]> 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 returns
3992 %  the image as a blob (a formatted "file" in memory) and its length, starting
3993 %  from the current position in the image sequence.  Use MagickSetImageFormat() 
3994 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3995 %
3996 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3997 %  the image sequence.
3998 %
3999 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
4000 %
4001 %  The format of the MagickGetImageBlob method is:
4002 %
4003 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4004 %
4005 %  A description of each parameter follows:
4006 %
4007 %    o wand: the magick wand.
4008 %
4009 %    o length: the length of the blob.
4010 %
4011 */
4012 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4013 {
4014   assert(wand != (MagickWand *) NULL);
4015   assert(wand->signature == WandSignature);
4016   if (wand->debug != MagickFalse)
4017     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4018   if (wand->images == (Image *) NULL)
4019     {
4020       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4021         "ContainsNoImages","`%s'",wand->name);
4022       return((unsigned char *) NULL);
4023     }
4024   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
4025 }
4026 \f
4027 /*
4028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4029 %                                                                             %
4030 %                                                                             %
4031 %                                                                             %
4032 %   M a g i c k G e t I m a g e s B l o b                                     %
4033 %                                                                             %
4034 %                                                                             %
4035 %                                                                             %
4036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4037 %
4038 %  MagickGetImageBlob() implements direct to memory image formats.  It
4039 %  returns the image sequence as a blob and its length.  The format of the image
4040 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
4041 %  return a different image format, use MagickSetImageFormat().
4042 %
4043 %  Note, some image formats do not permit multiple images to the same image
4044 %  stream (e.g. JPEG).  in this instance, just the first image of the
4045 %  sequence is returned as a blob.
4046 %
4047 %  The format of the MagickGetImagesBlob method is:
4048 %
4049 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4050 %
4051 %  A description of each parameter follows:
4052 %
4053 %    o wand: the magick wand.
4054 %
4055 %    o length: the length of the blob.
4056 %
4057 */
4058 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4059 {
4060   unsigned char
4061     *blob;
4062
4063   assert(wand != (MagickWand *) NULL);
4064   assert(wand->signature == WandSignature);
4065   if (wand->debug != MagickFalse)
4066     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4067   if (wand->images == (Image *) NULL)
4068     {
4069       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4070         "ContainsNoImages","`%s'",wand->name);
4071       return((unsigned char *) NULL);
4072     }
4073   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
4074     wand->exception);
4075   return(blob);
4076 }
4077 \f
4078 /*
4079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4080 %                                                                             %
4081 %                                                                             %
4082 %                                                                             %
4083 %   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                         %
4084 %                                                                             %
4085 %                                                                             %
4086 %                                                                             %
4087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4088 %
4089 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4090 %  image.
4091 %
4092 %  The format of the MagickGetImageBluePrimary method is:
4093 %
4094 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4095 %        double *y)
4096 %
4097 %  A description of each parameter follows:
4098 %
4099 %    o wand: the magick wand.
4100 %
4101 %    o x: the chromaticity blue primary x-point.
4102 %
4103 %    o y: the chromaticity blue primary y-point.
4104 %
4105 */
4106 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4107   double *x,double *y)
4108 {
4109   assert(wand != (MagickWand *) NULL);
4110   assert(wand->signature == WandSignature);
4111   if (wand->debug != MagickFalse)
4112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4113   if (wand->images == (Image *) NULL)
4114     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4115   *x=wand->images->chromaticity.blue_primary.x;
4116   *y=wand->images->chromaticity.blue_primary.y;
4117   return(MagickTrue);
4118 }
4119 \f
4120 /*
4121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4122 %                                                                             %
4123 %                                                                             %
4124 %                                                                             %
4125 %   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                         %
4126 %                                                                             %
4127 %                                                                             %
4128 %                                                                             %
4129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4130 %
4131 %  MagickGetImageBorderColor() returns the image border color.
4132 %
4133 %  The format of the MagickGetImageBorderColor method is:
4134 %
4135 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4136 %        PixelWand *border_color)
4137 %
4138 %  A description of each parameter follows:
4139 %
4140 %    o wand: the magick wand.
4141 %
4142 %    o border_color: Return the border color.
4143 %
4144 */
4145 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4146   PixelWand *border_color)
4147 {
4148   assert(wand != (MagickWand *) NULL);
4149   assert(wand->signature == WandSignature);
4150   if (wand->debug != MagickFalse)
4151     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4152   if (wand->images == (Image *) NULL)
4153     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4154   PixelSetQuantumColor(border_color,&wand->images->border_color);
4155   return(MagickTrue);
4156 }
4157 \f
4158 /*
4159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4160 %                                                                             %
4161 %                                                                             %
4162 %                                                                             %
4163 %   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                       %
4164 %                                                                             %
4165 %                                                                             %
4166 %                                                                             %
4167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4168 %
4169 %  MagickGetImageChannelDepth() gets the depth for one or more image channels.
4170 %
4171 %  The format of the MagickGetImageChannelDepth method is:
4172 %
4173 %      size_t MagickGetImageChannelDepth(MagickWand *wand,
4174 %        const ChannelType channel)
4175 %
4176 %  A description of each parameter follows:
4177 %
4178 %    o wand: the magick wand.
4179 %
4180 %    o channel: the image channel(s).
4181 %
4182 */
4183 WandExport size_t MagickGetImageChannelDepth(MagickWand *wand,
4184   const ChannelType channel)
4185 {
4186   assert(wand != (MagickWand *) NULL);
4187   assert(wand->signature == WandSignature);
4188   if (wand->debug != MagickFalse)
4189     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4190   if (wand->images == (Image *) NULL)
4191     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4192   return(GetImageChannelDepth(wand->images,channel,wand->exception));
4193 }
4194 \f
4195 /*
4196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4197 %                                                                             %
4198 %                                                                             %
4199 %                                                                             %
4200 %   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             %
4201 %                                                                             %
4202 %                                                                             %
4203 %                                                                             %
4204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4205 %
4206 %  MagickGetImageChannelDistortion() compares one or more image channels of an
4207 %  image to a reconstructed image and returns the specified distortion metric.
4208 %
4209 %  The format of the MagickGetImageChannelDistortion method is:
4210 %
4211 %      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4212 %        const MagickWand *reference,const ChannelType channel,
4213 %        const MetricType metric,double *distortion)
4214 %
4215 %  A description of each parameter follows:
4216 %
4217 %    o wand: the magick wand.
4218 %
4219 %    o reference: the reference wand.
4220 %
4221 %    o channel: the channel.
4222 %
4223 %    o metric: the metric.
4224 %
4225 %    o distortion: the computed distortion between the images.
4226 %
4227 */
4228 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4229   const MagickWand *reference,const ChannelType channel,const MetricType metric,
4230   double *distortion)
4231 {
4232   MagickBooleanType
4233     status;
4234
4235   assert(wand != (MagickWand *) NULL);
4236   assert(wand->signature == WandSignature);
4237   if (wand->debug != MagickFalse)
4238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4239   assert(reference != (MagickWand *) NULL);
4240   assert(reference->signature == WandSignature);
4241   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4242     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4243   status=GetImageChannelDistortion(wand->images,reference->images,channel,
4244     metric,distortion,&wand->images->exception);
4245   return(status);
4246 }
4247 \f
4248 /*
4249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4250 %                                                                             %
4251 %                                                                             %
4252 %                                                                             %
4253 %   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           %
4254 %                                                                             %
4255 %                                                                             %
4256 %                                                                             %
4257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4258 %
4259 %  MagickGetImageChannelDistortions() compares one or more image channels of an
4260 %  image to a reconstructed image and returns the specified distortion metrics.
4261 %
4262 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4263 %
4264 %  The format of the MagickGetImageChannelDistortion method is:
4265 %
4266 %      double *MagickGetImageChannelDistortion(MagickWand *wand,
4267 %        const MagickWand *reference,const MetricType metric)
4268 %
4269 %  A description of each parameter follows:
4270 %
4271 %    o wand: the magick wand.
4272 %
4273 %    o reference: the reference wand.
4274 %
4275 %    o metric: the metric.
4276 %
4277 */
4278 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4279   const MagickWand *reference,const MetricType metric)
4280 {
4281   double
4282     *channel_distortion;
4283
4284   assert(wand != (MagickWand *) NULL);
4285   assert(wand->signature == WandSignature);
4286   if (wand->debug != MagickFalse)
4287     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4288   assert(reference != (MagickWand *) NULL);
4289   assert(reference->signature == WandSignature);
4290   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4291     {
4292       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4293         "ContainsNoImages","`%s'",wand->name);
4294       return((double *) NULL);
4295     }
4296   channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4297     metric,&wand->images->exception);
4298   return(channel_distortion);
4299 }
4300 \f
4301 /*
4302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4303 %                                                                             %
4304 %                                                                             %
4305 %                                                                             %
4306 %   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                 %
4307 %                                                                             %
4308 %                                                                             %
4309 %                                                                             %
4310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4311 %
4312 %  MagickGetImageChannelFeatures() returns features for each channel in the
4313 %  image in each of four directions (horizontal, vertical, left and right
4314 %  diagonals) for the specified distance.  The features include the angular
4315 %  second moment, contrast, correlation, sum of squares: variance, inverse
4316 %  difference moment, sum average, sum varience, sum entropy, entropy,
4317 %  difference variance, difference entropy, information measures of
4318 %  correlation 1, information measures of correlation 2, and maximum
4319 %  correlation coefficient.  You can access the red channel contrast, for
4320 %  example, like this:
4321 %
4322 %      channel_features=MagickGetImageChannelFeatures(wand,1);
4323 %      contrast=channel_features[RedChannel].contrast[0];
4324 %
4325 %  Use MagickRelinquishMemory() to free the statistics buffer.
4326 %
4327 %  The format of the MagickGetImageChannelFeatures method is:
4328 %
4329 %      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4330 %        const size_t distance)
4331 %
4332 %  A description of each parameter follows:
4333 %
4334 %    o wand: the magick wand.
4335 %
4336 %    o distance: the distance.
4337 %
4338 */
4339 WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4340   const size_t distance)
4341 {
4342   assert(wand != (MagickWand *) NULL);
4343   assert(wand->signature == WandSignature);
4344   if (wand->debug != MagickFalse)
4345     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4346   if (wand->images == (Image *) NULL)
4347     {
4348       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4349         "ContainsNoImages","`%s'",wand->name);
4350       return((ChannelFeatures *) NULL);
4351     }
4352   return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4353 }
4354 \f
4355 /*
4356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4357 %                                                                             %
4358 %                                                                             %
4359 %                                                                             %
4360 %   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                 %
4361 %                                                                             %
4362 %                                                                             %
4363 %                                                                             %
4364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4365 %
4366 %  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4367 %  more image channels.
4368 %
4369 %  The format of the MagickGetImageChannelKurtosis method is:
4370 %
4371 %      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4372 %        const ChannelType channel,double *kurtosis,double *skewness)
4373 %
4374 %  A description of each parameter follows:
4375 %
4376 %    o wand: the magick wand.
4377 %
4378 %    o channel: the image channel(s).
4379 %
4380 %    o kurtosis:  The kurtosis for the specified channel(s).
4381 %
4382 %    o skewness:  The skewness for the specified channel(s).
4383 %
4384 */
4385 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4386   const ChannelType channel,double *kurtosis,double *skewness)
4387 {
4388   MagickBooleanType
4389     status;
4390
4391   assert(wand != (MagickWand *) NULL);
4392   assert(wand->signature == WandSignature);
4393   if (wand->debug != MagickFalse)
4394     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4395   if (wand->images == (Image *) NULL)
4396     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4397   status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4398     wand->exception);
4399   return(status);
4400 }
4401 \f
4402 /*
4403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4404 %                                                                             %
4405 %                                                                             %
4406 %                                                                             %
4407 %   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                         %
4408 %                                                                             %
4409 %                                                                             %
4410 %                                                                             %
4411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4412 %
4413 %  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4414 %  more image channels.
4415 %
4416 %  The format of the MagickGetImageChannelMean method is:
4417 %
4418 %      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4419 %        const ChannelType channel,double *mean,double *standard_deviation)
4420 %
4421 %  A description of each parameter follows:
4422 %
4423 %    o wand: the magick wand.
4424 %
4425 %    o channel: the image channel(s).
4426 %
4427 %    o mean:  The mean pixel value for the specified channel(s).
4428 %
4429 %    o standard_deviation:  The standard deviation for the specified channel(s).
4430 %
4431 */
4432 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4433   const ChannelType channel,double *mean,double *standard_deviation)
4434 {
4435   MagickBooleanType
4436     status;
4437
4438   assert(wand != (MagickWand *) NULL);
4439   assert(wand->signature == WandSignature);
4440   if (wand->debug != MagickFalse)
4441     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4442   if (wand->images == (Image *) NULL)
4443     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4444   status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4445     wand->exception);
4446   return(status);
4447 }
4448 \f
4449 /*
4450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4451 %                                                                             %
4452 %                                                                             %
4453 %                                                                             %
4454 %   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                       %
4455 %                                                                             %
4456 %                                                                             %
4457 %                                                                             %
4458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4459 %
4460 %  MagickGetImageChannelRange() gets the range for one or more image channels.
4461 %
4462 %  The format of the MagickGetImageChannelRange method is:
4463 %
4464 %      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4465 %        const ChannelType channel,double *minima,double *maxima)
4466 %
4467 %  A description of each parameter follows:
4468 %
4469 %    o wand: the magick wand.
4470 %
4471 %    o channel: the image channel(s).
4472 %
4473 %    o minima:  The minimum pixel value for the specified channel(s).
4474 %
4475 %    o maxima:  The maximum pixel value for the specified channel(s).
4476 %
4477 */
4478 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4479   const ChannelType channel,double *minima,double *maxima)
4480 {
4481   MagickBooleanType
4482     status;
4483
4484   assert(wand != (MagickWand *) NULL);
4485   assert(wand->signature == WandSignature);
4486   if (wand->debug != MagickFalse)
4487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4488   if (wand->images == (Image *) NULL)
4489     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4490   status=GetImageChannelRange(wand->images,channel,minima,maxima,
4491     wand->exception);
4492   return(status);
4493 }
4494 \f
4495 /*
4496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4497 %                                                                             %
4498 %                                                                             %
4499 %                                                                             %
4500 %   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             %
4501 %                                                                             %
4502 %                                                                             %
4503 %                                                                             %
4504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4505 %
4506 %  MagickGetImageChannelStatistics() returns statistics for each channel in the
4507 %  image.  The statistics include the channel depth, its minima and
4508 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4509 %  You can access the red channel mean, for example, like this:
4510 %
4511 %      channel_statistics=MagickGetImageChannelStatistics(wand);
4512 %      red_mean=channel_statistics[RedChannel].mean;
4513 %
4514 %  Use MagickRelinquishMemory() to free the statistics buffer.
4515 %
4516 %  The format of the MagickGetImageChannelStatistics method is:
4517 %
4518 %      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4519 %
4520 %  A description of each parameter follows:
4521 %
4522 %    o wand: the magick wand.
4523 %
4524 */
4525 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4526 {
4527   assert(wand != (MagickWand *) NULL);
4528   assert(wand->signature == WandSignature);
4529   if (wand->debug != MagickFalse)
4530     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4531   if (wand->images == (Image *) NULL)
4532     {
4533       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4534         "ContainsNoImages","`%s'",wand->name);
4535       return((ChannelStatistics *) NULL);
4536     }
4537   return(GetImageChannelStatistics(wand->images,wand->exception));
4538 }
4539 \f
4540 /*
4541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4542 %                                                                             %
4543 %                                                                             %
4544 %                                                                             %
4545 %   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                     %
4546 %                                                                             %
4547 %                                                                             %
4548 %                                                                             %
4549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4550 %
4551 %  MagickGetImageColormapColor() returns the color of the specified colormap
4552 %  index.
4553 %
4554 %  The format of the MagickGetImageColormapColor method is:
4555 %
4556 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4557 %        const size_t index,PixelWand *color)
4558 %
4559 %  A description of each parameter follows:
4560 %
4561 %    o wand: the magick wand.
4562 %
4563 %    o index: the offset into the image colormap.
4564 %
4565 %    o color: Return the colormap color in this wand.
4566 %
4567 */
4568 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4569   const size_t index,PixelWand *color)
4570 {
4571   assert(wand != (MagickWand *) NULL);
4572   assert(wand->signature == WandSignature);
4573   if (wand->debug != MagickFalse)
4574     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4575   if (wand->images == (Image *) NULL)
4576     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4577   if ((wand->images->colormap == (PixelPacket *) NULL) ||
4578       (index >= wand->images->colors))
4579     {
4580       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4581         "InvalidColormapIndex","`%s'",wand->name);
4582       return(MagickFalse);
4583     }
4584   PixelSetQuantumColor(color,wand->images->colormap+index);
4585   return(MagickTrue);
4586 }
4587 \f
4588 /*
4589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4590 %                                                                             %
4591 %                                                                             %
4592 %                                                                             %
4593 %   M a g i c k G e t I m a g e C o l o r s                                   %
4594 %                                                                             %
4595 %                                                                             %
4596 %                                                                             %
4597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4598 %
4599 %  MagickGetImageColors() gets the number of unique colors in the image.
4600 %
4601 %  The format of the MagickGetImageColors method is:
4602 %
4603 %      size_t MagickGetImageColors(MagickWand *wand)
4604 %
4605 %  A description of each parameter follows:
4606 %
4607 %    o wand: the magick wand.
4608 %
4609 */
4610 WandExport size_t MagickGetImageColors(MagickWand *wand)
4611 {
4612   assert(wand != (MagickWand *) NULL);
4613   assert(wand->signature == WandSignature);
4614   if (wand->debug != MagickFalse)
4615     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4616   if (wand->images == (Image *) NULL)
4617     {
4618       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4619         "ContainsNoImages","`%s'",wand->name);
4620       return(0);
4621     }
4622   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4623 }
4624 \f
4625 /*
4626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4627 %                                                                             %
4628 %                                                                             %
4629 %                                                                             %
4630 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4631 %                                                                             %
4632 %                                                                             %
4633 %                                                                             %
4634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4635 %
4636 %  MagickGetImageColorspace() gets the image colorspace.
4637 %
4638 %  The format of the MagickGetImageColorspace method is:
4639 %
4640 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4641 %
4642 %  A description of each parameter follows:
4643 %
4644 %    o wand: the magick wand.
4645 %
4646 */
4647 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4648 {
4649   assert(wand != (MagickWand *) NULL);
4650   assert(wand->signature == WandSignature);
4651   if (wand->debug != MagickFalse)
4652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4653   if (wand->images == (Image *) NULL)
4654     {
4655       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4656         "ContainsNoImages","`%s'",wand->name);
4657       return(UndefinedColorspace);
4658     }
4659   return(wand->images->colorspace);
4660 }
4661 \f
4662 /*
4663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4664 %                                                                             %
4665 %                                                                             %
4666 %                                                                             %
4667 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4668 %                                                                             %
4669 %                                                                             %
4670 %                                                                             %
4671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4672 %
4673 %  MagickGetImageCompose() returns the composite operator associated with the
4674 %  image.
4675 %
4676 %  The format of the MagickGetImageCompose method is:
4677 %
4678 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4679 %
4680 %  A description of each parameter follows:
4681 %
4682 %    o wand: the magick wand.
4683 %
4684 */
4685 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4686 {
4687   assert(wand != (MagickWand *) NULL);
4688   assert(wand->signature == WandSignature);
4689   if (wand->debug != MagickFalse)
4690     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4691   if (wand->images == (Image *) NULL)
4692     {
4693       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4694         "ContainsNoImages","`%s'",wand->name);
4695       return(UndefinedCompositeOp);
4696     }
4697   return(wand->images->compose);
4698 }
4699 \f
4700 /*
4701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4702 %                                                                             %
4703 %                                                                             %
4704 %                                                                             %
4705 %   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                         %
4706 %                                                                             %
4707 %                                                                             %
4708 %                                                                             %
4709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4710 %
4711 %  MagickGetImageCompression() gets the image compression.
4712 %
4713 %  The format of the MagickGetImageCompression method is:
4714 %
4715 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4716 %
4717 %  A description of each parameter follows:
4718 %
4719 %    o wand: the magick wand.
4720 %
4721 */
4722 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4723 {
4724   assert(wand != (MagickWand *) NULL);
4725   assert(wand->signature == WandSignature);
4726   if (wand->debug != MagickFalse)
4727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4728   if (wand->images == (Image *) NULL)
4729     {
4730       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4731         "ContainsNoImages","`%s'",wand->name);
4732       return(UndefinedCompression);
4733     }
4734   return(wand->images->compression);
4735 }
4736 \f
4737 /*
4738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4739 %                                                                             %
4740 %                                                                             %
4741 %                                                                             %
4742 %   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           %
4743 %                                                                             %
4744 %                                                                             %
4745 %                                                                             %
4746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4747 %
4748 %  MagickGetImageCompression() gets the image compression quality.
4749 %
4750 %  The format of the MagickGetImageCompression method is:
4751 %
4752 %      size_t MagickGetImageCompression(MagickWand *wand)
4753 %
4754 %  A description of each parameter follows:
4755 %
4756 %    o wand: the magick wand.
4757 %
4758 */
4759 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4760 {
4761   assert(wand != (MagickWand *) NULL);
4762   assert(wand->signature == WandSignature);
4763   if (wand->debug != MagickFalse)
4764     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4765   if (wand->images == (Image *) NULL)
4766     {
4767       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4768         "ContainsNoImages","`%s'",wand->name);
4769       return(0UL);
4770     }
4771   return(wand->images->quality);
4772 }
4773 \f
4774 /*
4775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4776 %                                                                             %
4777 %                                                                             %
4778 %                                                                             %
4779 %   M a g i c k G e t I m a g e D e l a y                                     %
4780 %                                                                             %
4781 %                                                                             %
4782 %                                                                             %
4783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4784 %
4785 %  MagickGetImageDelay() gets the image delay.
4786 %
4787 %  The format of the MagickGetImageDelay method is:
4788 %
4789 %      size_t MagickGetImageDelay(MagickWand *wand)
4790 %
4791 %  A description of each parameter follows:
4792 %
4793 %    o wand: the magick wand.
4794 %
4795 */
4796 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4797 {
4798   assert(wand != (MagickWand *) NULL);
4799   assert(wand->signature == WandSignature);
4800   if (wand->debug != MagickFalse)
4801     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4802   if (wand->images == (Image *) NULL)
4803     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4804   return(wand->images->delay);
4805 }
4806 \f
4807 /*
4808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4809 %                                                                             %
4810 %                                                                             %
4811 %                                                                             %
4812 %   M a g i c k G e t I m a g e D e p t h                                     %
4813 %                                                                             %
4814 %                                                                             %
4815 %                                                                             %
4816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4817 %
4818 %  MagickGetImageDepth() gets the image depth.
4819 %
4820 %  The format of the MagickGetImageDepth method is:
4821 %
4822 %      size_t MagickGetImageDepth(MagickWand *wand)
4823 %
4824 %  A description of each parameter follows:
4825 %
4826 %    o wand: the magick wand.
4827 %
4828 */
4829 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4830 {
4831   assert(wand != (MagickWand *) NULL);
4832   assert(wand->signature == WandSignature);
4833   if (wand->debug != MagickFalse)
4834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4835   if (wand->images == (Image *) NULL)
4836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4837   return(wand->images->depth);
4838 }
4839 \f
4840 /*
4841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4842 %                                                                             %
4843 %                                                                             %
4844 %                                                                             %
4845 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4846 %                                                                             %
4847 %                                                                             %
4848 %                                                                             %
4849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4850 %
4851 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4852 %  returns the specified distortion metric.
4853 %
4854 %  The format of the MagickGetImageDistortion method is:
4855 %
4856 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4857 %        const MagickWand *reference,const MetricType metric,
4858 %        double *distortion)
4859 %
4860 %  A description of each parameter follows:
4861 %
4862 %    o wand: the magick wand.
4863 %
4864 %    o reference: the reference wand.
4865 %
4866 %    o metric: the metric.
4867 %
4868 %    o distortion: the computed distortion between the images.
4869 %
4870 */
4871 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4872   const MagickWand *reference,const MetricType metric,double *distortion)
4873 {
4874   MagickBooleanType
4875     status;
4876
4877
4878   assert(wand != (MagickWand *) NULL);
4879   assert(wand->signature == WandSignature);
4880   if (wand->debug != MagickFalse)
4881     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4882   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4883     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4884   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4885     &wand->images->exception);
4886   return(status);
4887 }
4888 \f
4889 /*
4890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4891 %                                                                             %
4892 %                                                                             %
4893 %                                                                             %
4894 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4895 %                                                                             %
4896 %                                                                             %
4897 %                                                                             %
4898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4899 %
4900 %  MagickGetImageDispose() gets the image disposal method.
4901 %
4902 %  The format of the MagickGetImageDispose method is:
4903 %
4904 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4905 %
4906 %  A description of each parameter follows:
4907 %
4908 %    o wand: the magick wand.
4909 %
4910 */
4911 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4912 {
4913   assert(wand != (MagickWand *) NULL);
4914   assert(wand->signature == WandSignature);
4915   if (wand->debug != MagickFalse)
4916     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4917   if (wand->images == (Image *) NULL)
4918     {
4919       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4920         "ContainsNoImages","`%s'",wand->name);
4921       return(UndefinedDispose);
4922     }
4923   return((DisposeType) wand->images->dispose);
4924 }
4925 \f
4926 /*
4927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4928 %                                                                             %
4929 %                                                                             %
4930 %                                                                             %
4931 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4932 %                                                                             %
4933 %                                                                             %
4934 %                                                                             %
4935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4936 %
4937 %  MagickGetImageFilename() returns the filename of a particular image in a
4938 %  sequence.
4939 %
4940 %  The format of the MagickGetImageFilename method is:
4941 %
4942 %      char *MagickGetImageFilename(MagickWand *wand)
4943 %
4944 %  A description of each parameter follows:
4945 %
4946 %    o wand: the magick wand.
4947 %
4948 */
4949 WandExport char *MagickGetImageFilename(MagickWand *wand)
4950 {
4951   assert(wand != (MagickWand *) NULL);
4952   assert(wand->signature == WandSignature);
4953   if (wand->debug != MagickFalse)
4954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4955   if (wand->images == (Image *) NULL)
4956     {
4957       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4958         "ContainsNoImages","`%s'",wand->name);
4959       return((char *) NULL);
4960     }
4961   return(AcquireString(wand->images->filename));
4962 }
4963 \f
4964 /*
4965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4966 %                                                                             %
4967 %                                                                             %
4968 %                                                                             %
4969 %   M a g i c k G e t I m a g e F o r m a t                                   %
4970 %                                                                             %
4971 %                                                                             %
4972 %                                                                             %
4973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4974 %
4975 %  MagickGetImageFormat() returns the format of a particular image in a
4976 %  sequence.
4977 %
4978 %  The format of the MagickGetImageFormat method is:
4979 %
4980 %      const char *MagickGetImageFormat(MagickWand *wand)
4981 %
4982 %  A description of each parameter follows:
4983 %
4984 %    o wand: the magick wand.
4985 %
4986 */
4987 WandExport char *MagickGetImageFormat(MagickWand *wand)
4988 {
4989   assert(wand != (MagickWand *) NULL);
4990   assert(wand->signature == WandSignature);
4991   if (wand->debug != MagickFalse)
4992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4993   if (wand->images == (Image *) NULL)
4994     {
4995       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4996         "ContainsNoImages","`%s'",wand->name);
4997       return((char *) NULL);
4998     }
4999   return(AcquireString(wand->images->magick));
5000 }
5001 \f
5002 /*
5003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5004 %                                                                             %
5005 %                                                                             %
5006 %                                                                             %
5007 %   M a g i c k G e t I m a g e F u z z                                       %
5008 %                                                                             %
5009 %                                                                             %
5010 %                                                                             %
5011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5012 %
5013 %  MagickGetImageFuzz() gets the image fuzz.
5014 %
5015 %  The format of the MagickGetImageFuzz method is:
5016 %
5017 %      double MagickGetImageFuzz(MagickWand *wand)
5018 %
5019 %  A description of each parameter follows:
5020 %
5021 %    o wand: the magick wand.
5022 %
5023 */
5024 WandExport double MagickGetImageFuzz(MagickWand *wand)
5025 {
5026   assert(wand != (MagickWand *) NULL);
5027   assert(wand->signature == WandSignature);
5028   if (wand->debug != MagickFalse)
5029     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5030   if (wand->images == (Image *) NULL)
5031     {
5032       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5033         "ContainsNoImages","`%s'",wand->name);
5034       return(0.0);
5035     }
5036   return(wand->images->fuzz);
5037 }
5038 \f
5039 /*
5040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5041 %                                                                             %
5042 %                                                                             %
5043 %                                                                             %
5044 %   M a g i c k G e t I m a g e G a m m a                                     %
5045 %                                                                             %
5046 %                                                                             %
5047 %                                                                             %
5048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5049 %
5050 %  MagickGetImageGamma() gets the image gamma.
5051 %
5052 %  The format of the MagickGetImageGamma method is:
5053 %
5054 %      double MagickGetImageGamma(MagickWand *wand)
5055 %
5056 %  A description of each parameter follows:
5057 %
5058 %    o wand: the magick wand.
5059 %
5060 */
5061 WandExport double MagickGetImageGamma(MagickWand *wand)
5062 {
5063   assert(wand != (MagickWand *) NULL);
5064   assert(wand->signature == WandSignature);
5065   if (wand->debug != MagickFalse)
5066     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5067   if (wand->images == (Image *) NULL)
5068     {
5069       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5070         "ContainsNoImages","`%s'",wand->name);
5071       return(0.0);
5072     }
5073   return(wand->images->gamma);
5074 }
5075 \f
5076 /*
5077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5078 %                                                                             %
5079 %                                                                             %
5080 %                                                                             %
5081 %   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                 %
5082 %                                                                             %
5083 %                                                                             %
5084 %                                                                             %
5085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5086 %
5087 %  MagickGetImageGravity() gets the image gravity.
5088 %
5089 %  The format of the MagickGetImageGravity method is:
5090 %
5091 %      GravityType MagickGetImageGravity(MagickWand *wand)
5092 %
5093 %  A description of each parameter follows:
5094 %
5095 %    o wand: the magick wand.
5096 %
5097 */
5098 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5099 {
5100   assert(wand != (MagickWand *) NULL);
5101   assert(wand->signature == WandSignature);
5102   if (wand->debug != MagickFalse)
5103     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5104   if (wand->images == (Image *) NULL)
5105     {
5106       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5107         "ContainsNoImages","`%s'",wand->name);
5108       return(UndefinedGravity);
5109     }
5110   return(wand->images->gravity);
5111 }
5112 \f
5113 /*
5114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5115 %                                                                             %
5116 %                                                                             %
5117 %                                                                             %
5118 %   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                       %
5119 %                                                                             %
5120 %                                                                             %
5121 %                                                                             %
5122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5123 %
5124 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5125 %
5126 %  The format of the MagickGetImageGreenPrimary method is:
5127 %
5128 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5129 %        double *y)
5130 %
5131 %  A description of each parameter follows:
5132 %
5133 %    o wand: the magick wand.
5134 %
5135 %    o x: the chromaticity green primary x-point.
5136 %
5137 %    o y: the chromaticity green primary y-point.
5138 %
5139 */
5140 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5141   double *x,double *y)
5142 {
5143   assert(wand != (MagickWand *) NULL);
5144   assert(wand->signature == WandSignature);
5145   if (wand->debug != MagickFalse)
5146     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5147   if (wand->images == (Image *) NULL)
5148     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5149   *x=wand->images->chromaticity.green_primary.x;
5150   *y=wand->images->chromaticity.green_primary.y;
5151   return(MagickTrue);
5152 }
5153 \f
5154 /*
5155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5156 %                                                                             %
5157 %                                                                             %
5158 %                                                                             %
5159 %   M a g i c k G e t I m a g e H e i g h t                                   %
5160 %                                                                             %
5161 %                                                                             %
5162 %                                                                             %
5163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5164 %
5165 %  MagickGetImageHeight() returns the image height.
5166 %
5167 %  The format of the MagickGetImageHeight method is:
5168 %
5169 %      size_t MagickGetImageHeight(MagickWand *wand)
5170 %
5171 %  A description of each parameter follows:
5172 %
5173 %    o wand: the magick wand.
5174 %
5175 */
5176 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5177 {
5178   assert(wand != (MagickWand *) NULL);
5179   assert(wand->signature == WandSignature);
5180   if (wand->debug != MagickFalse)
5181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5182   if (wand->images == (Image *) NULL)
5183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5184   return(wand->images->rows);
5185 }
5186 \f
5187 /*
5188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5189 %                                                                             %
5190 %                                                                             %
5191 %                                                                             %
5192 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
5193 %                                                                             %
5194 %                                                                             %
5195 %                                                                             %
5196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5197 %
5198 %  MagickGetImageHistogram() returns the image histogram as an array of
5199 %  PixelWand wands.
5200 %
5201 %  The format of the MagickGetImageHistogram method is:
5202 %
5203 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5204 %        size_t *number_colors)
5205 %
5206 %  A description of each parameter follows:
5207 %
5208 %    o wand: the magick wand.
5209 %
5210 %    o number_colors: the number of unique colors in the image and the number
5211 %      of pixel wands returned.
5212 %
5213 */
5214 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5215   size_t *number_colors)
5216 {
5217   ColorPacket
5218     *histogram;
5219
5220   PixelWand
5221     **pixel_wands;
5222
5223   register ssize_t
5224     i;
5225
5226   assert(wand != (MagickWand *) NULL);
5227   assert(wand->signature == WandSignature);
5228   if (wand->debug != MagickFalse)
5229     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5230   if (wand->images == (Image *) NULL)
5231     {
5232       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5233         "ContainsNoImages","`%s'",wand->name);
5234       return((PixelWand **) NULL);
5235     }
5236   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5237   if (histogram == (ColorPacket *) NULL)
5238     return((PixelWand **) NULL);
5239   pixel_wands=NewPixelWands(*number_colors);
5240   for (i=0; i < (ssize_t) *number_colors; i++)
5241   {
5242     PixelSetQuantumColor(pixel_wands[i],&histogram[i].pixel);
5243     PixelSetIndex(pixel_wands[i],histogram[i].index);
5244     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5245   }
5246   histogram=(ColorPacket *) RelinquishMagickMemory(histogram);
5247   return(pixel_wands);
5248 }
5249 \f
5250 /*
5251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5252 %                                                                             %
5253 %                                                                             %
5254 %                                                                             %
5255 %   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                 %
5256 %                                                                             %
5257 %                                                                             %
5258 %                                                                             %
5259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5260 %
5261 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5262 %
5263 %  The format of the MagickGetImageInterlaceScheme method is:
5264 %
5265 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5266 %
5267 %  A description of each parameter follows:
5268 %
5269 %    o wand: the magick wand.
5270 %
5271 */
5272 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5273 {
5274   assert(wand != (MagickWand *) NULL);
5275   assert(wand->signature == WandSignature);
5276   if (wand->debug != MagickFalse)
5277     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5278   if (wand->images == (Image *) NULL)
5279     {
5280       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5281         "ContainsNoImages","`%s'",wand->name);
5282       return(UndefinedInterlace);
5283     }
5284   return(wand->images->interlace);
5285 }
5286 \f
5287 /*
5288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5289 %                                                                             %
5290 %                                                                             %
5291 %                                                                             %
5292 %   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             %
5293 %                                                                             %
5294 %                                                                             %
5295 %                                                                             %
5296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5297 %
5298 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5299 %  sepcified image.
5300 %
5301 %  The format of the MagickGetImageInterpolateMethod method is:
5302 %
5303 %      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5304 %
5305 %  A description of each parameter follows:
5306 %
5307 %    o wand: the magick wand.
5308 %
5309 */
5310 WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5311   MagickWand *wand)
5312 {
5313   assert(wand != (MagickWand *) NULL);
5314   assert(wand->signature == WandSignature);
5315   if (wand->debug != MagickFalse)
5316     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5317   if (wand->images == (Image *) NULL)
5318     {
5319       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5320         "ContainsNoImages","`%s'",wand->name);
5321       return(UndefinedInterpolatePixel);
5322     }
5323   return(wand->images->interpolate);
5324 }
5325 \f
5326 /*
5327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5328 %                                                                             %
5329 %                                                                             %
5330 %                                                                             %
5331 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5332 %                                                                             %
5333 %                                                                             %
5334 %                                                                             %
5335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5336 %
5337 %  MagickGetImageIterations() gets the image iterations.
5338 %
5339 %  The format of the MagickGetImageIterations method is:
5340 %
5341 %      size_t MagickGetImageIterations(MagickWand *wand)
5342 %
5343 %  A description of each parameter follows:
5344 %
5345 %    o wand: the magick wand.
5346 %
5347 */
5348 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5349 {
5350   assert(wand != (MagickWand *) NULL);
5351   assert(wand->signature == WandSignature);
5352   if (wand->debug != MagickFalse)
5353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5354   if (wand->images == (Image *) NULL)
5355     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5356   return(wand->images->iterations);
5357 }
5358 \f
5359 /*
5360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5361 %                                                                             %
5362 %                                                                             %
5363 %                                                                             %
5364 %   M a g i c k G e t I m a g e L e n g t h                                   %
5365 %                                                                             %
5366 %                                                                             %
5367 %                                                                             %
5368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5369 %
5370 %  MagickGetImageLength() returns the image length in bytes.
5371 %
5372 %  The format of the MagickGetImageLength method is:
5373 %
5374 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5375 %        MagickSizeType *length)
5376 %
5377 %  A description of each parameter follows:
5378 %
5379 %    o wand: the magick wand.
5380 %
5381 %    o length: the image length in bytes.
5382 %
5383 */
5384 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5385   MagickSizeType *length)
5386 {
5387   assert(wand != (MagickWand *) NULL);
5388   assert(wand->signature == WandSignature);
5389   if (wand->debug != MagickFalse)
5390     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5391   if (wand->images == (Image *) NULL)
5392     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5393   *length=GetBlobSize(wand->images);
5394   return(MagickTrue);
5395 }
5396 \f
5397 /*
5398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5399 %                                                                             %
5400 %                                                                             %
5401 %                                                                             %
5402 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5403 %                                                                             %
5404 %                                                                             %
5405 %                                                                             %
5406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5407 %
5408 %  MagickGetImageMatteColor() returns the image matte color.
5409 %
5410 %  The format of the MagickGetImageMatteColor method is:
5411 %
5412 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5413 %        PixelWand *matte_color)
5414 %
5415 %  A description of each parameter follows:
5416 %
5417 %    o wand: the magick wand.
5418 %
5419 %    o matte_color: Return the matte color.
5420 %
5421 */
5422 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5423   PixelWand *matte_color)
5424 {
5425   assert(wand != (MagickWand *) NULL);
5426   assert(wand->signature == WandSignature);
5427   if (wand->debug != MagickFalse)
5428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5429   if (wand->images == (Image *) NULL)
5430     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5431   PixelSetQuantumColor(matte_color,&wand->images->matte_color);
5432   return(MagickTrue);
5433 }
5434 \f
5435 /*
5436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5437 %                                                                             %
5438 %                                                                             %
5439 %                                                                             %
5440 %   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                         %
5441 %                                                                             %
5442 %                                                                             %
5443 %                                                                             %
5444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5445 %
5446 %  MagickGetImageOrientation() returns the image orientation.
5447 %
5448 %  The format of the MagickGetImageOrientation method is:
5449 %
5450 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5451 %
5452 %  A description of each parameter follows:
5453 %
5454 %    o wand: the magick wand.
5455 %
5456 */
5457 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5458 {
5459   assert(wand != (MagickWand *) NULL);
5460   assert(wand->signature == WandSignature);
5461   if (wand->debug != MagickFalse)
5462     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5463   if (wand->images == (Image *) NULL)
5464     {
5465       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5466         "ContainsNoImages","`%s'",wand->name);
5467       return(UndefinedOrientation);
5468     }
5469   return(wand->images->orientation);
5470 }
5471 \f
5472 /*
5473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5474 %                                                                             %
5475 %                                                                             %
5476 %                                                                             %
5477 %   M a g i c k G e t I m a g e P a g e                                       %
5478 %                                                                             %
5479 %                                                                             %
5480 %                                                                             %
5481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5482 %
5483 %  MagickGetImagePage() returns the page geometry associated with the image.
5484 %
5485 %  The format of the MagickGetImagePage method is:
5486 %
5487 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5488 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5489 %
5490 %  A description of each parameter follows:
5491 %
5492 %    o wand: the magick wand.
5493 %
5494 %    o width: the page width.
5495 %
5496 %    o height: the page height.
5497 %
5498 %    o x: the page x-offset.
5499 %
5500 %    o y: the page y-offset.
5501 %
5502 */
5503 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5504   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5505 {
5506   assert(wand != (const MagickWand *) NULL);
5507   assert(wand->signature == WandSignature);
5508   if (wand->debug != MagickFalse)
5509     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5510   if (wand->images == (Image *) NULL)
5511     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5512   *width=wand->images->page.width;
5513   *height=wand->images->page.height;
5514   *x=wand->images->page.x;
5515   *y=wand->images->page.y;
5516   return(MagickTrue);
5517 }
5518 \f
5519 /*
5520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5521 %                                                                             %
5522 %                                                                             %
5523 %                                                                             %
5524 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5525 %                                                                             %
5526 %                                                                             %
5527 %                                                                             %
5528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5529 %
5530 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5531 %
5532 %  The format of the MagickGetImagePixelColor method is:
5533 %
5534 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5535 %        const ssize_t x,const ssize_t y,PixelWand *color)
5536 %
5537 %  A description of each parameter follows:
5538 %
5539 %    o wand: the magick wand.
5540 %
5541 %    o x,y: the pixel offset into the image.
5542 %
5543 %    o color: Return the colormap color in this wand.
5544 %
5545 */
5546 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5547   const ssize_t x,const ssize_t y,PixelWand *color)
5548 {
5549   IndexPacket
5550     *indexes;
5551
5552   register const PixelPacket
5553     *p;
5554
5555   CacheView
5556     *image_view;
5557
5558   assert(wand != (MagickWand *) NULL);
5559   assert(wand->signature == WandSignature);
5560   if (wand->debug != MagickFalse)
5561     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5562   if (wand->images == (Image *) NULL)
5563     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5564   image_view=AcquireCacheView(wand->images);
5565   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5566   if (p == (const PixelPacket *) NULL)
5567     {
5568       image_view=DestroyCacheView(image_view);
5569       return(MagickFalse);
5570     }
5571   indexes=GetCacheViewAuthenticIndexQueue(image_view);
5572   PixelSetQuantumColor(color,p);
5573   if (GetCacheViewColorspace(image_view) == CMYKColorspace)
5574     PixelSetBlackQuantum(color,*indexes);
5575   else
5576     if (GetCacheViewStorageClass(image_view) == PseudoClass)
5577       PixelSetIndex(color,*indexes);
5578   image_view=DestroyCacheView(image_view);
5579   return(MagickTrue);
5580 }
5581 \f
5582 /*
5583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5584 %                                                                             %
5585 %                                                                             %
5586 %                                                                             %
5587 +   M a g i c k G e t I m a g e R a n g e                                     %
5588 %                                                                             %
5589 %                                                                             %
5590 %                                                                             %
5591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5592 %
5593 %  MagickGetImageRange() gets the pixel range for the image.
5594 %
5595 %  The format of the MagickGetImageRange method is:
5596 %
5597 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5598 %        double *maxima)
5599 %
5600 %  A description of each parameter follows:
5601 %
5602 %    o wand: the magick wand.
5603 %
5604 %    o minima:  The minimum pixel value for the specified channel(s).
5605 %
5606 %    o maxima:  The maximum pixel value for the specified channel(s).
5607 %
5608 */
5609 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5610   double *minima,double *maxima)
5611 {
5612   MagickBooleanType
5613     status;
5614
5615   assert(wand != (MagickWand *) NULL);
5616   assert(wand->signature == WandSignature);
5617   if (wand->debug != MagickFalse)
5618     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5619   if (wand->images == (Image *) NULL)
5620     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5621   status=GetImageRange(wand->images,minima,maxima,wand->exception);
5622   return(status);
5623 }
5624 \f
5625 /*
5626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5627 %                                                                             %
5628 %                                                                             %
5629 %                                                                             %
5630 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5631 %                                                                             %
5632 %                                                                             %
5633 %                                                                             %
5634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5635 %
5636 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5637 %
5638 %  The format of the MagickGetImageRedPrimary method is:
5639 %
5640 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5641 %        double *y)
5642 %
5643 %  A description of each parameter follows:
5644 %
5645 %    o wand: the magick wand.
5646 %
5647 %    o x: the chromaticity red primary x-point.
5648 %
5649 %    o y: the chromaticity red primary y-point.
5650 %
5651 */
5652 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5653   double *x,double *y)
5654 {
5655   assert(wand != (MagickWand *) NULL);
5656   assert(wand->signature == WandSignature);
5657   if (wand->debug != MagickFalse)
5658     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5659   if (wand->images == (Image *) NULL)
5660     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5661   *x=wand->images->chromaticity.red_primary.x;
5662   *y=wand->images->chromaticity.red_primary.y;
5663   return(MagickTrue);
5664 }
5665 \f
5666 /*
5667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5668 %                                                                             %
5669 %                                                                             %
5670 %                                                                             %
5671 %   M a g i c k G e t I m a g e R e g i o n                                   %
5672 %                                                                             %
5673 %                                                                             %
5674 %                                                                             %
5675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5676 %
5677 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5678 %  a new wand.
5679 %
5680 %  The format of the MagickGetImageRegion method is:
5681 %
5682 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5683 %        const size_t width,const size_t height,const ssize_t x,
5684 %        const ssize_t y)
5685 %
5686 %  A description of each parameter follows:
5687 %
5688 %    o wand: the magick wand.
5689 %
5690 %    o width: the region width.
5691 %
5692 %    o height: the region height.
5693 %
5694 %    o x: the region x offset.
5695 %
5696 %    o y: the region y offset.
5697 %
5698 */
5699 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5700   const size_t width,const size_t height,const ssize_t x,
5701   const ssize_t y)
5702 {
5703   Image
5704     *region_image;
5705
5706   RectangleInfo
5707     region;
5708
5709   assert(wand != (MagickWand *) NULL);
5710   assert(wand->signature == WandSignature);
5711   if (wand->debug != MagickFalse)
5712     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5713   if (wand->images == (Image *) NULL)
5714     return((MagickWand *) NULL);
5715   region.width=width;
5716   region.height=height;
5717   region.x=x;
5718   region.y=y;
5719   region_image=CropImage(wand->images,&region,wand->exception);
5720   if (region_image == (Image *) NULL)
5721     return((MagickWand *) NULL);
5722   return(CloneMagickWandFromImages(wand,region_image));
5723 }
5724 \f
5725 /*
5726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5727 %                                                                             %
5728 %                                                                             %
5729 %                                                                             %
5730 %   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                 %
5731 %                                                                             %
5732 %                                                                             %
5733 %                                                                             %
5734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5735 %
5736 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5737 %
5738 %  The format of the MagickGetImageRenderingIntent method is:
5739 %
5740 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5741 %
5742 %  A description of each parameter follows:
5743 %
5744 %    o wand: the magick wand.
5745 %
5746 */
5747 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5748 {
5749   assert(wand != (MagickWand *) NULL);
5750   assert(wand->signature == WandSignature);
5751   if (wand->debug != MagickFalse)
5752     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5753   if (wand->images == (Image *) NULL)
5754     {
5755       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5756         "ContainsNoImages","`%s'",wand->name);
5757       return(UndefinedIntent);
5758     }
5759   return((RenderingIntent) wand->images->rendering_intent);
5760 }
5761 \f
5762 /*
5763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5764 %                                                                             %
5765 %                                                                             %
5766 %                                                                             %
5767 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5768 %                                                                             %
5769 %                                                                             %
5770 %                                                                             %
5771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5772 %
5773 %  MagickGetImageResolution() gets the image X and Y resolution.
5774 %
5775 %  The format of the MagickGetImageResolution method is:
5776 %
5777 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5778 %        double *y)
5779 %
5780 %  A description of each parameter follows:
5781 %
5782 %    o wand: the magick wand.
5783 %
5784 %    o x: the image x-resolution.
5785 %
5786 %    o y: the image y-resolution.
5787 %
5788 */
5789 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5790   double *x,double *y)
5791 {
5792   assert(wand != (MagickWand *) NULL);
5793   assert(wand->signature == WandSignature);
5794   if (wand->debug != MagickFalse)
5795     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5796   if (wand->images == (Image *) NULL)
5797     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5798   *x=wand->images->x_resolution;
5799   *y=wand->images->y_resolution;
5800   return(MagickTrue);
5801 }
5802 \f
5803 /*
5804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5805 %                                                                             %
5806 %                                                                             %
5807 %                                                                             %
5808 %   M a g i c k G e t I m a g e S c e n e                                     %
5809 %                                                                             %
5810 %                                                                             %
5811 %                                                                             %
5812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5813 %
5814 %  MagickGetImageScene() gets the image scene.
5815 %
5816 %  The format of the MagickGetImageScene method is:
5817 %
5818 %      size_t MagickGetImageScene(MagickWand *wand)
5819 %
5820 %  A description of each parameter follows:
5821 %
5822 %    o wand: the magick wand.
5823 %
5824 */
5825 WandExport size_t MagickGetImageScene(MagickWand *wand)
5826 {
5827   assert(wand != (MagickWand *) NULL);
5828   assert(wand->signature == WandSignature);
5829   if (wand->debug != MagickFalse)
5830     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5831   if (wand->images == (Image *) NULL)
5832     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5833   return(wand->images->scene);
5834 }
5835 \f
5836 /*
5837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5838 %                                                                             %
5839 %                                                                             %
5840 %                                                                             %
5841 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5842 %                                                                             %
5843 %                                                                             %
5844 %                                                                             %
5845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5846 %
5847 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5848 %  pixel stream.
5849 %
5850 %  The format of the MagickGetImageSignature method is:
5851 %
5852 %      const char MagickGetImageSignature(MagickWand *wand)
5853 %
5854 %  A description of each parameter follows:
5855 %
5856 %    o wand: the magick wand.
5857 %
5858 */
5859 WandExport char *MagickGetImageSignature(MagickWand *wand)
5860 {
5861   const char
5862     *value;
5863
5864   MagickBooleanType
5865     status;
5866
5867   assert(wand != (MagickWand *) NULL);
5868   assert(wand->signature == WandSignature);
5869   if (wand->debug != MagickFalse)
5870     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5871   if (wand->images == (Image *) NULL)
5872     {
5873       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5874         "ContainsNoImages","`%s'",wand->name);
5875       return((char *) NULL);
5876     }
5877   status=SignatureImage(wand->images);
5878   if (status == MagickFalse)
5879     InheritException(wand->exception,&wand->images->exception);
5880   value=GetImageProperty(wand->images,"signature");
5881   if (value != (const char *) NULL)
5882     return(AcquireString(value));
5883   InheritException(wand->exception,&wand->images->exception);
5884   return((char *) NULL);
5885 }
5886 \f
5887 /*
5888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5889 %                                                                             %
5890 %                                                                             %
5891 %                                                                             %
5892 %   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                   %
5893 %                                                                             %
5894 %                                                                             %
5895 %                                                                             %
5896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5897 %
5898 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5899 %
5900 %  The format of the MagickGetImageTicksPerSecond method is:
5901 %
5902 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5903 %
5904 %  A description of each parameter follows:
5905 %
5906 %    o wand: the magick wand.
5907 %
5908 */
5909 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5910 {
5911   assert(wand != (MagickWand *) NULL);
5912   assert(wand->signature == WandSignature);
5913   if (wand->debug != MagickFalse)
5914     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5915   if (wand->images == (Image *) NULL)
5916     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5917   return((size_t) wand->images->ticks_per_second);
5918 }
5919 \f
5920 /*
5921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5922 %                                                                             %
5923 %                                                                             %
5924 %                                                                             %
5925 %   M a g i c k G e t I m a g e T y p e                                       %
5926 %                                                                             %
5927 %                                                                             %
5928 %                                                                             %
5929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5930 %
5931 %  MagickGetImageType() gets the potential image type:
5932 %
5933 %        Bilevel        Grayscale       GrayscaleMatte
5934 %        Palette        PaletteMatte    TrueColor
5935 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5936 %
5937 %  To ensure the image type matches its potential, use MagickSetImageType():
5938 %
5939 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5940 %
5941 %  The format of the MagickGetImageType method is:
5942 %
5943 %      ImageType MagickGetImageType(MagickWand *wand)
5944 %
5945 %  A description of each parameter follows:
5946 %
5947 %    o wand: the magick wand.
5948 %
5949 */
5950 WandExport ImageType MagickGetImageType(MagickWand *wand)
5951 {
5952   assert(wand != (MagickWand *) NULL);
5953   assert(wand->signature == WandSignature);
5954   if (wand->debug != MagickFalse)
5955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5956   if (wand->images == (Image *) NULL)
5957     {
5958       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5959         "ContainsNoImages","`%s'",wand->name);
5960       return(UndefinedType);
5961     }
5962   return(GetImageType(wand->images,wand->exception));
5963 }
5964 \f
5965 /*
5966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5967 %                                                                             %
5968 %                                                                             %
5969 %                                                                             %
5970 %   M a g i c k G e t I m a g e U n i t s                                     %
5971 %                                                                             %
5972 %                                                                             %
5973 %                                                                             %
5974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5975 %
5976 %  MagickGetImageUnits() gets the image units of resolution.
5977 %
5978 %  The format of the MagickGetImageUnits method is:
5979 %
5980 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5981 %
5982 %  A description of each parameter follows:
5983 %
5984 %    o wand: the magick wand.
5985 %
5986 */
5987 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5988 {
5989   assert(wand != (MagickWand *) NULL);
5990   assert(wand->signature == WandSignature);
5991   if (wand->debug != MagickFalse)
5992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5993   if (wand->images == (Image *) NULL)
5994     {
5995       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5996         "ContainsNoImages","`%s'",wand->name);
5997       return(UndefinedResolution);
5998     }
5999   return(wand->images->units);
6000 }
6001 \f
6002 /*
6003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6004 %                                                                             %
6005 %                                                                             %
6006 %                                                                             %
6007 %   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           %
6008 %                                                                             %
6009 %                                                                             %
6010 %                                                                             %
6011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6012 %
6013 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6014 %  sepcified image.
6015 %
6016 %  The format of the MagickGetImageVirtualPixelMethod method is:
6017 %
6018 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6019 %
6020 %  A description of each parameter follows:
6021 %
6022 %    o wand: the magick wand.
6023 %
6024 */
6025 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6026 {
6027   assert(wand != (MagickWand *) NULL);
6028   assert(wand->signature == WandSignature);
6029   if (wand->debug != MagickFalse)
6030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6031   if (wand->images == (Image *) NULL)
6032     {
6033       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6034         "ContainsNoImages","`%s'",wand->name);
6035       return(UndefinedVirtualPixelMethod);
6036     }
6037   return(GetImageVirtualPixelMethod(wand->images));
6038 }
6039 \f
6040 /*
6041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6042 %                                                                             %
6043 %                                                                             %
6044 %                                                                             %
6045 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
6046 %                                                                             %
6047 %                                                                             %
6048 %                                                                             %
6049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6050 %
6051 %  MagickGetImageWhitePoint() returns the chromaticy white point.
6052 %
6053 %  The format of the MagickGetImageWhitePoint method is:
6054 %
6055 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6056 %        double *y)
6057 %
6058 %  A description of each parameter follows:
6059 %
6060 %    o wand: the magick wand.
6061 %
6062 %    o x: the chromaticity white x-point.
6063 %
6064 %    o y: the chromaticity white y-point.
6065 %
6066 */
6067 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6068   double *x,double *y)
6069 {
6070   assert(wand != (MagickWand *) NULL);
6071   assert(wand->signature == WandSignature);
6072   if (wand->debug != MagickFalse)
6073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6074   if (wand->images == (Image *) NULL)
6075     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6076   *x=wand->images->chromaticity.white_point.x;
6077   *y=wand->images->chromaticity.white_point.y;
6078   return(MagickTrue);
6079 }
6080 \f
6081 /*
6082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6083 %                                                                             %
6084 %                                                                             %
6085 %                                                                             %
6086 %   M a g i c k G e t I m a g e W i d t h                                     %
6087 %                                                                             %
6088 %                                                                             %
6089 %                                                                             %
6090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6091 %
6092 %  MagickGetImageWidth() returns the image width.
6093 %
6094 %  The format of the MagickGetImageWidth method is:
6095 %
6096 %      size_t MagickGetImageWidth(MagickWand *wand)
6097 %
6098 %  A description of each parameter follows:
6099 %
6100 %    o wand: the magick wand.
6101 %
6102 */
6103 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6104 {
6105   assert(wand != (MagickWand *) NULL);
6106   assert(wand->signature == WandSignature);
6107   if (wand->debug != MagickFalse)
6108     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6109   if (wand->images == (Image *) NULL)
6110     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6111   return(wand->images->columns);
6112 }
6113 \f
6114 /*
6115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6116 %                                                                             %
6117 %                                                                             %
6118 %                                                                             %
6119 %   M a g i c k G e t N u m b e r I m a g e s                                 %
6120 %                                                                             %
6121 %                                                                             %
6122 %                                                                             %
6123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6124 %
6125 %  MagickGetNumberImages() returns the number of images associated with a
6126 %  magick wand.
6127 %
6128 %  The format of the MagickGetNumberImages method is:
6129 %
6130 %      size_t MagickGetNumberImages(MagickWand *wand)
6131 %
6132 %  A description of each parameter follows:
6133 %
6134 %    o wand: the magick wand.
6135 %
6136 */
6137 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6138 {
6139   assert(wand != (MagickWand *) NULL);
6140   assert(wand->signature == WandSignature);
6141   if (wand->debug != MagickFalse)
6142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6143   return(GetImageListLength(wand->images));
6144 }
6145 \f
6146 /*
6147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6148 %                                                                             %
6149 %                                                                             %
6150 %                                                                             %
6151 %   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                 %
6152 %                                                                             %
6153 %                                                                             %
6154 %                                                                             %
6155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6156 %
6157 %  MagickGetImageTotalInkDensity() gets the image total ink density.
6158 %
6159 %  The format of the MagickGetImageTotalInkDensity method is:
6160 %
6161 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
6162 %
6163 %  A description of each parameter follows:
6164 %
6165 %    o wand: the magick wand.
6166 %
6167 */
6168 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6169 {
6170   assert(wand != (MagickWand *) NULL);
6171   assert(wand->signature == WandSignature);
6172   if (wand->debug != MagickFalse)
6173     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6174   if (wand->images == (Image *) NULL)
6175     {
6176       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6177         "ContainsNoImages","`%s'",wand->name);
6178       return(0.0);
6179     }
6180   return(GetImageTotalInkDensity(wand->images));
6181 }
6182 \f
6183 /*
6184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6185 %                                                                             %
6186 %                                                                             %
6187 %                                                                             %
6188 %   M a g i c k H a l d C l u t I m a g e                                     %
6189 %                                                                             %
6190 %                                                                             %
6191 %                                                                             %
6192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6193 %
6194 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6195 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6196 %  dimensions.  Create it with the HALD coder.  You can apply any color
6197 %  transformation to the Hald image and then use this method to apply the
6198 %  transform to the image.
6199 %
6200 %  The format of the MagickHaldClutImage method is:
6201 %
6202 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6203 %        const MagickWand *hald_wand)
6204 %      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6205 %        const ChannelType channel,const MagickWand *hald_wand)
6206 %
6207 %  A description of each parameter follows:
6208 %
6209 %    o wand: the magick wand.
6210 %
6211 %    o hald_image: the hald CLUT image.
6212 %
6213 */
6214
6215 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6216   const MagickWand *hald_wand)
6217 {
6218   MagickBooleanType
6219     status;
6220
6221   status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6222   return(status);
6223 }
6224
6225 WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6226   const ChannelType channel,const MagickWand *hald_wand)
6227 {
6228   MagickBooleanType
6229     status;
6230
6231   assert(wand != (MagickWand *) NULL);
6232   assert(wand->signature == WandSignature);
6233   if (wand->debug != MagickFalse)
6234     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6235   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6236     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6237   status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6238   if (status == MagickFalse)
6239     InheritException(wand->exception,&wand->images->exception);
6240   return(status);
6241 }
6242 \f
6243 /*
6244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6245 %                                                                             %
6246 %                                                                             %
6247 %                                                                             %
6248 %   M a g i c k H a s N e x t I m a g e                                       %
6249 %                                                                             %
6250 %                                                                             %
6251 %                                                                             %
6252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6253 %
6254 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
6255 %  traversing the list in the forward direction
6256 %
6257 %  The format of the MagickHasNextImage method is:
6258 %
6259 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6260 %
6261 %  A description of each parameter follows:
6262 %
6263 %    o wand: the magick wand.
6264 %
6265 */
6266 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6267 {
6268   assert(wand != (MagickWand *) NULL);
6269   assert(wand->signature == WandSignature);
6270   if (wand->debug != MagickFalse)
6271     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6272   if (wand->images == (Image *) NULL)
6273     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6274   if (GetNextImageInList(wand->images) == (Image *) NULL)
6275     return(MagickFalse);
6276   return(MagickTrue);
6277 }
6278 \f
6279 /*
6280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6281 %                                                                             %
6282 %                                                                             %
6283 %                                                                             %
6284 %   M a g i c k H a s P r e v i o u s I m a g e                               %
6285 %                                                                             %
6286 %                                                                             %
6287 %                                                                             %
6288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6289 %
6290 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6291 %  traversing the list in the reverse direction
6292 %
6293 %  The format of the MagickHasPreviousImage method is:
6294 %
6295 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6296 %
6297 %  A description of each parameter follows:
6298 %
6299 %    o wand: the magick wand.
6300 %
6301 */
6302 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6303 {
6304   assert(wand != (MagickWand *) NULL);
6305   assert(wand->signature == WandSignature);
6306   if (wand->debug != MagickFalse)
6307     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6308   if (wand->images == (Image *) NULL)
6309     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6310   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6311     return(MagickFalse);
6312   return(MagickTrue);
6313 }
6314 \f
6315 /*
6316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6317 %                                                                             %
6318 %                                                                             %
6319 %                                                                             %
6320 %   M a g i c k I d e n t i f y I m a g e                                     %
6321 %                                                                             %
6322 %                                                                             %
6323 %                                                                             %
6324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6325 %
6326 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6327 %  file.  Attributes include the image width, height, size, and others.
6328 %
6329 %  The format of the MagickIdentifyImage method is:
6330 %
6331 %      const char *MagickIdentifyImage(MagickWand *wand)
6332 %
6333 %  A description of each parameter follows:
6334 %
6335 %    o wand: the magick wand.
6336 %
6337 */
6338 WandExport char *MagickIdentifyImage(MagickWand *wand)
6339 {
6340   char
6341     *description,
6342     filename[MaxTextExtent];
6343
6344   FILE
6345     *file;
6346
6347   int
6348     unique_file;
6349
6350   assert(wand != (MagickWand *) NULL);
6351   assert(wand->signature == WandSignature);
6352   if (wand->debug != MagickFalse)
6353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6354   if (wand->images == (Image *) NULL)
6355     {
6356       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6357         "ContainsNoImages","`%s'",wand->name);
6358       return((char *) NULL);
6359     }
6360   description=(char *) NULL;
6361   unique_file=AcquireUniqueFileResource(filename);
6362   file=(FILE *) NULL;
6363   if (unique_file != -1)
6364     file=fdopen(unique_file,"wb");
6365   if ((unique_file == -1) || (file == (FILE *) NULL))
6366     {
6367       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6368         "UnableToCreateTemporaryFile","`%s'",wand->name);
6369       return((char *) NULL);
6370     }
6371   (void) IdentifyImage(wand->images,file,MagickTrue);
6372   (void) fclose(file);
6373   description=FileToString(filename,~0,wand->exception);
6374   (void) RelinquishUniqueFileResource(filename);
6375   return(description);
6376 }
6377 \f
6378 /*
6379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6380 %                                                                             %
6381 %                                                                             %
6382 %                                                                             %
6383 %   M a g i c k I m p l o d e I m a g e                                       %
6384 %                                                                             %
6385 %                                                                             %
6386 %                                                                             %
6387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6388 %
6389 %  MagickImplodeImage() creates a new image that is a copy of an existing
6390 %  one with the image pixels "implode" by the specified percentage.  It
6391 %  allocates the memory necessary for the new Image structure and returns a
6392 %  pointer to the new image.
6393 %
6394 %  The format of the MagickImplodeImage method is:
6395 %
6396 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6397 %        const double radius)
6398 %
6399 %  A description of each parameter follows:
6400 %
6401 %    o wand: the magick wand.
6402 %
6403 %    o amount: Define the extent of the implosion.
6404 %
6405 */
6406 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6407   const double amount)
6408 {
6409   Image
6410     *implode_image;
6411
6412   assert(wand != (MagickWand *) NULL);
6413   assert(wand->signature == WandSignature);
6414   if (wand->debug != MagickFalse)
6415     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6416   if (wand->images == (Image *) NULL)
6417     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6418   implode_image=ImplodeImage(wand->images,amount,wand->exception);
6419   if (implode_image == (Image *) NULL)
6420     return(MagickFalse);
6421   ReplaceImageInList(&wand->images,implode_image);
6422   return(MagickTrue);
6423 }
6424 \f
6425 /*
6426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6427 %                                                                             %
6428 %                                                                             %
6429 %                                                                             %
6430 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6431 %                                                                             %
6432 %                                                                             %
6433 %                                                                             %
6434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6435 %
6436 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6437 %  location you specify.  The method returns MagickFalse on success otherwise
6438 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6439 %  short int, int, ssize_t, float, or double in the order specified by map.
6440 %
6441 %  Suppose your want to upload the first scanline of a 640x480 image from
6442 %  character data in red-green-blue order:
6443 %
6444 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6445 %
6446 %  The format of the MagickImportImagePixels method is:
6447 %
6448 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6449 %        const ssize_t x,const ssize_t y,const size_t columns,
6450 %        const size_t rows,const char *map,const StorageType storage,
6451 %        const void *pixels)
6452 %
6453 %  A description of each parameter follows:
6454 %
6455 %    o wand: the magick wand.
6456 %
6457 %    o x, y, columns, rows:  These values define the perimeter of a region
6458 %      of pixels you want to define.
6459 %
6460 %    o map:  This string reflects the expected ordering of the pixel array.
6461 %      It can be any combination or order of R = red, G = green, B = blue,
6462 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6463 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6464 %      P = pad.
6465 %
6466 %    o storage: Define the data type of the pixels.  Float and double types are
6467 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6468 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6469 %      or DoublePixel.
6470 %
6471 %    o pixels: This array of values contain the pixel components as defined by
6472 %      map and type.  You must preallocate this array where the expected
6473 %      length varies depending on the values of width, height, map, and type.
6474 %
6475 */
6476 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6477   const ssize_t x,const ssize_t y,const size_t columns,
6478   const size_t rows,const char *map,const StorageType storage,
6479   const void *pixels)
6480 {
6481   MagickBooleanType
6482     status;
6483
6484   assert(wand != (MagickWand *) NULL);
6485   assert(wand->signature == WandSignature);
6486   if (wand->debug != MagickFalse)
6487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6488   if (wand->images == (Image *) NULL)
6489     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6490   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6491   if (status == MagickFalse)
6492     InheritException(wand->exception,&wand->images->exception);
6493   return(status);
6494 }
6495 \f
6496 /*
6497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6498 %                                                                             %
6499 %                                                                             %
6500 %                                                                             %
6501 %   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       %
6502 %                                                                             %
6503 %                                                                             %
6504 %                                                                             %
6505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6506 %
6507 %  MagickInverseFourierTransformImage() implements the inverse discrete
6508 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6509 %  imaginary image pair.
6510 %
6511 %  The format of the MagickInverseFourierTransformImage method is:
6512 %
6513 %      MagickBooleanType MagickInverseFourierTransformImage(
6514 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6515 %        const MagickBooleanType magnitude)
6516 %
6517 %  A description of each parameter follows:
6518 %
6519 %    o magnitude_wand: the magnitude or real wand.
6520 %
6521 %    o phase_wand: the phase or imaginary wand.
6522 %
6523 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6524 %      imaginary image pair.
6525 %
6526 */
6527 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6528   MagickWand *magnitude_wand,MagickWand *phase_wand,
6529   const MagickBooleanType magnitude)
6530 {
6531   Image
6532     *inverse_image;
6533
6534   MagickWand
6535     *wand;
6536
6537   assert(magnitude_wand != (MagickWand *) NULL);
6538   assert(magnitude_wand->signature == WandSignature);
6539   if (magnitude_wand->debug != MagickFalse)
6540     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6541       magnitude_wand->name);
6542   wand=magnitude_wand;
6543   if (magnitude_wand->images == (Image *) NULL)
6544     ThrowWandException(WandError,"ContainsNoImages",
6545       magnitude_wand->name);
6546   assert(phase_wand != (MagickWand *) NULL);
6547   assert(phase_wand->signature == WandSignature);
6548   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6549     phase_wand->images,magnitude,wand->exception);
6550   if (inverse_image == (Image *) NULL)
6551     return(MagickFalse);
6552   ReplaceImageInList(&wand->images,inverse_image);
6553   return(MagickTrue);
6554 }
6555 \f
6556 /*
6557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6558 %                                                                             %
6559 %                                                                             %
6560 %                                                                             %
6561 %   M a g i c k L a b e l I m a g e                                           %
6562 %                                                                             %
6563 %                                                                             %
6564 %                                                                             %
6565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6566 %
6567 %  MagickLabelImage() adds a label to your image.
6568 %
6569 %  The format of the MagickLabelImage method is:
6570 %
6571 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6572 %
6573 %  A description of each parameter follows:
6574 %
6575 %    o wand: the magick wand.
6576 %
6577 %    o label: the image label.
6578 %
6579 */
6580 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6581   const char *label)
6582 {
6583   MagickBooleanType
6584     status;
6585
6586   assert(wand != (MagickWand *) NULL);
6587   assert(wand->signature == WandSignature);
6588   if (wand->debug != MagickFalse)
6589     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6590   if (wand->images == (Image *) NULL)
6591     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6592   status=SetImageProperty(wand->images,"label",label);
6593   if (status == MagickFalse)
6594     InheritException(wand->exception,&wand->images->exception);
6595   return(status);
6596 }
6597 \f
6598 /*
6599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6600 %                                                                             %
6601 %                                                                             %
6602 %                                                                             %
6603 %   M a g i c k L e v e l I m a g e                                           %
6604 %                                                                             %
6605 %                                                                             %
6606 %                                                                             %
6607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6608 %
6609 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6610 %  falling between specified white and black points to the full available
6611 %  quantum range. The parameters provided represent the black, mid, and white
6612 %  points. The black point specifies the darkest color in the image. Colors
6613 %  darker than the black point are set to zero. Mid point specifies a gamma
6614 %  correction to apply to the image.  White point specifies the lightest color
6615 %  in the image. Colors brighter than the white point are set to the maximum
6616 %  quantum value.
6617 %
6618 %  The format of the MagickLevelImage method is:
6619 %
6620 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6621 %        const double black_point,const double gamma,const double white_point)
6622 %      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6623 %        const ChannelType channel,const double black_point,const double gamma,
6624 %        const double white_point)
6625 %
6626 %  A description of each parameter follows:
6627 %
6628 %    o wand: the magick wand.
6629 %
6630 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6631 %
6632 %    o black_point: the black point.
6633 %
6634 %    o gamma: the gamma.
6635 %
6636 %    o white_point: the white point.
6637 %
6638 */
6639
6640 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6641   const double black_point,const double gamma,const double white_point)
6642 {
6643   MagickBooleanType
6644     status;
6645
6646   status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6647     white_point);
6648   return(status);
6649 }
6650
6651 WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6652   const ChannelType channel,const double black_point,const double gamma,
6653   const double white_point)
6654 {
6655   MagickBooleanType
6656     status;
6657
6658   assert(wand != (MagickWand *) NULL);
6659   assert(wand->signature == WandSignature);
6660   if (wand->debug != MagickFalse)
6661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6662   if (wand->images == (Image *) NULL)
6663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6664   status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6665   if (status == MagickFalse)
6666     InheritException(wand->exception,&wand->images->exception);
6667   return(status);
6668 }
6669 \f
6670 /*
6671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6672 %                                                                             %
6673 %                                                                             %
6674 %                                                                             %
6675 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6676 %                                                                             %
6677 %                                                                             %
6678 %                                                                             %
6679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6680 %
6681 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6682 %
6683 %  You can also reduce the influence of a particular channel with a gamma
6684 %  value of 0.
6685 %
6686 %  The format of the MagickLinearStretchImage method is:
6687 %
6688 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6689 %        const double black_point,const double white_point)
6690 %
6691 %  A description of each parameter follows:
6692 %
6693 %    o wand: the magick wand.
6694 %
6695 %    o black_point: the black point.
6696 %
6697 %    o white_point: the white point.
6698 %
6699 */
6700 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6701   const double black_point,const double white_point)
6702 {
6703   MagickBooleanType
6704     status;
6705
6706   assert(wand != (MagickWand *) NULL);
6707   assert(wand->signature == WandSignature);
6708   if (wand->debug != MagickFalse)
6709     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6710   if (wand->images == (Image *) NULL)
6711     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6712   status=LinearStretchImage(wand->images,black_point,white_point);
6713   if (status == MagickFalse)
6714     InheritException(wand->exception,&wand->images->exception);
6715   return(status);
6716 }
6717 \f
6718 /*
6719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6720 %                                                                             %
6721 %                                                                             %
6722 %                                                                             %
6723 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6724 %                                                                             %
6725 %                                                                             %
6726 %                                                                             %
6727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6728 %
6729 %  MagickLiquidRescaleImage() rescales image with seam carving.
6730 %
6731 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6732 %        const size_t columns,const size_t rows,
6733 %        const double delta_x,const double rigidity)
6734 %
6735 %  A description of each parameter follows:
6736 %
6737 %    o wand: the magick wand.
6738 %
6739 %    o columns: the number of columns in the scaled image.
6740 %
6741 %    o rows: the number of rows in the scaled image.
6742 %
6743 %    o delta_x: maximum seam transversal step (0 means straight seams).
6744 %
6745 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6746 %
6747 */
6748 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6749   const size_t columns,const size_t rows,const double delta_x,
6750   const double rigidity)
6751 {
6752   Image
6753     *rescale_image;
6754
6755   assert(wand != (MagickWand *) NULL);
6756   assert(wand->signature == WandSignature);
6757   if (wand->debug != MagickFalse)
6758     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6759   if (wand->images == (Image *) NULL)
6760     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6761   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6762     rigidity,wand->exception);
6763   if (rescale_image == (Image *) NULL)
6764     return(MagickFalse);
6765   ReplaceImageInList(&wand->images,rescale_image);
6766   return(MagickTrue);
6767 }
6768 \f
6769 /*
6770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6771 %                                                                             %
6772 %                                                                             %
6773 %                                                                             %
6774 %   M a g i c k M a g n i f y I m a g e                                       %
6775 %                                                                             %
6776 %                                                                             %
6777 %                                                                             %
6778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6779 %
6780 %  MagickMagnifyImage() is a convenience method that scales an image
6781 %  proportionally to twice its original size.
6782 %
6783 %  The format of the MagickMagnifyImage method is:
6784 %
6785 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6786 %
6787 %  A description of each parameter follows:
6788 %
6789 %    o wand: the magick wand.
6790 %
6791 */
6792 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6793 {
6794   Image
6795     *magnify_image;
6796
6797   assert(wand != (MagickWand *) NULL);
6798   assert(wand->signature == WandSignature);
6799   if (wand->debug != MagickFalse)
6800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6801   if (wand->images == (Image *) NULL)
6802     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6803   magnify_image=MagnifyImage(wand->images,wand->exception);
6804   if (magnify_image == (Image *) NULL)
6805     return(MagickFalse);
6806   ReplaceImageInList(&wand->images,magnify_image);
6807   return(MagickTrue);
6808 }
6809 \f
6810 /*
6811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6812 %                                                                             %
6813 %                                                                             %
6814 %                                                                             %
6815 %   M a g i c k M e d i a n F i l t e r I m a g e                             %
6816 %                                                                             %
6817 %                                                                             %
6818 %                                                                             %
6819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6820 %
6821 %  MagickMedianFilterImage() applies a digital filter that improves the quality
6822 %  of a noisy image.  Each pixel is replaced by the median in a set of
6823 %  neighboring pixels as defined by radius.
6824 %
6825 %  The format of the MagickMedianFilterImage method is:
6826 %
6827 %      MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6828 %        const double radius)
6829 %
6830 %  A description of each parameter follows:
6831 %
6832 %    o wand: the magick wand.
6833 %
6834 %    o radius: the radius of the pixel neighborhood.
6835 %
6836 */
6837 WandExport MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6838   const double radius)
6839 {
6840   Image
6841     *median_image;
6842
6843   assert(wand != (MagickWand *) NULL);
6844   assert(wand->signature == WandSignature);
6845   if (wand->debug != MagickFalse)
6846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6847   if (wand->images == (Image *) NULL)
6848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6849   median_image=MedianFilterImage(wand->images,radius,wand->exception);
6850   if (median_image == (Image *) NULL)
6851     return(MagickFalse);
6852   ReplaceImageInList(&wand->images,median_image);
6853   return(MagickTrue);
6854 }
6855 \f
6856 /*
6857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6858 %                                                                             %
6859 %                                                                             %
6860 %                                                                             %
6861 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6862 %                                                                             %
6863 %                                                                             %
6864 %                                                                             %
6865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6866 %
6867 %  MagickMergeImageLayers() composes all the image layers from the current given
6868 %  image onward to produce a single image of the merged layers.
6869 %
6870 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6871 %  initialized using the first images background color.  The images
6872 %  are then compositied onto that image in sequence using the given
6873 %  composition that has been assigned to each individual image.
6874 %
6875 %  The format of the MagickMergeImageLayers method is:
6876 %
6877 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6878 %        const ImageLayerMethod method)
6879 %
6880 %  A description of each parameter follows:
6881 %
6882 %    o wand: the magick wand.
6883 %
6884 %    o method: the method of selecting the size of the initial canvas.
6885 %
6886 %        MergeLayer: Merge all layers onto a canvas just large enough
6887 %           to hold all the actual images. The virtual canvas of the
6888 %           first image is preserved but otherwise ignored.
6889 %
6890 %        FlattenLayer: Use the virtual canvas size of first image.
6891 %           Images which fall outside this canvas is clipped.
6892 %           This can be used to 'fill out' a given virtual canvas.
6893 %
6894 %        MosaicLayer: Start with the virtual canvas of the first image,
6895 %           enlarging left and right edges to contain all images.
6896 %           Images with negative offsets will be clipped.
6897 %
6898 */
6899 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6900   const ImageLayerMethod method)
6901 {
6902   Image
6903     *mosaic_image;
6904
6905   assert(wand != (MagickWand *) NULL);
6906   assert(wand->signature == WandSignature);
6907   if (wand->debug != MagickFalse)
6908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6909   if (wand->images == (Image *) NULL)
6910     return((MagickWand *) NULL);
6911   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6912   if (mosaic_image == (Image *) NULL)
6913     return((MagickWand *) NULL);
6914   return(CloneMagickWandFromImages(wand,mosaic_image));
6915 }
6916 \f
6917 /*
6918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6919 %                                                                             %
6920 %                                                                             %
6921 %                                                                             %
6922 %   M a g i c k M i n i f y I m a g e                                         %
6923 %                                                                             %
6924 %                                                                             %
6925 %                                                                             %
6926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6927 %
6928 %  MagickMinifyImage() is a convenience method that scales an image
6929 %  proportionally to one-half its original size
6930 %
6931 %  The format of the MagickMinifyImage method is:
6932 %
6933 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6934 %
6935 %  A description of each parameter follows:
6936 %
6937 %    o wand: the magick wand.
6938 %
6939 */
6940 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6941 {
6942   Image
6943     *minify_image;
6944
6945   assert(wand != (MagickWand *) NULL);
6946   assert(wand->signature == WandSignature);
6947   if (wand->debug != MagickFalse)
6948     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6949   if (wand->images == (Image *) NULL)
6950     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6951   minify_image=MinifyImage(wand->images,wand->exception);
6952   if (minify_image == (Image *) NULL)
6953     return(MagickFalse);
6954   ReplaceImageInList(&wand->images,minify_image);
6955   return(MagickTrue);
6956 }
6957 \f
6958 /*
6959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6960 %                                                                             %
6961 %                                                                             %
6962 %                                                                             %
6963 %   M a g i c k M o d u l a t e I m a g e                                     %
6964 %                                                                             %
6965 %                                                                             %
6966 %                                                                             %
6967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6968 %
6969 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6970 %  of an image.  Hue is the percentage of absolute rotation from the current
6971 %  position.  For example 50 results in a counter-clockwise rotation of 90
6972 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6973 %  both resulting in a rotation of 180 degrees.
6974 %
6975 %  To increase the color brightness by 20% and decrease the color saturation by
6976 %  10% and leave the hue unchanged, use: 120,90,100.
6977 %
6978 %  The format of the MagickModulateImage method is:
6979 %
6980 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6981 %        const double brightness,const double saturation,const double hue)
6982 %
6983 %  A description of each parameter follows:
6984 %
6985 %    o wand: the magick wand.
6986 %
6987 %    o brightness: the percent change in brighness.
6988 %
6989 %    o saturation: the percent change in saturation.
6990 %
6991 %    o hue: the percent change in hue.
6992 %
6993 */
6994 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6995   const double brightness,const double saturation,const double hue)
6996 {
6997   char
6998     modulate[MaxTextExtent];
6999
7000   MagickBooleanType
7001     status;
7002
7003   assert(wand != (MagickWand *) NULL);
7004   assert(wand->signature == WandSignature);
7005   if (wand->debug != MagickFalse)
7006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7007   if (wand->images == (Image *) NULL)
7008     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7009   (void) FormatMagickString(modulate,MaxTextExtent,"%g,%g,%g",
7010     brightness,saturation,hue);
7011   status=ModulateImage(wand->images,modulate);
7012   if (status == MagickFalse)
7013     InheritException(wand->exception,&wand->images->exception);
7014   return(status);
7015 }
7016 \f
7017 /*
7018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7019 %                                                                             %
7020 %                                                                             %
7021 %                                                                             %
7022 %   M a g i c k M o n t a g e I m a g e                                       %
7023 %                                                                             %
7024 %                                                                             %
7025 %                                                                             %
7026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7027 %
7028 %  MagickMontageImage() creates a composite image by combining several
7029 %  separate images. The images are tiled on the composite image with the name
7030 %  of the image optionally appearing just below the individual tile.
7031 %
7032 %  The format of the MagickMontageImage method is:
7033 %
7034 %      MagickWand *MagickMontageImage(MagickWand *wand,
7035 %        const DrawingWand drawing_wand,const char *tile_geometry,
7036 %        const char *thumbnail_geometry,const MontageMode mode,
7037 %        const char *frame)
7038 %
7039 %  A description of each parameter follows:
7040 %
7041 %    o wand: the magick wand.
7042 %
7043 %    o drawing_wand: the drawing wand.  The font name, size, and color are
7044 %      obtained from this wand.
7045 %
7046 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7047 %
7048 %    o thumbnail_geometry: Preferred image size and border size of each
7049 %      thumbnail (e.g. 120x120+4+3>).
7050 %
7051 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7052 %
7053 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7054 %      The frame color is that of the thumbnail's matte color.
7055 %
7056 */
7057 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7058   const DrawingWand *drawing_wand,const char *tile_geometry,
7059   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7060 {
7061   char
7062     *font;
7063
7064   Image
7065     *montage_image;
7066
7067   MontageInfo
7068     *montage_info;
7069
7070   PixelWand
7071     *pixel_wand;
7072
7073   assert(wand != (MagickWand *) NULL);
7074   assert(wand->signature == WandSignature);
7075   if (wand->debug != MagickFalse)
7076     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7077   if (wand->images == (Image *) NULL)
7078     return((MagickWand *) NULL);
7079   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7080   switch (mode)
7081   {
7082     case FrameMode:
7083     {
7084       (void) CloneString(&montage_info->frame,"15x15+3+3");
7085       montage_info->shadow=MagickTrue;
7086       break;
7087     }
7088     case UnframeMode:
7089     {
7090       montage_info->frame=(char *) NULL;
7091       montage_info->shadow=MagickFalse;
7092       montage_info->border_width=0;
7093       break;
7094     }
7095     case ConcatenateMode:
7096     {
7097       montage_info->frame=(char *) NULL;
7098       montage_info->shadow=MagickFalse;
7099       (void) CloneString(&montage_info->geometry,"+0+0");
7100       montage_info->border_width=0;
7101       break;
7102     }
7103     default:
7104       break;
7105   }
7106   font=DrawGetFont(drawing_wand);
7107   if (font != (char *) NULL)
7108     (void) CloneString(&montage_info->font,font);
7109   if (frame != (char *) NULL)
7110     (void) CloneString(&montage_info->frame,frame);
7111   montage_info->pointsize=DrawGetFontSize(drawing_wand);
7112   pixel_wand=NewPixelWand();
7113   DrawGetFillColor(drawing_wand,pixel_wand);
7114   PixelGetQuantumColor(pixel_wand,&montage_info->fill);
7115   DrawGetStrokeColor(drawing_wand,pixel_wand);
7116   PixelGetQuantumColor(pixel_wand,&montage_info->stroke);
7117   pixel_wand=DestroyPixelWand(pixel_wand);
7118   if (thumbnail_geometry != (char *) NULL)
7119     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7120   if (tile_geometry != (char *) NULL)
7121     (void) CloneString(&montage_info->tile,tile_geometry);
7122   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7123     wand->exception);
7124   montage_info=DestroyMontageInfo(montage_info);
7125   if (montage_image == (Image *) NULL)
7126     return((MagickWand *) NULL);
7127   return(CloneMagickWandFromImages(wand,montage_image));
7128 }
7129 \f
7130 /*
7131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7132 %                                                                             %
7133 %                                                                             %
7134 %                                                                             %
7135 %   M a g i c k M o r p h I m a g e s                                         %
7136 %                                                                             %
7137 %                                                                             %
7138 %                                                                             %
7139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7140 %
7141 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
7142 %  and size are linearly interpolated to give the appearance of a
7143 %  meta-morphosis from one image to the next.
7144 %
7145 %  The format of the MagickMorphImages method is:
7146 %
7147 %      MagickWand *MagickMorphImages(MagickWand *wand,
7148 %        const size_t number_frames)
7149 %
7150 %  A description of each parameter follows:
7151 %
7152 %    o wand: the magick wand.
7153 %
7154 %    o number_frames: the number of in-between images to generate.
7155 %
7156 */
7157 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7158   const size_t number_frames)
7159 {
7160   Image
7161     *morph_image;
7162
7163   assert(wand != (MagickWand *) NULL);
7164   assert(wand->signature == WandSignature);
7165   if (wand->debug != MagickFalse)
7166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7167   if (wand->images == (Image *) NULL)
7168     return((MagickWand *) NULL);
7169   morph_image=MorphImages(wand->images,number_frames,wand->exception);
7170   if (morph_image == (Image *) NULL)
7171     return((MagickWand *) NULL);
7172   return(CloneMagickWandFromImages(wand,morph_image));
7173 }
7174 \f
7175 /*
7176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7177 %                                                                             %
7178 %                                                                             %
7179 %                                                                             %
7180 %   M a g i c k M o r p h o l o g y I m a g e                                 %
7181 %                                                                             %
7182 %                                                                             %
7183 %                                                                             %
7184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7185 %
7186 %  MagickMorphologyImage() applies a user supplied kernel to the image
7187 %  according to the given mophology method.
7188 %
7189 %  The format of the MagickMorphologyImage method is:
7190 %
7191 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7192 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7193 %      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7194 %        ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7195 %        KernelInfo *kernel)
7196 %
7197 %  A description of each parameter follows:
7198 %
7199 %    o wand: the magick wand.
7200 %
7201 %    o channel: the image channel(s).
7202 %
7203 %    o method: the morphology method to be applied.
7204 %
7205 %    o iterations: apply the operation this many times (or no change).
7206 %      A value of -1 means loop until no change found.  How this is applied
7207 %      may depend on the morphology method.  Typically this is a value of 1.
7208 %
7209 %    o kernel: An array of doubles representing the morphology kernel.
7210 %
7211 */
7212
7213 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7214   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7215 {
7216   MagickBooleanType
7217     status;
7218
7219   status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7220     kernel);
7221   return(status);
7222 }
7223
7224 WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7225   const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7226   KernelInfo *kernel)
7227 {
7228   Image
7229     *morphology_image;
7230
7231   assert(wand != (MagickWand *) NULL);
7232   assert(wand->signature == WandSignature);
7233   if (wand->debug != MagickFalse)
7234     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7235   if (kernel == (const KernelInfo *) NULL)
7236     return(MagickFalse);
7237   if (wand->images == (Image *) NULL)
7238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7239   morphology_image=MorphologyImageChannel(wand->images,channel,method,
7240     iterations,kernel,wand->exception);
7241   if (morphology_image == (Image *) NULL)
7242     return(MagickFalse);
7243   ReplaceImageInList(&wand->images,morphology_image);
7244   return(MagickTrue);
7245 }
7246 \f
7247 /*
7248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7249 %                                                                             %
7250 %                                                                             %
7251 %                                                                             %
7252 %   M a g i c k M o t i o n B l u r I m a g e                                 %
7253 %                                                                             %
7254 %                                                                             %
7255 %                                                                             %
7256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7257 %
7258 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7259 %  Gaussian operator of the given radius and standard deviation (sigma).
7260 %  For reasonable results, radius should be larger than sigma.  Use a
7261 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7262 %  Angle gives the angle of the blurring motion.
7263 %
7264 %  The format of the MagickMotionBlurImage method is:
7265 %
7266 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7267 %        const double radius,const double sigma,const double angle)
7268 %      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7269 %        const ChannelType channel,const double radius,const double sigma,
7270 %        const double angle)
7271 %
7272 %  A description of each parameter follows:
7273 %
7274 %    o wand: the magick wand.
7275 %
7276 %    o channel: the image channel(s).
7277 %
7278 %    o radius: the radius of the Gaussian, in pixels, not counting
7279 %      the center pixel.
7280 %
7281 %    o sigma: the standard deviation of the Gaussian, in pixels.
7282 %
7283 %    o angle: Apply the effect along this angle.
7284 %
7285 */
7286
7287 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7288   const double radius,const double sigma,const double angle)
7289 {
7290   MagickBooleanType
7291     status;
7292
7293   status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7294   return(status);
7295 }
7296
7297 WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7298   const ChannelType channel,const double radius,const double sigma,
7299   const double angle)
7300 {
7301   Image
7302     *blur_image;
7303
7304   assert(wand != (MagickWand *) NULL);
7305   assert(wand->signature == WandSignature);
7306   if (wand->debug != MagickFalse)
7307     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7308   if (wand->images == (Image *) NULL)
7309     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7310   blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7311     wand->exception);
7312   if (blur_image == (Image *) NULL)
7313     return(MagickFalse);
7314   ReplaceImageInList(&wand->images,blur_image);
7315   return(MagickTrue);
7316 }
7317 \f
7318 /*
7319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7320 %                                                                             %
7321 %                                                                             %
7322 %                                                                             %
7323 %   M a g i c k N e g a t e I m a g e                                         %
7324 %                                                                             %
7325 %                                                                             %
7326 %                                                                             %
7327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7328 %
7329 %  MagickNegateImage() negates the colors in the reference image.  The
7330 %  Grayscale option means that only grayscale values within the image are
7331 %  negated.
7332 %
7333 %  You can also reduce the influence of a particular channel with a gamma
7334 %  value of 0.
7335 %
7336 %  The format of the MagickNegateImage method is:
7337 %
7338 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7339 %        const MagickBooleanType gray)
7340 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7341 %        const ChannelType channel,const MagickBooleanType gray)
7342 %
7343 %  A description of each parameter follows:
7344 %
7345 %    o wand: the magick wand.
7346 %
7347 %    o channel: the image channel(s).
7348 %
7349 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7350 %
7351 */
7352
7353 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7354   const MagickBooleanType gray)
7355 {
7356   MagickBooleanType
7357     status;
7358
7359   status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7360   return(status);
7361 }
7362
7363 WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7364   const ChannelType channel,const MagickBooleanType gray)
7365 {
7366   MagickBooleanType
7367     status;
7368
7369   assert(wand != (MagickWand *) NULL);
7370   assert(wand->signature == WandSignature);
7371   if (wand->debug != MagickFalse)
7372     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7373   if (wand->images == (Image *) NULL)
7374     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7375   status=NegateImageChannel(wand->images,channel,gray);
7376   if (status == MagickFalse)
7377     InheritException(wand->exception,&wand->images->exception);
7378   return(status);
7379 }
7380 \f
7381 /*
7382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7383 %                                                                             %
7384 %                                                                             %
7385 %                                                                             %
7386 %   M a g i c k N e w I m a g e                                               %
7387 %                                                                             %
7388 %                                                                             %
7389 %                                                                             %
7390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7391 %
7392 %  MagickNewImage() adds a blank image canvas of the specified size and
7393 %  background color to the wand.
7394 %
7395 %  The format of the MagickNewImage method is:
7396 %
7397 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7398 %        const size_t columns,const size_t rows,
7399 %        const PixelWand *background)
7400 %
7401 %  A description of each parameter follows:
7402 %
7403 %    o wand: the magick wand.
7404 %
7405 %    o width: the image width.
7406 %
7407 %    o height: the image height.
7408 %
7409 %    o background: the image color.
7410 %
7411 */
7412 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7413   const size_t width,const size_t height,
7414   const PixelWand *background)
7415 {
7416   Image
7417     *images;
7418
7419   MagickPixelPacket
7420     pixel;
7421
7422   assert(wand != (MagickWand *) NULL);
7423   assert(wand->signature == WandSignature);
7424   if (wand->debug != MagickFalse)
7425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7426   PixelGetMagickColor(background,&pixel);
7427   images=NewMagickImage(wand->image_info,width,height,&pixel);
7428   if (images == (Image *) NULL)
7429     return(MagickFalse);
7430   if (images->exception.severity != UndefinedException)
7431     InheritException(wand->exception,&images->exception);
7432   return(InsertImageInWand(wand,images));
7433 }
7434 \f
7435 /*
7436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7437 %                                                                             %
7438 %                                                                             %
7439 %                                                                             %
7440 %   M a g i c k N e x t I m a g e                                             %
7441 %                                                                             %
7442 %                                                                             %
7443 %                                                                             %
7444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7445 %
7446 %  MagickNextImage() associates the next image in the image list with a magick
7447 %  wand.
7448 %
7449 %  The format of the MagickNextImage method is:
7450 %
7451 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7452 %
7453 %  A description of each parameter follows:
7454 %
7455 %    o wand: the magick wand.
7456 %
7457 */
7458 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7459 {
7460   assert(wand != (MagickWand *) NULL);
7461   assert(wand->signature == WandSignature);
7462   if (wand->debug != MagickFalse)
7463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7464   if (wand->images == (Image *) NULL)
7465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7466   if (wand->pend != MagickFalse)
7467     {
7468       wand->pend=MagickFalse;
7469       return(MagickTrue);
7470     }
7471   if (GetNextImageInList(wand->images) == (Image *) NULL)
7472     {
7473       wand->pend=MagickTrue;
7474       return(MagickFalse);
7475     }
7476   wand->images=GetNextImageInList(wand->images);
7477   return(MagickTrue);
7478 }
7479 \f
7480 /*
7481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7482 %                                                                             %
7483 %                                                                             %
7484 %                                                                             %
7485 %   M a g i c k N o r m a l i z e I m a g e                                   %
7486 %                                                                             %
7487 %                                                                             %
7488 %                                                                             %
7489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7490 %
7491 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7492 %  the pixels color to span the entire range of colors available
7493 %
7494 %  You can also reduce the influence of a particular channel with a gamma
7495 %  value of 0.
7496 %
7497 %  The format of the MagickNormalizeImage method is:
7498 %
7499 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7500 %      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7501 %        const ChannelType channel)
7502 %
7503 %  A description of each parameter follows:
7504 %
7505 %    o wand: the magick wand.
7506 %
7507 %    o channel: the image channel(s).
7508 %
7509 */
7510
7511 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7512 {
7513   MagickBooleanType
7514     status;
7515
7516   status=MagickNormalizeImageChannel(wand,DefaultChannels);
7517   return(status);
7518 }
7519
7520 WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7521   const ChannelType channel)
7522 {
7523   MagickBooleanType
7524     status;
7525
7526   assert(wand != (MagickWand *) NULL);
7527   assert(wand->signature == WandSignature);
7528   if (wand->debug != MagickFalse)
7529     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7530   if (wand->images == (Image *) NULL)
7531     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7532   status=NormalizeImageChannel(wand->images,channel);
7533   if (status == MagickFalse)
7534     InheritException(wand->exception,&wand->images->exception);
7535   return(status);
7536 }
7537 \f
7538 /*
7539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7540 %                                                                             %
7541 %                                                                             %
7542 %                                                                             %
7543 %   M a g i c k O i l P a i n t I m a g e                                     %
7544 %                                                                             %
7545 %                                                                             %
7546 %                                                                             %
7547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7548 %
7549 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7550 %  painting.  Each pixel is replaced by the most frequent color occurring
7551 %  in a circular region defined by radius.
7552 %
7553 %  The format of the MagickOilPaintImage method is:
7554 %
7555 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7556 %        const double radius)
7557 %
7558 %  A description of each parameter follows:
7559 %
7560 %    o wand: the magick wand.
7561 %
7562 %    o radius: the radius of the circular neighborhood.
7563 %
7564 */
7565 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7566   const double radius)
7567 {
7568   Image
7569     *paint_image;
7570
7571   assert(wand != (MagickWand *) NULL);
7572   assert(wand->signature == WandSignature);
7573   if (wand->debug != MagickFalse)
7574     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7575   if (wand->images == (Image *) NULL)
7576     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7577   paint_image=OilPaintImage(wand->images,radius,wand->exception);
7578   if (paint_image == (Image *) NULL)
7579     return(MagickFalse);
7580   ReplaceImageInList(&wand->images,paint_image);
7581   return(MagickTrue);
7582 }
7583 \f
7584 /*
7585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7586 %                                                                             %
7587 %                                                                             %
7588 %                                                                             %
7589 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7590 %                                                                             %
7591 %                                                                             %
7592 %                                                                             %
7593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7594 %
7595 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7596 %  defined by fill.
7597 %
7598 %  The format of the MagickOpaquePaintImage method is:
7599 %
7600 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7601 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7602 %        const MagickBooleanType invert)
7603 %      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7604 %        const ChannelType channel,const PixelWand *target,
7605 %        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7606 %
7607 %  A description of each parameter follows:
7608 %
7609 %    o wand: the magick wand.
7610 %
7611 %    o channel: the channel(s).
7612 %
7613 %    o target: Change this target color to the fill color within the image.
7614 %
7615 %    o fill: the fill pixel wand.
7616 %
7617 %    o fuzz: By default target must match a particular pixel color
7618 %      exactly.  However, in many cases two colors may differ by a small amount.
7619 %      The fuzz member of image defines how much tolerance is acceptable to
7620 %      consider two colors as the same.  For example, set fuzz to 10 and the
7621 %      color red at intensities of 100 and 102 respectively are now interpreted
7622 %      as the same color for the purposes of the floodfill.
7623 %
7624 %    o invert: paint any pixel that does not match the target color.
7625 %
7626 */
7627
7628 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7629   const PixelWand *target,const PixelWand *fill,const double fuzz,
7630   const MagickBooleanType invert)
7631 {
7632   MagickBooleanType
7633     status;
7634
7635   status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7636     invert);
7637   return(status);
7638 }
7639
7640 WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7641   const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7642   const double fuzz,const MagickBooleanType invert)
7643 {
7644   MagickBooleanType
7645     status;
7646
7647   MagickPixelPacket
7648     fill_pixel,
7649     target_pixel;
7650
7651   assert(wand != (MagickWand *) NULL);
7652   assert(wand->signature == WandSignature);
7653   if (wand->debug != MagickFalse)
7654     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7655   if (wand->images == (Image *) NULL)
7656     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7657   PixelGetMagickColor(target,&target_pixel);
7658   PixelGetMagickColor(fill,&fill_pixel);
7659   wand->images->fuzz=fuzz;
7660   status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7661     &fill_pixel,invert);
7662   if (status == MagickFalse)
7663     InheritException(wand->exception,&wand->images->exception);
7664   return(status);
7665 }
7666 \f
7667 /*
7668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7669 %                                                                             %
7670 %                                                                             %
7671 %                                                                             %
7672 %   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                         %
7673 %                                                                             %
7674 %                                                                             %
7675 %                                                                             %
7676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7677 %
7678 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7679 %  previous image in the sequence.  From this it attempts to select the
7680 %  smallest cropped image to replace each frame, while preserving the results
7681 %  of the animation.
7682 %
7683 %  The format of the MagickOptimizeImageLayers method is:
7684 %
7685 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7686 %
7687 %  A description of each parameter follows:
7688 %
7689 %    o wand: the magick wand.
7690 %
7691 */
7692 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7693 {
7694   Image
7695     *optimize_image;
7696
7697   assert(wand != (MagickWand *) NULL);
7698   assert(wand->signature == WandSignature);
7699   if (wand->debug != MagickFalse)
7700     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7701   if (wand->images == (Image *) NULL)
7702     return((MagickWand *) NULL);
7703   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7704   if (optimize_image == (Image *) NULL)
7705     return((MagickWand *) NULL);
7706   return(CloneMagickWandFromImages(wand,optimize_image));
7707 }
7708 \f
7709 /*
7710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7711 %                                                                             %
7712 %                                                                             %
7713 %                                                                             %
7714 %     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                   %
7715 %                                                                             %
7716 %                                                                             %
7717 %                                                                             %
7718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7719 %
7720 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7721 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7722 %  which can be different for different channels, according to the input
7723 %  arguments.
7724 %
7725 %  The format of the MagickOrderedPosterizeImage method is:
7726 %
7727 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7728 %        const char *threshold_map)
7729 %      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7730 %        const ChannelType channel,const char *threshold_map)
7731 %
7732 %  A description of each parameter follows:
7733 %
7734 %    o image: the image.
7735 %
7736 %    o channel: the channel or channels to be thresholded.
7737 %
7738 %    o threshold_map: A string containing the name of the threshold dither
7739 %      map to use, followed by zero or more numbers representing the number of
7740 %      color levels tho dither between.
7741 %
7742 %      Any level number less than 2 is equivelent to 2, and means only binary
7743 %      dithering will be applied to each color channel.
7744 %
7745 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7746 %      channels, while a single number is the number of levels applied to each
7747 %      channel in sequence.  More numbers will be applied in turn to each of
7748 %      the color channels.
7749 %
7750 %      For example: "o3x3,6" generates a 6 level posterization of the image
7751 %      with a ordered 3x3 diffused pixel dither being applied between each
7752 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7753 %      only a single checkerboard hash pattern (50% grey) between each color
7754 %      level, to basically double the number of color levels with a bare
7755 %      minimim of dithering.
7756 %
7757 */
7758
7759 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7760   const char *threshold_map)
7761 {
7762   MagickBooleanType
7763     status;
7764
7765   status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7766   return(status);
7767 }
7768
7769 WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7770   MagickWand *wand,const ChannelType channel,const char *threshold_map)
7771 {
7772   MagickBooleanType
7773     status;
7774
7775   assert(wand != (MagickWand *) NULL);
7776   assert(wand->signature == WandSignature);
7777   if (wand->debug != MagickFalse)
7778     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7779   if (wand->images == (Image *) NULL)
7780     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7781   status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7782     wand->exception);
7783   return(status);
7784 }
7785 \f
7786 /*
7787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7788 %                                                                             %
7789 %                                                                             %
7790 %                                                                             %
7791 %   M a g i c k P i n g I m a g e                                             %
7792 %                                                                             %
7793 %                                                                             %
7794 %                                                                             %
7795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7796 %
7797 %  MagickPingImage() is like MagickReadImage() except the only valid
7798 %  information returned is the image width, height, size, and format.  It
7799 %  is designed to efficiently obtain this information from a file without
7800 %  reading the entire image sequence into memory.
7801 %
7802 %  The format of the MagickPingImage method is:
7803 %
7804 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7805 %
7806 %  A description of each parameter follows:
7807 %
7808 %    o wand: the magick wand.
7809 %
7810 %    o filename: the image filename.
7811 %
7812 */
7813 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7814   const char *filename)
7815 {
7816   Image
7817     *images;
7818
7819   ImageInfo
7820     *ping_info;
7821
7822   assert(wand != (MagickWand *) NULL);
7823   assert(wand->signature == WandSignature);
7824   if (wand->debug != MagickFalse)
7825     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7826   ping_info=CloneImageInfo(wand->image_info);
7827   if (filename != (const char *) NULL)
7828     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7829   images=PingImage(ping_info,wand->exception);
7830   ping_info=DestroyImageInfo(ping_info);
7831   if (images == (Image *) NULL)
7832     return(MagickFalse);
7833   return(InsertImageInWand(wand,images));
7834 }
7835 \f
7836 /*
7837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7838 %                                                                             %
7839 %                                                                             %
7840 %                                                                             %
7841 %   M a g i c k P i n g I m a g e B l o b                                     %
7842 %                                                                             %
7843 %                                                                             %
7844 %                                                                             %
7845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7846 %
7847 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7848 %
7849 %  The format of the MagickPingImageBlob method is:
7850 %
7851 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7852 %        const void *blob,const size_t length)
7853 %
7854 %  A description of each parameter follows:
7855 %
7856 %    o wand: the magick wand.
7857 %
7858 %    o blob: the blob.
7859 %
7860 %    o length: the blob length.
7861 %
7862 */
7863 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7864   const void *blob,const size_t length)
7865 {
7866   Image
7867     *images;
7868
7869   ImageInfo
7870     *read_info;
7871
7872   assert(wand != (MagickWand *) NULL);
7873   assert(wand->signature == WandSignature);
7874   if (wand->debug != MagickFalse)
7875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7876   read_info=CloneImageInfo(wand->image_info);
7877   SetImageInfoBlob(read_info,blob,length);
7878   images=PingImage(read_info,wand->exception);
7879   read_info=DestroyImageInfo(read_info);
7880   if (images == (Image *) NULL)
7881     return(MagickFalse);
7882   return(InsertImageInWand(wand,images));
7883 }
7884 \f
7885 /*
7886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7887 %                                                                             %
7888 %                                                                             %
7889 %                                                                             %
7890 %   M a g i c k P i n g I m a g e F i l e                                     %
7891 %                                                                             %
7892 %                                                                             %
7893 %                                                                             %
7894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7895 %
7896 %  MagickPingImageFile() pings an image or image sequence from an open file
7897 %  descriptor.
7898 %
7899 %  The format of the MagickPingImageFile method is:
7900 %
7901 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7902 %
7903 %  A description of each parameter follows:
7904 %
7905 %    o wand: the magick wand.
7906 %
7907 %    o file: the file descriptor.
7908 %
7909 */
7910 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7911 {
7912   Image
7913     *images;
7914
7915   ImageInfo
7916     *read_info;
7917
7918   assert(wand != (MagickWand *) NULL);
7919   assert(wand->signature == WandSignature);
7920   assert(file != (FILE *) NULL);
7921   if (wand->debug != MagickFalse)
7922     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7923   read_info=CloneImageInfo(wand->image_info);
7924   SetImageInfoFile(read_info,file);
7925   images=PingImage(read_info,wand->exception);
7926   read_info=DestroyImageInfo(read_info);
7927   if (images == (Image *) NULL)
7928     return(MagickFalse);
7929   return(InsertImageInWand(wand,images));
7930 }
7931 \f
7932 /*
7933 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7934 %                                                                             %
7935 %                                                                             %
7936 %                                                                             %
7937 %   M a g i c k P o l a r o i d I m a g e                                     %
7938 %                                                                             %
7939 %                                                                             %
7940 %                                                                             %
7941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7942 %
7943 %  MagickPolaroidImage() simulates a Polaroid picture.
7944 %
7945 %  The format of the MagickPolaroidImage method is:
7946 %
7947 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7948 %        const DrawingWand *drawing_wand,const double angle)
7949 %
7950 %  A description of each parameter follows:
7951 %
7952 %    o wand: the magick wand.
7953 %
7954 %    o drawing_wand: the draw wand.
7955 %
7956 %    o angle: Apply the effect along this angle.
7957 %
7958 */
7959 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7960   const DrawingWand *drawing_wand,const double angle)
7961 {
7962   DrawInfo
7963     *draw_info;
7964
7965   Image
7966     *polaroid_image;
7967
7968   assert(wand != (MagickWand *) NULL);
7969   assert(wand->signature == WandSignature);
7970   if (wand->debug != MagickFalse)
7971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7972   if (wand->images == (Image *) NULL)
7973     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7974   draw_info=PeekDrawingWand(drawing_wand);
7975   if (draw_info == (DrawInfo *) NULL)
7976     return(MagickFalse);
7977   polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7978   if (polaroid_image == (Image *) NULL)
7979     return(MagickFalse);
7980   ReplaceImageInList(&wand->images,polaroid_image);
7981   return(MagickTrue);
7982 }
7983 \f
7984 /*
7985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7986 %                                                                             %
7987 %                                                                             %
7988 %                                                                             %
7989 %   M a g i c k P o s t e r i z e I m a g e                                   %
7990 %                                                                             %
7991 %                                                                             %
7992 %                                                                             %
7993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7994 %
7995 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7996 %
7997 %  The format of the MagickPosterizeImage method is:
7998 %
7999 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8000 %        const unsigned levels,const MagickBooleanType dither)
8001 %
8002 %  A description of each parameter follows:
8003 %
8004 %    o wand: the magick wand.
8005 %
8006 %    o levels: Number of color levels allowed in each channel.  Very low values
8007 %      (2, 3, or 4) have the most visible effect.
8008 %
8009 %    o dither: Set this integer value to something other than zero to dither
8010 %      the mapped image.
8011 %
8012 */
8013 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8014   const size_t levels,const MagickBooleanType dither)
8015 {
8016   MagickBooleanType
8017     status;
8018
8019   assert(wand != (MagickWand *) NULL);
8020   assert(wand->signature == WandSignature);
8021   if (wand->debug != MagickFalse)
8022     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8023   if (wand->images == (Image *) NULL)
8024     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8025   status=PosterizeImage(wand->images,levels,dither);
8026   if (status == MagickFalse)
8027     InheritException(wand->exception,&wand->images->exception);
8028   return(status);
8029 }
8030 \f
8031 /*
8032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8033 %                                                                             %
8034 %                                                                             %
8035 %                                                                             %
8036 %   M a g i c k P r e v i e w I m a g e s                                     %
8037 %                                                                             %
8038 %                                                                             %
8039 %                                                                             %
8040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8041 %
8042 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8043 %  image processing operation applied at varying strengths.  This helpful
8044 %  to quickly pin-point an appropriate parameter for an image processing
8045 %  operation.
8046 %
8047 %  The format of the MagickPreviewImages method is:
8048 %
8049 %      MagickWand *MagickPreviewImages(MagickWand *wand,
8050 %        const PreviewType preview)
8051 %
8052 %  A description of each parameter follows:
8053 %
8054 %    o wand: the magick wand.
8055 %
8056 %    o preview: the preview type.
8057 %
8058 */
8059 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8060   const PreviewType preview)
8061 {
8062   Image
8063     *preview_image;
8064
8065   assert(wand != (MagickWand *) NULL);
8066   assert(wand->signature == WandSignature);
8067   if (wand->debug != MagickFalse)
8068     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8069   if (wand->images == (Image *) NULL)
8070     return((MagickWand *) NULL);
8071   preview_image=PreviewImage(wand->images,preview,wand->exception);
8072   if (preview_image == (Image *) NULL)
8073     return((MagickWand *) NULL);
8074   return(CloneMagickWandFromImages(wand,preview_image));
8075 }
8076 \f
8077 /*
8078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8079 %                                                                             %
8080 %                                                                             %
8081 %                                                                             %
8082 %   M a g i c k P r e v i o u s I m a g e                                     %
8083 %                                                                             %
8084 %                                                                             %
8085 %                                                                             %
8086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8087 %
8088 %  MagickPreviousImage() assocates the previous image in an image list with
8089 %  the magick wand.
8090 %
8091 %  The format of the MagickPreviousImage method is:
8092 %
8093 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
8094 %
8095 %  A description of each parameter follows:
8096 %
8097 %    o wand: the magick wand.
8098 %
8099 */
8100 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8101 {
8102   assert(wand != (MagickWand *) NULL);
8103   assert(wand->signature == WandSignature);
8104   if (wand->debug != MagickFalse)
8105     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8106   if (wand->images == (Image *) NULL)
8107     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8108   if (wand->pend != MagickFalse)
8109     {
8110       wand->pend=MagickFalse;
8111       return(MagickTrue);
8112     }
8113   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8114     {
8115       wand->pend=MagickTrue;
8116       return(MagickFalse);
8117     }
8118   wand->images=GetPreviousImageInList(wand->images);
8119   return(MagickTrue);
8120 }
8121 \f
8122 /*
8123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8124 %                                                                             %
8125 %                                                                             %
8126 %                                                                             %
8127 %   M a g i c k Q u a n t i z e I m a g e                                     %
8128 %                                                                             %
8129 %                                                                             %
8130 %                                                                             %
8131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8132 %
8133 %  MagickQuantizeImage() analyzes the colors within a reference image and
8134 %  chooses a fixed number of colors to represent the image.  The goal of the
8135 %  algorithm is to minimize the color difference between the input and output
8136 %  image while minimizing the processing time.
8137 %
8138 %  The format of the MagickQuantizeImage method is:
8139 %
8140 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8141 %        const size_t number_colors,const ColorspaceType colorspace,
8142 %        const size_t treedepth,const MagickBooleanType dither,
8143 %        const MagickBooleanType measure_error)
8144 %
8145 %  A description of each parameter follows:
8146 %
8147 %    o wand: the magick wand.
8148 %
8149 %    o number_colors: the number of colors.
8150 %
8151 %    o colorspace: Perform color reduction in this colorspace, typically
8152 %      RGBColorspace.
8153 %
8154 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8155 %      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
8156 %      reference image with the least amount of memory and the fastest
8157 %      computational speed.  In some cases, such as an image with low color
8158 %      dispersion (a few number of colors), a value other than
8159 %      Log4(number_colors) is required.  To expand the color tree completely,
8160 %      use a value of 8.
8161 %
8162 %    o dither: A value other than zero distributes the difference between an
8163 %      original image and the corresponding color reduced image to
8164 %      neighboring pixels along a Hilbert curve.
8165 %
8166 %    o measure_error: A value other than zero measures the difference between
8167 %      the original and quantized images.  This difference is the total
8168 %      quantization error.  The error is computed by summing over all pixels
8169 %      in an image the distance squared in RGB space between each reference
8170 %      pixel value and its quantized value.
8171 %
8172 */
8173 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8174   const size_t number_colors,const ColorspaceType colorspace,
8175   const size_t treedepth,const MagickBooleanType dither,
8176   const MagickBooleanType measure_error)
8177 {
8178   MagickBooleanType
8179     status;
8180
8181   QuantizeInfo
8182     *quantize_info;
8183
8184   assert(wand != (MagickWand *) NULL);
8185   assert(wand->signature == WandSignature);
8186   if (wand->debug != MagickFalse)
8187     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8188   if (wand->images == (Image *) NULL)
8189     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8190   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8191   quantize_info->number_colors=number_colors;
8192   quantize_info->dither=dither;
8193   quantize_info->tree_depth=treedepth;
8194   quantize_info->colorspace=colorspace;
8195   quantize_info->measure_error=measure_error;
8196   status=QuantizeImage(quantize_info,wand->images);
8197   if (status == MagickFalse)
8198     InheritException(wand->exception,&wand->images->exception);
8199   quantize_info=DestroyQuantizeInfo(quantize_info);
8200   return(status);
8201 }
8202 \f
8203 /*
8204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8205 %                                                                             %
8206 %                                                                             %
8207 %                                                                             %
8208 %   M a g i c k Q u a n t i z e I m a g e s                                   %
8209 %                                                                             %
8210 %                                                                             %
8211 %                                                                             %
8212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8213 %
8214 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
8215 %  chooses a fixed number of colors to represent the image.  The goal of the
8216 %  algorithm is to minimize the color difference between the input and output
8217 %  image while minimizing the processing time.
8218 %
8219 %  The format of the MagickQuantizeImages method is:
8220 %
8221 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8222 %        const size_t number_colors,const ColorspaceType colorspace,
8223 %        const size_t treedepth,const MagickBooleanType dither,
8224 %        const MagickBooleanType measure_error)
8225 %
8226 %  A description of each parameter follows:
8227 %
8228 %    o wand: the magick wand.
8229 %
8230 %    o number_colors: the number of colors.
8231 %
8232 %    o colorspace: Perform color reduction in this colorspace, typically
8233 %      RGBColorspace.
8234 %
8235 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8236 %      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
8237 %      reference image with the least amount of memory and the fastest
8238 %      computational speed.  In some cases, such as an image with low color
8239 %      dispersion (a few number of colors), a value other than
8240 %      Log4(number_colors) is required.  To expand the color tree completely,
8241 %      use a value of 8.
8242 %
8243 %    o dither: A value other than zero distributes the difference between an
8244 %      original image and the corresponding color reduced algorithm to
8245 %      neighboring pixels along a Hilbert curve.
8246 %
8247 %    o measure_error: A value other than zero measures the difference between
8248 %      the original and quantized images.  This difference is the total
8249 %      quantization error.  The error is computed by summing over all pixels
8250 %      in an image the distance squared in RGB space between each reference
8251 %      pixel value and its quantized value.
8252 %
8253 */
8254 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8255   const size_t number_colors,const ColorspaceType colorspace,
8256   const size_t treedepth,const MagickBooleanType dither,
8257   const MagickBooleanType measure_error)
8258 {
8259   MagickBooleanType
8260     status;
8261
8262   QuantizeInfo
8263     *quantize_info;
8264
8265   assert(wand != (MagickWand *) NULL);
8266   assert(wand->signature == WandSignature);
8267   if (wand->debug != MagickFalse)
8268     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8269   if (wand->images == (Image *) NULL)
8270     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8271   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8272   quantize_info->number_colors=number_colors;
8273   quantize_info->dither=dither;
8274   quantize_info->tree_depth=treedepth;
8275   quantize_info->colorspace=colorspace;
8276   quantize_info->measure_error=measure_error;
8277   status=QuantizeImages(quantize_info,wand->images);
8278   if (status == MagickFalse)
8279     InheritException(wand->exception,&wand->images->exception);
8280   quantize_info=DestroyQuantizeInfo(quantize_info);
8281   return(status);
8282 }
8283 \f
8284 /*
8285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8286 %                                                                             %
8287 %                                                                             %
8288 %                                                                             %
8289 %   M a g i c k R a d i a l B l u r I m a g e                                 %
8290 %                                                                             %
8291 %                                                                             %
8292 %                                                                             %
8293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8294 %
8295 %  MagickRadialBlurImage() radial blurs an image.
8296 %
8297 %  The format of the MagickRadialBlurImage method is:
8298 %
8299 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8300 %        const double angle)
8301 %      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8302 %        const ChannelType channel,const double angle)
8303 %
8304 %  A description of each parameter follows:
8305 %
8306 %    o wand: the magick wand.
8307 %
8308 %    o channel: the image channel(s).
8309 %
8310 %    o angle: the angle of the blur in degrees.
8311 %
8312 */
8313 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8314   const double angle)
8315 {
8316   MagickBooleanType
8317     status;
8318
8319   status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8320   return(status);
8321 }
8322
8323 WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8324   const ChannelType channel,const double angle)
8325 {
8326   Image
8327     *blur_image;
8328
8329   assert(wand != (MagickWand *) NULL);
8330   assert(wand->signature == WandSignature);
8331   if (wand->debug != MagickFalse)
8332     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8333   if (wand->images == (Image *) NULL)
8334     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8335   blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8336     wand->exception);
8337   if (blur_image == (Image *) NULL)
8338     return(MagickFalse);
8339   ReplaceImageInList(&wand->images,blur_image);
8340   return(MagickTrue);
8341 }
8342 \f
8343 /*
8344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8345 %                                                                             %
8346 %                                                                             %
8347 %                                                                             %
8348 %   M a g i c k R a i s e I m a g e                                           %
8349 %                                                                             %
8350 %                                                                             %
8351 %                                                                             %
8352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8353 %
8354 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8355 %  by lightening and darkening the edges of the image.  Members width and
8356 %  height of raise_info define the width of the vertical and horizontal
8357 %  edge of the effect.
8358 %
8359 %  The format of the MagickRaiseImage method is:
8360 %
8361 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8362 %        const size_t width,const size_t height,const ssize_t x,
8363 %        const ssize_t y,const MagickBooleanType raise)
8364 %
8365 %  A description of each parameter follows:
8366 %
8367 %    o wand: the magick wand.
8368 %
8369 %    o width,height,x,y:  Define the dimensions of the area to raise.
8370 %
8371 %    o raise: A value other than zero creates a 3-D raise effect,
8372 %      otherwise it has a lowered effect.
8373 %
8374 */
8375 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8376   const size_t width,const size_t height,const ssize_t x,
8377   const ssize_t y,const MagickBooleanType raise)
8378 {
8379   MagickBooleanType
8380     status;
8381
8382   RectangleInfo
8383     raise_info;
8384
8385   assert(wand != (MagickWand *) NULL);
8386   assert(wand->signature == WandSignature);
8387   if (wand->debug != MagickFalse)
8388     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8389   if (wand->images == (Image *) NULL)
8390     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8391   raise_info.width=width;
8392   raise_info.height=height;
8393   raise_info.x=x;
8394   raise_info.y=y;
8395   status=RaiseImage(wand->images,&raise_info,raise);
8396   if (status == MagickFalse)
8397     InheritException(wand->exception,&wand->images->exception);
8398   return(status);
8399 }
8400 \f
8401 /*
8402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8403 %                                                                             %
8404 %                                                                             %
8405 %                                                                             %
8406 %   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                       %
8407 %                                                                             %
8408 %                                                                             %
8409 %                                                                             %
8410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8411 %
8412 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8413 %  the intensity of each pixel compared to threshold.  The result is a
8414 %  high-contrast, two color image.
8415 %
8416 %  The format of the MagickRandomThresholdImage method is:
8417 %
8418 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8419 %        const double low,const double high)
8420 %      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8421 %        const ChannelType channel,const double low,const double high)
8422 %
8423 %  A description of each parameter follows:
8424 %
8425 %    o wand: the magick wand.
8426 %
8427 %    o channel: the image channel(s).
8428 %
8429 %    o low,high: Specify the high and low thresholds.  These values range from
8430 %      0 to QuantumRange.
8431 %
8432 */
8433
8434 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8435   const double low,const double high)
8436 {
8437   MagickBooleanType
8438     status;
8439
8440   status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8441   return(status);
8442 }
8443
8444 WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8445   MagickWand *wand,const ChannelType channel,const double low,
8446   const double high)
8447 {
8448   char
8449     threshold[MaxTextExtent];
8450
8451   MagickBooleanType
8452     status;
8453
8454   assert(wand != (MagickWand *) NULL);
8455   assert(wand->signature == WandSignature);
8456   if (wand->debug != MagickFalse)
8457     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8458   if (wand->images == (Image *) NULL)
8459     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8460   (void) FormatMagickString(threshold,MaxTextExtent,"%gx%g",low,high);
8461   status=RandomThresholdImageChannel(wand->images,channel,threshold,
8462     wand->exception);
8463   if (status == MagickFalse)
8464     InheritException(wand->exception,&wand->images->exception);
8465   return(status);
8466 }
8467 \f
8468 /*
8469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8470 %                                                                             %
8471 %                                                                             %
8472 %                                                                             %
8473 %   M a g i c k R e a d I m a g e                                             %
8474 %                                                                             %
8475 %                                                                             %
8476 %                                                                             %
8477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8478 %
8479 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8480 %  at the current image pointer position.   Use MagickSetFirstIterator(),
8481 %  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8482 %  image pointer position at the beginning of the image list, the end, or
8483 %  anywhere in-between respectively.
8484 %
8485 %  The format of the MagickReadImage method is:
8486 %
8487 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8488 %
8489 %  A description of each parameter follows:
8490 %
8491 %    o wand: the magick wand.
8492 %
8493 %    o filename: the image filename.
8494 %
8495 */
8496 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8497   const char *filename)
8498 {
8499   Image
8500     *images;
8501
8502   ImageInfo
8503     *read_info;
8504
8505   assert(wand != (MagickWand *) NULL);
8506   assert(wand->signature == WandSignature);
8507   if (wand->debug != MagickFalse)
8508     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8509   read_info=CloneImageInfo(wand->image_info);
8510   if (filename != (const char *) NULL)
8511     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8512   images=ReadImage(read_info,wand->exception);
8513   read_info=DestroyImageInfo(read_info);
8514   if (images == (Image *) NULL)
8515     return(MagickFalse);
8516   return(InsertImageInWand(wand,images));
8517 }
8518 \f
8519 /*
8520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8521 %                                                                             %
8522 %                                                                             %
8523 %                                                                             %
8524 %   M a g i c k R e a d I m a g e B l o b                                     %
8525 %                                                                             %
8526 %                                                                             %
8527 %                                                                             %
8528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8529 %
8530 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8531 %
8532 %  The format of the MagickReadImageBlob method is:
8533 %
8534 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8535 %        const void *blob,const size_t length)
8536 %
8537 %  A description of each parameter follows:
8538 %
8539 %    o wand: the magick wand.
8540 %
8541 %    o blob: the blob.
8542 %
8543 %    o length: the blob length.
8544 %
8545 */
8546 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8547   const void *blob,const size_t length)
8548 {
8549   Image
8550     *images;
8551
8552   assert(wand != (MagickWand *) NULL);
8553   assert(wand->signature == WandSignature);
8554   if (wand->debug != MagickFalse)
8555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8556   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8557   if (images == (Image *) NULL)
8558     return(MagickFalse);
8559   return(InsertImageInWand(wand,images));
8560 }
8561 \f
8562 /*
8563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8564 %                                                                             %
8565 %                                                                             %
8566 %                                                                             %
8567 %   M a g i c k R e a d I m a g e F i l e                                     %
8568 %                                                                             %
8569 %                                                                             %
8570 %                                                                             %
8571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8572 %
8573 %  MagickReadImageFile() reads an image or image sequence from an open file
8574 %  descriptor.
8575 %
8576 %  The format of the MagickReadImageFile method is:
8577 %
8578 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8579 %
8580 %  A description of each parameter follows:
8581 %
8582 %    o wand: the magick wand.
8583 %
8584 %    o file: the file descriptor.
8585 %
8586 */
8587 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8588 {
8589   Image
8590     *images;
8591
8592   ImageInfo
8593     *read_info;
8594
8595   assert(wand != (MagickWand *) NULL);
8596   assert(wand->signature == WandSignature);
8597   assert(file != (FILE *) NULL);
8598   if (wand->debug != MagickFalse)
8599     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8600   read_info=CloneImageInfo(wand->image_info);
8601   SetImageInfoFile(read_info,file);
8602   images=ReadImage(read_info,wand->exception);
8603   read_info=DestroyImageInfo(read_info);
8604   if (images == (Image *) NULL)
8605     return(MagickFalse);
8606   return(InsertImageInWand(wand,images));
8607 }
8608 \f
8609 /*
8610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8611 %                                                                             %
8612 %                                                                             %
8613 %                                                                             %
8614 %     M a g i c k R e d u c e N o i s e I m a g e                             %
8615 %                                                                             %
8616 %                                                                             %
8617 %                                                                             %
8618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8619 %
8620 %  MagickReduceNoiseImage() smooths the contours of an image while still
8621 %  preserving edge information.  The algorithm works by replacing each pixel
8622 %  with its neighbor closest in value.  A neighbor is defined by radius.  Use
8623 %  a radius of 0 and ReduceNoise() selects a suitable radius for you.
8624 %
8625 %  The format of the MagickReduceNoiseImage method is:
8626 %
8627 %      MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8628 %        const double radius)
8629 %
8630 %  A description of each parameter follows:
8631 %
8632 %    o wand: the magick wand.
8633 %
8634 %    o radius: the radius of the pixel neighborhood.
8635 %
8636 */
8637 WandExport MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8638   const double radius)
8639 {
8640   Image
8641     *noise_image;
8642
8643   assert(wand != (MagickWand *) NULL);
8644   assert(wand->signature == WandSignature);
8645   if (wand->debug != MagickFalse)
8646     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8647   if (wand->images == (Image *) NULL)
8648     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8649   noise_image=ReduceNoiseImage(wand->images,radius,wand->exception);
8650   if (noise_image == (Image *) NULL)
8651     return(MagickFalse);
8652   ReplaceImageInList(&wand->images,noise_image);
8653   return(MagickTrue);
8654 }
8655 \f
8656 /*
8657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8658 %                                                                             %
8659 %                                                                             %
8660 %                                                                             %
8661 %   M a g i c k R e m a p I m a g e                                           %
8662 %                                                                             %
8663 %                                                                             %
8664 %                                                                             %
8665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8666 %
8667 %  MagickRemapImage() replaces the colors of an image with the closest color
8668 %  from a reference image.
8669 %
8670 %  The format of the MagickRemapImage method is:
8671 %
8672 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8673 %        const MagickWand *remap_wand,const DitherMethod method)
8674 %
8675 %  A description of each parameter follows:
8676 %
8677 %    o wand: the magick wand.
8678 %
8679 %    o affinity: the affinity wand.
8680 %
8681 %    o method: choose from these dither methods: NoDitherMethod,
8682 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8683 %
8684 */
8685 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8686   const MagickWand *remap_wand,const DitherMethod method)
8687 {
8688   MagickBooleanType
8689     status;
8690
8691   QuantizeInfo
8692     *quantize_info;
8693
8694   assert(wand != (MagickWand *) NULL);
8695   assert(wand->signature == WandSignature);
8696   if (wand->debug != MagickFalse)
8697     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8698   if ((wand->images == (Image *) NULL) ||
8699       (remap_wand->images == (Image *) NULL))
8700     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8701   quantize_info=AcquireQuantizeInfo(wand->image_info);
8702   quantize_info->dither_method=method;
8703   if (method == NoDitherMethod)
8704     quantize_info->dither=MagickFalse;
8705   status=RemapImage(quantize_info,wand->images,remap_wand->images);
8706   quantize_info=DestroyQuantizeInfo(quantize_info);
8707   if (status == MagickFalse)
8708     InheritException(wand->exception,&wand->images->exception);
8709   return(status);
8710 }
8711 \f
8712 /*
8713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8714 %                                                                             %
8715 %                                                                             %
8716 %                                                                             %
8717 %   M a g i c k R e m o v e I m a g e                                         %
8718 %                                                                             %
8719 %                                                                             %
8720 %                                                                             %
8721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8722 %
8723 %  MagickRemoveImage() removes an image from the image list.
8724 %
8725 %  The format of the MagickRemoveImage method is:
8726 %
8727 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8728 %
8729 %  A description of each parameter follows:
8730 %
8731 %    o wand: the magick wand.
8732 %
8733 %    o insert: the splice wand.
8734 %
8735 */
8736 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8737 {
8738   assert(wand != (MagickWand *) NULL);
8739   assert(wand->signature == WandSignature);
8740   if (wand->debug != MagickFalse)
8741     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8742   if (wand->images == (Image *) NULL)
8743     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8744   DeleteImageFromList(&wand->images);
8745   return(MagickTrue);
8746 }
8747 \f
8748 /*
8749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8750 %                                                                             %
8751 %                                                                             %
8752 %                                                                             %
8753 %   M a g i c k R e s a m p l e I m a g e                                     %
8754 %                                                                             %
8755 %                                                                             %
8756 %                                                                             %
8757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8758 %
8759 %  MagickResampleImage() resample image to desired resolution.
8760 %
8761 %    Bessel   Blackman   Box
8762 %    Catrom   Cubic      Gaussian
8763 %    Hanning  Hermite    Lanczos
8764 %    Mitchell Point      Quandratic
8765 %    Sinc     Triangle
8766 %
8767 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8768 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8769 %  are windowed (brought down to zero) with the Blackman filter.
8770 %
8771 %  The format of the MagickResampleImage method is:
8772 %
8773 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8774 %        const double x_resolution,const double y_resolution,
8775 %        const FilterTypes filter,const double blur)
8776 %
8777 %  A description of each parameter follows:
8778 %
8779 %    o wand: the magick wand.
8780 %
8781 %    o x_resolution: the new image x resolution.
8782 %
8783 %    o y_resolution: the new image y resolution.
8784 %
8785 %    o filter: Image filter to use.
8786 %
8787 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8788 %
8789 */
8790 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8791   const double x_resolution,const double y_resolution,const FilterTypes filter,
8792   const double blur)
8793 {
8794   Image
8795     *resample_image;
8796
8797   assert(wand != (MagickWand *) NULL);
8798   assert(wand->signature == WandSignature);
8799   if (wand->debug != MagickFalse)
8800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8801   if (wand->images == (Image *) NULL)
8802     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8803   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8804     blur,wand->exception);
8805   if (resample_image == (Image *) NULL)
8806     return(MagickFalse);
8807   ReplaceImageInList(&wand->images,resample_image);
8808   return(MagickTrue);
8809 }
8810 \f
8811 /*
8812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8813 %                                                                             %
8814 %                                                                             %
8815 %                                                                             %
8816 %   M a g i c k R e s e t I m a g e P a g e                                   %
8817 %                                                                             %
8818 %                                                                             %
8819 %                                                                             %
8820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8821 %
8822 %  MagickResetImagePage() resets the Wand page canvas and position.
8823 %
8824 %  The format of the MagickResetImagePage method is:
8825 %
8826 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8827 %        const char *page)
8828 %
8829 %  A description of each parameter follows:
8830 %
8831 %    o wand: the magick wand.
8832 %
8833 %    o page: the relative page specification.
8834 %
8835 */
8836 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8837   const char *page)
8838 {
8839   assert(wand != (MagickWand *) NULL);
8840   assert(wand->signature == WandSignature);
8841   if (wand->debug != MagickFalse)
8842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8843   if (wand->images == (Image *) NULL)
8844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8845   if ((page == (char *) NULL) || (*page == '\0'))
8846     {
8847       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8848       return(MagickTrue);
8849     }
8850   return(ResetImagePage(wand->images,page));
8851 }
8852 \f
8853 /*
8854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8855 %                                                                             %
8856 %                                                                             %
8857 %                                                                             %
8858 %   M a g i c k R e s i z e I m a g e                                         %
8859 %                                                                             %
8860 %                                                                             %
8861 %                                                                             %
8862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8863 %
8864 %  MagickResizeImage() scales an image to the desired dimensions with one of
8865 %  these filters:
8866 %
8867 %    Bessel   Blackman   Box
8868 %    Catrom   Cubic      Gaussian
8869 %    Hanning  Hermite    Lanczos
8870 %    Mitchell Point      Quandratic
8871 %    Sinc     Triangle
8872 %
8873 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8874 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8875 %  are windowed (brought down to zero) with the Blackman filter.
8876 %
8877 %  The format of the MagickResizeImage method is:
8878 %
8879 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8880 %        const size_t columns,const size_t rows,
8881 %        const FilterTypes filter,const double blur)
8882 %
8883 %  A description of each parameter follows:
8884 %
8885 %    o wand: the magick wand.
8886 %
8887 %    o columns: the number of columns in the scaled image.
8888 %
8889 %    o rows: the number of rows in the scaled image.
8890 %
8891 %    o filter: Image filter to use.
8892 %
8893 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8894 %
8895 */
8896 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8897   const size_t columns,const size_t rows,const FilterTypes filter,
8898   const double blur)
8899 {
8900   Image
8901     *resize_image;
8902
8903   assert(wand != (MagickWand *) NULL);
8904   assert(wand->signature == WandSignature);
8905   if (wand->debug != MagickFalse)
8906     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8907   if (wand->images == (Image *) NULL)
8908     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8909   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8910     wand->exception);
8911   if (resize_image == (Image *) NULL)
8912     return(MagickFalse);
8913   ReplaceImageInList(&wand->images,resize_image);
8914   return(MagickTrue);
8915 }
8916 \f
8917 /*
8918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8919 %                                                                             %
8920 %                                                                             %
8921 %                                                                             %
8922 %   M a g i c k R o l l I m a g e                                             %
8923 %                                                                             %
8924 %                                                                             %
8925 %                                                                             %
8926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8927 %
8928 %  MagickRollImage() offsets an image as defined by x and y.
8929 %
8930 %  The format of the MagickRollImage method is:
8931 %
8932 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8933 %        const size_t y)
8934 %
8935 %  A description of each parameter follows:
8936 %
8937 %    o wand: the magick wand.
8938 %
8939 %    o x: the x offset.
8940 %
8941 %    o y: the y offset.
8942 %
8943 %
8944 */
8945 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8946   const ssize_t x,const ssize_t y)
8947 {
8948   Image
8949     *roll_image;
8950
8951   assert(wand != (MagickWand *) NULL);
8952   assert(wand->signature == WandSignature);
8953   if (wand->debug != MagickFalse)
8954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8955   if (wand->images == (Image *) NULL)
8956     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8957   roll_image=RollImage(wand->images,x,y,wand->exception);
8958   if (roll_image == (Image *) NULL)
8959     return(MagickFalse);
8960   ReplaceImageInList(&wand->images,roll_image);
8961   return(MagickTrue);
8962 }
8963 \f
8964 /*
8965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8966 %                                                                             %
8967 %                                                                             %
8968 %                                                                             %
8969 %   M a g i c k R o t a t e I m a g e                                         %
8970 %                                                                             %
8971 %                                                                             %
8972 %                                                                             %
8973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8974 %
8975 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8976 %  triangles left over from rotating the image are filled with the
8977 %  background color.
8978 %
8979 %  The format of the MagickRotateImage method is:
8980 %
8981 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8982 %        const PixelWand *background,const double degrees)
8983 %
8984 %  A description of each parameter follows:
8985 %
8986 %    o wand: the magick wand.
8987 %
8988 %    o background: the background pixel wand.
8989 %
8990 %    o degrees: the number of degrees to rotate the image.
8991 %
8992 %
8993 */
8994 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8995   const PixelWand *background,const double degrees)
8996 {
8997   Image
8998     *rotate_image;
8999
9000   assert(wand != (MagickWand *) NULL);
9001   assert(wand->signature == WandSignature);
9002   if (wand->debug != MagickFalse)
9003     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9004   if (wand->images == (Image *) NULL)
9005     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9006   PixelGetQuantumColor(background,&wand->images->background_color);
9007   rotate_image=RotateImage(wand->images,degrees,wand->exception);
9008   if (rotate_image == (Image *) NULL)
9009     return(MagickFalse);
9010   ReplaceImageInList(&wand->images,rotate_image);
9011   return(MagickTrue);
9012 }
9013 \f
9014 /*
9015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9016 %                                                                             %
9017 %                                                                             %
9018 %                                                                             %
9019 %   M a g i c k S a m p l e I m a g e                                         %
9020 %                                                                             %
9021 %                                                                             %
9022 %                                                                             %
9023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9024 %
9025 %  MagickSampleImage() scales an image to the desired dimensions with pixel
9026 %  sampling.  Unlike other scaling methods, this method does not introduce
9027 %  any additional color into the scaled image.
9028 %
9029 %  The format of the MagickSampleImage method is:
9030 %
9031 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
9032 %        const size_t columns,const size_t rows)
9033 %
9034 %  A description of each parameter follows:
9035 %
9036 %    o wand: the magick wand.
9037 %
9038 %    o columns: the number of columns in the scaled image.
9039 %
9040 %    o rows: the number of rows in the scaled image.
9041 %
9042 %
9043 */
9044 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9045   const size_t columns,const size_t rows)
9046 {
9047   Image
9048     *sample_image;
9049
9050   assert(wand != (MagickWand *) NULL);
9051   assert(wand->signature == WandSignature);
9052   if (wand->debug != MagickFalse)
9053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9054   if (wand->images == (Image *) NULL)
9055     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9056   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9057   if (sample_image == (Image *) NULL)
9058     return(MagickFalse);
9059   ReplaceImageInList(&wand->images,sample_image);
9060   return(MagickTrue);
9061 }
9062 \f
9063 /*
9064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9065 %                                                                             %
9066 %                                                                             %
9067 %                                                                             %
9068 %   M a g i c k S c a l e I m a g e                                           %
9069 %                                                                             %
9070 %                                                                             %
9071 %                                                                             %
9072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9073 %
9074 %  MagickScaleImage() scales the size of an image to the given dimensions.
9075 %
9076 %  The format of the MagickScaleImage method is:
9077 %
9078 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
9079 %        const size_t columns,const size_t rows)
9080 %
9081 %  A description of each parameter follows:
9082 %
9083 %    o wand: the magick wand.
9084 %
9085 %    o columns: the number of columns in the scaled image.
9086 %
9087 %    o rows: the number of rows in the scaled image.
9088 %
9089 %
9090 */
9091 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9092   const size_t columns,const size_t rows)
9093 {
9094   Image
9095     *scale_image;
9096
9097   assert(wand != (MagickWand *) NULL);
9098   assert(wand->signature == WandSignature);
9099   if (wand->debug != MagickFalse)
9100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9101   if (wand->images == (Image *) NULL)
9102     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9103   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9104   if (scale_image == (Image *) NULL)
9105     return(MagickFalse);
9106   ReplaceImageInList(&wand->images,scale_image);
9107   return(MagickTrue);
9108 }
9109 \f
9110 /*
9111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9112 %                                                                             %
9113 %                                                                             %
9114 %                                                                             %
9115 %   M a g i c k S e g m e n t I m a g e                                       %
9116 %                                                                             %
9117 %                                                                             %
9118 %                                                                             %
9119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9120 %
9121 %  MagickSegmentImage() segments an image by analyzing the histograms of the
9122 %  color components and identifying units that are homogeneous with the fuzzy
9123 %  C-means technique.
9124 %
9125 %  The format of the SegmentImage method is:
9126 %
9127 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
9128 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
9129 %        const double cluster_threshold,const double smooth_threshold)
9130 %
9131 %  A description of each parameter follows.
9132 %
9133 %    o wand: the wand.
9134 %
9135 %    o colorspace: the image colorspace.
9136 %
9137 %    o verbose:  Set to MagickTrue to print detailed information about the
9138 %      identified classes.
9139 %
9140 %    o cluster_threshold:  This represents the minimum number of pixels
9141 %      contained in a hexahedra before it can be considered valid (expressed as
9142 %      a percentage).
9143 %
9144 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
9145 %      derivative of the histogram.  As the value is increased, you can expect a
9146 %      smoother second derivative.
9147 %
9148 */
9149 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9150   const ColorspaceType colorspace,const MagickBooleanType verbose,
9151   const double cluster_threshold,const double smooth_threshold)
9152 {
9153   MagickBooleanType
9154     status;
9155
9156   assert(wand != (MagickWand *) NULL);
9157   assert(wand->signature == WandSignature);
9158   if (wand->debug != MagickFalse)
9159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9160   if (wand->images == (Image *) NULL)
9161     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9162   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9163     smooth_threshold);
9164   if (status == MagickFalse)
9165     InheritException(wand->exception,&wand->images->exception);
9166   return(status);
9167 }
9168 \f
9169 /*
9170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9171 %                                                                             %
9172 %                                                                             %
9173 %                                                                             %
9174 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
9175 %                                                                             %
9176 %                                                                             %
9177 %                                                                             %
9178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9179 %
9180 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
9181 %  threshold. It is similar to the unsharpen mask that sharpens everything with
9182 %  contrast above a certain threshold.
9183 %
9184 %  The format of the MagickSelectiveBlurImage method is:
9185 %
9186 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9187 %        const double radius,const double sigma,const double threshold)
9188 %      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9189 %        const ChannelType channel,const double radius,const double sigma,
9190 %        const double threshold)
9191 %
9192 %  A description of each parameter follows:
9193 %
9194 %    o wand: the magick wand.
9195 %
9196 %    o channel: the image channel(s).
9197 %
9198 %    o radius: the radius of the gaussian, in pixels, not counting the center
9199 %      pixel.
9200 %
9201 %    o sigma: the standard deviation of the gaussian, in pixels.
9202 %
9203 %    o threshold: only pixels within this contrast threshold are included
9204 %      in the blur operation.
9205 %
9206 */
9207
9208 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9209   const double radius,const double sigma,const double threshold)
9210 {
9211   MagickBooleanType
9212     status;
9213
9214   status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9215     threshold);
9216   return(status);
9217 }
9218
9219 WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9220   const ChannelType channel,const double radius,const double sigma,
9221   const double threshold)
9222 {
9223   Image
9224     *blur_image;
9225
9226   assert(wand != (MagickWand *) NULL);
9227   assert(wand->signature == WandSignature);
9228   if (wand->debug != MagickFalse)
9229     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9230   if (wand->images == (Image *) NULL)
9231     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9232   blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9233     threshold,wand->exception);
9234   if (blur_image == (Image *) NULL)
9235     return(MagickFalse);
9236   ReplaceImageInList(&wand->images,blur_image);
9237   return(MagickTrue);
9238 }
9239 \f
9240 /*
9241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9242 %                                                                             %
9243 %                                                                             %
9244 %                                                                             %
9245 %   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                       %
9246 %                                                                             %
9247 %                                                                             %
9248 %                                                                             %
9249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9250 %
9251 %  MagickSeparateImageChannel() separates a channel from the image and returns a
9252 %  grayscale image.  A channel is a particular color component of each pixel
9253 %  in the image.
9254 %
9255 %  The format of the MagickSeparateImageChannel method is:
9256 %
9257 %      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9258 %        const ChannelType channel)
9259 %
9260 %  A description of each parameter follows:
9261 %
9262 %    o wand: the magick wand.
9263 %
9264 %    o channel: the image channel(s).
9265 %
9266 */
9267 WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9268   const ChannelType channel)
9269 {
9270   MagickBooleanType
9271     status;
9272
9273   assert(wand != (MagickWand *) NULL);
9274   assert(wand->signature == WandSignature);
9275   if (wand->debug != MagickFalse)
9276     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9277   if (wand->images == (Image *) NULL)
9278     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9279   status=SeparateImageChannel(wand->images,channel);
9280   if (status == MagickFalse)
9281     InheritException(wand->exception,&wand->images->exception);
9282   return(status);
9283 }
9284 \f
9285 /*
9286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9287 %                                                                             %
9288 %                                                                             %
9289 %                                                                             %
9290 %     M a g i c k S e p i a T o n e I m a g e                                 %
9291 %                                                                             %
9292 %                                                                             %
9293 %                                                                             %
9294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9295 %
9296 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
9297 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9298 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9299 %  threshold of 80% is a good starting point for a reasonable tone.
9300 %
9301 %  The format of the MagickSepiaToneImage method is:
9302 %
9303 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9304 %        const double threshold)
9305 %
9306 %  A description of each parameter follows:
9307 %
9308 %    o wand: the magick wand.
9309 %
9310 %    o threshold:  Define the extent of the sepia toning.
9311 %
9312 */
9313 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9314   const double threshold)
9315 {
9316   Image
9317     *sepia_image;
9318
9319   assert(wand != (MagickWand *) NULL);
9320   assert(wand->signature == WandSignature);
9321   if (wand->debug != MagickFalse)
9322     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9323   if (wand->images == (Image *) NULL)
9324     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9325   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9326   if (sepia_image == (Image *) NULL)
9327     return(MagickFalse);
9328   ReplaceImageInList(&wand->images,sepia_image);
9329   return(MagickTrue);
9330 }
9331 \f
9332 /*
9333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9334 %                                                                             %
9335 %                                                                             %
9336 %                                                                             %
9337 %   M a g i c k S e t I m a g e                                               %
9338 %                                                                             %
9339 %                                                                             %
9340 %                                                                             %
9341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9342 %
9343 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9344 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
9345 %  wand.
9346 %
9347 %  The format of the MagickSetImage method is:
9348 %
9349 %      MagickBooleanType MagickSetImage(MagickWand *wand,
9350 %        const MagickWand *set_wand)
9351 %
9352 %  A description of each parameter follows:
9353 %
9354 %    o wand: the magick wand.
9355 %
9356 %    o set_wand: the set_wand wand.
9357 %
9358 */
9359 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9360   const MagickWand *set_wand)
9361 {
9362   Image
9363     *images;
9364
9365   assert(wand != (MagickWand *) NULL);
9366   assert(wand->signature == WandSignature);
9367   if (wand->debug != MagickFalse)
9368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9369   assert(set_wand != (MagickWand *) NULL);
9370   assert(set_wand->signature == WandSignature);
9371   if (wand->debug != MagickFalse)
9372     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9373   if (set_wand->images == (Image *) NULL)
9374     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9375   images=CloneImageList(set_wand->images,wand->exception);
9376   if (images == (Image *) NULL)
9377     return(MagickFalse);
9378   ReplaceImageInList(&wand->images,images);
9379   return(MagickTrue);
9380 }
9381 \f
9382 /*
9383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9384 %                                                                             %
9385 %                                                                             %
9386 %                                                                             %
9387 %   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                       %
9388 %                                                                             %
9389 %                                                                             %
9390 %                                                                             %
9391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9392 %
9393 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9394 %  alpha channel.
9395 %
9396 %  The format of the MagickSetImageAlphaChannel method is:
9397 %
9398 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9399 %        const AlphaChannelType alpha_type)
9400 %
9401 %  A description of each parameter follows:
9402 %
9403 %    o wand: the magick wand.
9404 %
9405 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9406 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9407 %
9408 */
9409 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9410   const AlphaChannelType alpha_type)
9411 {
9412   assert(wand != (MagickWand *) NULL);
9413   assert(wand->signature == WandSignature);
9414   if (wand->debug != MagickFalse)
9415     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9416   if (wand->images == (Image *) NULL)
9417     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9418   return(SetImageAlphaChannel(wand->images,alpha_type));
9419 }
9420 \f
9421 /*
9422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9423 %                                                                             %
9424 %                                                                             %
9425 %                                                                             %
9426 %   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                 %
9427 %                                                                             %
9428 %                                                                             %
9429 %                                                                             %
9430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9431 %
9432 %  MagickSetImageBackgroundColor() sets the image background color.
9433 %
9434 %  The format of the MagickSetImageBackgroundColor method is:
9435 %
9436 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9437 %        const PixelWand *background)
9438 %
9439 %  A description of each parameter follows:
9440 %
9441 %    o wand: the magick wand.
9442 %
9443 %    o background: the background pixel wand.
9444 %
9445 */
9446 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9447   const PixelWand *background)
9448 {
9449   assert(wand != (MagickWand *) NULL);
9450   assert(wand->signature == WandSignature);
9451   if (wand->debug != MagickFalse)
9452     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9453   if (wand->images == (Image *) NULL)
9454     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9455   PixelGetQuantumColor(background,&wand->images->background_color);
9456   return(MagickTrue);
9457 }
9458 \f
9459 /*
9460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9461 %                                                                             %
9462 %                                                                             %
9463 %                                                                             %
9464 %   M a g i c k S e t I m a g e B i a s                                       %
9465 %                                                                             %
9466 %                                                                             %
9467 %                                                                             %
9468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9469 %
9470 %  MagickSetImageBias() sets the image bias for any method that convolves an
9471 %  image (e.g. MagickConvolveImage()).
9472 %
9473 %  The format of the MagickSetImageBias method is:
9474 %
9475 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9476 %        const double bias)
9477 %
9478 %  A description of each parameter follows:
9479 %
9480 %    o wand: the magick wand.
9481 %
9482 %    o bias: the image bias.
9483 %
9484 */
9485 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9486   const double bias)
9487 {
9488   assert(wand != (MagickWand *) NULL);
9489   assert(wand->signature == WandSignature);
9490   if (wand->debug != MagickFalse)
9491     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9492   if (wand->images == (Image *) NULL)
9493     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9494   wand->images->bias=bias;
9495   return(MagickTrue);
9496 }
9497 \f
9498 /*
9499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9500 %                                                                             %
9501 %                                                                             %
9502 %                                                                             %
9503 %   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                         %
9504 %                                                                             %
9505 %                                                                             %
9506 %                                                                             %
9507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9508 %
9509 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9510 %
9511 %  The format of the MagickSetImageBluePrimary method is:
9512 %
9513 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9514 %        const double x,const double y)
9515 %
9516 %  A description of each parameter follows:
9517 %
9518 %    o wand: the magick wand.
9519 %
9520 %    o x: the blue primary x-point.
9521 %
9522 %    o y: the blue primary y-point.
9523 %
9524 */
9525 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9526   const double x,const double y)
9527 {
9528   assert(wand != (MagickWand *) NULL);
9529   assert(wand->signature == WandSignature);
9530   if (wand->debug != MagickFalse)
9531     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9532   if (wand->images == (Image *) NULL)
9533     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9534   wand->images->chromaticity.blue_primary.x=x;
9535   wand->images->chromaticity.blue_primary.y=y;
9536   return(MagickTrue);
9537 }
9538 \f
9539 /*
9540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9541 %                                                                             %
9542 %                                                                             %
9543 %                                                                             %
9544 %   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                         %
9545 %                                                                             %
9546 %                                                                             %
9547 %                                                                             %
9548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9549 %
9550 %  MagickSetImageBorderColor() sets the image border color.
9551 %
9552 %  The format of the MagickSetImageBorderColor method is:
9553 %
9554 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9555 %        const PixelWand *border)
9556 %
9557 %  A description of each parameter follows:
9558 %
9559 %    o wand: the magick wand.
9560 %
9561 %    o border: the border pixel wand.
9562 %
9563 */
9564 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9565   const PixelWand *border)
9566 {
9567   assert(wand != (MagickWand *) NULL);
9568   assert(wand->signature == WandSignature);
9569   if (wand->debug != MagickFalse)
9570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9571   if (wand->images == (Image *) NULL)
9572     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9573   PixelGetQuantumColor(border,&wand->images->border_color);
9574   return(MagickTrue);
9575 }
9576 \f
9577 /*
9578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9579 %                                                                             %
9580 %                                                                             %
9581 %                                                                             %
9582 %   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                       %
9583 %                                                                             %
9584 %                                                                             %
9585 %                                                                             %
9586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9587 %
9588 %  MagickSetImageChannelDepth() sets the depth of a particular image channel.
9589 %
9590 %  The format of the MagickSetImageChannelDepth method is:
9591 %
9592 %      MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9593 %        const ChannelType channel,const size_t depth)
9594 %
9595 %  A description of each parameter follows:
9596 %
9597 %    o wand: the magick wand.
9598 %
9599 %    o channel: the image channel(s).
9600 %
9601 %    o depth: the image depth in bits.
9602 %
9603 */
9604 WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9605   const ChannelType channel,const size_t depth)
9606 {
9607   assert(wand != (MagickWand *) NULL);
9608   assert(wand->signature == WandSignature);
9609   if (wand->debug != MagickFalse)
9610     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9611   if (wand->images == (Image *) NULL)
9612     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9613   return(SetImageChannelDepth(wand->images,channel,depth));
9614 }
9615 \f
9616 /*
9617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9618 %                                                                             %
9619 %                                                                             %
9620 %                                                                             %
9621 %   M a g i c k S e t I m a g e C l i p M a s k                               %
9622 %                                                                             %
9623 %                                                                             %
9624 %                                                                             %
9625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9626 %
9627 %  MagickSetImageClipMask() sets image clip mask.
9628 %
9629 %  The format of the MagickSetImageClipMask method is:
9630 %
9631 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9632 %        const MagickWand *clip_mask)
9633 %
9634 %  A description of each parameter follows:
9635 %
9636 %    o wand: the magick wand.
9637 %
9638 %    o clip_mask: the clip_mask wand.
9639 %
9640 */
9641 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9642   const MagickWand *clip_mask)
9643 {
9644   assert(wand != (MagickWand *) NULL);
9645   assert(wand->signature == WandSignature);
9646   if (wand->debug != MagickFalse)
9647     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9648   assert(clip_mask != (MagickWand *) NULL);
9649   assert(clip_mask->signature == WandSignature);
9650   if (wand->debug != MagickFalse)
9651     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9652   if (clip_mask->images == (Image *) NULL)
9653     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9654   return(SetImageClipMask(wand->images,clip_mask->images));
9655 }
9656 \f
9657 /*
9658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9659 %                                                                             %
9660 %                                                                             %
9661 %                                                                             %
9662 %   M a g i c k S e t I m a g e C o l o r                                     %
9663 %                                                                             %
9664 %                                                                             %
9665 %                                                                             %
9666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9667 %
9668 %  MagickSetImageColor() set the entire wand canvas to the specified color.
9669 %
9670 %  The format of the MagickSetImageColor method is:
9671 %
9672 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9673 %        const PixelWand *color)
9674 %
9675 %  A description of each parameter follows:
9676 %
9677 %    o wand: the magick wand.
9678 %
9679 %    o background: the image color.
9680 %
9681 */
9682 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9683   const PixelWand *color)
9684 {
9685   MagickBooleanType
9686     status;
9687
9688   MagickPixelPacket
9689     pixel;
9690
9691   assert(wand != (MagickWand *) NULL);
9692   assert(wand->signature == WandSignature);
9693   if (wand->debug != MagickFalse)
9694     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9695   PixelGetMagickColor(color,&pixel);
9696   status=SetImageColor(wand->images,&pixel);
9697   if (status == MagickFalse)
9698     InheritException(wand->exception,&wand->images->exception);
9699   return(status);
9700 }
9701 \f
9702 /*
9703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9704 %                                                                             %
9705 %                                                                             %
9706 %                                                                             %
9707 %   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                     %
9708 %                                                                             %
9709 %                                                                             %
9710 %                                                                             %
9711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9712 %
9713 %  MagickSetImageColormapColor() sets the color of the specified colormap
9714 %  index.
9715 %
9716 %  The format of the MagickSetImageColormapColor method is:
9717 %
9718 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9719 %        const size_t index,const PixelWand *color)
9720 %
9721 %  A description of each parameter follows:
9722 %
9723 %    o wand: the magick wand.
9724 %
9725 %    o index: the offset into the image colormap.
9726 %
9727 %    o color: Return the colormap color in this wand.
9728 %
9729 */
9730 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9731   const size_t index,const PixelWand *color)
9732 {
9733   assert(wand != (MagickWand *) NULL);
9734   assert(wand->signature == WandSignature);
9735   if (wand->debug != MagickFalse)
9736     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9737   if (wand->images == (Image *) NULL)
9738     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9739   if ((wand->images->colormap == (PixelPacket *) NULL) ||
9740       (index >= wand->images->colors))
9741     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9742   PixelGetQuantumColor(color,wand->images->colormap+index);
9743   return(SyncImage(wand->images));
9744 }
9745 \f
9746 /*
9747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9748 %                                                                             %
9749 %                                                                             %
9750 %                                                                             %
9751 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9752 %                                                                             %
9753 %                                                                             %
9754 %                                                                             %
9755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9756 %
9757 %  MagickSetImageColorspace() sets the image colorspace.
9758 %
9759 %  The format of the MagickSetImageColorspace method is:
9760 %
9761 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9762 %        const ColorspaceType colorspace)
9763 %
9764 %  A description of each parameter follows:
9765 %
9766 %    o wand: the magick wand.
9767 %
9768 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9769 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9770 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9771 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9772 %      HSLColorspace, or HWBColorspace.
9773 %
9774 */
9775 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9776   const ColorspaceType colorspace)
9777 {
9778   assert(wand != (MagickWand *) NULL);
9779   assert(wand->signature == WandSignature);
9780   if (wand->debug != MagickFalse)
9781     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9782   if (wand->images == (Image *) NULL)
9783     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9784   return(SetImageColorspace(wand->images,colorspace));
9785 }
9786 \f
9787 /*
9788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9789 %                                                                             %
9790 %                                                                             %
9791 %                                                                             %
9792 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9793 %                                                                             %
9794 %                                                                             %
9795 %                                                                             %
9796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9797 %
9798 %  MagickSetImageCompose() sets the image composite operator, useful for
9799 %  specifying how to composite the image thumbnail when using the
9800 %  MagickMontageImage() method.
9801 %
9802 %  The format of the MagickSetImageCompose method is:
9803 %
9804 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9805 %        const CompositeOperator compose)
9806 %
9807 %  A description of each parameter follows:
9808 %
9809 %    o wand: the magick wand.
9810 %
9811 %    o compose: the image composite operator.
9812 %
9813 */
9814 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9815   const CompositeOperator compose)
9816 {
9817   assert(wand != (MagickWand *) NULL);
9818   assert(wand->signature == WandSignature);
9819   if (wand->debug != MagickFalse)
9820     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9821   if (wand->images == (Image *) NULL)
9822     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9823   wand->images->compose=compose;
9824   return(MagickTrue);
9825 }
9826 \f
9827 /*
9828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9829 %                                                                             %
9830 %                                                                             %
9831 %                                                                             %
9832 %   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                         %
9833 %                                                                             %
9834 %                                                                             %
9835 %                                                                             %
9836 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9837 %
9838 %  MagickSetImageCompression() sets the image compression.
9839 %
9840 %  The format of the MagickSetImageCompression method is:
9841 %
9842 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9843 %        const CompressionType compression)
9844 %
9845 %  A description of each parameter follows:
9846 %
9847 %    o wand: the magick wand.
9848 %
9849 %    o compression: the image compression type.
9850 %
9851 */
9852 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9853   const CompressionType compression)
9854 {
9855   assert(wand != (MagickWand *) NULL);
9856   assert(wand->signature == WandSignature);
9857   if (wand->debug != MagickFalse)
9858     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9859   if (wand->images == (Image *) NULL)
9860     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9861   wand->images->compression=compression;
9862   return(MagickTrue);
9863 }
9864 \f
9865 /*
9866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9867 %                                                                             %
9868 %                                                                             %
9869 %                                                                             %
9870 %   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           %
9871 %                                                                             %
9872 %                                                                             %
9873 %                                                                             %
9874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9875 %
9876 %  MagickSetImageCompressionQuality() sets the image compression quality.
9877 %
9878 %  The format of the MagickSetImageCompressionQuality method is:
9879 %
9880 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9881 %        const size_t quality)
9882 %
9883 %  A description of each parameter follows:
9884 %
9885 %    o wand: the magick wand.
9886 %
9887 %    o quality: the image compression tlityype.
9888 %
9889 */
9890 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9891   const size_t quality)
9892 {
9893   assert(wand != (MagickWand *) NULL);
9894   assert(wand->signature == WandSignature);
9895   if (wand->debug != MagickFalse)
9896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9897   if (wand->images == (Image *) NULL)
9898     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9899   wand->images->quality=quality;
9900   return(MagickTrue);
9901 }
9902 \f
9903 /*
9904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9905 %                                                                             %
9906 %                                                                             %
9907 %                                                                             %
9908 %   M a g i c k S e t I m a g e D e l a y                                     %
9909 %                                                                             %
9910 %                                                                             %
9911 %                                                                             %
9912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9913 %
9914 %  MagickSetImageDelay() sets the image delay.
9915 %
9916 %  The format of the MagickSetImageDelay method is:
9917 %
9918 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9919 %        const size_t delay)
9920 %
9921 %  A description of each parameter follows:
9922 %
9923 %    o wand: the magick wand.
9924 %
9925 %    o delay: the image delay in ticks-per-second units.
9926 %
9927 */
9928 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9929   const size_t delay)
9930 {
9931   assert(wand != (MagickWand *) NULL);
9932   assert(wand->signature == WandSignature);
9933   if (wand->debug != MagickFalse)
9934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9935   if (wand->images == (Image *) NULL)
9936     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9937   wand->images->delay=delay;
9938   return(MagickTrue);
9939 }
9940 \f
9941 /*
9942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9943 %                                                                             %
9944 %                                                                             %
9945 %                                                                             %
9946 %   M a g i c k S e t I m a g e D e p t h                                     %
9947 %                                                                             %
9948 %                                                                             %
9949 %                                                                             %
9950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9951 %
9952 %  MagickSetImageDepth() sets the image depth.
9953 %
9954 %  The format of the MagickSetImageDepth method is:
9955 %
9956 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9957 %        const size_t depth)
9958 %
9959 %  A description of each parameter follows:
9960 %
9961 %    o wand: the magick wand.
9962 %
9963 %    o depth: the image depth in bits: 8, 16, or 32.
9964 %
9965 */
9966 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9967   const size_t depth)
9968 {
9969   assert(wand != (MagickWand *) NULL);
9970   assert(wand->signature == WandSignature);
9971   if (wand->debug != MagickFalse)
9972     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9973   if (wand->images == (Image *) NULL)
9974     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9975   wand->images->depth=depth;
9976   return(MagickTrue);
9977 }
9978 \f
9979 /*
9980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9981 %                                                                             %
9982 %                                                                             %
9983 %                                                                             %
9984 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9985 %                                                                             %
9986 %                                                                             %
9987 %                                                                             %
9988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9989 %
9990 %  MagickSetImageDispose() sets the image disposal method.
9991 %
9992 %  The format of the MagickSetImageDispose method is:
9993 %
9994 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9995 %        const DisposeType dispose)
9996 %
9997 %  A description of each parameter follows:
9998 %
9999 %    o wand: the magick wand.
10000 %
10001 %    o dispose: the image disposeal type.
10002 %
10003 */
10004 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10005   const DisposeType dispose)
10006 {
10007   assert(wand != (MagickWand *) NULL);
10008   assert(wand->signature == WandSignature);
10009   if (wand->debug != MagickFalse)
10010     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10011   if (wand->images == (Image *) NULL)
10012     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10013   wand->images->dispose=dispose;
10014   return(MagickTrue);
10015 }
10016 \f
10017 /*
10018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10019 %                                                                             %
10020 %                                                                             %
10021 %                                                                             %
10022 %   M a g i c k S e t I m a g e E x t e n t                                   %
10023 %                                                                             %
10024 %                                                                             %
10025 %                                                                             %
10026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10027 %
10028 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
10029 %
10030 %  The format of the MagickSetImageExtent method is:
10031 %
10032 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10033 %        const size_t columns,const unsigned rows)
10034 %
10035 %  A description of each parameter follows:
10036 %
10037 %    o wand: the magick wand.
10038 %
10039 %    o columns:  The image width in pixels.
10040 %
10041 %    o rows:  The image height in pixels.
10042 %
10043 */
10044 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10045   const size_t columns,const size_t rows)
10046 {
10047   assert(wand != (MagickWand *) NULL);
10048   assert(wand->signature == WandSignature);
10049   if (wand->debug != MagickFalse)
10050     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10051   if (wand->images == (Image *) NULL)
10052     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10053   return(SetImageExtent(wand->images,columns,rows));
10054 }
10055 \f
10056 /*
10057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10058 %                                                                             %
10059 %                                                                             %
10060 %                                                                             %
10061 %   M a g i c k S e t I m a g e F i l e n a m e                               %
10062 %                                                                             %
10063 %                                                                             %
10064 %                                                                             %
10065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10066 %
10067 %  MagickSetImageFilename() sets the filename of a particular image in a
10068 %  sequence.
10069 %
10070 %  The format of the MagickSetImageFilename method is:
10071 %
10072 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10073 %        const char *filename)
10074 %
10075 %  A description of each parameter follows:
10076 %
10077 %    o wand: the magick wand.
10078 %
10079 %    o filename: the image filename.
10080 %
10081 */
10082 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10083   const char *filename)
10084 {
10085   assert(wand != (MagickWand *) NULL);
10086   assert(wand->signature == WandSignature);
10087   if (wand->debug != MagickFalse)
10088     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10089   if (wand->images == (Image *) NULL)
10090     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10091   if (filename != (const char *) NULL)
10092     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
10093   return(MagickTrue);
10094 }
10095 \f
10096 /*
10097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10098 %                                                                             %
10099 %                                                                             %
10100 %                                                                             %
10101 %   M a g i c k S e t I m a g e F o r m a t                                   %
10102 %                                                                             %
10103 %                                                                             %
10104 %                                                                             %
10105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10106 %
10107 %  MagickSetImageFormat() sets the format of a particular image in a
10108 %  sequence.
10109 %
10110 %  The format of the MagickSetImageFormat method is:
10111 %
10112 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10113 %        const char *format)
10114 %
10115 %  A description of each parameter follows:
10116 %
10117 %    o wand: the magick wand.
10118 %
10119 %    o format: the image format.
10120 %
10121 */
10122 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10123   const char *format)
10124 {
10125   const MagickInfo
10126     *magick_info;
10127
10128   assert(wand != (MagickWand *) NULL);
10129   assert(wand->signature == WandSignature);
10130   if (wand->debug != MagickFalse)
10131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10132   if (wand->images == (Image *) NULL)
10133     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10134   if ((format == (char *) NULL) || (*format == '\0'))
10135     {
10136       *wand->images->magick='\0';
10137       return(MagickTrue);
10138     }
10139   magick_info=GetMagickInfo(format,wand->exception);
10140   if (magick_info == (const MagickInfo *) NULL)
10141     return(MagickFalse);
10142   ClearMagickException(wand->exception);
10143   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
10144   return(MagickTrue);
10145 }
10146 \f
10147 /*
10148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10149 %                                                                             %
10150 %                                                                             %
10151 %                                                                             %
10152 %   M a g i c k S e t I m a g e F u z z                                       %
10153 %                                                                             %
10154 %                                                                             %
10155 %                                                                             %
10156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10157 %
10158 %  MagickSetImageFuzz() sets the image fuzz.
10159 %
10160 %  The format of the MagickSetImageFuzz method is:
10161 %
10162 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10163 %        const double fuzz)
10164 %
10165 %  A description of each parameter follows:
10166 %
10167 %    o wand: the magick wand.
10168 %
10169 %    o fuzz: the image fuzz.
10170 %
10171 */
10172 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10173   const double fuzz)
10174 {
10175   assert(wand != (MagickWand *) NULL);
10176   assert(wand->signature == WandSignature);
10177   if (wand->debug != MagickFalse)
10178     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10179   if (wand->images == (Image *) NULL)
10180     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10181   wand->images->fuzz=fuzz;
10182   return(MagickTrue);
10183 }
10184 \f
10185 /*
10186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10187 %                                                                             %
10188 %                                                                             %
10189 %                                                                             %
10190 %   M a g i c k S e t I m a g e G a m m a                                     %
10191 %                                                                             %
10192 %                                                                             %
10193 %                                                                             %
10194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10195 %
10196 %  MagickSetImageGamma() sets the image gamma.
10197 %
10198 %  The format of the MagickSetImageGamma method is:
10199 %
10200 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10201 %        const double gamma)
10202 %
10203 %  A description of each parameter follows:
10204 %
10205 %    o wand: the magick wand.
10206 %
10207 %    o gamma: the image gamma.
10208 %
10209 */
10210 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10211   const double gamma)
10212 {
10213   assert(wand != (MagickWand *) NULL);
10214   assert(wand->signature == WandSignature);
10215   if (wand->debug != MagickFalse)
10216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10217   if (wand->images == (Image *) NULL)
10218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10219   wand->images->gamma=gamma;
10220   return(MagickTrue);
10221 }
10222 \f
10223 /*
10224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10225 %                                                                             %
10226 %                                                                             %
10227 %                                                                             %
10228 %   M a g i c k S e t I m a g e G r a v i t y                                 %
10229 %                                                                             %
10230 %                                                                             %
10231 %                                                                             %
10232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10233 %
10234 %  MagickSetImageGravity() sets the image gravity type.
10235 %
10236 %  The format of the MagickSetImageGravity method is:
10237 %
10238 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10239 %        const GravityType gravity)
10240 %
10241 %  A description of each parameter follows:
10242 %
10243 %    o wand: the magick wand.
10244 %
10245 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10246 %      PlaneInterlace, PartitionInterlace.
10247 %
10248 */
10249 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10250   const GravityType gravity)
10251 {
10252   assert(wand != (MagickWand *) NULL);
10253   assert(wand->signature == WandSignature);
10254   if (wand->debug != MagickFalse)
10255     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10256   if (wand->images == (Image *) NULL)
10257     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10258   wand->images->gravity=gravity;
10259   return(MagickTrue);
10260 }
10261 \f
10262 /*
10263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10264 %                                                                             %
10265 %                                                                             %
10266 %                                                                             %
10267 %   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                       %
10268 %                                                                             %
10269 %                                                                             %
10270 %                                                                             %
10271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10272 %
10273 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
10274 %  point.
10275 %
10276 %  The format of the MagickSetImageGreenPrimary method is:
10277 %
10278 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10279 %        const double x,const double y)
10280 %
10281 %  A description of each parameter follows:
10282 %
10283 %    o wand: the magick wand.
10284 %
10285 %    o x: the green primary x-point.
10286 %
10287 %    o y: the green primary y-point.
10288 %
10289 %
10290 */
10291 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10292   const double x,const double y)
10293 {
10294   assert(wand != (MagickWand *) NULL);
10295   assert(wand->signature == WandSignature);
10296   if (wand->debug != MagickFalse)
10297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10298   if (wand->images == (Image *) NULL)
10299     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10300   wand->images->chromaticity.green_primary.x=x;
10301   wand->images->chromaticity.green_primary.y=y;
10302   return(MagickTrue);
10303 }
10304 \f
10305 /*
10306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10307 %                                                                             %
10308 %                                                                             %
10309 %                                                                             %
10310 %   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                 %
10311 %                                                                             %
10312 %                                                                             %
10313 %                                                                             %
10314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10315 %
10316 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10317 %
10318 %  The format of the MagickSetImageInterlaceScheme method is:
10319 %
10320 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10321 %        const InterlaceType interlace)
10322 %
10323 %  A description of each parameter follows:
10324 %
10325 %    o wand: the magick wand.
10326 %
10327 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10328 %      PlaneInterlace, PartitionInterlace.
10329 %
10330 */
10331 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10332   const InterlaceType interlace)
10333 {
10334   assert(wand != (MagickWand *) NULL);
10335   assert(wand->signature == WandSignature);
10336   if (wand->debug != MagickFalse)
10337     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10338   if (wand->images == (Image *) NULL)
10339     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10340   wand->images->interlace=interlace;
10341   return(MagickTrue);
10342 }
10343 \f
10344 /*
10345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10346 %                                                                             %
10347 %                                                                             %
10348 %                                                                             %
10349 %   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             %
10350 %                                                                             %
10351 %                                                                             %
10352 %                                                                             %
10353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10354 %
10355 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10356 %
10357 %  The format of the MagickSetImageInterpolateMethod method is:
10358 %
10359 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10360 %        const InterpolatePixelMethod method)
10361 %
10362 %  A description of each parameter follows:
10363 %
10364 %    o wand: the magick wand.
10365 %
10366 %    o method: the image interpole pixel methods: choose from Undefined,
10367 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10368 %
10369 */
10370 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10371   const InterpolatePixelMethod method)
10372 {
10373   assert(wand != (MagickWand *) NULL);
10374   assert(wand->signature == WandSignature);
10375   if (wand->debug != MagickFalse)
10376     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10377   if (wand->images == (Image *) NULL)
10378     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10379   wand->images->interpolate=method;
10380   return(MagickTrue);
10381 }
10382 \f
10383 /*
10384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10385 %                                                                             %
10386 %                                                                             %
10387 %                                                                             %
10388 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10389 %                                                                             %
10390 %                                                                             %
10391 %                                                                             %
10392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10393 %
10394 %  MagickSetImageIterations() sets the image iterations.
10395 %
10396 %  The format of the MagickSetImageIterations method is:
10397 %
10398 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10399 %        const size_t iterations)
10400 %
10401 %  A description of each parameter follows:
10402 %
10403 %    o wand: the magick wand.
10404 %
10405 %    o delay: the image delay in 1/100th of a second.
10406 %
10407 */
10408 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10409   const size_t iterations)
10410 {
10411   assert(wand != (MagickWand *) NULL);
10412   assert(wand->signature == WandSignature);
10413   if (wand->debug != MagickFalse)
10414     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10415   if (wand->images == (Image *) NULL)
10416     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10417   wand->images->iterations=iterations;
10418   return(MagickTrue);
10419 }
10420 \f
10421 /*
10422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10423 %                                                                             %
10424 %                                                                             %
10425 %                                                                             %
10426 %   M a g i c k S e t I m a g e M a t t e                                     %
10427 %                                                                             %
10428 %                                                                             %
10429 %                                                                             %
10430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10431 %
10432 %  MagickSetImageMatte() sets the image matte channel.
10433 %
10434 %  The format of the MagickSetImageMatteColor method is:
10435 %
10436 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10437 %        const MagickBooleanType *matte)
10438 %
10439 %  A description of each parameter follows:
10440 %
10441 %    o wand: the magick wand.
10442 %
10443 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10444 %      MagickFalse.
10445 %
10446 */
10447 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10448   const MagickBooleanType matte)
10449 {
10450   assert(wand != (MagickWand *) NULL);
10451   assert(wand->signature == WandSignature);
10452   if (wand->debug != MagickFalse)
10453     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10454   if (wand->images == (Image *) NULL)
10455     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10456   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10457     (void) SetImageOpacity(wand->images,OpaqueOpacity);
10458   wand->images->matte=matte;
10459   return(MagickTrue);
10460 }
10461 \f
10462 /*
10463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10464 %                                                                             %
10465 %                                                                             %
10466 %                                                                             %
10467 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10468 %                                                                             %
10469 %                                                                             %
10470 %                                                                             %
10471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10472 %
10473 %  MagickSetImageMatteColor() sets the image matte color.
10474 %
10475 %  The format of the MagickSetImageMatteColor method is:
10476 %
10477 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10478 %        const PixelWand *matte)
10479 %
10480 %  A description of each parameter follows:
10481 %
10482 %    o wand: the magick wand.
10483 %
10484 %    o matte: the matte pixel wand.
10485 %
10486 */
10487 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10488   const PixelWand *matte)
10489 {
10490   assert(wand != (MagickWand *) NULL);
10491   assert(wand->signature == WandSignature);
10492   if (wand->debug != MagickFalse)
10493     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10494   if (wand->images == (Image *) NULL)
10495     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10496   PixelGetQuantumColor(matte,&wand->images->matte_color);
10497   return(MagickTrue);
10498 }
10499 \f
10500 /*
10501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10502 %                                                                             %
10503 %                                                                             %
10504 %                                                                             %
10505 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10506 %                                                                             %
10507 %                                                                             %
10508 %                                                                             %
10509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10510 %
10511 %  MagickSetImageOpacity() sets the image to the specified opacity level.
10512 %
10513 %  The format of the MagickSetImageOpacity method is:
10514 %
10515 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10516 %        const double alpha)
10517 %
10518 %  A description of each parameter follows:
10519 %
10520 %    o wand: the magick wand.
10521 %
10522 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10523 %      transparent.
10524 %
10525 */
10526 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10527   const double alpha)
10528 {
10529   MagickBooleanType
10530     status;
10531
10532   assert(wand != (MagickWand *) NULL);
10533   assert(wand->signature == WandSignature);
10534   if (wand->debug != MagickFalse)
10535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10536   if (wand->images == (Image *) NULL)
10537     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10538   status=SetImageOpacity(wand->images,ClampToQuantum((MagickRealType)
10539     QuantumRange-QuantumRange*alpha));
10540   if (status == MagickFalse)
10541     InheritException(wand->exception,&wand->images->exception);
10542   return(status);
10543 }
10544 \f
10545 /*
10546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10547 %                                                                             %
10548 %                                                                             %
10549 %                                                                             %
10550 %   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                         %
10551 %                                                                             %
10552 %                                                                             %
10553 %                                                                             %
10554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10555 %
10556 %  MagickSetImageOrientation() sets the image orientation.
10557 %
10558 %  The format of the MagickSetImageOrientation method is:
10559 %
10560 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10561 %        const OrientationType orientation)
10562 %
10563 %  A description of each parameter follows:
10564 %
10565 %    o wand: the magick wand.
10566 %
10567 %    o orientation: the image orientation type.
10568 %
10569 */
10570 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10571   const OrientationType orientation)
10572 {
10573   assert(wand != (MagickWand *) NULL);
10574   assert(wand->signature == WandSignature);
10575   if (wand->debug != MagickFalse)
10576     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10577   if (wand->images == (Image *) NULL)
10578     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10579   wand->images->orientation=orientation;
10580   return(MagickTrue);
10581 }
10582 \f
10583 /*
10584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10585 %                                                                             %
10586 %                                                                             %
10587 %                                                                             %
10588 %   M a g i c k S e t I m a g e P a g e                                       %
10589 %                                                                             %
10590 %                                                                             %
10591 %                                                                             %
10592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10593 %
10594 %  MagickSetImagePage() sets the page geometry of the image.
10595 %
10596 %  The format of the MagickSetImagePage method is:
10597 %
10598 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10599 %        const size_t width,const size_t height,const ssize_t x,
10600 %        const ssize_t y)
10601 %
10602 %  A description of each parameter follows:
10603 %
10604 %    o wand: the magick wand.
10605 %
10606 %    o width: the page width.
10607 %
10608 %    o height: the page height.
10609 %
10610 %    o x: the page x-offset.
10611 %
10612 %    o y: the page y-offset.
10613 %
10614 */
10615 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10616   const size_t width,const size_t height,const ssize_t x,
10617   const ssize_t y)
10618 {
10619   assert(wand != (MagickWand *) NULL);
10620   assert(wand->signature == WandSignature);
10621   if (wand->debug != MagickFalse)
10622     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10623   if (wand->images == (Image *) NULL)
10624     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10625   wand->images->page.width=width;
10626   wand->images->page.height=height;
10627   wand->images->page.x=x;
10628   wand->images->page.y=y;
10629   return(MagickTrue);
10630 }
10631 \f
10632 /*
10633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10634 %                                                                             %
10635 %                                                                             %
10636 %                                                                             %
10637 %   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                 %
10638 %                                                                             %
10639 %                                                                             %
10640 %                                                                             %
10641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10642 %
10643 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10644 %  specified method and returns the previous progress monitor if any.  The
10645 %  progress monitor method looks like this:
10646 %
10647 %    MagickBooleanType MagickProgressMonitor(const char *text,
10648 %      const MagickOffsetType offset,const MagickSizeType span,
10649 %      void *client_data)
10650 %
10651 %  If the progress monitor returns MagickFalse, the current operation is
10652 %  interrupted.
10653 %
10654 %  The format of the MagickSetImageProgressMonitor method is:
10655 %
10656 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10657 %        const MagickProgressMonitor progress_monitor,void *client_data)
10658 %
10659 %  A description of each parameter follows:
10660 %
10661 %    o wand: the magick wand.
10662 %
10663 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10664 %      of an image operation.
10665 %
10666 %    o client_data: Specifies a pointer to any client data.
10667 %
10668 */
10669 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10670   const MagickProgressMonitor progress_monitor,void *client_data)
10671 {
10672   MagickProgressMonitor
10673     previous_monitor;
10674
10675   assert(wand != (MagickWand *) NULL);
10676   assert(wand->signature == WandSignature);
10677   if (wand->debug != MagickFalse)
10678     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10679   if (wand->images == (Image *) NULL)
10680     {
10681       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10682         "ContainsNoImages","`%s'",wand->name);
10683       return((MagickProgressMonitor) NULL);
10684     }
10685   previous_monitor=SetImageProgressMonitor(wand->images,
10686     progress_monitor,client_data);
10687   return(previous_monitor);
10688 }
10689 \f
10690 /*
10691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10692 %                                                                             %
10693 %                                                                             %
10694 %                                                                             %
10695 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10696 %                                                                             %
10697 %                                                                             %
10698 %                                                                             %
10699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10700 %
10701 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10702 %
10703 %  The format of the MagickSetImageRedPrimary method is:
10704 %
10705 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10706 %        const double x,const double y)
10707 %
10708 %  A description of each parameter follows:
10709 %
10710 %    o wand: the magick wand.
10711 %
10712 %    o x: the red primary x-point.
10713 %
10714 %    o y: the red primary y-point.
10715 %
10716 */
10717 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10718   const double x,const double y)
10719 {
10720   assert(wand != (MagickWand *) NULL);
10721   assert(wand->signature == WandSignature);
10722   if (wand->debug != MagickFalse)
10723     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10724   if (wand->images == (Image *) NULL)
10725     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10726   wand->images->chromaticity.red_primary.x=x;
10727   wand->images->chromaticity.red_primary.y=y;
10728   return(MagickTrue);
10729 }
10730 \f
10731 /*
10732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10733 %                                                                             %
10734 %                                                                             %
10735 %                                                                             %
10736 %   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                 %
10737 %                                                                             %
10738 %                                                                             %
10739 %                                                                             %
10740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10741 %
10742 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10743 %
10744 %  The format of the MagickSetImageRenderingIntent method is:
10745 %
10746 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10747 %        const RenderingIntent rendering_intent)
10748 %
10749 %  A description of each parameter follows:
10750 %
10751 %    o wand: the magick wand.
10752 %
10753 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10754 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10755 %
10756 */
10757 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10758   const RenderingIntent rendering_intent)
10759 {
10760   assert(wand != (MagickWand *) NULL);
10761   assert(wand->signature == WandSignature);
10762   if (wand->debug != MagickFalse)
10763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10764   if (wand->images == (Image *) NULL)
10765     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10766   wand->images->rendering_intent=rendering_intent;
10767   return(MagickTrue);
10768 }
10769 \f
10770 /*
10771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10772 %                                                                             %
10773 %                                                                             %
10774 %                                                                             %
10775 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10776 %                                                                             %
10777 %                                                                             %
10778 %                                                                             %
10779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10780 %
10781 %  MagickSetImageResolution() sets the image resolution.
10782 %
10783 %  The format of the MagickSetImageResolution method is:
10784 %
10785 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10786 %        const double x_resolution,const doubtl y_resolution)
10787 %
10788 %  A description of each parameter follows:
10789 %
10790 %    o wand: the magick wand.
10791 %
10792 %    o x_resolution: the image x resolution.
10793 %
10794 %    o y_resolution: the image y resolution.
10795 %
10796 */
10797 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10798   const double x_resolution,const double y_resolution)
10799 {
10800   assert(wand != (MagickWand *) NULL);
10801   assert(wand->signature == WandSignature);
10802   if (wand->debug != MagickFalse)
10803     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10804   if (wand->images == (Image *) NULL)
10805     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10806   wand->images->x_resolution=x_resolution;
10807   wand->images->y_resolution=y_resolution;
10808   return(MagickTrue);
10809 }
10810 \f
10811 /*
10812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10813 %                                                                             %
10814 %                                                                             %
10815 %                                                                             %
10816 %   M a g i c k S e t I m a g e S c e n e                                     %
10817 %                                                                             %
10818 %                                                                             %
10819 %                                                                             %
10820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10821 %
10822 %  MagickSetImageScene() sets the image scene.
10823 %
10824 %  The format of the MagickSetImageScene method is:
10825 %
10826 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10827 %        const size_t scene)
10828 %
10829 %  A description of each parameter follows:
10830 %
10831 %    o wand: the magick wand.
10832 %
10833 %    o delay: the image scene number.
10834 %
10835 */
10836 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10837   const size_t scene)
10838 {
10839   assert(wand != (MagickWand *) NULL);
10840   assert(wand->signature == WandSignature);
10841   if (wand->debug != MagickFalse)
10842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10843   if (wand->images == (Image *) NULL)
10844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10845   wand->images->scene=scene;
10846   return(MagickTrue);
10847 }
10848 \f
10849 /*
10850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10851 %                                                                             %
10852 %                                                                             %
10853 %                                                                             %
10854 %   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                   %
10855 %                                                                             %
10856 %                                                                             %
10857 %                                                                             %
10858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10859 %
10860 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10861 %
10862 %  The format of the MagickSetImageTicksPerSecond method is:
10863 %
10864 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10865 %        const ssize_t ticks_per-second)
10866 %
10867 %  A description of each parameter follows:
10868 %
10869 %    o wand: the magick wand.
10870 %
10871 %    o ticks_per_second: the units to use for the image delay.
10872 %
10873 */
10874 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10875   const ssize_t ticks_per_second)
10876 {
10877   assert(wand != (MagickWand *) NULL);
10878   assert(wand->signature == WandSignature);
10879   if (wand->debug != MagickFalse)
10880     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10881   if (wand->images == (Image *) NULL)
10882     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10883   wand->images->ticks_per_second=ticks_per_second;
10884   return(MagickTrue);
10885 }
10886 \f
10887 /*
10888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10889 %                                                                             %
10890 %                                                                             %
10891 %                                                                             %
10892 %   M a g i c k S e t I m a g e T y p e                                       %
10893 %                                                                             %
10894 %                                                                             %
10895 %                                                                             %
10896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10897 %
10898 %  MagickSetImageType() sets the image type.
10899 %
10900 %  The format of the MagickSetImageType method is:
10901 %
10902 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10903 %        const ImageType image_type)
10904 %
10905 %  A description of each parameter follows:
10906 %
10907 %    o wand: the magick wand.
10908 %
10909 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10910 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10911 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10912 %      or OptimizeType.
10913 %
10914 */
10915 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10916   const ImageType image_type)
10917 {
10918   assert(wand != (MagickWand *) NULL);
10919   assert(wand->signature == WandSignature);
10920   if (wand->debug != MagickFalse)
10921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10922   if (wand->images == (Image *) NULL)
10923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10924   return(SetImageType(wand->images,image_type));
10925 }
10926 \f
10927 /*
10928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10929 %                                                                             %
10930 %                                                                             %
10931 %                                                                             %
10932 %   M a g i c k S e t I m a g e U n i t s                                     %
10933 %                                                                             %
10934 %                                                                             %
10935 %                                                                             %
10936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10937 %
10938 %  MagickSetImageUnits() sets the image units of resolution.
10939 %
10940 %  The format of the MagickSetImageUnits method is:
10941 %
10942 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10943 %        const ResolutionType units)
10944 %
10945 %  A description of each parameter follows:
10946 %
10947 %    o wand: the magick wand.
10948 %
10949 %    o units: the image units of resolution : UndefinedResolution,
10950 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10951 %
10952 */
10953 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10954   const ResolutionType units)
10955 {
10956   assert(wand != (MagickWand *) NULL);
10957   assert(wand->signature == WandSignature);
10958   if (wand->debug != MagickFalse)
10959     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10960   if (wand->images == (Image *) NULL)
10961     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10962   wand->images->units=units;
10963   return(MagickTrue);
10964 }
10965 \f
10966 /*
10967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10968 %                                                                             %
10969 %                                                                             %
10970 %                                                                             %
10971 %   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           %
10972 %                                                                             %
10973 %                                                                             %
10974 %                                                                             %
10975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10976 %
10977 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10978 %
10979 %  The format of the MagickSetImageVirtualPixelMethod method is:
10980 %
10981 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10982 %        const VirtualPixelMethod method)
10983 %
10984 %  A description of each parameter follows:
10985 %
10986 %    o wand: the magick wand.
10987 %
10988 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10989 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10990 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10991 %
10992 */
10993 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10994   const VirtualPixelMethod method)
10995 {
10996   assert(wand != (MagickWand *) NULL);
10997   assert(wand->signature == WandSignature);
10998   if (wand->debug != MagickFalse)
10999     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11000   if (wand->images == (Image *) NULL)
11001     return(UndefinedVirtualPixelMethod);
11002   return(SetImageVirtualPixelMethod(wand->images,method));
11003 }
11004 \f
11005 /*
11006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11007 %                                                                             %
11008 %                                                                             %
11009 %                                                                             %
11010 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
11011 %                                                                             %
11012 %                                                                             %
11013 %                                                                             %
11014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11015 %
11016 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
11017 %
11018 %  The format of the MagickSetImageWhitePoint method is:
11019 %
11020 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11021 %        const double x,const double y)
11022 %
11023 %  A description of each parameter follows:
11024 %
11025 %    o wand: the magick wand.
11026 %
11027 %    o x: the white x-point.
11028 %
11029 %    o y: the white y-point.
11030 %
11031 */
11032 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11033   const double x,const double y)
11034 {
11035   assert(wand != (MagickWand *) NULL);
11036   assert(wand->signature == WandSignature);
11037   if (wand->debug != MagickFalse)
11038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11039   if (wand->images == (Image *) NULL)
11040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11041   wand->images->chromaticity.white_point.x=x;
11042   wand->images->chromaticity.white_point.y=y;
11043   return(MagickTrue);
11044 }
11045 \f
11046 /*
11047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11048 %                                                                             %
11049 %                                                                             %
11050 %                                                                             %
11051 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
11052 %                                                                             %
11053 %                                                                             %
11054 %                                                                             %
11055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11056 %
11057 %  MagickShadeImage() shines a distant light on an image to create a
11058 %  three-dimensional effect. You control the positioning of the light with
11059 %  azimuth and elevation; azimuth is measured in degrees off the x axis
11060 %  and elevation is measured in pixels above the Z axis.
11061 %
11062 %  The format of the MagickShadeImage method is:
11063 %
11064 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
11065 %        const MagickBooleanType gray,const double azimuth,
11066 %        const double elevation)
11067 %
11068 %  A description of each parameter follows:
11069 %
11070 %    o wand: the magick wand.
11071 %
11072 %    o gray: A value other than zero shades the intensity of each pixel.
11073 %
11074 %    o azimuth, elevation:  Define the light source direction.
11075 %
11076 */
11077 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11078   const MagickBooleanType gray,const double asimuth,const double elevation)
11079 {
11080   Image
11081     *shade_image;
11082
11083   assert(wand != (MagickWand *) NULL);
11084   assert(wand->signature == WandSignature);
11085   if (wand->debug != MagickFalse)
11086     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11087   if (wand->images == (Image *) NULL)
11088     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11089   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
11090   if (shade_image == (Image *) NULL)
11091     return(MagickFalse);
11092   ReplaceImageInList(&wand->images,shade_image);
11093   return(MagickTrue);
11094 }
11095 \f
11096 /*
11097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11098 %                                                                             %
11099 %                                                                             %
11100 %                                                                             %
11101 %   M a g i c k S h a d o w I m a g e                                         %
11102 %                                                                             %
11103 %                                                                             %
11104 %                                                                             %
11105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11106 %
11107 %  MagickShadowImage() simulates an image shadow.
11108 %
11109 %  The format of the MagickShadowImage method is:
11110 %
11111 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
11112 %        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11113 %
11114 %  A description of each parameter follows:
11115 %
11116 %    o wand: the magick wand.
11117 %
11118 %    o opacity: percentage transparency.
11119 %
11120 %    o sigma: the standard deviation of the Gaussian, in pixels.
11121 %
11122 %    o x: the shadow x-offset.
11123 %
11124 %    o y: the shadow y-offset.
11125 %
11126 */
11127 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11128   const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11129 {
11130   Image
11131     *shadow_image;
11132
11133   assert(wand != (MagickWand *) NULL);
11134   assert(wand->signature == WandSignature);
11135   if (wand->debug != MagickFalse)
11136     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11137   if (wand->images == (Image *) NULL)
11138     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11139   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
11140   if (shadow_image == (Image *) NULL)
11141     return(MagickFalse);
11142   ReplaceImageInList(&wand->images,shadow_image);
11143   return(MagickTrue);
11144 }
11145 \f
11146 /*
11147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11148 %                                                                             %
11149 %                                                                             %
11150 %                                                                             %
11151 %   M a g i c k S h a r p e n I m a g e                                       %
11152 %                                                                             %
11153 %                                                                             %
11154 %                                                                             %
11155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11156 %
11157 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
11158 %  Gaussian operator of the given radius and standard deviation (sigma).
11159 %  For reasonable results, the radius should be larger than sigma.  Use a
11160 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11161 %
11162 %  The format of the MagickSharpenImage method is:
11163 %
11164 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
11165 %        const double radius,const double sigma)
11166 %      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11167 %        const ChannelType channel,const double radius,const double sigma)
11168 %
11169 %  A description of each parameter follows:
11170 %
11171 %    o wand: the magick wand.
11172 %
11173 %    o channel: the image channel(s).
11174 %
11175 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11176 %      pixel.
11177 %
11178 %    o sigma: the standard deviation of the Gaussian, in pixels.
11179 %
11180 */
11181
11182 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11183   const double radius,const double sigma)
11184 {
11185   MagickBooleanType
11186     status;
11187
11188   status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11189   return(status);
11190 }
11191
11192 WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11193   const ChannelType channel,const double radius,const double sigma)
11194 {
11195   Image
11196     *sharp_image;
11197
11198   assert(wand != (MagickWand *) NULL);
11199   assert(wand->signature == WandSignature);
11200   if (wand->debug != MagickFalse)
11201     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11202   if (wand->images == (Image *) NULL)
11203     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11204   sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11205     wand->exception);
11206   if (sharp_image == (Image *) NULL)
11207     return(MagickFalse);
11208   ReplaceImageInList(&wand->images,sharp_image);
11209   return(MagickTrue);
11210 }
11211 \f
11212 /*
11213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11214 %                                                                             %
11215 %                                                                             %
11216 %                                                                             %
11217 %   M a g i c k S h a v e I m a g e                                           %
11218 %                                                                             %
11219 %                                                                             %
11220 %                                                                             %
11221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11222 %
11223 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
11224 %  memory necessary for the new Image structure and returns a pointer to the
11225 %  new image.
11226 %
11227 %  The format of the MagickShaveImage method is:
11228 %
11229 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
11230 %        const size_t columns,const size_t rows)
11231 %
11232 %  A description of each parameter follows:
11233 %
11234 %    o wand: the magick wand.
11235 %
11236 %    o columns: the number of columns in the scaled image.
11237 %
11238 %    o rows: the number of rows in the scaled image.
11239 %
11240 %
11241 */
11242 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11243   const size_t columns,const size_t rows)
11244 {
11245   Image
11246     *shave_image;
11247
11248   RectangleInfo
11249     shave_info;
11250
11251   assert(wand != (MagickWand *) NULL);
11252   assert(wand->signature == WandSignature);
11253   if (wand->debug != MagickFalse)
11254     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11255   if (wand->images == (Image *) NULL)
11256     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11257   shave_info.width=columns;
11258   shave_info.height=rows;
11259   shave_info.x=0;
11260   shave_info.y=0;
11261   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11262   if (shave_image == (Image *) NULL)
11263     return(MagickFalse);
11264   ReplaceImageInList(&wand->images,shave_image);
11265   return(MagickTrue);
11266 }
11267 \f
11268 /*
11269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11270 %                                                                             %
11271 %                                                                             %
11272 %                                                                             %
11273 %   M a g i c k S h e a r I m a g e                                           %
11274 %                                                                             %
11275 %                                                                             %
11276 %                                                                             %
11277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11278 %
11279 %  MagickShearImage() slides one edge of an image along the X or Y axis,
11280 %  creating a parallelogram.  An X direction shear slides an edge along the X
11281 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
11282 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
11283 %  is measured relative to the Y axis, and similarly, for Y direction shears
11284 %  y_shear is measured relative to the X axis.  Empty triangles left over from
11285 %  shearing the image are filled with the background color.
11286 %
11287 %  The format of the MagickShearImage method is:
11288 %
11289 %      MagickBooleanType MagickShearImage(MagickWand *wand,
11290 %        const PixelWand *background,const double x_shear,onst double y_shear)
11291 %
11292 %  A description of each parameter follows:
11293 %
11294 %    o wand: the magick wand.
11295 %
11296 %    o background: the background pixel wand.
11297 %
11298 %    o x_shear: the number of degrees to shear the image.
11299 %
11300 %    o y_shear: the number of degrees to shear the image.
11301 %
11302 */
11303 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11304   const PixelWand *background,const double x_shear,const double y_shear)
11305 {
11306   Image
11307     *shear_image;
11308
11309   assert(wand != (MagickWand *) NULL);
11310   assert(wand->signature == WandSignature);
11311   if (wand->debug != MagickFalse)
11312     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11313   if (wand->images == (Image *) NULL)
11314     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11315   PixelGetQuantumColor(background,&wand->images->background_color);
11316   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11317   if (shear_image == (Image *) NULL)
11318     return(MagickFalse);
11319   ReplaceImageInList(&wand->images,shear_image);
11320   return(MagickTrue);
11321 }
11322 \f
11323 /*
11324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11325 %                                                                             %
11326 %                                                                             %
11327 %                                                                             %
11328 %   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                   %
11329 %                                                                             %
11330 %                                                                             %
11331 %                                                                             %
11332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11333 %
11334 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11335 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11336 %  image using a sigmoidal transfer function without saturating highlights or
11337 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11338 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11339 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11340 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11341 %  is reduced.
11342 %
11343 %  The format of the MagickSigmoidalContrastImage method is:
11344 %
11345 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11346 %        const MagickBooleanType sharpen,const double alpha,const double beta)
11347 %      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11348 %        const ChannelType channel,const MagickBooleanType sharpen,
11349 %        const double alpha,const double beta)
11350 %
11351 %  A description of each parameter follows:
11352 %
11353 %    o wand: the magick wand.
11354 %
11355 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
11356 %
11357 %    o sharpen: Increase or decrease image contrast.
11358 %
11359 %    o alpha: strength of the contrast, the larger the number the more
11360 %      'threshold-like' it becomes.
11361 %
11362 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
11363 %
11364 */
11365
11366 WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11367   const MagickBooleanType sharpen,const double alpha,const double beta)
11368 {
11369   MagickBooleanType
11370     status;
11371
11372   status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11373     alpha,beta);
11374   return(status);
11375 }
11376
11377 WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11378   MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11379   const double alpha,const double beta)
11380 {
11381   MagickBooleanType
11382     status;
11383
11384   assert(wand != (MagickWand *) NULL);
11385   assert(wand->signature == WandSignature);
11386   if (wand->debug != MagickFalse)
11387     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11388   if (wand->images == (Image *) NULL)
11389     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11390   status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11391   if (status == MagickFalse)
11392     InheritException(wand->exception,&wand->images->exception);
11393   return(status);
11394 }
11395 \f
11396 /*
11397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11398 %                                                                             %
11399 %                                                                             %
11400 %                                                                             %
11401 %   M a g i c k S i m i l a r i t y I m a g e                                 %
11402 %                                                                             %
11403 %                                                                             %
11404 %                                                                             %
11405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11406 %
11407 %  MagickSimilarityImage() compares the reference image of the image and
11408 %  returns the best match offset.  In addition, it returns a similarity image
11409 %  such that an exact match location is completely white and if none of the
11410 %  pixels match, black, otherwise some gray level in-between.
11411 %
11412 %  The format of the MagickSimilarityImage method is:
11413 %
11414 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
11415 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11416 %
11417 %  A description of each parameter follows:
11418 %
11419 %    o wand: the magick wand.
11420 %
11421 %    o reference: the reference wand.
11422 %
11423 %    o offset: the best match offset of the reference image within the image.
11424 %
11425 %    o similarity: the computed similarity between the images.
11426 %
11427 */
11428 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11429   const MagickWand *reference,RectangleInfo *offset,double *similarity)
11430 {
11431   Image
11432     *similarity_image;
11433
11434   assert(wand != (MagickWand *) NULL);
11435   assert(wand->signature == WandSignature);
11436   if (wand->debug != MagickFalse)
11437     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11438   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11439     {
11440       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11441         "ContainsNoImages","`%s'",wand->name);
11442       return((MagickWand *) NULL);
11443     }
11444   similarity_image=SimilarityImage(wand->images,reference->images,offset,
11445     similarity,&wand->images->exception);
11446   if (similarity_image == (Image *) NULL)
11447     return((MagickWand *) NULL);
11448   return(CloneMagickWandFromImages(wand,similarity_image));
11449 }
11450 \f
11451 /*
11452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11453 %                                                                             %
11454 %                                                                             %
11455 %                                                                             %
11456 %   M a g i c k S k e t c h I m a g e                                         %
11457 %                                                                             %
11458 %                                                                             %
11459 %                                                                             %
11460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11461 %
11462 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11463 %  a Gaussian operator of the given radius and standard deviation (sigma).
11464 %  For reasonable results, radius should be larger than sigma.  Use a
11465 %  radius of 0 and SketchImage() selects a suitable radius for you.
11466 %  Angle gives the angle of the blurring motion.
11467 %
11468 %  The format of the MagickSketchImage method is:
11469 %
11470 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11471 %        const double radius,const double sigma,const double angle)
11472 %
11473 %  A description of each parameter follows:
11474 %
11475 %    o wand: the magick wand.
11476 %
11477 %    o radius: the radius of the Gaussian, in pixels, not counting
11478 %      the center pixel.
11479 %
11480 %    o sigma: the standard deviation of the Gaussian, in pixels.
11481 %
11482 %    o angle: Apply the effect along this angle.
11483 %
11484 */
11485 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11486   const double radius,const double sigma,const double angle)
11487 {
11488   Image
11489     *sketch_image;
11490
11491   assert(wand != (MagickWand *) NULL);
11492   assert(wand->signature == WandSignature);
11493   if (wand->debug != MagickFalse)
11494     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11495   if (wand->images == (Image *) NULL)
11496     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11497   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11498   if (sketch_image == (Image *) NULL)
11499     return(MagickFalse);
11500   ReplaceImageInList(&wand->images,sketch_image);
11501   return(MagickTrue);
11502 }
11503 \f
11504 /*
11505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11506 %                                                                             %
11507 %                                                                             %
11508 %                                                                             %
11509 %   M a g i c k S m u s h I m a g e s                                         %
11510 %                                                                             %
11511 %                                                                             %
11512 %                                                                             %
11513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11514 %
11515 %  MagickSmushImages() takes all images from the current image pointer to the
11516 %  end of the image list and smushs them to each other top-to-bottom if the
11517 %  stack parameter is true, otherwise left-to-right.
11518 %
11519 %  The format of the MagickSmushImages method is:
11520 %
11521 %      MagickWand *MagickSmushImages(MagickWand *wand,
11522 %        const MagickBooleanType stack,const ssize_t offset)
11523 %
11524 %  A description of each parameter follows:
11525 %
11526 %    o wand: the magick wand.
11527 %
11528 %    o stack: By default, images are stacked left-to-right. Set stack to
11529 %      MagickTrue to stack them top-to-bottom.
11530 %
11531 %    o offset: minimum distance in pixels between images.
11532 %
11533 */
11534 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11535   const MagickBooleanType stack,const ssize_t offset)
11536 {
11537   Image
11538     *smush_image;
11539
11540   assert(wand != (MagickWand *) NULL);
11541   assert(wand->signature == WandSignature);
11542   if (wand->debug != MagickFalse)
11543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11544   if (wand->images == (Image *) NULL)
11545     return((MagickWand *) NULL);
11546   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11547   if (smush_image == (Image *) NULL)
11548     return((MagickWand *) NULL);
11549   return(CloneMagickWandFromImages(wand,smush_image));
11550 }
11551 \f
11552 /*
11553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11554 %                                                                             %
11555 %                                                                             %
11556 %                                                                             %
11557 %     M a g i c k S o l a r i z e I m a g e                                   %
11558 %                                                                             %
11559 %                                                                             %
11560 %                                                                             %
11561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11562 %
11563 %  MagickSolarizeImage() applies a special effect to the image, similar to the
11564 %  effect achieved in a photo darkroom by selectively exposing areas of photo
11565 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11566 %  measure of the extent of the solarization.
11567 %
11568 %  The format of the MagickSolarizeImage method is:
11569 %
11570 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11571 %        const double threshold)
11572 %
11573 %  A description of each parameter follows:
11574 %
11575 %    o wand: the magick wand.
11576 %
11577 %    o threshold:  Define the extent of the solarization.
11578 %
11579 */
11580 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11581   const double threshold)
11582 {
11583   MagickBooleanType
11584     status;
11585
11586   assert(wand != (MagickWand *) NULL);
11587   assert(wand->signature == WandSignature);
11588   if (wand->debug != MagickFalse)
11589     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11590   if (wand->images == (Image *) NULL)
11591     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11592   status=SolarizeImage(wand->images,threshold);
11593   if (status == MagickFalse)
11594     InheritException(wand->exception,&wand->images->exception);
11595   return(status);
11596 }
11597 \f
11598 /*
11599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11600 %                                                                             %
11601 %                                                                             %
11602 %                                                                             %
11603 %   M a g i c k S p a r s e C o l o r I m a g e                               %
11604 %                                                                             %
11605 %                                                                             %
11606 %                                                                             %
11607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11608 %
11609 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
11610 %  colors found at those coordinates, across the whole image, using various
11611 %  methods.
11612 %
11613 %  The format of the MagickSparseColorImage method is:
11614 %
11615 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11616 %        const ChannelType channel,const SparseColorMethod method,
11617 %        const size_t number_arguments,const double *arguments)
11618 %
11619 %  A description of each parameter follows:
11620 %
11621 %    o image: the image to be sparseed.
11622 %
11623 %    o method: the method of image sparseion.
11624 %
11625 %        ArcSparseColorion will always ignore source image offset, and always
11626 %        'bestfit' the destination image with the top left corner offset
11627 %        relative to the polar mapping center.
11628 %
11629 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11630 %        style of image sparseion.
11631 %
11632 %        Affine, Perspective, and Bilinear, will do least squares fitting of
11633 %        the distrotion when more than the minimum number of control point
11634 %        pairs are provided.
11635 %
11636 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
11637 %        less than 4 control point pairs are provided. While Affine sparseions
11638 %        will let you use any number of control point pairs, that is Zero pairs
11639 %        is a No-Op (viewport only) distrotion, one pair is a translation and
11640 %        two pairs of control points will do a scale-rotate-translate, without
11641 %        any shearing.
11642 %
11643 %    o number_arguments: the number of arguments given for this sparseion
11644 %      method.
11645 %
11646 %    o arguments: the arguments for this sparseion method.
11647 %
11648 */
11649 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11650   const ChannelType channel,const SparseColorMethod method,
11651   const size_t number_arguments,const double *arguments)
11652 {
11653   Image
11654     *sparse_image;
11655
11656   assert(wand != (MagickWand *) NULL);
11657   assert(wand->signature == WandSignature);
11658   if (wand->debug != MagickFalse)
11659     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11660   if (wand->images == (Image *) NULL)
11661     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11662   sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11663     arguments,wand->exception);
11664   if (sparse_image == (Image *) NULL)
11665     return(MagickFalse);
11666   ReplaceImageInList(&wand->images,sparse_image);
11667   return(MagickTrue);
11668 }
11669 \f
11670 /*
11671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672 %                                                                             %
11673 %                                                                             %
11674 %                                                                             %
11675 %   M a g i c k S p l i c e I m a g e                                         %
11676 %                                                                             %
11677 %                                                                             %
11678 %                                                                             %
11679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11680 %
11681 %  MagickSpliceImage() splices a solid color into the image.
11682 %
11683 %  The format of the MagickSpliceImage method is:
11684 %
11685 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11686 %        const size_t width,const size_t height,const ssize_t x,
11687 %        const ssize_t y)
11688 %
11689 %  A description of each parameter follows:
11690 %
11691 %    o wand: the magick wand.
11692 %
11693 %    o width: the region width.
11694 %
11695 %    o height: the region height.
11696 %
11697 %    o x: the region x offset.
11698 %
11699 %    o y: the region y offset.
11700 %
11701 */
11702 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11703   const size_t width,const size_t height,const ssize_t x,
11704   const ssize_t y)
11705 {
11706   Image
11707     *splice_image;
11708
11709   RectangleInfo
11710     splice;
11711
11712   assert(wand != (MagickWand *) NULL);
11713   assert(wand->signature == WandSignature);
11714   if (wand->debug != MagickFalse)
11715     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11716   if (wand->images == (Image *) NULL)
11717     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11718   splice.width=width;
11719   splice.height=height;
11720   splice.x=x;
11721   splice.y=y;
11722   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11723   if (splice_image == (Image *) NULL)
11724     return(MagickFalse);
11725   ReplaceImageInList(&wand->images,splice_image);
11726   return(MagickTrue);
11727 }
11728 \f
11729 /*
11730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11731 %                                                                             %
11732 %                                                                             %
11733 %                                                                             %
11734 %   M a g i c k S p r e a d I m a g e                                         %
11735 %                                                                             %
11736 %                                                                             %
11737 %                                                                             %
11738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11739 %
11740 %  MagickSpreadImage() is a special effects method that randomly displaces each
11741 %  pixel in a block defined by the radius parameter.
11742 %
11743 %  The format of the MagickSpreadImage method is:
11744 %
11745 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11746 %
11747 %  A description of each parameter follows:
11748 %
11749 %    o wand: the magick wand.
11750 %
11751 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11752 %
11753 */
11754 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11755   const double radius)
11756 {
11757   Image
11758     *spread_image;
11759
11760   assert(wand != (MagickWand *) NULL);
11761   assert(wand->signature == WandSignature);
11762   if (wand->debug != MagickFalse)
11763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11764   if (wand->images == (Image *) NULL)
11765     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11766   spread_image=SpreadImage(wand->images,radius,wand->exception);
11767   if (spread_image == (Image *) NULL)
11768     return(MagickFalse);
11769   ReplaceImageInList(&wand->images,spread_image);
11770   return(MagickTrue);
11771 }
11772 \f
11773 /*
11774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11775 %                                                                             %
11776 %                                                                             %
11777 %                                                                             %
11778 %   M a g i c k S t e g a n o I m a g e                                       %
11779 %                                                                             %
11780 %                                                                             %
11781 %                                                                             %
11782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11783 %
11784 %  MagickSteganoImage() hides a digital watermark within the image.
11785 %  Recover the hidden watermark later to prove that the authenticity of
11786 %  an image.  Offset defines the start position within the image to hide
11787 %  the watermark.
11788 %
11789 %  The format of the MagickSteganoImage method is:
11790 %
11791 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11792 %        const MagickWand *watermark_wand,const ssize_t offset)
11793 %
11794 %  A description of each parameter follows:
11795 %
11796 %    o wand: the magick wand.
11797 %
11798 %    o watermark_wand: the watermark wand.
11799 %
11800 %    o offset: Start hiding at this offset into the image.
11801 %
11802 */
11803 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11804   const MagickWand *watermark_wand,const ssize_t offset)
11805 {
11806   Image
11807     *stegano_image;
11808
11809   assert(wand != (MagickWand *) NULL);
11810   assert(wand->signature == WandSignature);
11811   if (wand->debug != MagickFalse)
11812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11813   if ((wand->images == (Image *) NULL) ||
11814       (watermark_wand->images == (Image *) NULL))
11815     {
11816       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11817         "ContainsNoImages","`%s'",wand->name);
11818       return((MagickWand *) NULL);
11819     }
11820   wand->images->offset=offset;
11821   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11822     wand->exception);
11823   if (stegano_image == (Image *) NULL)
11824     return((MagickWand *) NULL);
11825   return(CloneMagickWandFromImages(wand,stegano_image));
11826 }
11827 \f
11828 /*
11829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11830 %                                                                             %
11831 %                                                                             %
11832 %                                                                             %
11833 %   M a g i c k S t e r e o I m a g e                                         %
11834 %                                                                             %
11835 %                                                                             %
11836 %                                                                             %
11837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11838 %
11839 %  MagickStereoImage() composites two images and produces a single image that
11840 %  is the composite of a left and right image of a stereo pair
11841 %
11842 %  The format of the MagickStereoImage method is:
11843 %
11844 %      MagickWand *MagickStereoImage(MagickWand *wand,
11845 %        const MagickWand *offset_wand)
11846 %
11847 %  A description of each parameter follows:
11848 %
11849 %    o wand: the magick wand.
11850 %
11851 %    o offset_wand: Another image wand.
11852 %
11853 */
11854 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11855   const MagickWand *offset_wand)
11856 {
11857   Image
11858     *stereo_image;
11859
11860   assert(wand != (MagickWand *) NULL);
11861   assert(wand->signature == WandSignature);
11862   if (wand->debug != MagickFalse)
11863     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11864   if ((wand->images == (Image *) NULL) ||
11865       (offset_wand->images == (Image *) NULL))
11866     {
11867       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11868         "ContainsNoImages","`%s'",wand->name);
11869       return((MagickWand *) NULL);
11870     }
11871   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11872   if (stereo_image == (Image *) NULL)
11873     return((MagickWand *) NULL);
11874   return(CloneMagickWandFromImages(wand,stereo_image));
11875 }
11876 \f
11877 /*
11878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11879 %                                                                             %
11880 %                                                                             %
11881 %                                                                             %
11882 %   M a g i c k S t r i p I m a g e                                           %
11883 %                                                                             %
11884 %                                                                             %
11885 %                                                                             %
11886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11887 %
11888 %  MagickStripImage() strips an image of all profiles and comments.
11889 %
11890 %  The format of the MagickStripImage method is:
11891 %
11892 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11893 %
11894 %  A description of each parameter follows:
11895 %
11896 %    o wand: the magick wand.
11897 %
11898 */
11899 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11900 {
11901   MagickBooleanType
11902     status;
11903
11904   assert(wand != (MagickWand *) NULL);
11905   assert(wand->signature == WandSignature);
11906   if (wand->debug != MagickFalse)
11907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11908   if (wand->images == (Image *) NULL)
11909     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11910   status=StripImage(wand->images);
11911   if (status == MagickFalse)
11912     InheritException(wand->exception,&wand->images->exception);
11913   return(status);
11914 }
11915 \f
11916 /*
11917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11918 %                                                                             %
11919 %                                                                             %
11920 %                                                                             %
11921 %   M a g i c k S w i r l I m a g e                                           %
11922 %                                                                             %
11923 %                                                                             %
11924 %                                                                             %
11925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11926 %
11927 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11928 %  degrees indicates the sweep of the arc through which each pixel is moved.
11929 %  You get a more dramatic effect as the degrees move from 1 to 360.
11930 %
11931 %  The format of the MagickSwirlImage method is:
11932 %
11933 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11934 %
11935 %  A description of each parameter follows:
11936 %
11937 %    o wand: the magick wand.
11938 %
11939 %    o degrees: Define the tightness of the swirling effect.
11940 %
11941 */
11942 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11943   const double degrees)
11944 {
11945   Image
11946     *swirl_image;
11947
11948   assert(wand != (MagickWand *) NULL);
11949   assert(wand->signature == WandSignature);
11950   if (wand->debug != MagickFalse)
11951     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11952   if (wand->images == (Image *) NULL)
11953     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11954   swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11955   if (swirl_image == (Image *) NULL)
11956     return(MagickFalse);
11957   ReplaceImageInList(&wand->images,swirl_image);
11958   return(MagickTrue);
11959 }
11960 \f
11961 /*
11962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11963 %                                                                             %
11964 %                                                                             %
11965 %                                                                             %
11966 %   M a g i c k T e x t u r e I m a g e                                       %
11967 %                                                                             %
11968 %                                                                             %
11969 %                                                                             %
11970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11971 %
11972 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11973 %  image canvas.
11974 %
11975 %  The format of the MagickTextureImage method is:
11976 %
11977 %      MagickWand *MagickTextureImage(MagickWand *wand,
11978 %        const MagickWand *texture_wand)
11979 %
11980 %  A description of each parameter follows:
11981 %
11982 %    o wand: the magick wand.
11983 %
11984 %    o texture_wand: the texture wand
11985 %
11986 */
11987 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11988   const MagickWand *texture_wand)
11989 {
11990   Image
11991     *texture_image;
11992
11993   MagickBooleanType
11994     status;
11995
11996   assert(wand != (MagickWand *) NULL);
11997   assert(wand->signature == WandSignature);
11998   if (wand->debug != MagickFalse)
11999     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12000   if ((wand->images == (Image *) NULL) ||
12001       (texture_wand->images == (Image *) NULL))
12002     {
12003       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12004         "ContainsNoImages","`%s'",wand->name);
12005       return((MagickWand *) NULL);
12006     }
12007   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12008   if (texture_image == (Image *) NULL)
12009     return((MagickWand *) NULL);
12010   status=TextureImage(texture_image,texture_wand->images);
12011   if (status == MagickFalse)
12012     {
12013       InheritException(wand->exception,&texture_image->exception);
12014       texture_image=DestroyImage(texture_image);
12015       return((MagickWand *) NULL);
12016     }
12017   return(CloneMagickWandFromImages(wand,texture_image));
12018 }
12019 \f
12020 /*
12021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12022 %                                                                             %
12023 %                                                                             %
12024 %                                                                             %
12025 %   M a g i c k T h r e s h o l d I m a g e                                   %
12026 %                                                                             %
12027 %                                                                             %
12028 %                                                                             %
12029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12030 %
12031 %  MagickThresholdImage() changes the value of individual pixels based on
12032 %  the intensity of each pixel compared to threshold.  The result is a
12033 %  high-contrast, two color image.
12034 %
12035 %  The format of the MagickThresholdImage method is:
12036 %
12037 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
12038 %        const double threshold)
12039 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12040 %        const ChannelType channel,const double threshold)
12041 %
12042 %  A description of each parameter follows:
12043 %
12044 %    o wand: the magick wand.
12045 %
12046 %    o channel: the image channel(s).
12047 %
12048 %    o threshold: Define the threshold value.
12049 %
12050 */
12051 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12052   const double threshold)
12053 {
12054   MagickBooleanType
12055     status;
12056
12057   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12058   return(status);
12059 }
12060
12061 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12062   const ChannelType channel,const double threshold)
12063 {
12064   MagickBooleanType
12065     status;
12066
12067   assert(wand != (MagickWand *) NULL);
12068   assert(wand->signature == WandSignature);
12069   if (wand->debug != MagickFalse)
12070     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12071   if (wand->images == (Image *) NULL)
12072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12073   status=BilevelImageChannel(wand->images,channel,threshold);
12074   if (status == MagickFalse)
12075     InheritException(wand->exception,&wand->images->exception);
12076   return(status);
12077 }
12078 \f
12079 /*
12080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12081 %                                                                             %
12082 %                                                                             %
12083 %                                                                             %
12084 %   M a g i c k T h u m b n a i l I m a g e                                   %
12085 %                                                                             %
12086 %                                                                             %
12087 %                                                                             %
12088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12089 %
12090 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
12091 %  and removes any associated profiles.  The goal is to produce small low cost
12092 %  thumbnail images suited for display on the Web.
12093 %
12094 %  The format of the MagickThumbnailImage method is:
12095 %
12096 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12097 %        const size_t columns,const size_t rows)
12098 %
12099 %  A description of each parameter follows:
12100 %
12101 %    o wand: the magick wand.
12102 %
12103 %    o columns: the number of columns in the scaled image.
12104 %
12105 %    o rows: the number of rows in the scaled image.
12106 %
12107 */
12108 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12109   const size_t columns,const size_t rows)
12110 {
12111   Image
12112     *thumbnail_image;
12113
12114   assert(wand != (MagickWand *) NULL);
12115   assert(wand->signature == WandSignature);
12116   if (wand->debug != MagickFalse)
12117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12118   if (wand->images == (Image *) NULL)
12119     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12120   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12121   if (thumbnail_image == (Image *) NULL)
12122     return(MagickFalse);
12123   ReplaceImageInList(&wand->images,thumbnail_image);
12124   return(MagickTrue);
12125 }
12126 \f
12127 /*
12128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12129 %                                                                             %
12130 %                                                                             %
12131 %                                                                             %
12132 %   M a g i c k T i n t I m a g e                                             %
12133 %                                                                             %
12134 %                                                                             %
12135 %                                                                             %
12136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12137 %
12138 %  MagickTintImage() applies a color vector to each pixel in the image.  The
12139 %  length of the vector is 0 for black and white and at its maximum for the
12140 %  midtones.  The vector weighting function is
12141 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12142 %
12143 %  The format of the MagickTintImage method is:
12144 %
12145 %      MagickBooleanType MagickTintImage(MagickWand *wand,
12146 %        const PixelWand *tint,const PixelWand *opacity)
12147 %
12148 %  A description of each parameter follows:
12149 %
12150 %    o wand: the magick wand.
12151 %
12152 %    o tint: the tint pixel wand.
12153 %
12154 %    o opacity: the opacity pixel wand.
12155 %
12156 */
12157 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12158   const PixelWand *tint,const PixelWand *opacity)
12159 {
12160   char
12161     percent_opaque[MaxTextExtent];
12162
12163   Image
12164     *tint_image;
12165
12166   PixelPacket
12167     target;
12168
12169   assert(wand != (MagickWand *) NULL);
12170   assert(wand->signature == WandSignature);
12171   if (wand->debug != MagickFalse)
12172     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12173   if (wand->images == (Image *) NULL)
12174     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12175   (void) FormatMagickString(percent_opaque,MaxTextExtent,
12176     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12177     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12178     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12179     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12180     PixelGetOpacityQuantum(opacity)));
12181   PixelGetQuantumColor(tint,&target);
12182   tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12183   if (tint_image == (Image *) NULL)
12184     return(MagickFalse);
12185   ReplaceImageInList(&wand->images,tint_image);
12186   return(MagickTrue);
12187 }
12188 \f
12189 /*
12190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12191 %                                                                             %
12192 %                                                                             %
12193 %                                                                             %
12194 %   M a g i c k T r a n s f o r m I m a g e                                   %
12195 %                                                                             %
12196 %                                                                             %
12197 %                                                                             %
12198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12199 %
12200 %  MagickTransformImage() is a convenience method that behaves like
12201 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12202 %  information as a region geometry specification.  If the operation fails,
12203 %  a NULL image handle is returned.
12204 %
12205 %  The format of the MagickTransformImage method is:
12206 %
12207 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12208 %        const char *geometry)
12209 %
12210 %  A description of each parameter follows:
12211 %
12212 %    o wand: the magick wand.
12213 %
12214 %    o crop: A crop geometry string.  This geometry defines a subregion of the
12215 %      image to crop.
12216 %
12217 %    o geometry: An image geometry string.  This geometry defines the final
12218 %      size of the image.
12219 %
12220 */
12221 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12222   const char *crop,const char *geometry)
12223 {
12224   Image
12225     *transform_image;
12226
12227   MagickBooleanType
12228     status;
12229
12230   assert(wand != (MagickWand *) NULL);
12231   assert(wand->signature == WandSignature);
12232   if (wand->debug != MagickFalse)
12233     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12234   if (wand->images == (Image *) NULL)
12235     return((MagickWand *) NULL);
12236   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12237   if (transform_image == (Image *) NULL)
12238     return((MagickWand *) NULL);
12239   status=TransformImage(&transform_image,crop,geometry);
12240   if (status == MagickFalse)
12241     {
12242       InheritException(wand->exception,&transform_image->exception);
12243       transform_image=DestroyImage(transform_image);
12244       return((MagickWand *) NULL);
12245     }
12246   return(CloneMagickWandFromImages(wand,transform_image));
12247 }
12248 \f
12249 /*
12250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12251 %                                                                             %
12252 %                                                                             %
12253 %                                                                             %
12254 %   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               %
12255 %                                                                             %
12256 %                                                                             %
12257 %                                                                             %
12258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12259 %
12260 %  MagickTransformImageColorspace() transform the image colorspace.
12261 %
12262 %  The format of the MagickTransformImageColorspace method is:
12263 %
12264 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12265 %        const ColorspaceType colorspace)
12266 %
12267 %  A description of each parameter follows:
12268 %
12269 %    o wand: the magick wand.
12270 %
12271 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
12272 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
12273 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
12274 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
12275 %      HSLColorspace, or HWBColorspace.
12276 %
12277 */
12278 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12279   const ColorspaceType colorspace)
12280 {
12281   assert(wand != (MagickWand *) NULL);
12282   assert(wand->signature == WandSignature);
12283   if (wand->debug != MagickFalse)
12284     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12285   if (wand->images == (Image *) NULL)
12286     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12287   return(TransformImageColorspace(wand->images,colorspace));
12288 }
12289 \f
12290 /*
12291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12292 %                                                                             %
12293 %                                                                             %
12294 %                                                                             %
12295 %   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                     %
12296 %                                                                             %
12297 %                                                                             %
12298 %                                                                             %
12299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12300 %
12301 %  MagickTransparentPaintImage() changes any pixel that matches color with the
12302 %  color defined by fill.
12303 %
12304 %  The format of the MagickTransparentPaintImage method is:
12305 %
12306 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12307 %        const PixelWand *target,const double alpha,const double fuzz,
12308 %        const MagickBooleanType invert)
12309 %
12310 %  A description of each parameter follows:
12311 %
12312 %    o wand: the magick wand.
12313 %
12314 %    o target: Change this target color to specified opacity value within
12315 %      the image.
12316 %
12317 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12318 %      transparent.
12319 %
12320 %    o fuzz: By default target must match a particular pixel color
12321 %      exactly.  However, in many cases two colors may differ by a small amount.
12322 %      The fuzz member of image defines how much tolerance is acceptable to
12323 %      consider two colors as the same.  For example, set fuzz to 10 and the
12324 %      color red at intensities of 100 and 102 respectively are now interpreted
12325 %      as the same color for the purposes of the floodfill.
12326 %
12327 %    o invert: paint any pixel that does not match the target color.
12328 %
12329 */
12330 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12331   const PixelWand *target,const double alpha,const double fuzz,
12332   const MagickBooleanType invert)
12333 {
12334   MagickBooleanType
12335     status;
12336
12337   MagickPixelPacket
12338     target_pixel;
12339
12340   assert(wand != (MagickWand *) NULL);
12341   assert(wand->signature == WandSignature);
12342   if (wand->debug != MagickFalse)
12343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12344   if (wand->images == (Image *) NULL)
12345     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12346   PixelGetMagickColor(target,&target_pixel);
12347   wand->images->fuzz=fuzz;
12348   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12349     (MagickRealType) QuantumRange-QuantumRange*alpha),invert);
12350   if (status == MagickFalse)
12351     InheritException(wand->exception,&wand->images->exception);
12352   return(status);
12353 }
12354 \f
12355 /*
12356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12357 %                                                                             %
12358 %                                                                             %
12359 %                                                                             %
12360 %   M a g i c k T r a n s p o s e I m a g e                                   %
12361 %                                                                             %
12362 %                                                                             %
12363 %                                                                             %
12364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12365 %
12366 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
12367 %  pixels around the central x-axis while rotating them 90-degrees.
12368 %
12369 %  The format of the MagickTransposeImage method is:
12370 %
12371 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12372 %
12373 %  A description of each parameter follows:
12374 %
12375 %    o wand: the magick wand.
12376 %
12377 */
12378 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12379 {
12380   Image
12381     *transpose_image;
12382
12383   assert(wand != (MagickWand *) NULL);
12384   assert(wand->signature == WandSignature);
12385   if (wand->debug != MagickFalse)
12386     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12387   if (wand->images == (Image *) NULL)
12388     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12389   transpose_image=TransposeImage(wand->images,wand->exception);
12390   if (transpose_image == (Image *) NULL)
12391     return(MagickFalse);
12392   ReplaceImageInList(&wand->images,transpose_image);
12393   return(MagickTrue);
12394 }
12395 \f
12396 /*
12397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12398 %                                                                             %
12399 %                                                                             %
12400 %                                                                             %
12401 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12402 %                                                                             %
12403 %                                                                             %
12404 %                                                                             %
12405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12406 %
12407 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12408 %  pixels around the central y-axis while rotating them 270-degrees.
12409 %
12410 %  The format of the MagickTransverseImage method is:
12411 %
12412 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12413 %
12414 %  A description of each parameter follows:
12415 %
12416 %    o wand: the magick wand.
12417 %
12418 */
12419 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12420 {
12421   Image
12422     *transverse_image;
12423
12424   assert(wand != (MagickWand *) NULL);
12425   assert(wand->signature == WandSignature);
12426   if (wand->debug != MagickFalse)
12427     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12428   if (wand->images == (Image *) NULL)
12429     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12430   transverse_image=TransverseImage(wand->images,wand->exception);
12431   if (transverse_image == (Image *) NULL)
12432     return(MagickFalse);
12433   ReplaceImageInList(&wand->images,transverse_image);
12434   return(MagickTrue);
12435 }
12436 \f
12437 /*
12438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12439 %                                                                             %
12440 %                                                                             %
12441 %                                                                             %
12442 %   M a g i c k T r i m I m a g e                                             %
12443 %                                                                             %
12444 %                                                                             %
12445 %                                                                             %
12446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12447 %
12448 %  MagickTrimImage() remove edges that are the background color from the image.
12449 %
12450 %  The format of the MagickTrimImage method is:
12451 %
12452 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12453 %
12454 %  A description of each parameter follows:
12455 %
12456 %    o wand: the magick wand.
12457 %
12458 %    o fuzz: By default target must match a particular pixel color
12459 %      exactly.  However, in many cases two colors may differ by a small amount.
12460 %      The fuzz member of image defines how much tolerance is acceptable to
12461 %      consider two colors as the same.  For example, set fuzz to 10 and the
12462 %      color red at intensities of 100 and 102 respectively are now interpreted
12463 %      as the same color for the purposes of the floodfill.
12464 %
12465 */
12466 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12467 {
12468   Image
12469     *trim_image;
12470
12471   assert(wand != (MagickWand *) NULL);
12472   assert(wand->signature == WandSignature);
12473   if (wand->debug != MagickFalse)
12474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12475   if (wand->images == (Image *) NULL)
12476     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12477   wand->images->fuzz=fuzz;
12478   trim_image=TrimImage(wand->images,wand->exception);
12479   if (trim_image == (Image *) NULL)
12480     return(MagickFalse);
12481   ReplaceImageInList(&wand->images,trim_image);
12482   return(MagickTrue);
12483 }
12484 \f
12485 /*
12486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12487 %                                                                             %
12488 %                                                                             %
12489 %                                                                             %
12490 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
12491 %                                                                             %
12492 %                                                                             %
12493 %                                                                             %
12494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12495 %
12496 %  MagickUniqueImageColors() discards all but one of any pixel color.
12497 %
12498 %  The format of the MagickUniqueImageColors method is:
12499 %
12500 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12501 %
12502 %  A description of each parameter follows:
12503 %
12504 %    o wand: the magick wand.
12505 %
12506 */
12507 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12508 {
12509   Image
12510     *unique_image;
12511
12512   assert(wand != (MagickWand *) NULL);
12513   assert(wand->signature == WandSignature);
12514   if (wand->debug != MagickFalse)
12515     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12516   if (wand->images == (Image *) NULL)
12517     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12518   unique_image=UniqueImageColors(wand->images,wand->exception);
12519   if (unique_image == (Image *) NULL)
12520     return(MagickFalse);
12521   ReplaceImageInList(&wand->images,unique_image);
12522   return(MagickTrue);
12523 }
12524 \f
12525 /*
12526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12527 %                                                                             %
12528 %                                                                             %
12529 %                                                                             %
12530 %   M a g i c k U n s h a r p M a s k I m a g e                               %
12531 %                                                                             %
12532 %                                                                             %
12533 %                                                                             %
12534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12535 %
12536 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12537 %  Gaussian operator of the given radius and standard deviation (sigma).
12538 %  For reasonable results, radius should be larger than sigma.  Use a radius
12539 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12540 %
12541 %  The format of the MagickUnsharpMaskImage method is:
12542 %
12543 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12544 %        const double radius,const double sigma,const double amount,
12545 %        const double threshold)
12546 %      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12547 %        const ChannelType channel,const double radius,const double sigma,
12548 %        const double amount,const double threshold)
12549 %
12550 %  A description of each parameter follows:
12551 %
12552 %    o wand: the magick wand.
12553 %
12554 %    o channel: the image channel(s).
12555 %
12556 %    o radius: the radius of the Gaussian, in pixels, not counting the center
12557 %      pixel.
12558 %
12559 %    o sigma: the standard deviation of the Gaussian, in pixels.
12560 %
12561 %    o amount: the percentage of the difference between the original and the
12562 %      blur image that is added back into the original.
12563 %
12564 %    o threshold: the threshold in pixels needed to apply the diffence amount.
12565 %
12566 */
12567
12568 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12569   const double radius,const double sigma,const double amount,
12570   const double threshold)
12571 {
12572   MagickBooleanType
12573     status;
12574
12575   status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12576     amount,threshold);
12577   return(status);
12578 }
12579
12580 WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12581   const ChannelType channel,const double radius,const double sigma,
12582   const double amount,const double threshold)
12583 {
12584   Image
12585     *unsharp_image;
12586
12587   assert(wand != (MagickWand *) NULL);
12588   assert(wand->signature == WandSignature);
12589   if (wand->debug != MagickFalse)
12590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12591   if (wand->images == (Image *) NULL)
12592     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12593   unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12594     amount,threshold,wand->exception);
12595   if (unsharp_image == (Image *) NULL)
12596     return(MagickFalse);
12597   ReplaceImageInList(&wand->images,unsharp_image);
12598   return(MagickTrue);
12599 }
12600 \f
12601 /*
12602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12603 %                                                                             %
12604 %                                                                             %
12605 %                                                                             %
12606 %   M a g i c k V i g n e t t e I m a g e                                     %
12607 %                                                                             %
12608 %                                                                             %
12609 %                                                                             %
12610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12611 %
12612 %  MagickVignetteImage() softens the edges of the image in vignette style.
12613 %
12614 %  The format of the MagickVignetteImage method is:
12615 %
12616 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12617 %        const double black_point,const double white_point,const ssize_t x,
12618 %        const ssize_t y)
12619 %
12620 %  A description of each parameter follows:
12621 %
12622 %    o wand: the magick wand.
12623 %
12624 %    o black_point: the black point.
12625 %
12626 %    o white_point: the white point.
12627 %
12628 %    o x, y:  Define the x and y ellipse offset.
12629 %
12630 */
12631 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12632   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
12633 {
12634   Image
12635     *vignette_image;
12636
12637   assert(wand != (MagickWand *) NULL);
12638   assert(wand->signature == WandSignature);
12639   if (wand->debug != MagickFalse)
12640     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12641   if (wand->images == (Image *) NULL)
12642     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12643   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12644     wand->exception);
12645   if (vignette_image == (Image *) NULL)
12646     return(MagickFalse);
12647   ReplaceImageInList(&wand->images,vignette_image);
12648   return(MagickTrue);
12649 }
12650 \f
12651 /*
12652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12653 %                                                                             %
12654 %                                                                             %
12655 %                                                                             %
12656 %   M a g i c k W a v e I m a g e                                             %
12657 %                                                                             %
12658 %                                                                             %
12659 %                                                                             %
12660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12661 %
12662 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12663 %  the pixels vertically along a sine wave whose amplitude and wavelength
12664 %  is specified by the given parameters.
12665 %
12666 %  The format of the MagickWaveImage method is:
12667 %
12668 %      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12669 %        const double wave_length)
12670 %
12671 %  A description of each parameter follows:
12672 %
12673 %    o wand: the magick wand.
12674 %
12675 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12676 %      sine wave.
12677 %
12678 */
12679 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12680   const double amplitude,const double wave_length)
12681 {
12682   Image
12683     *wave_image;
12684
12685   assert(wand != (MagickWand *) NULL);
12686   assert(wand->signature == WandSignature);
12687   if (wand->debug != MagickFalse)
12688     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12689   if (wand->images == (Image *) NULL)
12690     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12691   wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12692   if (wave_image == (Image *) NULL)
12693     return(MagickFalse);
12694   ReplaceImageInList(&wand->images,wave_image);
12695   return(MagickTrue);
12696 }
12697 \f
12698 /*
12699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12700 %                                                                             %
12701 %                                                                             %
12702 %                                                                             %
12703 %   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                         %
12704 %                                                                             %
12705 %                                                                             %
12706 %                                                                             %
12707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12708 %
12709 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12710 %  above the threshold into white while leaving all pixels below the threshold
12711 %  unchanged.
12712 %
12713 %  The format of the MagickWhiteThresholdImage method is:
12714 %
12715 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12716 %        const PixelWand *threshold)
12717 %
12718 %  A description of each parameter follows:
12719 %
12720 %    o wand: the magick wand.
12721 %
12722 %    o threshold: the pixel wand.
12723 %
12724 */
12725 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12726   const PixelWand *threshold)
12727 {
12728   char
12729     thresholds[MaxTextExtent];
12730
12731   MagickBooleanType
12732     status;
12733
12734   assert(wand != (MagickWand *) NULL);
12735   assert(wand->signature == WandSignature);
12736   if (wand->debug != MagickFalse)
12737     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12738   if (wand->images == (Image *) NULL)
12739     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12740   (void) FormatMagickString(thresholds,MaxTextExtent,
12741     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12742     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12743     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12744   status=WhiteThresholdImage(wand->images,thresholds);
12745   if (status == MagickFalse)
12746     InheritException(wand->exception,&wand->images->exception);
12747   return(status);
12748 }
12749 \f
12750 /*
12751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12752 %                                                                             %
12753 %                                                                             %
12754 %                                                                             %
12755 %   M a g i c k W r i t e I m a g e                                           %
12756 %                                                                             %
12757 %                                                                             %
12758 %                                                                             %
12759 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12760 %
12761 %  MagickWriteImage() writes an image to the specified filename.  If the
12762 %  filename parameter is NULL, the image is written to the filename set
12763 %  by MagickReadImage() or MagickSetImageFilename().
12764 %
12765 %  The format of the MagickWriteImage method is:
12766 %
12767 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12768 %        const char *filename)
12769 %
12770 %  A description of each parameter follows:
12771 %
12772 %    o wand: the magick wand.
12773 %
12774 %    o filename: the image filename.
12775 %
12776 %
12777 */
12778 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12779   const char *filename)
12780 {
12781   Image
12782     *image;
12783
12784   ImageInfo
12785     *write_info;
12786
12787   MagickBooleanType
12788     status;
12789
12790   assert(wand != (MagickWand *) NULL);
12791   assert(wand->signature == WandSignature);
12792   if (wand->debug != MagickFalse)
12793     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12794   if (wand->images == (Image *) NULL)
12795     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12796   if (filename != (const char *) NULL)
12797     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12798   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12799   if (image == (Image *) NULL)
12800     return(MagickFalse);
12801   write_info=CloneImageInfo(wand->image_info);
12802   write_info->adjoin=MagickTrue;
12803   status=WriteImage(write_info,image);
12804   if (status == MagickFalse)
12805     InheritException(wand->exception,&image->exception);
12806   image=DestroyImage(image);
12807   write_info=DestroyImageInfo(write_info);
12808   return(status);
12809 }
12810 \f
12811 /*
12812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12813 %                                                                             %
12814 %                                                                             %
12815 %                                                                             %
12816 %   M a g i c k W r i t e I m a g e F i l e                                   %
12817 %                                                                             %
12818 %                                                                             %
12819 %                                                                             %
12820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12821 %
12822 %  MagickWriteImageFile() writes an image to an open file descriptor.
12823 %
12824 %  The format of the MagickWriteImageFile method is:
12825 %
12826 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12827 %
12828 %  A description of each parameter follows:
12829 %
12830 %    o wand: the magick wand.
12831 %
12832 %    o file: the file descriptor.
12833 %
12834 */
12835 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12836 {
12837   Image
12838     *image;
12839
12840   ImageInfo
12841     *write_info;
12842
12843   MagickBooleanType
12844     status;
12845
12846   assert(wand != (MagickWand *) NULL);
12847   assert(wand->signature == WandSignature);
12848   assert(file != (FILE *) NULL);
12849   if (wand->debug != MagickFalse)
12850     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12851   if (wand->images == (Image *) NULL)
12852     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12853   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12854   if (image == (Image *) NULL)
12855     return(MagickFalse);
12856   write_info=CloneImageInfo(wand->image_info);
12857   SetImageInfoFile(write_info,file);
12858   write_info->adjoin=MagickTrue;
12859   status=WriteImage(write_info,image);
12860   write_info=DestroyImageInfo(write_info);
12861   if (status == MagickFalse)
12862     InheritException(wand->exception,&image->exception);
12863   image=DestroyImage(image);
12864   return(status);
12865 }
12866 \f
12867 /*
12868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12869 %                                                                             %
12870 %                                                                             %
12871 %                                                                             %
12872 %   M a g i c k W r i t e I m a g e s                                         %
12873 %                                                                             %
12874 %                                                                             %
12875 %                                                                             %
12876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12877 %
12878 %  MagickWriteImages() writes an image or image sequence.
12879 %
12880 %  The format of the MagickWriteImages method is:
12881 %
12882 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12883 %        const char *filename,const MagickBooleanType adjoin)
12884 %
12885 %  A description of each parameter follows:
12886 %
12887 %    o wand: the magick wand.
12888 %
12889 %    o filename: the image filename.
12890 %
12891 %    o adjoin: join images into a single multi-image file.
12892 %
12893 */
12894 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12895   const char *filename,const MagickBooleanType adjoin)
12896 {
12897   ImageInfo
12898     *write_info;
12899
12900   MagickBooleanType
12901     status;
12902
12903   assert(wand != (MagickWand *) NULL);
12904   assert(wand->signature == WandSignature);
12905   if (wand->debug != MagickFalse)
12906     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12907   if (wand->images == (Image *) NULL)
12908     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12909   write_info=CloneImageInfo(wand->image_info);
12910   write_info->adjoin=adjoin;
12911   status=WriteImages(write_info,wand->images,filename,wand->exception);
12912   if (status == MagickFalse)
12913     InheritException(wand->exception,&wand->images->exception);
12914   write_info=DestroyImageInfo(write_info);
12915   return(status);
12916 }
12917 \f
12918 /*
12919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12920 %                                                                             %
12921 %                                                                             %
12922 %                                                                             %
12923 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12924 %                                                                             %
12925 %                                                                             %
12926 %                                                                             %
12927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12928 %
12929 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12930 %
12931 %  The format of the MagickWriteImagesFile method is:
12932 %
12933 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12934 %
12935 %  A description of each parameter follows:
12936 %
12937 %    o wand: the magick wand.
12938 %
12939 %    o file: the file descriptor.
12940 %
12941 */
12942 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12943 {
12944   ImageInfo
12945     *write_info;
12946
12947   MagickBooleanType
12948     status;
12949
12950   assert(wand != (MagickWand *) NULL);
12951   assert(wand->signature == WandSignature);
12952   if (wand->debug != MagickFalse)
12953     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12954   if (wand->images == (Image *) NULL)
12955     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12956   write_info=CloneImageInfo(wand->image_info);
12957   SetImageInfoFile(write_info,file);
12958   write_info->adjoin=MagickTrue;
12959   status=WriteImages(write_info,wand->images,(const char *) NULL,
12960     wand->exception);
12961   write_info=DestroyImageInfo(write_info);
12962   if (status == MagickFalse)
12963     InheritException(wand->exception,&wand->images->exception);
12964   return(status);
12965 }