]> 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-2009 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-%lu",
109     MagickWandId,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 unsigned long columns,const unsigned long 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 unsigned long columns,const unsigned long 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 unsigned long width,const unsigned long height,const long 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 unsigned long width,const unsigned long height,const long 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   InsertImageInList(&sentinel,images);
447   wand->images=GetFirstImageInList(images);
448   return(MagickTrue);
449 }
450
451 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
452   const MagickWand *add_wand)
453 {
454   Image
455     *images;
456
457   assert(wand != (MagickWand *) NULL);
458   assert(wand->signature == WandSignature);
459   if (wand->debug != MagickFalse)
460     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
461   assert(add_wand != (MagickWand *) NULL);
462   assert(add_wand->signature == WandSignature);
463   if (add_wand->images == (Image *) NULL)
464     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
465   images=CloneImageList(add_wand->images,wand->exception);
466   if (images == (Image *) NULL)
467     return(MagickFalse);
468   return(InsertImageInWand(wand,images));
469 }
470 \f
471 /*
472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
473 %                                                                             %
474 %                                                                             %
475 %                                                                             %
476 %     M a g i c k A d d N o i s e I m a g e                                   %
477 %                                                                             %
478 %                                                                             %
479 %                                                                             %
480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481 %
482 %  MagickAddNoiseImage() adds random noise to the image.
483 %
484 %  The format of the MagickAddNoiseImage method is:
485 %
486 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
487 %        const NoiseType noise_type)
488 %      MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
489 %        const ChannelType channel,const NoiseType noise_type)
490 %
491 %  A description of each parameter follows:
492 %
493 %    o wand: the magick wand.
494 %
495 %    o channel: the image channel(s).
496 %
497 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
498 %      Impulse, Laplacian, or Poisson.
499 %
500 */
501
502 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
503   const NoiseType noise_type)
504 {
505   MagickBooleanType
506     status;
507
508   status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
509   return(status);
510 }
511
512 WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
513   const ChannelType channel,const NoiseType noise_type)
514 {
515   Image
516     *noise_image;
517
518   assert(wand != (MagickWand *) NULL);
519   assert(wand->signature == WandSignature);
520   if (wand->debug != MagickFalse)
521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
522   if (wand->images == (Image *) NULL)
523     ThrowWandException(WandError,"ContainsNoImages",wand->name);
524   noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
525     wand->exception);
526   if (noise_image == (Image *) NULL)
527     return(MagickFalse);
528   ReplaceImageInList(&wand->images,noise_image);
529   return(MagickTrue);
530 }
531 \f
532 /*
533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
534 %                                                                             %
535 %                                                                             %
536 %                                                                             %
537 %   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                       %
538 %                                                                             %
539 %                                                                             %
540 %                                                                             %
541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542 %
543 %  MagickAffineTransformImage() transforms an image as dictated by the affine
544 %  matrix of the drawing wand.
545 %
546 %  The format of the MagickAffineTransformImage method is:
547 %
548 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
549 %        const DrawingWand *drawing_wand)
550 %
551 %  A description of each parameter follows:
552 %
553 %    o wand: the magick wand.
554 %
555 %    o drawing_wand: the draw wand.
556 %
557 */
558 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
559   const DrawingWand *drawing_wand)
560 {
561   DrawInfo
562     *draw_info;
563
564   Image
565     *affine_image;
566
567   assert(wand != (MagickWand *) NULL);
568   assert(wand->signature == WandSignature);
569   if (wand->debug != MagickFalse)
570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
571   if (wand->images == (Image *) NULL)
572     ThrowWandException(WandError,"ContainsNoImages",wand->name);
573   draw_info=PeekDrawingWand(drawing_wand);
574   if (draw_info == (DrawInfo *) NULL)
575     return(MagickFalse);
576   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
577     wand->exception);
578   draw_info=DestroyDrawInfo(draw_info);
579   if (affine_image == (Image *) NULL)
580     return(MagickFalse);
581   ReplaceImageInList(&wand->images,affine_image);
582   return(MagickTrue);
583 }
584 \f
585 /*
586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
587 %                                                                             %
588 %                                                                             %
589 %                                                                             %
590 %   M a g i c k A n n o t a t e I m a g e                                     %
591 %                                                                             %
592 %                                                                             %
593 %                                                                             %
594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
595 %
596 %  MagickAnnotateImage() annotates an image with text.
597 %
598 %  The format of the MagickAnnotateImage method is:
599 %
600 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
601 %        const DrawingWand *drawing_wand,const double x,const double y,
602 %        const double angle,const char *text)
603 %
604 %  A description of each parameter follows:
605 %
606 %    o wand: the magick wand.
607 %
608 %    o drawing_wand: the draw wand.
609 %
610 %    o x: x ordinate to left of text
611 %
612 %    o y: y ordinate to text baseline
613 %
614 %    o angle: rotate text relative to this angle.
615 %
616 %    o text: text to draw
617 %
618 */
619 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
620   const DrawingWand *drawing_wand,const double x,const double y,
621   const double angle,const char *text)
622 {
623   char
624     geometry[MaxTextExtent];
625
626   DrawInfo
627     *draw_info;
628
629   MagickBooleanType
630     status;
631
632   assert(wand != (MagickWand *) NULL);
633   assert(wand->signature == WandSignature);
634   if (wand->debug != MagickFalse)
635     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
636   if (wand->images == (Image *) NULL)
637     ThrowWandException(WandError,"ContainsNoImages",wand->name);
638   draw_info=PeekDrawingWand(drawing_wand);
639   if (draw_info == (DrawInfo *) NULL)
640     return(MagickFalse);
641   (void) CloneString(&draw_info->text,text);
642   (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g",x,y);
643   draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
644   draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
645   draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
646   draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
647   (void) CloneString(&draw_info->geometry,geometry);
648   status=AnnotateImage(wand->images,draw_info);
649   draw_info=DestroyDrawInfo(draw_info);
650   if (status == MagickFalse)
651     InheritException(wand->exception,&wand->images->exception);
652   return(status);
653 }
654 \f
655 /*
656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657 %                                                                             %
658 %                                                                             %
659 %                                                                             %
660 %   M a g i c k A n i m a t e I m a g e s                                     %
661 %                                                                             %
662 %                                                                             %
663 %                                                                             %
664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
665 %
666 %  MagickAnimateImages() animates an image or image sequence.
667 %
668 %  The format of the MagickAnimateImages method is:
669 %
670 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
671 %        const char *server_name)
672 %
673 %  A description of each parameter follows:
674 %
675 %    o wand: the magick wand.
676 %
677 %    o server_name: the X server name.
678 %
679 */
680 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
681   const char *server_name)
682 {
683   MagickBooleanType
684     status;
685
686   assert(wand != (MagickWand *) NULL);
687   assert(wand->signature == WandSignature);
688   if (wand->debug != MagickFalse)
689     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
690   (void) CloneString(&wand->image_info->server_name,server_name);
691   status=AnimateImages(wand->image_info,wand->images);
692   if (status == MagickFalse)
693     InheritException(wand->exception,&wand->images->exception);
694   return(status);
695 }
696 \f
697 /*
698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
699 %                                                                             %
700 %                                                                             %
701 %                                                                             %
702 %   M a g i c k A p p e n d I m a g e s                                       %
703 %                                                                             %
704 %                                                                             %
705 %                                                                             %
706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
707 %
708 %  MagickAppendImages() append a set of images.
709 %
710 %  The format of the MagickAppendImages method is:
711 %
712 %      MagickWand *MagickAppendImages(MagickWand *wand,
713 %        const MagickBooleanType stack)
714 %
715 %  A description of each parameter follows:
716 %
717 %    o wand: the magick wand.
718 %
719 %    o stack: By default, images are stacked left-to-right. Set stack to
720 %      MagickTrue to stack them top-to-bottom.
721 %
722 */
723 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
724   const MagickBooleanType stack)
725 {
726   Image
727     *append_image;
728
729   assert(wand != (MagickWand *) NULL);
730   assert(wand->signature == WandSignature);
731   if (wand->debug != MagickFalse)
732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
733   if (wand->images == (Image *) NULL)
734     return((MagickWand *) NULL);
735   append_image=AppendImages(wand->images,stack,wand->exception);
736   if (append_image == (Image *) NULL)
737     return((MagickWand *) NULL);
738   return(CloneMagickWandFromImages(wand,append_image));
739 }
740 \f
741 /*
742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
743 %                                                                             %
744 %                                                                             %
745 %                                                                             %
746 %   M a g i c k A u t o G a m m a I m a g e                                   %
747 %                                                                             %
748 %                                                                             %
749 %                                                                             %
750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
751 %
752 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
753 %  image to try make set its gamma appropriatally.
754 %
755 %  The format of the MagickAutoGammaImage method is:
756 %
757 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
758 %      MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
759 %        const ChannelType channel)
760 %
761 %  A description of each parameter follows:
762 %
763 %    o wand: the magick wand.
764 %
765 %    o channel: the image channel(s).
766 %
767 */
768 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
769 {
770   MagickBooleanType
771     status;
772
773   status=MagickAutoGammaImageChannel(wand,DefaultChannels);
774   return(status);
775 }
776
777 WandExport MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
778   const ChannelType channel)
779 {
780   MagickBooleanType
781     status;
782
783   assert(wand != (MagickWand *) NULL);
784   assert(wand->signature == WandSignature);
785   if (wand->debug != MagickFalse)
786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787   if (wand->images == (Image *) NULL)
788     ThrowWandException(WandError,"ContainsNoImages",wand->name);
789   status=AutoGammaImageChannel(wand->images,channel);
790   if (status == MagickFalse)
791     InheritException(wand->exception,&wand->images->exception);
792   return(status);
793 }
794 \f
795 /*
796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
797 %                                                                             %
798 %                                                                             %
799 %                                                                             %
800 %   M a g i c k A u t o L e v e l I m a g e                                   %
801 %                                                                             %
802 %                                                                             %
803 %                                                                             %
804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805 %
806 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
807 %  scaling the minimum and maximum values to the full quantum range.
808 %
809 %  The format of the MagickAutoLevelImage method is:
810 %
811 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
812 %      MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
813 %        const ChannelType channel)
814 %
815 %  A description of each parameter follows:
816 %
817 %    o wand: the magick wand.
818 %
819 %    o channel: the image channel(s).
820 %
821 */
822 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
823 {
824   MagickBooleanType
825     status;
826
827   status=MagickAutoLevelImageChannel(wand,DefaultChannels);
828   return(status);
829 }
830
831 WandExport MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
832   const ChannelType channel)
833 {
834   MagickBooleanType
835     status;
836
837   assert(wand != (MagickWand *) NULL);
838   assert(wand->signature == WandSignature);
839   if (wand->debug != MagickFalse)
840     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
841   if (wand->images == (Image *) NULL)
842     ThrowWandException(WandError,"ContainsNoImages",wand->name);
843   status=AutoLevelImageChannel(wand->images,channel);
844   if (status == MagickFalse)
845     InheritException(wand->exception,&wand->images->exception);
846   return(status);
847 }
848 \f
849 /*
850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
851 %                                                                             %
852 %                                                                             %
853 %                                                                             %
854 %   M a g i c k A v e r a g e I m a g e s                                     %
855 %                                                                             %
856 %                                                                             %
857 %                                                                             %
858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859 %
860 %  MagickAverageImages() average a set of images.
861 %
862 %  The format of the MagickAverageImages method is:
863 %
864 %      MagickWand *MagickAverageImages(MagickWand *wand)
865 %
866 %  A description of each parameter follows:
867 %
868 %    o wand: the magick wand.
869 %
870 */
871 WandExport MagickWand *MagickAverageImages(MagickWand *wand)
872 {
873   Image
874     *average_image;
875
876   assert(wand != (MagickWand *) NULL);
877   assert(wand->signature == WandSignature);
878   if (wand->debug != MagickFalse)
879     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
880   if (wand->images == (Image *) NULL)
881     return((MagickWand *) NULL);
882   average_image=AverageImages(wand->images,wand->exception);
883   if (average_image == (Image *) NULL)
884     return((MagickWand *) NULL);
885   return(CloneMagickWandFromImages(wand,average_image));
886 }
887 \f
888 /*
889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
890 %                                                                             %
891 %                                                                             %
892 %                                                                             %
893 %   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                         %
894 %                                                                             %
895 %                                                                             %
896 %                                                                             %
897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
898 %
899 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
900 %  pixels below the threshold into black while leaving all pixels above the
901 %  threshold unchanged.
902 %
903 %  The format of the MagickBlackThresholdImage method is:
904 %
905 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
906 %        const PixelWand *threshold)
907 %
908 %  A description of each parameter follows:
909 %
910 %    o wand: the magick wand.
911 %
912 %    o threshold: the pixel wand.
913 %
914 */
915 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
916   const PixelWand *threshold)
917 {
918   char
919     thresholds[MaxTextExtent];
920
921   MagickBooleanType
922     status;
923
924   assert(wand != (MagickWand *) NULL);
925   assert(wand->signature == WandSignature);
926   if (wand->debug != MagickFalse)
927     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
928   if (wand->images == (Image *) NULL)
929     ThrowWandException(WandError,"ContainsNoImages",wand->name);
930   (void) FormatMagickString(thresholds,MaxTextExtent,
931     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
932     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
933     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
934   status=BlackThresholdImage(wand->images,thresholds);
935   if (status == MagickFalse)
936     InheritException(wand->exception,&wand->images->exception);
937   return(status);
938 }
939 \f
940 /*
941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
942 %                                                                             %
943 %                                                                             %
944 %                                                                             %
945 %   M a g i c k B l u e S h i f t I m a g e                                   %
946 %                                                                             %
947 %                                                                             %
948 %                                                                             %
949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
950 %
951 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
952 %  nighttime in the moonlight.
953 %
954 %  The format of the MagickBlueShiftImage method is:
955 %
956 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
957 %        const double factor)
958 %
959 %  A description of each parameter follows:
960 %
961 %    o wand: the magick wand.
962 %
963 %    o factor: the blue shift factor (default 1.5)
964 %
965 */
966 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
967   const double factor)
968 {
969   Image
970     *shift_image;
971
972   assert(wand != (MagickWand *) NULL);
973   assert(wand->signature == WandSignature);
974   if (wand->debug != MagickFalse)
975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
976   if (wand->images == (Image *) NULL)
977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
978   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
979   if (shift_image == (Image *) NULL)
980     return(MagickFalse);
981   ReplaceImageInList(&wand->images,shift_image);
982   return(MagickTrue);
983 }
984 \f
985 /*
986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
987 %                                                                             %
988 %                                                                             %
989 %                                                                             %
990 %   M a g i c k B l u r I m a g e                                             %
991 %                                                                             %
992 %                                                                             %
993 %                                                                             %
994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
995 %
996 %  MagickBlurImage() blurs an image.  We convolve the image with a
997 %  gaussian operator of the given radius and standard deviation (sigma).
998 %  For reasonable results, the radius should be larger than sigma.  Use a
999 %  radius of 0 and BlurImage() selects a suitable radius for you.
1000 %
1001 %  The format of the MagickBlurImage method is:
1002 %
1003 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
1004 %        const double sigma)
1005 %      MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
1006 %        const ChannelType channel,const double radius,const double sigma)
1007 %
1008 %  A description of each parameter follows:
1009 %
1010 %    o wand: the magick wand.
1011 %
1012 %    o channel: the image channel(s).
1013 %
1014 %    o radius: the radius of the , in pixels, not counting the center
1015 %      pixel.
1016 %
1017 %    o sigma: the standard deviation of the , in pixels.
1018 %
1019 */
1020
1021 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
1022   const double radius,const double sigma)
1023 {
1024   MagickBooleanType
1025     status;
1026
1027   status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
1028   return(status);
1029 }
1030
1031 WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
1032   const ChannelType channel,const double radius,const double sigma)
1033 {
1034   Image
1035     *blur_image;
1036
1037   assert(wand != (MagickWand *) NULL);
1038   assert(wand->signature == WandSignature);
1039   if (wand->debug != MagickFalse)
1040     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1041   if (wand->images == (Image *) NULL)
1042     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1043   blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
1044     wand->exception);
1045   if (blur_image == (Image *) NULL)
1046     return(MagickFalse);
1047   ReplaceImageInList(&wand->images,blur_image);
1048   return(MagickTrue);
1049 }
1050 \f
1051 /*
1052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1053 %                                                                             %
1054 %                                                                             %
1055 %                                                                             %
1056 %   M a g i c k B o r d e r I m a g e                                         %
1057 %                                                                             %
1058 %                                                                             %
1059 %                                                                             %
1060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1061 %
1062 %  MagickBorderImage() surrounds the image with a border of the color defined
1063 %  by the bordercolor pixel wand.
1064 %
1065 %  The format of the MagickBorderImage method is:
1066 %
1067 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
1068 %        const PixelWand *bordercolor,const unsigned long width,
1069 %        const unsigned long height)
1070 %
1071 %  A description of each parameter follows:
1072 %
1073 %    o wand: the magick wand.
1074 %
1075 %    o bordercolor: the border color pixel wand.
1076 %
1077 %    o width: the border width.
1078 %
1079 %    o height: the border height.
1080 %
1081 */
1082 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1083   const PixelWand *bordercolor,const unsigned long width,
1084   const unsigned long height)
1085 {
1086   Image
1087     *border_image;
1088
1089   RectangleInfo
1090     border_info;
1091
1092   assert(wand != (MagickWand *) NULL);
1093   assert(wand->signature == WandSignature);
1094   if (wand->debug != MagickFalse)
1095     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1096   if (wand->images == (Image *) NULL)
1097     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1098   border_info.width=width;
1099   border_info.height=height;
1100   border_info.x=0;
1101   border_info.y=0;
1102   PixelGetQuantumColor(bordercolor,&wand->images->border_color);
1103   border_image=BorderImage(wand->images,&border_info,wand->exception);
1104   if (border_image == (Image *) NULL)
1105     return(MagickFalse);
1106   ReplaceImageInList(&wand->images,border_image);
1107   return(MagickTrue);
1108 }
1109 \f
1110 /*
1111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1112 %                                                                             %
1113 %                                                                             %
1114 %                                                                             %
1115 %   M a g i c k C h a r c o a l I m a g e                                     %
1116 %                                                                             %
1117 %                                                                             %
1118 %                                                                             %
1119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1120 %
1121 %  MagickCharcoalImage() simulates a charcoal drawing.
1122 %
1123 %  The format of the MagickCharcoalImage method is:
1124 %
1125 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1126 %        const double radius,const double sigma)
1127 %
1128 %  A description of each parameter follows:
1129 %
1130 %    o wand: the magick wand.
1131 %
1132 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1133 %      pixel.
1134 %
1135 %    o sigma: the standard deviation of the Gaussian, in pixels.
1136 %
1137 */
1138 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1139   const double radius,const double sigma)
1140 {
1141   Image
1142     *charcoal_image;
1143
1144   assert(wand != (MagickWand *) NULL);
1145   assert(wand->signature == WandSignature);
1146   if (wand->debug != MagickFalse)
1147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1148   if (wand->images == (Image *) NULL)
1149     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1150   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1151   if (charcoal_image == (Image *) NULL)
1152     return(MagickFalse);
1153   ReplaceImageInList(&wand->images,charcoal_image);
1154   return(MagickTrue);
1155 }
1156 \f
1157 /*
1158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1159 %                                                                             %
1160 %                                                                             %
1161 %                                                                             %
1162 %   M a g i c k C h o p I m a g e                                             %
1163 %                                                                             %
1164 %                                                                             %
1165 %                                                                             %
1166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1167 %
1168 %  MagickChopImage() removes a region of an image and collapses the image to
1169 %  occupy the removed portion
1170 %
1171 %  The format of the MagickChopImage method is:
1172 %
1173 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1174 %        const unsigned long width,const unsigned long height,const long x,
1175 %        const long y)
1176 %
1177 %  A description of each parameter follows:
1178 %
1179 %    o wand: the magick wand.
1180 %
1181 %    o width: the region width.
1182 %
1183 %    o height: the region height.
1184 %
1185 %    o x: the region x offset.
1186 %
1187 %    o y: the region y offset.
1188 %
1189 %
1190 */
1191 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1192   const unsigned long width,const unsigned long height,const long x,
1193   const long y)
1194 {
1195   Image
1196     *chop_image;
1197
1198   RectangleInfo
1199     chop;
1200
1201   assert(wand != (MagickWand *) NULL);
1202   assert(wand->signature == WandSignature);
1203   if (wand->debug != MagickFalse)
1204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1205   if (wand->images == (Image *) NULL)
1206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1207   chop.width=width;
1208   chop.height=height;
1209   chop.x=x;
1210   chop.y=y;
1211   chop_image=ChopImage(wand->images,&chop,wand->exception);
1212   if (chop_image == (Image *) NULL)
1213     return(MagickFalse);
1214   ReplaceImageInList(&wand->images,chop_image);
1215   return(MagickTrue);
1216 }
1217 \f
1218 /*
1219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1220 %                                                                             %
1221 %                                                                             %
1222 %                                                                             %
1223 %   M a g i c k C l a m p I m a g e                                           %
1224 %                                                                             %
1225 %                                                                             %
1226 %                                                                             %
1227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1228 %
1229 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1230 %
1231 %  The format of the MagickClampImage method is:
1232 %
1233 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1234 %      MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1235 %        const ChannelType channel)
1236 %
1237 %  A description of each parameter follows:
1238 %
1239 %    o wand: the magick wand.
1240 %
1241 %    o channel: the channel.
1242 %
1243 */
1244
1245 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1246 {
1247   MagickBooleanType
1248     status;
1249
1250   status=MagickClampImageChannel(wand,DefaultChannels);
1251   return(status);
1252 }
1253
1254 WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1255   const ChannelType channel)
1256 {
1257   MagickBooleanType
1258     status;
1259
1260   assert(wand != (MagickWand *) NULL);
1261   assert(wand->signature == WandSignature);
1262   if (wand->debug != MagickFalse)
1263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1264   if (wand->images == (Image *) NULL)
1265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1266   status=ClampImageChannel(wand->images,channel);
1267   if (status == MagickFalse)
1268     InheritException(wand->exception,&wand->images->exception);
1269   return(status);
1270 }
1271 \f
1272 /*
1273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1274 %                                                                             %
1275 %                                                                             %
1276 %                                                                             %
1277 %   M a g i c k C l i p I m a g e                                             %
1278 %                                                                             %
1279 %                                                                             %
1280 %                                                                             %
1281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1282 %
1283 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1284 %  present.
1285 %
1286 %  The format of the MagickClipImage method is:
1287 %
1288 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1289 %
1290 %  A description of each parameter follows:
1291 %
1292 %    o wand: the magick wand.
1293 %
1294 */
1295 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1296 {
1297   MagickBooleanType
1298     status;
1299
1300   assert(wand != (MagickWand *) NULL);
1301   assert(wand->signature == WandSignature);
1302   if (wand->debug != MagickFalse)
1303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1304   if (wand->images == (Image *) NULL)
1305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1306   status=ClipImage(wand->images);
1307   if (status == MagickFalse)
1308     InheritException(wand->exception,&wand->images->exception);
1309   return(status);
1310 }
1311 \f
1312 /*
1313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1314 %                                                                             %
1315 %                                                                             %
1316 %                                                                             %
1317 %   M a g i c k C l i p I m a g e P a t h                                     %
1318 %                                                                             %
1319 %                                                                             %
1320 %                                                                             %
1321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1322 %
1323 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1324 %  present. Later operations take effect inside the path.  Id may be a number
1325 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1326 %  path.
1327 %
1328 %  The format of the MagickClipImagePath method is:
1329 %
1330 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1331 %        const char *pathname,const MagickBooleanType inside)
1332 %
1333 %  A description of each parameter follows:
1334 %
1335 %    o wand: the magick wand.
1336 %
1337 %    o pathname: name of clipping path resource. If name is preceded by #, use
1338 %      clipping path numbered by name.
1339 %
1340 %    o inside: if non-zero, later operations take effect inside clipping path.
1341 %      Otherwise later operations take effect outside clipping path.
1342 %
1343 */
1344 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1345   const char *pathname,const MagickBooleanType inside)
1346 {
1347   MagickBooleanType
1348     status;
1349
1350   assert(wand != (MagickWand *) NULL);
1351   assert(wand->signature == WandSignature);
1352   if (wand->debug != MagickFalse)
1353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1354   if (wand->images == (Image *) NULL)
1355     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1356   status=ClipImagePath(wand->images,pathname,inside);
1357   if (status == MagickFalse)
1358     InheritException(wand->exception,&wand->images->exception);
1359   return(status);
1360 }
1361 \f
1362 /*
1363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1364 %                                                                             %
1365 %                                                                             %
1366 %                                                                             %
1367 %   M a g i c k C l u t I m a g e                                             %
1368 %                                                                             %
1369 %                                                                             %
1370 %                                                                             %
1371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1372 %
1373 %  MagickClutImage() replaces colors in the image from a color lookup table.
1374 %
1375 %  The format of the MagickClutImage method is:
1376 %
1377 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1378 %        const MagickWand *clut_wand)
1379 %      MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1380 %        const ChannelType channel,const MagickWand *clut_wand)
1381 %
1382 %  A description of each parameter follows:
1383 %
1384 %    o wand: the magick wand.
1385 %
1386 %    o clut_image: the clut image.
1387 %
1388 */
1389
1390 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1391   const MagickWand *clut_wand)
1392 {
1393   MagickBooleanType
1394     status;
1395
1396   status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
1397   return(status);
1398 }
1399
1400 WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1401   const ChannelType channel,const MagickWand *clut_wand)
1402 {
1403   MagickBooleanType
1404     status;
1405
1406   assert(wand != (MagickWand *) NULL);
1407   assert(wand->signature == WandSignature);
1408   if (wand->debug != MagickFalse)
1409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1410   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1411     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1412   status=ClutImageChannel(wand->images,channel,clut_wand->images);
1413   if (status == MagickFalse)
1414     InheritException(wand->exception,&wand->images->exception);
1415   return(status);
1416 }
1417 \f
1418 /*
1419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1420 %                                                                             %
1421 %                                                                             %
1422 %                                                                             %
1423 %   M a g i c k C o a l e s c e I m a g e s                                   %
1424 %                                                                             %
1425 %                                                                             %
1426 %                                                                             %
1427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1428 %
1429 %  MagickCoalesceImages() composites a set of images while respecting any page
1430 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1431 %  typically start with an image background and each subsequent image
1432 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1433 %  where each image in the sequence is the same size as the first and
1434 %  composited with the next image in the sequence.
1435 %
1436 %  The format of the MagickCoalesceImages method is:
1437 %
1438 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1439 %
1440 %  A description of each parameter follows:
1441 %
1442 %    o wand: the magick wand.
1443 %
1444 */
1445 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1446 {
1447   Image
1448     *coalesce_image;
1449
1450   assert(wand != (MagickWand *) NULL);
1451   assert(wand->signature == WandSignature);
1452   if (wand->debug != MagickFalse)
1453     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1454   if (wand->images == (Image *) NULL)
1455     return((MagickWand *) NULL);
1456   coalesce_image=CoalesceImages(wand->images,wand->exception);
1457   if (coalesce_image == (Image *) NULL)
1458     return((MagickWand *) NULL);
1459   return(CloneMagickWandFromImages(wand,coalesce_image));
1460 }
1461 \f
1462 /*
1463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1464 %                                                                             %
1465 %                                                                             %
1466 %                                                                             %
1467 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1468 %                                                                             %
1469 %                                                                             %
1470 %                                                                             %
1471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1472 %
1473 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1474 %  Collection (CCC) file which solely contains one or more color corrections
1475 %  and applies the color correction to the image.  Here is a sample CCC file:
1476 %
1477 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1478 %          <ColorCorrection id="cc03345">
1479 %                <SOPNode>
1480 %                     <Slope> 0.9 1.2 0.5 </Slope>
1481 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1482 %                     <Power> 1.0 0.8 1.5 </Power>
1483 %                </SOPNode>
1484 %                <SATNode>
1485 %                     <Saturation> 0.85 </Saturation>
1486 %                </SATNode>
1487 %          </ColorCorrection>
1488 %    </ColorCorrectionCollection>
1489 %
1490 %  which includes the offset, slope, and power for each of the RGB channels
1491 %  as well as the saturation.
1492 %
1493 %  The format of the MagickColorDecisionListImage method is:
1494 %
1495 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1496 %        const double gamma)
1497 %
1498 %  A description of each parameter follows:
1499 %
1500 %    o wand: the magick wand.
1501 %
1502 %    o color_correction_collection: the color correction collection in XML.
1503 %
1504 */
1505 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1506   const char *color_correction_collection)
1507 {
1508   MagickBooleanType
1509     status;
1510
1511   assert(wand != (MagickWand *) NULL);
1512   assert(wand->signature == WandSignature);
1513   if (wand->debug != MagickFalse)
1514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1515   if (wand->images == (Image *) NULL)
1516     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1517   status=ColorDecisionListImage(wand->images,color_correction_collection);
1518   if (status == MagickFalse)
1519     InheritException(wand->exception,&wand->images->exception);
1520   return(status);
1521 }
1522 \f
1523 /*
1524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1525 %                                                                             %
1526 %                                                                             %
1527 %                                                                             %
1528 %   M a g i c k C o l o r i z e I m a g e                                     %
1529 %                                                                             %
1530 %                                                                             %
1531 %                                                                             %
1532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1533 %
1534 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1535 %
1536 %  The format of the MagickColorizeImage method is:
1537 %
1538 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1539 %        const PixelWand *colorize,const PixelWand *opacity)
1540 %
1541 %  A description of each parameter follows:
1542 %
1543 %    o wand: the magick wand.
1544 %
1545 %    o colorize: the colorize pixel wand.
1546 %
1547 %    o opacity: the opacity pixel wand.
1548 %
1549 */
1550 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1551   const PixelWand *colorize,const PixelWand *opacity)
1552 {
1553   char
1554     percent_opaque[MaxTextExtent];
1555
1556   Image
1557     *colorize_image;
1558
1559   PixelPacket
1560     target;
1561
1562   assert(wand != (MagickWand *) NULL);
1563   assert(wand->signature == WandSignature);
1564   if (wand->debug != MagickFalse)
1565     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1566   if (wand->images == (Image *) NULL)
1567     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1568   (void) FormatMagickString(percent_opaque,MaxTextExtent,"%g,%g,%g,%g",
1569     (double) (100.0*QuantumScale*PixelGetRedQuantum(opacity)),
1570     (double) (100.0*QuantumScale*PixelGetGreenQuantum(opacity)),
1571     (double) (100.0*QuantumScale*PixelGetBlueQuantum(opacity)),
1572     (double) (100.0*QuantumScale*PixelGetOpacityQuantum(opacity)));
1573   PixelGetQuantumColor(colorize,&target);
1574   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1575     wand->exception);
1576   if (colorize_image == (Image *) NULL)
1577     return(MagickFalse);
1578   ReplaceImageInList(&wand->images,colorize_image);
1579   return(MagickTrue);
1580 }
1581 \f
1582 /*
1583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1584 %                                                                             %
1585 %                                                                             %
1586 %                                                                             %
1587 %   M a g i c k C o m b i n e I m a g e s                                     %
1588 %                                                                             %
1589 %                                                                             %
1590 %                                                                             %
1591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1592 %
1593 %  MagickCombineImages() combines one or more images into a single image.  The
1594 %  grayscale value of the pixels of each image in the sequence is assigned in
1595 %  order to the specified  hannels of the combined image.   The typical
1596 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1597 %
1598 %  The format of the MagickCombineImages method is:
1599 %
1600 %      MagickWand *MagickCombineImages(MagickWand *wand,
1601 %        const ChannelType channel)
1602 %
1603 %  A description of each parameter follows:
1604 %
1605 %    o wand: the magick wand.
1606 %
1607 %    o channel: the channel.
1608 %
1609 */
1610 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1611   const ChannelType channel)
1612 {
1613   Image
1614     *combine_image;
1615
1616   assert(wand != (MagickWand *) NULL);
1617   assert(wand->signature == WandSignature);
1618   if (wand->debug != MagickFalse)
1619     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1620   if (wand->images == (Image *) NULL)
1621     return((MagickWand *) NULL);
1622   combine_image=CombineImages(wand->images,channel,wand->exception);
1623   if (combine_image == (Image *) NULL)
1624     return((MagickWand *) NULL);
1625   return(CloneMagickWandFromImages(wand,combine_image));
1626 }
1627 \f
1628 /*
1629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1630 %                                                                             %
1631 %                                                                             %
1632 %                                                                             %
1633 %   M a g i c k C o m m e n t I m a g e                                       %
1634 %                                                                             %
1635 %                                                                             %
1636 %                                                                             %
1637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1638 %
1639 %  MagickCommentImage() adds a comment to your image.
1640 %
1641 %  The format of the MagickCommentImage method is:
1642 %
1643 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1644 %        const char *comment)
1645 %
1646 %  A description of each parameter follows:
1647 %
1648 %    o wand: the magick wand.
1649 %
1650 %    o comment: the image comment.
1651 %
1652 */
1653 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1654   const char *comment)
1655 {
1656   MagickBooleanType
1657     status;
1658
1659   assert(wand != (MagickWand *) NULL);
1660   assert(wand->signature == WandSignature);
1661   if (wand->debug != MagickFalse)
1662     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1663   if (wand->images == (Image *) NULL)
1664     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1665   status=SetImageProperty(wand->images,"comment",comment);
1666   if (status == MagickFalse)
1667     InheritException(wand->exception,&wand->images->exception);
1668   return(status);
1669 }
1670 \f
1671 /*
1672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1673 %                                                                             %
1674 %                                                                             %
1675 %                                                                             %
1676 %   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                       %
1677 %                                                                             %
1678 %                                                                             %
1679 %                                                                             %
1680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1681 %
1682 %  MagickCompareImageChannels() compares one or more image channels of an image
1683 %  to a reconstructed image and returns the difference image.
1684 %
1685 %  The format of the MagickCompareImageChannels method is:
1686 %
1687 %      MagickWand *MagickCompareImageChannels(MagickWand *wand,
1688 %        const MagickWand *reference,const ChannelType channel,
1689 %        const MetricType metric,double *distortion)
1690 %
1691 %  A description of each parameter follows:
1692 %
1693 %    o wand: the magick wand.
1694 %
1695 %    o reference: the reference wand.
1696 %
1697 %    o channel: the channel.
1698 %
1699 %    o metric: the metric.
1700 %
1701 %    o distortion: the computed distortion between the images.
1702 %
1703 */
1704 WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
1705   const MagickWand *reference,const ChannelType channel,const MetricType metric,
1706   double *distortion)
1707 {
1708   Image
1709     *compare_image;
1710
1711   assert(wand != (MagickWand *) NULL);
1712   assert(wand->signature == WandSignature);
1713   if (wand->debug != MagickFalse)
1714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1715   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1716     {
1717       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1718         "ContainsNoImages","`%s'",wand->name);
1719       return((MagickWand *) NULL);
1720     }
1721   compare_image=CompareImageChannels(wand->images,reference->images,channel,
1722     metric,distortion,&wand->images->exception);
1723   if (compare_image == (Image *) NULL)
1724     return((MagickWand *) NULL);
1725   return(CloneMagickWandFromImages(wand,compare_image));
1726 }
1727 \f
1728 /*
1729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1730 %                                                                             %
1731 %                                                                             %
1732 %                                                                             %
1733 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1734 %                                                                             %
1735 %                                                                             %
1736 %                                                                             %
1737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1738 %
1739 %  MagickCompareImageLayers() compares each image with the next in a sequence
1740 %  and returns the maximum bounding region of any pixel differences it
1741 %  discovers.
1742 %
1743 %  The format of the MagickCompareImageLayers method is:
1744 %
1745 %      MagickWand *MagickCompareImageLayers(MagickWand *wand,
1746 %        const ImageLayerMethod method)
1747 %
1748 %  A description of each parameter follows:
1749 %
1750 %    o wand: the magick wand.
1751 %
1752 %    o method: the compare method.
1753 %
1754 */
1755 WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
1756   const ImageLayerMethod method)
1757 {
1758   Image
1759     *layers_image;
1760
1761   assert(wand != (MagickWand *) NULL);
1762   assert(wand->signature == WandSignature);
1763   if (wand->debug != MagickFalse)
1764     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1765   if (wand->images == (Image *) NULL)
1766     return((MagickWand *) NULL);
1767   layers_image=CompareImageLayers(wand->images,method,wand->exception);
1768   if (layers_image == (Image *) NULL)
1769     return((MagickWand *) NULL);
1770   return(CloneMagickWandFromImages(wand,layers_image));
1771 }
1772 \f
1773 /*
1774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1775 %                                                                             %
1776 %                                                                             %
1777 %                                                                             %
1778 %   M a g i c k C o m p a r e I m a g e s                                     %
1779 %                                                                             %
1780 %                                                                             %
1781 %                                                                             %
1782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1783 %
1784 %  MagickCompareImages() compares an image to a reconstructed image and returns
1785 %  the specified difference image.
1786 %
1787 %  The format of the MagickCompareImages method is:
1788 %
1789 %      MagickWand *MagickCompareImages(MagickWand *wand,
1790 %        const MagickWand *reference,const MetricType metric,
1791 %        double *distortion)
1792 %
1793 %  A description of each parameter follows:
1794 %
1795 %    o wand: the magick wand.
1796 %
1797 %    o reference: the reference wand.
1798 %
1799 %    o metric: the metric.
1800 %
1801 %    o distortion: the computed distortion between the images.
1802 %
1803 */
1804 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1805   const MagickWand *reference,const MetricType metric,double *distortion)
1806 {
1807   Image
1808     *compare_image;
1809
1810
1811   assert(wand != (MagickWand *) NULL);
1812   assert(wand->signature == WandSignature);
1813   if (wand->debug != MagickFalse)
1814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1815   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1816     {
1817       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1818         "ContainsNoImages","`%s'",wand->name);
1819       return((MagickWand *) NULL);
1820     }
1821   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1822     &wand->images->exception);
1823   if (compare_image == (Image *) NULL)
1824     return((MagickWand *) NULL);
1825   return(CloneMagickWandFromImages(wand,compare_image));
1826 }
1827 \f
1828 /*
1829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1830 %                                                                             %
1831 %                                                                             %
1832 %                                                                             %
1833 %   M a g i c k C o m p o s i t e I m a g e                                   %
1834 %                                                                             %
1835 %                                                                             %
1836 %                                                                             %
1837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1838 %
1839 %  MagickCompositeImage() composite one image onto another at the specified
1840 %  offset.
1841 %
1842 %  The format of the MagickCompositeImage method is:
1843 %
1844 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1845 %        const MagickWand *composite_wand,const CompositeOperator compose,
1846 %        const long x,const long y)
1847 %      MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1848 %        const ChannelType channel,const MagickWand *composite_wand,
1849 %        const CompositeOperator compose,const long x,const long y)
1850 %
1851 %  A description of each parameter follows:
1852 %
1853 %    o wand: the magick wand.
1854 %
1855 %    o composite_image: the composite image.
1856 %
1857 %    o compose: This operator affects how the composite is applied to the
1858 %      image.  The default is Over.  Choose from these operators:
1859 %
1860 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1861 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1862 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1863 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1864 %        DisplaceCompositeOp
1865 %
1866 %    o x: the column offset of the composited image.
1867 %
1868 %    o y: the row offset of the composited image.
1869 %
1870 */
1871
1872 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1873   const MagickWand *composite_wand,const CompositeOperator compose,const long x,
1874   const long y)
1875 {
1876   MagickBooleanType
1877     status;
1878
1879   status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
1880     compose,x,y);
1881   return(status);
1882 }
1883
1884 WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1885   const ChannelType channel,const MagickWand *composite_wand,
1886   const CompositeOperator compose,const long x,const long y)
1887 {
1888   MagickBooleanType
1889     status;
1890
1891   assert(wand != (MagickWand *) NULL);
1892   assert(wand->signature == WandSignature);
1893   if (wand->debug != MagickFalse)
1894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1895   if ((wand->images == (Image *) NULL) ||
1896       (composite_wand->images == (Image *) NULL))
1897     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1898   status=CompositeImageChannel(wand->images,channel,compose,
1899     composite_wand->images,x,y);
1900   if (status == MagickFalse)
1901     InheritException(wand->exception,&wand->images->exception);
1902   return(status);
1903 }
1904 \f
1905 /*
1906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1907 %                                                                             %
1908 %                                                                             %
1909 %                                                                             %
1910 %   M a g i c k C o n t r a s t I m a g e                                     %
1911 %                                                                             %
1912 %                                                                             %
1913 %                                                                             %
1914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1915 %
1916 %  MagickContrastImage() enhances the intensity differences between the lighter
1917 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1918 %  increase the image contrast otherwise the contrast is reduced.
1919 %
1920 %  The format of the MagickContrastImage method is:
1921 %
1922 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1923 %        const MagickBooleanType sharpen)
1924 %
1925 %  A description of each parameter follows:
1926 %
1927 %    o wand: the magick wand.
1928 %
1929 %    o sharpen: Increase or decrease image contrast.
1930 %
1931 %
1932 */
1933 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1934   const MagickBooleanType sharpen)
1935 {
1936   MagickBooleanType
1937     status;
1938
1939   assert(wand != (MagickWand *) NULL);
1940   assert(wand->signature == WandSignature);
1941   if (wand->debug != MagickFalse)
1942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1943   if (wand->images == (Image *) NULL)
1944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1945   status=ContrastImage(wand->images,sharpen);
1946   if (status == MagickFalse)
1947     InheritException(wand->exception,&wand->images->exception);
1948   return(status);
1949 }
1950 \f
1951 /*
1952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1953 %                                                                             %
1954 %                                                                             %
1955 %                                                                             %
1956 %   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                       %
1957 %                                                                             %
1958 %                                                                             %
1959 %                                                                             %
1960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1961 %
1962 %  MagickContrastStretchImage() enhances the contrast of a color image by
1963 %  adjusting the pixels color to span the entire range of colors available.
1964 %  You can also reduce the influence of a particular channel with a gamma
1965 %  value of 0.
1966 %
1967 %  The format of the MagickContrastStretchImage method is:
1968 %
1969 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1970 %        const double black_point,const double white_point)
1971 %      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
1972 %        const ChannelType channel,const double black_point,
1973 %        const double white_point)
1974 %
1975 %  A description of each parameter follows:
1976 %
1977 %    o wand: the magick wand.
1978 %
1979 %    o channel: the image channel(s).
1980 %
1981 %    o black_point: the black point.
1982 %
1983 %    o white_point: the white point.
1984 %
1985 */
1986
1987 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1988   const double black_point,const double white_point)
1989 {
1990   MagickBooleanType
1991     status;
1992
1993   status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
1994     white_point);
1995   return(status);
1996 }
1997
1998 WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
1999   const ChannelType channel,const double black_point,const double white_point)
2000 {
2001   MagickBooleanType
2002     status;
2003
2004   assert(wand != (MagickWand *) NULL);
2005   assert(wand->signature == WandSignature);
2006   if (wand->debug != MagickFalse)
2007     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2008   if (wand->images == (Image *) NULL)
2009     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2010   status=ContrastStretchImageChannel(wand->images,channel,black_point,
2011     white_point);
2012   if (status == MagickFalse)
2013     InheritException(wand->exception,&wand->images->exception);
2014   return(status);
2015 }
2016 \f
2017 /*
2018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2019 %                                                                             %
2020 %                                                                             %
2021 %                                                                             %
2022 %   M a g i c k C o n v o l v e I m a g e                                     %
2023 %                                                                             %
2024 %                                                                             %
2025 %                                                                             %
2026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2027 %
2028 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2029 %
2030 %  The format of the MagickConvolveImage method is:
2031 %
2032 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2033 %        const unsigned long order,const double *kernel)
2034 %      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2035 %        const ChannelType channel,const unsigned long order,
2036 %        const double *kernel)
2037 %
2038 %  A description of each parameter follows:
2039 %
2040 %    o wand: the magick wand.
2041 %
2042 %    o channel: the image channel(s).
2043 %
2044 %    o order: the number of columns and rows in the filter kernel.
2045 %
2046 %    o kernel: An array of doubles representing the convolution kernel.
2047 %
2048 */
2049
2050 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2051   const unsigned long order,const double *kernel)
2052 {
2053   MagickBooleanType
2054     status;
2055
2056   status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2057   return(status);
2058 }
2059
2060 WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2061   const ChannelType channel,const unsigned long order,const double *kernel)
2062 {
2063   Image
2064     *convolve_image;
2065
2066   assert(wand != (MagickWand *) NULL);
2067   assert(wand->signature == WandSignature);
2068   if (wand->debug != MagickFalse)
2069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2070   if (kernel == (const double *) NULL)
2071     return(MagickFalse);
2072   if (wand->images == (Image *) NULL)
2073     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2074   convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2075     wand->exception);
2076   if (convolve_image == (Image *) NULL)
2077     return(MagickFalse);
2078   ReplaceImageInList(&wand->images,convolve_image);
2079   return(MagickTrue);
2080 }
2081 \f
2082 /*
2083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2084 %                                                                             %
2085 %                                                                             %
2086 %                                                                             %
2087 %   M a g i c k C r o p I m a g e                                             %
2088 %                                                                             %
2089 %                                                                             %
2090 %                                                                             %
2091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2092 %
2093 %  MagickCropImage() extracts a region of the image.
2094 %
2095 %  The format of the MagickCropImage method is:
2096 %
2097 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2098 %        const unsigned long width,const unsigned long height,const long x,
2099 %        const long y)
2100 %
2101 %  A description of each parameter follows:
2102 %
2103 %    o wand: the magick wand.
2104 %
2105 %    o width: the region width.
2106 %
2107 %    o height: the region height.
2108 %
2109 %    o x: the region x-offset.
2110 %
2111 %    o y: the region y-offset.
2112 %
2113 */
2114 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2115   const unsigned long width,const unsigned long height,const long x,
2116   const long y)
2117 {
2118   Image
2119     *crop_image;
2120
2121   RectangleInfo
2122     crop;
2123
2124   assert(wand != (MagickWand *) NULL);
2125   assert(wand->signature == WandSignature);
2126   if (wand->debug != MagickFalse)
2127     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2128   if (wand->images == (Image *) NULL)
2129     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2130   crop.width=width;
2131   crop.height=height;
2132   crop.x=x;
2133   crop.y=y;
2134   crop_image=CropImage(wand->images,&crop,wand->exception);
2135   if (crop_image == (Image *) NULL)
2136     return(MagickFalse);
2137   ReplaceImageInList(&wand->images,crop_image);
2138   return(MagickTrue);
2139 }
2140 \f
2141 /*
2142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2143 %                                                                             %
2144 %                                                                             %
2145 %                                                                             %
2146 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2147 %                                                                             %
2148 %                                                                             %
2149 %                                                                             %
2150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2151 %
2152 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2153 %  of positions.  If you cycle the colormap a number of times you can produce
2154 %  a psychodelic effect.
2155 %
2156 %  The format of the MagickCycleColormapImage method is:
2157 %
2158 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2159 %        const long displace)
2160 %
2161 %  A description of each parameter follows:
2162 %
2163 %    o wand: the magick wand.
2164 %
2165 %    o pixel_wand: the pixel wand.
2166 %
2167 */
2168 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2169   const long displace)
2170 {
2171   MagickBooleanType
2172     status;
2173
2174   assert(wand != (MagickWand *) NULL);
2175   assert(wand->signature == WandSignature);
2176   if (wand->debug != MagickFalse)
2177     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2178   if (wand->images == (Image *) NULL)
2179     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2180   status=CycleColormapImage(wand->images,displace);
2181   if (status == MagickFalse)
2182     InheritException(wand->exception,&wand->images->exception);
2183   return(status);
2184 }
2185 \f
2186 /*
2187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2188 %                                                                             %
2189 %                                                                             %
2190 %                                                                             %
2191 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2192 %                                                                             %
2193 %                                                                             %
2194 %                                                                             %
2195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2196 %
2197 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2198 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2199 %  The data can be char, short int, int, float, or double.  Float and double
2200 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2201 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2202 %  example, to create a 640x480 image from unsigned red-green-blue character
2203 %  data, use
2204 %
2205 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2206 %
2207 %  The format of the MagickConstituteImage method is:
2208 %
2209 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2210 %        const unsigned long columns,const unsigned long rows,const char *map,
2211 %        const StorageType storage,void *pixels)
2212 %
2213 %  A description of each parameter follows:
2214 %
2215 %    o wand: the magick wand.
2216 %
2217 %    o columns: width in pixels of the image.
2218 %
2219 %    o rows: height in pixels of the image.
2220 %
2221 %    o map:  This string reflects the expected ordering of the pixel array.
2222 %      It can be any combination or order of R = red, G = green, B = blue,
2223 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2224 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2225 %      P = pad.
2226 %
2227 %    o storage: Define the data type of the pixels.  Float and double types are
2228 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2229 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2230 %      LongPixel, QuantumPixel, or ShortPixel.
2231 %
2232 %    o pixels: This array of values contain the pixel components as defined by
2233 %      map and type.  You must preallocate this array where the expected
2234 %      length varies depending on the values of width, height, map, and type.
2235 %
2236 %
2237 */
2238 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2239   const unsigned long columns,const unsigned long rows,const char *map,
2240   const StorageType storage,const void *pixels)
2241 {
2242   Image
2243     *images;
2244
2245   assert(wand != (MagickWand *) NULL);
2246   assert(wand->signature == WandSignature);
2247   if (wand->debug != MagickFalse)
2248     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2249   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2250   if (images == (Image *) NULL)
2251     return(MagickFalse);
2252   return(InsertImageInWand(wand,images));
2253 }
2254 \f
2255 /*
2256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2257 %                                                                             %
2258 %                                                                             %
2259 %                                                                             %
2260 %   M a g i c k D e c i p h e r I m a g e                                     %
2261 %                                                                             %
2262 %                                                                             %
2263 %                                                                             %
2264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2265 %
2266 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2267 %
2268 %  The format of the MagickDecipherImage method is:
2269 %
2270 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2271 %        const char *passphrase)
2272 %
2273 %  A description of each parameter follows:
2274 %
2275 %    o wand: the magick wand.
2276 %
2277 %    o passphrase: the passphrase.
2278 %
2279 */
2280 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2281   const char *passphrase)
2282 {
2283   assert(wand != (MagickWand *) NULL);
2284   assert(wand->signature == WandSignature);
2285   if (wand->debug != MagickFalse)
2286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2287   if (wand->images == (Image *) NULL)
2288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2289   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2290 }
2291 \f
2292 /*
2293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2294 %                                                                             %
2295 %                                                                             %
2296 %                                                                             %
2297 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2298 %                                                                             %
2299 %                                                                             %
2300 %                                                                             %
2301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2302 %
2303 %  MagickDeconstructImages() compares each image with the next in a sequence
2304 %  and returns the maximum bounding region of any pixel differences it
2305 %  discovers.
2306 %
2307 %  The format of the MagickDeconstructImages method is:
2308 %
2309 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2310 %
2311 %  A description of each parameter follows:
2312 %
2313 %    o wand: the magick wand.
2314 %
2315 */
2316 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2317 {
2318   Image
2319     *deconstruct_image;
2320
2321   assert(wand != (MagickWand *) NULL);
2322   assert(wand->signature == WandSignature);
2323   if (wand->debug != MagickFalse)
2324     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2325   if (wand->images == (Image *) NULL)
2326     return((MagickWand *) NULL);
2327   deconstruct_image=DeconstructImages(wand->images,wand->exception);
2328   if (deconstruct_image == (Image *) NULL)
2329     return((MagickWand *) NULL);
2330   return(CloneMagickWandFromImages(wand,deconstruct_image));
2331 }
2332 \f
2333 /*
2334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2335 %                                                                             %
2336 %                                                                             %
2337 %                                                                             %
2338 %     M a g i c k D e s k e w I m a g e                                       %
2339 %                                                                             %
2340 %                                                                             %
2341 %                                                                             %
2342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2343 %
2344 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2345 %  occurs in scanned images because of the camera being misaligned,
2346 %  imperfections in the scanning or surface, or simply because the paper was
2347 %  not placed completely flat when scanned.
2348 %
2349 %  The format of the MagickDeskewImage method is:
2350 %
2351 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2352 %        const double threshold)
2353 %
2354 %  A description of each parameter follows:
2355 %
2356 %    o wand: the magick wand.
2357 %
2358 %    o threshold: separate background from foreground.
2359 %
2360 */
2361 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2362   const double threshold)
2363 {
2364   Image
2365     *sepia_image;
2366
2367   assert(wand != (MagickWand *) NULL);
2368   assert(wand->signature == WandSignature);
2369   if (wand->debug != MagickFalse)
2370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2371   if (wand->images == (Image *) NULL)
2372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2373   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2374   if (sepia_image == (Image *) NULL)
2375     return(MagickFalse);
2376   ReplaceImageInList(&wand->images,sepia_image);
2377   return(MagickTrue);
2378 }
2379 \f
2380 /*
2381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2382 %                                                                             %
2383 %                                                                             %
2384 %                                                                             %
2385 %     M a g i c k D e s p e c k l e I m a g e                                 %
2386 %                                                                             %
2387 %                                                                             %
2388 %                                                                             %
2389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2390 %
2391 %  MagickDespeckleImage() reduces the speckle noise in an image while
2392 %  perserving the edges of the original image.
2393 %
2394 %  The format of the MagickDespeckleImage method is:
2395 %
2396 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2397 %
2398 %  A description of each parameter follows:
2399 %
2400 %    o wand: the magick wand.
2401 %
2402 */
2403 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2404 {
2405   Image
2406     *despeckle_image;
2407
2408   assert(wand != (MagickWand *) NULL);
2409   assert(wand->signature == WandSignature);
2410   if (wand->debug != MagickFalse)
2411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2412   if (wand->images == (Image *) NULL)
2413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2414   despeckle_image=DespeckleImage(wand->images,wand->exception);
2415   if (despeckle_image == (Image *) NULL)
2416     return(MagickFalse);
2417   ReplaceImageInList(&wand->images,despeckle_image);
2418   return(MagickTrue);
2419 }
2420 \f
2421 /*
2422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2423 %                                                                             %
2424 %                                                                             %
2425 %                                                                             %
2426 %   M a g i c k D e s t r o y I m a g e                                       %
2427 %                                                                             %
2428 %                                                                             %
2429 %                                                                             %
2430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2431 %
2432 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2433 %  with the image if the reference count becomes zero.
2434 %
2435 %  The format of the MagickDestroyImage method is:
2436 %
2437 %      Image *MagickDestroyImage(Image *image)
2438 %
2439 %  A description of each parameter follows:
2440 %
2441 %    o image: the image.
2442 %
2443 */
2444 WandExport Image *MagickDestroyImage(Image *image)
2445 {
2446   return(DestroyImage(image));
2447 }
2448 \f
2449 /*
2450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2451 %                                                                             %
2452 %                                                                             %
2453 %                                                                             %
2454 %   M a g i c k D i s p l a y I m a g e                                       %
2455 %                                                                             %
2456 %                                                                             %
2457 %                                                                             %
2458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2459 %
2460 %  MagickDisplayImage() displays an image.
2461 %
2462 %  The format of the MagickDisplayImage method is:
2463 %
2464 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2465 %        const char *server_name)
2466 %
2467 %  A description of each parameter follows:
2468 %
2469 %    o wand: the magick wand.
2470 %
2471 %    o server_name: the X server name.
2472 %
2473 */
2474 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2475   const char *server_name)
2476 {
2477   Image
2478     *image;
2479
2480   MagickBooleanType
2481     status;
2482
2483   assert(wand != (MagickWand *) NULL);
2484   assert(wand->signature == WandSignature);
2485   if (wand->debug != MagickFalse)
2486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2487   if (wand->images == (Image *) NULL)
2488     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2489   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2490   if (image == (Image *) NULL)
2491     return(MagickFalse);
2492   (void) CloneString(&wand->image_info->server_name,server_name);
2493   status=DisplayImages(wand->image_info,image);
2494   if (status == MagickFalse)
2495     InheritException(wand->exception,&image->exception);
2496   image=DestroyImage(image);
2497   return(status);
2498 }
2499 \f
2500 /*
2501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2502 %                                                                             %
2503 %                                                                             %
2504 %                                                                             %
2505 %   M a g i c k D i s p l a y I m a g e s                                     %
2506 %                                                                             %
2507 %                                                                             %
2508 %                                                                             %
2509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2510 %
2511 %  MagickDisplayImages() displays an image or image sequence.
2512 %
2513 %  The format of the MagickDisplayImages method is:
2514 %
2515 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2516 %        const char *server_name)
2517 %
2518 %  A description of each parameter follows:
2519 %
2520 %    o wand: the magick wand.
2521 %
2522 %    o server_name: the X server name.
2523 %
2524 */
2525 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2526   const char *server_name)
2527 {
2528   MagickBooleanType
2529     status;
2530
2531   assert(wand != (MagickWand *) NULL);
2532   assert(wand->signature == WandSignature);
2533   if (wand->debug != MagickFalse)
2534     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2535   (void) CloneString(&wand->image_info->server_name,server_name);
2536   status=DisplayImages(wand->image_info,wand->images);
2537   if (status == MagickFalse)
2538     InheritException(wand->exception,&wand->images->exception);
2539   return(status);
2540 }
2541 \f
2542 /*
2543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2544 %                                                                             %
2545 %                                                                             %
2546 %                                                                             %
2547 %   M a g i c k D i s t o r t I m a g e                                       %
2548 %                                                                             %
2549 %                                                                             %
2550 %                                                                             %
2551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2552 %
2553 %  MagickDistortImage() distorts an image using various distortion methods, by
2554 %  mapping color lookups of the source image to a new destination image
2555 %  usally of the same size as the source image, unless 'bestfit' is set to
2556 %  true.
2557 %
2558 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2559 %  adjusted to ensure the whole source 'image' will just fit within the final
2560 %  destination image, which will be sized and offset accordingly.  Also in
2561 %  many cases the virtual offset of the source image will be taken into
2562 %  account in the mapping.
2563 %
2564 %  The format of the MagickDistortImage method is:
2565 %
2566 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2567 %        const DistortImageMethod method,const unsigned long number_arguments,
2568 %        const double *arguments,const MagickBooleanType bestfit)
2569 %
2570 %  A description of each parameter follows:
2571 %
2572 %    o image: the image to be distorted.
2573 %
2574 %    o method: the method of image distortion.
2575 %
2576 %        ArcDistortion always ignores the source image offset, and always
2577 %        'bestfit' the destination image with the top left corner offset
2578 %        relative to the polar mapping center.
2579 %
2580 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2581 %        style of image distortion.
2582 %
2583 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2584 %        distortion when more than the minimum number of control point pairs
2585 %        are provided.
2586 %
2587 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2588 %        that 4 control point pairs are provided. While Affine distortions let
2589 %        you use any number of control point pairs, that is Zero pairs is a
2590 %        no-Op (viewport only) distrotion, one pair is a translation and two
2591 %        pairs of control points do a scale-rotate-translate, without any
2592 %        shearing.
2593 %
2594 %    o number_arguments: the number of arguments given for this distortion
2595 %      method.
2596 %
2597 %    o arguments: the arguments for this distortion method.
2598 %
2599 %    o bestfit: Attempt to resize destination to fit distorted source.
2600 %
2601 */
2602 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2603   const DistortImageMethod method,const unsigned long number_arguments,
2604   const double *arguments,const MagickBooleanType bestfit)
2605 {
2606   Image
2607     *distort_image;
2608
2609   assert(wand != (MagickWand *) NULL);
2610   assert(wand->signature == WandSignature);
2611   if (wand->debug != MagickFalse)
2612     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2613   if (wand->images == (Image *) NULL)
2614     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2615   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2616     bestfit,wand->exception);
2617   if (distort_image == (Image *) NULL)
2618     return(MagickFalse);
2619   ReplaceImageInList(&wand->images,distort_image);
2620   return(MagickTrue);
2621 }
2622 \f
2623 /*
2624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2625 %                                                                             %
2626 %                                                                             %
2627 %                                                                             %
2628 %   M a g i c k D r a w I m a g e                                             %
2629 %                                                                             %
2630 %                                                                             %
2631 %                                                                             %
2632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2633 %
2634 %  MagickDrawImage() renders the drawing wand on the current image.
2635 %
2636 %  The format of the MagickDrawImage method is:
2637 %
2638 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2639 %        const DrawingWand *drawing_wand)
2640 %
2641 %  A description of each parameter follows:
2642 %
2643 %    o wand: the magick wand.
2644 %
2645 %    o drawing_wand: the draw wand.
2646 %
2647 */
2648 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2649   const DrawingWand *drawing_wand)
2650 {
2651   char
2652     *primitive;
2653
2654   DrawInfo
2655     *draw_info;
2656
2657   MagickBooleanType
2658     status;
2659
2660   assert(wand != (MagickWand *) NULL);
2661   assert(wand->signature == WandSignature);
2662   if (wand->debug != MagickFalse)
2663     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2664   if (wand->images == (Image *) NULL)
2665     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2666   draw_info=PeekDrawingWand(drawing_wand);
2667   if ((draw_info == (DrawInfo *) NULL) ||
2668       (draw_info->primitive == (char *) NULL))
2669     return(MagickFalse);
2670   primitive=AcquireString(draw_info->primitive);
2671   draw_info=DestroyDrawInfo(draw_info);
2672   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2673   draw_info->primitive=primitive;
2674   status=DrawImage(wand->images,draw_info);
2675   if (status == MagickFalse)
2676     InheritException(wand->exception,&wand->images->exception);
2677   draw_info=DestroyDrawInfo(draw_info);
2678   return(status);
2679 }
2680 \f
2681 /*
2682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2683 %                                                                             %
2684 %                                                                             %
2685 %                                                                             %
2686 %   M a g i c k E d g e I m a g e                                             %
2687 %                                                                             %
2688 %                                                                             %
2689 %                                                                             %
2690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2691 %
2692 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2693 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2694 %  radius for you.
2695 %
2696 %  The format of the MagickEdgeImage method is:
2697 %
2698 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2699 %
2700 %  A description of each parameter follows:
2701 %
2702 %    o wand: the magick wand.
2703 %
2704 %    o radius: the radius of the pixel neighborhood.
2705 %
2706 */
2707 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2708   const double radius)
2709 {
2710   Image
2711     *edge_image;
2712
2713   assert(wand != (MagickWand *) NULL);
2714   assert(wand->signature == WandSignature);
2715   if (wand->debug != MagickFalse)
2716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2717   if (wand->images == (Image *) NULL)
2718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2719   edge_image=EdgeImage(wand->images,radius,wand->exception);
2720   if (edge_image == (Image *) NULL)
2721     return(MagickFalse);
2722   ReplaceImageInList(&wand->images,edge_image);
2723   return(MagickTrue);
2724 }
2725 \f
2726 /*
2727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2728 %                                                                             %
2729 %                                                                             %
2730 %                                                                             %
2731 %   M a g i c k E m b o s s I m a g e                                         %
2732 %                                                                             %
2733 %                                                                             %
2734 %                                                                             %
2735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2736 %
2737 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2738 %  effect.  We convolve the image with a Gaussian operator of the given radius
2739 %  and standard deviation (sigma).  For reasonable results, radius should be
2740 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2741 %  radius for you.
2742 %
2743 %  The format of the MagickEmbossImage method is:
2744 %
2745 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2746 %        const double sigma)
2747 %
2748 %  A description of each parameter follows:
2749 %
2750 %    o wand: the magick wand.
2751 %
2752 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2753 %      pixel.
2754 %
2755 %    o sigma: the standard deviation of the Gaussian, in pixels.
2756 %
2757 */
2758 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2759   const double radius,const double sigma)
2760 {
2761   Image
2762     *emboss_image;
2763
2764   assert(wand != (MagickWand *) NULL);
2765   assert(wand->signature == WandSignature);
2766   if (wand->debug != MagickFalse)
2767     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2768   if (wand->images == (Image *) NULL)
2769     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2770   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2771   if (emboss_image == (Image *) NULL)
2772     return(MagickFalse);
2773   ReplaceImageInList(&wand->images,emboss_image);
2774   return(MagickTrue);
2775 }
2776 \f
2777 /*
2778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2779 %                                                                             %
2780 %                                                                             %
2781 %                                                                             %
2782 %   M a g i c k E n c i p h e r I m a g e                                     %
2783 %                                                                             %
2784 %                                                                             %
2785 %                                                                             %
2786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2787 %
2788 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2789 %
2790 %  The format of the MagickEncipherImage method is:
2791 %
2792 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2793 %        const char *passphrase)
2794 %
2795 %  A description of each parameter follows:
2796 %
2797 %    o wand: the magick wand.
2798 %
2799 %    o passphrase: the passphrase.
2800 %
2801 */
2802 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2803   const char *passphrase)
2804 {
2805   assert(wand != (MagickWand *) NULL);
2806   assert(wand->signature == WandSignature);
2807   if (wand->debug != MagickFalse)
2808     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2809   if (wand->images == (Image *) NULL)
2810     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2811   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2812 }
2813 \f
2814 /*
2815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2816 %                                                                             %
2817 %                                                                             %
2818 %                                                                             %
2819 %   M a g i c k E n h a n c e I m a g e                                       %
2820 %                                                                             %
2821 %                                                                             %
2822 %                                                                             %
2823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2824 %
2825 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2826 %  noisy image.
2827 %
2828 %  The format of the MagickEnhanceImage method is:
2829 %
2830 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2831 %
2832 %  A description of each parameter follows:
2833 %
2834 %    o wand: the magick wand.
2835 %
2836 */
2837 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2838 {
2839   Image
2840     *enhance_image;
2841
2842   assert(wand != (MagickWand *) NULL);
2843   assert(wand->signature == WandSignature);
2844   if (wand->debug != MagickFalse)
2845     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2846   if (wand->images == (Image *) NULL)
2847     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2848   enhance_image=EnhanceImage(wand->images,wand->exception);
2849   if (enhance_image == (Image *) NULL)
2850     return(MagickFalse);
2851   ReplaceImageInList(&wand->images,enhance_image);
2852   return(MagickTrue);
2853 }
2854 \f
2855 /*
2856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2857 %                                                                             %
2858 %                                                                             %
2859 %                                                                             %
2860 %   M a g i c k E q u a l i z e I m a g e                                     %
2861 %                                                                             %
2862 %                                                                             %
2863 %                                                                             %
2864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2865 %
2866 %  MagickEqualizeImage() equalizes the image histogram.
2867 %
2868 %  The format of the MagickEqualizeImage method is:
2869 %
2870 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2871 %      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2872 %        const ChannelType channel)
2873 %
2874 %  A description of each parameter follows:
2875 %
2876 %    o wand: the magick wand.
2877 %
2878 %    o channel: the image channel(s).
2879 %
2880 */
2881
2882 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2883 {
2884   MagickBooleanType
2885     status;
2886
2887   status=MagickEqualizeImageChannel(wand,DefaultChannels);
2888   return(status);
2889 }
2890
2891 WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2892   const ChannelType channel)
2893 {
2894   MagickBooleanType
2895     status;
2896
2897   assert(wand != (MagickWand *) NULL);
2898   assert(wand->signature == WandSignature);
2899   if (wand->debug != MagickFalse)
2900     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2901   if (wand->images == (Image *) NULL)
2902     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2903   status=EqualizeImageChannel(wand->images,channel);
2904   if (status == MagickFalse)
2905     InheritException(wand->exception,&wand->images->exception);
2906   return(status);
2907 }
2908 \f
2909 /*
2910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2911 %                                                                             %
2912 %                                                                             %
2913 %                                                                             %
2914 %   M a g i c k E v a l u a t e I m a g e                                     %
2915 %                                                                             %
2916 %                                                                             %
2917 %                                                                             %
2918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2919 %
2920 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2921 %  expression to an image.  Use these operators to lighten or darken an image,
2922 %  to increase or decrease contrast in an image, or to produce the "negative"
2923 %  of an image.
2924 %
2925 %  The format of the MagickEvaluateImage method is:
2926 %
2927 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2928 %        const MagickEvaluateOperator operator,const double value)
2929 %      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2930 %        const ChannelType channel,const MagickEvaluateOperator op,
2931 %        const double value)
2932 %
2933 %  A description of each parameter follows:
2934 %
2935 %    o wand: the magick wand.
2936 %
2937 %    o channel: the channel(s).
2938 %
2939 %    o op: A channel operator.
2940 %
2941 %    o value: A value value.
2942 %
2943 */
2944
2945 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2946   const MagickEvaluateOperator op,const double value)
2947 {
2948   MagickBooleanType
2949     status;
2950
2951   assert(wand != (MagickWand *) NULL);
2952   assert(wand->signature == WandSignature);
2953   if (wand->debug != MagickFalse)
2954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2955   if (wand->images == (Image *) NULL)
2956     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2957   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2958   if (status == MagickFalse)
2959     InheritException(wand->exception,&wand->images->exception);
2960   return(status);
2961 }
2962
2963 WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
2964   const ChannelType channel,const MagickEvaluateOperator op,const double value)
2965 {
2966   MagickBooleanType
2967     status;
2968
2969   assert(wand != (MagickWand *) NULL);
2970   assert(wand->signature == WandSignature);
2971   if (wand->debug != MagickFalse)
2972     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2973   if (wand->images == (Image *) NULL)
2974     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2975   status=EvaluateImageChannel(wand->images,channel,op,value,
2976     &wand->images->exception);
2977   return(status);
2978 }
2979 \f
2980 /*
2981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2982 %                                                                             %
2983 %                                                                             %
2984 %                                                                             %
2985 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2986 %                                                                             %
2987 %                                                                             %
2988 %                                                                             %
2989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2990 %
2991 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2992 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2993 %  an error is encountered.  The data is returned as char, short int, int,
2994 %  long, float, or double in the order specified by map.
2995 %
2996 %  Suppose you want to extract the first scanline of a 640x480 image as
2997 %  character data in red-green-blue order:
2998 %
2999 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3000 %
3001 %  The format of the MagickExportImagePixels method is:
3002 %
3003 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3004 %        const long x,const long y,const unsigned long columns,
3005 %        const unsigned long rows,const char *map,const StorageType storage,
3006 %        void *pixels)
3007 %
3008 %  A description of each parameter follows:
3009 %
3010 %    o wand: the magick wand.
3011 %
3012 %    o x, y, columns, rows:  These values define the perimeter
3013 %      of a region of pixels you want to extract.
3014 %
3015 %    o map:  This string reflects the expected ordering of the pixel array.
3016 %      It can be any combination or order of R = red, G = green, B = blue,
3017 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3018 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3019 %      P = pad.
3020 %
3021 %    o storage: Define the data type of the pixels.  Float and double types are
3022 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3023 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3024 %      LongPixel, QuantumPixel, or ShortPixel.
3025 %
3026 %    o pixels: This array of values contain the pixel components as defined by
3027 %      map and type.  You must preallocate this array where the expected
3028 %      length varies depending on the values of width, height, map, and type.
3029 %
3030 */
3031 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3032   const long x,const long y,const unsigned long columns,
3033   const unsigned long rows,const char *map,const StorageType storage,
3034   void *pixels)
3035 {
3036   MagickBooleanType
3037     status;
3038
3039   assert(wand != (MagickWand *) NULL);
3040   assert(wand->signature == WandSignature);
3041   if (wand->debug != MagickFalse)
3042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3043   if (wand->images == (Image *) NULL)
3044     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3045   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3046     storage,pixels,wand->exception);
3047   if (status == MagickFalse)
3048     InheritException(wand->exception,&wand->images->exception);
3049   return(status);
3050 }
3051 \f
3052 /*
3053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3054 %                                                                             %
3055 %                                                                             %
3056 %                                                                             %
3057 %   M a g i c k E x t e n t I m a g e                                         %
3058 %                                                                             %
3059 %                                                                             %
3060 %                                                                             %
3061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3062 %
3063 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3064 %  and wand background color.  Set the (x,y) offset of the geometry to move
3065 %  the original wand relative to the extended wand.
3066 %
3067 %  The format of the MagickExtentImage method is:
3068 %
3069 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
3070 %        const unsigned long width,const unsigned long height,const long x,
3071 %        const long y)
3072 %
3073 %  A description of each parameter follows:
3074 %
3075 %    o wand: the magick wand.
3076 %
3077 %    o width: the region width.
3078 %
3079 %    o height: the region height.
3080 %
3081 %    o x: the region x offset.
3082 %
3083 %    o y: the region y offset.
3084 %
3085 */
3086 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3087   const unsigned long width,const unsigned long height,const long x,
3088   const long y)
3089 {
3090   Image
3091     *extent_image;
3092
3093   RectangleInfo
3094     extent;
3095
3096   assert(wand != (MagickWand *) NULL);
3097   assert(wand->signature == WandSignature);
3098   if (wand->debug != MagickFalse)
3099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3100   if (wand->images == (Image *) NULL)
3101     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3102   extent.width=width;
3103   extent.height=height;
3104   extent.x=x;
3105   extent.y=y;
3106   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3107   if (extent_image == (Image *) NULL)
3108     return(MagickFalse);
3109   ReplaceImageInList(&wand->images,extent_image);
3110   return(MagickTrue);
3111 }
3112 \f
3113 /*
3114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3115 %                                                                             %
3116 %                                                                             %
3117 %                                                                             %
3118 %   M a g i c k F l i p I m a g e                                             %
3119 %                                                                             %
3120 %                                                                             %
3121 %                                                                             %
3122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3123 %
3124 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3125 %  around the central x-axis.
3126 %
3127 %  The format of the MagickFlipImage method is:
3128 %
3129 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3130 %
3131 %  A description of each parameter follows:
3132 %
3133 %    o wand: the magick wand.
3134 %
3135 */
3136 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3137 {
3138   Image
3139     *flip_image;
3140
3141   assert(wand != (MagickWand *) NULL);
3142   assert(wand->signature == WandSignature);
3143   if (wand->debug != MagickFalse)
3144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3145   if (wand->images == (Image *) NULL)
3146     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3147   flip_image=FlipImage(wand->images,wand->exception);
3148   if (flip_image == (Image *) NULL)
3149     return(MagickFalse);
3150   ReplaceImageInList(&wand->images,flip_image);
3151   return(MagickTrue);
3152 }
3153 \f
3154 /*
3155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3156 %                                                                             %
3157 %                                                                             %
3158 %                                                                             %
3159 %   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                         %
3160 %                                                                             %
3161 %                                                                             %
3162 %                                                                             %
3163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3164 %
3165 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3166 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3167 %  specified, the color value is changed for any neighbor pixel that does not
3168 %  match the bordercolor member of image.
3169 %
3170 %  The format of the MagickFloodfillPaintImage method is:
3171 %
3172 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3173 %        const ChannelType channel,const PixelWand *fill,const double fuzz,
3174 %        const PixelWand *bordercolor,const long x,const long y,
3175 %        const MagickBooleanType invert)
3176 %
3177 %  A description of each parameter follows:
3178 %
3179 %    o wand: the magick wand.
3180 %
3181 %    o channel: the channel(s).
3182 %
3183 %    o fill: the floodfill color pixel wand.
3184 %
3185 %    o fuzz: By default target must match a particular pixel color
3186 %      exactly.  However, in many cases two colors may differ by a small amount.
3187 %      The fuzz member of image defines how much tolerance is acceptable to
3188 %      consider two colors as the same.  For example, set fuzz to 10 and the
3189 %      color red at intensities of 100 and 102 respectively are now interpreted
3190 %      as the same color for the purposes of the floodfill.
3191 %
3192 %    o bordercolor: the border color pixel wand.
3193 %
3194 %    o x,y: the starting location of the operation.
3195 %
3196 %    o invert: paint any pixel that does not match the target color.
3197 %
3198 */
3199 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3200   const ChannelType channel,const PixelWand *fill,const double fuzz,
3201   const PixelWand *bordercolor,const long x,const long y,
3202   const MagickBooleanType invert)
3203 {
3204   DrawInfo
3205     *draw_info;
3206
3207   MagickBooleanType
3208     status;
3209
3210   MagickPixelPacket
3211     target;
3212
3213   assert(wand != (MagickWand *) NULL);
3214   assert(wand->signature == WandSignature);
3215   if (wand->debug != MagickFalse)
3216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3217   if (wand->images == (Image *) NULL)
3218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3219   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3220   PixelGetQuantumColor(fill,&draw_info->fill);
3221   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3222     y % wand->images->rows,&target,wand->exception);
3223   if (bordercolor != (PixelWand *) NULL)
3224     PixelGetMagickColor(bordercolor,&target);
3225   wand->images->fuzz=fuzz;
3226   status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
3227     invert);
3228   if (status == MagickFalse)
3229     InheritException(wand->exception,&wand->images->exception);
3230   draw_info=DestroyDrawInfo(draw_info);
3231   return(status);
3232 }
3233 \f
3234 /*
3235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3236 %                                                                             %
3237 %                                                                             %
3238 %                                                                             %
3239 %   M a g i c k F l o p I m a g e                                             %
3240 %                                                                             %
3241 %                                                                             %
3242 %                                                                             %
3243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3244 %
3245 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3246 %  around the central y-axis.
3247 %
3248 %  The format of the MagickFlopImage method is:
3249 %
3250 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3251 %
3252 %  A description of each parameter follows:
3253 %
3254 %    o wand: the magick wand.
3255 %
3256 */
3257 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3258 {
3259   Image
3260     *flop_image;
3261
3262   assert(wand != (MagickWand *) NULL);
3263   assert(wand->signature == WandSignature);
3264   if (wand->debug != MagickFalse)
3265     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3266   if (wand->images == (Image *) NULL)
3267     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3268   flop_image=FlopImage(wand->images,wand->exception);
3269   if (flop_image == (Image *) NULL)
3270     return(MagickFalse);
3271   ReplaceImageInList(&wand->images,flop_image);
3272   return(MagickTrue);
3273 }
3274 \f
3275 /*
3276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3277 %                                                                             %
3278 %                                                                             %
3279 %                                                                             %
3280 %   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                     %
3281 %                                                                             %
3282 %                                                                             %
3283 %                                                                             %
3284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3285 %
3286 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3287 %  transform (DFT) of the image either as a magnitude / phase or real /
3288 %  imaginary image pair.
3289 %
3290 %  The format of the MagickForwardFourierTransformImage method is:
3291 %
3292 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3293 %        const MagickBooleanType magnitude)
3294 %
3295 %  A description of each parameter follows:
3296 %
3297 %    o wand: the magick wand.
3298 %
3299 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3300 %      imaginary image pair.
3301 %
3302 */
3303 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3304   MagickWand *wand,const MagickBooleanType magnitude)
3305 {
3306   Image
3307     *forward_image;
3308
3309   assert(wand != (MagickWand *) NULL);
3310   assert(wand->signature == WandSignature);
3311   if (wand->debug != MagickFalse)
3312     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3313   if (wand->images == (Image *) NULL)
3314     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3315   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3316     wand->exception);
3317   if (forward_image == (Image *) NULL)
3318     return(MagickFalse);
3319   ReplaceImageInList(&wand->images,forward_image);
3320   return(MagickTrue);
3321 }
3322 \f
3323 /*
3324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3325 %                                                                             %
3326 %                                                                             %
3327 %                                                                             %
3328 %   M a g i c k F r a m e I m a g e                                           %
3329 %                                                                             %
3330 %                                                                             %
3331 %                                                                             %
3332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3333 %
3334 %  MagickFrameImage() adds a simulated three-dimensional border around the
3335 %  image.  The width and height specify the border width of the vertical and
3336 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3337 %  width of the inner and outer shadows of the frame.
3338 %
3339 %  The format of the MagickFrameImage method is:
3340 %
3341 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3342 %        const PixelWand *matte_color,const unsigned long width,
3343 %        const unsigned long height,const long inner_bevel,
3344 %        const long outer_bevel)
3345 %
3346 %  A description of each parameter follows:
3347 %
3348 %    o wand: the magick wand.
3349 %
3350 %    o matte_color: the frame color pixel wand.
3351 %
3352 %    o width: the border width.
3353 %
3354 %    o height: the border height.
3355 %
3356 %    o inner_bevel: the inner bevel width.
3357 %
3358 %    o outer_bevel: the outer bevel width.
3359 %
3360 */
3361 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3362   const PixelWand *matte_color,const unsigned long width,
3363   const unsigned long height,const long inner_bevel,const long outer_bevel)
3364 {
3365   Image
3366     *frame_image;
3367
3368   FrameInfo
3369     frame_info;
3370
3371   assert(wand != (MagickWand *) NULL);
3372   assert(wand->signature == WandSignature);
3373   if (wand->debug != MagickFalse)
3374     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3375   if (wand->images == (Image *) NULL)
3376     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3377   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3378   frame_info.width=wand->images->columns+2*width;
3379   frame_info.height=wand->images->rows+2*height;
3380   frame_info.x=(long) width;
3381   frame_info.y=(long) height;
3382   frame_info.inner_bevel=inner_bevel;
3383   frame_info.outer_bevel=outer_bevel;
3384   PixelGetQuantumColor(matte_color,&wand->images->matte_color);
3385   frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3386   if (frame_image == (Image *) NULL)
3387     return(MagickFalse);
3388   ReplaceImageInList(&wand->images,frame_image);
3389   return(MagickTrue);
3390 }
3391 \f
3392 /*
3393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3394 %                                                                             %
3395 %                                                                             %
3396 %                                                                             %
3397 %   M a g i c k F u n c t i o n I m a g e                                     %
3398 %                                                                             %
3399 %                                                                             %
3400 %                                                                             %
3401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3402 %
3403 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3404 %  expression to an image.  Use these operators to lighten or darken an image,
3405 %  to increase or decrease contrast in an image, or to produce the "negative"
3406 %  of an image.
3407 %
3408 %  The format of the MagickFunctionImage method is:
3409 %
3410 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3411 %        const MagickFunction function,const unsigned long number_arguments,
3412 %        const double *arguments)
3413 %      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3414 %        const ChannelType channel,const MagickFunction function,
3415 %        const unsigned long number_arguments,const double *arguments)
3416 %
3417 %  A description of each parameter follows:
3418 %
3419 %    o wand: the magick wand.
3420 %
3421 %    o channel: the channel(s).
3422 %
3423 %    o function: the image function.
3424 %
3425 %    o number_arguments: the number of function arguments.
3426 %
3427 %    o arguments: the function arguments.
3428 %
3429 */
3430
3431 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3432   const MagickFunction function,const unsigned long number_arguments,
3433   const double *arguments)
3434 {
3435   MagickBooleanType
3436     status;
3437
3438   assert(wand != (MagickWand *) NULL);
3439   assert(wand->signature == WandSignature);
3440   if (wand->debug != MagickFalse)
3441     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3442   if (wand->images == (Image *) NULL)
3443     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3444   status=FunctionImage(wand->images,function,number_arguments,arguments,
3445     &wand->images->exception);
3446   if (status == MagickFalse)
3447     InheritException(wand->exception,&wand->images->exception);
3448   return(status);
3449 }
3450
3451 WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3452   const ChannelType channel,const MagickFunction function,
3453   const unsigned long number_arguments,const double *arguments)
3454 {
3455   MagickBooleanType
3456     status;
3457
3458   assert(wand != (MagickWand *) NULL);
3459   assert(wand->signature == WandSignature);
3460   if (wand->debug != MagickFalse)
3461     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3462   if (wand->images == (Image *) NULL)
3463     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3464   status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3465     arguments,&wand->images->exception);
3466   return(status);
3467 }
3468 \f
3469 /*
3470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3471 %                                                                             %
3472 %                                                                             %
3473 %                                                                             %
3474 %   M a g i c k F x I m a g e                                                 %
3475 %                                                                             %
3476 %                                                                             %
3477 %                                                                             %
3478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3479 %
3480 %  MagickFxImage() evaluate expression for each pixel in the image.
3481 %
3482 %  The format of the MagickFxImage method is:
3483 %
3484 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3485 %      MagickWand *MagickFxImageChannel(MagickWand *wand,
3486 %        const ChannelType channel,const char *expression)
3487 %
3488 %  A description of each parameter follows:
3489 %
3490 %    o wand: the magick wand.
3491 %
3492 %    o channel: the image channel(s).
3493 %
3494 %    o expression: the expression.
3495 %
3496 */
3497
3498 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3499 {
3500   MagickWand
3501     *fx_wand;
3502
3503   fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3504   return(fx_wand);
3505 }
3506
3507 WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3508   const ChannelType channel,const char *expression)
3509 {
3510   Image
3511     *fx_image;
3512
3513   assert(wand != (MagickWand *) NULL);
3514   assert(wand->signature == WandSignature);
3515   if (wand->debug != MagickFalse)
3516     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3517   if (wand->images == (Image *) NULL)
3518     return((MagickWand *) NULL);
3519   fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3520   if (fx_image == (Image *) NULL)
3521     return((MagickWand *) NULL);
3522   return(CloneMagickWandFromImages(wand,fx_image));
3523 }
3524 \f
3525 /*
3526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3527 %                                                                             %
3528 %                                                                             %
3529 %                                                                             %
3530 %   M a g i c k G a m m a I m a g e                                           %
3531 %                                                                             %
3532 %                                                                             %
3533 %                                                                             %
3534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3535 %
3536 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3537 %  different devices will have perceptual differences in the way the image's
3538 %  intensities are represented on the screen.  Specify individual gamma levels
3539 %  for the red, green, and blue channels, or adjust all three with the gamma
3540 %  parameter.  Values typically range from 0.8 to 2.3.
3541 %
3542 %  You can also reduce the influence of a particular channel with a gamma
3543 %  value of 0.
3544 %
3545 %  The format of the MagickGammaImage method is:
3546 %
3547 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3548 %      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3549 %        const ChannelType channel,const double gamma)
3550 %
3551 %  A description of each parameter follows:
3552 %
3553 %    o wand: the magick wand.
3554 %
3555 %    o channel: the channel.
3556 %
3557 %    o level: Define the level of gamma correction.
3558 %
3559 */
3560
3561 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3562   const double gamma)
3563 {
3564   MagickBooleanType
3565     status;
3566
3567   status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3568   return(status);
3569 }
3570
3571 WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3572   const ChannelType channel,const double gamma)
3573 {
3574   MagickBooleanType
3575     status;
3576
3577   assert(wand != (MagickWand *) NULL);
3578   assert(wand->signature == WandSignature);
3579   if (wand->debug != MagickFalse)
3580     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3581   if (wand->images == (Image *) NULL)
3582     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3583   status=GammaImageChannel(wand->images,channel,gamma);
3584   if (status == MagickFalse)
3585     InheritException(wand->exception,&wand->images->exception);
3586   return(status);
3587 }
3588 \f
3589 /*
3590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3591 %                                                                             %
3592 %                                                                             %
3593 %                                                                             %
3594 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3595 %                                                                             %
3596 %                                                                             %
3597 %                                                                             %
3598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3599 %
3600 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3601 %  Gaussian operator of the given radius and standard deviation (sigma).
3602 %  For reasonable results, the radius should be larger than sigma.  Use a
3603 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3604 %
3605 %  The format of the MagickGaussianBlurImage method is:
3606 %
3607 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3608 %        const double radius,const double sigma)
3609 %      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3610 %        const ChannelType channel,const double radius,const double sigma)
3611 %
3612 %  A description of each parameter follows:
3613 %
3614 %    o wand: the magick wand.
3615 %
3616 %    o channel: the image channel(s).
3617 %
3618 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3619 %      pixel.
3620 %
3621 %    o sigma: the standard deviation of the Gaussian, in pixels.
3622 %
3623 */
3624
3625 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3626   const double radius,const double sigma)
3627 {
3628   MagickBooleanType
3629     status;
3630
3631   status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3632   return(status);
3633 }
3634
3635 WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3636   const ChannelType channel,const double radius,const double sigma)
3637 {
3638   Image
3639     *blur_image;
3640
3641   assert(wand != (MagickWand *) NULL);
3642   assert(wand->signature == WandSignature);
3643   if (wand->debug != MagickFalse)
3644     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3645   if (wand->images == (Image *) NULL)
3646     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3647   blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
3648     wand->exception);
3649   if (blur_image == (Image *) NULL)
3650     return(MagickFalse);
3651   ReplaceImageInList(&wand->images,blur_image);
3652   return(MagickTrue);
3653 }
3654 \f
3655 /*
3656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3657 %                                                                             %
3658 %                                                                             %
3659 %                                                                             %
3660 %   M a g i c k G e t I m a g e                                               %
3661 %                                                                             %
3662 %                                                                             %
3663 %                                                                             %
3664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3665 %
3666 %  MagickGetImage() gets the image at the current image index.
3667 %
3668 %  The format of the MagickGetImage method is:
3669 %
3670 %      MagickWand *MagickGetImage(MagickWand *wand)
3671 %
3672 %  A description of each parameter follows:
3673 %
3674 %    o wand: the magick wand.
3675 %
3676 */
3677 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3678 {
3679   Image
3680     *image;
3681
3682   assert(wand != (MagickWand *) NULL);
3683   assert(wand->signature == WandSignature);
3684   if (wand->debug != MagickFalse)
3685     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3686   if (wand->images == (Image *) NULL)
3687     {
3688       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3689         "ContainsNoImages","`%s'",wand->name);
3690       return((MagickWand *) NULL);
3691     }
3692   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3693   if (image == (Image *) NULL)
3694     return((MagickWand *) NULL);
3695   return(CloneMagickWandFromImages(wand,image));
3696 }
3697 \f
3698 /*
3699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3700 %                                                                             %
3701 %                                                                             %
3702 %                                                                             %
3703 %   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                       %
3704 %                                                                             %
3705 %                                                                             %
3706 %                                                                             %
3707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3708 %
3709 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3710 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3711 %  than CMYKA.
3712 %
3713 %  The format of the MagickGetImageAlphaChannel method is:
3714 %
3715 %      unsigned long MagickGetImageAlphaChannel(MagickWand *wand)
3716 %
3717 %  A description of each parameter follows:
3718 %
3719 %    o wand: the magick wand.
3720 %
3721 */
3722 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3723 {
3724   assert(wand != (MagickWand *) NULL);
3725   assert(wand->signature == WandSignature);
3726   if (wand->debug != MagickFalse)
3727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3728   if (wand->images == (Image *) NULL)
3729     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3730   return(GetImageAlphaChannel(wand->images));
3731 }
3732 \f
3733 /*
3734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3735 %                                                                             %
3736 %                                                                             %
3737 %                                                                             %
3738 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3739 %                                                                             %
3740 %                                                                             %
3741 %                                                                             %
3742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3743 %
3744 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3745 %
3746 %  The format of the MagickGetImageClipMask method is:
3747 %
3748 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3749 %
3750 %  A description of each parameter follows:
3751 %
3752 %    o wand: the magick wand.
3753 %
3754 */
3755 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3756 {
3757   Image
3758     *image;
3759
3760   assert(wand != (MagickWand *) NULL);
3761   assert(wand->signature == WandSignature);
3762   if (wand->debug != MagickFalse)
3763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3764   if (wand->images == (Image *) NULL)
3765     {
3766       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3767         "ContainsNoImages","`%s'",wand->name);
3768       return((MagickWand *) NULL);
3769     }
3770   image=GetImageClipMask(wand->images,wand->exception);
3771   if (image == (Image *) NULL)
3772     return((MagickWand *) NULL);
3773   return(CloneMagickWandFromImages(wand,image));
3774 }
3775 \f
3776 /*
3777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3778 %                                                                             %
3779 %                                                                             %
3780 %                                                                             %
3781 %   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                 %
3782 %                                                                             %
3783 %                                                                             %
3784 %                                                                             %
3785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3786 %
3787 %  MagickGetImageBackgroundColor() returns the image background color.
3788 %
3789 %  The format of the MagickGetImageBackgroundColor method is:
3790 %
3791 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3792 %        PixelWand *background_color)
3793 %
3794 %  A description of each parameter follows:
3795 %
3796 %    o wand: the magick wand.
3797 %
3798 %    o background_color: Return the background color.
3799 %
3800 */
3801 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3802   PixelWand *background_color)
3803 {
3804   assert(wand != (MagickWand *) NULL);
3805   assert(wand->signature == WandSignature);
3806   if (wand->debug != MagickFalse)
3807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3808   if (wand->images == (Image *) NULL)
3809     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3810   PixelSetQuantumColor(background_color,&wand->images->background_color);
3811   return(MagickTrue);
3812 }
3813 \f
3814 /*
3815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3816 %                                                                             %
3817 %                                                                             %
3818 %                                                                             %
3819 %   M a g i c k G e t I m a g e B l o b                                       %
3820 %                                                                             %
3821 %                                                                             %
3822 %                                                                             %
3823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3824 %
3825 %  MagickGetImageBlob() implements direct to memory image formats.  It
3826 %  returns the image as a blob and its length.   Use MagickSetFormat() to
3827 %  set the format of the returned blob (GIF, JPEG,  PNG, etc.).
3828 %
3829 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3830 %
3831 %  The format of the MagickGetImageBlob method is:
3832 %
3833 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3834 %
3835 %  A description of each parameter follows:
3836 %
3837 %    o wand: the magick wand.
3838 %
3839 %    o length: the length of the blob.
3840 %
3841 */
3842 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3843 {
3844   assert(wand != (MagickWand *) NULL);
3845   assert(wand->signature == WandSignature);
3846   if (wand->debug != MagickFalse)
3847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3848   if (wand->images == (Image *) NULL)
3849     {
3850       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3851         "ContainsNoImages","`%s'",wand->name);
3852       return((unsigned char *) NULL);
3853     }
3854   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3855 }
3856 \f
3857 /*
3858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3859 %                                                                             %
3860 %                                                                             %
3861 %                                                                             %
3862 %   M a g i c k G e t I m a g e s B l o b                                     %
3863 %                                                                             %
3864 %                                                                             %
3865 %                                                                             %
3866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3867 %
3868 %  MagickGetImageBlob() implements direct to memory image formats.  It
3869 %  returns the image sequence as a blob and its length.  The format of the image
3870 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3871 %  return a different image format, use MagickSetImageFormat().
3872 %
3873 %  Note, some image formats do not permit multiple images to the same image
3874 %  stream (e.g. JPEG).  in this instance, just the first image of the
3875 %  sequence is returned as a blob.
3876 %
3877 %  The format of the MagickGetImagesBlob method is:
3878 %
3879 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3880 %
3881 %  A description of each parameter follows:
3882 %
3883 %    o wand: the magick wand.
3884 %
3885 %    o length: the length of the blob.
3886 %
3887 */
3888 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3889 {
3890   unsigned char
3891     *blob;
3892
3893   assert(wand != (MagickWand *) NULL);
3894   assert(wand->signature == WandSignature);
3895   if (wand->debug != MagickFalse)
3896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3897   if (wand->images == (Image *) NULL)
3898     {
3899       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3900         "ContainsNoImages","`%s'",wand->name);
3901       return((unsigned char *) NULL);
3902     }
3903   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3904     wand->exception);
3905   return(blob);
3906 }
3907 \f
3908 /*
3909 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3910 %                                                                             %
3911 %                                                                             %
3912 %                                                                             %
3913 %   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                         %
3914 %                                                                             %
3915 %                                                                             %
3916 %                                                                             %
3917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3918 %
3919 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3920 %  image.
3921 %
3922 %  The format of the MagickGetImageBluePrimary method is:
3923 %
3924 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3925 %        double *y)
3926 %
3927 %  A description of each parameter follows:
3928 %
3929 %    o wand: the magick wand.
3930 %
3931 %    o x: the chromaticity blue primary x-point.
3932 %
3933 %    o y: the chromaticity blue primary y-point.
3934 %
3935 */
3936 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3937   double *x,double *y)
3938 {
3939   assert(wand != (MagickWand *) NULL);
3940   assert(wand->signature == WandSignature);
3941   if (wand->debug != MagickFalse)
3942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3943   if (wand->images == (Image *) NULL)
3944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3945   *x=wand->images->chromaticity.blue_primary.x;
3946   *y=wand->images->chromaticity.blue_primary.y;
3947   return(MagickTrue);
3948 }
3949 \f
3950 /*
3951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3952 %                                                                             %
3953 %                                                                             %
3954 %                                                                             %
3955 %   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                         %
3956 %                                                                             %
3957 %                                                                             %
3958 %                                                                             %
3959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3960 %
3961 %  MagickGetImageBorderColor() returns the image border color.
3962 %
3963 %  The format of the MagickGetImageBorderColor method is:
3964 %
3965 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3966 %        PixelWand *border_color)
3967 %
3968 %  A description of each parameter follows:
3969 %
3970 %    o wand: the magick wand.
3971 %
3972 %    o border_color: Return the border color.
3973 %
3974 */
3975 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3976   PixelWand *border_color)
3977 {
3978   assert(wand != (MagickWand *) NULL);
3979   assert(wand->signature == WandSignature);
3980   if (wand->debug != MagickFalse)
3981     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3982   if (wand->images == (Image *) NULL)
3983     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3984   PixelSetQuantumColor(border_color,&wand->images->border_color);
3985   return(MagickTrue);
3986 }
3987 \f
3988 /*
3989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3990 %                                                                             %
3991 %                                                                             %
3992 %                                                                             %
3993 %   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                       %
3994 %                                                                             %
3995 %                                                                             %
3996 %                                                                             %
3997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3998 %
3999 %  MagickGetImageChannelDepth() gets the depth for one or more image channels.
4000 %
4001 %  The format of the MagickGetImageChannelDepth method is:
4002 %
4003 %      unsigned long MagickGetImageChannelDepth(MagickWand *wand,
4004 %        const ChannelType channel)
4005 %
4006 %  A description of each parameter follows:
4007 %
4008 %    o wand: the magick wand.
4009 %
4010 %    o channel: the image channel(s).
4011 %
4012 */
4013 WandExport unsigned long MagickGetImageChannelDepth(MagickWand *wand,
4014   const ChannelType channel)
4015 {
4016   assert(wand != (MagickWand *) NULL);
4017   assert(wand->signature == WandSignature);
4018   if (wand->debug != MagickFalse)
4019     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4020   if (wand->images == (Image *) NULL)
4021     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4022   return(GetImageChannelDepth(wand->images,channel,wand->exception));
4023 }
4024 \f
4025 /*
4026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4027 %                                                                             %
4028 %                                                                             %
4029 %                                                                             %
4030 %   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             %
4031 %                                                                             %
4032 %                                                                             %
4033 %                                                                             %
4034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4035 %
4036 %  MagickGetImageChannelDistortion() compares one or more image channels of an
4037 %  image to a reconstructed image and returns the specified distortion metric.
4038 %
4039 %  The format of the MagickGetImageChannelDistortion method is:
4040 %
4041 %      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4042 %        const MagickWand *reference,const ChannelType channel,
4043 %        const MetricType metric,double *distortion)
4044 %
4045 %  A description of each parameter follows:
4046 %
4047 %    o wand: the magick wand.
4048 %
4049 %    o reference: the reference wand.
4050 %
4051 %    o channel: the channel.
4052 %
4053 %    o metric: the metric.
4054 %
4055 %    o distortion: the computed distortion between the images.
4056 %
4057 */
4058 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4059   const MagickWand *reference,const ChannelType channel,const MetricType metric,
4060   double *distortion)
4061 {
4062   MagickBooleanType
4063     status;
4064
4065   assert(wand != (MagickWand *) NULL);
4066   assert(wand->signature == WandSignature);
4067   if (wand->debug != MagickFalse)
4068     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4069   assert(reference != (MagickWand *) NULL);
4070   assert(reference->signature == WandSignature);
4071   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4073   status=GetImageChannelDistortion(wand->images,reference->images,channel,
4074     metric,distortion,&wand->images->exception);
4075   return(status);
4076 }
4077 \f
4078 /*
4079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4080 %                                                                             %
4081 %                                                                             %
4082 %                                                                             %
4083 %   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           %
4084 %                                                                             %
4085 %                                                                             %
4086 %                                                                             %
4087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4088 %
4089 %  MagickGetImageChannelDistortions() compares one or more image channels of an
4090 %  image to a reconstructed image and returns the specified distortion metrics.
4091 %
4092 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4093 %
4094 %  The format of the MagickGetImageChannelDistortion method is:
4095 %
4096 %      double *MagickGetImageChannelDistortion(MagickWand *wand,
4097 %        const MagickWand *reference,const MetricType metric)
4098 %
4099 %  A description of each parameter follows:
4100 %
4101 %    o wand: the magick wand.
4102 %
4103 %    o reference: the reference wand.
4104 %
4105 %    o metric: the metric.
4106 %
4107 */
4108 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4109   const MagickWand *reference,const MetricType metric)
4110 {
4111   double
4112     *channel_distortion;
4113
4114   assert(wand != (MagickWand *) NULL);
4115   assert(wand->signature == WandSignature);
4116   if (wand->debug != MagickFalse)
4117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4118   assert(reference != (MagickWand *) NULL);
4119   assert(reference->signature == WandSignature);
4120   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4121     {
4122       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4123         "ContainsNoImages","`%s'",wand->name);
4124       return((double *) NULL);
4125     }
4126   channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4127     metric,&wand->images->exception);
4128   return(channel_distortion);
4129 }
4130 \f
4131 /*
4132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4133 %                                                                             %
4134 %                                                                             %
4135 %                                                                             %
4136 %   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                         %
4137 %                                                                             %
4138 %                                                                             %
4139 %                                                                             %
4140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4141 %
4142 %  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4143 %  more image channels.
4144 %
4145 %  The format of the MagickGetImageChannelMean method is:
4146 %
4147 %      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4148 %        const ChannelType channel,double *mean,double *standard_deviation)
4149 %
4150 %  A description of each parameter follows:
4151 %
4152 %    o wand: the magick wand.
4153 %
4154 %    o channel: the image channel(s).
4155 %
4156 %    o mean:  The mean pixel value for the specified channel(s).
4157 %
4158 %    o standard_deviation:  The standard deviation for the specified channel(s).
4159 %
4160 */
4161 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4162   const ChannelType channel,double *mean,double *standard_deviation)
4163 {
4164   MagickBooleanType
4165     status;
4166
4167   assert(wand != (MagickWand *) NULL);
4168   assert(wand->signature == WandSignature);
4169   if (wand->debug != MagickFalse)
4170     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4171   if (wand->images == (Image *) NULL)
4172     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4173   status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4174     wand->exception);
4175   return(status);
4176 }
4177 \f
4178 /*
4179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4180 %                                                                             %
4181 %                                                                             %
4182 %                                                                             %
4183 %   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                 %
4184 %                                                                             %
4185 %                                                                             %
4186 %                                                                             %
4187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4188 %
4189 %  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4190 %  more image channels.
4191 %
4192 %  The format of the MagickGetImageChannelKurtosis method is:
4193 %
4194 %      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4195 %        const ChannelType channel,double *kurtosis,double *skewness)
4196 %
4197 %  A description of each parameter follows:
4198 %
4199 %    o wand: the magick wand.
4200 %
4201 %    o channel: the image channel(s).
4202 %
4203 %    o kurtosis:  The kurtosis for the specified channel(s).
4204 %
4205 %    o skewness:  The skewness for the specified channel(s).
4206 %
4207 */
4208 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4209   const ChannelType channel,double *kurtosis,double *skewness)
4210 {
4211   MagickBooleanType
4212     status;
4213
4214   assert(wand != (MagickWand *) NULL);
4215   assert(wand->signature == WandSignature);
4216   if (wand->debug != MagickFalse)
4217     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4218   if (wand->images == (Image *) NULL)
4219     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4220   status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4221     wand->exception);
4222   return(status);
4223 }
4224
4225 /*
4226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4227 %                                                                             %
4228 %                                                                             %
4229 %                                                                             %
4230 %   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                       %
4231 %                                                                             %
4232 %                                                                             %
4233 %                                                                             %
4234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4235 %
4236 %  MagickGetImageChannelRange() gets the range for one or more image channels.
4237 %
4238 %  The format of the MagickGetImageChannelRange method is:
4239 %
4240 %      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4241 %        const ChannelType channel,double *minima,double *maxima)
4242 %
4243 %  A description of each parameter follows:
4244 %
4245 %    o wand: the magick wand.
4246 %
4247 %    o channel: the image channel(s).
4248 %
4249 %    o minima:  The minimum pixel value for the specified channel(s).
4250 %
4251 %    o maxima:  The maximum pixel value for the specified channel(s).
4252 %
4253 */
4254 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4255   const ChannelType channel,double *minima,double *maxima)
4256 {
4257   MagickBooleanType
4258     status;
4259
4260   assert(wand != (MagickWand *) NULL);
4261   assert(wand->signature == WandSignature);
4262   if (wand->debug != MagickFalse)
4263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4264   if (wand->images == (Image *) NULL)
4265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4266   status=GetImageChannelRange(wand->images,channel,minima,maxima,
4267     wand->exception);
4268   return(status);
4269 }
4270 \f
4271 /*
4272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4273 %                                                                             %
4274 %                                                                             %
4275 %                                                                             %
4276 %   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             %
4277 %                                                                             %
4278 %                                                                             %
4279 %                                                                             %
4280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4281 %
4282 %  MagickGetImageChannelStatistics() returns statistics for each channel in the
4283 %  image.  The statistics include the channel depth, its minima and
4284 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4285 %  You can access the red channel mean, for example, like this:
4286 %
4287 %      channel_statistics=MagickGetImageChannelStatistics(image,excepton);
4288 %      red_mean=channel_statistics[RedChannel].mean;
4289 %
4290 %  Use MagickRelinquishMemory() to free the statistics buffer.
4291 %
4292 %  The format of the MagickGetImageChannelStatistics method is:
4293 %
4294 %      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4295 %
4296 %  A description of each parameter follows:
4297 %
4298 %    o wand: the magick wand.
4299 %
4300 */
4301 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4302 {
4303   assert(wand != (MagickWand *) NULL);
4304   assert(wand->signature == WandSignature);
4305   if (wand->debug != MagickFalse)
4306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4307   if (wand->images == (Image *) NULL)
4308     {
4309       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4310         "ContainsNoImages","`%s'",wand->name);
4311       return((ChannelStatistics *) NULL);
4312     }
4313   return(GetImageChannelStatistics(wand->images,wand->exception));
4314 }
4315 \f
4316 /*
4317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4318 %                                                                             %
4319 %                                                                             %
4320 %                                                                             %
4321 %   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                     %
4322 %                                                                             %
4323 %                                                                             %
4324 %                                                                             %
4325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4326 %
4327 %  MagickGetImageColormapColor() returns the color of the specified colormap
4328 %  index.
4329 %
4330 %  The format of the MagickGetImageColormapColor method is:
4331 %
4332 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4333 %        const unsigned long index,PixelWand *color)
4334 %
4335 %  A description of each parameter follows:
4336 %
4337 %    o wand: the magick wand.
4338 %
4339 %    o index: the offset into the image colormap.
4340 %
4341 %    o color: Return the colormap color in this wand.
4342 %
4343 */
4344 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4345   const unsigned long index,PixelWand *color)
4346 {
4347   assert(wand != (MagickWand *) NULL);
4348   assert(wand->signature == WandSignature);
4349   if (wand->debug != MagickFalse)
4350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4351   if (wand->images == (Image *) NULL)
4352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4353   if ((wand->images->colormap == (PixelPacket *) NULL) ||
4354       (index >= wand->images->colors))
4355     {
4356       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4357         "InvalidColormapIndex","`%s'",wand->name);
4358       return(MagickFalse);
4359     }
4360   PixelSetQuantumColor(color,wand->images->colormap+index);
4361   return(MagickTrue);
4362 }
4363 \f
4364 /*
4365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4366 %                                                                             %
4367 %                                                                             %
4368 %                                                                             %
4369 %   M a g i c k G e t I m a g e C o l o r s                                   %
4370 %                                                                             %
4371 %                                                                             %
4372 %                                                                             %
4373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4374 %
4375 %  MagickGetImageColors() gets the number of unique colors in the image.
4376 %
4377 %  The format of the MagickGetImageColors method is:
4378 %
4379 %      unsigned long MagickGetImageColors(MagickWand *wand)
4380 %
4381 %  A description of each parameter follows:
4382 %
4383 %    o wand: the magick wand.
4384 %
4385 */
4386 WandExport unsigned long MagickGetImageColors(MagickWand *wand)
4387 {
4388   assert(wand != (MagickWand *) NULL);
4389   assert(wand->signature == WandSignature);
4390   if (wand->debug != MagickFalse)
4391     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4392   if (wand->images == (Image *) NULL)
4393     {
4394       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4395         "ContainsNoImages","`%s'",wand->name);
4396       return(0);
4397     }
4398   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4399 }
4400 \f
4401 /*
4402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4403 %                                                                             %
4404 %                                                                             %
4405 %                                                                             %
4406 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4407 %                                                                             %
4408 %                                                                             %
4409 %                                                                             %
4410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4411 %
4412 %  MagickGetImageColorspace() gets the image colorspace.
4413 %
4414 %  The format of the MagickGetImageColorspace method is:
4415 %
4416 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4417 %
4418 %  A description of each parameter follows:
4419 %
4420 %    o wand: the magick wand.
4421 %
4422 */
4423 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4424 {
4425   assert(wand != (MagickWand *) NULL);
4426   assert(wand->signature == WandSignature);
4427   if (wand->debug != MagickFalse)
4428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4429   if (wand->images == (Image *) NULL)
4430     {
4431       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4432         "ContainsNoImages","`%s'",wand->name);
4433       return(UndefinedColorspace);
4434     }
4435   return(wand->images->colorspace);
4436 }
4437 \f
4438 /*
4439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4440 %                                                                             %
4441 %                                                                             %
4442 %                                                                             %
4443 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4444 %                                                                             %
4445 %                                                                             %
4446 %                                                                             %
4447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4448 %
4449 %  MagickGetImageCompose() returns the composite operator associated with the
4450 %  image.
4451 %
4452 %  The format of the MagickGetImageCompose method is:
4453 %
4454 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4455 %
4456 %  A description of each parameter follows:
4457 %
4458 %    o wand: the magick wand.
4459 %
4460 */
4461 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4462 {
4463   assert(wand != (MagickWand *) NULL);
4464   assert(wand->signature == WandSignature);
4465   if (wand->debug != MagickFalse)
4466     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4467   if (wand->images == (Image *) NULL)
4468     {
4469       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4470         "ContainsNoImages","`%s'",wand->name);
4471       return(UndefinedCompositeOp);
4472     }
4473   return(wand->images->compose);
4474 }
4475 \f
4476 /*
4477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4478 %                                                                             %
4479 %                                                                             %
4480 %                                                                             %
4481 %   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                         %
4482 %                                                                             %
4483 %                                                                             %
4484 %                                                                             %
4485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4486 %
4487 %  MagickGetImageCompression() gets the image compression.
4488 %
4489 %  The format of the MagickGetImageCompression method is:
4490 %
4491 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4492 %
4493 %  A description of each parameter follows:
4494 %
4495 %    o wand: the magick wand.
4496 %
4497 */
4498 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4499 {
4500   assert(wand != (MagickWand *) NULL);
4501   assert(wand->signature == WandSignature);
4502   if (wand->debug != MagickFalse)
4503     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4504   if (wand->images == (Image *) NULL)
4505     {
4506       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4507         "ContainsNoImages","`%s'",wand->name);
4508       return(UndefinedCompression);
4509     }
4510   return(wand->images->compression);
4511 }
4512 \f
4513 /*
4514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4515 %                                                                             %
4516 %                                                                             %
4517 %                                                                             %
4518 %   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           %
4519 %                                                                             %
4520 %                                                                             %
4521 %                                                                             %
4522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4523 %
4524 %  MagickGetImageCompression() gets the image compression quality.
4525 %
4526 %  The format of the MagickGetImageCompression method is:
4527 %
4528 %      unsigned long MagickGetImageCompression(MagickWand *wand)
4529 %
4530 %  A description of each parameter follows:
4531 %
4532 %    o wand: the magick wand.
4533 %
4534 */
4535 WandExport unsigned long MagickGetImageCompressionQuality(MagickWand *wand)
4536 {
4537   assert(wand != (MagickWand *) NULL);
4538   assert(wand->signature == WandSignature);
4539   if (wand->debug != MagickFalse)
4540     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4541   if (wand->images == (Image *) NULL)
4542     {
4543       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4544         "ContainsNoImages","`%s'",wand->name);
4545       return(0UL);
4546     }
4547   return(wand->images->quality);
4548 }
4549 \f
4550 /*
4551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4552 %                                                                             %
4553 %                                                                             %
4554 %                                                                             %
4555 %   M a g i c k G e t I m a g e D e l a y                                     %
4556 %                                                                             %
4557 %                                                                             %
4558 %                                                                             %
4559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4560 %
4561 %  MagickGetImageDelay() gets the image delay.
4562 %
4563 %  The format of the MagickGetImageDelay method is:
4564 %
4565 %      unsigned long MagickGetImageDelay(MagickWand *wand)
4566 %
4567 %  A description of each parameter follows:
4568 %
4569 %    o wand: the magick wand.
4570 %
4571 */
4572 WandExport unsigned long MagickGetImageDelay(MagickWand *wand)
4573 {
4574   assert(wand != (MagickWand *) NULL);
4575   assert(wand->signature == WandSignature);
4576   if (wand->debug != MagickFalse)
4577     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4578   if (wand->images == (Image *) NULL)
4579     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4580   return(wand->images->delay);
4581 }
4582 \f
4583 /*
4584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4585 %                                                                             %
4586 %                                                                             %
4587 %                                                                             %
4588 %   M a g i c k G e t I m a g e D e p t h                                     %
4589 %                                                                             %
4590 %                                                                             %
4591 %                                                                             %
4592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4593 %
4594 %  MagickGetImageDepth() gets the image depth.
4595 %
4596 %  The format of the MagickGetImageDepth method is:
4597 %
4598 %      unsigned long MagickGetImageDepth(MagickWand *wand)
4599 %
4600 %  A description of each parameter follows:
4601 %
4602 %    o wand: the magick wand.
4603 %
4604 */
4605 WandExport unsigned long MagickGetImageDepth(MagickWand *wand)
4606 {
4607   assert(wand != (MagickWand *) NULL);
4608   assert(wand->signature == WandSignature);
4609   if (wand->debug != MagickFalse)
4610     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4611   if (wand->images == (Image *) NULL)
4612     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4613   return(wand->images->depth);
4614 }
4615 \f
4616 /*
4617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4618 %                                                                             %
4619 %                                                                             %
4620 %                                                                             %
4621 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4622 %                                                                             %
4623 %                                                                             %
4624 %                                                                             %
4625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4626 %
4627 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4628 %  returns the specified distortion metric.
4629 %
4630 %  The format of the MagickGetImageDistortion method is:
4631 %
4632 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4633 %        const MagickWand *reference,const MetricType metric,
4634 %        double *distortion)
4635 %
4636 %  A description of each parameter follows:
4637 %
4638 %    o wand: the magick wand.
4639 %
4640 %    o reference: the reference wand.
4641 %
4642 %    o metric: the metric.
4643 %
4644 %    o distortion: the computed distortion between the images.
4645 %
4646 */
4647 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4648   const MagickWand *reference,const MetricType metric,double *distortion)
4649 {
4650   MagickBooleanType
4651     status;
4652
4653
4654   assert(wand != (MagickWand *) NULL);
4655   assert(wand->signature == WandSignature);
4656   if (wand->debug != MagickFalse)
4657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4658   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4659     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4660   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4661     &wand->images->exception);
4662   return(status);
4663 }
4664 \f
4665 /*
4666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4667 %                                                                             %
4668 %                                                                             %
4669 %                                                                             %
4670 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4671 %                                                                             %
4672 %                                                                             %
4673 %                                                                             %
4674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4675 %
4676 %  MagickGetImageDispose() gets the image disposal method.
4677 %
4678 %  The format of the MagickGetImageDispose method is:
4679 %
4680 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4681 %
4682 %  A description of each parameter follows:
4683 %
4684 %    o wand: the magick wand.
4685 %
4686 */
4687 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4688 {
4689   assert(wand != (MagickWand *) NULL);
4690   assert(wand->signature == WandSignature);
4691   if (wand->debug != MagickFalse)
4692     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4693   if (wand->images == (Image *) NULL)
4694     {
4695       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4696         "ContainsNoImages","`%s'",wand->name);
4697       return(UndefinedDispose);
4698     }
4699   return((DisposeType) wand->images->dispose);
4700 }
4701 \f
4702 /*
4703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4704 %                                                                             %
4705 %                                                                             %
4706 %                                                                             %
4707 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4708 %                                                                             %
4709 %                                                                             %
4710 %                                                                             %
4711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4712 %
4713 %  MagickGetImageFilename() returns the filename of a particular image in a
4714 %  sequence.
4715 %
4716 %  The format of the MagickGetImageFilename method is:
4717 %
4718 %      char *MagickGetImageFilename(MagickWand *wand)
4719 %
4720 %  A description of each parameter follows:
4721 %
4722 %    o wand: the magick wand.
4723 %
4724 */
4725 WandExport char *MagickGetImageFilename(MagickWand *wand)
4726 {
4727   assert(wand != (MagickWand *) NULL);
4728   assert(wand->signature == WandSignature);
4729   if (wand->debug != MagickFalse)
4730     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4731   if (wand->images == (Image *) NULL)
4732     {
4733       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4734         "ContainsNoImages","`%s'",wand->name);
4735       return((char *) NULL);
4736     }
4737   return(AcquireString(wand->images->filename));
4738 }
4739 \f
4740 /*
4741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4742 %                                                                             %
4743 %                                                                             %
4744 %                                                                             %
4745 %   M a g i c k G e t I m a g e F o r m a t                                   %
4746 %                                                                             %
4747 %                                                                             %
4748 %                                                                             %
4749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4750 %
4751 %  MagickGetImageFormat() returns the format of a particular image in a
4752 %  sequence.
4753 %
4754 %  The format of the MagickGetImageFormat method is:
4755 %
4756 %      const char MagickGetImageFormat(MagickWand *wand)
4757 %
4758 %  A description of each parameter follows:
4759 %
4760 %    o wand: the magick wand.
4761 %
4762 */
4763 WandExport char *MagickGetImageFormat(MagickWand *wand)
4764 {
4765   assert(wand != (MagickWand *) NULL);
4766   assert(wand->signature == WandSignature);
4767   if (wand->debug != MagickFalse)
4768     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4769   if (wand->images == (Image *) NULL)
4770     {
4771       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4772         "ContainsNoImages","`%s'",wand->name);
4773       return((char *) NULL);
4774     }
4775   return(AcquireString(wand->images->magick));
4776 }
4777 \f
4778 /*
4779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4780 %                                                                             %
4781 %                                                                             %
4782 %                                                                             %
4783 %   M a g i c k G e t I m a g e F u z z                                       %
4784 %                                                                             %
4785 %                                                                             %
4786 %                                                                             %
4787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4788 %
4789 %  MagickGetImageFuzz() gets the image fuzz.
4790 %
4791 %  The format of the MagickGetImageFuzz method is:
4792 %
4793 %      double MagickGetImageFuzz(MagickWand *wand)
4794 %
4795 %  A description of each parameter follows:
4796 %
4797 %    o wand: the magick wand.
4798 %
4799 */
4800 WandExport double MagickGetImageFuzz(MagickWand *wand)
4801 {
4802   assert(wand != (MagickWand *) NULL);
4803   assert(wand->signature == WandSignature);
4804   if (wand->debug != MagickFalse)
4805     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4806   if (wand->images == (Image *) NULL)
4807     {
4808       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4809         "ContainsNoImages","`%s'",wand->name);
4810       return(0.0);
4811     }
4812   return(wand->images->fuzz);
4813 }
4814 \f
4815 /*
4816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4817 %                                                                             %
4818 %                                                                             %
4819 %                                                                             %
4820 %   M a g i c k G e t I m a g e G a m m a                                     %
4821 %                                                                             %
4822 %                                                                             %
4823 %                                                                             %
4824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4825 %
4826 %  MagickGetImageGamma() gets the image gamma.
4827 %
4828 %  The format of the MagickGetImageGamma method is:
4829 %
4830 %      double MagickGetImageGamma(MagickWand *wand)
4831 %
4832 %  A description of each parameter follows:
4833 %
4834 %    o wand: the magick wand.
4835 %
4836 */
4837 WandExport double MagickGetImageGamma(MagickWand *wand)
4838 {
4839   assert(wand != (MagickWand *) NULL);
4840   assert(wand->signature == WandSignature);
4841   if (wand->debug != MagickFalse)
4842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4843   if (wand->images == (Image *) NULL)
4844     {
4845       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4846         "ContainsNoImages","`%s'",wand->name);
4847       return(0.0);
4848     }
4849   return(wand->images->gamma);
4850 }
4851 \f
4852 /*
4853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4854 %                                                                             %
4855 %                                                                             %
4856 %                                                                             %
4857 %   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                 %
4858 %                                                                             %
4859 %                                                                             %
4860 %                                                                             %
4861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4862 %
4863 %  MagickGetImageGravity() gets the image gravity.
4864 %
4865 %  The format of the MagickGetImageGravity method is:
4866 %
4867 %      GravityType MagickGetImageGravity(MagickWand *wand)
4868 %
4869 %  A description of each parameter follows:
4870 %
4871 %    o wand: the magick wand.
4872 %
4873 */
4874 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4875 {
4876   assert(wand != (MagickWand *) NULL);
4877   assert(wand->signature == WandSignature);
4878   if (wand->debug != MagickFalse)
4879     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4880   if (wand->images == (Image *) NULL)
4881     {
4882       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4883         "ContainsNoImages","`%s'",wand->name);
4884       return(UndefinedGravity);
4885     }
4886   return(wand->images->gravity);
4887 }
4888 \f
4889 /*
4890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4891 %                                                                             %
4892 %                                                                             %
4893 %                                                                             %
4894 %   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                       %
4895 %                                                                             %
4896 %                                                                             %
4897 %                                                                             %
4898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4899 %
4900 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4901 %
4902 %  The format of the MagickGetImageGreenPrimary method is:
4903 %
4904 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4905 %        double *y)
4906 %
4907 %  A description of each parameter follows:
4908 %
4909 %    o wand: the magick wand.
4910 %
4911 %    o x: the chromaticity green primary x-point.
4912 %
4913 %    o y: the chromaticity green primary y-point.
4914 %
4915 */
4916 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4917   double *x,double *y)
4918 {
4919   assert(wand != (MagickWand *) NULL);
4920   assert(wand->signature == WandSignature);
4921   if (wand->debug != MagickFalse)
4922     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4923   if (wand->images == (Image *) NULL)
4924     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4925   *x=wand->images->chromaticity.green_primary.x;
4926   *y=wand->images->chromaticity.green_primary.y;
4927   return(MagickTrue);
4928 }
4929 \f
4930 /*
4931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4932 %                                                                             %
4933 %                                                                             %
4934 %                                                                             %
4935 %   M a g i c k G e t I m a g e H e i g h t                                   %
4936 %                                                                             %
4937 %                                                                             %
4938 %                                                                             %
4939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4940 %
4941 %  MagickGetImageHeight() returns the image height.
4942 %
4943 %  The format of the MagickGetImageHeight method is:
4944 %
4945 %      unsigned long MagickGetImageHeight(MagickWand *wand)
4946 %
4947 %  A description of each parameter follows:
4948 %
4949 %    o wand: the magick wand.
4950 %
4951 */
4952 WandExport unsigned long MagickGetImageHeight(MagickWand *wand)
4953 {
4954   assert(wand != (MagickWand *) NULL);
4955   assert(wand->signature == WandSignature);
4956   if (wand->debug != MagickFalse)
4957     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4958   if (wand->images == (Image *) NULL)
4959     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4960   return(wand->images->rows);
4961 }
4962 \f
4963 /*
4964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4965 %                                                                             %
4966 %                                                                             %
4967 %                                                                             %
4968 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4969 %                                                                             %
4970 %                                                                             %
4971 %                                                                             %
4972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4973 %
4974 %  MagickGetImageHistogram() returns the image histogram as an array of
4975 %  PixelWand wands.
4976 %
4977 %  The format of the MagickGetImageHistogram method is:
4978 %
4979 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4980 %        unsigned long *number_colors)
4981 %
4982 %  A description of each parameter follows:
4983 %
4984 %    o wand: the magick wand.
4985 %
4986 %    o number_colors: the number of unique colors in the image and the number
4987 %      of pixel wands returned.
4988 %
4989 */
4990 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4991   unsigned long *number_colors)
4992 {
4993   ColorPacket
4994     *histogram;
4995
4996   PixelWand
4997     **pixel_wands;
4998
4999   register long
5000     i;
5001
5002   assert(wand != (MagickWand *) NULL);
5003   assert(wand->signature == WandSignature);
5004   if (wand->debug != MagickFalse)
5005     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5006   if (wand->images == (Image *) NULL)
5007     {
5008       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5009         "ContainsNoImages","`%s'",wand->name);
5010       return((PixelWand **) NULL);
5011     }
5012   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5013   if (histogram == (ColorPacket *) NULL)
5014     return((PixelWand **) NULL);
5015   pixel_wands=NewPixelWands(*number_colors);
5016   for (i=0; i < (long) *number_colors; i++)
5017   {
5018     PixelSetQuantumColor(pixel_wands[i],&histogram[i].pixel);
5019     PixelSetIndex(pixel_wands[i],histogram[i].index);
5020     PixelSetColorCount(pixel_wands[i],(unsigned long) histogram[i].count);
5021   }
5022   histogram=(ColorPacket *) RelinquishMagickMemory(histogram);
5023   return(pixel_wands);
5024 }
5025 \f
5026 /*
5027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5028 %                                                                             %
5029 %                                                                             %
5030 %                                                                             %
5031 %   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                 %
5032 %                                                                             %
5033 %                                                                             %
5034 %                                                                             %
5035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5036 %
5037 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5038 %
5039 %  The format of the MagickGetImageInterlaceScheme method is:
5040 %
5041 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5042 %
5043 %  A description of each parameter follows:
5044 %
5045 %    o wand: the magick wand.
5046 %
5047 */
5048 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5049 {
5050   assert(wand != (MagickWand *) NULL);
5051   assert(wand->signature == WandSignature);
5052   if (wand->debug != MagickFalse)
5053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5054   if (wand->images == (Image *) NULL)
5055     {
5056       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5057         "ContainsNoImages","`%s'",wand->name);
5058       return(UndefinedInterlace);
5059     }
5060   return(wand->images->interlace);
5061 }
5062 \f
5063 /*
5064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5065 %                                                                             %
5066 %                                                                             %
5067 %                                                                             %
5068 %   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             %
5069 %                                                                             %
5070 %                                                                             %
5071 %                                                                             %
5072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5073 %
5074 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5075 %  sepcified image.
5076 %
5077 %  The format of the MagickGetImageInterpolateMethod method is:
5078 %
5079 %      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5080 %
5081 %  A description of each parameter follows:
5082 %
5083 %    o wand: the magick wand.
5084 %
5085 */
5086 WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5087   MagickWand *wand)
5088 {
5089   assert(wand != (MagickWand *) NULL);
5090   assert(wand->signature == WandSignature);
5091   if (wand->debug != MagickFalse)
5092     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5093   if (wand->images == (Image *) NULL)
5094     {
5095       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5096         "ContainsNoImages","`%s'",wand->name);
5097       return(UndefinedInterpolatePixel);
5098     }
5099   return(wand->images->interpolate);
5100 }
5101 \f
5102 /*
5103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5104 %                                                                             %
5105 %                                                                             %
5106 %                                                                             %
5107 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5108 %                                                                             %
5109 %                                                                             %
5110 %                                                                             %
5111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5112 %
5113 %  MagickGetImageIterations() gets the image iterations.
5114 %
5115 %  The format of the MagickGetImageIterations method is:
5116 %
5117 %      unsigned long MagickGetImageIterations(MagickWand *wand)
5118 %
5119 %  A description of each parameter follows:
5120 %
5121 %    o wand: the magick wand.
5122 %
5123 */
5124 WandExport unsigned long MagickGetImageIterations(MagickWand *wand)
5125 {
5126   assert(wand != (MagickWand *) NULL);
5127   assert(wand->signature == WandSignature);
5128   if (wand->debug != MagickFalse)
5129     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5130   if (wand->images == (Image *) NULL)
5131     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5132   return(wand->images->iterations);
5133 }
5134 \f
5135 /*
5136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5137 %                                                                             %
5138 %                                                                             %
5139 %                                                                             %
5140 %   M a g i c k G e t I m a g e L e n g t h                                   %
5141 %                                                                             %
5142 %                                                                             %
5143 %                                                                             %
5144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5145 %
5146 %  MagickGetImageLength() returns the image length in bytes.
5147 %
5148 %  The format of the MagickGetImageLength method is:
5149 %
5150 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5151 %        MagickSizeType *length)
5152 %
5153 %  A description of each parameter follows:
5154 %
5155 %    o wand: the magick wand.
5156 %
5157 %    o length: the image length in bytes.
5158 %
5159 */
5160 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5161   MagickSizeType *length)
5162 {
5163   assert(wand != (MagickWand *) NULL);
5164   assert(wand->signature == WandSignature);
5165   if (wand->debug != MagickFalse)
5166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5167   if (wand->images == (Image *) NULL)
5168     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5169   *length=GetBlobSize(wand->images);
5170   return(MagickTrue);
5171 }
5172 \f
5173 /*
5174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5175 %                                                                             %
5176 %                                                                             %
5177 %                                                                             %
5178 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5179 %                                                                             %
5180 %                                                                             %
5181 %                                                                             %
5182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5183 %
5184 %  MagickGetImageMatteColor() returns the image matte color.
5185 %
5186 %  The format of the MagickGetImageMatteColor method is:
5187 %
5188 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5189 %        PixelWand *matte_color)
5190 %
5191 %  A description of each parameter follows:
5192 %
5193 %    o wand: the magick wand.
5194 %
5195 %    o matte_color: Return the matte color.
5196 %
5197 */
5198 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5199   PixelWand *matte_color)
5200 {
5201   assert(wand != (MagickWand *) NULL);
5202   assert(wand->signature == WandSignature);
5203   if (wand->debug != MagickFalse)
5204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5205   if (wand->images == (Image *) NULL)
5206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5207   PixelSetQuantumColor(matte_color,&wand->images->matte_color);
5208   return(MagickTrue);
5209 }
5210 \f
5211 /*
5212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5213 %                                                                             %
5214 %                                                                             %
5215 %                                                                             %
5216 %   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                         %
5217 %                                                                             %
5218 %                                                                             %
5219 %                                                                             %
5220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5221 %
5222 %  MagickGetImageOrientation() returns the image orientation.
5223 %
5224 %  The format of the MagickGetImageOrientation method is:
5225 %
5226 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5227 %
5228 %  A description of each parameter follows:
5229 %
5230 %    o wand: the magick wand.
5231 %
5232 */
5233 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5234 {
5235   assert(wand != (MagickWand *) NULL);
5236   assert(wand->signature == WandSignature);
5237   if (wand->debug != MagickFalse)
5238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5239   if (wand->images == (Image *) NULL)
5240     {
5241       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5242         "ContainsNoImages","`%s'",wand->name);
5243       return(UndefinedOrientation);
5244     }
5245   return(wand->images->orientation);
5246 }
5247 \f
5248 /*
5249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5250 %                                                                             %
5251 %                                                                             %
5252 %                                                                             %
5253 %   M a g i c k G e t I m a g e P a g e                                       %
5254 %                                                                             %
5255 %                                                                             %
5256 %                                                                             %
5257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5258 %
5259 %  MagickGetImagePage() returns the page geometry associated with the image.
5260 %
5261 %  The format of the MagickGetImagePage method is:
5262 %
5263 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5264 %        unsigned long *width,unsigned long *height,long *x,long *y)
5265 %
5266 %  A description of each parameter follows:
5267 %
5268 %    o wand: the magick wand.
5269 %
5270 %    o width: the page width.
5271 %
5272 %    o height: the page height.
5273 %
5274 %    o x: the page x-offset.
5275 %
5276 %    o y: the page y-offset.
5277 %
5278 */
5279 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5280   unsigned long *width,unsigned long *height,long *x,long *y)
5281 {
5282   assert(wand != (const MagickWand *) NULL);
5283   assert(wand->signature == WandSignature);
5284   if (wand->debug != MagickFalse)
5285     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5286   if (wand->images == (Image *) NULL)
5287     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5288   *width=wand->images->page.width;
5289   *height=wand->images->page.height;
5290   *x=wand->images->page.x;
5291   *y=wand->images->page.y;
5292   return(MagickTrue);
5293 }
5294 \f
5295 /*
5296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5297 %                                                                             %
5298 %                                                                             %
5299 %                                                                             %
5300 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5301 %                                                                             %
5302 %                                                                             %
5303 %                                                                             %
5304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5305 %
5306 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5307 %
5308 %  The format of the MagickGetImagePixelColor method is:
5309 %
5310 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5311 %        const long x,const long y,PixelWand *color)
5312 %
5313 %  A description of each parameter follows:
5314 %
5315 %    o wand: the magick wand.
5316 %
5317 %    o x,y: the pixel offset into the image.
5318 %
5319 %    o color: Return the colormap color in this wand.
5320 %
5321 */
5322 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5323   const long x,const long y,PixelWand *color)
5324 {
5325   IndexPacket
5326     *indexes;
5327
5328   register const PixelPacket
5329     *p;
5330
5331   CacheView
5332     *image_view;
5333
5334   assert(wand != (MagickWand *) NULL);
5335   assert(wand->signature == WandSignature);
5336   if (wand->debug != MagickFalse)
5337     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5338   if (wand->images == (Image *) NULL)
5339     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5340   image_view=AcquireCacheView(wand->images);
5341   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5342   if (p == (const PixelPacket *) NULL)
5343     {
5344       image_view=DestroyCacheView(image_view);
5345       return(MagickFalse);
5346     }
5347   indexes=GetCacheViewAuthenticIndexQueue(image_view);
5348   PixelSetQuantumColor(color,p);
5349   if (GetCacheViewColorspace(image_view) == CMYKColorspace)
5350     PixelSetBlackQuantum(color,*indexes);
5351   else
5352     if (GetCacheViewStorageClass(image_view) == PseudoClass)
5353       PixelSetIndex(color,*indexes);
5354   image_view=DestroyCacheView(image_view);
5355   return(MagickTrue);
5356 }
5357 \f
5358 /*
5359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5360 %                                                                             %
5361 %                                                                             %
5362 %                                                                             %
5363 +   M a g i c k G e t I m a g e R a n g e                                     %
5364 %                                                                             %
5365 %                                                                             %
5366 %                                                                             %
5367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5368 %
5369 %  MagickGetImageRange() gets the pixel range for the image.
5370 %
5371 %  The format of the MagickGetImageRange method is:
5372 %
5373 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5374 %        double *maxima)
5375 %
5376 %  A description of each parameter follows:
5377 %
5378 %    o wand: the magick wand.
5379 %
5380 %    o minima:  The minimum pixel value for the specified channel(s).
5381 %
5382 %    o maxima:  The maximum pixel value for the specified channel(s).
5383 %
5384 */
5385 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5386   double *minima,double *maxima)
5387 {
5388   MagickBooleanType
5389     status;
5390
5391   assert(wand != (MagickWand *) NULL);
5392   assert(wand->signature == WandSignature);
5393   if (wand->debug != MagickFalse)
5394     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5395   if (wand->images == (Image *) NULL)
5396     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5397   status=GetImageRange(wand->images,minima,maxima,wand->exception);
5398   return(status);
5399 }
5400 \f
5401 /*
5402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5403 %                                                                             %
5404 %                                                                             %
5405 %                                                                             %
5406 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5407 %                                                                             %
5408 %                                                                             %
5409 %                                                                             %
5410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5411 %
5412 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5413 %
5414 %  The format of the MagickGetImageRedPrimary method is:
5415 %
5416 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5417 %        double *y)
5418 %
5419 %  A description of each parameter follows:
5420 %
5421 %    o wand: the magick wand.
5422 %
5423 %    o x: the chromaticity red primary x-point.
5424 %
5425 %    o y: the chromaticity red primary y-point.
5426 %
5427 */
5428 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5429   double *x,double *y)
5430 {
5431   assert(wand != (MagickWand *) NULL);
5432   assert(wand->signature == WandSignature);
5433   if (wand->debug != MagickFalse)
5434     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5435   if (wand->images == (Image *) NULL)
5436     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5437   *x=wand->images->chromaticity.red_primary.x;
5438   *y=wand->images->chromaticity.red_primary.y;
5439   return(MagickTrue);
5440 }
5441 \f
5442 /*
5443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5444 %                                                                             %
5445 %                                                                             %
5446 %                                                                             %
5447 %   M a g i c k G e t I m a g e R e g i o n                                   %
5448 %                                                                             %
5449 %                                                                             %
5450 %                                                                             %
5451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5452 %
5453 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5454 %  a new wand.
5455 %
5456 %  The format of the MagickGetImageRegion method is:
5457 %
5458 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5459 %        const unsigned long width,const unsigned long height,const long x,
5460 %        const long y)
5461 %
5462 %  A description of each parameter follows:
5463 %
5464 %    o wand: the magick wand.
5465 %
5466 %    o width: the region width.
5467 %
5468 %    o height: the region height.
5469 %
5470 %    o x: the region x offset.
5471 %
5472 %    o y: the region y offset.
5473 %
5474 */
5475 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5476   const unsigned long width,const unsigned long height,const long x,
5477   const long y)
5478 {
5479   Image
5480     *region_image;
5481
5482   RectangleInfo
5483     region;
5484
5485   assert(wand != (MagickWand *) NULL);
5486   assert(wand->signature == WandSignature);
5487   if (wand->debug != MagickFalse)
5488     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5489   if (wand->images == (Image *) NULL)
5490     return((MagickWand *) NULL);
5491   region.width=width;
5492   region.height=height;
5493   region.x=x;
5494   region.y=y;
5495   region_image=CropImage(wand->images,&region,wand->exception);
5496   if (region_image == (Image *) NULL)
5497     return((MagickWand *) NULL);
5498   return(CloneMagickWandFromImages(wand,region_image));
5499 }
5500 \f
5501 /*
5502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5503 %                                                                             %
5504 %                                                                             %
5505 %                                                                             %
5506 %   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                 %
5507 %                                                                             %
5508 %                                                                             %
5509 %                                                                             %
5510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5511 %
5512 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5513 %
5514 %  The format of the MagickGetImageRenderingIntent method is:
5515 %
5516 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5517 %
5518 %  A description of each parameter follows:
5519 %
5520 %    o wand: the magick wand.
5521 %
5522 */
5523 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5524 {
5525   assert(wand != (MagickWand *) NULL);
5526   assert(wand->signature == WandSignature);
5527   if (wand->debug != MagickFalse)
5528     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5529   if (wand->images == (Image *) NULL)
5530     {
5531       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5532         "ContainsNoImages","`%s'",wand->name);
5533       return(UndefinedIntent);
5534     }
5535   return((RenderingIntent) wand->images->rendering_intent);
5536 }
5537 \f
5538 /*
5539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5540 %                                                                             %
5541 %                                                                             %
5542 %                                                                             %
5543 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5544 %                                                                             %
5545 %                                                                             %
5546 %                                                                             %
5547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5548 %
5549 %  MagickGetImageResolution() gets the image X and Y resolution.
5550 %
5551 %  The format of the MagickGetImageResolution method is:
5552 %
5553 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5554 %        double *y)
5555 %
5556 %  A description of each parameter follows:
5557 %
5558 %    o wand: the magick wand.
5559 %
5560 %    o x: the image x-resolution.
5561 %
5562 %    o y: the image y-resolution.
5563 %
5564 */
5565 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5566   double *x,double *y)
5567 {
5568   assert(wand != (MagickWand *) NULL);
5569   assert(wand->signature == WandSignature);
5570   if (wand->debug != MagickFalse)
5571     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5572   if (wand->images == (Image *) NULL)
5573     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5574   *x=wand->images->x_resolution;
5575   *y=wand->images->y_resolution;
5576   return(MagickTrue);
5577 }
5578 \f
5579 /*
5580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5581 %                                                                             %
5582 %                                                                             %
5583 %                                                                             %
5584 %   M a g i c k G e t I m a g e S c e n e                                     %
5585 %                                                                             %
5586 %                                                                             %
5587 %                                                                             %
5588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5589 %
5590 %  MagickGetImageScene() gets the image scene.
5591 %
5592 %  The format of the MagickGetImageScene method is:
5593 %
5594 %      unsigned long MagickGetImageScene(MagickWand *wand)
5595 %
5596 %  A description of each parameter follows:
5597 %
5598 %    o wand: the magick wand.
5599 %
5600 */
5601 WandExport unsigned long MagickGetImageScene(MagickWand *wand)
5602 {
5603   assert(wand != (MagickWand *) NULL);
5604   assert(wand->signature == WandSignature);
5605   if (wand->debug != MagickFalse)
5606     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5607   if (wand->images == (Image *) NULL)
5608     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5609   return(wand->images->scene);
5610 }
5611 \f
5612 /*
5613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5614 %                                                                             %
5615 %                                                                             %
5616 %                                                                             %
5617 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5618 %                                                                             %
5619 %                                                                             %
5620 %                                                                             %
5621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5622 %
5623 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5624 %  pixel stream.
5625 %
5626 %  The format of the MagickGetImageSignature method is:
5627 %
5628 %      const char MagickGetImageSignature(MagickWand *wand)
5629 %
5630 %  A description of each parameter follows:
5631 %
5632 %    o wand: the magick wand.
5633 %
5634 */
5635 WandExport char *MagickGetImageSignature(MagickWand *wand)
5636 {
5637   const char
5638     *value;
5639
5640   MagickBooleanType
5641     status;
5642
5643   assert(wand != (MagickWand *) NULL);
5644   assert(wand->signature == WandSignature);
5645   if (wand->debug != MagickFalse)
5646     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5647   if (wand->images == (Image *) NULL)
5648     {
5649       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5650         "ContainsNoImages","`%s'",wand->name);
5651       return((char *) NULL);
5652     }
5653   status=SignatureImage(wand->images);
5654   if (status == MagickFalse)
5655     InheritException(wand->exception,&wand->images->exception);
5656   value=GetImageProperty(wand->images,"signature");
5657   if (value != (const char *) NULL)
5658     return(AcquireString(value));
5659   InheritException(wand->exception,&wand->images->exception);
5660   return((char *) NULL);
5661 }
5662 \f
5663 /*
5664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5665 %                                                                             %
5666 %                                                                             %
5667 %                                                                             %
5668 %   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                   %
5669 %                                                                             %
5670 %                                                                             %
5671 %                                                                             %
5672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5673 %
5674 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5675 %
5676 %  The format of the MagickGetImageTicksPerSecond method is:
5677 %
5678 %      unsigned long MagickGetImageTicksPerSecond(MagickWand *wand)
5679 %
5680 %  A description of each parameter follows:
5681 %
5682 %    o wand: the magick wand.
5683 %
5684 */
5685 WandExport unsigned long MagickGetImageTicksPerSecond(MagickWand *wand)
5686 {
5687   assert(wand != (MagickWand *) NULL);
5688   assert(wand->signature == WandSignature);
5689   if (wand->debug != MagickFalse)
5690     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5691   if (wand->images == (Image *) NULL)
5692     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5693   return((unsigned long) wand->images->ticks_per_second);
5694 }
5695 \f
5696 /*
5697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5698 %                                                                             %
5699 %                                                                             %
5700 %                                                                             %
5701 %   M a g i c k G e t I m a g e T y p e                                       %
5702 %                                                                             %
5703 %                                                                             %
5704 %                                                                             %
5705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5706 %
5707 %  MagickGetImageType() gets the potential image type:
5708 %
5709 %        Bilevel        Grayscale       GrayscaleMatte
5710 %        Palette        PaletteMatte    TrueColor
5711 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5712 %
5713 %  To ensure the image type matches its potential, use MagickSetImageType():
5714 %
5715 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5716 %
5717 %  The format of the MagickGetImageType method is:
5718 %
5719 %      ImageType MagickGetImageType(MagickWand *wand)
5720 %
5721 %  A description of each parameter follows:
5722 %
5723 %    o wand: the magick wand.
5724 %
5725 */
5726 WandExport ImageType MagickGetImageType(MagickWand *wand)
5727 {
5728   assert(wand != (MagickWand *) NULL);
5729   assert(wand->signature == WandSignature);
5730   if (wand->debug != MagickFalse)
5731     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5732   if (wand->images == (Image *) NULL)
5733     {
5734       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5735         "ContainsNoImages","`%s'",wand->name);
5736       return(UndefinedType);
5737     }
5738   return(GetImageType(wand->images,wand->exception));
5739 }
5740 \f
5741 /*
5742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5743 %                                                                             %
5744 %                                                                             %
5745 %                                                                             %
5746 %   M a g i c k G e t I m a g e U n i t s                                     %
5747 %                                                                             %
5748 %                                                                             %
5749 %                                                                             %
5750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5751 %
5752 %  MagickGetImageUnits() gets the image units of resolution.
5753 %
5754 %  The format of the MagickGetImageUnits method is:
5755 %
5756 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5757 %
5758 %  A description of each parameter follows:
5759 %
5760 %    o wand: the magick wand.
5761 %
5762 */
5763 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5764 {
5765   assert(wand != (MagickWand *) NULL);
5766   assert(wand->signature == WandSignature);
5767   if (wand->debug != MagickFalse)
5768     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5769   if (wand->images == (Image *) NULL)
5770     {
5771       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5772         "ContainsNoImages","`%s'",wand->name);
5773       return(UndefinedResolution);
5774     }
5775   return(wand->images->units);
5776 }
5777 \f
5778 /*
5779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5780 %                                                                             %
5781 %                                                                             %
5782 %                                                                             %
5783 %   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           %
5784 %                                                                             %
5785 %                                                                             %
5786 %                                                                             %
5787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5788 %
5789 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5790 %  sepcified image.
5791 %
5792 %  The format of the MagickGetImageVirtualPixelMethod method is:
5793 %
5794 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5795 %
5796 %  A description of each parameter follows:
5797 %
5798 %    o wand: the magick wand.
5799 %
5800 */
5801 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5802 {
5803   assert(wand != (MagickWand *) NULL);
5804   assert(wand->signature == WandSignature);
5805   if (wand->debug != MagickFalse)
5806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5807   if (wand->images == (Image *) NULL)
5808     {
5809       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5810         "ContainsNoImages","`%s'",wand->name);
5811       return(UndefinedVirtualPixelMethod);
5812     }
5813   return(GetImageVirtualPixelMethod(wand->images));
5814 }
5815 \f
5816 /*
5817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5818 %                                                                             %
5819 %                                                                             %
5820 %                                                                             %
5821 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5822 %                                                                             %
5823 %                                                                             %
5824 %                                                                             %
5825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5826 %
5827 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5828 %
5829 %  The format of the MagickGetImageWhitePoint method is:
5830 %
5831 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5832 %        double *y)
5833 %
5834 %  A description of each parameter follows:
5835 %
5836 %    o wand: the magick wand.
5837 %
5838 %    o x: the chromaticity white x-point.
5839 %
5840 %    o y: the chromaticity white y-point.
5841 %
5842 */
5843 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5844   double *x,double *y)
5845 {
5846   assert(wand != (MagickWand *) NULL);
5847   assert(wand->signature == WandSignature);
5848   if (wand->debug != MagickFalse)
5849     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5850   if (wand->images == (Image *) NULL)
5851     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5852   *x=wand->images->chromaticity.white_point.x;
5853   *y=wand->images->chromaticity.white_point.y;
5854   return(MagickTrue);
5855 }
5856 \f
5857 /*
5858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5859 %                                                                             %
5860 %                                                                             %
5861 %                                                                             %
5862 %   M a g i c k G e t I m a g e W i d t h                                     %
5863 %                                                                             %
5864 %                                                                             %
5865 %                                                                             %
5866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5867 %
5868 %  MagickGetImageWidth() returns the image width.
5869 %
5870 %  The format of the MagickGetImageWidth method is:
5871 %
5872 %      unsigned long MagickGetImageWidth(MagickWand *wand)
5873 %
5874 %  A description of each parameter follows:
5875 %
5876 %    o wand: the magick wand.
5877 %
5878 */
5879 WandExport unsigned long MagickGetImageWidth(MagickWand *wand)
5880 {
5881   assert(wand != (MagickWand *) NULL);
5882   assert(wand->signature == WandSignature);
5883   if (wand->debug != MagickFalse)
5884     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5885   if (wand->images == (Image *) NULL)
5886     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5887   return(wand->images->columns);
5888 }
5889 \f
5890 /*
5891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5892 %                                                                             %
5893 %                                                                             %
5894 %                                                                             %
5895 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5896 %                                                                             %
5897 %                                                                             %
5898 %                                                                             %
5899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5900 %
5901 %  MagickGetNumberImages() returns the number of images associated with a
5902 %  magick wand.
5903 %
5904 %  The format of the MagickGetNumberImages method is:
5905 %
5906 %      unsigned long MagickGetNumberImages(MagickWand *wand)
5907 %
5908 %  A description of each parameter follows:
5909 %
5910 %    o wand: the magick wand.
5911 %
5912 */
5913 WandExport unsigned long MagickGetNumberImages(MagickWand *wand)
5914 {
5915   assert(wand != (MagickWand *) NULL);
5916   assert(wand->signature == WandSignature);
5917   if (wand->debug != MagickFalse)
5918     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5919   return(GetImageListLength(wand->images));
5920 }
5921 \f
5922 /*
5923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5924 %                                                                             %
5925 %                                                                             %
5926 %                                                                             %
5927 %   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                 %
5928 %                                                                             %
5929 %                                                                             %
5930 %                                                                             %
5931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5932 %
5933 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5934 %
5935 %  The format of the MagickGetImageTotalInkDensity method is:
5936 %
5937 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5938 %
5939 %  A description of each parameter follows:
5940 %
5941 %    o wand: the magick wand.
5942 %
5943 */
5944 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5945 {
5946   assert(wand != (MagickWand *) NULL);
5947   assert(wand->signature == WandSignature);
5948   if (wand->debug != MagickFalse)
5949     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5950   if (wand->images == (Image *) NULL)
5951     {
5952       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5953         "ContainsNoImages","`%s'",wand->name);
5954       return(0.0);
5955     }
5956   return(GetImageTotalInkDensity(wand->images));
5957 }
5958 \f
5959 /*
5960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5961 %                                                                             %
5962 %                                                                             %
5963 %                                                                             %
5964 %   M a g i c k H a l d C l u t I m a g e                                     %
5965 %                                                                             %
5966 %                                                                             %
5967 %                                                                             %
5968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5969 %
5970 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5971 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5972 %  dimensions.  Create it with the HALD coder.  You can apply any color
5973 %  transformation to the Hald image and then use this method to apply the
5974 %  transform to the image.
5975 %
5976 %  The format of the MagickHaldClutImage method is:
5977 %
5978 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5979 %        const MagickWand *hald_wand)
5980 %      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
5981 %        const ChannelType channel,const MagickWand *hald_wand)
5982 %
5983 %  A description of each parameter follows:
5984 %
5985 %    o wand: the magick wand.
5986 %
5987 %    o hald_image: the hald CLUT image.
5988 %
5989 */
5990
5991 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5992   const MagickWand *hald_wand)
5993 {
5994   MagickBooleanType
5995     status;
5996
5997   status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
5998   return(status);
5999 }
6000
6001 WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6002   const ChannelType channel,const MagickWand *hald_wand)
6003 {
6004   MagickBooleanType
6005     status;
6006
6007   assert(wand != (MagickWand *) NULL);
6008   assert(wand->signature == WandSignature);
6009   if (wand->debug != MagickFalse)
6010     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6011   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6012     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6013   status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6014   if (status == MagickFalse)
6015     InheritException(wand->exception,&wand->images->exception);
6016   return(status);
6017 }
6018 \f
6019 /*
6020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6021 %                                                                             %
6022 %                                                                             %
6023 %                                                                             %
6024 %   M a g i c k H a s N e x t I m a g e                                       %
6025 %                                                                             %
6026 %                                                                             %
6027 %                                                                             %
6028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6029 %
6030 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
6031 %  traversing the list in the forward direction
6032 %
6033 %  The format of the MagickHasNextImage method is:
6034 %
6035 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6036 %
6037 %  A description of each parameter follows:
6038 %
6039 %    o wand: the magick wand.
6040 %
6041 */
6042 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6043 {
6044   assert(wand != (MagickWand *) NULL);
6045   assert(wand->signature == WandSignature);
6046   if (wand->debug != MagickFalse)
6047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6048   if (wand->images == (Image *) NULL)
6049     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6050   if (GetNextImageInList(wand->images) == (Image *) NULL)
6051     return(MagickFalse);
6052   return(MagickTrue);
6053 }
6054 \f
6055 /*
6056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6057 %                                                                             %
6058 %                                                                             %
6059 %                                                                             %
6060 %   M a g i c k H a s P r e v i o u s I m a g e                               %
6061 %                                                                             %
6062 %                                                                             %
6063 %                                                                             %
6064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6065 %
6066 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6067 %  traversing the list in the reverse direction
6068 %
6069 %  The format of the MagickHasPreviousImage method is:
6070 %
6071 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6072 %
6073 %  A description of each parameter follows:
6074 %
6075 %    o wand: the magick wand.
6076 %
6077 */
6078 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6079 {
6080   assert(wand != (MagickWand *) NULL);
6081   assert(wand->signature == WandSignature);
6082   if (wand->debug != MagickFalse)
6083     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6084   if (wand->images == (Image *) NULL)
6085     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6086   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6087     return(MagickFalse);
6088   return(MagickTrue);
6089 }
6090 \f
6091 /*
6092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6093 %                                                                             %
6094 %                                                                             %
6095 %                                                                             %
6096 %   M a g i c k I d e n t i f y I m a g e                                     %
6097 %                                                                             %
6098 %                                                                             %
6099 %                                                                             %
6100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6101 %
6102 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6103 %  file.  Attributes include the image width, height, size, and others.
6104 %
6105 %  The format of the MagickIdentifyImage method is:
6106 %
6107 %      const char *MagickIdentifyImage(MagickWand *wand)
6108 %
6109 %  A description of each parameter follows:
6110 %
6111 %    o wand: the magick wand.
6112 %
6113 */
6114 WandExport char *MagickIdentifyImage(MagickWand *wand)
6115 {
6116   char
6117     *description,
6118     filename[MaxTextExtent];
6119
6120   FILE
6121     *file;
6122
6123   int
6124     unique_file;
6125
6126   assert(wand != (MagickWand *) NULL);
6127   assert(wand->signature == WandSignature);
6128   if (wand->debug != MagickFalse)
6129     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6130   if (wand->images == (Image *) NULL)
6131     {
6132       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6133         "ContainsNoImages","`%s'",wand->name);
6134       return((char *) NULL);
6135     }
6136   description=(char *) NULL;
6137   unique_file=AcquireUniqueFileResource(filename);
6138   file=(FILE *) NULL;
6139   if (unique_file != -1)
6140     file=fdopen(unique_file,"wb");
6141   if ((unique_file == -1) || (file == (FILE *) NULL))
6142     {
6143       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6144         "UnableToCreateTemporaryFile","`%s'",wand->name);
6145       return((char *) NULL);
6146     }
6147   (void) IdentifyImage(wand->images,file,MagickTrue);
6148   (void) fclose(file);
6149   description=FileToString(filename,~0,wand->exception);
6150   (void) RelinquishUniqueFileResource(filename);
6151   return(description);
6152 }
6153 \f
6154 /*
6155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6156 %                                                                             %
6157 %                                                                             %
6158 %                                                                             %
6159 %   M a g i c k I m p l o d e I m a g e                                       %
6160 %                                                                             %
6161 %                                                                             %
6162 %                                                                             %
6163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6164 %
6165 %  MagickImplodeImage() creates a new image that is a copy of an existing
6166 %  one with the image pixels "implode" by the specified percentage.  It
6167 %  allocates the memory necessary for the new Image structure and returns a
6168 %  pointer to the new image.
6169 %
6170 %  The format of the MagickImplodeImage method is:
6171 %
6172 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6173 %        const double radius)
6174 %
6175 %  A description of each parameter follows:
6176 %
6177 %    o wand: the magick wand.
6178 %
6179 %    o amount: Define the extent of the implosion.
6180 %
6181 */
6182 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6183   const double amount)
6184 {
6185   Image
6186     *implode_image;
6187
6188   assert(wand != (MagickWand *) NULL);
6189   assert(wand->signature == WandSignature);
6190   if (wand->debug != MagickFalse)
6191     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6192   if (wand->images == (Image *) NULL)
6193     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6194   implode_image=ImplodeImage(wand->images,amount,wand->exception);
6195   if (implode_image == (Image *) NULL)
6196     return(MagickFalse);
6197   ReplaceImageInList(&wand->images,implode_image);
6198   return(MagickTrue);
6199 }
6200 \f
6201 /*
6202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6203 %                                                                             %
6204 %                                                                             %
6205 %                                                                             %
6206 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6207 %                                                                             %
6208 %                                                                             %
6209 %                                                                             %
6210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6211 %
6212 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6213 %  location you specify.  The method returns MagickFalse on success otherwise
6214 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6215 %  short int, int, long, float, or double in the order specified by map.
6216 %
6217 %  Suppose your want to upload the first scanline of a 640x480 image from
6218 %  character data in red-green-blue order:
6219 %
6220 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6221 %
6222 %  The format of the MagickImportImagePixels method is:
6223 %
6224 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6225 %        const long x,const long y,const unsigned long columns,
6226 %        const unsigned long rows,const char *map,const StorageType storage,
6227 %        const void *pixels)
6228 %
6229 %  A description of each parameter follows:
6230 %
6231 %    o wand: the magick wand.
6232 %
6233 %    o x, y, columns, rows:  These values define the perimeter of a region
6234 %      of pixels you want to define.
6235 %
6236 %    o map:  This string reflects the expected ordering of the pixel array.
6237 %      It can be any combination or order of R = red, G = green, B = blue,
6238 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6239 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6240 %      P = pad.
6241 %
6242 %    o storage: Define the data type of the pixels.  Float and double types are
6243 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6244 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6245 %      or DoublePixel.
6246 %
6247 %    o pixels: This array of values contain the pixel components as defined by
6248 %      map and type.  You must preallocate this array where the expected
6249 %      length varies depending on the values of width, height, map, and type.
6250 %
6251 */
6252 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6253   const long x,const long y,const unsigned long columns,
6254   const unsigned long rows,const char *map,const StorageType storage,
6255   const void *pixels)
6256 {
6257   MagickBooleanType
6258     status;
6259
6260   assert(wand != (MagickWand *) NULL);
6261   assert(wand->signature == WandSignature);
6262   if (wand->debug != MagickFalse)
6263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6264   if (wand->images == (Image *) NULL)
6265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6266   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6267   if (status == MagickFalse)
6268     InheritException(wand->exception,&wand->images->exception);
6269   return(status);
6270 }
6271 \f
6272 /*
6273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6274 %                                                                             %
6275 %                                                                             %
6276 %                                                                             %
6277 %   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       %
6278 %                                                                             %
6279 %                                                                             %
6280 %                                                                             %
6281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6282 %
6283 %  MagickInverseFourierTransformImage() implements the inverse discrete
6284 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6285 %  imaginary image pair.
6286 %
6287 %  The format of the MagickInverseFourierTransformImage method is:
6288 %
6289 %      MagickBooleanType MagickInverseFourierTransformImage(
6290 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6291 %        const MagickBooleanType magnitude)
6292 %
6293 %  A description of each parameter follows:
6294 %
6295 %    o magnitude_wand: the magnitude or real wand.
6296 %
6297 %    o phase_wand: the phase or imaginary wand.
6298 %
6299 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6300 %      imaginary image pair.
6301 %
6302 */
6303 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6304   MagickWand *magnitude_wand,MagickWand *phase_wand,
6305   const MagickBooleanType magnitude)
6306 {
6307   Image
6308     *inverse_image;
6309
6310   MagickWand
6311     *wand;
6312
6313   assert(magnitude_wand != (MagickWand *) NULL);
6314   assert(magnitude_wand->signature == WandSignature);
6315   if (magnitude_wand->debug != MagickFalse)
6316     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6317       magnitude_wand->name);
6318   wand=magnitude_wand;
6319   if (magnitude_wand->images == (Image *) NULL)
6320     ThrowWandException(WandError,"ContainsNoImages",
6321       magnitude_wand->name);
6322   assert(phase_wand != (MagickWand *) NULL);
6323   assert(phase_wand->signature == WandSignature);
6324   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6325     phase_wand->images,magnitude,wand->exception);
6326   if (inverse_image == (Image *) NULL)
6327     return(MagickFalse);
6328   ReplaceImageInList(&wand->images,inverse_image);
6329   return(MagickTrue);
6330 }
6331 \f
6332 /*
6333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6334 %                                                                             %
6335 %                                                                             %
6336 %                                                                             %
6337 %   M a g i c k L a b e l I m a g e                                           %
6338 %                                                                             %
6339 %                                                                             %
6340 %                                                                             %
6341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6342 %
6343 %  MagickLabelImage() adds a label to your image.
6344 %
6345 %  The format of the MagickLabelImage method is:
6346 %
6347 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6348 %
6349 %  A description of each parameter follows:
6350 %
6351 %    o wand: the magick wand.
6352 %
6353 %    o label: the image label.
6354 %
6355 */
6356 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6357   const char *label)
6358 {
6359   MagickBooleanType
6360     status;
6361
6362   assert(wand != (MagickWand *) NULL);
6363   assert(wand->signature == WandSignature);
6364   if (wand->debug != MagickFalse)
6365     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6366   if (wand->images == (Image *) NULL)
6367     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6368   status=SetImageProperty(wand->images,"label",label);
6369   if (status == MagickFalse)
6370     InheritException(wand->exception,&wand->images->exception);
6371   return(status);
6372 }
6373 \f
6374 /*
6375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6376 %                                                                             %
6377 %                                                                             %
6378 %                                                                             %
6379 %   M a g i c k L e v e l I m a g e                                           %
6380 %                                                                             %
6381 %                                                                             %
6382 %                                                                             %
6383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6384 %
6385 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6386 %  falling between specified white and black points to the full available
6387 %  quantum range. The parameters provided represent the black, mid, and white
6388 %  points. The black point specifies the darkest color in the image. Colors
6389 %  darker than the black point are set to zero. Mid point specifies a gamma
6390 %  correction to apply to the image.  White point specifies the lightest color
6391 %  in the image. Colors brighter than the white point are set to the maximum
6392 %  quantum value.
6393 %
6394 %  The format of the MagickLevelImage method is:
6395 %
6396 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6397 %        const double black_point,const double gamma,const double white_point)
6398 %      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6399 %        const ChannelType channel,const double black_point,const double gamma,
6400 %        const double white_point)
6401 %
6402 %  A description of each parameter follows:
6403 %
6404 %    o wand: the magick wand.
6405 %
6406 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6407 %
6408 %    o black_point: the black point.
6409 %
6410 %    o gamma: the gamma.
6411 %
6412 %    o white_point: the white point.
6413 %
6414 */
6415
6416 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6417   const double black_point,const double gamma,const double white_point)
6418 {
6419   MagickBooleanType
6420     status;
6421
6422   status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6423     white_point);
6424   return(status);
6425 }
6426
6427 WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6428   const ChannelType channel,const double black_point,const double gamma,
6429   const double white_point)
6430 {
6431   MagickBooleanType
6432     status;
6433
6434   assert(wand != (MagickWand *) NULL);
6435   assert(wand->signature == WandSignature);
6436   if (wand->debug != MagickFalse)
6437     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6438   if (wand->images == (Image *) NULL)
6439     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6440   status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6441   if (status == MagickFalse)
6442     InheritException(wand->exception,&wand->images->exception);
6443   return(status);
6444 }
6445 \f
6446 /*
6447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6448 %                                                                             %
6449 %                                                                             %
6450 %                                                                             %
6451 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6452 %                                                                             %
6453 %                                                                             %
6454 %                                                                             %
6455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6456 %
6457 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6458 %
6459 %  You can also reduce the influence of a particular channel with a gamma
6460 %  value of 0.
6461 %
6462 %  The format of the MagickLinearStretchImage method is:
6463 %
6464 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6465 %        const double black_point,const double white_point)
6466 %
6467 %  A description of each parameter follows:
6468 %
6469 %    o wand: the magick wand.
6470 %
6471 %    o black_point: the black point.
6472 %
6473 %    o white_point: the white point.
6474 %
6475 */
6476 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6477   const double black_point,const double white_point)
6478 {
6479   MagickBooleanType
6480     status;
6481
6482   assert(wand != (MagickWand *) NULL);
6483   assert(wand->signature == WandSignature);
6484   if (wand->debug != MagickFalse)
6485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6486   if (wand->images == (Image *) NULL)
6487     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6488   status=LinearStretchImage(wand->images,black_point,white_point);
6489   if (status == MagickFalse)
6490     InheritException(wand->exception,&wand->images->exception);
6491   return(status);
6492 }
6493 \f
6494 /*
6495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6496 %                                                                             %
6497 %                                                                             %
6498 %                                                                             %
6499 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6500 %                                                                             %
6501 %                                                                             %
6502 %                                                                             %
6503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6504 %
6505 %  MagickLiquidRescaleImage() rescales image with seam carving.
6506 %
6507 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6508 %        const unsigned long columns,const unsigned long rows,
6509 %        const double delta_x,const double rigidity)
6510 %
6511 %  A description of each parameter follows:
6512 %
6513 %    o wand: the magick wand.
6514 %
6515 %    o columns: the number of columns in the scaled image.
6516 %
6517 %    o rows: the number of rows in the scaled image.
6518 %
6519 %    o delta_x: maximum seam transversal step (0 means straight seams).
6520 %
6521 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6522 %
6523 */
6524 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6525   const unsigned long columns,const unsigned long rows,const double delta_x,
6526   const double rigidity)
6527 {
6528   Image
6529     *rescale_image;
6530
6531   assert(wand != (MagickWand *) NULL);
6532   assert(wand->signature == WandSignature);
6533   if (wand->debug != MagickFalse)
6534     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6535   if (wand->images == (Image *) NULL)
6536     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6537   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6538     rigidity,wand->exception);
6539   if (rescale_image == (Image *) NULL)
6540     return(MagickFalse);
6541   ReplaceImageInList(&wand->images,rescale_image);
6542   return(MagickTrue);
6543 }
6544 \f
6545 /*
6546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6547 %                                                                             %
6548 %                                                                             %
6549 %                                                                             %
6550 %   M a g i c k M a g n i f y I m a g e                                       %
6551 %                                                                             %
6552 %                                                                             %
6553 %                                                                             %
6554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6555 %
6556 %  MagickMagnifyImage() is a convenience method that scales an image
6557 %  proportionally to twice its original size.
6558 %
6559 %  The format of the MagickMagnifyImage method is:
6560 %
6561 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6562 %
6563 %  A description of each parameter follows:
6564 %
6565 %    o wand: the magick wand.
6566 %
6567 */
6568 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6569 {
6570   Image
6571     *magnify_image;
6572
6573   assert(wand != (MagickWand *) NULL);
6574   assert(wand->signature == WandSignature);
6575   if (wand->debug != MagickFalse)
6576     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6577   if (wand->images == (Image *) NULL)
6578     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6579   magnify_image=MagnifyImage(wand->images,wand->exception);
6580   if (magnify_image == (Image *) NULL)
6581     return(MagickFalse);
6582   ReplaceImageInList(&wand->images,magnify_image);
6583   return(MagickTrue);
6584 }
6585 \f
6586 /*
6587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6588 %                                                                             %
6589 %                                                                             %
6590 %                                                                             %
6591 %   M a g i c k M e d i a n F i l t e r I m a g e                             %
6592 %                                                                             %
6593 %                                                                             %
6594 %                                                                             %
6595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6596 %
6597 %  MagickMedianFilterImage() applies a digital filter that improves the quality
6598 %  of a noisy image.  Each pixel is replaced by the median in a set of
6599 %  neighboring pixels as defined by radius.
6600 %
6601 %  The format of the MagickMedianFilterImage method is:
6602 %
6603 %      MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6604 %        const double radius)
6605 %
6606 %  A description of each parameter follows:
6607 %
6608 %    o wand: the magick wand.
6609 %
6610 %    o radius: the radius of the pixel neighborhood.
6611 %
6612 */
6613 WandExport MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6614   const double radius)
6615 {
6616   Image
6617     *median_image;
6618
6619   assert(wand != (MagickWand *) NULL);
6620   assert(wand->signature == WandSignature);
6621   if (wand->debug != MagickFalse)
6622     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6623   if (wand->images == (Image *) NULL)
6624     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6625   median_image=MedianFilterImage(wand->images,radius,wand->exception);
6626   if (median_image == (Image *) NULL)
6627     return(MagickFalse);
6628   ReplaceImageInList(&wand->images,median_image);
6629   return(MagickTrue);
6630 }
6631 \f
6632 /*
6633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6634 %                                                                             %
6635 %                                                                             %
6636 %                                                                             %
6637 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6638 %                                                                             %
6639 %                                                                             %
6640 %                                                                             %
6641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6642 %
6643 %  MagickMergeImageLayers() composes all the image layers from the current given
6644 %  image onward to produce a single image of the merged layers.
6645 %
6646 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6647 %  initialized using the first images background color.  The images
6648 %  are then compositied onto that image in sequence using the given
6649 %  composition that has been assigned to each individual image.
6650 %
6651 %  The format of the MagickMergeImageLayers method is:
6652 %
6653 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6654 %        const ImageLayerMethod method)
6655 %
6656 %  A description of each parameter follows:
6657 %
6658 %    o wand: the magick wand.
6659 %
6660 %    o method: the method of selecting the size of the initial canvas.
6661 %
6662 %        MergeLayer: Merge all layers onto a canvas just large enough
6663 %           to hold all the actual images. The virtual canvas of the
6664 %           first image is preserved but otherwise ignored.
6665 %
6666 %        FlattenLayer: Use the virtual canvas size of first image.
6667 %           Images which fall outside this canvas is clipped.
6668 %           This can be used to 'fill out' a given virtual canvas.
6669 %
6670 %        MosaicLayer: Start with the virtual canvas of the first image,
6671 %           enlarging left and right edges to contain all images.
6672 %           Images with negative offsets will be clipped.
6673 %
6674 */
6675 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6676   const ImageLayerMethod method)
6677 {
6678   Image
6679     *mosaic_image;
6680
6681   assert(wand != (MagickWand *) NULL);
6682   assert(wand->signature == WandSignature);
6683   if (wand->debug != MagickFalse)
6684     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6685   if (wand->images == (Image *) NULL)
6686     return((MagickWand *) NULL);
6687   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6688   if (mosaic_image == (Image *) NULL)
6689     return((MagickWand *) NULL);
6690   return(CloneMagickWandFromImages(wand,mosaic_image));
6691 }
6692 \f
6693 /*
6694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6695 %                                                                             %
6696 %                                                                             %
6697 %                                                                             %
6698 %   M a g i c k M i n i f y I m a g e                                         %
6699 %                                                                             %
6700 %                                                                             %
6701 %                                                                             %
6702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6703 %
6704 %  MagickMinifyImage() is a convenience method that scales an image
6705 %  proportionally to one-half its original size
6706 %
6707 %  The format of the MagickMinifyImage method is:
6708 %
6709 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6710 %
6711 %  A description of each parameter follows:
6712 %
6713 %    o wand: the magick wand.
6714 %
6715 */
6716 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6717 {
6718   Image
6719     *minify_image;
6720
6721   assert(wand != (MagickWand *) NULL);
6722   assert(wand->signature == WandSignature);
6723   if (wand->debug != MagickFalse)
6724     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6725   if (wand->images == (Image *) NULL)
6726     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6727   minify_image=MinifyImage(wand->images,wand->exception);
6728   if (minify_image == (Image *) NULL)
6729     return(MagickFalse);
6730   ReplaceImageInList(&wand->images,minify_image);
6731   return(MagickTrue);
6732 }
6733 \f
6734 /*
6735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6736 %                                                                             %
6737 %                                                                             %
6738 %                                                                             %
6739 %   M a g i c k M o d u l a t e I m a g e                                     %
6740 %                                                                             %
6741 %                                                                             %
6742 %                                                                             %
6743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6744 %
6745 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6746 %  of an image.  Hue is the percentage of absolute rotation from the current
6747 %  position.  For example 50 results in a counter-clockwise rotation of 90
6748 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6749 %  both resulting in a rotation of 180 degrees.
6750 %
6751 %  To increase the color brightness by 20% and decrease the color saturation by
6752 %  10% and leave the hue unchanged, use: 120,90,100.
6753 %
6754 %  The format of the MagickModulateImage method is:
6755 %
6756 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6757 %        const double brightness,const double saturation,const double hue)
6758 %
6759 %  A description of each parameter follows:
6760 %
6761 %    o wand: the magick wand.
6762 %
6763 %    o brightness: the percent change in brighness.
6764 %
6765 %    o saturation: the percent change in saturation.
6766 %
6767 %    o hue: the percent change in hue.
6768 %
6769 */
6770 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6771   const double brightness,const double saturation,const double hue)
6772 {
6773   char
6774     modulate[MaxTextExtent];
6775
6776   MagickBooleanType
6777     status;
6778
6779   assert(wand != (MagickWand *) NULL);
6780   assert(wand->signature == WandSignature);
6781   if (wand->debug != MagickFalse)
6782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6783   if (wand->images == (Image *) NULL)
6784     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6785   (void) FormatMagickString(modulate,MaxTextExtent,"%g,%g,%g",brightness,
6786     saturation,hue);
6787   status=ModulateImage(wand->images,modulate);
6788   if (status == MagickFalse)
6789     InheritException(wand->exception,&wand->images->exception);
6790   return(status);
6791 }
6792 \f
6793 /*
6794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6795 %                                                                             %
6796 %                                                                             %
6797 %                                                                             %
6798 %   M a g i c k M o n t a g e I m a g e                                       %
6799 %                                                                             %
6800 %                                                                             %
6801 %                                                                             %
6802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6803 %
6804 %  MagickMontageImage() creates a composite image by combining several
6805 %  separate images. The images are tiled on the composite image with the name
6806 %  of the image optionally appearing just below the individual tile.
6807 %
6808 %  The format of the MagickMontageImage method is:
6809 %
6810 %      MagickWand *MagickMontageImage(MagickWand *wand,
6811 %        const DrawingWand drawing_wand,const char *tile_geometry,
6812 %        const char *thumbnail_geometry,const MontageMode mode,
6813 %        const char *frame)
6814 %
6815 %  A description of each parameter follows:
6816 %
6817 %    o wand: the magick wand.
6818 %
6819 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6820 %      obtained from this wand.
6821 %
6822 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6823 %
6824 %    o thumbnail_geometry: Preferred image size and border size of each
6825 %      thumbnail (e.g. 120x120+4+3>).
6826 %
6827 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6828 %
6829 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6830 %      The frame color is that of the thumbnail's matte color.
6831 %
6832 */
6833 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6834   const DrawingWand *drawing_wand,const char *tile_geometry,
6835   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6836 {
6837   char
6838     *font;
6839
6840   Image
6841     *montage_image;
6842
6843   MontageInfo
6844     *montage_info;
6845
6846   PixelWand
6847     *pixel_wand;
6848
6849   assert(wand != (MagickWand *) NULL);
6850   assert(wand->signature == WandSignature);
6851   if (wand->debug != MagickFalse)
6852     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6853   if (wand->images == (Image *) NULL)
6854     return((MagickWand *) NULL);
6855   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6856   switch (mode)
6857   {
6858     case FrameMode:
6859     {
6860       (void) CloneString(&montage_info->frame,"15x15+3+3");
6861       montage_info->shadow=MagickTrue;
6862       break;
6863     }
6864     case UnframeMode:
6865     {
6866       montage_info->frame=(char *) NULL;
6867       montage_info->shadow=MagickFalse;
6868       montage_info->border_width=0;
6869       break;
6870     }
6871     case ConcatenateMode:
6872     {
6873       montage_info->frame=(char *) NULL;
6874       montage_info->shadow=MagickFalse;
6875       (void) CloneString(&montage_info->geometry,"+0+0");
6876       montage_info->border_width=0;
6877       break;
6878     }
6879     default:
6880       break;
6881   }
6882   font=DrawGetFont(drawing_wand);
6883   if (font != (char *) NULL)
6884     (void) CloneString(&montage_info->font,font);
6885   if (frame != (char *) NULL)
6886     (void) CloneString(&montage_info->frame,frame);
6887   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6888   pixel_wand=NewPixelWand();
6889   DrawGetFillColor(drawing_wand,pixel_wand);
6890   PixelGetQuantumColor(pixel_wand,&montage_info->fill);
6891   DrawGetStrokeColor(drawing_wand,pixel_wand);
6892   PixelGetQuantumColor(pixel_wand,&montage_info->stroke);
6893   pixel_wand=DestroyPixelWand(pixel_wand);
6894   if (thumbnail_geometry != (char *) NULL)
6895     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6896   if (tile_geometry != (char *) NULL)
6897     (void) CloneString(&montage_info->tile,tile_geometry);
6898   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6899     wand->exception);
6900   montage_info=DestroyMontageInfo(montage_info);
6901   if (montage_image == (Image *) NULL)
6902     return((MagickWand *) NULL);
6903   return(CloneMagickWandFromImages(wand,montage_image));
6904 }
6905 \f
6906 /*
6907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6908 %                                                                             %
6909 %                                                                             %
6910 %                                                                             %
6911 %   M a g i c k M o r p h I m a g e s                                         %
6912 %                                                                             %
6913 %                                                                             %
6914 %                                                                             %
6915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6916 %
6917 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6918 %  and size are linearly interpolated to give the appearance of a
6919 %  meta-morphosis from one image to the next.
6920 %
6921 %  The format of the MagickMorphImages method is:
6922 %
6923 %      MagickWand *MagickMorphImages(MagickWand *wand,
6924 %        const unsigned long number_frames)
6925 %
6926 %  A description of each parameter follows:
6927 %
6928 %    o wand: the magick wand.
6929 %
6930 %    o number_frames: the number of in-between images to generate.
6931 %
6932 */
6933 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6934   const unsigned long number_frames)
6935 {
6936   Image
6937     *morph_image;
6938
6939   assert(wand != (MagickWand *) NULL);
6940   assert(wand->signature == WandSignature);
6941   if (wand->debug != MagickFalse)
6942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6943   if (wand->images == (Image *) NULL)
6944     return((MagickWand *) NULL);
6945   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6946   if (morph_image == (Image *) NULL)
6947     return((MagickWand *) NULL);
6948   return(CloneMagickWandFromImages(wand,morph_image));
6949 }
6950 \f
6951 /*
6952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6953 %                                                                             %
6954 %                                                                             %
6955 %                                                                             %
6956 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6957 %                                                                             %
6958 %                                                                             %
6959 %                                                                             %
6960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6961 %
6962 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6963 %  Gaussian operator of the given radius and standard deviation (sigma).
6964 %  For reasonable results, radius should be larger than sigma.  Use a
6965 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6966 %  Angle gives the angle of the blurring motion.
6967 %
6968 %  The format of the MagickMotionBlurImage method is:
6969 %
6970 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6971 %        const double radius,const double sigma,const double angle)
6972 %      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
6973 %        const ChannelType channel,const double radius,const double sigma,
6974 %        const double angle)
6975 %
6976 %  A description of each parameter follows:
6977 %
6978 %    o wand: the magick wand.
6979 %
6980 %    o channel: the image channel(s).
6981 %
6982 %    o radius: the radius of the Gaussian, in pixels, not counting
6983 %      the center pixel.
6984 %
6985 %    o sigma: the standard deviation of the Gaussian, in pixels.
6986 %
6987 %    o angle: Apply the effect along this angle.
6988 %
6989 */
6990
6991 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6992   const double radius,const double sigma,const double angle)
6993 {
6994   MagickBooleanType
6995     status;
6996
6997   status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
6998   return(status);
6999 }
7000
7001 WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7002   const ChannelType channel,const double radius,const double sigma,
7003   const double angle)
7004 {
7005   Image
7006     *blur_image;
7007
7008   assert(wand != (MagickWand *) NULL);
7009   assert(wand->signature == WandSignature);
7010   if (wand->debug != MagickFalse)
7011     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7012   if (wand->images == (Image *) NULL)
7013     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7014   blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7015     wand->exception);
7016   if (blur_image == (Image *) NULL)
7017     return(MagickFalse);
7018   ReplaceImageInList(&wand->images,blur_image);
7019   return(MagickTrue);
7020 }
7021 \f
7022 /*
7023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7024 %                                                                             %
7025 %                                                                             %
7026 %                                                                             %
7027 %   M a g i c k N e g a t e I m a g e                                         %
7028 %                                                                             %
7029 %                                                                             %
7030 %                                                                             %
7031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7032 %
7033 %  MagickNegateImage() negates the colors in the reference image.  The
7034 %  Grayscale option means that only grayscale values within the image are
7035 %  negated.
7036 %
7037 %  You can also reduce the influence of a particular channel with a gamma
7038 %  value of 0.
7039 %
7040 %  The format of the MagickNegateImage method is:
7041 %
7042 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7043 %        const MagickBooleanType gray)
7044 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7045 %        const ChannelType channel,const MagickBooleanType gray)
7046 %
7047 %  A description of each parameter follows:
7048 %
7049 %    o wand: the magick wand.
7050 %
7051 %    o channel: the image channel(s).
7052 %
7053 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7054 %
7055 */
7056
7057 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7058   const MagickBooleanType gray)
7059 {
7060   MagickBooleanType
7061     status;
7062
7063   status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7064   return(status);
7065 }
7066
7067 WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7068   const ChannelType channel,const MagickBooleanType gray)
7069 {
7070   MagickBooleanType
7071     status;
7072
7073   assert(wand != (MagickWand *) NULL);
7074   assert(wand->signature == WandSignature);
7075   if (wand->debug != MagickFalse)
7076     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7077   if (wand->images == (Image *) NULL)
7078     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7079   status=NegateImageChannel(wand->images,channel,gray);
7080   if (status == MagickFalse)
7081     InheritException(wand->exception,&wand->images->exception);
7082   return(status);
7083 }
7084 \f
7085 /*
7086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7087 %                                                                             %
7088 %                                                                             %
7089 %                                                                             %
7090 %   M a g i c k N e w I m a g e                                               %
7091 %                                                                             %
7092 %                                                                             %
7093 %                                                                             %
7094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7095 %
7096 %  MagickNewImage() adds a blank image canvas of the specified size and
7097 %  background color to the wand.
7098 %
7099 %  The format of the MagickNewImage method is:
7100 %
7101 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7102 %        const unsigned long columns,const unsigned long rows,
7103 %        const PixelWand *background)
7104 %
7105 %  A description of each parameter follows:
7106 %
7107 %    o wand: the magick wand.
7108 %
7109 %    o width: the image width.
7110 %
7111 %    o height: the image height.
7112 %
7113 %    o background: the image color.
7114 %
7115 */
7116 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7117   const unsigned long width,const unsigned long height,
7118   const PixelWand *background)
7119 {
7120   Image
7121     *images;
7122
7123   MagickPixelPacket
7124     pixel;
7125
7126   assert(wand != (MagickWand *) NULL);
7127   assert(wand->signature == WandSignature);
7128   if (wand->debug != MagickFalse)
7129     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7130   PixelGetMagickColor(background,&pixel);
7131   images=NewMagickImage(wand->image_info,width,height,&pixel);
7132   if (images == (Image *) NULL)
7133     return(MagickFalse);
7134   if (images->exception.severity != UndefinedException)
7135     InheritException(wand->exception,&images->exception);
7136   return(InsertImageInWand(wand,images));
7137 }
7138 \f
7139 /*
7140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7141 %                                                                             %
7142 %                                                                             %
7143 %                                                                             %
7144 %   M a g i c k N e x t I m a g e                                             %
7145 %                                                                             %
7146 %                                                                             %
7147 %                                                                             %
7148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7149 %
7150 %  MagickNextImage() associates the next image in the image list with a magick
7151 %  wand.
7152 %
7153 %  The format of the MagickNextImage method is:
7154 %
7155 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7156 %
7157 %  A description of each parameter follows:
7158 %
7159 %    o wand: the magick wand.
7160 %
7161 */
7162 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7163 {
7164   assert(wand != (MagickWand *) NULL);
7165   assert(wand->signature == WandSignature);
7166   if (wand->debug != MagickFalse)
7167     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7168   if (wand->images == (Image *) NULL)
7169     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7170   if (wand->pend != MagickFalse)
7171     {
7172       wand->pend=MagickFalse;
7173       return(MagickTrue);
7174     }
7175   if (GetNextImageInList(wand->images) == (Image *) NULL)
7176     {
7177       wand->pend=MagickTrue;
7178       return(MagickFalse);
7179     }
7180   wand->images=GetNextImageInList(wand->images);
7181   return(MagickTrue);
7182 }
7183 \f
7184 /*
7185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7186 %                                                                             %
7187 %                                                                             %
7188 %                                                                             %
7189 %   M a g i c k N o r m a l i z e I m a g e                                   %
7190 %                                                                             %
7191 %                                                                             %
7192 %                                                                             %
7193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7194 %
7195 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7196 %  the pixels color to span the entire range of colors available
7197 %
7198 %  You can also reduce the influence of a particular channel with a gamma
7199 %  value of 0.
7200 %
7201 %  The format of the MagickNormalizeImage method is:
7202 %
7203 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7204 %      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7205 %        const ChannelType channel)
7206 %
7207 %  A description of each parameter follows:
7208 %
7209 %    o wand: the magick wand.
7210 %
7211 %    o channel: the image channel(s).
7212 %
7213 */
7214
7215 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7216 {
7217   MagickBooleanType
7218     status;
7219
7220   status=MagickNormalizeImageChannel(wand,DefaultChannels);
7221   return(status);
7222 }
7223
7224 WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7225   const ChannelType channel)
7226 {
7227   MagickBooleanType
7228     status;
7229
7230   assert(wand != (MagickWand *) NULL);
7231   assert(wand->signature == WandSignature);
7232   if (wand->debug != MagickFalse)
7233     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7234   if (wand->images == (Image *) NULL)
7235     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7236   status=NormalizeImageChannel(wand->images,channel);
7237   if (status == MagickFalse)
7238     InheritException(wand->exception,&wand->images->exception);
7239   return(status);
7240 }
7241 \f
7242 /*
7243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7244 %                                                                             %
7245 %                                                                             %
7246 %                                                                             %
7247 %   M a g i c k O i l P a i n t I m a g e                                     %
7248 %                                                                             %
7249 %                                                                             %
7250 %                                                                             %
7251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7252 %
7253 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7254 %  painting.  Each pixel is replaced by the most frequent color occurring
7255 %  in a circular region defined by radius.
7256 %
7257 %  The format of the MagickOilPaintImage method is:
7258 %
7259 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7260 %        const double radius)
7261 %
7262 %  A description of each parameter follows:
7263 %
7264 %    o wand: the magick wand.
7265 %
7266 %    o radius: the radius of the circular neighborhood.
7267 %
7268 */
7269 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7270   const double radius)
7271 {
7272   Image
7273     *paint_image;
7274
7275   assert(wand != (MagickWand *) NULL);
7276   assert(wand->signature == WandSignature);
7277   if (wand->debug != MagickFalse)
7278     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7279   if (wand->images == (Image *) NULL)
7280     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7281   paint_image=OilPaintImage(wand->images,radius,wand->exception);
7282   if (paint_image == (Image *) NULL)
7283     return(MagickFalse);
7284   ReplaceImageInList(&wand->images,paint_image);
7285   return(MagickTrue);
7286 }
7287 \f
7288 /*
7289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7290 %                                                                             %
7291 %                                                                             %
7292 %                                                                             %
7293 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7294 %                                                                             %
7295 %                                                                             %
7296 %                                                                             %
7297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7298 %
7299 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7300 %  defined by fill.
7301 %
7302 %  The format of the MagickOpaquePaintImage method is:
7303 %
7304 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7305 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7306 %        const MagickBooleanType invert)
7307 %      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7308 %        const ChannelType channel,const PixelWand *target,
7309 %        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7310 %
7311 %  A description of each parameter follows:
7312 %
7313 %    o wand: the magick wand.
7314 %
7315 %    o channel: the channel(s).
7316 %
7317 %    o target: Change this target color to the fill color within the image.
7318 %
7319 %    o fill: the fill pixel wand.
7320 %
7321 %    o fuzz: By default target must match a particular pixel color
7322 %      exactly.  However, in many cases two colors may differ by a small amount.
7323 %      The fuzz member of image defines how much tolerance is acceptable to
7324 %      consider two colors as the same.  For example, set fuzz to 10 and the
7325 %      color red at intensities of 100 and 102 respectively are now interpreted
7326 %      as the same color for the purposes of the floodfill.
7327 %
7328 %    o invert: paint any pixel that does not match the target color.
7329 %
7330 */
7331
7332 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7333   const PixelWand *target,const PixelWand *fill,const double fuzz,
7334   const MagickBooleanType invert)
7335 {
7336   MagickBooleanType
7337     status;
7338
7339   status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7340     invert);
7341   return(status);
7342 }
7343
7344 WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7345   const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7346   const double fuzz,const MagickBooleanType invert)
7347 {
7348   MagickBooleanType
7349     status;
7350
7351   MagickPixelPacket
7352     fill_pixel,
7353     target_pixel;
7354
7355   assert(wand != (MagickWand *) NULL);
7356   assert(wand->signature == WandSignature);
7357   if (wand->debug != MagickFalse)
7358     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7359   if (wand->images == (Image *) NULL)
7360     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7361   PixelGetMagickColor(target,&target_pixel);
7362   PixelGetMagickColor(fill,&fill_pixel);
7363   wand->images->fuzz=fuzz;
7364   status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7365     &fill_pixel,invert);
7366   if (status == MagickFalse)
7367     InheritException(wand->exception,&wand->images->exception);
7368   return(status);
7369 }
7370 \f
7371 /*
7372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7373 %                                                                             %
7374 %                                                                             %
7375 %                                                                             %
7376 %   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                         %
7377 %                                                                             %
7378 %                                                                             %
7379 %                                                                             %
7380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7381 %
7382 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7383 %  previous image in the sequence.  From this it attempts to select the
7384 %  smallest cropped image to replace each frame, while preserving the results
7385 %  of the animation.
7386 %
7387 %  The format of the MagickOptimizeImageLayers method is:
7388 %
7389 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7390 %
7391 %  A description of each parameter follows:
7392 %
7393 %    o wand: the magick wand.
7394 %
7395 */
7396 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7397 {
7398   Image
7399     *optimize_image;
7400
7401   assert(wand != (MagickWand *) NULL);
7402   assert(wand->signature == WandSignature);
7403   if (wand->debug != MagickFalse)
7404     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7405   if (wand->images == (Image *) NULL)
7406     return((MagickWand *) NULL);
7407   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7408   if (optimize_image == (Image *) NULL)
7409     return((MagickWand *) NULL);
7410   return(CloneMagickWandFromImages(wand,optimize_image));
7411 }
7412 \f
7413 /*
7414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7415 %                                                                             %
7416 %                                                                             %
7417 %                                                                             %
7418 %     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                   %
7419 %                                                                             %
7420 %                                                                             %
7421 %                                                                             %
7422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7423 %
7424 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7425 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7426 %  which can be different for different channels, according to the input
7427 %  arguments.
7428 %
7429 %  The format of the MagickOrderedPosterizeImage method is:
7430 %
7431 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7432 %        const char *threshold_map)
7433 %      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7434 %        const ChannelType channel,const char *threshold_map)
7435 %
7436 %  A description of each parameter follows:
7437 %
7438 %    o image: the image.
7439 %
7440 %    o channel: the channel or channels to be thresholded.
7441 %
7442 %    o threshold_map: A string containing the name of the threshold dither
7443 %      map to use, followed by zero or more numbers representing the number of
7444 %      color levels tho dither between.
7445 %
7446 %      Any level number less than 2 is equivelent to 2, and means only binary
7447 %      dithering will be applied to each color channel.
7448 %
7449 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7450 %      channels, while a single number is the number of levels applied to each
7451 %      channel in sequence.  More numbers will be applied in turn to each of
7452 %      the color channels.
7453 %
7454 %      For example: "o3x3,6" generates a 6 level posterization of the image
7455 %      with a ordered 3x3 diffused pixel dither being applied between each
7456 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7457 %      only a single checkerboard hash pattern (50% grey) between each color
7458 %      level, to basically double the number of color levels with a bare
7459 %      minimim of dithering.
7460 %
7461 */
7462
7463 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7464   const char *threshold_map)
7465 {
7466   MagickBooleanType
7467     status;
7468
7469   status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7470   return(status);
7471 }
7472
7473 WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7474   MagickWand *wand,const ChannelType channel,const char *threshold_map)
7475 {
7476   MagickBooleanType
7477     status;
7478
7479   assert(wand != (MagickWand *) NULL);
7480   assert(wand->signature == WandSignature);
7481   if (wand->debug != MagickFalse)
7482     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7483   if (wand->images == (Image *) NULL)
7484     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7485   status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7486     wand->exception);
7487   return(status);
7488 }
7489 \f
7490 /*
7491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7492 %                                                                             %
7493 %                                                                             %
7494 %                                                                             %
7495 %   M a g i c k P i n g I m a g e                                             %
7496 %                                                                             %
7497 %                                                                             %
7498 %                                                                             %
7499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7500 %
7501 %  MagickPingImage() is like MagickReadImage() except the only valid
7502 %  information returned is the image width, height, size, and format.  It
7503 %  is designed to efficiently obtain this information from a file without
7504 %  reading the entire image sequence into memory.
7505 %
7506 %  The format of the MagickPingImage method is:
7507 %
7508 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7509 %
7510 %  A description of each parameter follows:
7511 %
7512 %    o wand: the magick wand.
7513 %
7514 %    o filename: the image filename.
7515 %
7516 */
7517 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7518   const char *filename)
7519 {
7520   Image
7521     *images;
7522
7523   ImageInfo
7524     *ping_info;
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   ping_info=CloneImageInfo(wand->image_info);
7531   if (filename != (const char *) NULL)
7532     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7533   images=PingImage(ping_info,wand->exception);
7534   ping_info=DestroyImageInfo(ping_info);
7535   if (images == (Image *) NULL)
7536     return(MagickFalse);
7537   return(InsertImageInWand(wand,images));
7538 }
7539 \f
7540 /*
7541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7542 %                                                                             %
7543 %                                                                             %
7544 %                                                                             %
7545 %   M a g i c k P i n g I m a g e B l o b                                     %
7546 %                                                                             %
7547 %                                                                             %
7548 %                                                                             %
7549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7550 %
7551 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7552 %
7553 %  The format of the MagickPingImageBlob method is:
7554 %
7555 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7556 %        const void *blob,const size_t length)
7557 %
7558 %  A description of each parameter follows:
7559 %
7560 %    o wand: the magick wand.
7561 %
7562 %    o blob: the blob.
7563 %
7564 %    o length: the blob length.
7565 %
7566 */
7567 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7568   const void *blob,const size_t length)
7569 {
7570   Image
7571     *images;
7572
7573   ImageInfo
7574     *read_info;
7575
7576   assert(wand != (MagickWand *) NULL);
7577   assert(wand->signature == WandSignature);
7578   if (wand->debug != MagickFalse)
7579     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7580   read_info=CloneImageInfo(wand->image_info);
7581   SetImageInfoBlob(read_info,blob,length);
7582   images=PingImage(read_info,wand->exception);
7583   read_info=DestroyImageInfo(read_info);
7584   if (images == (Image *) NULL)
7585     return(MagickFalse);
7586   return(InsertImageInWand(wand,images));
7587 }
7588 \f
7589 /*
7590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7591 %                                                                             %
7592 %                                                                             %
7593 %                                                                             %
7594 %   M a g i c k P i n g I m a g e F i l e                                     %
7595 %                                                                             %
7596 %                                                                             %
7597 %                                                                             %
7598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7599 %
7600 %  MagickPingImageFile() pings an image or image sequence from an open file
7601 %  descriptor.
7602 %
7603 %  The format of the MagickPingImageFile method is:
7604 %
7605 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7606 %
7607 %  A description of each parameter follows:
7608 %
7609 %    o wand: the magick wand.
7610 %
7611 %    o file: the file descriptor.
7612 %
7613 */
7614 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7615 {
7616   Image
7617     *images;
7618
7619   ImageInfo
7620     *read_info;
7621
7622   assert(wand != (MagickWand *) NULL);
7623   assert(wand->signature == WandSignature);
7624   assert(file != (FILE *) NULL);
7625   if (wand->debug != MagickFalse)
7626     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7627   read_info=CloneImageInfo(wand->image_info);
7628   SetImageInfoFile(read_info,file);
7629   images=PingImage(read_info,wand->exception);
7630   read_info=DestroyImageInfo(read_info);
7631   if (images == (Image *) NULL)
7632     return(MagickFalse);
7633   return(InsertImageInWand(wand,images));
7634 }
7635 \f
7636 /*
7637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7638 %                                                                             %
7639 %                                                                             %
7640 %                                                                             %
7641 %   M a g i c k P o l a r o i d I m a g e                                     %
7642 %                                                                             %
7643 %                                                                             %
7644 %                                                                             %
7645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7646 %
7647 %  MagickPolaroidImage() simulates a Polaroid picture.
7648 %
7649 %  The format of the MagickPolaroidImage method is:
7650 %
7651 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7652 %        const DrawingWand *drawing_wand,const double angle)
7653 %
7654 %  A description of each parameter follows:
7655 %
7656 %    o wand: the magick wand.
7657 %
7658 %    o drawing_wand: the draw wand.
7659 %
7660 %    o angle: Apply the effect along this angle.
7661 %
7662 */
7663 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7664   const DrawingWand *drawing_wand,const double angle)
7665 {
7666   DrawInfo
7667     *draw_info;
7668
7669   Image
7670     *polaroid_image;
7671
7672   assert(wand != (MagickWand *) NULL);
7673   assert(wand->signature == WandSignature);
7674   if (wand->debug != MagickFalse)
7675     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7676   if (wand->images == (Image *) NULL)
7677     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7678   draw_info=PeekDrawingWand(drawing_wand);
7679   if (draw_info == (DrawInfo *) NULL)
7680     return(MagickFalse);
7681   polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7682   if (polaroid_image == (Image *) NULL)
7683     return(MagickFalse);
7684   ReplaceImageInList(&wand->images,polaroid_image);
7685   return(MagickTrue);
7686 }
7687 \f
7688 /*
7689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7690 %                                                                             %
7691 %                                                                             %
7692 %                                                                             %
7693 %   M a g i c k P o s t e r i z e I m a g e                                   %
7694 %                                                                             %
7695 %                                                                             %
7696 %                                                                             %
7697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7698 %
7699 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7700 %
7701 %  The format of the MagickPosterizeImage method is:
7702 %
7703 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7704 %        const unsigned levels,const MagickBooleanType dither)
7705 %
7706 %  A description of each parameter follows:
7707 %
7708 %    o wand: the magick wand.
7709 %
7710 %    o levels: Number of color levels allowed in each channel.  Very low values
7711 %      (2, 3, or 4) have the most visible effect.
7712 %
7713 %    o dither: Set this integer value to something other than zero to dither
7714 %      the mapped image.
7715 %
7716 */
7717 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7718   const unsigned long levels,const MagickBooleanType dither)
7719 {
7720   MagickBooleanType
7721     status;
7722
7723   assert(wand != (MagickWand *) NULL);
7724   assert(wand->signature == WandSignature);
7725   if (wand->debug != MagickFalse)
7726     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7727   if (wand->images == (Image *) NULL)
7728     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7729   status=PosterizeImage(wand->images,levels,dither);
7730   if (status == MagickFalse)
7731     InheritException(wand->exception,&wand->images->exception);
7732   return(status);
7733 }
7734 \f
7735 /*
7736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7737 %                                                                             %
7738 %                                                                             %
7739 %                                                                             %
7740 %   M a g i c k P r e v i e w I m a g e s                                     %
7741 %                                                                             %
7742 %                                                                             %
7743 %                                                                             %
7744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7745 %
7746 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7747 %  image processing operation applied at varying strengths.  This helpful
7748 %  to quickly pin-point an appropriate parameter for an image processing
7749 %  operation.
7750 %
7751 %  The format of the MagickPreviewImages method is:
7752 %
7753 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7754 %        const PreviewType preview)
7755 %
7756 %  A description of each parameter follows:
7757 %
7758 %    o wand: the magick wand.
7759 %
7760 %    o preview: the preview type.
7761 %
7762 */
7763 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7764   const PreviewType preview)
7765 {
7766   Image
7767     *preview_image;
7768
7769   assert(wand != (MagickWand *) NULL);
7770   assert(wand->signature == WandSignature);
7771   if (wand->debug != MagickFalse)
7772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7773   if (wand->images == (Image *) NULL)
7774     return((MagickWand *) NULL);
7775   preview_image=PreviewImage(wand->images,preview,wand->exception);
7776   if (preview_image == (Image *) NULL)
7777     return((MagickWand *) NULL);
7778   return(CloneMagickWandFromImages(wand,preview_image));
7779 }
7780 \f
7781 /*
7782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7783 %                                                                             %
7784 %                                                                             %
7785 %                                                                             %
7786 %   M a g i c k P r e v i o u s I m a g e                                     %
7787 %                                                                             %
7788 %                                                                             %
7789 %                                                                             %
7790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7791 %
7792 %  MagickPreviousImage() assocates the previous image in an image list with
7793 %  the magick wand.
7794 %
7795 %  The format of the MagickPreviousImage method is:
7796 %
7797 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7798 %
7799 %  A description of each parameter follows:
7800 %
7801 %    o wand: the magick wand.
7802 %
7803 */
7804 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7805 {
7806   assert(wand != (MagickWand *) NULL);
7807   assert(wand->signature == WandSignature);
7808   if (wand->debug != MagickFalse)
7809     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7810   if (wand->images == (Image *) NULL)
7811     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7812   if (wand->pend != MagickFalse)
7813     {
7814       wand->pend=MagickFalse;
7815       return(MagickTrue);
7816     }
7817   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7818     {
7819       wand->pend=MagickTrue;
7820       return(MagickFalse);
7821     }
7822   wand->images=GetPreviousImageInList(wand->images);
7823   return(MagickTrue);
7824 }
7825 \f
7826 /*
7827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7828 %                                                                             %
7829 %                                                                             %
7830 %                                                                             %
7831 %   M a g i c k Q u a n t i z e I m a g e                                     %
7832 %                                                                             %
7833 %                                                                             %
7834 %                                                                             %
7835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7836 %
7837 %  MagickQuantizeImage() analyzes the colors within a reference image and
7838 %  chooses a fixed number of colors to represent the image.  The goal of the
7839 %  algorithm is to minimize the color difference between the input and output
7840 %  image while minimizing the processing time.
7841 %
7842 %  The format of the MagickQuantizeImage method is:
7843 %
7844 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7845 %        const unsigned long number_colors,const ColorspaceType colorspace,
7846 %        const unsigned long treedepth,const MagickBooleanType dither,
7847 %        const MagickBooleanType measure_error)
7848 %
7849 %  A description of each parameter follows:
7850 %
7851 %    o wand: the magick wand.
7852 %
7853 %    o number_colors: the number of colors.
7854 %
7855 %    o colorspace: Perform color reduction in this colorspace, typically
7856 %      RGBColorspace.
7857 %
7858 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7859 %      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
7860 %      reference image with the least amount of memory and the fastest
7861 %      computational speed.  In some cases, such as an image with low color
7862 %      dispersion (a few number of colors), a value other than
7863 %      Log4(number_colors) is required.  To expand the color tree completely,
7864 %      use a value of 8.
7865 %
7866 %    o dither: A value other than zero distributes the difference between an
7867 %      original image and the corresponding color reduced image to
7868 %      neighboring pixels along a Hilbert curve.
7869 %
7870 %    o measure_error: A value other than zero measures the difference between
7871 %      the original and quantized images.  This difference is the total
7872 %      quantization error.  The error is computed by summing over all pixels
7873 %      in an image the distance squared in RGB space between each reference
7874 %      pixel value and its quantized value.
7875 %
7876 */
7877 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7878   const unsigned long number_colors,const ColorspaceType colorspace,
7879   const unsigned long treedepth,const MagickBooleanType dither,
7880   const MagickBooleanType measure_error)
7881 {
7882   MagickBooleanType
7883     status;
7884
7885   QuantizeInfo
7886     *quantize_info;
7887
7888   assert(wand != (MagickWand *) NULL);
7889   assert(wand->signature == WandSignature);
7890   if (wand->debug != MagickFalse)
7891     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7892   if (wand->images == (Image *) NULL)
7893     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7894   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7895   quantize_info->number_colors=number_colors;
7896   quantize_info->dither=dither;
7897   quantize_info->tree_depth=treedepth;
7898   quantize_info->colorspace=colorspace;
7899   quantize_info->measure_error=measure_error;
7900   status=QuantizeImage(quantize_info,wand->images);
7901   if (status == MagickFalse)
7902     InheritException(wand->exception,&wand->images->exception);
7903   quantize_info=DestroyQuantizeInfo(quantize_info);
7904   return(status);
7905 }
7906 \f
7907 /*
7908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7909 %                                                                             %
7910 %                                                                             %
7911 %                                                                             %
7912 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7913 %                                                                             %
7914 %                                                                             %
7915 %                                                                             %
7916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7917 %
7918 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7919 %  chooses a fixed number of colors to represent the image.  The goal of the
7920 %  algorithm is to minimize the color difference between the input and output
7921 %  image while minimizing the processing time.
7922 %
7923 %  The format of the MagickQuantizeImages method is:
7924 %
7925 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7926 %        const unsigned long number_colors,const ColorspaceType colorspace,
7927 %        const unsigned long treedepth,const MagickBooleanType dither,
7928 %        const MagickBooleanType measure_error)
7929 %
7930 %  A description of each parameter follows:
7931 %
7932 %    o wand: the magick wand.
7933 %
7934 %    o number_colors: the number of colors.
7935 %
7936 %    o colorspace: Perform color reduction in this colorspace, typically
7937 %      RGBColorspace.
7938 %
7939 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7940 %      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
7941 %      reference image with the least amount of memory and the fastest
7942 %      computational speed.  In some cases, such as an image with low color
7943 %      dispersion (a few number of colors), a value other than
7944 %      Log4(number_colors) is required.  To expand the color tree completely,
7945 %      use a value of 8.
7946 %
7947 %    o dither: A value other than zero distributes the difference between an
7948 %      original image and the corresponding color reduced algorithm to
7949 %      neighboring pixels along a Hilbert curve.
7950 %
7951 %    o measure_error: A value other than zero measures the difference between
7952 %      the original and quantized images.  This difference is the total
7953 %      quantization error.  The error is computed by summing over all pixels
7954 %      in an image the distance squared in RGB space between each reference
7955 %      pixel value and its quantized value.
7956 %
7957 */
7958 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7959   const unsigned long number_colors,const ColorspaceType colorspace,
7960   const unsigned long treedepth,const MagickBooleanType dither,
7961   const MagickBooleanType measure_error)
7962 {
7963   MagickBooleanType
7964     status;
7965
7966   QuantizeInfo
7967     *quantize_info;
7968
7969   assert(wand != (MagickWand *) NULL);
7970   assert(wand->signature == WandSignature);
7971   if (wand->debug != MagickFalse)
7972     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7973   if (wand->images == (Image *) NULL)
7974     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7975   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7976   quantize_info->number_colors=number_colors;
7977   quantize_info->dither=dither;
7978   quantize_info->tree_depth=treedepth;
7979   quantize_info->colorspace=colorspace;
7980   quantize_info->measure_error=measure_error;
7981   status=QuantizeImages(quantize_info,wand->images);
7982   if (status == MagickFalse)
7983     InheritException(wand->exception,&wand->images->exception);
7984   quantize_info=DestroyQuantizeInfo(quantize_info);
7985   return(status);
7986 }
7987 \f
7988 /*
7989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7990 %                                                                             %
7991 %                                                                             %
7992 %                                                                             %
7993 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7994 %                                                                             %
7995 %                                                                             %
7996 %                                                                             %
7997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7998 %
7999 %  MagickRadialBlurImage() radial blurs an image.
8000 %
8001 %  The format of the MagickRadialBlurImage method is:
8002 %
8003 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8004 %        const double angle)
8005 %      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8006 %        const ChannelType channel,const double angle)
8007 %
8008 %  A description of each parameter follows:
8009 %
8010 %    o wand: the magick wand.
8011 %
8012 %    o channel: the image channel(s).
8013 %
8014 %    o angle: the angle of the blur in degrees.
8015 %
8016 */
8017 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8018   const double angle)
8019 {
8020   MagickBooleanType
8021     status;
8022
8023   status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8024   return(status);
8025 }
8026
8027 WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8028   const ChannelType channel,const double angle)
8029 {
8030   Image
8031     *blur_image;
8032
8033   assert(wand != (MagickWand *) NULL);
8034   assert(wand->signature == WandSignature);
8035   if (wand->debug != MagickFalse)
8036     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8037   if (wand->images == (Image *) NULL)
8038     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8039   blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8040     wand->exception);
8041   if (blur_image == (Image *) NULL)
8042     return(MagickFalse);
8043   ReplaceImageInList(&wand->images,blur_image);
8044   return(MagickTrue);
8045 }
8046 \f
8047 /*
8048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8049 %                                                                             %
8050 %                                                                             %
8051 %                                                                             %
8052 %   M a g i c k R a i s e I m a g e                                           %
8053 %                                                                             %
8054 %                                                                             %
8055 %                                                                             %
8056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8057 %
8058 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8059 %  by lightening and darkening the edges of the image.  Members width and
8060 %  height of raise_info define the width of the vertical and horizontal
8061 %  edge of the effect.
8062 %
8063 %  The format of the MagickRaiseImage method is:
8064 %
8065 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8066 %        const unsigned long width,const unsigned long height,const long x,
8067 %        const long y,const MagickBooleanType raise)
8068 %
8069 %  A description of each parameter follows:
8070 %
8071 %    o wand: the magick wand.
8072 %
8073 %    o width,height,x,y:  Define the dimensions of the area to raise.
8074 %
8075 %    o raise: A value other than zero creates a 3-D raise effect,
8076 %      otherwise it has a lowered effect.
8077 %
8078 */
8079 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8080   const unsigned long width,const unsigned long height,const long x,
8081   const long y,const MagickBooleanType raise)
8082 {
8083   MagickBooleanType
8084     status;
8085
8086   RectangleInfo
8087     raise_info;
8088
8089   assert(wand != (MagickWand *) NULL);
8090   assert(wand->signature == WandSignature);
8091   if (wand->debug != MagickFalse)
8092     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8093   if (wand->images == (Image *) NULL)
8094     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8095   raise_info.width=width;
8096   raise_info.height=height;
8097   raise_info.x=x;
8098   raise_info.y=y;
8099   status=RaiseImage(wand->images,&raise_info,raise);
8100   if (status == MagickFalse)
8101     InheritException(wand->exception,&wand->images->exception);
8102   return(status);
8103 }
8104 \f
8105 /*
8106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8107 %                                                                             %
8108 %                                                                             %
8109 %                                                                             %
8110 %   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                       %
8111 %                                                                             %
8112 %                                                                             %
8113 %                                                                             %
8114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8115 %
8116 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8117 %  the intensity of each pixel compared to threshold.  The result is a
8118 %  high-contrast, two color image.
8119 %
8120 %  The format of the MagickRandomThresholdImage method is:
8121 %
8122 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8123 %        const double low,const double high)
8124 %      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8125 %        const ChannelType channel,const double low,const double high)
8126 %
8127 %  A description of each parameter follows:
8128 %
8129 %    o wand: the magick wand.
8130 %
8131 %    o channel: the image channel(s).
8132 %
8133 %    o low,high: Specify the high and low thresholds.  These values range from
8134 %      0 to QuantumRange.
8135 %
8136 */
8137
8138 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8139   const double low,const double high)
8140 {
8141   MagickBooleanType
8142     status;
8143
8144   status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8145   return(status);
8146 }
8147
8148 WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8149   MagickWand *wand,const ChannelType channel,const double low,
8150   const double high)
8151 {
8152   char
8153     threshold[MaxTextExtent];
8154
8155   MagickBooleanType
8156     status;
8157
8158   assert(wand != (MagickWand *) NULL);
8159   assert(wand->signature == WandSignature);
8160   if (wand->debug != MagickFalse)
8161     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8162   if (wand->images == (Image *) NULL)
8163     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8164   (void) FormatMagickString(threshold,MaxTextExtent,"%gx%g",low,high);
8165   status=RandomThresholdImageChannel(wand->images,channel,threshold,
8166     wand->exception);
8167   if (status == MagickFalse)
8168     InheritException(wand->exception,&wand->images->exception);
8169   return(status);
8170 }
8171 \f
8172 /*
8173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8174 %                                                                             %
8175 %                                                                             %
8176 %                                                                             %
8177 %   M a g i c k R e a d I m a g e                                             %
8178 %                                                                             %
8179 %                                                                             %
8180 %                                                                             %
8181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8182 %
8183 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8184 %  at the current image pointer position.   Use MagickSetFirstIterator(),
8185 %  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8186 %  image pointer position at the beginning of the image list, the end, or
8187 %  anywhere in-between respectively.
8188 %
8189 %  The format of the MagickReadImage method is:
8190 %
8191 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8192 %
8193 %  A description of each parameter follows:
8194 %
8195 %    o wand: the magick wand.
8196 %
8197 %    o filename: the image filename.
8198 %
8199 */
8200 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8201   const char *filename)
8202 {
8203   Image
8204     *images;
8205
8206   ImageInfo
8207     *read_info;
8208
8209   assert(wand != (MagickWand *) NULL);
8210   assert(wand->signature == WandSignature);
8211   if (wand->debug != MagickFalse)
8212     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8213   read_info=CloneImageInfo(wand->image_info);
8214   if (filename != (const char *) NULL)
8215     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8216   images=ReadImage(read_info,wand->exception);
8217   read_info=DestroyImageInfo(read_info);
8218   if (images == (Image *) NULL)
8219     return(MagickFalse);
8220   return(InsertImageInWand(wand,images));
8221 }
8222 \f
8223 /*
8224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8225 %                                                                             %
8226 %                                                                             %
8227 %                                                                             %
8228 %   M a g i c k R e a d I m a g e B l o b                                     %
8229 %                                                                             %
8230 %                                                                             %
8231 %                                                                             %
8232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8233 %
8234 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8235 %
8236 %  The format of the MagickReadImageBlob method is:
8237 %
8238 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8239 %        const void *blob,const size_t length)
8240 %
8241 %  A description of each parameter follows:
8242 %
8243 %    o wand: the magick wand.
8244 %
8245 %    o blob: the blob.
8246 %
8247 %    o length: the blob length.
8248 %
8249 */
8250 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8251   const void *blob,const size_t length)
8252 {
8253   Image
8254     *images;
8255
8256   assert(wand != (MagickWand *) NULL);
8257   assert(wand->signature == WandSignature);
8258   if (wand->debug != MagickFalse)
8259     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8260   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8261   if (images == (Image *) NULL)
8262     return(MagickFalse);
8263   return(InsertImageInWand(wand,images));
8264 }
8265 \f
8266 /*
8267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8268 %                                                                             %
8269 %                                                                             %
8270 %                                                                             %
8271 %   M a g i c k R e a d I m a g e F i l e                                     %
8272 %                                                                             %
8273 %                                                                             %
8274 %                                                                             %
8275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8276 %
8277 %  MagickReadImageFile() reads an image or image sequence from an open file
8278 %  descriptor.
8279 %
8280 %  The format of the MagickReadImageFile method is:
8281 %
8282 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8283 %
8284 %  A description of each parameter follows:
8285 %
8286 %    o wand: the magick wand.
8287 %
8288 %    o file: the file descriptor.
8289 %
8290 */
8291 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8292 {
8293   Image
8294     *images;
8295
8296   ImageInfo
8297     *read_info;
8298
8299   assert(wand != (MagickWand *) NULL);
8300   assert(wand->signature == WandSignature);
8301   assert(file != (FILE *) NULL);
8302   if (wand->debug != MagickFalse)
8303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8304   read_info=CloneImageInfo(wand->image_info);
8305   SetImageInfoFile(read_info,file);
8306   images=ReadImage(read_info,wand->exception);
8307   read_info=DestroyImageInfo(read_info);
8308   if (images == (Image *) NULL)
8309     return(MagickFalse);
8310   return(InsertImageInWand(wand,images));
8311 }
8312 \f
8313 /*
8314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8315 %                                                                             %
8316 %                                                                             %
8317 %                                                                             %
8318 %   M a g i c k R e c o l o r I m a g e                                       %
8319 %                                                                             %
8320 %                                                                             %
8321 %                                                                             %
8322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8323 %
8324 %  MagickRecolorImage() translate, scale, shear, or rotate image colors.
8325 %  Although you can use variable sized matrices, typically you use a 5 x 5 for
8326 %  an RGBA image and a 6x6 for CMYKA.  Populate the last row with normalized
8327 %  values to translate.
8328 %
8329 %  The format of the MagickRecolorImage method is:
8330 %
8331 %      MagickBooleanType MagickRecolorImage(MagickWand *wand,
8332 %        const unsigned long order,const double *color_matrix)
8333 %
8334 %  A description of each parameter follows:
8335 %
8336 %    o wand: the magick wand.
8337 %
8338 %    o order: the number of columns and rows in the color matrix.
8339 %
8340 %    o color_matrix: An array of doubles representing the color matrix.
8341 %
8342 */
8343 WandExport MagickBooleanType MagickRecolorImage(MagickWand *wand,
8344   const unsigned long order,const double *color_matrix)
8345 {
8346   Image
8347     *transform_image;
8348
8349   assert(wand != (MagickWand *) NULL);
8350   assert(wand->signature == WandSignature);
8351   if (wand->debug != MagickFalse)
8352     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8353   if (color_matrix == (const double *) NULL)
8354     return(MagickFalse);
8355   if (wand->images == (Image *) NULL)
8356     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8357   transform_image=RecolorImage(wand->images,order,color_matrix,
8358     wand->exception);
8359   if (transform_image == (Image *) NULL)
8360     return(MagickFalse);
8361   ReplaceImageInList(&wand->images,transform_image);
8362   return(MagickTrue);
8363 }
8364 \f
8365 /*
8366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8367 %                                                                             %
8368 %                                                                             %
8369 %                                                                             %
8370 %     M a g i c k R e d u c e N o i s e I m a g e                             %
8371 %                                                                             %
8372 %                                                                             %
8373 %                                                                             %
8374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8375 %
8376 %  MagickReduceNoiseImage() smooths the contours of an image while still
8377 %  preserving edge information.  The algorithm works by replacing each pixel
8378 %  with its neighbor closest in value.  A neighbor is defined by radius.  Use
8379 %  a radius of 0 and ReduceNoise() selects a suitable radius for you.
8380 %
8381 %  The format of the MagickReduceNoiseImage method is:
8382 %
8383 %      MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8384 %        const double radius)
8385 %
8386 %  A description of each parameter follows:
8387 %
8388 %    o wand: the magick wand.
8389 %
8390 %    o radius: the radius of the pixel neighborhood.
8391 %
8392 */
8393 WandExport MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8394   const double radius)
8395 {
8396   Image
8397     *noise_image;
8398
8399   assert(wand != (MagickWand *) NULL);
8400   assert(wand->signature == WandSignature);
8401   if (wand->debug != MagickFalse)
8402     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8403   if (wand->images == (Image *) NULL)
8404     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8405   noise_image=ReduceNoiseImage(wand->images,radius,wand->exception);
8406   if (noise_image == (Image *) NULL)
8407     return(MagickFalse);
8408   ReplaceImageInList(&wand->images,noise_image);
8409   return(MagickTrue);
8410 }
8411 \f
8412 /*
8413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8414 %                                                                             %
8415 %                                                                             %
8416 %                                                                             %
8417 %   M a g i c k R e m a p I m a g e                                           %
8418 %                                                                             %
8419 %                                                                             %
8420 %                                                                             %
8421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8422 %
8423 %  MagickRemapImage() replaces the colors of an image with the closest color
8424 %  from a reference image.
8425 %
8426 %  The format of the MagickRemapImage method is:
8427 %
8428 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8429 %        const MagickWand *remap_wand,const DitherMethod method)
8430 %
8431 %  A description of each parameter follows:
8432 %
8433 %    o wand: the magick wand.
8434 %
8435 %    o affinity: the affinity wand.
8436 %
8437 %    o method: choose from these dither methods: NoDitherMethod,
8438 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8439 %
8440 */
8441 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8442   const MagickWand *remap_wand,const DitherMethod method)
8443 {
8444   MagickBooleanType
8445     status;
8446
8447   QuantizeInfo
8448     *quantize_info;
8449
8450   assert(wand != (MagickWand *) NULL);
8451   assert(wand->signature == WandSignature);
8452   if (wand->debug != MagickFalse)
8453     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8454   if ((wand->images == (Image *) NULL) ||
8455       (remap_wand->images == (Image *) NULL))
8456     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8457   quantize_info=AcquireQuantizeInfo(wand->image_info);
8458   quantize_info->dither_method=method;
8459   if (method == NoDitherMethod)
8460     quantize_info->dither=MagickFalse;
8461   status=RemapImage(quantize_info,wand->images,remap_wand->images);
8462   quantize_info=DestroyQuantizeInfo(quantize_info);
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 m o v e I m a g e                                         %
8474 %                                                                             %
8475 %                                                                             %
8476 %                                                                             %
8477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8478 %
8479 %  MagickRemoveImage() removes an image from the image list.
8480 %
8481 %  The format of the MagickRemoveImage method is:
8482 %
8483 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8484 %
8485 %  A description of each parameter follows:
8486 %
8487 %    o wand: the magick wand.
8488 %
8489 %    o insert: the splice wand.
8490 %
8491 */
8492 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8493 {
8494   assert(wand != (MagickWand *) NULL);
8495   assert(wand->signature == WandSignature);
8496   if (wand->debug != MagickFalse)
8497     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8498   if (wand->images == (Image *) NULL)
8499     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8500   DeleteImageFromList(&wand->images);
8501   return(MagickTrue);
8502 }
8503 \f
8504 /*
8505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8506 %                                                                             %
8507 %                                                                             %
8508 %                                                                             %
8509 %   M a g i c k R e s a m p l e I m a g e                                     %
8510 %                                                                             %
8511 %                                                                             %
8512 %                                                                             %
8513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8514 %
8515 %  MagickResampleImage() resample image to desired resolution.
8516 %
8517 %    Bessel   Blackman   Box
8518 %    Catrom   Cubic      Gaussian
8519 %    Hanning  Hermite    Lanczos
8520 %    Mitchell Point      Quandratic
8521 %    Sinc     Triangle
8522 %
8523 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8524 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8525 %  are windowed (brought down to zero) with the Blackman filter.
8526 %
8527 %  The format of the MagickResampleImage method is:
8528 %
8529 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8530 %        const double x_resolution,const double y_resolution,
8531 %        const FilterTypes filter,const double blur)
8532 %
8533 %  A description of each parameter follows:
8534 %
8535 %    o wand: the magick wand.
8536 %
8537 %    o x_resolution: the new image x resolution.
8538 %
8539 %    o y_resolution: the new image y resolution.
8540 %
8541 %    o filter: Image filter to use.
8542 %
8543 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8544 %
8545 */
8546 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8547   const double x_resolution,const double y_resolution,const FilterTypes filter,
8548   const double blur)
8549 {
8550   Image
8551     *resample_image;
8552
8553   assert(wand != (MagickWand *) NULL);
8554   assert(wand->signature == WandSignature);
8555   if (wand->debug != MagickFalse)
8556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8557   if (wand->images == (Image *) NULL)
8558     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8559   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8560     blur,wand->exception);
8561   if (resample_image == (Image *) NULL)
8562     return(MagickFalse);
8563   ReplaceImageInList(&wand->images,resample_image);
8564   return(MagickTrue);
8565 }
8566 \f
8567 /*
8568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8569 %                                                                             %
8570 %                                                                             %
8571 %                                                                             %
8572 %   M a g i c k R e s e t I m a g e P a g e                                   %
8573 %                                                                             %
8574 %                                                                             %
8575 %                                                                             %
8576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8577 %
8578 %  MagickResetImagePage() resets the Wand page canvas and position.
8579 %
8580 %  The format of the MagickResetImagePage method is:
8581 %
8582 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8583 %        const char *page)
8584 %
8585 %  A description of each parameter follows:
8586 %
8587 %    o wand: the magick wand.
8588 %
8589 %    o page: the relative page specification.
8590 %
8591 */
8592 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8593   const char *page)
8594 {
8595   assert(wand != (MagickWand *) NULL);
8596   assert(wand->signature == WandSignature);
8597   if (wand->debug != MagickFalse)
8598     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8599   if (wand->images == (Image *) NULL)
8600     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8601   if ((page == (char *) NULL) || (*page == '\0'))
8602     {
8603       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8604       return(MagickTrue);
8605     }
8606   return(ResetImagePage(wand->images,page));
8607 }
8608 \f
8609 /*
8610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8611 %                                                                             %
8612 %                                                                             %
8613 %                                                                             %
8614 %   M a g i c k R e s i z e I m a g e                                         %
8615 %                                                                             %
8616 %                                                                             %
8617 %                                                                             %
8618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8619 %
8620 %  MagickResizeImage() scales an image to the desired dimensions with one of
8621 %  these filters:
8622 %
8623 %    Bessel   Blackman   Box
8624 %    Catrom   Cubic      Gaussian
8625 %    Hanning  Hermite    Lanczos
8626 %    Mitchell Point      Quandratic
8627 %    Sinc     Triangle
8628 %
8629 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8630 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8631 %  are windowed (brought down to zero) with the Blackman filter.
8632 %
8633 %  The format of the MagickResizeImage method is:
8634 %
8635 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8636 %        const unsigned long columns,const unsigned long rows,
8637 %        const FilterTypes filter,const double blur)
8638 %
8639 %  A description of each parameter follows:
8640 %
8641 %    o wand: the magick wand.
8642 %
8643 %    o columns: the number of columns in the scaled image.
8644 %
8645 %    o rows: the number of rows in the scaled image.
8646 %
8647 %    o filter: Image filter to use.
8648 %
8649 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8650 %
8651 */
8652 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8653   const unsigned long columns,const unsigned long rows,const FilterTypes filter,
8654   const double blur)
8655 {
8656   Image
8657     *resize_image;
8658
8659   assert(wand != (MagickWand *) NULL);
8660   assert(wand->signature == WandSignature);
8661   if (wand->debug != MagickFalse)
8662     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8663   if (wand->images == (Image *) NULL)
8664     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8665   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8666     wand->exception);
8667   if (resize_image == (Image *) NULL)
8668     return(MagickFalse);
8669   ReplaceImageInList(&wand->images,resize_image);
8670   return(MagickTrue);
8671 }
8672 \f
8673 /*
8674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8675 %                                                                             %
8676 %                                                                             %
8677 %                                                                             %
8678 %   M a g i c k R o l l I m a g e                                             %
8679 %                                                                             %
8680 %                                                                             %
8681 %                                                                             %
8682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8683 %
8684 %  MagickRollImage() offsets an image as defined by x and y.
8685 %
8686 %  The format of the MagickRollImage method is:
8687 %
8688 %      MagickBooleanType MagickRollImage(MagickWand *wand,const long x,
8689 %        const unsigned long y)
8690 %
8691 %  A description of each parameter follows:
8692 %
8693 %    o wand: the magick wand.
8694 %
8695 %    o x: the x offset.
8696 %
8697 %    o y: the y offset.
8698 %
8699 %
8700 */
8701 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8702   const long x,const long y)
8703 {
8704   Image
8705     *roll_image;
8706
8707   assert(wand != (MagickWand *) NULL);
8708   assert(wand->signature == WandSignature);
8709   if (wand->debug != MagickFalse)
8710     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8711   if (wand->images == (Image *) NULL)
8712     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8713   roll_image=RollImage(wand->images,x,y,wand->exception);
8714   if (roll_image == (Image *) NULL)
8715     return(MagickFalse);
8716   ReplaceImageInList(&wand->images,roll_image);
8717   return(MagickTrue);
8718 }
8719 \f
8720 /*
8721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8722 %                                                                             %
8723 %                                                                             %
8724 %                                                                             %
8725 %   M a g i c k R o t a t e I m a g e                                         %
8726 %                                                                             %
8727 %                                                                             %
8728 %                                                                             %
8729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8730 %
8731 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8732 %  triangles left over from rotating the image are filled with the
8733 %  background color.
8734 %
8735 %  The format of the MagickRotateImage method is:
8736 %
8737 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8738 %        const PixelWand *background,const double degrees)
8739 %
8740 %  A description of each parameter follows:
8741 %
8742 %    o wand: the magick wand.
8743 %
8744 %    o background: the background pixel wand.
8745 %
8746 %    o degrees: the number of degrees to rotate the image.
8747 %
8748 %
8749 */
8750 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8751   const PixelWand *background,const double degrees)
8752 {
8753   Image
8754     *rotate_image;
8755
8756   assert(wand != (MagickWand *) NULL);
8757   assert(wand->signature == WandSignature);
8758   if (wand->debug != MagickFalse)
8759     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8760   if (wand->images == (Image *) NULL)
8761     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8762   PixelGetQuantumColor(background,&wand->images->background_color);
8763   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8764   if (rotate_image == (Image *) NULL)
8765     return(MagickFalse);
8766   ReplaceImageInList(&wand->images,rotate_image);
8767   return(MagickTrue);
8768 }
8769 \f
8770 /*
8771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8772 %                                                                             %
8773 %                                                                             %
8774 %                                                                             %
8775 %   M a g i c k S a m p l e I m a g e                                         %
8776 %                                                                             %
8777 %                                                                             %
8778 %                                                                             %
8779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8780 %
8781 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8782 %  sampling.  Unlike other scaling methods, this method does not introduce
8783 %  any additional color into the scaled image.
8784 %
8785 %  The format of the MagickSampleImage method is:
8786 %
8787 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8788 %        const unsigned long columns,const unsigned long rows)
8789 %
8790 %  A description of each parameter follows:
8791 %
8792 %    o wand: the magick wand.
8793 %
8794 %    o columns: the number of columns in the scaled image.
8795 %
8796 %    o rows: the number of rows in the scaled image.
8797 %
8798 %
8799 */
8800 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8801   const unsigned long columns,const unsigned long rows)
8802 {
8803   Image
8804     *sample_image;
8805
8806   assert(wand != (MagickWand *) NULL);
8807   assert(wand->signature == WandSignature);
8808   if (wand->debug != MagickFalse)
8809     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8810   if (wand->images == (Image *) NULL)
8811     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8812   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8813   if (sample_image == (Image *) NULL)
8814     return(MagickFalse);
8815   ReplaceImageInList(&wand->images,sample_image);
8816   return(MagickTrue);
8817 }
8818 \f
8819 /*
8820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8821 %                                                                             %
8822 %                                                                             %
8823 %                                                                             %
8824 %   M a g i c k S c a l e I m a g e                                           %
8825 %                                                                             %
8826 %                                                                             %
8827 %                                                                             %
8828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8829 %
8830 %  MagickScaleImage() scales the size of an image to the given dimensions.
8831 %
8832 %  The format of the MagickScaleImage method is:
8833 %
8834 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8835 %        const unsigned long columns,const unsigned long rows)
8836 %
8837 %  A description of each parameter follows:
8838 %
8839 %    o wand: the magick wand.
8840 %
8841 %    o columns: the number of columns in the scaled image.
8842 %
8843 %    o rows: the number of rows in the scaled image.
8844 %
8845 %
8846 */
8847 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8848   const unsigned long columns,const unsigned long rows)
8849 {
8850   Image
8851     *scale_image;
8852
8853   assert(wand != (MagickWand *) NULL);
8854   assert(wand->signature == WandSignature);
8855   if (wand->debug != MagickFalse)
8856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8857   if (wand->images == (Image *) NULL)
8858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8859   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8860   if (scale_image == (Image *) NULL)
8861     return(MagickFalse);
8862   ReplaceImageInList(&wand->images,scale_image);
8863   return(MagickTrue);
8864 }
8865 \f
8866 /*
8867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8868 %                                                                             %
8869 %                                                                             %
8870 %                                                                             %
8871 %   M a g i c k S e g m e n t I m a g e                                       %
8872 %                                                                             %
8873 %                                                                             %
8874 %                                                                             %
8875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8876 %
8877 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8878 %  color components and identifying units that are homogeneous with the fuzzy
8879 %  C-means technique.
8880 %
8881 %  The format of the SegmentImage method is:
8882 %
8883 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8884 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8885 %        const double cluster_threshold,const double smooth_threshold)
8886 %
8887 %  A description of each parameter follows.
8888 %
8889 %    o wand: the wand.
8890 %
8891 %    o colorspace: the image colorspace.
8892 %
8893 %    o verbose:  Set to MagickTrue to print detailed information about the
8894 %      identified classes.
8895 %
8896 %    o cluster_threshold:  This represents the minimum number of pixels
8897 %      contained in a hexahedra before it can be considered valid (expressed as
8898 %      a percentage).
8899 %
8900 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8901 %      derivative of the histogram.  As the value is increased, you can expect a
8902 %      smoother second derivative.
8903 %
8904 */
8905 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8906   const ColorspaceType colorspace,const MagickBooleanType verbose,
8907   const double cluster_threshold,const double smooth_threshold)
8908 {
8909   MagickBooleanType
8910     status;
8911
8912   assert(wand != (MagickWand *) NULL);
8913   assert(wand->signature == WandSignature);
8914   if (wand->debug != MagickFalse)
8915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8916   if (wand->images == (Image *) NULL)
8917     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8918   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8919     smooth_threshold);
8920   if (status == MagickFalse)
8921     InheritException(wand->exception,&wand->images->exception);
8922   return(status);
8923 }
8924 \f
8925 /*
8926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8927 %                                                                             %
8928 %                                                                             %
8929 %                                                                             %
8930 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8931 %                                                                             %
8932 %                                                                             %
8933 %                                                                             %
8934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8935 %
8936 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8937 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8938 %  contrast above a certain threshold.
8939 %
8940 %  The format of the MagickSelectiveBlurImage method is:
8941 %
8942 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8943 %        const double radius,const double sigma,const double threshold)
8944 %      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
8945 %        const ChannelType channel,const double radius,const double sigma,
8946 %        const double threshold)
8947 %
8948 %  A description of each parameter follows:
8949 %
8950 %    o wand: the magick wand.
8951 %
8952 %    o channel: the image channel(s).
8953 %
8954 %    o radius: the radius of the gaussian, in pixels, not counting the center
8955 %      pixel.
8956 %
8957 %    o sigma: the standard deviation of the gaussian, in pixels.
8958 %
8959 %    o threshold: only pixels within this contrast threshold are included
8960 %      in the blur operation.
8961 %
8962 */
8963
8964 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8965   const double radius,const double sigma,const double threshold)
8966 {
8967   MagickBooleanType
8968     status;
8969
8970   status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
8971     threshold);
8972   return(status);
8973 }
8974
8975 WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
8976   const ChannelType channel,const double radius,const double sigma,
8977   const double threshold)
8978 {
8979   Image
8980     *blur_image;
8981
8982   assert(wand != (MagickWand *) NULL);
8983   assert(wand->signature == WandSignature);
8984   if (wand->debug != MagickFalse)
8985     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8986   if (wand->images == (Image *) NULL)
8987     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8988   blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
8989     threshold,wand->exception);
8990   if (blur_image == (Image *) NULL)
8991     return(MagickFalse);
8992   ReplaceImageInList(&wand->images,blur_image);
8993   return(MagickTrue);
8994 }
8995 \f
8996 /*
8997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8998 %                                                                             %
8999 %                                                                             %
9000 %                                                                             %
9001 %   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                       %
9002 %                                                                             %
9003 %                                                                             %
9004 %                                                                             %
9005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9006 %
9007 %  MagickSeparateImageChannel() separates a channel from the image and returns a
9008 %  grayscale image.  A channel is a particular color component of each pixel
9009 %  in the image.
9010 %
9011 %  The format of the MagickSeparateImageChannel method is:
9012 %
9013 %      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9014 %        const ChannelType channel)
9015 %
9016 %  A description of each parameter follows:
9017 %
9018 %    o wand: the magick wand.
9019 %
9020 %    o channel: the image channel(s).
9021 %
9022 */
9023 WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9024   const ChannelType channel)
9025 {
9026   MagickBooleanType
9027     status;
9028
9029   assert(wand != (MagickWand *) NULL);
9030   assert(wand->signature == WandSignature);
9031   if (wand->debug != MagickFalse)
9032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9033   if (wand->images == (Image *) NULL)
9034     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9035   status=SeparateImageChannel(wand->images,channel);
9036   if (status == MagickFalse)
9037     InheritException(wand->exception,&wand->images->exception);
9038   return(status);
9039 }
9040 \f
9041 /*
9042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9043 %                                                                             %
9044 %                                                                             %
9045 %                                                                             %
9046 %     M a g i c k S e p i a T o n e I m a g e                                 %
9047 %                                                                             %
9048 %                                                                             %
9049 %                                                                             %
9050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9051 %
9052 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
9053 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9054 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9055 %  threshold of 80% is a good starting point for a reasonable tone.
9056 %
9057 %  The format of the MagickSepiaToneImage method is:
9058 %
9059 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9060 %        const double threshold)
9061 %
9062 %  A description of each parameter follows:
9063 %
9064 %    o wand: the magick wand.
9065 %
9066 %    o threshold:  Define the extent of the sepia toning.
9067 %
9068 */
9069 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9070   const double threshold)
9071 {
9072   Image
9073     *sepia_image;
9074
9075   assert(wand != (MagickWand *) NULL);
9076   assert(wand->signature == WandSignature);
9077   if (wand->debug != MagickFalse)
9078     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9079   if (wand->images == (Image *) NULL)
9080     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9081   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9082   if (sepia_image == (Image *) NULL)
9083     return(MagickFalse);
9084   ReplaceImageInList(&wand->images,sepia_image);
9085   return(MagickTrue);
9086 }
9087 \f
9088 /*
9089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9090 %                                                                             %
9091 %                                                                             %
9092 %                                                                             %
9093 %   M a g i c k S e t I m a g e                                               %
9094 %                                                                             %
9095 %                                                                             %
9096 %                                                                             %
9097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9098 %
9099 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9100 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
9101 %  wand.
9102 %
9103 %  The format of the MagickSetImage method is:
9104 %
9105 %      MagickBooleanType MagickSetImage(MagickWand *wand,
9106 %        const MagickWand *set_wand)
9107 %
9108 %  A description of each parameter follows:
9109 %
9110 %    o wand: the magick wand.
9111 %
9112 %    o set_wand: the set_wand wand.
9113 %
9114 */
9115 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9116   const MagickWand *set_wand)
9117 {
9118   Image
9119     *images;
9120
9121   assert(wand != (MagickWand *) NULL);
9122   assert(wand->signature == WandSignature);
9123   if (wand->debug != MagickFalse)
9124     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9125   assert(set_wand != (MagickWand *) NULL);
9126   assert(set_wand->signature == WandSignature);
9127   if (wand->debug != MagickFalse)
9128     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9129   if (set_wand->images == (Image *) NULL)
9130     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9131   images=CloneImageList(set_wand->images,wand->exception);
9132   if (images == (Image *) NULL)
9133     return(MagickFalse);
9134   ReplaceImageInList(&wand->images,images);
9135   return(MagickTrue);
9136 }
9137 \f
9138 /*
9139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9140 %                                                                             %
9141 %                                                                             %
9142 %                                                                             %
9143 %   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                       %
9144 %                                                                             %
9145 %                                                                             %
9146 %                                                                             %
9147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9148 %
9149 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9150 %  alpha channel.
9151 %
9152 %  The format of the MagickSetImageAlphaChannel method is:
9153 %
9154 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9155 %        const AlphaChannelType alpha_type)
9156 %
9157 %  A description of each parameter follows:
9158 %
9159 %    o wand: the magick wand.
9160 %
9161 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9162 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9163 %
9164 */
9165 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9166   const AlphaChannelType alpha_type)
9167 {
9168   assert(wand != (MagickWand *) NULL);
9169   assert(wand->signature == WandSignature);
9170   if (wand->debug != MagickFalse)
9171     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9172   if (wand->images == (Image *) NULL)
9173     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9174   return(SetImageAlphaChannel(wand->images,alpha_type));
9175 }
9176 \f
9177 /*
9178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9179 %                                                                             %
9180 %                                                                             %
9181 %                                                                             %
9182 %   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                 %
9183 %                                                                             %
9184 %                                                                             %
9185 %                                                                             %
9186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9187 %
9188 %  MagickSetImageBackgroundColor() sets the image background color.
9189 %
9190 %  The format of the MagickSetImageBackgroundColor method is:
9191 %
9192 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9193 %        const PixelWand *background)
9194 %
9195 %  A description of each parameter follows:
9196 %
9197 %    o wand: the magick wand.
9198 %
9199 %    o background: the background pixel wand.
9200 %
9201 */
9202 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9203   const PixelWand *background)
9204 {
9205   assert(wand != (MagickWand *) NULL);
9206   assert(wand->signature == WandSignature);
9207   if (wand->debug != MagickFalse)
9208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9209   if (wand->images == (Image *) NULL)
9210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9211   PixelGetQuantumColor(background,&wand->images->background_color);
9212   return(MagickTrue);
9213 }
9214 \f
9215 /*
9216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9217 %                                                                             %
9218 %                                                                             %
9219 %                                                                             %
9220 %   M a g i c k S e t I m a g e B i a s                                       %
9221 %                                                                             %
9222 %                                                                             %
9223 %                                                                             %
9224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9225 %
9226 %  MagickSetImageBias() sets the image bias for any method that convolves an
9227 %  image (e.g. MagickConvolveImage()).
9228 %
9229 %  The format of the MagickSetImageBias method is:
9230 %
9231 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9232 %        const double bias)
9233 %
9234 %  A description of each parameter follows:
9235 %
9236 %    o wand: the magick wand.
9237 %
9238 %    o bias: the image bias.
9239 %
9240 */
9241 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9242   const double bias)
9243 {
9244   assert(wand != (MagickWand *) NULL);
9245   assert(wand->signature == WandSignature);
9246   if (wand->debug != MagickFalse)
9247     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9248   if (wand->images == (Image *) NULL)
9249     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9250   wand->images->bias=bias;
9251   return(MagickTrue);
9252 }
9253 \f
9254 /*
9255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9256 %                                                                             %
9257 %                                                                             %
9258 %                                                                             %
9259 %   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                         %
9260 %                                                                             %
9261 %                                                                             %
9262 %                                                                             %
9263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9264 %
9265 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9266 %
9267 %  The format of the MagickSetImageBluePrimary method is:
9268 %
9269 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9270 %        const double x,const double y)
9271 %
9272 %  A description of each parameter follows:
9273 %
9274 %    o wand: the magick wand.
9275 %
9276 %    o x: the blue primary x-point.
9277 %
9278 %    o y: the blue primary y-point.
9279 %
9280 */
9281 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9282   const double x,const double y)
9283 {
9284   assert(wand != (MagickWand *) NULL);
9285   assert(wand->signature == WandSignature);
9286   if (wand->debug != MagickFalse)
9287     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9288   if (wand->images == (Image *) NULL)
9289     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9290   wand->images->chromaticity.blue_primary.x=x;
9291   wand->images->chromaticity.blue_primary.y=y;
9292   return(MagickTrue);
9293 }
9294 \f
9295 /*
9296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9297 %                                                                             %
9298 %                                                                             %
9299 %                                                                             %
9300 %   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                         %
9301 %                                                                             %
9302 %                                                                             %
9303 %                                                                             %
9304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9305 %
9306 %  MagickSetImageBorderColor() sets the image border color.
9307 %
9308 %  The format of the MagickSetImageBorderColor method is:
9309 %
9310 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9311 %        const PixelWand *border)
9312 %
9313 %  A description of each parameter follows:
9314 %
9315 %    o wand: the magick wand.
9316 %
9317 %    o border: the border pixel wand.
9318 %
9319 */
9320 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9321   const PixelWand *border)
9322 {
9323   assert(wand != (MagickWand *) NULL);
9324   assert(wand->signature == WandSignature);
9325   if (wand->debug != MagickFalse)
9326     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9327   if (wand->images == (Image *) NULL)
9328     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9329   PixelGetQuantumColor(border,&wand->images->border_color);
9330   return(MagickTrue);
9331 }
9332 \f
9333 /*
9334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9335 %                                                                             %
9336 %                                                                             %
9337 %                                                                             %
9338 %   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                       %
9339 %                                                                             %
9340 %                                                                             %
9341 %                                                                             %
9342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9343 %
9344 %  MagickSetImageChannelDepth() sets the depth of a particular image channel.
9345 %
9346 %  The format of the MagickSetImageChannelDepth method is:
9347 %
9348 %      MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9349 %        const ChannelType channel,const unsigned long depth)
9350 %
9351 %  A description of each parameter follows:
9352 %
9353 %    o wand: the magick wand.
9354 %
9355 %    o channel: the image channel(s).
9356 %
9357 %    o depth: the image depth in bits.
9358 %
9359 */
9360 WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9361   const ChannelType channel,const unsigned long depth)
9362 {
9363   assert(wand != (MagickWand *) NULL);
9364   assert(wand->signature == WandSignature);
9365   if (wand->debug != MagickFalse)
9366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9367   if (wand->images == (Image *) NULL)
9368     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9369   return(SetImageChannelDepth(wand->images,channel,depth));
9370 }
9371 \f
9372 /*
9373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9374 %                                                                             %
9375 %                                                                             %
9376 %                                                                             %
9377 %   M a g i c k S e t I m a g e C l i p M a s k                               %
9378 %                                                                             %
9379 %                                                                             %
9380 %                                                                             %
9381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9382 %
9383 %  MagickSetImageClipMask() sets image clip mask.
9384 %
9385 %  The format of the MagickSetImageClipMask method is:
9386 %
9387 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9388 %        const MagickWand *clip_mask)
9389 %
9390 %  A description of each parameter follows:
9391 %
9392 %    o wand: the magick wand.
9393 %
9394 %    o clip_mask: the clip_mask wand.
9395 %
9396 */
9397 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9398   const MagickWand *clip_mask)
9399 {
9400   assert(wand != (MagickWand *) NULL);
9401   assert(wand->signature == WandSignature);
9402   if (wand->debug != MagickFalse)
9403     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9404   assert(clip_mask != (MagickWand *) NULL);
9405   assert(clip_mask->signature == WandSignature);
9406   if (wand->debug != MagickFalse)
9407     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9408   if (clip_mask->images == (Image *) NULL)
9409     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9410   return(SetImageClipMask(wand->images,clip_mask->images));
9411 }
9412 \f
9413 /*
9414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9415 %                                                                             %
9416 %                                                                             %
9417 %                                                                             %
9418 %   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                     %
9419 %                                                                             %
9420 %                                                                             %
9421 %                                                                             %
9422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9423 %
9424 %  MagickSetImageColormapColor() sets the color of the specified colormap
9425 %  index.
9426 %
9427 %  The format of the MagickSetImageColormapColor method is:
9428 %
9429 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9430 %        const unsigned long index,const PixelWand *color)
9431 %
9432 %  A description of each parameter follows:
9433 %
9434 %    o wand: the magick wand.
9435 %
9436 %    o index: the offset into the image colormap.
9437 %
9438 %    o color: Return the colormap color in this wand.
9439 %
9440 */
9441 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9442   const unsigned long index,const PixelWand *color)
9443 {
9444   assert(wand != (MagickWand *) NULL);
9445   assert(wand->signature == WandSignature);
9446   if (wand->debug != MagickFalse)
9447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9448   if (wand->images == (Image *) NULL)
9449     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9450   if ((wand->images->colormap == (PixelPacket *) NULL) ||
9451       (index >= wand->images->colors))
9452     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9453   PixelGetQuantumColor(color,wand->images->colormap+index);
9454   return(SyncImage(wand->images));
9455 }
9456 \f
9457 /*
9458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9459 %                                                                             %
9460 %                                                                             %
9461 %                                                                             %
9462 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9463 %                                                                             %
9464 %                                                                             %
9465 %                                                                             %
9466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9467 %
9468 %  MagickSetImageColorspace() sets the image colorspace.
9469 %
9470 %  The format of the MagickSetImageColorspace method is:
9471 %
9472 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9473 %        const ColorspaceType colorspace)
9474 %
9475 %  A description of each parameter follows:
9476 %
9477 %    o wand: the magick wand.
9478 %
9479 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9480 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9481 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9482 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9483 %      HSLColorspace, or HWBColorspace.
9484 %
9485 */
9486 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9487   const ColorspaceType colorspace)
9488 {
9489   assert(wand != (MagickWand *) NULL);
9490   assert(wand->signature == WandSignature);
9491   if (wand->debug != MagickFalse)
9492     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9493   if (wand->images == (Image *) NULL)
9494     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9495   return(SetImageColorspace(wand->images,colorspace));
9496 }
9497 \f
9498 /*
9499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9500 %                                                                             %
9501 %                                                                             %
9502 %                                                                             %
9503 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9504 %                                                                             %
9505 %                                                                             %
9506 %                                                                             %
9507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9508 %
9509 %  MagickSetImageCompose() sets the image composite operator, useful for
9510 %  specifying how to composite the image thumbnail when using the
9511 %  MagickMontageImage() method.
9512 %
9513 %  The format of the MagickSetImageCompose method is:
9514 %
9515 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9516 %        const CompositeOperator compose)
9517 %
9518 %  A description of each parameter follows:
9519 %
9520 %    o wand: the magick wand.
9521 %
9522 %    o compose: the image composite operator.
9523 %
9524 */
9525 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9526   const CompositeOperator compose)
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->compose=compose;
9535   return(MagickTrue);
9536 }
9537 \f
9538 /*
9539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9540 %                                                                             %
9541 %                                                                             %
9542 %                                                                             %
9543 %   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                         %
9544 %                                                                             %
9545 %                                                                             %
9546 %                                                                             %
9547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9548 %
9549 %  MagickSetImageCompression() sets the image compression.
9550 %
9551 %  The format of the MagickSetImageCompression method is:
9552 %
9553 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9554 %        const CompressionType compression)
9555 %
9556 %  A description of each parameter follows:
9557 %
9558 %    o wand: the magick wand.
9559 %
9560 %    o compression: the image compression type.
9561 %
9562 */
9563 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9564   const CompressionType compression)
9565 {
9566   assert(wand != (MagickWand *) NULL);
9567   assert(wand->signature == WandSignature);
9568   if (wand->debug != MagickFalse)
9569     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9570   if (wand->images == (Image *) NULL)
9571     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9572   wand->images->compression=compression;
9573   return(MagickTrue);
9574 }
9575 \f
9576 /*
9577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9578 %                                                                             %
9579 %                                                                             %
9580 %                                                                             %
9581 %   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           %
9582 %                                                                             %
9583 %                                                                             %
9584 %                                                                             %
9585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9586 %
9587 %  MagickSetImageCompressionQuality() sets the image compression quality.
9588 %
9589 %  The format of the MagickSetImageCompressionQuality method is:
9590 %
9591 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9592 %        const unsigned long quality)
9593 %
9594 %  A description of each parameter follows:
9595 %
9596 %    o wand: the magick wand.
9597 %
9598 %    o quality: the image compression tlityype.
9599 %
9600 */
9601 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9602   const unsigned long quality)
9603 {
9604   assert(wand != (MagickWand *) NULL);
9605   assert(wand->signature == WandSignature);
9606   if (wand->debug != MagickFalse)
9607     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9608   if (wand->images == (Image *) NULL)
9609     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9610   wand->images->quality=quality;
9611   return(MagickTrue);
9612 }
9613 \f
9614 /*
9615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9616 %                                                                             %
9617 %                                                                             %
9618 %                                                                             %
9619 %   M a g i c k S e t I m a g e D e l a y                                     %
9620 %                                                                             %
9621 %                                                                             %
9622 %                                                                             %
9623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9624 %
9625 %  MagickSetImageDelay() sets the image delay.
9626 %
9627 %  The format of the MagickSetImageDelay method is:
9628 %
9629 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9630 %        const unsigned long delay)
9631 %
9632 %  A description of each parameter follows:
9633 %
9634 %    o wand: the magick wand.
9635 %
9636 %    o delay: the image delay in ticks-per-second units.
9637 %
9638 */
9639 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9640   const unsigned long delay)
9641 {
9642   assert(wand != (MagickWand *) NULL);
9643   assert(wand->signature == WandSignature);
9644   if (wand->debug != MagickFalse)
9645     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9646   if (wand->images == (Image *) NULL)
9647     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9648   wand->images->delay=delay;
9649   return(MagickTrue);
9650 }
9651 \f
9652 /*
9653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9654 %                                                                             %
9655 %                                                                             %
9656 %                                                                             %
9657 %   M a g i c k S e t I m a g e D e p t h                                     %
9658 %                                                                             %
9659 %                                                                             %
9660 %                                                                             %
9661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9662 %
9663 %  MagickSetImageDepth() sets the image depth.
9664 %
9665 %  The format of the MagickSetImageDepth method is:
9666 %
9667 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9668 %        const unsigned long depth)
9669 %
9670 %  A description of each parameter follows:
9671 %
9672 %    o wand: the magick wand.
9673 %
9674 %    o depth: the image depth in bits: 8, 16, or 32.
9675 %
9676 */
9677 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9678   const unsigned long depth)
9679 {
9680   assert(wand != (MagickWand *) NULL);
9681   assert(wand->signature == WandSignature);
9682   if (wand->debug != MagickFalse)
9683     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9684   if (wand->images == (Image *) NULL)
9685     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9686   wand->images->depth=depth;
9687   return(MagickTrue);
9688 }
9689 \f
9690 /*
9691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9692 %                                                                             %
9693 %                                                                             %
9694 %                                                                             %
9695 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9696 %                                                                             %
9697 %                                                                             %
9698 %                                                                             %
9699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9700 %
9701 %  MagickSetImageDispose() sets the image disposal method.
9702 %
9703 %  The format of the MagickSetImageDispose method is:
9704 %
9705 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9706 %        const DisposeType dispose)
9707 %
9708 %  A description of each parameter follows:
9709 %
9710 %    o wand: the magick wand.
9711 %
9712 %    o dispose: the image disposeal type.
9713 %
9714 */
9715 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9716   const DisposeType dispose)
9717 {
9718   assert(wand != (MagickWand *) NULL);
9719   assert(wand->signature == WandSignature);
9720   if (wand->debug != MagickFalse)
9721     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9722   if (wand->images == (Image *) NULL)
9723     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9724   wand->images->dispose=dispose;
9725   return(MagickTrue);
9726 }
9727 \f
9728 /*
9729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9730 %                                                                             %
9731 %                                                                             %
9732 %                                                                             %
9733 %   M a g i c k S e t I m a g e E x t e n t                                   %
9734 %                                                                             %
9735 %                                                                             %
9736 %                                                                             %
9737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9738 %
9739 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9740 %
9741 %  The format of the MagickSetImageExtent method is:
9742 %
9743 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9744 %        const unsigned long columns,const unsigned rows)
9745 %
9746 %  A description of each parameter follows:
9747 %
9748 %    o wand: the magick wand.
9749 %
9750 %    o columns:  The image width in pixels.
9751 %
9752 %    o rows:  The image height in pixels.
9753 %
9754 */
9755 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9756   const unsigned long columns,const unsigned long rows)
9757 {
9758   assert(wand != (MagickWand *) NULL);
9759   assert(wand->signature == WandSignature);
9760   if (wand->debug != MagickFalse)
9761     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9762   if (wand->images == (Image *) NULL)
9763     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9764   return(SetImageExtent(wand->images,columns,rows));
9765 }
9766 \f
9767 /*
9768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9769 %                                                                             %
9770 %                                                                             %
9771 %                                                                             %
9772 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9773 %                                                                             %
9774 %                                                                             %
9775 %                                                                             %
9776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9777 %
9778 %  MagickSetImageFilename() sets the filename of a particular image in a
9779 %  sequence.
9780 %
9781 %  The format of the MagickSetImageFilename method is:
9782 %
9783 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9784 %        const char *filename)
9785 %
9786 %  A description of each parameter follows:
9787 %
9788 %    o wand: the magick wand.
9789 %
9790 %    o filename: the image filename.
9791 %
9792 */
9793 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9794   const char *filename)
9795 {
9796   assert(wand != (MagickWand *) NULL);
9797   assert(wand->signature == WandSignature);
9798   if (wand->debug != MagickFalse)
9799     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9800   if (wand->images == (Image *) NULL)
9801     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9802   if (filename != (const char *) NULL)
9803     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9804   return(MagickTrue);
9805 }
9806 \f
9807 /*
9808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9809 %                                                                             %
9810 %                                                                             %
9811 %                                                                             %
9812 %   M a g i c k S e t I m a g e F o r m a t                                   %
9813 %                                                                             %
9814 %                                                                             %
9815 %                                                                             %
9816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9817 %
9818 %  MagickSetImageFormat() sets the format of a particular image in a
9819 %  sequence.
9820 %
9821 %  The format of the MagickSetImageFormat method is:
9822 %
9823 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9824 %        const char *format)
9825 %
9826 %  A description of each parameter follows:
9827 %
9828 %    o wand: the magick wand.
9829 %
9830 %    o format: the image format.
9831 %
9832 */
9833 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9834   const char *format)
9835 {
9836   const MagickInfo
9837     *magick_info;
9838
9839   assert(wand != (MagickWand *) NULL);
9840   assert(wand->signature == WandSignature);
9841   if (wand->debug != MagickFalse)
9842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9843   if (wand->images == (Image *) NULL)
9844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9845   if ((format == (char *) NULL) || (*format == '\0'))
9846     {
9847       *wand->images->magick='\0';
9848       return(MagickTrue);
9849     }
9850   magick_info=GetMagickInfo(format,wand->exception);
9851   if (magick_info == (const MagickInfo *) NULL)
9852     return(MagickFalse);
9853   ClearMagickException(wand->exception);
9854   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9855   return(MagickTrue);
9856 }
9857 \f
9858 /*
9859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9860 %                                                                             %
9861 %                                                                             %
9862 %                                                                             %
9863 %   M a g i c k S e t I m a g e F u z z                                       %
9864 %                                                                             %
9865 %                                                                             %
9866 %                                                                             %
9867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9868 %
9869 %  MagickSetImageFuzz() sets the image fuzz.
9870 %
9871 %  The format of the MagickSetImageFuzz method is:
9872 %
9873 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9874 %        const double fuzz)
9875 %
9876 %  A description of each parameter follows:
9877 %
9878 %    o wand: the magick wand.
9879 %
9880 %    o fuzz: the image fuzz.
9881 %
9882 */
9883 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9884   const double fuzz)
9885 {
9886   assert(wand != (MagickWand *) NULL);
9887   assert(wand->signature == WandSignature);
9888   if (wand->debug != MagickFalse)
9889     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9890   if (wand->images == (Image *) NULL)
9891     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9892   wand->images->fuzz=fuzz;
9893   return(MagickTrue);
9894 }
9895 \f
9896 /*
9897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9898 %                                                                             %
9899 %                                                                             %
9900 %                                                                             %
9901 %   M a g i c k S e t I m a g e G a m m a                                     %
9902 %                                                                             %
9903 %                                                                             %
9904 %                                                                             %
9905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9906 %
9907 %  MagickSetImageGamma() sets the image gamma.
9908 %
9909 %  The format of the MagickSetImageGamma method is:
9910 %
9911 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9912 %        const double gamma)
9913 %
9914 %  A description of each parameter follows:
9915 %
9916 %    o wand: the magick wand.
9917 %
9918 %    o gamma: the image gamma.
9919 %
9920 */
9921 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9922   const double gamma)
9923 {
9924   assert(wand != (MagickWand *) NULL);
9925   assert(wand->signature == WandSignature);
9926   if (wand->debug != MagickFalse)
9927     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9928   if (wand->images == (Image *) NULL)
9929     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9930   wand->images->gamma=gamma;
9931   return(MagickTrue);
9932 }
9933 \f
9934 /*
9935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9936 %                                                                             %
9937 %                                                                             %
9938 %                                                                             %
9939 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9940 %                                                                             %
9941 %                                                                             %
9942 %                                                                             %
9943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9944 %
9945 %  MagickSetImageGravity() sets the image gravity type.
9946 %
9947 %  The format of the MagickSetImageGravity method is:
9948 %
9949 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9950 %        const GravityType gravity)
9951 %
9952 %  A description of each parameter follows:
9953 %
9954 %    o wand: the magick wand.
9955 %
9956 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9957 %      PlaneInterlace, PartitionInterlace.
9958 %
9959 */
9960 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9961   const GravityType gravity)
9962 {
9963   assert(wand != (MagickWand *) NULL);
9964   assert(wand->signature == WandSignature);
9965   if (wand->debug != MagickFalse)
9966     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9967   if (wand->images == (Image *) NULL)
9968     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9969   wand->images->gravity=gravity;
9970   return(MagickTrue);
9971 }
9972 \f
9973 /*
9974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9975 %                                                                             %
9976 %                                                                             %
9977 %                                                                             %
9978 %   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                       %
9979 %                                                                             %
9980 %                                                                             %
9981 %                                                                             %
9982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9983 %
9984 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9985 %  point.
9986 %
9987 %  The format of the MagickSetImageGreenPrimary method is:
9988 %
9989 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9990 %        const double x,const double y)
9991 %
9992 %  A description of each parameter follows:
9993 %
9994 %    o wand: the magick wand.
9995 %
9996 %    o x: the green primary x-point.
9997 %
9998 %    o y: the green primary y-point.
9999 %
10000 %
10001 */
10002 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10003   const double x,const double y)
10004 {
10005   assert(wand != (MagickWand *) NULL);
10006   assert(wand->signature == WandSignature);
10007   if (wand->debug != MagickFalse)
10008     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10009   if (wand->images == (Image *) NULL)
10010     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10011   wand->images->chromaticity.green_primary.x=x;
10012   wand->images->chromaticity.green_primary.y=y;
10013   return(MagickTrue);
10014 }
10015 \f
10016 /*
10017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10018 %                                                                             %
10019 %                                                                             %
10020 %                                                                             %
10021 %   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                 %
10022 %                                                                             %
10023 %                                                                             %
10024 %                                                                             %
10025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10026 %
10027 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10028 %
10029 %  The format of the MagickSetImageInterlaceScheme method is:
10030 %
10031 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10032 %        const InterlaceType interlace)
10033 %
10034 %  A description of each parameter follows:
10035 %
10036 %    o wand: the magick wand.
10037 %
10038 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10039 %      PlaneInterlace, PartitionInterlace.
10040 %
10041 */
10042 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10043   const InterlaceType interlace)
10044 {
10045   assert(wand != (MagickWand *) NULL);
10046   assert(wand->signature == WandSignature);
10047   if (wand->debug != MagickFalse)
10048     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10049   if (wand->images == (Image *) NULL)
10050     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10051   wand->images->interlace=interlace;
10052   return(MagickTrue);
10053 }
10054 \f
10055 /*
10056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10057 %                                                                             %
10058 %                                                                             %
10059 %                                                                             %
10060 %   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             %
10061 %                                                                             %
10062 %                                                                             %
10063 %                                                                             %
10064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10065 %
10066 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10067 %
10068 %  The format of the MagickSetImageInterpolateMethod method is:
10069 %
10070 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10071 %        const InterpolatePixelMethod method)
10072 %
10073 %  A description of each parameter follows:
10074 %
10075 %    o wand: the magick wand.
10076 %
10077 %    o method: the image interpole pixel methods: choose from Undefined,
10078 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10079 %
10080 */
10081 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10082   const InterpolatePixelMethod method)
10083 {
10084   assert(wand != (MagickWand *) NULL);
10085   assert(wand->signature == WandSignature);
10086   if (wand->debug != MagickFalse)
10087     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10088   if (wand->images == (Image *) NULL)
10089     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10090   wand->images->interpolate=method;
10091   return(MagickTrue);
10092 }
10093 \f
10094 /*
10095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10096 %                                                                             %
10097 %                                                                             %
10098 %                                                                             %
10099 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10100 %                                                                             %
10101 %                                                                             %
10102 %                                                                             %
10103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10104 %
10105 %  MagickSetImageIterations() sets the image iterations.
10106 %
10107 %  The format of the MagickSetImageIterations method is:
10108 %
10109 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10110 %        const unsigned long iterations)
10111 %
10112 %  A description of each parameter follows:
10113 %
10114 %    o wand: the magick wand.
10115 %
10116 %    o delay: the image delay in 1/100th of a second.
10117 %
10118 */
10119 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10120   const unsigned long iterations)
10121 {
10122   assert(wand != (MagickWand *) NULL);
10123   assert(wand->signature == WandSignature);
10124   if (wand->debug != MagickFalse)
10125     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10126   if (wand->images == (Image *) NULL)
10127     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10128   wand->images->iterations=iterations;
10129   return(MagickTrue);
10130 }
10131 \f
10132 /*
10133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10134 %                                                                             %
10135 %                                                                             %
10136 %                                                                             %
10137 %   M a g i c k S e t I m a g e M a t t e                                     %
10138 %                                                                             %
10139 %                                                                             %
10140 %                                                                             %
10141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10142 %
10143 %  MagickSetImageMatte() sets the image matte channel.
10144 %
10145 %  The format of the MagickSetImageMatteColor method is:
10146 %
10147 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10148 %        const MagickBooleanType *matte)
10149 %
10150 %  A description of each parameter follows:
10151 %
10152 %    o wand: the magick wand.
10153 %
10154 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10155 %      MagickFalse.
10156 %
10157 */
10158 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10159   const MagickBooleanType matte)
10160 {
10161   assert(wand != (MagickWand *) NULL);
10162   assert(wand->signature == WandSignature);
10163   if (wand->debug != MagickFalse)
10164     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10165   if (wand->images == (Image *) NULL)
10166     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10167   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10168     (void) SetImageOpacity(wand->images,OpaqueOpacity);
10169   wand->images->matte=matte;
10170   return(MagickTrue);
10171 }
10172 \f
10173 /*
10174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10175 %                                                                             %
10176 %                                                                             %
10177 %                                                                             %
10178 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10179 %                                                                             %
10180 %                                                                             %
10181 %                                                                             %
10182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10183 %
10184 %  MagickSetImageMatteColor() sets the image matte color.
10185 %
10186 %  The format of the MagickSetImageMatteColor method is:
10187 %
10188 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10189 %        const PixelWand *matte)
10190 %
10191 %  A description of each parameter follows:
10192 %
10193 %    o wand: the magick wand.
10194 %
10195 %    o matte: the matte pixel wand.
10196 %
10197 */
10198 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10199   const PixelWand *matte)
10200 {
10201   assert(wand != (MagickWand *) NULL);
10202   assert(wand->signature == WandSignature);
10203   if (wand->debug != MagickFalse)
10204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10205   if (wand->images == (Image *) NULL)
10206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10207   PixelGetQuantumColor(matte,&wand->images->matte_color);
10208   return(MagickTrue);
10209 }
10210 \f
10211 /*
10212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10213 %                                                                             %
10214 %                                                                             %
10215 %                                                                             %
10216 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10217 %                                                                             %
10218 %                                                                             %
10219 %                                                                             %
10220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10221 %
10222 %  MagickSetImageOpacity() sets the image to the specified opacity level.
10223 %
10224 %  The format of the MagickSetImageOpacity method is:
10225 %
10226 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10227 %        const double alpha)
10228 %
10229 %  A description of each parameter follows:
10230 %
10231 %    o wand: the magick wand.
10232 %
10233 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10234 %      transparent.
10235 %
10236 */
10237 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10238   const double alpha)
10239 {
10240   MagickBooleanType
10241     status;
10242
10243   assert(wand != (MagickWand *) NULL);
10244   assert(wand->signature == WandSignature);
10245   if (wand->debug != MagickFalse)
10246     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10247   if (wand->images == (Image *) NULL)
10248     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10249   status=SetImageOpacity(wand->images,RoundToQuantum((MagickRealType)
10250     QuantumRange-QuantumRange*alpha));
10251   if (status == MagickFalse)
10252     InheritException(wand->exception,&wand->images->exception);
10253   return(status);
10254 }
10255 \f
10256 /*
10257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10258 %                                                                             %
10259 %                                                                             %
10260 %                                                                             %
10261 %   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                         %
10262 %                                                                             %
10263 %                                                                             %
10264 %                                                                             %
10265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10266 %
10267 %  MagickSetImageOrientation() sets the image orientation.
10268 %
10269 %  The format of the MagickSetImageOrientation method is:
10270 %
10271 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10272 %        const OrientationType orientation)
10273 %
10274 %  A description of each parameter follows:
10275 %
10276 %    o wand: the magick wand.
10277 %
10278 %    o orientation: the image orientation type.
10279 %
10280 */
10281 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10282   const OrientationType orientation)
10283 {
10284   assert(wand != (MagickWand *) NULL);
10285   assert(wand->signature == WandSignature);
10286   if (wand->debug != MagickFalse)
10287     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10288   if (wand->images == (Image *) NULL)
10289     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10290   wand->images->orientation=orientation;
10291   return(MagickTrue);
10292 }
10293 \f
10294 /*
10295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10296 %                                                                             %
10297 %                                                                             %
10298 %                                                                             %
10299 %   M a g i c k S e t I m a g e P a g e                                       %
10300 %                                                                             %
10301 %                                                                             %
10302 %                                                                             %
10303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10304 %
10305 %  MagickSetImagePage() sets the page geometry of the image.
10306 %
10307 %  The format of the MagickSetImagePage method is:
10308 %
10309 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10310 %        const unsigned long width,const unsigned long height,const long x,
10311 %        const long y)
10312 %
10313 %  A description of each parameter follows:
10314 %
10315 %    o wand: the magick wand.
10316 %
10317 %    o width: the page width.
10318 %
10319 %    o height: the page height.
10320 %
10321 %    o x: the page x-offset.
10322 %
10323 %    o y: the page y-offset.
10324 %
10325 */
10326 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10327   const unsigned long width,const unsigned long height,const long x,
10328   const long y)
10329 {
10330   assert(wand != (MagickWand *) NULL);
10331   assert(wand->signature == WandSignature);
10332   if (wand->debug != MagickFalse)
10333     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10334   if (wand->images == (Image *) NULL)
10335     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10336   wand->images->page.width=width;
10337   wand->images->page.height=height;
10338   wand->images->page.x=x;
10339   wand->images->page.y=y;
10340   return(MagickTrue);
10341 }
10342 \f
10343 /*
10344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10345 %                                                                             %
10346 %                                                                             %
10347 %                                                                             %
10348 %   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                 %
10349 %                                                                             %
10350 %                                                                             %
10351 %                                                                             %
10352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10353 %
10354 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10355 %  specified method and returns the previous progress monitor if any.  The
10356 %  progress monitor method looks like this:
10357 %
10358 %    MagickBooleanType MagickProgressMonitor(const char *text,
10359 %      const MagickOffsetType offset,const MagickSizeType span,
10360 %      void *client_data)
10361 %
10362 %  If the progress monitor returns MagickFalse, the current operation is
10363 %  interrupted.
10364 %
10365 %  The format of the MagickSetImageProgressMonitor method is:
10366 %
10367 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10368 %        const MagickProgressMonitor progress_monitor,void *client_data)
10369 %
10370 %  A description of each parameter follows:
10371 %
10372 %    o wand: the magick wand.
10373 %
10374 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10375 %      of an image operation.
10376 %
10377 %    o client_data: Specifies a pointer to any client data.
10378 %
10379 */
10380 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10381   const MagickProgressMonitor progress_monitor,void *client_data)
10382 {
10383   MagickProgressMonitor
10384     previous_monitor;
10385
10386   assert(wand != (MagickWand *) NULL);
10387   assert(wand->signature == WandSignature);
10388   if (wand->debug != MagickFalse)
10389     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10390   if (wand->images == (Image *) NULL)
10391     {
10392       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10393         "ContainsNoImages","`%s'",wand->name);
10394       return((MagickProgressMonitor) NULL);
10395     }
10396   previous_monitor=SetImageProgressMonitor(wand->images,
10397     progress_monitor,client_data);
10398   return(previous_monitor);
10399 }
10400 \f
10401 /*
10402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10403 %                                                                             %
10404 %                                                                             %
10405 %                                                                             %
10406 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10407 %                                                                             %
10408 %                                                                             %
10409 %                                                                             %
10410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10411 %
10412 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10413 %
10414 %  The format of the MagickSetImageRedPrimary method is:
10415 %
10416 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10417 %        const double x,const double y)
10418 %
10419 %  A description of each parameter follows:
10420 %
10421 %    o wand: the magick wand.
10422 %
10423 %    o x: the red primary x-point.
10424 %
10425 %    o y: the red primary y-point.
10426 %
10427 */
10428 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10429   const double x,const double y)
10430 {
10431   assert(wand != (MagickWand *) NULL);
10432   assert(wand->signature == WandSignature);
10433   if (wand->debug != MagickFalse)
10434     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10435   if (wand->images == (Image *) NULL)
10436     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10437   wand->images->chromaticity.red_primary.x=x;
10438   wand->images->chromaticity.red_primary.y=y;
10439   return(MagickTrue);
10440 }
10441 \f
10442 /*
10443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10444 %                                                                             %
10445 %                                                                             %
10446 %                                                                             %
10447 %   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                 %
10448 %                                                                             %
10449 %                                                                             %
10450 %                                                                             %
10451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10452 %
10453 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10454 %
10455 %  The format of the MagickSetImageRenderingIntent method is:
10456 %
10457 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10458 %        const RenderingIntent rendering_intent)
10459 %
10460 %  A description of each parameter follows:
10461 %
10462 %    o wand: the magick wand.
10463 %
10464 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10465 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10466 %
10467 */
10468 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10469   const RenderingIntent rendering_intent)
10470 {
10471   assert(wand != (MagickWand *) NULL);
10472   assert(wand->signature == WandSignature);
10473   if (wand->debug != MagickFalse)
10474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10475   if (wand->images == (Image *) NULL)
10476     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10477   wand->images->rendering_intent=rendering_intent;
10478   return(MagickTrue);
10479 }
10480 \f
10481 /*
10482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10483 %                                                                             %
10484 %                                                                             %
10485 %                                                                             %
10486 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10487 %                                                                             %
10488 %                                                                             %
10489 %                                                                             %
10490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10491 %
10492 %  MagickSetImageResolution() sets the image resolution.
10493 %
10494 %  The format of the MagickSetImageResolution method is:
10495 %
10496 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10497 %        const double x_resolution,const doubtl y_resolution)
10498 %
10499 %  A description of each parameter follows:
10500 %
10501 %    o wand: the magick wand.
10502 %
10503 %    o x_resolution: the image x resolution.
10504 %
10505 %    o y_resolution: the image y resolution.
10506 %
10507 */
10508 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10509   const double x_resolution,const double y_resolution)
10510 {
10511   assert(wand != (MagickWand *) NULL);
10512   assert(wand->signature == WandSignature);
10513   if (wand->debug != MagickFalse)
10514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10515   if (wand->images == (Image *) NULL)
10516     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10517   wand->images->x_resolution=x_resolution;
10518   wand->images->y_resolution=y_resolution;
10519   return(MagickTrue);
10520 }
10521 \f
10522 /*
10523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10524 %                                                                             %
10525 %                                                                             %
10526 %                                                                             %
10527 %   M a g i c k S e t I m a g e S c e n e                                     %
10528 %                                                                             %
10529 %                                                                             %
10530 %                                                                             %
10531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10532 %
10533 %  MagickSetImageScene() sets the image scene.
10534 %
10535 %  The format of the MagickSetImageScene method is:
10536 %
10537 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10538 %        const unsigned long scene)
10539 %
10540 %  A description of each parameter follows:
10541 %
10542 %    o wand: the magick wand.
10543 %
10544 %    o delay: the image scene number.
10545 %
10546 */
10547 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10548   const unsigned long scene)
10549 {
10550   assert(wand != (MagickWand *) NULL);
10551   assert(wand->signature == WandSignature);
10552   if (wand->debug != MagickFalse)
10553     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10554   if (wand->images == (Image *) NULL)
10555     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10556   wand->images->scene=scene;
10557   return(MagickTrue);
10558 }
10559 \f
10560 /*
10561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10562 %                                                                             %
10563 %                                                                             %
10564 %                                                                             %
10565 %   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                   %
10566 %                                                                             %
10567 %                                                                             %
10568 %                                                                             %
10569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10570 %
10571 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10572 %
10573 %  The format of the MagickSetImageTicksPerSecond method is:
10574 %
10575 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10576 %        const long ticks_per-second)
10577 %
10578 %  A description of each parameter follows:
10579 %
10580 %    o wand: the magick wand.
10581 %
10582 %    o ticks_per_second: the units to use for the image delay.
10583 %
10584 */
10585 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10586   const long ticks_per_second)
10587 {
10588   assert(wand != (MagickWand *) NULL);
10589   assert(wand->signature == WandSignature);
10590   if (wand->debug != MagickFalse)
10591     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10592   if (wand->images == (Image *) NULL)
10593     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10594   wand->images->ticks_per_second=ticks_per_second;
10595   return(MagickTrue);
10596 }
10597 \f
10598 /*
10599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10600 %                                                                             %
10601 %                                                                             %
10602 %                                                                             %
10603 %   M a g i c k S e t I m a g e T y p e                                       %
10604 %                                                                             %
10605 %                                                                             %
10606 %                                                                             %
10607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10608 %
10609 %  MagickSetImageType() sets the image type.
10610 %
10611 %  The format of the MagickSetImageType method is:
10612 %
10613 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10614 %        const ImageType image_type)
10615 %
10616 %  A description of each parameter follows:
10617 %
10618 %    o wand: the magick wand.
10619 %
10620 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10621 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10622 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10623 %      or OptimizeType.
10624 %
10625 */
10626 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10627   const ImageType image_type)
10628 {
10629   assert(wand != (MagickWand *) NULL);
10630   assert(wand->signature == WandSignature);
10631   if (wand->debug != MagickFalse)
10632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10633   if (wand->images == (Image *) NULL)
10634     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10635   return(SetImageType(wand->images,image_type));
10636 }
10637 \f
10638 /*
10639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10640 %                                                                             %
10641 %                                                                             %
10642 %                                                                             %
10643 %   M a g i c k S e t I m a g e U n i t s                                     %
10644 %                                                                             %
10645 %                                                                             %
10646 %                                                                             %
10647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10648 %
10649 %  MagickSetImageUnits() sets the image units of resolution.
10650 %
10651 %  The format of the MagickSetImageUnits method is:
10652 %
10653 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10654 %        const ResolutionType units)
10655 %
10656 %  A description of each parameter follows:
10657 %
10658 %    o wand: the magick wand.
10659 %
10660 %    o units: the image units of resolution : UndefinedResolution,
10661 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10662 %
10663 */
10664 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10665   const ResolutionType units)
10666 {
10667   assert(wand != (MagickWand *) NULL);
10668   assert(wand->signature == WandSignature);
10669   if (wand->debug != MagickFalse)
10670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10671   if (wand->images == (Image *) NULL)
10672     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10673   wand->images->units=units;
10674   return(MagickTrue);
10675 }
10676 \f
10677 /*
10678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10679 %                                                                             %
10680 %                                                                             %
10681 %                                                                             %
10682 %   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           %
10683 %                                                                             %
10684 %                                                                             %
10685 %                                                                             %
10686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10687 %
10688 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10689 %
10690 %  The format of the MagickSetImageVirtualPixelMethod method is:
10691 %
10692 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10693 %        const VirtualPixelMethod method)
10694 %
10695 %  A description of each parameter follows:
10696 %
10697 %    o wand: the magick wand.
10698 %
10699 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10700 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10701 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10702 %
10703 */
10704 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10705   const VirtualPixelMethod method)
10706 {
10707   assert(wand != (MagickWand *) NULL);
10708   assert(wand->signature == WandSignature);
10709   if (wand->debug != MagickFalse)
10710     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10711   if (wand->images == (Image *) NULL)
10712     return(UndefinedVirtualPixelMethod);
10713   return(SetImageVirtualPixelMethod(wand->images,method));
10714 }
10715 \f
10716 /*
10717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10718 %                                                                             %
10719 %                                                                             %
10720 %                                                                             %
10721 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10722 %                                                                             %
10723 %                                                                             %
10724 %                                                                             %
10725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10726 %
10727 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10728 %
10729 %  The format of the MagickSetImageWhitePoint method is:
10730 %
10731 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10732 %        const double x,const double y)
10733 %
10734 %  A description of each parameter follows:
10735 %
10736 %    o wand: the magick wand.
10737 %
10738 %    o x: the white x-point.
10739 %
10740 %    o y: the white y-point.
10741 %
10742 */
10743 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10744   const double x,const double y)
10745 {
10746   assert(wand != (MagickWand *) NULL);
10747   assert(wand->signature == WandSignature);
10748   if (wand->debug != MagickFalse)
10749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10750   if (wand->images == (Image *) NULL)
10751     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10752   wand->images->chromaticity.white_point.x=x;
10753   wand->images->chromaticity.white_point.y=y;
10754   return(MagickTrue);
10755 }
10756 \f
10757 /*
10758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10759 %                                                                             %
10760 %                                                                             %
10761 %                                                                             %
10762 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10763 %                                                                             %
10764 %                                                                             %
10765 %                                                                             %
10766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10767 %
10768 %  MagickShadeImage() shines a distant light on an image to create a
10769 %  three-dimensional effect. You control the positioning of the light with
10770 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10771 %  and elevation is measured in pixels above the Z axis.
10772 %
10773 %  The format of the MagickShadeImage method is:
10774 %
10775 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10776 %        const MagickBooleanType gray,const double azimuth,
10777 %        const double elevation)
10778 %
10779 %  A description of each parameter follows:
10780 %
10781 %    o wand: the magick wand.
10782 %
10783 %    o gray: A value other than zero shades the intensity of each pixel.
10784 %
10785 %    o azimuth, elevation:  Define the light source direction.
10786 %
10787 */
10788 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10789   const MagickBooleanType gray,const double asimuth,const double elevation)
10790 {
10791   Image
10792     *shade_image;
10793
10794   assert(wand != (MagickWand *) NULL);
10795   assert(wand->signature == WandSignature);
10796   if (wand->debug != MagickFalse)
10797     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10798   if (wand->images == (Image *) NULL)
10799     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10800   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10801   if (shade_image == (Image *) NULL)
10802     return(MagickFalse);
10803   ReplaceImageInList(&wand->images,shade_image);
10804   return(MagickTrue);
10805 }
10806 \f
10807 /*
10808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10809 %                                                                             %
10810 %                                                                             %
10811 %                                                                             %
10812 %   M a g i c k S h a d o w I m a g e                                         %
10813 %                                                                             %
10814 %                                                                             %
10815 %                                                                             %
10816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10817 %
10818 %  MagickShadowImage() simulates an image shadow.
10819 %
10820 %  The format of the MagickShadowImage method is:
10821 %
10822 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10823 %        const double opacity,const double sigma,const long x,const long y)
10824 %
10825 %  A description of each parameter follows:
10826 %
10827 %    o wand: the magick wand.
10828 %
10829 %    o opacity: percentage transparency.
10830 %
10831 %    o sigma: the standard deviation of the Gaussian, in pixels.
10832 %
10833 %    o x: the shadow x-offset.
10834 %
10835 %    o y: the shadow y-offset.
10836 %
10837 */
10838 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10839   const double opacity,const double sigma,const long x,const long y)
10840 {
10841   Image
10842     *shadow_image;
10843
10844   assert(wand != (MagickWand *) NULL);
10845   assert(wand->signature == WandSignature);
10846   if (wand->debug != MagickFalse)
10847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10848   if (wand->images == (Image *) NULL)
10849     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10850   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10851   if (shadow_image == (Image *) NULL)
10852     return(MagickFalse);
10853   ReplaceImageInList(&wand->images,shadow_image);
10854   return(MagickTrue);
10855 }
10856 \f
10857 /*
10858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10859 %                                                                             %
10860 %                                                                             %
10861 %                                                                             %
10862 %   M a g i c k S h a r p e n I m a g e                                       %
10863 %                                                                             %
10864 %                                                                             %
10865 %                                                                             %
10866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10867 %
10868 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10869 %  Gaussian operator of the given radius and standard deviation (sigma).
10870 %  For reasonable results, the radius should be larger than sigma.  Use a
10871 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10872 %
10873 %  The format of the MagickSharpenImage method is:
10874 %
10875 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10876 %        const double radius,const double sigma)
10877 %      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
10878 %        const ChannelType channel,const double radius,const double sigma)
10879 %
10880 %  A description of each parameter follows:
10881 %
10882 %    o wand: the magick wand.
10883 %
10884 %    o channel: the image channel(s).
10885 %
10886 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10887 %      pixel.
10888 %
10889 %    o sigma: the standard deviation of the Gaussian, in pixels.
10890 %
10891 */
10892
10893 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10894   const double radius,const double sigma)
10895 {
10896   MagickBooleanType
10897     status;
10898
10899   status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
10900   return(status);
10901 }
10902
10903 WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
10904   const ChannelType channel,const double radius,const double sigma)
10905 {
10906   Image
10907     *sharp_image;
10908
10909   assert(wand != (MagickWand *) NULL);
10910   assert(wand->signature == WandSignature);
10911   if (wand->debug != MagickFalse)
10912     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10913   if (wand->images == (Image *) NULL)
10914     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10915   sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
10916     wand->exception);
10917   if (sharp_image == (Image *) NULL)
10918     return(MagickFalse);
10919   ReplaceImageInList(&wand->images,sharp_image);
10920   return(MagickTrue);
10921 }
10922 \f
10923 /*
10924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10925 %                                                                             %
10926 %                                                                             %
10927 %                                                                             %
10928 %   M a g i c k S h a v e I m a g e                                           %
10929 %                                                                             %
10930 %                                                                             %
10931 %                                                                             %
10932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10933 %
10934 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10935 %  memory necessary for the new Image structure and returns a pointer to the
10936 %  new image.
10937 %
10938 %  The format of the MagickShaveImage method is:
10939 %
10940 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10941 %        const unsigned long columns,const unsigned long rows)
10942 %
10943 %  A description of each parameter follows:
10944 %
10945 %    o wand: the magick wand.
10946 %
10947 %    o columns: the number of columns in the scaled image.
10948 %
10949 %    o rows: the number of rows in the scaled image.
10950 %
10951 %
10952 */
10953 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10954   const unsigned long columns,const unsigned long rows)
10955 {
10956   Image
10957     *shave_image;
10958
10959   RectangleInfo
10960     shave_info;
10961
10962   assert(wand != (MagickWand *) NULL);
10963   assert(wand->signature == WandSignature);
10964   if (wand->debug != MagickFalse)
10965     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10966   if (wand->images == (Image *) NULL)
10967     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10968   shave_info.width=columns;
10969   shave_info.height=rows;
10970   shave_info.x=0;
10971   shave_info.y=0;
10972   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10973   if (shave_image == (Image *) NULL)
10974     return(MagickFalse);
10975   ReplaceImageInList(&wand->images,shave_image);
10976   return(MagickTrue);
10977 }
10978 \f
10979 /*
10980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10981 %                                                                             %
10982 %                                                                             %
10983 %                                                                             %
10984 %   M a g i c k S h e a r I m a g e                                           %
10985 %                                                                             %
10986 %                                                                             %
10987 %                                                                             %
10988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10989 %
10990 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10991 %  creating a parallelogram.  An X direction shear slides an edge along the X
10992 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10993 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10994 %  is measured relative to the Y axis, and similarly, for Y direction shears
10995 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10996 %  shearing the image are filled with the background color.
10997 %
10998 %  The format of the MagickShearImage method is:
10999 %
11000 %      MagickBooleanType MagickShearImage(MagickWand *wand,
11001 %        const PixelWand *background,const double x_shear,onst double y_shear)
11002 %
11003 %  A description of each parameter follows:
11004 %
11005 %    o wand: the magick wand.
11006 %
11007 %    o background: the background pixel wand.
11008 %
11009 %    o x_shear: the number of degrees to shear the image.
11010 %
11011 %    o y_shear: the number of degrees to shear the image.
11012 %
11013 */
11014 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11015   const PixelWand *background,const double x_shear,const double y_shear)
11016 {
11017   Image
11018     *shear_image;
11019
11020   assert(wand != (MagickWand *) NULL);
11021   assert(wand->signature == WandSignature);
11022   if (wand->debug != MagickFalse)
11023     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11024   if (wand->images == (Image *) NULL)
11025     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11026   PixelGetQuantumColor(background,&wand->images->background_color);
11027   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11028   if (shear_image == (Image *) NULL)
11029     return(MagickFalse);
11030   ReplaceImageInList(&wand->images,shear_image);
11031   return(MagickTrue);
11032 }
11033 \f
11034 /*
11035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11036 %                                                                             %
11037 %                                                                             %
11038 %                                                                             %
11039 %   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                   %
11040 %                                                                             %
11041 %                                                                             %
11042 %                                                                             %
11043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11044 %
11045 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11046 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11047 %  image using a sigmoidal transfer function without saturating highlights or
11048 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11049 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11050 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11051 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11052 %  is reduced.
11053 %
11054 %  The format of the MagickSigmoidalContrastImage method is:
11055 %
11056 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11057 %        const MagickBooleanType sharpen,const double alpha,const double beta)
11058 %      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11059 %        const ChannelType channel,const MagickBooleanType sharpen,
11060 %        const double alpha,const double beta)
11061 %
11062 %  A description of each parameter follows:
11063 %
11064 %    o wand: the magick wand.
11065 %
11066 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
11067 %
11068 %    o sharpen: Increase or decrease image contrast.
11069 %
11070 %    o alpha: control the "shoulder" of the contast curve.
11071 %
11072 %    o beta: control the "toe" of the contast curve.
11073 %
11074 */
11075
11076 WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11077   const MagickBooleanType sharpen,const double alpha,const double beta)
11078 {
11079   MagickBooleanType
11080     status;
11081
11082   status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11083     alpha,beta);
11084   return(status);
11085 }
11086
11087 WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11088   MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11089   const double alpha,const double beta)
11090 {
11091   MagickBooleanType
11092     status;
11093
11094   assert(wand != (MagickWand *) NULL);
11095   assert(wand->signature == WandSignature);
11096   if (wand->debug != MagickFalse)
11097     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11098   if (wand->images == (Image *) NULL)
11099     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11100   status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11101   if (status == MagickFalse)
11102     InheritException(wand->exception,&wand->images->exception);
11103   return(status);
11104 }
11105 \f
11106 /*
11107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11108 %                                                                             %
11109 %                                                                             %
11110 %                                                                             %
11111 %   M a g i c k S i m i l a r i t y I m a g e                                 %
11112 %                                                                             %
11113 %                                                                             %
11114 %                                                                             %
11115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11116 %
11117 %  MagickSimilarityImage() compares the reference image of the image and
11118 %  returns the best match offset.  In addition, it returns a similarity image
11119 %  such that an exact match location is completely white and if none of the
11120 %  pixels match, black, otherwise some gray level in-between.
11121 %
11122 %  The format of the MagickSimilarityImage method is:
11123 %
11124 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
11125 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11126 %
11127 %  A description of each parameter follows:
11128 %
11129 %    o wand: the magick wand.
11130 %
11131 %    o reference: the reference wand.
11132 %
11133 %    o offset: the best match offset of the reference image within the image.
11134 %
11135 %    o similarity: the computed similarity between the images.
11136 %
11137 */
11138 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11139   const MagickWand *reference,RectangleInfo *offset,double *similarity)
11140 {
11141   Image
11142     *similarity_image;
11143
11144   assert(wand != (MagickWand *) NULL);
11145   assert(wand->signature == WandSignature);
11146   if (wand->debug != MagickFalse)
11147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11148   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11149     {
11150       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11151         "ContainsNoImages","`%s'",wand->name);
11152       return((MagickWand *) NULL);
11153     }
11154   similarity_image=SimilarityImage(wand->images,reference->images,offset,
11155     similarity,&wand->images->exception);
11156   if (similarity_image == (Image *) NULL)
11157     return((MagickWand *) NULL);
11158   return(CloneMagickWandFromImages(wand,similarity_image));
11159 }
11160 \f
11161 /*
11162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11163 %                                                                             %
11164 %                                                                             %
11165 %                                                                             %
11166 %   M a g i c k S k e t c h I m a g e                                         %
11167 %                                                                             %
11168 %                                                                             %
11169 %                                                                             %
11170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11171 %
11172 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11173 %  a Gaussian operator of the given radius and standard deviation (sigma).
11174 %  For reasonable results, radius should be larger than sigma.  Use a
11175 %  radius of 0 and SketchImage() selects a suitable radius for you.
11176 %  Angle gives the angle of the blurring motion.
11177 %
11178 %  The format of the MagickSketchImage method is:
11179 %
11180 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11181 %        const double radius,const double sigma,const double angle)
11182 %
11183 %  A description of each parameter follows:
11184 %
11185 %    o wand: the magick wand.
11186 %
11187 %    o radius: the radius of the Gaussian, in pixels, not counting
11188 %      the center pixel.
11189 %
11190 %    o sigma: the standard deviation of the Gaussian, in pixels.
11191 %
11192 %    o angle: Apply the effect along this angle.
11193 %
11194 */
11195 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11196   const double radius,const double sigma,const double angle)
11197 {
11198   Image
11199     *sketch_image;
11200
11201   assert(wand != (MagickWand *) NULL);
11202   assert(wand->signature == WandSignature);
11203   if (wand->debug != MagickFalse)
11204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11205   if (wand->images == (Image *) NULL)
11206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11207   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11208   if (sketch_image == (Image *) NULL)
11209     return(MagickFalse);
11210   ReplaceImageInList(&wand->images,sketch_image);
11211   return(MagickTrue);
11212 }
11213 \f
11214 /*
11215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11216 %                                                                             %
11217 %                                                                             %
11218 %                                                                             %
11219 %     M a g i c k S o l a r i z e I m a g e                                   %
11220 %                                                                             %
11221 %                                                                             %
11222 %                                                                             %
11223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11224 %
11225 %  MagickSolarizeImage() applies a special effect to the image, similar to the
11226 %  effect achieved in a photo darkroom by selectively exposing areas of photo
11227 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11228 %  measure of the extent of the solarization.
11229 %
11230 %  The format of the MagickSolarizeImage method is:
11231 %
11232 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11233 %        const double threshold)
11234 %
11235 %  A description of each parameter follows:
11236 %
11237 %    o wand: the magick wand.
11238 %
11239 %    o threshold:  Define the extent of the solarization.
11240 %
11241 */
11242 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11243   const double threshold)
11244 {
11245   MagickBooleanType
11246     status;
11247
11248   assert(wand != (MagickWand *) NULL);
11249   assert(wand->signature == WandSignature);
11250   if (wand->debug != MagickFalse)
11251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11252   if (wand->images == (Image *) NULL)
11253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11254   status=SolarizeImage(wand->images,threshold);
11255   if (status == MagickFalse)
11256     InheritException(wand->exception,&wand->images->exception);
11257   return(status);
11258 }
11259 \f
11260 /*
11261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11262 %                                                                             %
11263 %                                                                             %
11264 %                                                                             %
11265 %   M a g i c k S p a r s e C o l o r I m a g e                               %
11266 %                                                                             %
11267 %                                                                             %
11268 %                                                                             %
11269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11270 %
11271 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
11272 %  colors found at those coordinates, across the whole image, using various
11273 %  methods.
11274 %
11275 %  The format of the MagickSparseColorImage method is:
11276 %
11277 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11278 %        const ChannelType channel,const SparseColorMethod method,
11279 %        const unsigned long number_arguments,const double *arguments)
11280 %
11281 %  A description of each parameter follows:
11282 %
11283 %    o image: the image to be sparseed.
11284 %
11285 %    o method: the method of image sparseion.
11286 %
11287 %        ArcSparseColorion will always ignore source image offset, and always
11288 %        'bestfit' the destination image with the top left corner offset
11289 %        relative to the polar mapping center.
11290 %
11291 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11292 %        style of image sparseion.
11293 %
11294 %        Affine, Perspective, and Bilinear, will do least squares fitting of
11295 %        the distrotion when more than the minimum number of control point
11296 %        pairs are provided.
11297 %
11298 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
11299 %        less than 4 control point pairs are provided. While Affine sparseions
11300 %        will let you use any number of control point pairs, that is Zero pairs
11301 %        is a No-Op (viewport only) distrotion, one pair is a translation and
11302 %        two pairs of control points will do a scale-rotate-translate, without
11303 %        any shearing.
11304 %
11305 %    o number_arguments: the number of arguments given for this sparseion
11306 %      method.
11307 %
11308 %    o arguments: the arguments for this sparseion method.
11309 %
11310 */
11311 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11312   const ChannelType channel,const SparseColorMethod method,
11313   const unsigned long number_arguments,const double *arguments)
11314 {
11315   Image
11316     *sparse_image;
11317
11318   assert(wand != (MagickWand *) NULL);
11319   assert(wand->signature == WandSignature);
11320   if (wand->debug != MagickFalse)
11321     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11322   if (wand->images == (Image *) NULL)
11323     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11324   sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11325     arguments,wand->exception);
11326   if (sparse_image == (Image *) NULL)
11327     return(MagickFalse);
11328   ReplaceImageInList(&wand->images,sparse_image);
11329   return(MagickTrue);
11330 }
11331 \f
11332 /*
11333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11334 %                                                                             %
11335 %                                                                             %
11336 %                                                                             %
11337 %   M a g i c k S p l i c e I m a g e                                         %
11338 %                                                                             %
11339 %                                                                             %
11340 %                                                                             %
11341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11342 %
11343 %  MagickSpliceImage() splices a solid color into the image.
11344 %
11345 %  The format of the MagickSpliceImage method is:
11346 %
11347 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11348 %        const unsigned long width,const unsigned long height,const long x,
11349 %        const long y)
11350 %
11351 %  A description of each parameter follows:
11352 %
11353 %    o wand: the magick wand.
11354 %
11355 %    o width: the region width.
11356 %
11357 %    o height: the region height.
11358 %
11359 %    o x: the region x offset.
11360 %
11361 %    o y: the region y offset.
11362 %
11363 */
11364 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11365   const unsigned long width,const unsigned long height,const long x,
11366   const long y)
11367 {
11368   Image
11369     *splice_image;
11370
11371   RectangleInfo
11372     splice;
11373
11374   assert(wand != (MagickWand *) NULL);
11375   assert(wand->signature == WandSignature);
11376   if (wand->debug != MagickFalse)
11377     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11378   if (wand->images == (Image *) NULL)
11379     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11380   splice.width=width;
11381   splice.height=height;
11382   splice.x=x;
11383   splice.y=y;
11384   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11385   if (splice_image == (Image *) NULL)
11386     return(MagickFalse);
11387   ReplaceImageInList(&wand->images,splice_image);
11388   return(MagickTrue);
11389 }
11390 \f
11391 /*
11392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11393 %                                                                             %
11394 %                                                                             %
11395 %                                                                             %
11396 %   M a g i c k S p r e a d I m a g e                                         %
11397 %                                                                             %
11398 %                                                                             %
11399 %                                                                             %
11400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11401 %
11402 %  MagickSpreadImage() is a special effects method that randomly displaces each
11403 %  pixel in a block defined by the radius parameter.
11404 %
11405 %  The format of the MagickSpreadImage method is:
11406 %
11407 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11408 %
11409 %  A description of each parameter follows:
11410 %
11411 %    o wand: the magick wand.
11412 %
11413 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11414 %
11415 */
11416 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11417   const double radius)
11418 {
11419   Image
11420     *spread_image;
11421
11422   assert(wand != (MagickWand *) NULL);
11423   assert(wand->signature == WandSignature);
11424   if (wand->debug != MagickFalse)
11425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11426   if (wand->images == (Image *) NULL)
11427     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11428   spread_image=SpreadImage(wand->images,radius,wand->exception);
11429   if (spread_image == (Image *) NULL)
11430     return(MagickFalse);
11431   ReplaceImageInList(&wand->images,spread_image);
11432   return(MagickTrue);
11433 }
11434 \f
11435 /*
11436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11437 %                                                                             %
11438 %                                                                             %
11439 %                                                                             %
11440 %   M a g i c k S t e g a n o I m a g e                                       %
11441 %                                                                             %
11442 %                                                                             %
11443 %                                                                             %
11444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11445 %
11446 %  MagickSteganoImage() hides a digital watermark within the image.
11447 %  Recover the hidden watermark later to prove that the authenticity of
11448 %  an image.  Offset defines the start position within the image to hide
11449 %  the watermark.
11450 %
11451 %  The format of the MagickSteganoImage method is:
11452 %
11453 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11454 %        const MagickWand *watermark_wand,const long offset)
11455 %
11456 %  A description of each parameter follows:
11457 %
11458 %    o wand: the magick wand.
11459 %
11460 %    o watermark_wand: the watermark wand.
11461 %
11462 %    o offset: Start hiding at this offset into the image.
11463 %
11464 */
11465 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11466   const MagickWand *watermark_wand,const long offset)
11467 {
11468   Image
11469     *stegano_image;
11470
11471   assert(wand != (MagickWand *) NULL);
11472   assert(wand->signature == WandSignature);
11473   if (wand->debug != MagickFalse)
11474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11475   if ((wand->images == (Image *) NULL) ||
11476       (watermark_wand->images == (Image *) NULL))
11477     {
11478       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11479         "ContainsNoImages","`%s'",wand->name);
11480       return((MagickWand *) NULL);
11481     }
11482   wand->images->offset=offset;
11483   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11484     wand->exception);
11485   if (stegano_image == (Image *) NULL)
11486     return((MagickWand *) NULL);
11487   return(CloneMagickWandFromImages(wand,stegano_image));
11488 }
11489 \f
11490 /*
11491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11492 %                                                                             %
11493 %                                                                             %
11494 %                                                                             %
11495 %   M a g i c k S t e r e o I m a g e                                         %
11496 %                                                                             %
11497 %                                                                             %
11498 %                                                                             %
11499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11500 %
11501 %  MagickStereoImage() composites two images and produces a single image that
11502 %  is the composite of a left and right image of a stereo pair
11503 %
11504 %  The format of the MagickStereoImage method is:
11505 %
11506 %      MagickWand *MagickStereoImage(MagickWand *wand,
11507 %        const MagickWand *offset_wand)
11508 %
11509 %  A description of each parameter follows:
11510 %
11511 %    o wand: the magick wand.
11512 %
11513 %    o offset_wand: Another image wand.
11514 %
11515 */
11516 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11517   const MagickWand *offset_wand)
11518 {
11519   Image
11520     *stereo_image;
11521
11522   assert(wand != (MagickWand *) NULL);
11523   assert(wand->signature == WandSignature);
11524   if (wand->debug != MagickFalse)
11525     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11526   if ((wand->images == (Image *) NULL) ||
11527       (offset_wand->images == (Image *) NULL))
11528     {
11529       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11530         "ContainsNoImages","`%s'",wand->name);
11531       return((MagickWand *) NULL);
11532     }
11533   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11534   if (stereo_image == (Image *) NULL)
11535     return((MagickWand *) NULL);
11536   return(CloneMagickWandFromImages(wand,stereo_image));
11537 }
11538 \f
11539 /*
11540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11541 %                                                                             %
11542 %                                                                             %
11543 %                                                                             %
11544 %   M a g i c k S t r i p I m a g e                                           %
11545 %                                                                             %
11546 %                                                                             %
11547 %                                                                             %
11548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11549 %
11550 %  MagickStripImage() strips an image of all profiles and comments.
11551 %
11552 %  The format of the MagickStripImage method is:
11553 %
11554 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11555 %
11556 %  A description of each parameter follows:
11557 %
11558 %    o wand: the magick wand.
11559 %
11560 */
11561 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11562 {
11563   MagickBooleanType
11564     status;
11565
11566   assert(wand != (MagickWand *) NULL);
11567   assert(wand->signature == WandSignature);
11568   if (wand->debug != MagickFalse)
11569     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11570   if (wand->images == (Image *) NULL)
11571     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11572   status=StripImage(wand->images);
11573   if (status == MagickFalse)
11574     InheritException(wand->exception,&wand->images->exception);
11575   return(status);
11576 }
11577 \f
11578 /*
11579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11580 %                                                                             %
11581 %                                                                             %
11582 %                                                                             %
11583 %   M a g i c k S w i r l I m a g e                                           %
11584 %                                                                             %
11585 %                                                                             %
11586 %                                                                             %
11587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11588 %
11589 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11590 %  degrees indicates the sweep of the arc through which each pixel is moved.
11591 %  You get a more dramatic effect as the degrees move from 1 to 360.
11592 %
11593 %  The format of the MagickSwirlImage method is:
11594 %
11595 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11596 %
11597 %  A description of each parameter follows:
11598 %
11599 %    o wand: the magick wand.
11600 %
11601 %    o degrees: Define the tightness of the swirling effect.
11602 %
11603 */
11604 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11605   const double degrees)
11606 {
11607   Image
11608     *swirl_image;
11609
11610   assert(wand != (MagickWand *) NULL);
11611   assert(wand->signature == WandSignature);
11612   if (wand->debug != MagickFalse)
11613     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11614   if (wand->images == (Image *) NULL)
11615     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11616   swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11617   if (swirl_image == (Image *) NULL)
11618     return(MagickFalse);
11619   ReplaceImageInList(&wand->images,swirl_image);
11620   return(MagickTrue);
11621 }
11622 \f
11623 /*
11624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11625 %                                                                             %
11626 %                                                                             %
11627 %                                                                             %
11628 %   M a g i c k T e x t u r e I m a g e                                       %
11629 %                                                                             %
11630 %                                                                             %
11631 %                                                                             %
11632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11633 %
11634 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11635 %  image canvas.
11636 %
11637 %  The format of the MagickTextureImage method is:
11638 %
11639 %      MagickWand *MagickTextureImage(MagickWand *wand,
11640 %        const MagickWand *texture_wand)
11641 %
11642 %  A description of each parameter follows:
11643 %
11644 %    o wand: the magick wand.
11645 %
11646 %    o texture_wand: the texture wand
11647 %
11648 */
11649 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11650   const MagickWand *texture_wand)
11651 {
11652   Image
11653     *texture_image;
11654
11655   MagickBooleanType
11656     status;
11657
11658   assert(wand != (MagickWand *) NULL);
11659   assert(wand->signature == WandSignature);
11660   if (wand->debug != MagickFalse)
11661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11662   if ((wand->images == (Image *) NULL) ||
11663       (texture_wand->images == (Image *) NULL))
11664     {
11665       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11666         "ContainsNoImages","`%s'",wand->name);
11667       return((MagickWand *) NULL);
11668     }
11669   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11670   if (texture_image == (Image *) NULL)
11671     return((MagickWand *) NULL);
11672   status=TextureImage(texture_image,texture_wand->images);
11673   if (status == MagickFalse)
11674     {
11675       InheritException(wand->exception,&texture_image->exception);
11676       texture_image=DestroyImage(texture_image);
11677       return((MagickWand *) NULL);
11678     }
11679   return(CloneMagickWandFromImages(wand,texture_image));
11680 }
11681 \f
11682 /*
11683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11684 %                                                                             %
11685 %                                                                             %
11686 %                                                                             %
11687 %   M a g i c k T h r e s h o l d I m a g e                                   %
11688 %                                                                             %
11689 %                                                                             %
11690 %                                                                             %
11691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11692 %
11693 %  MagickThresholdImage() changes the value of individual pixels based on
11694 %  the intensity of each pixel compared to threshold.  The result is a
11695 %  high-contrast, two color image.
11696 %
11697 %  The format of the MagickThresholdImage method is:
11698 %
11699 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11700 %        const double threshold)
11701 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11702 %        const ChannelType channel,const double threshold)
11703 %
11704 %  A description of each parameter follows:
11705 %
11706 %    o wand: the magick wand.
11707 %
11708 %    o channel: the image channel(s).
11709 %
11710 %    o threshold: Define the threshold value.
11711 %
11712 */
11713 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11714   const double threshold)
11715 {
11716   MagickBooleanType
11717     status;
11718
11719   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11720   return(status);
11721 }
11722
11723 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11724   const ChannelType channel,const double threshold)
11725 {
11726   MagickBooleanType
11727     status;
11728
11729   assert(wand != (MagickWand *) NULL);
11730   assert(wand->signature == WandSignature);
11731   if (wand->debug != MagickFalse)
11732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11733   if (wand->images == (Image *) NULL)
11734     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11735   status=BilevelImageChannel(wand->images,channel,threshold);
11736   if (status == MagickFalse)
11737     InheritException(wand->exception,&wand->images->exception);
11738   return(status);
11739 }
11740 \f
11741 /*
11742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11743 %                                                                             %
11744 %                                                                             %
11745 %                                                                             %
11746 %   M a g i c k T h u m b n a i l I m a g e                                   %
11747 %                                                                             %
11748 %                                                                             %
11749 %                                                                             %
11750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11751 %
11752 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11753 %  and removes any associated profiles.  The goal is to produce small low cost
11754 %  thumbnail images suited for display on the Web.
11755 %
11756 %  The format of the MagickThumbnailImage method is:
11757 %
11758 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11759 %        const unsigned long columns,const unsigned long rows)
11760 %
11761 %  A description of each parameter follows:
11762 %
11763 %    o wand: the magick wand.
11764 %
11765 %    o columns: the number of columns in the scaled image.
11766 %
11767 %    o rows: the number of rows in the scaled image.
11768 %
11769 */
11770 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11771   const unsigned long columns,const unsigned long rows)
11772 {
11773   Image
11774     *thumbnail_image;
11775
11776   assert(wand != (MagickWand *) NULL);
11777   assert(wand->signature == WandSignature);
11778   if (wand->debug != MagickFalse)
11779     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11780   if (wand->images == (Image *) NULL)
11781     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11782   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11783   if (thumbnail_image == (Image *) NULL)
11784     return(MagickFalse);
11785   ReplaceImageInList(&wand->images,thumbnail_image);
11786   return(MagickTrue);
11787 }
11788 \f
11789 /*
11790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11791 %                                                                             %
11792 %                                                                             %
11793 %                                                                             %
11794 %   M a g i c k T i n t I m a g e                                             %
11795 %                                                                             %
11796 %                                                                             %
11797 %                                                                             %
11798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11799 %
11800 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11801 %  length of the vector is 0 for black and white and at its maximum for the
11802 %  midtones.  The vector weighting function is
11803 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11804 %
11805 %  The format of the MagickTintImage method is:
11806 %
11807 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11808 %        const PixelWand *tint,const PixelWand *opacity)
11809 %
11810 %  A description of each parameter follows:
11811 %
11812 %    o wand: the magick wand.
11813 %
11814 %    o tint: the tint pixel wand.
11815 %
11816 %    o opacity: the opacity pixel wand.
11817 %
11818 */
11819 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11820   const PixelWand *tint,const PixelWand *opacity)
11821 {
11822   char
11823     percent_opaque[MaxTextExtent];
11824
11825   Image
11826     *tint_image;
11827
11828   PixelPacket
11829     target;
11830
11831   assert(wand != (MagickWand *) NULL);
11832   assert(wand->signature == WandSignature);
11833   if (wand->debug != MagickFalse)
11834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11835   if (wand->images == (Image *) NULL)
11836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11837   (void) FormatMagickString(percent_opaque,MaxTextExtent,"%g,%g,%g,%g",
11838     (double) (100.0*QuantumScale*PixelGetRedQuantum(opacity)),
11839     (double) (100.0*QuantumScale*PixelGetGreenQuantum(opacity)),
11840     (double) (100.0*QuantumScale*PixelGetBlueQuantum(opacity)),
11841     (double) (100.0*QuantumScale*PixelGetOpacityQuantum(opacity)));
11842   PixelGetQuantumColor(tint,&target);
11843   tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11844   if (tint_image == (Image *) NULL)
11845     return(MagickFalse);
11846   ReplaceImageInList(&wand->images,tint_image);
11847   return(MagickTrue);
11848 }
11849 \f
11850 /*
11851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11852 %                                                                             %
11853 %                                                                             %
11854 %                                                                             %
11855 %   M a g i c k T r a n s f o r m I m a g e                                   %
11856 %                                                                             %
11857 %                                                                             %
11858 %                                                                             %
11859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11860 %
11861 %  MagickTransformImage() is a convenience method that behaves like
11862 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11863 %  information as a region geometry specification.  If the operation fails,
11864 %  a NULL image handle is returned.
11865 %
11866 %  The format of the MagickTransformImage method is:
11867 %
11868 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11869 %        const char *geometry)
11870 %
11871 %  A description of each parameter follows:
11872 %
11873 %    o wand: the magick wand.
11874 %
11875 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11876 %      image to crop.
11877 %
11878 %    o geometry: An image geometry string.  This geometry defines the final
11879 %      size of the image.
11880 %
11881 */
11882 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11883   const char *crop,const char *geometry)
11884 {
11885   Image
11886     *transform_image;
11887
11888   MagickBooleanType
11889     status;
11890
11891   assert(wand != (MagickWand *) NULL);
11892   assert(wand->signature == WandSignature);
11893   if (wand->debug != MagickFalse)
11894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11895   if (wand->images == (Image *) NULL)
11896     return((MagickWand *) NULL);
11897   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11898   if (transform_image == (Image *) NULL)
11899     return((MagickWand *) NULL);
11900   status=TransformImage(&transform_image,crop,geometry);
11901   if (status == MagickFalse)
11902     {
11903       InheritException(wand->exception,&transform_image->exception);
11904       transform_image=DestroyImage(transform_image);
11905       return((MagickWand *) NULL);
11906     }
11907   return(CloneMagickWandFromImages(wand,transform_image));
11908 }
11909 \f
11910 /*
11911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11912 %                                                                             %
11913 %                                                                             %
11914 %                                                                             %
11915 %   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               %
11916 %                                                                             %
11917 %                                                                             %
11918 %                                                                             %
11919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11920 %
11921 %  MagickTransformImageColorspace() transform the image colorspace.
11922 %
11923 %  The format of the MagickTransformImageColorspace method is:
11924 %
11925 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11926 %        const ColorspaceType colorspace)
11927 %
11928 %  A description of each parameter follows:
11929 %
11930 %    o wand: the magick wand.
11931 %
11932 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11933 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11934 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11935 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11936 %      HSLColorspace, or HWBColorspace.
11937 %
11938 */
11939 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11940   const ColorspaceType colorspace)
11941 {
11942   assert(wand != (MagickWand *) NULL);
11943   assert(wand->signature == WandSignature);
11944   if (wand->debug != MagickFalse)
11945     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11946   if (wand->images == (Image *) NULL)
11947     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11948   return(TransformImageColorspace(wand->images,colorspace));
11949 }
11950 \f
11951 /*
11952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11953 %                                                                             %
11954 %                                                                             %
11955 %                                                                             %
11956 %   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                     %
11957 %                                                                             %
11958 %                                                                             %
11959 %                                                                             %
11960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11961 %
11962 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11963 %  color defined by fill.
11964 %
11965 %  The format of the MagickTransparentPaintImage method is:
11966 %
11967 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11968 %        const PixelWand *target,const double alpha,const double fuzz,
11969 %        const MagickBooleanType invert)
11970 %
11971 %  A description of each parameter follows:
11972 %
11973 %    o wand: the magick wand.
11974 %
11975 %    o target: Change this target color to specified opacity value within
11976 %      the image.
11977 %
11978 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11979 %      transparent.
11980 %
11981 %    o fuzz: By default target must match a particular pixel color
11982 %      exactly.  However, in many cases two colors may differ by a small amount.
11983 %      The fuzz member of image defines how much tolerance is acceptable to
11984 %      consider two colors as the same.  For example, set fuzz to 10 and the
11985 %      color red at intensities of 100 and 102 respectively are now interpreted
11986 %      as the same color for the purposes of the floodfill.
11987 %
11988 %    o invert: paint any pixel that does not match the target color.
11989 %
11990 */
11991 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11992   const PixelWand *target,const double alpha,const double fuzz,
11993   const MagickBooleanType invert)
11994 {
11995   MagickBooleanType
11996     status;
11997
11998   MagickPixelPacket
11999     target_pixel;
12000
12001   assert(wand != (MagickWand *) NULL);
12002   assert(wand->signature == WandSignature);
12003   if (wand->debug != MagickFalse)
12004     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12005   if (wand->images == (Image *) NULL)
12006     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12007   PixelGetMagickColor(target,&target_pixel);
12008   wand->images->fuzz=fuzz;
12009   status=TransparentPaintImage(wand->images,&target_pixel,RoundToQuantum(
12010     (MagickRealType) QuantumRange-QuantumRange*alpha),invert);
12011   if (status == MagickFalse)
12012     InheritException(wand->exception,&wand->images->exception);
12013   return(status);
12014 }
12015 \f
12016 /*
12017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12018 %                                                                             %
12019 %                                                                             %
12020 %                                                                             %
12021 %   M a g i c k T r a n s p o s e I m a g e                                   %
12022 %                                                                             %
12023 %                                                                             %
12024 %                                                                             %
12025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12026 %
12027 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
12028 %  pixels around the central x-axis while rotating them 90-degrees.
12029 %
12030 %  The format of the MagickTransposeImage method is:
12031 %
12032 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12033 %
12034 %  A description of each parameter follows:
12035 %
12036 %    o wand: the magick wand.
12037 %
12038 */
12039 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12040 {
12041   Image
12042     *transpose_image;
12043
12044   assert(wand != (MagickWand *) NULL);
12045   assert(wand->signature == WandSignature);
12046   if (wand->debug != MagickFalse)
12047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12048   if (wand->images == (Image *) NULL)
12049     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12050   transpose_image=TransposeImage(wand->images,wand->exception);
12051   if (transpose_image == (Image *) NULL)
12052     return(MagickFalse);
12053   ReplaceImageInList(&wand->images,transpose_image);
12054   return(MagickTrue);
12055 }
12056 \f
12057 /*
12058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12059 %                                                                             %
12060 %                                                                             %
12061 %                                                                             %
12062 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12063 %                                                                             %
12064 %                                                                             %
12065 %                                                                             %
12066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12067 %
12068 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12069 %  pixels around the central y-axis while rotating them 270-degrees.
12070 %
12071 %  The format of the MagickTransverseImage method is:
12072 %
12073 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12074 %
12075 %  A description of each parameter follows:
12076 %
12077 %    o wand: the magick wand.
12078 %
12079 */
12080 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12081 {
12082   Image
12083     *transverse_image;
12084
12085   assert(wand != (MagickWand *) NULL);
12086   assert(wand->signature == WandSignature);
12087   if (wand->debug != MagickFalse)
12088     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12089   if (wand->images == (Image *) NULL)
12090     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12091   transverse_image=TransverseImage(wand->images,wand->exception);
12092   if (transverse_image == (Image *) NULL)
12093     return(MagickFalse);
12094   ReplaceImageInList(&wand->images,transverse_image);
12095   return(MagickTrue);
12096 }
12097 \f
12098 /*
12099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12100 %                                                                             %
12101 %                                                                             %
12102 %                                                                             %
12103 %   M a g i c k T r i m I m a g e                                             %
12104 %                                                                             %
12105 %                                                                             %
12106 %                                                                             %
12107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12108 %
12109 %  MagickTrimImage() remove edges that are the background color from the image.
12110 %
12111 %  The format of the MagickTrimImage method is:
12112 %
12113 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12114 %
12115 %  A description of each parameter follows:
12116 %
12117 %    o wand: the magick wand.
12118 %
12119 %    o fuzz: By default target must match a particular pixel color
12120 %      exactly.  However, in many cases two colors may differ by a small amount.
12121 %      The fuzz member of image defines how much tolerance is acceptable to
12122 %      consider two colors as the same.  For example, set fuzz to 10 and the
12123 %      color red at intensities of 100 and 102 respectively are now interpreted
12124 %      as the same color for the purposes of the floodfill.
12125 %
12126 */
12127 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12128 {
12129   Image
12130     *trim_image;
12131
12132   assert(wand != (MagickWand *) NULL);
12133   assert(wand->signature == WandSignature);
12134   if (wand->debug != MagickFalse)
12135     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12136   if (wand->images == (Image *) NULL)
12137     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12138   wand->images->fuzz=fuzz;
12139   trim_image=TrimImage(wand->images,wand->exception);
12140   if (trim_image == (Image *) NULL)
12141     return(MagickFalse);
12142   ReplaceImageInList(&wand->images,trim_image);
12143   return(MagickTrue);
12144 }
12145 \f
12146 /*
12147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12148 %                                                                             %
12149 %                                                                             %
12150 %                                                                             %
12151 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
12152 %                                                                             %
12153 %                                                                             %
12154 %                                                                             %
12155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12156 %
12157 %  MagickUniqueImageColors() discards all but one of any pixel color.
12158 %
12159 %  The format of the MagickUniqueImageColors method is:
12160 %
12161 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12162 %
12163 %  A description of each parameter follows:
12164 %
12165 %    o wand: the magick wand.
12166 %
12167 */
12168 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12169 {
12170   Image
12171     *unique_image;
12172
12173   assert(wand != (MagickWand *) NULL);
12174   assert(wand->signature == WandSignature);
12175   if (wand->debug != MagickFalse)
12176     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12177   if (wand->images == (Image *) NULL)
12178     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12179   unique_image=UniqueImageColors(wand->images,wand->exception);
12180   if (unique_image == (Image *) NULL)
12181     return(MagickFalse);
12182   ReplaceImageInList(&wand->images,unique_image);
12183   return(MagickTrue);
12184 }
12185 \f
12186 /*
12187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12188 %                                                                             %
12189 %                                                                             %
12190 %                                                                             %
12191 %   M a g i c k U n s h a r p M a s k I m a g e                               %
12192 %                                                                             %
12193 %                                                                             %
12194 %                                                                             %
12195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12196 %
12197 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12198 %  Gaussian operator of the given radius and standard deviation (sigma).
12199 %  For reasonable results, radius should be larger than sigma.  Use a radius
12200 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12201 %
12202 %  The format of the MagickUnsharpMaskImage method is:
12203 %
12204 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12205 %        const double radius,const double sigma,const double amount,
12206 %        const double threshold)
12207 %      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12208 %        const ChannelType channel,const double radius,const double sigma,
12209 %        const double amount,const double threshold)
12210 %
12211 %  A description of each parameter follows:
12212 %
12213 %    o wand: the magick wand.
12214 %
12215 %    o channel: the image channel(s).
12216 %
12217 %    o radius: the radius of the Gaussian, in pixels, not counting the center
12218 %      pixel.
12219 %
12220 %    o sigma: the standard deviation of the Gaussian, in pixels.
12221 %
12222 %    o amount: the percentage of the difference between the original and the
12223 %      blur image that is added back into the original.
12224 %
12225 %    o threshold: the threshold in pixels needed to apply the diffence amount.
12226 %
12227 */
12228
12229 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12230   const double radius,const double sigma,const double amount,
12231   const double threshold)
12232 {
12233   MagickBooleanType
12234     status;
12235
12236   status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12237     amount,threshold);
12238   return(status);
12239 }
12240
12241 WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12242   const ChannelType channel,const double radius,const double sigma,
12243   const double amount,const double threshold)
12244 {
12245   Image
12246     *unsharp_image;
12247
12248   assert(wand != (MagickWand *) NULL);
12249   assert(wand->signature == WandSignature);
12250   if (wand->debug != MagickFalse)
12251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12252   if (wand->images == (Image *) NULL)
12253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12254   unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12255     amount,threshold,wand->exception);
12256   if (unsharp_image == (Image *) NULL)
12257     return(MagickFalse);
12258   ReplaceImageInList(&wand->images,unsharp_image);
12259   return(MagickTrue);
12260 }
12261 \f
12262 /*
12263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12264 %                                                                             %
12265 %                                                                             %
12266 %                                                                             %
12267 %   M a g i c k V i g n e t t e I m a g e                                     %
12268 %                                                                             %
12269 %                                                                             %
12270 %                                                                             %
12271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12272 %
12273 %  MagickVignetteImage() softens the edges of the image in vignette style.
12274 %
12275 %  The format of the MagickVignetteImage method is:
12276 %
12277 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12278 %        const double black_point,const double white_point,const long x,
12279 %        const long y)
12280 %
12281 %  A description of each parameter follows:
12282 %
12283 %    o wand: the magick wand.
12284 %
12285 %    o black_point: the black point.
12286 %
12287 %    o white_point: the white point.
12288 %
12289 %    o x, y:  Define the x and y ellipse offset.
12290 %
12291 */
12292 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12293   const double black_point,const double white_point,const long x,const long y)
12294 {
12295   Image
12296     *vignette_image;
12297
12298   assert(wand != (MagickWand *) NULL);
12299   assert(wand->signature == WandSignature);
12300   if (wand->debug != MagickFalse)
12301     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12302   if (wand->images == (Image *) NULL)
12303     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12304   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12305     wand->exception);
12306   if (vignette_image == (Image *) NULL)
12307     return(MagickFalse);
12308   ReplaceImageInList(&wand->images,vignette_image);
12309   return(MagickTrue);
12310 }
12311 \f
12312 /*
12313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12314 %                                                                             %
12315 %                                                                             %
12316 %                                                                             %
12317 %   M a g i c k W a v e I m a g e                                             %
12318 %                                                                             %
12319 %                                                                             %
12320 %                                                                             %
12321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12322 %
12323 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12324 %  the pixels vertically along a sine wave whose amplitude and wavelength
12325 %  is specified by the given parameters.
12326 %
12327 %  The format of the MagickWaveImage method is:
12328 %
12329 %      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12330 %        const double wave_length)
12331 %
12332 %  A description of each parameter follows:
12333 %
12334 %    o wand: the magick wand.
12335 %
12336 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12337 %      sine wave.
12338 %
12339 */
12340 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12341   const double amplitude,const double wave_length)
12342 {
12343   Image
12344     *wave_image;
12345
12346   assert(wand != (MagickWand *) NULL);
12347   assert(wand->signature == WandSignature);
12348   if (wand->debug != MagickFalse)
12349     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12350   if (wand->images == (Image *) NULL)
12351     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12352   wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12353   if (wave_image == (Image *) NULL)
12354     return(MagickFalse);
12355   ReplaceImageInList(&wand->images,wave_image);
12356   return(MagickTrue);
12357 }
12358 \f
12359 /*
12360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12361 %                                                                             %
12362 %                                                                             %
12363 %                                                                             %
12364 %   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                         %
12365 %                                                                             %
12366 %                                                                             %
12367 %                                                                             %
12368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12369 %
12370 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12371 %  above the threshold into white while leaving all pixels below the threshold
12372 %  unchanged.
12373 %
12374 %  The format of the MagickWhiteThresholdImage method is:
12375 %
12376 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12377 %        const PixelWand *threshold)
12378 %
12379 %  A description of each parameter follows:
12380 %
12381 %    o wand: the magick wand.
12382 %
12383 %    o threshold: the pixel wand.
12384 %
12385 */
12386 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12387   const PixelWand *threshold)
12388 {
12389   char
12390     thresholds[MaxTextExtent];
12391
12392   MagickBooleanType
12393     status;
12394
12395   assert(wand != (MagickWand *) NULL);
12396   assert(wand->signature == WandSignature);
12397   if (wand->debug != MagickFalse)
12398     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12399   if (wand->images == (Image *) NULL)
12400     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12401   (void) FormatMagickString(thresholds,MaxTextExtent,
12402     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12403     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12404     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12405   status=WhiteThresholdImage(wand->images,thresholds);
12406   if (status == MagickFalse)
12407     InheritException(wand->exception,&wand->images->exception);
12408   return(status);
12409 }
12410 \f
12411 /*
12412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12413 %                                                                             %
12414 %                                                                             %
12415 %                                                                             %
12416 %   M a g i c k W r i t e I m a g e                                           %
12417 %                                                                             %
12418 %                                                                             %
12419 %                                                                             %
12420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12421 %
12422 %  MagickWriteImage() writes an image to the specified filename.  If the
12423 %  filename parameter is NULL, the image is written to the filename set
12424 %  by MagickReadImage() or MagickSetImageFilename().
12425 %
12426 %  The format of the MagickWriteImage method is:
12427 %
12428 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12429 %        const char *filename)
12430 %
12431 %  A description of each parameter follows:
12432 %
12433 %    o wand: the magick wand.
12434 %
12435 %    o filename: the image filename.
12436 %
12437 %
12438 */
12439 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12440   const char *filename)
12441 {
12442   Image
12443     *image;
12444
12445   ImageInfo
12446     *write_info;
12447
12448   MagickBooleanType
12449     status;
12450
12451   assert(wand != (MagickWand *) NULL);
12452   assert(wand->signature == WandSignature);
12453   if (wand->debug != MagickFalse)
12454     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12455   if (wand->images == (Image *) NULL)
12456     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12457   if (filename != (const char *) NULL)
12458     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12459   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12460   if (image == (Image *) NULL)
12461     return(MagickFalse);
12462   write_info=CloneImageInfo(wand->image_info);
12463   write_info->adjoin=MagickTrue;
12464   status=WriteImage(write_info,image);
12465   if (status == MagickFalse)
12466     InheritException(wand->exception,&image->exception);
12467   image=DestroyImage(image);
12468   write_info=DestroyImageInfo(write_info);
12469   return(status);
12470 }
12471 \f
12472 /*
12473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12474 %                                                                             %
12475 %                                                                             %
12476 %                                                                             %
12477 %   M a g i c k W r i t e I m a g e F i l e                                   %
12478 %                                                                             %
12479 %                                                                             %
12480 %                                                                             %
12481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12482 %
12483 %  MagickWriteImageFile() writes an image to an open file descriptor.
12484 %
12485 %  The format of the MagickWriteImageFile method is:
12486 %
12487 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12488 %
12489 %  A description of each parameter follows:
12490 %
12491 %    o wand: the magick wand.
12492 %
12493 %    o file: the file descriptor.
12494 %
12495 %
12496 */
12497 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12498 {
12499   Image
12500     *image;
12501
12502   ImageInfo
12503     *write_info;
12504
12505   MagickBooleanType
12506     status;
12507
12508   assert(wand != (MagickWand *) NULL);
12509   assert(wand->signature == WandSignature);
12510   assert(file != (FILE *) NULL);
12511   if (wand->debug != MagickFalse)
12512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12513   if (wand->images == (Image *) NULL)
12514     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12515   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12516   if (image == (Image *) NULL)
12517     return(MagickFalse);
12518   write_info=CloneImageInfo(wand->image_info);
12519   SetImageInfoFile(write_info,file);
12520   write_info->adjoin=MagickTrue;
12521   status=WriteImage(write_info,image);
12522   write_info=DestroyImageInfo(write_info);
12523   if (status == MagickFalse)
12524     InheritException(wand->exception,&image->exception);
12525   image=DestroyImage(image);
12526   return(status);
12527 }
12528 \f
12529 /*
12530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12531 %                                                                             %
12532 %                                                                             %
12533 %                                                                             %
12534 %   M a g i c k W r i t e I m a g e s                                         %
12535 %                                                                             %
12536 %                                                                             %
12537 %                                                                             %
12538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12539 %
12540 %  MagickWriteImages() writes an image or image sequence.
12541 %
12542 %  The format of the MagickWriteImages method is:
12543 %
12544 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12545 %        const char *filename,const MagickBooleanType adjoin)
12546 %
12547 %  A description of each parameter follows:
12548 %
12549 %    o wand: the magick wand.
12550 %
12551 %    o filename: the image filename.
12552 %
12553 %    o adjoin: join images into a single multi-image file.
12554 %
12555 */
12556 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12557   const char *filename,const MagickBooleanType adjoin)
12558 {
12559   ImageInfo
12560     *write_info;
12561
12562   MagickBooleanType
12563     status;
12564
12565   assert(wand != (MagickWand *) NULL);
12566   assert(wand->signature == WandSignature);
12567   if (wand->debug != MagickFalse)
12568     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12569   if (wand->images == (Image *) NULL)
12570     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12571   write_info=CloneImageInfo(wand->image_info);
12572   write_info->adjoin=adjoin;
12573   status=WriteImages(write_info,wand->images,filename,wand->exception);
12574   if (status == MagickFalse)
12575     InheritException(wand->exception,&wand->images->exception);
12576   write_info=DestroyImageInfo(write_info);
12577   return(status);
12578 }
12579 \f
12580 /*
12581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12582 %                                                                             %
12583 %                                                                             %
12584 %                                                                             %
12585 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12586 %                                                                             %
12587 %                                                                             %
12588 %                                                                             %
12589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12590 %
12591 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12592 %
12593 %  The format of the MagickWriteImagesFile method is:
12594 %
12595 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12596 %
12597 %  A description of each parameter follows:
12598 %
12599 %    o wand: the magick wand.
12600 %
12601 %    o file: the file descriptor.
12602 %
12603 */
12604 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12605 {
12606   ImageInfo
12607     *write_info;
12608
12609   MagickBooleanType
12610     status;
12611
12612   assert(wand != (MagickWand *) NULL);
12613   assert(wand->signature == WandSignature);
12614   if (wand->debug != MagickFalse)
12615     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12616   if (wand->images == (Image *) NULL)
12617     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12618   write_info=CloneImageInfo(wand->image_info);
12619   SetImageInfoFile(write_info,file);
12620   write_info->adjoin=MagickTrue;
12621   status=WriteImages(write_info,wand->images,(const char *) NULL,
12622     wand->exception);
12623   write_info=DestroyImageInfo(write_info);
12624   if (status == MagickFalse)
12625     InheritException(wand->exception,&wand->images->exception);
12626   return(status);
12627 }