]> 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-2010 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 *) AcquireAlignedMemory(1,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 size_t columns,const size_t rows)
243 %
244 %  A description of each parameter follows:
245 %
246 %    o wand: the magick wand.
247 %
248 %    o columns: the number of columns in the scaled image.
249 %
250 %    o rows: the number of rows in the scaled image.
251 %
252 */
253 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
254   const size_t columns,const size_t rows)
255 {
256   Image
257     *resize_image;
258
259   assert(wand != (MagickWand *) NULL);
260   assert(wand->signature == WandSignature);
261   if (wand->debug != MagickFalse)
262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
263   if (wand->images == (Image *) NULL)
264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
265   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
266   if (resize_image == (Image *) NULL)
267     return(MagickFalse);
268   ReplaceImageInList(&wand->images,resize_image);
269   return(MagickTrue);
270 }
271 \f
272 /*
273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274 %                                                                             %
275 %                                                                             %
276 %                                                                             %
277 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
278 %                                                                             %
279 %                                                                             %
280 %                                                                             %
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282 %
283 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
284 %  more intensely near image edges and less intensely far from edges. We
285 %  sharpen the image with a Gaussian operator of the given radius and standard
286 %  deviation (sigma).  For reasonable results, radius should be larger than
287 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
288 %  suitable radius for you.
289 %
290 %  The format of the MagickAdaptiveSharpenImage method is:
291 %
292 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
293 %        const double radius,const double sigma)
294 %      MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
295 %        const ChannelType channel,const double radius,const double sigma)
296 %
297 %  A description of each parameter follows:
298 %
299 %    o wand: the magick wand.
300 %
301 %    o channel: the image channel(s).
302 %
303 %    o radius: the radius of the Gaussian, in pixels, not counting the center
304 %      pixel.
305 %
306 %    o sigma: the standard deviation of the Gaussian, in pixels.
307 %
308 */
309
310 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
311   const double radius,const double sigma)
312 {
313   MagickBooleanType
314     status;
315
316   status=MagickAdaptiveSharpenImageChannel(wand,DefaultChannels,radius,sigma);
317   return(status);
318 }
319
320 WandExport MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
321   const ChannelType channel,const double radius,const double sigma)
322 {
323   Image
324     *sharp_image;
325
326   assert(wand != (MagickWand *) NULL);
327   assert(wand->signature == WandSignature);
328   if (wand->debug != MagickFalse)
329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
330   if (wand->images == (Image *) NULL)
331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
332   sharp_image=AdaptiveSharpenImageChannel(wand->images,channel,radius,sigma,
333     wand->exception);
334   if (sharp_image == (Image *) NULL)
335     return(MagickFalse);
336   ReplaceImageInList(&wand->images,sharp_image);
337   return(MagickTrue);
338 }
339 \f
340 /*
341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342 %                                                                             %
343 %                                                                             %
344 %                                                                             %
345 %   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
346 %                                                                             %
347 %                                                                             %
348 %                                                                             %
349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350 %
351 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
352 %  based on the range of intensity values in its local neighborhood.  This
353 %  allows for thresholding of an image whose global intensity histogram
354 %  doesn't contain distinctive peaks.
355 %
356 %  The format of the AdaptiveThresholdImage method is:
357 %
358 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
359 %        const size_t width,const size_t height,const ssize_t offset)
360 %
361 %  A description of each parameter follows:
362 %
363 %    o wand: the magick wand.
364 %
365 %    o width: the width of the local neighborhood.
366 %
367 %    o height: the height of the local neighborhood.
368 %
369 %    o offset: the mean offset.
370 %
371 */
372 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
373   const size_t width,const size_t height,const ssize_t offset)
374 {
375   Image
376     *threshold_image;
377
378   assert(wand != (MagickWand *) NULL);
379   assert(wand->signature == WandSignature);
380   if (wand->debug != MagickFalse)
381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
382   if (wand->images == (Image *) NULL)
383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
384   threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
385     wand->exception);
386   if (threshold_image == (Image *) NULL)
387     return(MagickFalse);
388   ReplaceImageInList(&wand->images,threshold_image);
389   return(MagickTrue);
390 }
391 \f
392 /*
393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394 %                                                                             %
395 %                                                                             %
396 %                                                                             %
397 %   M a g i c k A d d I m a g e                                               %
398 %                                                                             %
399 %                                                                             %
400 %                                                                             %
401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402 %
403 %  MagickAddImage() adds the specified images at the current image location.
404 %
405 %  The format of the MagickAddImage method is:
406 %
407 %      MagickBooleanType MagickAddImage(MagickWand *wand,
408 %        const MagickWand *add_wand)
409 %
410 %  A description of each parameter follows:
411 %
412 %    o wand: the magick wand.
413 %
414 %    o add_wand: A wand that contains images to add at the current image
415 %      location.
416 %
417 */
418
419 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
420   Image *images)
421 {
422   Image
423     *sentinel;
424
425   sentinel=wand->images;
426   if (sentinel == (Image *) NULL)
427     {
428       wand->images=GetFirstImageInList(images);
429       return(MagickTrue);
430     }
431   if (wand->active == MagickFalse)
432     {
433       if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
434         {
435           AppendImageToList(&sentinel,images);
436           wand->images=GetLastImageInList(images);
437           return(MagickTrue);
438         }
439       if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
440         {
441           PrependImageToList(&sentinel,images);
442           wand->images=GetFirstImageInList(images);
443           return(MagickTrue);
444         }
445     }
446   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 B l a c k T h r e s h o l d I m a g e                         %
855 %                                                                             %
856 %                                                                             %
857 %                                                                             %
858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859 %
860 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
861 %  pixels below the threshold into black while leaving all pixels above the
862 %  threshold unchanged.
863 %
864 %  The format of the MagickBlackThresholdImage method is:
865 %
866 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
867 %        const PixelWand *threshold)
868 %
869 %  A description of each parameter follows:
870 %
871 %    o wand: the magick wand.
872 %
873 %    o threshold: the pixel wand.
874 %
875 */
876 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
877   const PixelWand *threshold)
878 {
879   char
880     thresholds[MaxTextExtent];
881
882   MagickBooleanType
883     status;
884
885   assert(wand != (MagickWand *) NULL);
886   assert(wand->signature == WandSignature);
887   if (wand->debug != MagickFalse)
888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
889   if (wand->images == (Image *) NULL)
890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
891   (void) FormatMagickString(thresholds,MaxTextExtent,
892     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
893     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
894     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
895   status=BlackThresholdImage(wand->images,thresholds);
896   if (status == MagickFalse)
897     InheritException(wand->exception,&wand->images->exception);
898   return(status);
899 }
900 \f
901 /*
902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
903 %                                                                             %
904 %                                                                             %
905 %                                                                             %
906 %   M a g i c k B l u e S h i f t I m a g e                                   %
907 %                                                                             %
908 %                                                                             %
909 %                                                                             %
910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
911 %
912 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
913 %  nighttime in the moonlight.
914 %
915 %  The format of the MagickBlueShiftImage method is:
916 %
917 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
918 %        const double factor)
919 %
920 %  A description of each parameter follows:
921 %
922 %    o wand: the magick wand.
923 %
924 %    o factor: the blue shift factor (default 1.5)
925 %
926 */
927 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
928   const double factor)
929 {
930   Image
931     *shift_image;
932
933   assert(wand != (MagickWand *) NULL);
934   assert(wand->signature == WandSignature);
935   if (wand->debug != MagickFalse)
936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
937   if (wand->images == (Image *) NULL)
938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
939   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
940   if (shift_image == (Image *) NULL)
941     return(MagickFalse);
942   ReplaceImageInList(&wand->images,shift_image);
943   return(MagickTrue);
944 }
945 \f
946 /*
947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
948 %                                                                             %
949 %                                                                             %
950 %                                                                             %
951 %   M a g i c k B l u r I m a g e                                             %
952 %                                                                             %
953 %                                                                             %
954 %                                                                             %
955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
956 %
957 %  MagickBlurImage() blurs an image.  We convolve the image with a
958 %  gaussian operator of the given radius and standard deviation (sigma).
959 %  For reasonable results, the radius should be larger than sigma.  Use a
960 %  radius of 0 and BlurImage() selects a suitable radius for you.
961 %
962 %  The format of the MagickBlurImage method is:
963 %
964 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
965 %        const double sigma)
966 %      MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
967 %        const ChannelType channel,const double radius,const double sigma)
968 %
969 %  A description of each parameter follows:
970 %
971 %    o wand: the magick wand.
972 %
973 %    o channel: the image channel(s).
974 %
975 %    o radius: the radius of the , in pixels, not counting the center
976 %      pixel.
977 %
978 %    o sigma: the standard deviation of the , in pixels.
979 %
980 */
981
982 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
983   const double radius,const double sigma)
984 {
985   MagickBooleanType
986     status;
987
988   status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
989   return(status);
990 }
991
992 WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
993   const ChannelType channel,const double radius,const double sigma)
994 {
995   Image
996     *blur_image;
997
998   assert(wand != (MagickWand *) NULL);
999   assert(wand->signature == WandSignature);
1000   if (wand->debug != MagickFalse)
1001     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1002   if (wand->images == (Image *) NULL)
1003     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1004   blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
1005     wand->exception);
1006   if (blur_image == (Image *) NULL)
1007     return(MagickFalse);
1008   ReplaceImageInList(&wand->images,blur_image);
1009   return(MagickTrue);
1010 }
1011 \f
1012 /*
1013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1014 %                                                                             %
1015 %                                                                             %
1016 %                                                                             %
1017 %   M a g i c k B o r d e r I m a g e                                         %
1018 %                                                                             %
1019 %                                                                             %
1020 %                                                                             %
1021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1022 %
1023 %  MagickBorderImage() surrounds the image with a border of the color defined
1024 %  by the bordercolor pixel wand.
1025 %
1026 %  The format of the MagickBorderImage method is:
1027 %
1028 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
1029 %        const PixelWand *bordercolor,const size_t width,
1030 %        const size_t height)
1031 %
1032 %  A description of each parameter follows:
1033 %
1034 %    o wand: the magick wand.
1035 %
1036 %    o bordercolor: the border color pixel wand.
1037 %
1038 %    o width: the border width.
1039 %
1040 %    o height: the border height.
1041 %
1042 */
1043 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1044   const PixelWand *bordercolor,const size_t width,
1045   const size_t height)
1046 {
1047   Image
1048     *border_image;
1049
1050   RectangleInfo
1051     border_info;
1052
1053   assert(wand != (MagickWand *) NULL);
1054   assert(wand->signature == WandSignature);
1055   if (wand->debug != MagickFalse)
1056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1057   if (wand->images == (Image *) NULL)
1058     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1059   border_info.width=width;
1060   border_info.height=height;
1061   border_info.x=0;
1062   border_info.y=0;
1063   PixelGetQuantumColor(bordercolor,&wand->images->border_color);
1064   border_image=BorderImage(wand->images,&border_info,wand->exception);
1065   if (border_image == (Image *) NULL)
1066     return(MagickFalse);
1067   ReplaceImageInList(&wand->images,border_image);
1068   return(MagickTrue);
1069 }
1070 \f
1071 /*
1072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073 %                                                                             %
1074 %                                                                             %
1075 %                                                                             %
1076 %   M a g i c k B r i g h t n e s s C o n t r a s t S t r e t c h I m a g e   %
1077 %                                                                             %
1078 %                                                                             %
1079 %                                                                             %
1080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1081 %
1082 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1083 %  of an image.  It converts the brightness and contrast parameters into slope
1084 %  and intercept and calls a polynomical function to apply to the image.
1085
1086 %
1087 %  The format of the MagickBrightnessContrastImage method is:
1088 %
1089 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1090 %        const double brightness,const double contrast)
1091 %      MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand,
1092 %        const ChannelType channel,const double brightness,
1093 %        const double contrast)
1094 %
1095 %  A description of each parameter follows:
1096 %
1097 %    o wand: the magick wand.
1098 %
1099 %    o channel: the image channel(s).
1100 %
1101 %    o brightness: the brightness percent (-100 .. 100).
1102 %
1103 %    o contrast: the contrast percent (-100 .. 100).
1104 %
1105 */
1106
1107 WandExport MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1108   const double brightness,const double contrast)
1109 {
1110   MagickBooleanType
1111     status;
1112
1113   status=MagickBrightnessContrastImageChannel(wand,DefaultChannels,brightness,
1114     contrast);
1115   return(status);
1116 }
1117
1118 WandExport MagickBooleanType MagickBrightnessContrastImageChannel(
1119   MagickWand *wand,const ChannelType channel,const double brightness,
1120   const double contrast)
1121 {
1122   MagickBooleanType
1123     status;
1124
1125   assert(wand != (MagickWand *) NULL);
1126   assert(wand->signature == WandSignature);
1127   if (wand->debug != MagickFalse)
1128     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1129   if (wand->images == (Image *) NULL)
1130     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1131   status=BrightnessContrastImageChannel(wand->images,channel,brightness,
1132     contrast);
1133   if (status == MagickFalse)
1134     InheritException(wand->exception,&wand->images->exception);
1135   return(status);
1136 }
1137 \f
1138 /*
1139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1140 %                                                                             %
1141 %                                                                             %
1142 %                                                                             %
1143 %   M a g i c k C h a r c o a l I m a g e                                     %
1144 %                                                                             %
1145 %                                                                             %
1146 %                                                                             %
1147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1148 %
1149 %  MagickCharcoalImage() simulates a charcoal drawing.
1150 %
1151 %  The format of the MagickCharcoalImage method is:
1152 %
1153 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1154 %        const double radius,const double sigma)
1155 %
1156 %  A description of each parameter follows:
1157 %
1158 %    o wand: the magick wand.
1159 %
1160 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1161 %      pixel.
1162 %
1163 %    o sigma: the standard deviation of the Gaussian, in pixels.
1164 %
1165 */
1166 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1167   const double radius,const double sigma)
1168 {
1169   Image
1170     *charcoal_image;
1171
1172   assert(wand != (MagickWand *) NULL);
1173   assert(wand->signature == WandSignature);
1174   if (wand->debug != MagickFalse)
1175     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1176   if (wand->images == (Image *) NULL)
1177     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1178   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1179   if (charcoal_image == (Image *) NULL)
1180     return(MagickFalse);
1181   ReplaceImageInList(&wand->images,charcoal_image);
1182   return(MagickTrue);
1183 }
1184 \f
1185 /*
1186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1187 %                                                                             %
1188 %                                                                             %
1189 %                                                                             %
1190 %   M a g i c k C h o p I m a g e                                             %
1191 %                                                                             %
1192 %                                                                             %
1193 %                                                                             %
1194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1195 %
1196 %  MagickChopImage() removes a region of an image and collapses the image to
1197 %  occupy the removed portion
1198 %
1199 %  The format of the MagickChopImage method is:
1200 %
1201 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1202 %        const size_t width,const size_t height,const ssize_t x,
1203 %        const ssize_t y)
1204 %
1205 %  A description of each parameter follows:
1206 %
1207 %    o wand: the magick wand.
1208 %
1209 %    o width: the region width.
1210 %
1211 %    o height: the region height.
1212 %
1213 %    o x: the region x offset.
1214 %
1215 %    o y: the region y offset.
1216 %
1217 %
1218 */
1219 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1220   const size_t width,const size_t height,const ssize_t x,
1221   const ssize_t y)
1222 {
1223   Image
1224     *chop_image;
1225
1226   RectangleInfo
1227     chop;
1228
1229   assert(wand != (MagickWand *) NULL);
1230   assert(wand->signature == WandSignature);
1231   if (wand->debug != MagickFalse)
1232     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1233   if (wand->images == (Image *) NULL)
1234     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1235   chop.width=width;
1236   chop.height=height;
1237   chop.x=x;
1238   chop.y=y;
1239   chop_image=ChopImage(wand->images,&chop,wand->exception);
1240   if (chop_image == (Image *) NULL)
1241     return(MagickFalse);
1242   ReplaceImageInList(&wand->images,chop_image);
1243   return(MagickTrue);
1244 }
1245 \f
1246 /*
1247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1248 %                                                                             %
1249 %                                                                             %
1250 %                                                                             %
1251 %   M a g i c k C l a m p I m a g e                                           %
1252 %                                                                             %
1253 %                                                                             %
1254 %                                                                             %
1255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1256 %
1257 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1258 %
1259 %  The format of the MagickClampImage method is:
1260 %
1261 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1262 %      MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1263 %        const ChannelType channel)
1264 %
1265 %  A description of each parameter follows:
1266 %
1267 %    o wand: the magick wand.
1268 %
1269 %    o channel: the channel.
1270 %
1271 */
1272
1273 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1274 {
1275   MagickBooleanType
1276     status;
1277
1278   status=MagickClampImageChannel(wand,DefaultChannels);
1279   return(status);
1280 }
1281
1282 WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1283   const ChannelType channel)
1284 {
1285   MagickBooleanType
1286     status;
1287
1288   assert(wand != (MagickWand *) NULL);
1289   assert(wand->signature == WandSignature);
1290   if (wand->debug != MagickFalse)
1291     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1292   if (wand->images == (Image *) NULL)
1293     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1294   status=ClampImageChannel(wand->images,channel);
1295   if (status == MagickFalse)
1296     InheritException(wand->exception,&wand->images->exception);
1297   return(status);
1298 }
1299 \f
1300 /*
1301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1302 %                                                                             %
1303 %                                                                             %
1304 %                                                                             %
1305 %   M a g i c k C l i p I m a g e                                             %
1306 %                                                                             %
1307 %                                                                             %
1308 %                                                                             %
1309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1310 %
1311 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1312 %  present.
1313 %
1314 %  The format of the MagickClipImage method is:
1315 %
1316 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1317 %
1318 %  A description of each parameter follows:
1319 %
1320 %    o wand: the magick wand.
1321 %
1322 */
1323 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1324 {
1325   MagickBooleanType
1326     status;
1327
1328   assert(wand != (MagickWand *) NULL);
1329   assert(wand->signature == WandSignature);
1330   if (wand->debug != MagickFalse)
1331     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1332   if (wand->images == (Image *) NULL)
1333     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1334   status=ClipImage(wand->images);
1335   if (status == MagickFalse)
1336     InheritException(wand->exception,&wand->images->exception);
1337   return(status);
1338 }
1339 \f
1340 /*
1341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1342 %                                                                             %
1343 %                                                                             %
1344 %                                                                             %
1345 %   M a g i c k C l i p I m a g e P a t h                                     %
1346 %                                                                             %
1347 %                                                                             %
1348 %                                                                             %
1349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1350 %
1351 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1352 %  present. Later operations take effect inside the path.  Id may be a number
1353 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1354 %  path.
1355 %
1356 %  The format of the MagickClipImagePath method is:
1357 %
1358 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1359 %        const char *pathname,const MagickBooleanType inside)
1360 %
1361 %  A description of each parameter follows:
1362 %
1363 %    o wand: the magick wand.
1364 %
1365 %    o pathname: name of clipping path resource. If name is preceded by #, use
1366 %      clipping path numbered by name.
1367 %
1368 %    o inside: if non-zero, later operations take effect inside clipping path.
1369 %      Otherwise later operations take effect outside clipping path.
1370 %
1371 */
1372 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1373   const char *pathname,const MagickBooleanType inside)
1374 {
1375   MagickBooleanType
1376     status;
1377
1378   assert(wand != (MagickWand *) NULL);
1379   assert(wand->signature == WandSignature);
1380   if (wand->debug != MagickFalse)
1381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1382   if (wand->images == (Image *) NULL)
1383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1384   status=ClipImagePath(wand->images,pathname,inside);
1385   if (status == MagickFalse)
1386     InheritException(wand->exception,&wand->images->exception);
1387   return(status);
1388 }
1389 \f
1390 /*
1391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1392 %                                                                             %
1393 %                                                                             %
1394 %                                                                             %
1395 %   M a g i c k C l u t I m a g e                                             %
1396 %                                                                             %
1397 %                                                                             %
1398 %                                                                             %
1399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1400 %
1401 %  MagickClutImage() replaces colors in the image from a color lookup table.
1402 %
1403 %  The format of the MagickClutImage method is:
1404 %
1405 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1406 %        const MagickWand *clut_wand)
1407 %      MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1408 %        const ChannelType channel,const MagickWand *clut_wand)
1409 %
1410 %  A description of each parameter follows:
1411 %
1412 %    o wand: the magick wand.
1413 %
1414 %    o clut_image: the clut image.
1415 %
1416 */
1417
1418 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1419   const MagickWand *clut_wand)
1420 {
1421   MagickBooleanType
1422     status;
1423
1424   status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
1425   return(status);
1426 }
1427
1428 WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1429   const ChannelType channel,const MagickWand *clut_wand)
1430 {
1431   MagickBooleanType
1432     status;
1433
1434   assert(wand != (MagickWand *) NULL);
1435   assert(wand->signature == WandSignature);
1436   if (wand->debug != MagickFalse)
1437     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1438   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1439     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1440   status=ClutImageChannel(wand->images,channel,clut_wand->images);
1441   if (status == MagickFalse)
1442     InheritException(wand->exception,&wand->images->exception);
1443   return(status);
1444 }
1445 \f
1446 /*
1447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1448 %                                                                             %
1449 %                                                                             %
1450 %                                                                             %
1451 %   M a g i c k C o a l e s c e I m a g e s                                   %
1452 %                                                                             %
1453 %                                                                             %
1454 %                                                                             %
1455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1456 %
1457 %  MagickCoalesceImages() composites a set of images while respecting any page
1458 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1459 %  typically start with an image background and each subsequent image
1460 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1461 %  where each image in the sequence is the same size as the first and
1462 %  composited with the next image in the sequence.
1463 %
1464 %  The format of the MagickCoalesceImages method is:
1465 %
1466 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1467 %
1468 %  A description of each parameter follows:
1469 %
1470 %    o wand: the magick wand.
1471 %
1472 */
1473 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1474 {
1475   Image
1476     *coalesce_image;
1477
1478   assert(wand != (MagickWand *) NULL);
1479   assert(wand->signature == WandSignature);
1480   if (wand->debug != MagickFalse)
1481     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1482   if (wand->images == (Image *) NULL)
1483     return((MagickWand *) NULL);
1484   coalesce_image=CoalesceImages(wand->images,wand->exception);
1485   if (coalesce_image == (Image *) NULL)
1486     return((MagickWand *) NULL);
1487   return(CloneMagickWandFromImages(wand,coalesce_image));
1488 }
1489 \f
1490 /*
1491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1492 %                                                                             %
1493 %                                                                             %
1494 %                                                                             %
1495 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1496 %                                                                             %
1497 %                                                                             %
1498 %                                                                             %
1499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1500 %
1501 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1502 %  Collection (CCC) file which solely contains one or more color corrections
1503 %  and applies the color correction to the image.  Here is a sample CCC file:
1504 %
1505 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1506 %          <ColorCorrection id="cc03345">
1507 %                <SOPNode>
1508 %                     <Slope> 0.9 1.2 0.5 </Slope>
1509 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1510 %                     <Power> 1.0 0.8 1.5 </Power>
1511 %                </SOPNode>
1512 %                <SATNode>
1513 %                     <Saturation> 0.85 </Saturation>
1514 %                </SATNode>
1515 %          </ColorCorrection>
1516 %    </ColorCorrectionCollection>
1517 %
1518 %  which includes the offset, slope, and power for each of the RGB channels
1519 %  as well as the saturation.
1520 %
1521 %  The format of the MagickColorDecisionListImage method is:
1522 %
1523 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1524 %        const double gamma)
1525 %
1526 %  A description of each parameter follows:
1527 %
1528 %    o wand: the magick wand.
1529 %
1530 %    o color_correction_collection: the color correction collection in XML.
1531 %
1532 */
1533 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1534   const char *color_correction_collection)
1535 {
1536   MagickBooleanType
1537     status;
1538
1539   assert(wand != (MagickWand *) NULL);
1540   assert(wand->signature == WandSignature);
1541   if (wand->debug != MagickFalse)
1542     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1543   if (wand->images == (Image *) NULL)
1544     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1545   status=ColorDecisionListImage(wand->images,color_correction_collection);
1546   if (status == MagickFalse)
1547     InheritException(wand->exception,&wand->images->exception);
1548   return(status);
1549 }
1550 \f
1551 /*
1552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1553 %                                                                             %
1554 %                                                                             %
1555 %                                                                             %
1556 %   M a g i c k C o l o r i z e I m a g e                                     %
1557 %                                                                             %
1558 %                                                                             %
1559 %                                                                             %
1560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1561 %
1562 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1563 %
1564 %  The format of the MagickColorizeImage method is:
1565 %
1566 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1567 %        const PixelWand *colorize,const PixelWand *opacity)
1568 %
1569 %  A description of each parameter follows:
1570 %
1571 %    o wand: the magick wand.
1572 %
1573 %    o colorize: the colorize pixel wand.
1574 %
1575 %    o opacity: the opacity pixel wand.
1576 %
1577 */
1578 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1579   const PixelWand *colorize,const PixelWand *opacity)
1580 {
1581   char
1582     percent_opaque[MaxTextExtent];
1583
1584   Image
1585     *colorize_image;
1586
1587   PixelPacket
1588     target;
1589
1590   assert(wand != (MagickWand *) NULL);
1591   assert(wand->signature == WandSignature);
1592   if (wand->debug != MagickFalse)
1593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1594   if (wand->images == (Image *) NULL)
1595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1596   (void) FormatMagickString(percent_opaque,MaxTextExtent,
1597     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1598     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1599     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1600     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1601     PixelGetOpacityQuantum(opacity)));
1602   PixelGetQuantumColor(colorize,&target);
1603   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1604     wand->exception);
1605   if (colorize_image == (Image *) NULL)
1606     return(MagickFalse);
1607   ReplaceImageInList(&wand->images,colorize_image);
1608   return(MagickTrue);
1609 }
1610 \f
1611 /*
1612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1613 %                                                                             %
1614 %                                                                             %
1615 %                                                                             %
1616 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1617 %                                                                             %
1618 %                                                                             %
1619 %                                                                             %
1620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1621 %
1622 %  MagickColorMatrixImage() apply color transformation to an image. The method
1623 %  permits saturation changes, hue rotation, luminance to alpha, and various
1624 %  other effects.  Although variable-sized transformation matrices can be used,
1625 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1626 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1627 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1628 %  and offsets are normalized (divide Flash offset by 255).
1629 %
1630 %  The format of the MagickColorMatrixImage method is:
1631 %
1632 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1633 %        const KernelInfo *color_matrix)
1634 %
1635 %  A description of each parameter follows:
1636 %
1637 %    o wand: the magick wand.
1638 %
1639 %    o color_matrix:  the color matrix.
1640 %
1641 */
1642 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1643   const KernelInfo *color_matrix)
1644 {
1645   Image
1646     *color_image;
1647
1648   assert(wand != (MagickWand *) NULL);
1649   assert(wand->signature == WandSignature);
1650   if (wand->debug != MagickFalse)
1651     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1652   if (color_matrix == (const KernelInfo *) NULL)
1653     return(MagickFalse);
1654   if (wand->images == (Image *) NULL)
1655     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1656   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1657   if (color_image == (Image *) NULL)
1658     return(MagickFalse);
1659   ReplaceImageInList(&wand->images,color_image);
1660   return(MagickTrue);
1661 }
1662 \f
1663 /*
1664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1665 %                                                                             %
1666 %                                                                             %
1667 %                                                                             %
1668 %   M a g i c k C o m b i n e I m a g e s                                     %
1669 %                                                                             %
1670 %                                                                             %
1671 %                                                                             %
1672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1673 %
1674 %  MagickCombineImages() combines one or more images into a single image.  The
1675 %  grayscale value of the pixels of each image in the sequence is assigned in
1676 %  order to the specified  hannels of the combined image.   The typical
1677 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1678 %
1679 %  The format of the MagickCombineImages method is:
1680 %
1681 %      MagickWand *MagickCombineImages(MagickWand *wand,
1682 %        const ChannelType channel)
1683 %
1684 %  A description of each parameter follows:
1685 %
1686 %    o wand: the magick wand.
1687 %
1688 %    o channel: the channel.
1689 %
1690 */
1691 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1692   const ChannelType channel)
1693 {
1694   Image
1695     *combine_image;
1696
1697   assert(wand != (MagickWand *) NULL);
1698   assert(wand->signature == WandSignature);
1699   if (wand->debug != MagickFalse)
1700     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1701   if (wand->images == (Image *) NULL)
1702     return((MagickWand *) NULL);
1703   combine_image=CombineImages(wand->images,channel,wand->exception);
1704   if (combine_image == (Image *) NULL)
1705     return((MagickWand *) NULL);
1706   return(CloneMagickWandFromImages(wand,combine_image));
1707 }
1708 \f
1709 /*
1710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1711 %                                                                             %
1712 %                                                                             %
1713 %                                                                             %
1714 %   M a g i c k C o m m e n t I m a g e                                       %
1715 %                                                                             %
1716 %                                                                             %
1717 %                                                                             %
1718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1719 %
1720 %  MagickCommentImage() adds a comment to your image.
1721 %
1722 %  The format of the MagickCommentImage method is:
1723 %
1724 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1725 %        const char *comment)
1726 %
1727 %  A description of each parameter follows:
1728 %
1729 %    o wand: the magick wand.
1730 %
1731 %    o comment: the image comment.
1732 %
1733 */
1734 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1735   const char *comment)
1736 {
1737   MagickBooleanType
1738     status;
1739
1740   assert(wand != (MagickWand *) NULL);
1741   assert(wand->signature == WandSignature);
1742   if (wand->debug != MagickFalse)
1743     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1744   if (wand->images == (Image *) NULL)
1745     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1746   status=SetImageProperty(wand->images,"comment",comment);
1747   if (status == MagickFalse)
1748     InheritException(wand->exception,&wand->images->exception);
1749   return(status);
1750 }
1751 \f
1752 /*
1753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1754 %                                                                             %
1755 %                                                                             %
1756 %                                                                             %
1757 %   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                       %
1758 %                                                                             %
1759 %                                                                             %
1760 %                                                                             %
1761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1762 %
1763 %  MagickCompareImageChannels() compares one or more image channels of an image
1764 %  to a reconstructed image and returns the difference image.
1765 %
1766 %  The format of the MagickCompareImageChannels method is:
1767 %
1768 %      MagickWand *MagickCompareImageChannels(MagickWand *wand,
1769 %        const MagickWand *reference,const ChannelType channel,
1770 %        const MetricType metric,double *distortion)
1771 %
1772 %  A description of each parameter follows:
1773 %
1774 %    o wand: the magick wand.
1775 %
1776 %    o reference: the reference wand.
1777 %
1778 %    o channel: the channel.
1779 %
1780 %    o metric: the metric.
1781 %
1782 %    o distortion: the computed distortion between the images.
1783 %
1784 */
1785 WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
1786   const MagickWand *reference,const ChannelType channel,const MetricType metric,
1787   double *distortion)
1788 {
1789   Image
1790     *compare_image;
1791
1792   assert(wand != (MagickWand *) NULL);
1793   assert(wand->signature == WandSignature);
1794   if (wand->debug != MagickFalse)
1795     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1796   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1797     {
1798       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1799         "ContainsNoImages","`%s'",wand->name);
1800       return((MagickWand *) NULL);
1801     }
1802   compare_image=CompareImageChannels(wand->images,reference->images,channel,
1803     metric,distortion,&wand->images->exception);
1804   if (compare_image == (Image *) NULL)
1805     return((MagickWand *) NULL);
1806   return(CloneMagickWandFromImages(wand,compare_image));
1807 }
1808 \f
1809 /*
1810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1811 %                                                                             %
1812 %                                                                             %
1813 %                                                                             %
1814 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1815 %                                                                             %
1816 %                                                                             %
1817 %                                                                             %
1818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1819 %
1820 %  MagickCompareImageLayers() compares each image with the next in a sequence
1821 %  and returns the maximum bounding region of any pixel differences it
1822 %  discovers.
1823 %
1824 %  The format of the MagickCompareImageLayers method is:
1825 %
1826 %      MagickWand *MagickCompareImageLayers(MagickWand *wand,
1827 %        const ImageLayerMethod method)
1828 %
1829 %  A description of each parameter follows:
1830 %
1831 %    o wand: the magick wand.
1832 %
1833 %    o method: the compare method.
1834 %
1835 */
1836 WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
1837   const ImageLayerMethod method)
1838 {
1839   Image
1840     *layers_image;
1841
1842   assert(wand != (MagickWand *) NULL);
1843   assert(wand->signature == WandSignature);
1844   if (wand->debug != MagickFalse)
1845     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1846   if (wand->images == (Image *) NULL)
1847     return((MagickWand *) NULL);
1848   layers_image=CompareImageLayers(wand->images,method,wand->exception);
1849   if (layers_image == (Image *) NULL)
1850     return((MagickWand *) NULL);
1851   return(CloneMagickWandFromImages(wand,layers_image));
1852 }
1853 \f
1854 /*
1855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1856 %                                                                             %
1857 %                                                                             %
1858 %                                                                             %
1859 %   M a g i c k C o m p a r e I m a g e s                                     %
1860 %                                                                             %
1861 %                                                                             %
1862 %                                                                             %
1863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1864 %
1865 %  MagickCompareImages() compares an image to a reconstructed image and returns
1866 %  the specified difference image.
1867 %
1868 %  The format of the MagickCompareImages method is:
1869 %
1870 %      MagickWand *MagickCompareImages(MagickWand *wand,
1871 %        const MagickWand *reference,const MetricType metric,
1872 %        double *distortion)
1873 %
1874 %  A description of each parameter follows:
1875 %
1876 %    o wand: the magick wand.
1877 %
1878 %    o reference: the reference wand.
1879 %
1880 %    o metric: the metric.
1881 %
1882 %    o distortion: the computed distortion between the images.
1883 %
1884 */
1885 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1886   const MagickWand *reference,const MetricType metric,double *distortion)
1887 {
1888   Image
1889     *compare_image;
1890
1891
1892   assert(wand != (MagickWand *) NULL);
1893   assert(wand->signature == WandSignature);
1894   if (wand->debug != MagickFalse)
1895     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1896   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1897     {
1898       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1899         "ContainsNoImages","`%s'",wand->name);
1900       return((MagickWand *) NULL);
1901     }
1902   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1903     &wand->images->exception);
1904   if (compare_image == (Image *) NULL)
1905     return((MagickWand *) NULL);
1906   return(CloneMagickWandFromImages(wand,compare_image));
1907 }
1908 \f
1909 /*
1910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1911 %                                                                             %
1912 %                                                                             %
1913 %                                                                             %
1914 %   M a g i c k C o m p o s i t e I m a g e                                   %
1915 %                                                                             %
1916 %                                                                             %
1917 %                                                                             %
1918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1919 %
1920 %  MagickCompositeImage() composite one image onto another at the specified
1921 %  offset.
1922 %
1923 %  The format of the MagickCompositeImage method is:
1924 %
1925 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1926 %        const MagickWand *composite_wand,const CompositeOperator compose,
1927 %        const ssize_t x,const ssize_t y)
1928 %      MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1929 %        const ChannelType channel,const MagickWand *composite_wand,
1930 %        const CompositeOperator compose,const ssize_t x,const ssize_t y)
1931 %
1932 %  A description of each parameter follows:
1933 %
1934 %    o wand: the magick wand.
1935 %
1936 %    o composite_image: the composite image.
1937 %
1938 %    o compose: This operator affects how the composite is applied to the
1939 %      image.  The default is Over.  Choose from these operators:
1940 %
1941 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1942 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1943 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1944 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1945 %        DisplaceCompositeOp
1946 %
1947 %    o x: the column offset of the composited image.
1948 %
1949 %    o y: the row offset of the composited image.
1950 %
1951 */
1952
1953 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1954   const MagickWand *composite_wand,const CompositeOperator compose,const ssize_t x,
1955   const ssize_t y)
1956 {
1957   MagickBooleanType
1958     status;
1959
1960   status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
1961     compose,x,y);
1962   return(status);
1963 }
1964
1965 WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1966   const ChannelType channel,const MagickWand *composite_wand,
1967   const CompositeOperator compose,const ssize_t x,const ssize_t y)
1968 {
1969   MagickBooleanType
1970     status;
1971
1972   assert(wand != (MagickWand *) NULL);
1973   assert(wand->signature == WandSignature);
1974   if (wand->debug != MagickFalse)
1975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1976   if ((wand->images == (Image *) NULL) ||
1977       (composite_wand->images == (Image *) NULL))
1978     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1979   status=CompositeImageChannel(wand->images,channel,compose,
1980     composite_wand->images,x,y);
1981   if (status == MagickFalse)
1982     InheritException(wand->exception,&wand->images->exception);
1983   return(status);
1984 }
1985 \f
1986 /*
1987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1988 %                                                                             %
1989 %                                                                             %
1990 %                                                                             %
1991 %   M a g i c k C o n t r a s t I m a g e                                     %
1992 %                                                                             %
1993 %                                                                             %
1994 %                                                                             %
1995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1996 %
1997 %  MagickContrastImage() enhances the intensity differences between the lighter
1998 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1999 %  increase the image contrast otherwise the contrast is reduced.
2000 %
2001 %  The format of the MagickContrastImage method is:
2002 %
2003 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
2004 %        const MagickBooleanType sharpen)
2005 %
2006 %  A description of each parameter follows:
2007 %
2008 %    o wand: the magick wand.
2009 %
2010 %    o sharpen: Increase or decrease image contrast.
2011 %
2012 %
2013 */
2014 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2015   const MagickBooleanType sharpen)
2016 {
2017   MagickBooleanType
2018     status;
2019
2020   assert(wand != (MagickWand *) NULL);
2021   assert(wand->signature == WandSignature);
2022   if (wand->debug != MagickFalse)
2023     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2024   if (wand->images == (Image *) NULL)
2025     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2026   status=ContrastImage(wand->images,sharpen);
2027   if (status == MagickFalse)
2028     InheritException(wand->exception,&wand->images->exception);
2029   return(status);
2030 }
2031 \f
2032 /*
2033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2034 %                                                                             %
2035 %                                                                             %
2036 %                                                                             %
2037 %   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                       %
2038 %                                                                             %
2039 %                                                                             %
2040 %                                                                             %
2041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2042 %
2043 %  MagickContrastStretchImage() enhances the contrast of a color image by
2044 %  adjusting the pixels color to span the entire range of colors available.
2045 %  You can also reduce the influence of a particular channel with a gamma
2046 %  value of 0.
2047 %
2048 %  The format of the MagickContrastStretchImage method is:
2049 %
2050 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2051 %        const double black_point,const double white_point)
2052 %      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2053 %        const ChannelType channel,const double black_point,
2054 %        const double white_point)
2055 %
2056 %  A description of each parameter follows:
2057 %
2058 %    o wand: the magick wand.
2059 %
2060 %    o channel: the image channel(s).
2061 %
2062 %    o black_point: the black point.
2063 %
2064 %    o white_point: the white point.
2065 %
2066 */
2067
2068 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2069   const double black_point,const double white_point)
2070 {
2071   MagickBooleanType
2072     status;
2073
2074   status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
2075     white_point);
2076   return(status);
2077 }
2078
2079 WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2080   const ChannelType channel,const double black_point,const double white_point)
2081 {
2082   MagickBooleanType
2083     status;
2084
2085   assert(wand != (MagickWand *) NULL);
2086   assert(wand->signature == WandSignature);
2087   if (wand->debug != MagickFalse)
2088     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2089   if (wand->images == (Image *) NULL)
2090     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2091   status=ContrastStretchImageChannel(wand->images,channel,black_point,
2092     white_point);
2093   if (status == MagickFalse)
2094     InheritException(wand->exception,&wand->images->exception);
2095   return(status);
2096 }
2097 \f
2098 /*
2099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2100 %                                                                             %
2101 %                                                                             %
2102 %                                                                             %
2103 %   M a g i c k C o n v o l v e I m a g e                                     %
2104 %                                                                             %
2105 %                                                                             %
2106 %                                                                             %
2107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2108 %
2109 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2110 %
2111 %  The format of the MagickConvolveImage method is:
2112 %
2113 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2114 %        const size_t order,const double *kernel)
2115 %      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2116 %        const ChannelType channel,const size_t order,
2117 %        const double *kernel)
2118 %
2119 %  A description of each parameter follows:
2120 %
2121 %    o wand: the magick wand.
2122 %
2123 %    o channel: the image channel(s).
2124 %
2125 %    o order: the number of columns and rows in the filter kernel.
2126 %
2127 %    o kernel: An array of doubles representing the convolution kernel.
2128 %
2129 */
2130
2131 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2132   const size_t order,const double *kernel)
2133 {
2134   MagickBooleanType
2135     status;
2136
2137   status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2138   return(status);
2139 }
2140
2141 WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2142   const ChannelType channel,const size_t order,const double *kernel)
2143 {
2144   Image
2145     *convolve_image;
2146
2147   assert(wand != (MagickWand *) NULL);
2148   assert(wand->signature == WandSignature);
2149   if (wand->debug != MagickFalse)
2150     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2151   if (kernel == (const double *) NULL)
2152     return(MagickFalse);
2153   if (wand->images == (Image *) NULL)
2154     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2155   convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2156     wand->exception);
2157   if (convolve_image == (Image *) NULL)
2158     return(MagickFalse);
2159   ReplaceImageInList(&wand->images,convolve_image);
2160   return(MagickTrue);
2161 }
2162 \f
2163 /*
2164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2165 %                                                                             %
2166 %                                                                             %
2167 %                                                                             %
2168 %   M a g i c k C r o p I m a g e                                             %
2169 %                                                                             %
2170 %                                                                             %
2171 %                                                                             %
2172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2173 %
2174 %  MagickCropImage() extracts a region of the image.
2175 %
2176 %  The format of the MagickCropImage method is:
2177 %
2178 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2179 %        const size_t width,const size_t height,const ssize_t x,
2180 %        const ssize_t y)
2181 %
2182 %  A description of each parameter follows:
2183 %
2184 %    o wand: the magick wand.
2185 %
2186 %    o width: the region width.
2187 %
2188 %    o height: the region height.
2189 %
2190 %    o x: the region x-offset.
2191 %
2192 %    o y: the region y-offset.
2193 %
2194 */
2195 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2196   const size_t width,const size_t height,const ssize_t x,
2197   const ssize_t y)
2198 {
2199   Image
2200     *crop_image;
2201
2202   RectangleInfo
2203     crop;
2204
2205   assert(wand != (MagickWand *) NULL);
2206   assert(wand->signature == WandSignature);
2207   if (wand->debug != MagickFalse)
2208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2209   if (wand->images == (Image *) NULL)
2210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2211   crop.width=width;
2212   crop.height=height;
2213   crop.x=x;
2214   crop.y=y;
2215   crop_image=CropImage(wand->images,&crop,wand->exception);
2216   if (crop_image == (Image *) NULL)
2217     return(MagickFalse);
2218   ReplaceImageInList(&wand->images,crop_image);
2219   return(MagickTrue);
2220 }
2221 \f
2222 /*
2223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2224 %                                                                             %
2225 %                                                                             %
2226 %                                                                             %
2227 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2228 %                                                                             %
2229 %                                                                             %
2230 %                                                                             %
2231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2232 %
2233 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2234 %  of positions.  If you cycle the colormap a number of times you can produce
2235 %  a psychodelic effect.
2236 %
2237 %  The format of the MagickCycleColormapImage method is:
2238 %
2239 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2240 %        const ssize_t displace)
2241 %
2242 %  A description of each parameter follows:
2243 %
2244 %    o wand: the magick wand.
2245 %
2246 %    o pixel_wand: the pixel wand.
2247 %
2248 */
2249 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2250   const ssize_t displace)
2251 {
2252   MagickBooleanType
2253     status;
2254
2255   assert(wand != (MagickWand *) NULL);
2256   assert(wand->signature == WandSignature);
2257   if (wand->debug != MagickFalse)
2258     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2259   if (wand->images == (Image *) NULL)
2260     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2261   status=CycleColormapImage(wand->images,displace);
2262   if (status == MagickFalse)
2263     InheritException(wand->exception,&wand->images->exception);
2264   return(status);
2265 }
2266 \f
2267 /*
2268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2269 %                                                                             %
2270 %                                                                             %
2271 %                                                                             %
2272 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2273 %                                                                             %
2274 %                                                                             %
2275 %                                                                             %
2276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2277 %
2278 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2279 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2280 %  The data can be char, short int, int, float, or double.  Float and double
2281 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2282 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2283 %  example, to create a 640x480 image from unsigned red-green-blue character
2284 %  data, use
2285 %
2286 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2287 %
2288 %  The format of the MagickConstituteImage method is:
2289 %
2290 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2291 %        const size_t columns,const size_t rows,const char *map,
2292 %        const StorageType storage,void *pixels)
2293 %
2294 %  A description of each parameter follows:
2295 %
2296 %    o wand: the magick wand.
2297 %
2298 %    o columns: width in pixels of the image.
2299 %
2300 %    o rows: height in pixels of the image.
2301 %
2302 %    o map:  This string reflects the expected ordering of the pixel array.
2303 %      It can be any combination or order of R = red, G = green, B = blue,
2304 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2305 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2306 %      P = pad.
2307 %
2308 %    o storage: Define the data type of the pixels.  Float and double types are
2309 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2310 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2311 %      LongPixel, QuantumPixel, or ShortPixel.
2312 %
2313 %    o pixels: This array of values contain the pixel components as defined by
2314 %      map and type.  You must preallocate this array where the expected
2315 %      length varies depending on the values of width, height, map, and type.
2316 %
2317 %
2318 */
2319 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2320   const size_t columns,const size_t rows,const char *map,
2321   const StorageType storage,const void *pixels)
2322 {
2323   Image
2324     *images;
2325
2326   assert(wand != (MagickWand *) NULL);
2327   assert(wand->signature == WandSignature);
2328   if (wand->debug != MagickFalse)
2329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2330   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2331   if (images == (Image *) NULL)
2332     return(MagickFalse);
2333   return(InsertImageInWand(wand,images));
2334 }
2335 \f
2336 /*
2337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338 %                                                                             %
2339 %                                                                             %
2340 %                                                                             %
2341 %   M a g i c k D e c i p h e r I m a g e                                     %
2342 %                                                                             %
2343 %                                                                             %
2344 %                                                                             %
2345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346 %
2347 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2348 %
2349 %  The format of the MagickDecipherImage method is:
2350 %
2351 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2352 %        const char *passphrase)
2353 %
2354 %  A description of each parameter follows:
2355 %
2356 %    o wand: the magick wand.
2357 %
2358 %    o passphrase: the passphrase.
2359 %
2360 */
2361 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2362   const char *passphrase)
2363 {
2364   assert(wand != (MagickWand *) NULL);
2365   assert(wand->signature == WandSignature);
2366   if (wand->debug != MagickFalse)
2367     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2368   if (wand->images == (Image *) NULL)
2369     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2370   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2371 }
2372 \f
2373 /*
2374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375 %                                                                             %
2376 %                                                                             %
2377 %                                                                             %
2378 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2379 %                                                                             %
2380 %                                                                             %
2381 %                                                                             %
2382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2383 %
2384 %  MagickDeconstructImages() compares each image with the next in a sequence
2385 %  and returns the maximum bounding region of any pixel differences it
2386 %  discovers.
2387 %
2388 %  The format of the MagickDeconstructImages method is:
2389 %
2390 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2391 %
2392 %  A description of each parameter follows:
2393 %
2394 %    o wand: the magick wand.
2395 %
2396 */
2397 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2398 {
2399   Image
2400     *deconstruct_image;
2401
2402   assert(wand != (MagickWand *) NULL);
2403   assert(wand->signature == WandSignature);
2404   if (wand->debug != MagickFalse)
2405     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2406   if (wand->images == (Image *) NULL)
2407     return((MagickWand *) NULL);
2408   deconstruct_image=DeconstructImages(wand->images,wand->exception);
2409   if (deconstruct_image == (Image *) NULL)
2410     return((MagickWand *) NULL);
2411   return(CloneMagickWandFromImages(wand,deconstruct_image));
2412 }
2413 \f
2414 /*
2415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2416 %                                                                             %
2417 %                                                                             %
2418 %                                                                             %
2419 %     M a g i c k D e s k e w I m a g e                                       %
2420 %                                                                             %
2421 %                                                                             %
2422 %                                                                             %
2423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2424 %
2425 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2426 %  occurs in scanned images because of the camera being misaligned,
2427 %  imperfections in the scanning or surface, or simply because the paper was
2428 %  not placed completely flat when scanned.
2429 %
2430 %  The format of the MagickDeskewImage method is:
2431 %
2432 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2433 %        const double threshold)
2434 %
2435 %  A description of each parameter follows:
2436 %
2437 %    o wand: the magick wand.
2438 %
2439 %    o threshold: separate background from foreground.
2440 %
2441 */
2442 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2443   const double threshold)
2444 {
2445   Image
2446     *sepia_image;
2447
2448   assert(wand != (MagickWand *) NULL);
2449   assert(wand->signature == WandSignature);
2450   if (wand->debug != MagickFalse)
2451     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2452   if (wand->images == (Image *) NULL)
2453     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2454   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2455   if (sepia_image == (Image *) NULL)
2456     return(MagickFalse);
2457   ReplaceImageInList(&wand->images,sepia_image);
2458   return(MagickTrue);
2459 }
2460 \f
2461 /*
2462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2463 %                                                                             %
2464 %                                                                             %
2465 %                                                                             %
2466 %     M a g i c k D e s p e c k l e I m a g e                                 %
2467 %                                                                             %
2468 %                                                                             %
2469 %                                                                             %
2470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2471 %
2472 %  MagickDespeckleImage() reduces the speckle noise in an image while
2473 %  perserving the edges of the original image.
2474 %
2475 %  The format of the MagickDespeckleImage method is:
2476 %
2477 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2478 %
2479 %  A description of each parameter follows:
2480 %
2481 %    o wand: the magick wand.
2482 %
2483 */
2484 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2485 {
2486   Image
2487     *despeckle_image;
2488
2489   assert(wand != (MagickWand *) NULL);
2490   assert(wand->signature == WandSignature);
2491   if (wand->debug != MagickFalse)
2492     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2493   if (wand->images == (Image *) NULL)
2494     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2495   despeckle_image=DespeckleImage(wand->images,wand->exception);
2496   if (despeckle_image == (Image *) NULL)
2497     return(MagickFalse);
2498   ReplaceImageInList(&wand->images,despeckle_image);
2499   return(MagickTrue);
2500 }
2501 \f
2502 /*
2503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2504 %                                                                             %
2505 %                                                                             %
2506 %                                                                             %
2507 %   M a g i c k D e s t r o y I m a g e                                       %
2508 %                                                                             %
2509 %                                                                             %
2510 %                                                                             %
2511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2512 %
2513 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2514 %  with the image if the reference count becomes zero.
2515 %
2516 %  The format of the MagickDestroyImage method is:
2517 %
2518 %      Image *MagickDestroyImage(Image *image)
2519 %
2520 %  A description of each parameter follows:
2521 %
2522 %    o image: the image.
2523 %
2524 */
2525 WandExport Image *MagickDestroyImage(Image *image)
2526 {
2527   return(DestroyImage(image));
2528 }
2529 \f
2530 /*
2531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2532 %                                                                             %
2533 %                                                                             %
2534 %                                                                             %
2535 %   M a g i c k D i s p l a y I m a g e                                       %
2536 %                                                                             %
2537 %                                                                             %
2538 %                                                                             %
2539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2540 %
2541 %  MagickDisplayImage() displays an image.
2542 %
2543 %  The format of the MagickDisplayImage method is:
2544 %
2545 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2546 %        const char *server_name)
2547 %
2548 %  A description of each parameter follows:
2549 %
2550 %    o wand: the magick wand.
2551 %
2552 %    o server_name: the X server name.
2553 %
2554 */
2555 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2556   const char *server_name)
2557 {
2558   Image
2559     *image;
2560
2561   MagickBooleanType
2562     status;
2563
2564   assert(wand != (MagickWand *) NULL);
2565   assert(wand->signature == WandSignature);
2566   if (wand->debug != MagickFalse)
2567     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2568   if (wand->images == (Image *) NULL)
2569     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2570   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2571   if (image == (Image *) NULL)
2572     return(MagickFalse);
2573   (void) CloneString(&wand->image_info->server_name,server_name);
2574   status=DisplayImages(wand->image_info,image);
2575   if (status == MagickFalse)
2576     InheritException(wand->exception,&image->exception);
2577   image=DestroyImage(image);
2578   return(status);
2579 }
2580 \f
2581 /*
2582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2583 %                                                                             %
2584 %                                                                             %
2585 %                                                                             %
2586 %   M a g i c k D i s p l a y I m a g e s                                     %
2587 %                                                                             %
2588 %                                                                             %
2589 %                                                                             %
2590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2591 %
2592 %  MagickDisplayImages() displays an image or image sequence.
2593 %
2594 %  The format of the MagickDisplayImages method is:
2595 %
2596 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2597 %        const char *server_name)
2598 %
2599 %  A description of each parameter follows:
2600 %
2601 %    o wand: the magick wand.
2602 %
2603 %    o server_name: the X server name.
2604 %
2605 */
2606 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2607   const char *server_name)
2608 {
2609   MagickBooleanType
2610     status;
2611
2612   assert(wand != (MagickWand *) NULL);
2613   assert(wand->signature == WandSignature);
2614   if (wand->debug != MagickFalse)
2615     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2616   (void) CloneString(&wand->image_info->server_name,server_name);
2617   status=DisplayImages(wand->image_info,wand->images);
2618   if (status == MagickFalse)
2619     InheritException(wand->exception,&wand->images->exception);
2620   return(status);
2621 }
2622 \f
2623 /*
2624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2625 %                                                                             %
2626 %                                                                             %
2627 %                                                                             %
2628 %   M a g i c k D i s t o r t I m a g e                                       %
2629 %                                                                             %
2630 %                                                                             %
2631 %                                                                             %
2632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2633 %
2634 %  MagickDistortImage() distorts an image using various distortion methods, by
2635 %  mapping color lookups of the source image to a new destination image
2636 %  usally of the same size as the source image, unless 'bestfit' is set to
2637 %  true.
2638 %
2639 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2640 %  adjusted to ensure the whole source 'image' will just fit within the final
2641 %  destination image, which will be sized and offset accordingly.  Also in
2642 %  many cases the virtual offset of the source image will be taken into
2643 %  account in the mapping.
2644 %
2645 %  The format of the MagickDistortImage method is:
2646 %
2647 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2648 %        const DistortImageMethod method,const size_t number_arguments,
2649 %        const double *arguments,const MagickBooleanType bestfit)
2650 %
2651 %  A description of each parameter follows:
2652 %
2653 %    o image: the image to be distorted.
2654 %
2655 %    o method: the method of image distortion.
2656 %
2657 %        ArcDistortion always ignores the source image offset, and always
2658 %        'bestfit' the destination image with the top left corner offset
2659 %        relative to the polar mapping center.
2660 %
2661 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2662 %        style of image distortion.
2663 %
2664 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2665 %        distortion when more than the minimum number of control point pairs
2666 %        are provided.
2667 %
2668 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2669 %        that 4 control point pairs are provided. While Affine distortions let
2670 %        you use any number of control point pairs, that is Zero pairs is a
2671 %        no-Op (viewport only) distrotion, one pair is a translation and two
2672 %        pairs of control points do a scale-rotate-translate, without any
2673 %        shearing.
2674 %
2675 %    o number_arguments: the number of arguments given for this distortion
2676 %      method.
2677 %
2678 %    o arguments: the arguments for this distortion method.
2679 %
2680 %    o bestfit: Attempt to resize destination to fit distorted source.
2681 %
2682 */
2683 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2684   const DistortImageMethod method,const size_t number_arguments,
2685   const double *arguments,const MagickBooleanType bestfit)
2686 {
2687   Image
2688     *distort_image;
2689
2690   assert(wand != (MagickWand *) NULL);
2691   assert(wand->signature == WandSignature);
2692   if (wand->debug != MagickFalse)
2693     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2694   if (wand->images == (Image *) NULL)
2695     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2696   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2697     bestfit,wand->exception);
2698   if (distort_image == (Image *) NULL)
2699     return(MagickFalse);
2700   ReplaceImageInList(&wand->images,distort_image);
2701   return(MagickTrue);
2702 }
2703 \f
2704 /*
2705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2706 %                                                                             %
2707 %                                                                             %
2708 %                                                                             %
2709 %   M a g i c k D r a w I m a g e                                             %
2710 %                                                                             %
2711 %                                                                             %
2712 %                                                                             %
2713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2714 %
2715 %  MagickDrawImage() renders the drawing wand on the current image.
2716 %
2717 %  The format of the MagickDrawImage method is:
2718 %
2719 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2720 %        const DrawingWand *drawing_wand)
2721 %
2722 %  A description of each parameter follows:
2723 %
2724 %    o wand: the magick wand.
2725 %
2726 %    o drawing_wand: the draw wand.
2727 %
2728 */
2729 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2730   const DrawingWand *drawing_wand)
2731 {
2732   char
2733     *primitive;
2734
2735   DrawInfo
2736     *draw_info;
2737
2738   MagickBooleanType
2739     status;
2740
2741   assert(wand != (MagickWand *) NULL);
2742   assert(wand->signature == WandSignature);
2743   if (wand->debug != MagickFalse)
2744     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2745   if (wand->images == (Image *) NULL)
2746     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2747   draw_info=PeekDrawingWand(drawing_wand);
2748   if ((draw_info == (DrawInfo *) NULL) ||
2749       (draw_info->primitive == (char *) NULL))
2750     return(MagickFalse);
2751   primitive=AcquireString(draw_info->primitive);
2752   draw_info=DestroyDrawInfo(draw_info);
2753   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2754   draw_info->primitive=primitive;
2755   status=DrawImage(wand->images,draw_info);
2756   if (status == MagickFalse)
2757     InheritException(wand->exception,&wand->images->exception);
2758   draw_info=DestroyDrawInfo(draw_info);
2759   return(status);
2760 }
2761 \f
2762 /*
2763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2764 %                                                                             %
2765 %                                                                             %
2766 %                                                                             %
2767 %   M a g i c k E d g e I m a g e                                             %
2768 %                                                                             %
2769 %                                                                             %
2770 %                                                                             %
2771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2772 %
2773 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2774 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2775 %  radius for you.
2776 %
2777 %  The format of the MagickEdgeImage method is:
2778 %
2779 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2780 %
2781 %  A description of each parameter follows:
2782 %
2783 %    o wand: the magick wand.
2784 %
2785 %    o radius: the radius of the pixel neighborhood.
2786 %
2787 */
2788 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2789   const double radius)
2790 {
2791   Image
2792     *edge_image;
2793
2794   assert(wand != (MagickWand *) NULL);
2795   assert(wand->signature == WandSignature);
2796   if (wand->debug != MagickFalse)
2797     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2798   if (wand->images == (Image *) NULL)
2799     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2800   edge_image=EdgeImage(wand->images,radius,wand->exception);
2801   if (edge_image == (Image *) NULL)
2802     return(MagickFalse);
2803   ReplaceImageInList(&wand->images,edge_image);
2804   return(MagickTrue);
2805 }
2806 \f
2807 /*
2808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2809 %                                                                             %
2810 %                                                                             %
2811 %                                                                             %
2812 %   M a g i c k E m b o s s I m a g e                                         %
2813 %                                                                             %
2814 %                                                                             %
2815 %                                                                             %
2816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2817 %
2818 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2819 %  effect.  We convolve the image with a Gaussian operator of the given radius
2820 %  and standard deviation (sigma).  For reasonable results, radius should be
2821 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2822 %  radius for you.
2823 %
2824 %  The format of the MagickEmbossImage method is:
2825 %
2826 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2827 %        const double sigma)
2828 %
2829 %  A description of each parameter follows:
2830 %
2831 %    o wand: the magick wand.
2832 %
2833 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2834 %      pixel.
2835 %
2836 %    o sigma: the standard deviation of the Gaussian, in pixels.
2837 %
2838 */
2839 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2840   const double radius,const double sigma)
2841 {
2842   Image
2843     *emboss_image;
2844
2845   assert(wand != (MagickWand *) NULL);
2846   assert(wand->signature == WandSignature);
2847   if (wand->debug != MagickFalse)
2848     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2849   if (wand->images == (Image *) NULL)
2850     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2851   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2852   if (emboss_image == (Image *) NULL)
2853     return(MagickFalse);
2854   ReplaceImageInList(&wand->images,emboss_image);
2855   return(MagickTrue);
2856 }
2857 \f
2858 /*
2859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2860 %                                                                             %
2861 %                                                                             %
2862 %                                                                             %
2863 %   M a g i c k E n c i p h e r I m a g e                                     %
2864 %                                                                             %
2865 %                                                                             %
2866 %                                                                             %
2867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2868 %
2869 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2870 %
2871 %  The format of the MagickEncipherImage method is:
2872 %
2873 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2874 %        const char *passphrase)
2875 %
2876 %  A description of each parameter follows:
2877 %
2878 %    o wand: the magick wand.
2879 %
2880 %    o passphrase: the passphrase.
2881 %
2882 */
2883 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2884   const char *passphrase)
2885 {
2886   assert(wand != (MagickWand *) NULL);
2887   assert(wand->signature == WandSignature);
2888   if (wand->debug != MagickFalse)
2889     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2890   if (wand->images == (Image *) NULL)
2891     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2892   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2893 }
2894 \f
2895 /*
2896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2897 %                                                                             %
2898 %                                                                             %
2899 %                                                                             %
2900 %   M a g i c k E n h a n c e I m a g e                                       %
2901 %                                                                             %
2902 %                                                                             %
2903 %                                                                             %
2904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2905 %
2906 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2907 %  noisy image.
2908 %
2909 %  The format of the MagickEnhanceImage method is:
2910 %
2911 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2912 %
2913 %  A description of each parameter follows:
2914 %
2915 %    o wand: the magick wand.
2916 %
2917 */
2918 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2919 {
2920   Image
2921     *enhance_image;
2922
2923   assert(wand != (MagickWand *) NULL);
2924   assert(wand->signature == WandSignature);
2925   if (wand->debug != MagickFalse)
2926     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2927   if (wand->images == (Image *) NULL)
2928     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2929   enhance_image=EnhanceImage(wand->images,wand->exception);
2930   if (enhance_image == (Image *) NULL)
2931     return(MagickFalse);
2932   ReplaceImageInList(&wand->images,enhance_image);
2933   return(MagickTrue);
2934 }
2935 \f
2936 /*
2937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2938 %                                                                             %
2939 %                                                                             %
2940 %                                                                             %
2941 %   M a g i c k E q u a l i z e I m a g e                                     %
2942 %                                                                             %
2943 %                                                                             %
2944 %                                                                             %
2945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2946 %
2947 %  MagickEqualizeImage() equalizes the image histogram.
2948 %
2949 %  The format of the MagickEqualizeImage method is:
2950 %
2951 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2952 %      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2953 %        const ChannelType channel)
2954 %
2955 %  A description of each parameter follows:
2956 %
2957 %    o wand: the magick wand.
2958 %
2959 %    o channel: the image channel(s).
2960 %
2961 */
2962
2963 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2964 {
2965   MagickBooleanType
2966     status;
2967
2968   status=MagickEqualizeImageChannel(wand,DefaultChannels);
2969   return(status);
2970 }
2971
2972 WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2973   const ChannelType channel)
2974 {
2975   MagickBooleanType
2976     status;
2977
2978   assert(wand != (MagickWand *) NULL);
2979   assert(wand->signature == WandSignature);
2980   if (wand->debug != MagickFalse)
2981     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2982   if (wand->images == (Image *) NULL)
2983     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2984   status=EqualizeImageChannel(wand->images,channel);
2985   if (status == MagickFalse)
2986     InheritException(wand->exception,&wand->images->exception);
2987   return(status);
2988 }
2989 \f
2990 /*
2991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2992 %                                                                             %
2993 %                                                                             %
2994 %                                                                             %
2995 %   M a g i c k E v a l u a t e I m a g e                                     %
2996 %                                                                             %
2997 %                                                                             %
2998 %                                                                             %
2999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3000 %
3001 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
3002 %  expression to an image.  Use these operators to lighten or darken an image,
3003 %  to increase or decrease contrast in an image, or to produce the "negative"
3004 %  of an image.
3005 %
3006 %  The format of the MagickEvaluateImage method is:
3007 %
3008 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3009 %        const MagickEvaluateOperator operator,const double value)
3010 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3011 %        const MagickEvaluateOperator operator)
3012 %      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3013 %        const ChannelType channel,const MagickEvaluateOperator op,
3014 %        const double value)
3015 %
3016 %  A description of each parameter follows:
3017 %
3018 %    o wand: the magick wand.
3019 %
3020 %    o channel: the channel(s).
3021 %
3022 %    o op: A channel operator.
3023 %
3024 %    o value: A value value.
3025 %
3026 */
3027
3028 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3029   const MagickEvaluateOperator op,const double value)
3030 {
3031   MagickBooleanType
3032     status;
3033
3034   assert(wand != (MagickWand *) NULL);
3035   assert(wand->signature == WandSignature);
3036   if (wand->debug != MagickFalse)
3037     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3038   if (wand->images == (Image *) NULL)
3039     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3040   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
3041   if (status == MagickFalse)
3042     InheritException(wand->exception,&wand->images->exception);
3043   return(status);
3044 }
3045
3046 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3047   const MagickEvaluateOperator op)
3048 {
3049   Image
3050     *evaluate_image;
3051
3052   assert(wand != (MagickWand *) NULL);
3053   assert(wand->signature == WandSignature);
3054   if (wand->debug != MagickFalse)
3055     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3056   if (wand->images == (Image *) NULL)
3057     return((MagickWand *) NULL);
3058   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3059   if (evaluate_image == (Image *) NULL)
3060     return((MagickWand *) NULL);
3061   return(CloneMagickWandFromImages(wand,evaluate_image));
3062 }
3063
3064 WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3065   const ChannelType channel,const MagickEvaluateOperator op,const double value)
3066 {
3067   MagickBooleanType
3068     status;
3069
3070   assert(wand != (MagickWand *) NULL);
3071   assert(wand->signature == WandSignature);
3072   if (wand->debug != MagickFalse)
3073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3074   if (wand->images == (Image *) NULL)
3075     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3076   status=EvaluateImageChannel(wand->images,channel,op,value,
3077     &wand->images->exception);
3078   return(status);
3079 }
3080 \f
3081 /*
3082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3083 %                                                                             %
3084 %                                                                             %
3085 %                                                                             %
3086 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
3087 %                                                                             %
3088 %                                                                             %
3089 %                                                                             %
3090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3091 %
3092 %  MagickExportImagePixels() extracts pixel data from an image and returns it
3093 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3094 %  an error is encountered.  The data is returned as char, short int, int,
3095 %  ssize_t, float, or double in the order specified by map.
3096 %
3097 %  Suppose you want to extract the first scanline of a 640x480 image as
3098 %  character data in red-green-blue order:
3099 %
3100 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3101 %
3102 %  The format of the MagickExportImagePixels method is:
3103 %
3104 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3105 %        const ssize_t x,const ssize_t y,const size_t columns,
3106 %        const size_t rows,const char *map,const StorageType storage,
3107 %        void *pixels)
3108 %
3109 %  A description of each parameter follows:
3110 %
3111 %    o wand: the magick wand.
3112 %
3113 %    o x, y, columns, rows:  These values define the perimeter
3114 %      of a region of pixels you want to extract.
3115 %
3116 %    o map:  This string reflects the expected ordering of the pixel array.
3117 %      It can be any combination or order of R = red, G = green, B = blue,
3118 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3119 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3120 %      P = pad.
3121 %
3122 %    o storage: Define the data type of the pixels.  Float and double types are
3123 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3124 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3125 %      LongPixel, QuantumPixel, or ShortPixel.
3126 %
3127 %    o pixels: This array of values contain the pixel components as defined by
3128 %      map and type.  You must preallocate this array where the expected
3129 %      length varies depending on the values of width, height, map, and type.
3130 %
3131 */
3132 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3133   const ssize_t x,const ssize_t y,const size_t columns,
3134   const size_t rows,const char *map,const StorageType storage,
3135   void *pixels)
3136 {
3137   MagickBooleanType
3138     status;
3139
3140   assert(wand != (MagickWand *) NULL);
3141   assert(wand->signature == WandSignature);
3142   if (wand->debug != MagickFalse)
3143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3144   if (wand->images == (Image *) NULL)
3145     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3146   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3147     storage,pixels,wand->exception);
3148   if (status == MagickFalse)
3149     InheritException(wand->exception,&wand->images->exception);
3150   return(status);
3151 }
3152 \f
3153 /*
3154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3155 %                                                                             %
3156 %                                                                             %
3157 %                                                                             %
3158 %   M a g i c k E x t e n t I m a g e                                         %
3159 %                                                                             %
3160 %                                                                             %
3161 %                                                                             %
3162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3163 %
3164 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3165 %  and wand background color.  Set the (x,y) offset of the geometry to move
3166 %  the original wand relative to the extended wand.
3167 %
3168 %  The format of the MagickExtentImage method is:
3169 %
3170 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
3171 %        const size_t width,const size_t height,const ssize_t x,
3172 %        const ssize_t y)
3173 %
3174 %  A description of each parameter follows:
3175 %
3176 %    o wand: the magick wand.
3177 %
3178 %    o width: the region width.
3179 %
3180 %    o height: the region height.
3181 %
3182 %    o x: the region x offset.
3183 %
3184 %    o y: the region y offset.
3185 %
3186 */
3187 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3188   const size_t width,const size_t height,const ssize_t x,
3189   const ssize_t y)
3190 {
3191   Image
3192     *extent_image;
3193
3194   RectangleInfo
3195     extent;
3196
3197   assert(wand != (MagickWand *) NULL);
3198   assert(wand->signature == WandSignature);
3199   if (wand->debug != MagickFalse)
3200     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3201   if (wand->images == (Image *) NULL)
3202     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3203   extent.width=width;
3204   extent.height=height;
3205   extent.x=x;
3206   extent.y=y;
3207   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3208   if (extent_image == (Image *) NULL)
3209     return(MagickFalse);
3210   ReplaceImageInList(&wand->images,extent_image);
3211   return(MagickTrue);
3212 }
3213 \f
3214 /*
3215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3216 %                                                                             %
3217 %                                                                             %
3218 %                                                                             %
3219 %   M a g i c k F i l t e r I m a g e                                         %
3220 %                                                                             %
3221 %                                                                             %
3222 %                                                                             %
3223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3224 %
3225 %  MagickFilterImage() applies a custom convolution kernel to the image.
3226 %
3227 %  The format of the MagickFilterImage method is:
3228 %
3229 %      MagickBooleanType MagickFilterImage(MagickWand *wand,
3230 %        const KernelInfo *kernel)
3231 %      MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3232 %        const ChannelType channel,const KernelInfo *kernel)
3233 %
3234 %  A description of each parameter follows:
3235 %
3236 %    o wand: the magick wand.
3237 %
3238 %    o channel: the image channel(s).
3239 %
3240 %    o kernel: An array of doubles representing the convolution kernel.
3241 %
3242 */
3243
3244 WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
3245   const KernelInfo *kernel)
3246 {
3247   MagickBooleanType
3248     status;
3249
3250   status=MagickFilterImageChannel(wand,DefaultChannels,kernel);
3251   return(status);
3252 }
3253
3254 WandExport MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3255   const ChannelType channel,const KernelInfo *kernel)
3256 {
3257   Image
3258     *filter_image;
3259
3260   assert(wand != (MagickWand *) NULL);
3261   assert(wand->signature == WandSignature);
3262   if (wand->debug != MagickFalse)
3263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3264   if (kernel == (const KernelInfo *) NULL)
3265     return(MagickFalse);
3266   if (wand->images == (Image *) NULL)
3267     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3268   filter_image=FilterImageChannel(wand->images,channel,kernel,wand->exception);
3269   if (filter_image == (Image *) NULL)
3270     return(MagickFalse);
3271   ReplaceImageInList(&wand->images,filter_image);
3272   return(MagickTrue);
3273 }
3274 \f
3275 /*
3276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3277 %                                                                             %
3278 %                                                                             %
3279 %                                                                             %
3280 %   M a g i c k F l i p I m a g e                                             %
3281 %                                                                             %
3282 %                                                                             %
3283 %                                                                             %
3284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3285 %
3286 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3287 %  around the central x-axis.
3288 %
3289 %  The format of the MagickFlipImage method is:
3290 %
3291 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3292 %
3293 %  A description of each parameter follows:
3294 %
3295 %    o wand: the magick wand.
3296 %
3297 */
3298 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3299 {
3300   Image
3301     *flip_image;
3302
3303   assert(wand != (MagickWand *) NULL);
3304   assert(wand->signature == WandSignature);
3305   if (wand->debug != MagickFalse)
3306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3307   if (wand->images == (Image *) NULL)
3308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3309   flip_image=FlipImage(wand->images,wand->exception);
3310   if (flip_image == (Image *) NULL)
3311     return(MagickFalse);
3312   ReplaceImageInList(&wand->images,flip_image);
3313   return(MagickTrue);
3314 }
3315 \f
3316 /*
3317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3318 %                                                                             %
3319 %                                                                             %
3320 %                                                                             %
3321 %   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                         %
3322 %                                                                             %
3323 %                                                                             %
3324 %                                                                             %
3325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3326 %
3327 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3328 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3329 %  specified, the color value is changed for any neighbor pixel that does not
3330 %  match the bordercolor member of image.
3331 %
3332 %  The format of the MagickFloodfillPaintImage method is:
3333 %
3334 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3335 %        const ChannelType channel,const PixelWand *fill,const double fuzz,
3336 %        const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3337 %        const MagickBooleanType invert)
3338 %
3339 %  A description of each parameter follows:
3340 %
3341 %    o wand: the magick wand.
3342 %
3343 %    o channel: the channel(s).
3344 %
3345 %    o fill: the floodfill color pixel wand.
3346 %
3347 %    o fuzz: By default target must match a particular pixel color
3348 %      exactly.  However, in many cases two colors may differ by a small amount.
3349 %      The fuzz member of image defines how much tolerance is acceptable to
3350 %      consider two colors as the same.  For example, set fuzz to 10 and the
3351 %      color red at intensities of 100 and 102 respectively are now interpreted
3352 %      as the same color for the purposes of the floodfill.
3353 %
3354 %    o bordercolor: the border color pixel wand.
3355 %
3356 %    o x,y: the starting location of the operation.
3357 %
3358 %    o invert: paint any pixel that does not match the target color.
3359 %
3360 */
3361 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3362   const ChannelType channel,const PixelWand *fill,const double fuzz,
3363   const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3364   const MagickBooleanType invert)
3365 {
3366   DrawInfo
3367     *draw_info;
3368
3369   MagickBooleanType
3370     status;
3371
3372   MagickPixelPacket
3373     target;
3374
3375   assert(wand != (MagickWand *) NULL);
3376   assert(wand->signature == WandSignature);
3377   if (wand->debug != MagickFalse)
3378     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3379   if (wand->images == (Image *) NULL)
3380     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3381   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3382   PixelGetQuantumColor(fill,&draw_info->fill);
3383   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3384     y % wand->images->rows,&target,wand->exception);
3385   if (bordercolor != (PixelWand *) NULL)
3386     PixelGetMagickColor(bordercolor,&target);
3387   wand->images->fuzz=fuzz;
3388   status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
3389     invert);
3390   if (status == MagickFalse)
3391     InheritException(wand->exception,&wand->images->exception);
3392   draw_info=DestroyDrawInfo(draw_info);
3393   return(status);
3394 }
3395 \f
3396 /*
3397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3398 %                                                                             %
3399 %                                                                             %
3400 %                                                                             %
3401 %   M a g i c k F l o p I m a g e                                             %
3402 %                                                                             %
3403 %                                                                             %
3404 %                                                                             %
3405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3406 %
3407 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3408 %  around the central y-axis.
3409 %
3410 %  The format of the MagickFlopImage method is:
3411 %
3412 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3413 %
3414 %  A description of each parameter follows:
3415 %
3416 %    o wand: the magick wand.
3417 %
3418 */
3419 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3420 {
3421   Image
3422     *flop_image;
3423
3424   assert(wand != (MagickWand *) NULL);
3425   assert(wand->signature == WandSignature);
3426   if (wand->debug != MagickFalse)
3427     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3428   if (wand->images == (Image *) NULL)
3429     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3430   flop_image=FlopImage(wand->images,wand->exception);
3431   if (flop_image == (Image *) NULL)
3432     return(MagickFalse);
3433   ReplaceImageInList(&wand->images,flop_image);
3434   return(MagickTrue);
3435 }
3436 \f
3437 /*
3438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3439 %                                                                             %
3440 %                                                                             %
3441 %                                                                             %
3442 %   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                     %
3443 %                                                                             %
3444 %                                                                             %
3445 %                                                                             %
3446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3447 %
3448 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3449 %  transform (DFT) of the image either as a magnitude / phase or real /
3450 %  imaginary image pair.
3451 %
3452 %  The format of the MagickForwardFourierTransformImage method is:
3453 %
3454 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3455 %        const MagickBooleanType magnitude)
3456 %
3457 %  A description of each parameter follows:
3458 %
3459 %    o wand: the magick wand.
3460 %
3461 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3462 %      imaginary image pair.
3463 %
3464 */
3465 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3466   MagickWand *wand,const MagickBooleanType magnitude)
3467 {
3468   Image
3469     *forward_image;
3470
3471   assert(wand != (MagickWand *) NULL);
3472   assert(wand->signature == WandSignature);
3473   if (wand->debug != MagickFalse)
3474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3475   if (wand->images == (Image *) NULL)
3476     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3477   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3478     wand->exception);
3479   if (forward_image == (Image *) NULL)
3480     return(MagickFalse);
3481   ReplaceImageInList(&wand->images,forward_image);
3482   return(MagickTrue);
3483 }
3484 \f
3485 /*
3486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3487 %                                                                             %
3488 %                                                                             %
3489 %                                                                             %
3490 %   M a g i c k F r a m e I m a g e                                           %
3491 %                                                                             %
3492 %                                                                             %
3493 %                                                                             %
3494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3495 %
3496 %  MagickFrameImage() adds a simulated three-dimensional border around the
3497 %  image.  The width and height specify the border width of the vertical and
3498 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3499 %  width of the inner and outer shadows of the frame.
3500 %
3501 %  The format of the MagickFrameImage method is:
3502 %
3503 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3504 %        const PixelWand *matte_color,const size_t width,
3505 %        const size_t height,const ssize_t inner_bevel,
3506 %        const ssize_t outer_bevel)
3507 %
3508 %  A description of each parameter follows:
3509 %
3510 %    o wand: the magick wand.
3511 %
3512 %    o matte_color: the frame color pixel wand.
3513 %
3514 %    o width: the border width.
3515 %
3516 %    o height: the border height.
3517 %
3518 %    o inner_bevel: the inner bevel width.
3519 %
3520 %    o outer_bevel: the outer bevel width.
3521 %
3522 */
3523 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3524   const PixelWand *matte_color,const size_t width,
3525   const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3526 {
3527   Image
3528     *frame_image;
3529
3530   FrameInfo
3531     frame_info;
3532
3533   assert(wand != (MagickWand *) NULL);
3534   assert(wand->signature == WandSignature);
3535   if (wand->debug != MagickFalse)
3536     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3537   if (wand->images == (Image *) NULL)
3538     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3539   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3540   frame_info.width=wand->images->columns+2*width;
3541   frame_info.height=wand->images->rows+2*height;
3542   frame_info.x=(ssize_t) width;
3543   frame_info.y=(ssize_t) height;
3544   frame_info.inner_bevel=inner_bevel;
3545   frame_info.outer_bevel=outer_bevel;
3546   PixelGetQuantumColor(matte_color,&wand->images->matte_color);
3547   frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3548   if (frame_image == (Image *) NULL)
3549     return(MagickFalse);
3550   ReplaceImageInList(&wand->images,frame_image);
3551   return(MagickTrue);
3552 }
3553 \f
3554 /*
3555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3556 %                                                                             %
3557 %                                                                             %
3558 %                                                                             %
3559 %   M a g i c k F u n c t i o n I m a g e                                     %
3560 %                                                                             %
3561 %                                                                             %
3562 %                                                                             %
3563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3564 %
3565 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3566 %  expression to an image.  Use these operators to lighten or darken an image,
3567 %  to increase or decrease contrast in an image, or to produce the "negative"
3568 %  of an image.
3569 %
3570 %  The format of the MagickFunctionImage method is:
3571 %
3572 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3573 %        const MagickFunction function,const size_t number_arguments,
3574 %        const double *arguments)
3575 %      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3576 %        const ChannelType channel,const MagickFunction function,
3577 %        const size_t number_arguments,const double *arguments)
3578 %
3579 %  A description of each parameter follows:
3580 %
3581 %    o wand: the magick wand.
3582 %
3583 %    o channel: the channel(s).
3584 %
3585 %    o function: the image function.
3586 %
3587 %    o number_arguments: the number of function arguments.
3588 %
3589 %    o arguments: the function arguments.
3590 %
3591 */
3592
3593 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3594   const MagickFunction function,const size_t number_arguments,
3595   const double *arguments)
3596 {
3597   MagickBooleanType
3598     status;
3599
3600   assert(wand != (MagickWand *) NULL);
3601   assert(wand->signature == WandSignature);
3602   if (wand->debug != MagickFalse)
3603     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3604   if (wand->images == (Image *) NULL)
3605     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3606   status=FunctionImage(wand->images,function,number_arguments,arguments,
3607     &wand->images->exception);
3608   if (status == MagickFalse)
3609     InheritException(wand->exception,&wand->images->exception);
3610   return(status);
3611 }
3612
3613 WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3614   const ChannelType channel,const MagickFunction function,
3615   const size_t number_arguments,const double *arguments)
3616 {
3617   MagickBooleanType
3618     status;
3619
3620   assert(wand != (MagickWand *) NULL);
3621   assert(wand->signature == WandSignature);
3622   if (wand->debug != MagickFalse)
3623     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3624   if (wand->images == (Image *) NULL)
3625     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3626   status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3627     arguments,&wand->images->exception);
3628   return(status);
3629 }
3630 \f
3631 /*
3632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633 %                                                                             %
3634 %                                                                             %
3635 %                                                                             %
3636 %   M a g i c k F x I m a g e                                                 %
3637 %                                                                             %
3638 %                                                                             %
3639 %                                                                             %
3640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641 %
3642 %  MagickFxImage() evaluate expression for each pixel in the image.
3643 %
3644 %  The format of the MagickFxImage method is:
3645 %
3646 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3647 %      MagickWand *MagickFxImageChannel(MagickWand *wand,
3648 %        const ChannelType channel,const char *expression)
3649 %
3650 %  A description of each parameter follows:
3651 %
3652 %    o wand: the magick wand.
3653 %
3654 %    o channel: the image channel(s).
3655 %
3656 %    o expression: the expression.
3657 %
3658 */
3659
3660 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3661 {
3662   MagickWand
3663     *fx_wand;
3664
3665   fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3666   return(fx_wand);
3667 }
3668
3669 WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3670   const ChannelType channel,const char *expression)
3671 {
3672   Image
3673     *fx_image;
3674
3675   assert(wand != (MagickWand *) NULL);
3676   assert(wand->signature == WandSignature);
3677   if (wand->debug != MagickFalse)
3678     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3679   if (wand->images == (Image *) NULL)
3680     return((MagickWand *) NULL);
3681   fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3682   if (fx_image == (Image *) NULL)
3683     return((MagickWand *) NULL);
3684   return(CloneMagickWandFromImages(wand,fx_image));
3685 }
3686 \f
3687 /*
3688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3689 %                                                                             %
3690 %                                                                             %
3691 %                                                                             %
3692 %   M a g i c k G a m m a I m a g e                                           %
3693 %                                                                             %
3694 %                                                                             %
3695 %                                                                             %
3696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3697 %
3698 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3699 %  different devices will have perceptual differences in the way the image's
3700 %  intensities are represented on the screen.  Specify individual gamma levels
3701 %  for the red, green, and blue channels, or adjust all three with the gamma
3702 %  parameter.  Values typically range from 0.8 to 2.3.
3703 %
3704 %  You can also reduce the influence of a particular channel with a gamma
3705 %  value of 0.
3706 %
3707 %  The format of the MagickGammaImage method is:
3708 %
3709 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3710 %      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3711 %        const ChannelType channel,const double gamma)
3712 %
3713 %  A description of each parameter follows:
3714 %
3715 %    o wand: the magick wand.
3716 %
3717 %    o channel: the channel.
3718 %
3719 %    o level: Define the level of gamma correction.
3720 %
3721 */
3722
3723 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3724   const double gamma)
3725 {
3726   MagickBooleanType
3727     status;
3728
3729   status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3730   return(status);
3731 }
3732
3733 WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3734   const ChannelType channel,const double gamma)
3735 {
3736   MagickBooleanType
3737     status;
3738
3739   assert(wand != (MagickWand *) NULL);
3740   assert(wand->signature == WandSignature);
3741   if (wand->debug != MagickFalse)
3742     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3743   if (wand->images == (Image *) NULL)
3744     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3745   status=GammaImageChannel(wand->images,channel,gamma);
3746   if (status == MagickFalse)
3747     InheritException(wand->exception,&wand->images->exception);
3748   return(status);
3749 }
3750 \f
3751 /*
3752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3753 %                                                                             %
3754 %                                                                             %
3755 %                                                                             %
3756 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3757 %                                                                             %
3758 %                                                                             %
3759 %                                                                             %
3760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3761 %
3762 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3763 %  Gaussian operator of the given radius and standard deviation (sigma).
3764 %  For reasonable results, the radius should be larger than sigma.  Use a
3765 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3766 %
3767 %  The format of the MagickGaussianBlurImage method is:
3768 %
3769 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3770 %        const double radius,const double sigma)
3771 %      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3772 %        const ChannelType channel,const double radius,const double sigma)
3773 %
3774 %  A description of each parameter follows:
3775 %
3776 %    o wand: the magick wand.
3777 %
3778 %    o channel: the image channel(s).
3779 %
3780 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3781 %      pixel.
3782 %
3783 %    o sigma: the standard deviation of the Gaussian, in pixels.
3784 %
3785 */
3786
3787 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3788   const double radius,const double sigma)
3789 {
3790   MagickBooleanType
3791     status;
3792
3793   status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3794   return(status);
3795 }
3796
3797 WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3798   const ChannelType channel,const double radius,const double sigma)
3799 {
3800   Image
3801     *blur_image;
3802
3803   assert(wand != (MagickWand *) NULL);
3804   assert(wand->signature == WandSignature);
3805   if (wand->debug != MagickFalse)
3806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3807   if (wand->images == (Image *) NULL)
3808     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3809   blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
3810     wand->exception);
3811   if (blur_image == (Image *) NULL)
3812     return(MagickFalse);
3813   ReplaceImageInList(&wand->images,blur_image);
3814   return(MagickTrue);
3815 }
3816 \f
3817 /*
3818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3819 %                                                                             %
3820 %                                                                             %
3821 %                                                                             %
3822 %   M a g i c k G e t I m a g e                                               %
3823 %                                                                             %
3824 %                                                                             %
3825 %                                                                             %
3826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3827 %
3828 %  MagickGetImage() gets the image at the current image index.
3829 %
3830 %  The format of the MagickGetImage method is:
3831 %
3832 %      MagickWand *MagickGetImage(MagickWand *wand)
3833 %
3834 %  A description of each parameter follows:
3835 %
3836 %    o wand: the magick wand.
3837 %
3838 */
3839 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3840 {
3841   Image
3842     *image;
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((MagickWand *) NULL);
3853     }
3854   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3855   if (image == (Image *) NULL)
3856     return((MagickWand *) NULL);
3857   return(CloneMagickWandFromImages(wand,image));
3858 }
3859 \f
3860 /*
3861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3862 %                                                                             %
3863 %                                                                             %
3864 %                                                                             %
3865 %   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                       %
3866 %                                                                             %
3867 %                                                                             %
3868 %                                                                             %
3869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3870 %
3871 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3872 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3873 %  than CMYKA.
3874 %
3875 %  The format of the MagickGetImageAlphaChannel method is:
3876 %
3877 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3878 %
3879 %  A description of each parameter follows:
3880 %
3881 %    o wand: the magick wand.
3882 %
3883 */
3884 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3885 {
3886   assert(wand != (MagickWand *) NULL);
3887   assert(wand->signature == WandSignature);
3888   if (wand->debug != MagickFalse)
3889     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3890   if (wand->images == (Image *) NULL)
3891     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3892   return(GetImageAlphaChannel(wand->images));
3893 }
3894 \f
3895 /*
3896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3897 %                                                                             %
3898 %                                                                             %
3899 %                                                                             %
3900 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3901 %                                                                             %
3902 %                                                                             %
3903 %                                                                             %
3904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3905 %
3906 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3907 %
3908 %  The format of the MagickGetImageClipMask method is:
3909 %
3910 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3911 %
3912 %  A description of each parameter follows:
3913 %
3914 %    o wand: the magick wand.
3915 %
3916 */
3917 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3918 {
3919   Image
3920     *image;
3921
3922   assert(wand != (MagickWand *) NULL);
3923   assert(wand->signature == WandSignature);
3924   if (wand->debug != MagickFalse)
3925     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3926   if (wand->images == (Image *) NULL)
3927     {
3928       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3929         "ContainsNoImages","`%s'",wand->name);
3930       return((MagickWand *) NULL);
3931     }
3932   image=GetImageClipMask(wand->images,wand->exception);
3933   if (image == (Image *) NULL)
3934     return((MagickWand *) NULL);
3935   return(CloneMagickWandFromImages(wand,image));
3936 }
3937 \f
3938 /*
3939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3940 %                                                                             %
3941 %                                                                             %
3942 %                                                                             %
3943 %   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                 %
3944 %                                                                             %
3945 %                                                                             %
3946 %                                                                             %
3947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3948 %
3949 %  MagickGetImageBackgroundColor() returns the image background color.
3950 %
3951 %  The format of the MagickGetImageBackgroundColor method is:
3952 %
3953 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3954 %        PixelWand *background_color)
3955 %
3956 %  A description of each parameter follows:
3957 %
3958 %    o wand: the magick wand.
3959 %
3960 %    o background_color: Return the background color.
3961 %
3962 */
3963 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3964   PixelWand *background_color)
3965 {
3966   assert(wand != (MagickWand *) NULL);
3967   assert(wand->signature == WandSignature);
3968   if (wand->debug != MagickFalse)
3969     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3970   if (wand->images == (Image *) NULL)
3971     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3972   PixelSetQuantumColor(background_color,&wand->images->background_color);
3973   return(MagickTrue);
3974 }
3975 \f
3976 /*
3977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3978 %                                                                             %
3979 %                                                                             %
3980 %                                                                             %
3981 %   M a g i c k G e t I m a g e B l o b                                       %
3982 %                                                                             %
3983 %                                                                             %
3984 %                                                                             %
3985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3986 %
3987 %  MagickGetImageBlob() implements direct to memory image formats.  It
3988 %  returns the image as a blob and its length.   Use MagickSetFormat() to
3989 %  set the format of the returned blob (GIF, JPEG,  PNG, etc.).
3990 %
3991 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3992 %
3993 %  The format of the MagickGetImageBlob method is:
3994 %
3995 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3996 %
3997 %  A description of each parameter follows:
3998 %
3999 %    o wand: the magick wand.
4000 %
4001 %    o length: the length of the blob.
4002 %
4003 */
4004 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4005 {
4006   assert(wand != (MagickWand *) NULL);
4007   assert(wand->signature == WandSignature);
4008   if (wand->debug != MagickFalse)
4009     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4010   if (wand->images == (Image *) NULL)
4011     {
4012       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4013         "ContainsNoImages","`%s'",wand->name);
4014       return((unsigned char *) NULL);
4015     }
4016   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
4017 }
4018 \f
4019 /*
4020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4021 %                                                                             %
4022 %                                                                             %
4023 %                                                                             %
4024 %   M a g i c k G e t I m a g e s B l o b                                     %
4025 %                                                                             %
4026 %                                                                             %
4027 %                                                                             %
4028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4029 %
4030 %  MagickGetImageBlob() implements direct to memory image formats.  It
4031 %  returns the image sequence as a blob and its length.  The format of the image
4032 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
4033 %  return a different image format, use MagickSetImageFormat().
4034 %
4035 %  Note, some image formats do not permit multiple images to the same image
4036 %  stream (e.g. JPEG).  in this instance, just the first image of the
4037 %  sequence is returned as a blob.
4038 %
4039 %  The format of the MagickGetImagesBlob method is:
4040 %
4041 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4042 %
4043 %  A description of each parameter follows:
4044 %
4045 %    o wand: the magick wand.
4046 %
4047 %    o length: the length of the blob.
4048 %
4049 */
4050 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4051 {
4052   unsigned char
4053     *blob;
4054
4055   assert(wand != (MagickWand *) NULL);
4056   assert(wand->signature == WandSignature);
4057   if (wand->debug != MagickFalse)
4058     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4059   if (wand->images == (Image *) NULL)
4060     {
4061       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4062         "ContainsNoImages","`%s'",wand->name);
4063       return((unsigned char *) NULL);
4064     }
4065   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
4066     wand->exception);
4067   return(blob);
4068 }
4069 \f
4070 /*
4071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4072 %                                                                             %
4073 %                                                                             %
4074 %                                                                             %
4075 %   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                         %
4076 %                                                                             %
4077 %                                                                             %
4078 %                                                                             %
4079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4080 %
4081 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4082 %  image.
4083 %
4084 %  The format of the MagickGetImageBluePrimary method is:
4085 %
4086 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4087 %        double *y)
4088 %
4089 %  A description of each parameter follows:
4090 %
4091 %    o wand: the magick wand.
4092 %
4093 %    o x: the chromaticity blue primary x-point.
4094 %
4095 %    o y: the chromaticity blue primary y-point.
4096 %
4097 */
4098 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4099   double *x,double *y)
4100 {
4101   assert(wand != (MagickWand *) NULL);
4102   assert(wand->signature == WandSignature);
4103   if (wand->debug != MagickFalse)
4104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4105   if (wand->images == (Image *) NULL)
4106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4107   *x=wand->images->chromaticity.blue_primary.x;
4108   *y=wand->images->chromaticity.blue_primary.y;
4109   return(MagickTrue);
4110 }
4111 \f
4112 /*
4113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4114 %                                                                             %
4115 %                                                                             %
4116 %                                                                             %
4117 %   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                         %
4118 %                                                                             %
4119 %                                                                             %
4120 %                                                                             %
4121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4122 %
4123 %  MagickGetImageBorderColor() returns the image border color.
4124 %
4125 %  The format of the MagickGetImageBorderColor method is:
4126 %
4127 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4128 %        PixelWand *border_color)
4129 %
4130 %  A description of each parameter follows:
4131 %
4132 %    o wand: the magick wand.
4133 %
4134 %    o border_color: Return the border color.
4135 %
4136 */
4137 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4138   PixelWand *border_color)
4139 {
4140   assert(wand != (MagickWand *) NULL);
4141   assert(wand->signature == WandSignature);
4142   if (wand->debug != MagickFalse)
4143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4144   if (wand->images == (Image *) NULL)
4145     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4146   PixelSetQuantumColor(border_color,&wand->images->border_color);
4147   return(MagickTrue);
4148 }
4149 \f
4150 /*
4151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4152 %                                                                             %
4153 %                                                                             %
4154 %                                                                             %
4155 %   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                       %
4156 %                                                                             %
4157 %                                                                             %
4158 %                                                                             %
4159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4160 %
4161 %  MagickGetImageChannelDepth() gets the depth for one or more image channels.
4162 %
4163 %  The format of the MagickGetImageChannelDepth method is:
4164 %
4165 %      size_t MagickGetImageChannelDepth(MagickWand *wand,
4166 %        const ChannelType channel)
4167 %
4168 %  A description of each parameter follows:
4169 %
4170 %    o wand: the magick wand.
4171 %
4172 %    o channel: the image channel(s).
4173 %
4174 */
4175 WandExport size_t MagickGetImageChannelDepth(MagickWand *wand,
4176   const ChannelType channel)
4177 {
4178   assert(wand != (MagickWand *) NULL);
4179   assert(wand->signature == WandSignature);
4180   if (wand->debug != MagickFalse)
4181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4182   if (wand->images == (Image *) NULL)
4183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4184   return(GetImageChannelDepth(wand->images,channel,wand->exception));
4185 }
4186 \f
4187 /*
4188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4189 %                                                                             %
4190 %                                                                             %
4191 %                                                                             %
4192 %   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             %
4193 %                                                                             %
4194 %                                                                             %
4195 %                                                                             %
4196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4197 %
4198 %  MagickGetImageChannelDistortion() compares one or more image channels of an
4199 %  image to a reconstructed image and returns the specified distortion metric.
4200 %
4201 %  The format of the MagickGetImageChannelDistortion method is:
4202 %
4203 %      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4204 %        const MagickWand *reference,const ChannelType channel,
4205 %        const MetricType metric,double *distortion)
4206 %
4207 %  A description of each parameter follows:
4208 %
4209 %    o wand: the magick wand.
4210 %
4211 %    o reference: the reference wand.
4212 %
4213 %    o channel: the channel.
4214 %
4215 %    o metric: the metric.
4216 %
4217 %    o distortion: the computed distortion between the images.
4218 %
4219 */
4220 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4221   const MagickWand *reference,const ChannelType channel,const MetricType metric,
4222   double *distortion)
4223 {
4224   MagickBooleanType
4225     status;
4226
4227   assert(wand != (MagickWand *) NULL);
4228   assert(wand->signature == WandSignature);
4229   if (wand->debug != MagickFalse)
4230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4231   assert(reference != (MagickWand *) NULL);
4232   assert(reference->signature == WandSignature);
4233   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4234     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4235   status=GetImageChannelDistortion(wand->images,reference->images,channel,
4236     metric,distortion,&wand->images->exception);
4237   return(status);
4238 }
4239 \f
4240 /*
4241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4242 %                                                                             %
4243 %                                                                             %
4244 %                                                                             %
4245 %   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           %
4246 %                                                                             %
4247 %                                                                             %
4248 %                                                                             %
4249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4250 %
4251 %  MagickGetImageChannelDistortions() compares one or more image channels of an
4252 %  image to a reconstructed image and returns the specified distortion metrics.
4253 %
4254 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4255 %
4256 %  The format of the MagickGetImageChannelDistortion method is:
4257 %
4258 %      double *MagickGetImageChannelDistortion(MagickWand *wand,
4259 %        const MagickWand *reference,const MetricType metric)
4260 %
4261 %  A description of each parameter follows:
4262 %
4263 %    o wand: the magick wand.
4264 %
4265 %    o reference: the reference wand.
4266 %
4267 %    o metric: the metric.
4268 %
4269 */
4270 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4271   const MagickWand *reference,const MetricType metric)
4272 {
4273   double
4274     *channel_distortion;
4275
4276   assert(wand != (MagickWand *) NULL);
4277   assert(wand->signature == WandSignature);
4278   if (wand->debug != MagickFalse)
4279     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4280   assert(reference != (MagickWand *) NULL);
4281   assert(reference->signature == WandSignature);
4282   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4283     {
4284       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4285         "ContainsNoImages","`%s'",wand->name);
4286       return((double *) NULL);
4287     }
4288   channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4289     metric,&wand->images->exception);
4290   return(channel_distortion);
4291 }
4292 \f
4293 /*
4294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4295 %                                                                             %
4296 %                                                                             %
4297 %                                                                             %
4298 %   M a g i c k G e t I m a g e C h a n n e l F e a t u r e s                 %
4299 %                                                                             %
4300 %                                                                             %
4301 %                                                                             %
4302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4303 %
4304 %  MagickGetImageChannelFeatures() returns features for each channel in the
4305 %  image in each of four directions (horizontal, vertical, left and right
4306 %  diagonals) for the specified distance.  The features include the angular
4307 %  second moment, contrast, correlation, sum of squares: variance, inverse
4308 %  difference moment, sum average, sum varience, sum entropy, entropy,
4309 %  difference variance, difference entropy, information measures of
4310 %  correlation 1, information measures of correlation 2, and maximum
4311 %  correlation coefficient.  You can access the red channel contrast, for
4312 %  example, like this:
4313 %
4314 %      channel_features=MagickGetImageChannelFeatures(wand,1);
4315 %      contrast=channel_features[RedChannel].contrast[0];
4316 %
4317 %  Use MagickRelinquishMemory() to free the statistics buffer.
4318 %
4319 %  The format of the MagickGetImageChannelFeatures method is:
4320 %
4321 %      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4322 %        const size_t distance)
4323 %
4324 %  A description of each parameter follows:
4325 %
4326 %    o wand: the magick wand.
4327 %
4328 %    o distance: the distance.
4329 %
4330 */
4331 WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4332   const size_t distance)
4333 {
4334   assert(wand != (MagickWand *) NULL);
4335   assert(wand->signature == WandSignature);
4336   if (wand->debug != MagickFalse)
4337     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4338   if (wand->images == (Image *) NULL)
4339     {
4340       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4341         "ContainsNoImages","`%s'",wand->name);
4342       return((ChannelFeatures *) NULL);
4343     }
4344   return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4345 }
4346 \f
4347 /*
4348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4349 %                                                                             %
4350 %                                                                             %
4351 %                                                                             %
4352 %   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                 %
4353 %                                                                             %
4354 %                                                                             %
4355 %                                                                             %
4356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4357 %
4358 %  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4359 %  more image channels.
4360 %
4361 %  The format of the MagickGetImageChannelKurtosis method is:
4362 %
4363 %      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4364 %        const ChannelType channel,double *kurtosis,double *skewness)
4365 %
4366 %  A description of each parameter follows:
4367 %
4368 %    o wand: the magick wand.
4369 %
4370 %    o channel: the image channel(s).
4371 %
4372 %    o kurtosis:  The kurtosis for the specified channel(s).
4373 %
4374 %    o skewness:  The skewness for the specified channel(s).
4375 %
4376 */
4377 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4378   const ChannelType channel,double *kurtosis,double *skewness)
4379 {
4380   MagickBooleanType
4381     status;
4382
4383   assert(wand != (MagickWand *) NULL);
4384   assert(wand->signature == WandSignature);
4385   if (wand->debug != MagickFalse)
4386     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4387   if (wand->images == (Image *) NULL)
4388     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4389   status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4390     wand->exception);
4391   return(status);
4392 }
4393 \f
4394 /*
4395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4396 %                                                                             %
4397 %                                                                             %
4398 %                                                                             %
4399 %   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                         %
4400 %                                                                             %
4401 %                                                                             %
4402 %                                                                             %
4403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4404 %
4405 %  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4406 %  more image channels.
4407 %
4408 %  The format of the MagickGetImageChannelMean method is:
4409 %
4410 %      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4411 %        const ChannelType channel,double *mean,double *standard_deviation)
4412 %
4413 %  A description of each parameter follows:
4414 %
4415 %    o wand: the magick wand.
4416 %
4417 %    o channel: the image channel(s).
4418 %
4419 %    o mean:  The mean pixel value for the specified channel(s).
4420 %
4421 %    o standard_deviation:  The standard deviation for the specified channel(s).
4422 %
4423 */
4424 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4425   const ChannelType channel,double *mean,double *standard_deviation)
4426 {
4427   MagickBooleanType
4428     status;
4429
4430   assert(wand != (MagickWand *) NULL);
4431   assert(wand->signature == WandSignature);
4432   if (wand->debug != MagickFalse)
4433     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4434   if (wand->images == (Image *) NULL)
4435     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4436   status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4437     wand->exception);
4438   return(status);
4439 }
4440 \f
4441 /*
4442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4443 %                                                                             %
4444 %                                                                             %
4445 %                                                                             %
4446 %   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                       %
4447 %                                                                             %
4448 %                                                                             %
4449 %                                                                             %
4450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4451 %
4452 %  MagickGetImageChannelRange() gets the range for one or more image channels.
4453 %
4454 %  The format of the MagickGetImageChannelRange method is:
4455 %
4456 %      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4457 %        const ChannelType channel,double *minima,double *maxima)
4458 %
4459 %  A description of each parameter follows:
4460 %
4461 %    o wand: the magick wand.
4462 %
4463 %    o channel: the image channel(s).
4464 %
4465 %    o minima:  The minimum pixel value for the specified channel(s).
4466 %
4467 %    o maxima:  The maximum pixel value for the specified channel(s).
4468 %
4469 */
4470 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4471   const ChannelType channel,double *minima,double *maxima)
4472 {
4473   MagickBooleanType
4474     status;
4475
4476   assert(wand != (MagickWand *) NULL);
4477   assert(wand->signature == WandSignature);
4478   if (wand->debug != MagickFalse)
4479     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4480   if (wand->images == (Image *) NULL)
4481     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4482   status=GetImageChannelRange(wand->images,channel,minima,maxima,
4483     wand->exception);
4484   return(status);
4485 }
4486 \f
4487 /*
4488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4489 %                                                                             %
4490 %                                                                             %
4491 %                                                                             %
4492 %   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             %
4493 %                                                                             %
4494 %                                                                             %
4495 %                                                                             %
4496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4497 %
4498 %  MagickGetImageChannelStatistics() returns statistics for each channel in the
4499 %  image.  The statistics include the channel depth, its minima and
4500 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4501 %  You can access the red channel mean, for example, like this:
4502 %
4503 %      channel_statistics=MagickGetImageChannelStatistics(wand);
4504 %      red_mean=channel_statistics[RedChannel].mean;
4505 %
4506 %  Use MagickRelinquishMemory() to free the statistics buffer.
4507 %
4508 %  The format of the MagickGetImageChannelStatistics method is:
4509 %
4510 %      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4511 %
4512 %  A description of each parameter follows:
4513 %
4514 %    o wand: the magick wand.
4515 %
4516 */
4517 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4518 {
4519   assert(wand != (MagickWand *) NULL);
4520   assert(wand->signature == WandSignature);
4521   if (wand->debug != MagickFalse)
4522     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4523   if (wand->images == (Image *) NULL)
4524     {
4525       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4526         "ContainsNoImages","`%s'",wand->name);
4527       return((ChannelStatistics *) NULL);
4528     }
4529   return(GetImageChannelStatistics(wand->images,wand->exception));
4530 }
4531 \f
4532 /*
4533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4534 %                                                                             %
4535 %                                                                             %
4536 %                                                                             %
4537 %   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                     %
4538 %                                                                             %
4539 %                                                                             %
4540 %                                                                             %
4541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4542 %
4543 %  MagickGetImageColormapColor() returns the color of the specified colormap
4544 %  index.
4545 %
4546 %  The format of the MagickGetImageColormapColor method is:
4547 %
4548 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4549 %        const size_t index,PixelWand *color)
4550 %
4551 %  A description of each parameter follows:
4552 %
4553 %    o wand: the magick wand.
4554 %
4555 %    o index: the offset into the image colormap.
4556 %
4557 %    o color: Return the colormap color in this wand.
4558 %
4559 */
4560 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4561   const size_t index,PixelWand *color)
4562 {
4563   assert(wand != (MagickWand *) NULL);
4564   assert(wand->signature == WandSignature);
4565   if (wand->debug != MagickFalse)
4566     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4567   if (wand->images == (Image *) NULL)
4568     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4569   if ((wand->images->colormap == (PixelPacket *) NULL) ||
4570       (index >= wand->images->colors))
4571     {
4572       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4573         "InvalidColormapIndex","`%s'",wand->name);
4574       return(MagickFalse);
4575     }
4576   PixelSetQuantumColor(color,wand->images->colormap+index);
4577   return(MagickTrue);
4578 }
4579 \f
4580 /*
4581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4582 %                                                                             %
4583 %                                                                             %
4584 %                                                                             %
4585 %   M a g i c k G e t I m a g e C o l o r s                                   %
4586 %                                                                             %
4587 %                                                                             %
4588 %                                                                             %
4589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4590 %
4591 %  MagickGetImageColors() gets the number of unique colors in the image.
4592 %
4593 %  The format of the MagickGetImageColors method is:
4594 %
4595 %      size_t MagickGetImageColors(MagickWand *wand)
4596 %
4597 %  A description of each parameter follows:
4598 %
4599 %    o wand: the magick wand.
4600 %
4601 */
4602 WandExport size_t MagickGetImageColors(MagickWand *wand)
4603 {
4604   assert(wand != (MagickWand *) NULL);
4605   assert(wand->signature == WandSignature);
4606   if (wand->debug != MagickFalse)
4607     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4608   if (wand->images == (Image *) NULL)
4609     {
4610       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4611         "ContainsNoImages","`%s'",wand->name);
4612       return(0);
4613     }
4614   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4615 }
4616 \f
4617 /*
4618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4619 %                                                                             %
4620 %                                                                             %
4621 %                                                                             %
4622 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4623 %                                                                             %
4624 %                                                                             %
4625 %                                                                             %
4626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4627 %
4628 %  MagickGetImageColorspace() gets the image colorspace.
4629 %
4630 %  The format of the MagickGetImageColorspace method is:
4631 %
4632 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4633 %
4634 %  A description of each parameter follows:
4635 %
4636 %    o wand: the magick wand.
4637 %
4638 */
4639 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4640 {
4641   assert(wand != (MagickWand *) NULL);
4642   assert(wand->signature == WandSignature);
4643   if (wand->debug != MagickFalse)
4644     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4645   if (wand->images == (Image *) NULL)
4646     {
4647       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4648         "ContainsNoImages","`%s'",wand->name);
4649       return(UndefinedColorspace);
4650     }
4651   return(wand->images->colorspace);
4652 }
4653 \f
4654 /*
4655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656 %                                                                             %
4657 %                                                                             %
4658 %                                                                             %
4659 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4660 %                                                                             %
4661 %                                                                             %
4662 %                                                                             %
4663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4664 %
4665 %  MagickGetImageCompose() returns the composite operator associated with the
4666 %  image.
4667 %
4668 %  The format of the MagickGetImageCompose method is:
4669 %
4670 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4671 %
4672 %  A description of each parameter follows:
4673 %
4674 %    o wand: the magick wand.
4675 %
4676 */
4677 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4678 {
4679   assert(wand != (MagickWand *) NULL);
4680   assert(wand->signature == WandSignature);
4681   if (wand->debug != MagickFalse)
4682     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4683   if (wand->images == (Image *) NULL)
4684     {
4685       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4686         "ContainsNoImages","`%s'",wand->name);
4687       return(UndefinedCompositeOp);
4688     }
4689   return(wand->images->compose);
4690 }
4691 \f
4692 /*
4693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4694 %                                                                             %
4695 %                                                                             %
4696 %                                                                             %
4697 %   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                         %
4698 %                                                                             %
4699 %                                                                             %
4700 %                                                                             %
4701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4702 %
4703 %  MagickGetImageCompression() gets the image compression.
4704 %
4705 %  The format of the MagickGetImageCompression method is:
4706 %
4707 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4708 %
4709 %  A description of each parameter follows:
4710 %
4711 %    o wand: the magick wand.
4712 %
4713 */
4714 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4715 {
4716   assert(wand != (MagickWand *) NULL);
4717   assert(wand->signature == WandSignature);
4718   if (wand->debug != MagickFalse)
4719     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4720   if (wand->images == (Image *) NULL)
4721     {
4722       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4723         "ContainsNoImages","`%s'",wand->name);
4724       return(UndefinedCompression);
4725     }
4726   return(wand->images->compression);
4727 }
4728 \f
4729 /*
4730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4731 %                                                                             %
4732 %                                                                             %
4733 %                                                                             %
4734 %   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           %
4735 %                                                                             %
4736 %                                                                             %
4737 %                                                                             %
4738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4739 %
4740 %  MagickGetImageCompression() gets the image compression quality.
4741 %
4742 %  The format of the MagickGetImageCompression method is:
4743 %
4744 %      size_t MagickGetImageCompression(MagickWand *wand)
4745 %
4746 %  A description of each parameter follows:
4747 %
4748 %    o wand: the magick wand.
4749 %
4750 */
4751 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4752 {
4753   assert(wand != (MagickWand *) NULL);
4754   assert(wand->signature == WandSignature);
4755   if (wand->debug != MagickFalse)
4756     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4757   if (wand->images == (Image *) NULL)
4758     {
4759       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4760         "ContainsNoImages","`%s'",wand->name);
4761       return(0UL);
4762     }
4763   return(wand->images->quality);
4764 }
4765 \f
4766 /*
4767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4768 %                                                                             %
4769 %                                                                             %
4770 %                                                                             %
4771 %   M a g i c k G e t I m a g e D e l a y                                     %
4772 %                                                                             %
4773 %                                                                             %
4774 %                                                                             %
4775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4776 %
4777 %  MagickGetImageDelay() gets the image delay.
4778 %
4779 %  The format of the MagickGetImageDelay method is:
4780 %
4781 %      size_t MagickGetImageDelay(MagickWand *wand)
4782 %
4783 %  A description of each parameter follows:
4784 %
4785 %    o wand: the magick wand.
4786 %
4787 */
4788 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4789 {
4790   assert(wand != (MagickWand *) NULL);
4791   assert(wand->signature == WandSignature);
4792   if (wand->debug != MagickFalse)
4793     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4794   if (wand->images == (Image *) NULL)
4795     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4796   return(wand->images->delay);
4797 }
4798 \f
4799 /*
4800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4801 %                                                                             %
4802 %                                                                             %
4803 %                                                                             %
4804 %   M a g i c k G e t I m a g e D e p t h                                     %
4805 %                                                                             %
4806 %                                                                             %
4807 %                                                                             %
4808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4809 %
4810 %  MagickGetImageDepth() gets the image depth.
4811 %
4812 %  The format of the MagickGetImageDepth method is:
4813 %
4814 %      size_t MagickGetImageDepth(MagickWand *wand)
4815 %
4816 %  A description of each parameter follows:
4817 %
4818 %    o wand: the magick wand.
4819 %
4820 */
4821 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4822 {
4823   assert(wand != (MagickWand *) NULL);
4824   assert(wand->signature == WandSignature);
4825   if (wand->debug != MagickFalse)
4826     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4827   if (wand->images == (Image *) NULL)
4828     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4829   return(wand->images->depth);
4830 }
4831 \f
4832 /*
4833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4834 %                                                                             %
4835 %                                                                             %
4836 %                                                                             %
4837 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4838 %                                                                             %
4839 %                                                                             %
4840 %                                                                             %
4841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4842 %
4843 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4844 %  returns the specified distortion metric.
4845 %
4846 %  The format of the MagickGetImageDistortion method is:
4847 %
4848 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4849 %        const MagickWand *reference,const MetricType metric,
4850 %        double *distortion)
4851 %
4852 %  A description of each parameter follows:
4853 %
4854 %    o wand: the magick wand.
4855 %
4856 %    o reference: the reference wand.
4857 %
4858 %    o metric: the metric.
4859 %
4860 %    o distortion: the computed distortion between the images.
4861 %
4862 */
4863 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4864   const MagickWand *reference,const MetricType metric,double *distortion)
4865 {
4866   MagickBooleanType
4867     status;
4868
4869
4870   assert(wand != (MagickWand *) NULL);
4871   assert(wand->signature == WandSignature);
4872   if (wand->debug != MagickFalse)
4873     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4874   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4875     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4876   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4877     &wand->images->exception);
4878   return(status);
4879 }
4880 \f
4881 /*
4882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4883 %                                                                             %
4884 %                                                                             %
4885 %                                                                             %
4886 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4887 %                                                                             %
4888 %                                                                             %
4889 %                                                                             %
4890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4891 %
4892 %  MagickGetImageDispose() gets the image disposal method.
4893 %
4894 %  The format of the MagickGetImageDispose method is:
4895 %
4896 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4897 %
4898 %  A description of each parameter follows:
4899 %
4900 %    o wand: the magick wand.
4901 %
4902 */
4903 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4904 {
4905   assert(wand != (MagickWand *) NULL);
4906   assert(wand->signature == WandSignature);
4907   if (wand->debug != MagickFalse)
4908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4909   if (wand->images == (Image *) NULL)
4910     {
4911       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4912         "ContainsNoImages","`%s'",wand->name);
4913       return(UndefinedDispose);
4914     }
4915   return((DisposeType) wand->images->dispose);
4916 }
4917 \f
4918 /*
4919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4920 %                                                                             %
4921 %                                                                             %
4922 %                                                                             %
4923 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4924 %                                                                             %
4925 %                                                                             %
4926 %                                                                             %
4927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4928 %
4929 %  MagickGetImageFilename() returns the filename of a particular image in a
4930 %  sequence.
4931 %
4932 %  The format of the MagickGetImageFilename method is:
4933 %
4934 %      char *MagickGetImageFilename(MagickWand *wand)
4935 %
4936 %  A description of each parameter follows:
4937 %
4938 %    o wand: the magick wand.
4939 %
4940 */
4941 WandExport char *MagickGetImageFilename(MagickWand *wand)
4942 {
4943   assert(wand != (MagickWand *) NULL);
4944   assert(wand->signature == WandSignature);
4945   if (wand->debug != MagickFalse)
4946     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4947   if (wand->images == (Image *) NULL)
4948     {
4949       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4950         "ContainsNoImages","`%s'",wand->name);
4951       return((char *) NULL);
4952     }
4953   return(AcquireString(wand->images->filename));
4954 }
4955 \f
4956 /*
4957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4958 %                                                                             %
4959 %                                                                             %
4960 %                                                                             %
4961 %   M a g i c k G e t I m a g e F o r m a t                                   %
4962 %                                                                             %
4963 %                                                                             %
4964 %                                                                             %
4965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4966 %
4967 %  MagickGetImageFormat() returns the format of a particular image in a
4968 %  sequence.
4969 %
4970 %  The format of the MagickGetImageFormat method is:
4971 %
4972 %      const char MagickGetImageFormat(MagickWand *wand)
4973 %
4974 %  A description of each parameter follows:
4975 %
4976 %    o wand: the magick wand.
4977 %
4978 */
4979 WandExport char *MagickGetImageFormat(MagickWand *wand)
4980 {
4981   assert(wand != (MagickWand *) NULL);
4982   assert(wand->signature == WandSignature);
4983   if (wand->debug != MagickFalse)
4984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4985   if (wand->images == (Image *) NULL)
4986     {
4987       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4988         "ContainsNoImages","`%s'",wand->name);
4989       return((char *) NULL);
4990     }
4991   return(AcquireString(wand->images->magick));
4992 }
4993 \f
4994 /*
4995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4996 %                                                                             %
4997 %                                                                             %
4998 %                                                                             %
4999 %   M a g i c k G e t I m a g e F u z z                                       %
5000 %                                                                             %
5001 %                                                                             %
5002 %                                                                             %
5003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5004 %
5005 %  MagickGetImageFuzz() gets the image fuzz.
5006 %
5007 %  The format of the MagickGetImageFuzz method is:
5008 %
5009 %      double MagickGetImageFuzz(MagickWand *wand)
5010 %
5011 %  A description of each parameter follows:
5012 %
5013 %    o wand: the magick wand.
5014 %
5015 */
5016 WandExport double MagickGetImageFuzz(MagickWand *wand)
5017 {
5018   assert(wand != (MagickWand *) NULL);
5019   assert(wand->signature == WandSignature);
5020   if (wand->debug != MagickFalse)
5021     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5022   if (wand->images == (Image *) NULL)
5023     {
5024       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5025         "ContainsNoImages","`%s'",wand->name);
5026       return(0.0);
5027     }
5028   return(wand->images->fuzz);
5029 }
5030 \f
5031 /*
5032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5033 %                                                                             %
5034 %                                                                             %
5035 %                                                                             %
5036 %   M a g i c k G e t I m a g e G a m m a                                     %
5037 %                                                                             %
5038 %                                                                             %
5039 %                                                                             %
5040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5041 %
5042 %  MagickGetImageGamma() gets the image gamma.
5043 %
5044 %  The format of the MagickGetImageGamma method is:
5045 %
5046 %      double MagickGetImageGamma(MagickWand *wand)
5047 %
5048 %  A description of each parameter follows:
5049 %
5050 %    o wand: the magick wand.
5051 %
5052 */
5053 WandExport double MagickGetImageGamma(MagickWand *wand)
5054 {
5055   assert(wand != (MagickWand *) NULL);
5056   assert(wand->signature == WandSignature);
5057   if (wand->debug != MagickFalse)
5058     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5059   if (wand->images == (Image *) NULL)
5060     {
5061       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5062         "ContainsNoImages","`%s'",wand->name);
5063       return(0.0);
5064     }
5065   return(wand->images->gamma);
5066 }
5067 \f
5068 /*
5069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5070 %                                                                             %
5071 %                                                                             %
5072 %                                                                             %
5073 %   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                 %
5074 %                                                                             %
5075 %                                                                             %
5076 %                                                                             %
5077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5078 %
5079 %  MagickGetImageGravity() gets the image gravity.
5080 %
5081 %  The format of the MagickGetImageGravity method is:
5082 %
5083 %      GravityType MagickGetImageGravity(MagickWand *wand)
5084 %
5085 %  A description of each parameter follows:
5086 %
5087 %    o wand: the magick wand.
5088 %
5089 */
5090 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5091 {
5092   assert(wand != (MagickWand *) NULL);
5093   assert(wand->signature == WandSignature);
5094   if (wand->debug != MagickFalse)
5095     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5096   if (wand->images == (Image *) NULL)
5097     {
5098       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5099         "ContainsNoImages","`%s'",wand->name);
5100       return(UndefinedGravity);
5101     }
5102   return(wand->images->gravity);
5103 }
5104 \f
5105 /*
5106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5107 %                                                                             %
5108 %                                                                             %
5109 %                                                                             %
5110 %   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                       %
5111 %                                                                             %
5112 %                                                                             %
5113 %                                                                             %
5114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5115 %
5116 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5117 %
5118 %  The format of the MagickGetImageGreenPrimary method is:
5119 %
5120 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5121 %        double *y)
5122 %
5123 %  A description of each parameter follows:
5124 %
5125 %    o wand: the magick wand.
5126 %
5127 %    o x: the chromaticity green primary x-point.
5128 %
5129 %    o y: the chromaticity green primary y-point.
5130 %
5131 */
5132 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5133   double *x,double *y)
5134 {
5135   assert(wand != (MagickWand *) NULL);
5136   assert(wand->signature == WandSignature);
5137   if (wand->debug != MagickFalse)
5138     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5139   if (wand->images == (Image *) NULL)
5140     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5141   *x=wand->images->chromaticity.green_primary.x;
5142   *y=wand->images->chromaticity.green_primary.y;
5143   return(MagickTrue);
5144 }
5145 \f
5146 /*
5147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5148 %                                                                             %
5149 %                                                                             %
5150 %                                                                             %
5151 %   M a g i c k G e t I m a g e H e i g h t                                   %
5152 %                                                                             %
5153 %                                                                             %
5154 %                                                                             %
5155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5156 %
5157 %  MagickGetImageHeight() returns the image height.
5158 %
5159 %  The format of the MagickGetImageHeight method is:
5160 %
5161 %      size_t MagickGetImageHeight(MagickWand *wand)
5162 %
5163 %  A description of each parameter follows:
5164 %
5165 %    o wand: the magick wand.
5166 %
5167 */
5168 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5169 {
5170   assert(wand != (MagickWand *) NULL);
5171   assert(wand->signature == WandSignature);
5172   if (wand->debug != MagickFalse)
5173     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5174   if (wand->images == (Image *) NULL)
5175     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5176   return(wand->images->rows);
5177 }
5178 \f
5179 /*
5180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5181 %                                                                             %
5182 %                                                                             %
5183 %                                                                             %
5184 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
5185 %                                                                             %
5186 %                                                                             %
5187 %                                                                             %
5188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5189 %
5190 %  MagickGetImageHistogram() returns the image histogram as an array of
5191 %  PixelWand wands.
5192 %
5193 %  The format of the MagickGetImageHistogram method is:
5194 %
5195 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5196 %        size_t *number_colors)
5197 %
5198 %  A description of each parameter follows:
5199 %
5200 %    o wand: the magick wand.
5201 %
5202 %    o number_colors: the number of unique colors in the image and the number
5203 %      of pixel wands returned.
5204 %
5205 */
5206 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5207   size_t *number_colors)
5208 {
5209   ColorPacket
5210     *histogram;
5211
5212   PixelWand
5213     **pixel_wands;
5214
5215   register ssize_t
5216     i;
5217
5218   assert(wand != (MagickWand *) NULL);
5219   assert(wand->signature == WandSignature);
5220   if (wand->debug != MagickFalse)
5221     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5222   if (wand->images == (Image *) NULL)
5223     {
5224       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5225         "ContainsNoImages","`%s'",wand->name);
5226       return((PixelWand **) NULL);
5227     }
5228   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5229   if (histogram == (ColorPacket *) NULL)
5230     return((PixelWand **) NULL);
5231   pixel_wands=NewPixelWands(*number_colors);
5232   for (i=0; i < (ssize_t) *number_colors; i++)
5233   {
5234     PixelSetQuantumColor(pixel_wands[i],&histogram[i].pixel);
5235     PixelSetIndex(pixel_wands[i],histogram[i].index);
5236     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5237   }
5238   histogram=(ColorPacket *) RelinquishMagickMemory(histogram);
5239   return(pixel_wands);
5240 }
5241 \f
5242 /*
5243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5244 %                                                                             %
5245 %                                                                             %
5246 %                                                                             %
5247 %   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                 %
5248 %                                                                             %
5249 %                                                                             %
5250 %                                                                             %
5251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5252 %
5253 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5254 %
5255 %  The format of the MagickGetImageInterlaceScheme method is:
5256 %
5257 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5258 %
5259 %  A description of each parameter follows:
5260 %
5261 %    o wand: the magick wand.
5262 %
5263 */
5264 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5265 {
5266   assert(wand != (MagickWand *) NULL);
5267   assert(wand->signature == WandSignature);
5268   if (wand->debug != MagickFalse)
5269     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5270   if (wand->images == (Image *) NULL)
5271     {
5272       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5273         "ContainsNoImages","`%s'",wand->name);
5274       return(UndefinedInterlace);
5275     }
5276   return(wand->images->interlace);
5277 }
5278 \f
5279 /*
5280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5281 %                                                                             %
5282 %                                                                             %
5283 %                                                                             %
5284 %   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             %
5285 %                                                                             %
5286 %                                                                             %
5287 %                                                                             %
5288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5289 %
5290 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5291 %  sepcified image.
5292 %
5293 %  The format of the MagickGetImageInterpolateMethod method is:
5294 %
5295 %      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5296 %
5297 %  A description of each parameter follows:
5298 %
5299 %    o wand: the magick wand.
5300 %
5301 */
5302 WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5303   MagickWand *wand)
5304 {
5305   assert(wand != (MagickWand *) NULL);
5306   assert(wand->signature == WandSignature);
5307   if (wand->debug != MagickFalse)
5308     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5309   if (wand->images == (Image *) NULL)
5310     {
5311       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5312         "ContainsNoImages","`%s'",wand->name);
5313       return(UndefinedInterpolatePixel);
5314     }
5315   return(wand->images->interpolate);
5316 }
5317 \f
5318 /*
5319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5320 %                                                                             %
5321 %                                                                             %
5322 %                                                                             %
5323 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5324 %                                                                             %
5325 %                                                                             %
5326 %                                                                             %
5327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5328 %
5329 %  MagickGetImageIterations() gets the image iterations.
5330 %
5331 %  The format of the MagickGetImageIterations method is:
5332 %
5333 %      size_t MagickGetImageIterations(MagickWand *wand)
5334 %
5335 %  A description of each parameter follows:
5336 %
5337 %    o wand: the magick wand.
5338 %
5339 */
5340 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5341 {
5342   assert(wand != (MagickWand *) NULL);
5343   assert(wand->signature == WandSignature);
5344   if (wand->debug != MagickFalse)
5345     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5346   if (wand->images == (Image *) NULL)
5347     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5348   return(wand->images->iterations);
5349 }
5350 \f
5351 /*
5352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5353 %                                                                             %
5354 %                                                                             %
5355 %                                                                             %
5356 %   M a g i c k G e t I m a g e L e n g t h                                   %
5357 %                                                                             %
5358 %                                                                             %
5359 %                                                                             %
5360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5361 %
5362 %  MagickGetImageLength() returns the image length in bytes.
5363 %
5364 %  The format of the MagickGetImageLength method is:
5365 %
5366 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5367 %        MagickSizeType *length)
5368 %
5369 %  A description of each parameter follows:
5370 %
5371 %    o wand: the magick wand.
5372 %
5373 %    o length: the image length in bytes.
5374 %
5375 */
5376 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5377   MagickSizeType *length)
5378 {
5379   assert(wand != (MagickWand *) NULL);
5380   assert(wand->signature == WandSignature);
5381   if (wand->debug != MagickFalse)
5382     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5383   if (wand->images == (Image *) NULL)
5384     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5385   *length=GetBlobSize(wand->images);
5386   return(MagickTrue);
5387 }
5388 \f
5389 /*
5390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5391 %                                                                             %
5392 %                                                                             %
5393 %                                                                             %
5394 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5395 %                                                                             %
5396 %                                                                             %
5397 %                                                                             %
5398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5399 %
5400 %  MagickGetImageMatteColor() returns the image matte color.
5401 %
5402 %  The format of the MagickGetImageMatteColor method is:
5403 %
5404 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5405 %        PixelWand *matte_color)
5406 %
5407 %  A description of each parameter follows:
5408 %
5409 %    o wand: the magick wand.
5410 %
5411 %    o matte_color: Return the matte color.
5412 %
5413 */
5414 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5415   PixelWand *matte_color)
5416 {
5417   assert(wand != (MagickWand *) NULL);
5418   assert(wand->signature == WandSignature);
5419   if (wand->debug != MagickFalse)
5420     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5421   if (wand->images == (Image *) NULL)
5422     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5423   PixelSetQuantumColor(matte_color,&wand->images->matte_color);
5424   return(MagickTrue);
5425 }
5426 \f
5427 /*
5428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5429 %                                                                             %
5430 %                                                                             %
5431 %                                                                             %
5432 %   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                         %
5433 %                                                                             %
5434 %                                                                             %
5435 %                                                                             %
5436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5437 %
5438 %  MagickGetImageOrientation() returns the image orientation.
5439 %
5440 %  The format of the MagickGetImageOrientation method is:
5441 %
5442 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5443 %
5444 %  A description of each parameter follows:
5445 %
5446 %    o wand: the magick wand.
5447 %
5448 */
5449 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5450 {
5451   assert(wand != (MagickWand *) NULL);
5452   assert(wand->signature == WandSignature);
5453   if (wand->debug != MagickFalse)
5454     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5455   if (wand->images == (Image *) NULL)
5456     {
5457       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5458         "ContainsNoImages","`%s'",wand->name);
5459       return(UndefinedOrientation);
5460     }
5461   return(wand->images->orientation);
5462 }
5463 \f
5464 /*
5465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5466 %                                                                             %
5467 %                                                                             %
5468 %                                                                             %
5469 %   M a g i c k G e t I m a g e P a g e                                       %
5470 %                                                                             %
5471 %                                                                             %
5472 %                                                                             %
5473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5474 %
5475 %  MagickGetImagePage() returns the page geometry associated with the image.
5476 %
5477 %  The format of the MagickGetImagePage method is:
5478 %
5479 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5480 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5481 %
5482 %  A description of each parameter follows:
5483 %
5484 %    o wand: the magick wand.
5485 %
5486 %    o width: the page width.
5487 %
5488 %    o height: the page height.
5489 %
5490 %    o x: the page x-offset.
5491 %
5492 %    o y: the page y-offset.
5493 %
5494 */
5495 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5496   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5497 {
5498   assert(wand != (const MagickWand *) NULL);
5499   assert(wand->signature == WandSignature);
5500   if (wand->debug != MagickFalse)
5501     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5502   if (wand->images == (Image *) NULL)
5503     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5504   *width=wand->images->page.width;
5505   *height=wand->images->page.height;
5506   *x=wand->images->page.x;
5507   *y=wand->images->page.y;
5508   return(MagickTrue);
5509 }
5510 \f
5511 /*
5512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5513 %                                                                             %
5514 %                                                                             %
5515 %                                                                             %
5516 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5517 %                                                                             %
5518 %                                                                             %
5519 %                                                                             %
5520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5521 %
5522 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5523 %
5524 %  The format of the MagickGetImagePixelColor method is:
5525 %
5526 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5527 %        const ssize_t x,const ssize_t y,PixelWand *color)
5528 %
5529 %  A description of each parameter follows:
5530 %
5531 %    o wand: the magick wand.
5532 %
5533 %    o x,y: the pixel offset into the image.
5534 %
5535 %    o color: Return the colormap color in this wand.
5536 %
5537 */
5538 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5539   const ssize_t x,const ssize_t y,PixelWand *color)
5540 {
5541   IndexPacket
5542     *indexes;
5543
5544   register const PixelPacket
5545     *p;
5546
5547   CacheView
5548     *image_view;
5549
5550   assert(wand != (MagickWand *) NULL);
5551   assert(wand->signature == WandSignature);
5552   if (wand->debug != MagickFalse)
5553     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5554   if (wand->images == (Image *) NULL)
5555     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5556   image_view=AcquireCacheView(wand->images);
5557   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5558   if (p == (const PixelPacket *) NULL)
5559     {
5560       image_view=DestroyCacheView(image_view);
5561       return(MagickFalse);
5562     }
5563   indexes=GetCacheViewAuthenticIndexQueue(image_view);
5564   PixelSetQuantumColor(color,p);
5565   if (GetCacheViewColorspace(image_view) == CMYKColorspace)
5566     PixelSetBlackQuantum(color,*indexes);
5567   else
5568     if (GetCacheViewStorageClass(image_view) == PseudoClass)
5569       PixelSetIndex(color,*indexes);
5570   image_view=DestroyCacheView(image_view);
5571   return(MagickTrue);
5572 }
5573 \f
5574 /*
5575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5576 %                                                                             %
5577 %                                                                             %
5578 %                                                                             %
5579 +   M a g i c k G e t I m a g e R a n g e                                     %
5580 %                                                                             %
5581 %                                                                             %
5582 %                                                                             %
5583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5584 %
5585 %  MagickGetImageRange() gets the pixel range for the image.
5586 %
5587 %  The format of the MagickGetImageRange method is:
5588 %
5589 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5590 %        double *maxima)
5591 %
5592 %  A description of each parameter follows:
5593 %
5594 %    o wand: the magick wand.
5595 %
5596 %    o minima:  The minimum pixel value for the specified channel(s).
5597 %
5598 %    o maxima:  The maximum pixel value for the specified channel(s).
5599 %
5600 */
5601 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5602   double *minima,double *maxima)
5603 {
5604   MagickBooleanType
5605     status;
5606
5607   assert(wand != (MagickWand *) NULL);
5608   assert(wand->signature == WandSignature);
5609   if (wand->debug != MagickFalse)
5610     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5611   if (wand->images == (Image *) NULL)
5612     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5613   status=GetImageRange(wand->images,minima,maxima,wand->exception);
5614   return(status);
5615 }
5616 \f
5617 /*
5618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5619 %                                                                             %
5620 %                                                                             %
5621 %                                                                             %
5622 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5623 %                                                                             %
5624 %                                                                             %
5625 %                                                                             %
5626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5627 %
5628 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5629 %
5630 %  The format of the MagickGetImageRedPrimary method is:
5631 %
5632 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5633 %        double *y)
5634 %
5635 %  A description of each parameter follows:
5636 %
5637 %    o wand: the magick wand.
5638 %
5639 %    o x: the chromaticity red primary x-point.
5640 %
5641 %    o y: the chromaticity red primary y-point.
5642 %
5643 */
5644 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5645   double *x,double *y)
5646 {
5647   assert(wand != (MagickWand *) NULL);
5648   assert(wand->signature == WandSignature);
5649   if (wand->debug != MagickFalse)
5650     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5651   if (wand->images == (Image *) NULL)
5652     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5653   *x=wand->images->chromaticity.red_primary.x;
5654   *y=wand->images->chromaticity.red_primary.y;
5655   return(MagickTrue);
5656 }
5657 \f
5658 /*
5659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5660 %                                                                             %
5661 %                                                                             %
5662 %                                                                             %
5663 %   M a g i c k G e t I m a g e R e g i o n                                   %
5664 %                                                                             %
5665 %                                                                             %
5666 %                                                                             %
5667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5668 %
5669 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5670 %  a new wand.
5671 %
5672 %  The format of the MagickGetImageRegion method is:
5673 %
5674 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5675 %        const size_t width,const size_t height,const ssize_t x,
5676 %        const ssize_t y)
5677 %
5678 %  A description of each parameter follows:
5679 %
5680 %    o wand: the magick wand.
5681 %
5682 %    o width: the region width.
5683 %
5684 %    o height: the region height.
5685 %
5686 %    o x: the region x offset.
5687 %
5688 %    o y: the region y offset.
5689 %
5690 */
5691 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5692   const size_t width,const size_t height,const ssize_t x,
5693   const ssize_t y)
5694 {
5695   Image
5696     *region_image;
5697
5698   RectangleInfo
5699     region;
5700
5701   assert(wand != (MagickWand *) NULL);
5702   assert(wand->signature == WandSignature);
5703   if (wand->debug != MagickFalse)
5704     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5705   if (wand->images == (Image *) NULL)
5706     return((MagickWand *) NULL);
5707   region.width=width;
5708   region.height=height;
5709   region.x=x;
5710   region.y=y;
5711   region_image=CropImage(wand->images,&region,wand->exception);
5712   if (region_image == (Image *) NULL)
5713     return((MagickWand *) NULL);
5714   return(CloneMagickWandFromImages(wand,region_image));
5715 }
5716 \f
5717 /*
5718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5719 %                                                                             %
5720 %                                                                             %
5721 %                                                                             %
5722 %   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                 %
5723 %                                                                             %
5724 %                                                                             %
5725 %                                                                             %
5726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5727 %
5728 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5729 %
5730 %  The format of the MagickGetImageRenderingIntent method is:
5731 %
5732 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5733 %
5734 %  A description of each parameter follows:
5735 %
5736 %    o wand: the magick wand.
5737 %
5738 */
5739 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5740 {
5741   assert(wand != (MagickWand *) NULL);
5742   assert(wand->signature == WandSignature);
5743   if (wand->debug != MagickFalse)
5744     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5745   if (wand->images == (Image *) NULL)
5746     {
5747       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5748         "ContainsNoImages","`%s'",wand->name);
5749       return(UndefinedIntent);
5750     }
5751   return((RenderingIntent) wand->images->rendering_intent);
5752 }
5753 \f
5754 /*
5755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5756 %                                                                             %
5757 %                                                                             %
5758 %                                                                             %
5759 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5760 %                                                                             %
5761 %                                                                             %
5762 %                                                                             %
5763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5764 %
5765 %  MagickGetImageResolution() gets the image X and Y resolution.
5766 %
5767 %  The format of the MagickGetImageResolution method is:
5768 %
5769 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5770 %        double *y)
5771 %
5772 %  A description of each parameter follows:
5773 %
5774 %    o wand: the magick wand.
5775 %
5776 %    o x: the image x-resolution.
5777 %
5778 %    o y: the image y-resolution.
5779 %
5780 */
5781 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5782   double *x,double *y)
5783 {
5784   assert(wand != (MagickWand *) NULL);
5785   assert(wand->signature == WandSignature);
5786   if (wand->debug != MagickFalse)
5787     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5788   if (wand->images == (Image *) NULL)
5789     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5790   *x=wand->images->x_resolution;
5791   *y=wand->images->y_resolution;
5792   return(MagickTrue);
5793 }
5794 \f
5795 /*
5796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5797 %                                                                             %
5798 %                                                                             %
5799 %                                                                             %
5800 %   M a g i c k G e t I m a g e S c e n e                                     %
5801 %                                                                             %
5802 %                                                                             %
5803 %                                                                             %
5804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5805 %
5806 %  MagickGetImageScene() gets the image scene.
5807 %
5808 %  The format of the MagickGetImageScene method is:
5809 %
5810 %      size_t MagickGetImageScene(MagickWand *wand)
5811 %
5812 %  A description of each parameter follows:
5813 %
5814 %    o wand: the magick wand.
5815 %
5816 */
5817 WandExport size_t MagickGetImageScene(MagickWand *wand)
5818 {
5819   assert(wand != (MagickWand *) NULL);
5820   assert(wand->signature == WandSignature);
5821   if (wand->debug != MagickFalse)
5822     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5823   if (wand->images == (Image *) NULL)
5824     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5825   return(wand->images->scene);
5826 }
5827 \f
5828 /*
5829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5830 %                                                                             %
5831 %                                                                             %
5832 %                                                                             %
5833 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5834 %                                                                             %
5835 %                                                                             %
5836 %                                                                             %
5837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5838 %
5839 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5840 %  pixel stream.
5841 %
5842 %  The format of the MagickGetImageSignature method is:
5843 %
5844 %      const char MagickGetImageSignature(MagickWand *wand)
5845 %
5846 %  A description of each parameter follows:
5847 %
5848 %    o wand: the magick wand.
5849 %
5850 */
5851 WandExport char *MagickGetImageSignature(MagickWand *wand)
5852 {
5853   const char
5854     *value;
5855
5856   MagickBooleanType
5857     status;
5858
5859   assert(wand != (MagickWand *) NULL);
5860   assert(wand->signature == WandSignature);
5861   if (wand->debug != MagickFalse)
5862     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5863   if (wand->images == (Image *) NULL)
5864     {
5865       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5866         "ContainsNoImages","`%s'",wand->name);
5867       return((char *) NULL);
5868     }
5869   status=SignatureImage(wand->images);
5870   if (status == MagickFalse)
5871     InheritException(wand->exception,&wand->images->exception);
5872   value=GetImageProperty(wand->images,"signature");
5873   if (value != (const char *) NULL)
5874     return(AcquireString(value));
5875   InheritException(wand->exception,&wand->images->exception);
5876   return((char *) NULL);
5877 }
5878 \f
5879 /*
5880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5881 %                                                                             %
5882 %                                                                             %
5883 %                                                                             %
5884 %   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                   %
5885 %                                                                             %
5886 %                                                                             %
5887 %                                                                             %
5888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5889 %
5890 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5891 %
5892 %  The format of the MagickGetImageTicksPerSecond method is:
5893 %
5894 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5895 %
5896 %  A description of each parameter follows:
5897 %
5898 %    o wand: the magick wand.
5899 %
5900 */
5901 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5902 {
5903   assert(wand != (MagickWand *) NULL);
5904   assert(wand->signature == WandSignature);
5905   if (wand->debug != MagickFalse)
5906     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5907   if (wand->images == (Image *) NULL)
5908     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5909   return((size_t) wand->images->ticks_per_second);
5910 }
5911 \f
5912 /*
5913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5914 %                                                                             %
5915 %                                                                             %
5916 %                                                                             %
5917 %   M a g i c k G e t I m a g e T y p e                                       %
5918 %                                                                             %
5919 %                                                                             %
5920 %                                                                             %
5921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5922 %
5923 %  MagickGetImageType() gets the potential image type:
5924 %
5925 %        Bilevel        Grayscale       GrayscaleMatte
5926 %        Palette        PaletteMatte    TrueColor
5927 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5928 %
5929 %  To ensure the image type matches its potential, use MagickSetImageType():
5930 %
5931 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5932 %
5933 %  The format of the MagickGetImageType method is:
5934 %
5935 %      ImageType MagickGetImageType(MagickWand *wand)
5936 %
5937 %  A description of each parameter follows:
5938 %
5939 %    o wand: the magick wand.
5940 %
5941 */
5942 WandExport ImageType MagickGetImageType(MagickWand *wand)
5943 {
5944   assert(wand != (MagickWand *) NULL);
5945   assert(wand->signature == WandSignature);
5946   if (wand->debug != MagickFalse)
5947     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5948   if (wand->images == (Image *) NULL)
5949     {
5950       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5951         "ContainsNoImages","`%s'",wand->name);
5952       return(UndefinedType);
5953     }
5954   return(GetImageType(wand->images,wand->exception));
5955 }
5956 \f
5957 /*
5958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5959 %                                                                             %
5960 %                                                                             %
5961 %                                                                             %
5962 %   M a g i c k G e t I m a g e U n i t s                                     %
5963 %                                                                             %
5964 %                                                                             %
5965 %                                                                             %
5966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5967 %
5968 %  MagickGetImageUnits() gets the image units of resolution.
5969 %
5970 %  The format of the MagickGetImageUnits method is:
5971 %
5972 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5973 %
5974 %  A description of each parameter follows:
5975 %
5976 %    o wand: the magick wand.
5977 %
5978 */
5979 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5980 {
5981   assert(wand != (MagickWand *) NULL);
5982   assert(wand->signature == WandSignature);
5983   if (wand->debug != MagickFalse)
5984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5985   if (wand->images == (Image *) NULL)
5986     {
5987       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5988         "ContainsNoImages","`%s'",wand->name);
5989       return(UndefinedResolution);
5990     }
5991   return(wand->images->units);
5992 }
5993 \f
5994 /*
5995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5996 %                                                                             %
5997 %                                                                             %
5998 %                                                                             %
5999 %   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           %
6000 %                                                                             %
6001 %                                                                             %
6002 %                                                                             %
6003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6004 %
6005 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6006 %  sepcified image.
6007 %
6008 %  The format of the MagickGetImageVirtualPixelMethod method is:
6009 %
6010 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6011 %
6012 %  A description of each parameter follows:
6013 %
6014 %    o wand: the magick wand.
6015 %
6016 */
6017 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6018 {
6019   assert(wand != (MagickWand *) NULL);
6020   assert(wand->signature == WandSignature);
6021   if (wand->debug != MagickFalse)
6022     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6023   if (wand->images == (Image *) NULL)
6024     {
6025       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6026         "ContainsNoImages","`%s'",wand->name);
6027       return(UndefinedVirtualPixelMethod);
6028     }
6029   return(GetImageVirtualPixelMethod(wand->images));
6030 }
6031 \f
6032 /*
6033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6034 %                                                                             %
6035 %                                                                             %
6036 %                                                                             %
6037 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
6038 %                                                                             %
6039 %                                                                             %
6040 %                                                                             %
6041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6042 %
6043 %  MagickGetImageWhitePoint() returns the chromaticy white point.
6044 %
6045 %  The format of the MagickGetImageWhitePoint method is:
6046 %
6047 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6048 %        double *y)
6049 %
6050 %  A description of each parameter follows:
6051 %
6052 %    o wand: the magick wand.
6053 %
6054 %    o x: the chromaticity white x-point.
6055 %
6056 %    o y: the chromaticity white y-point.
6057 %
6058 */
6059 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6060   double *x,double *y)
6061 {
6062   assert(wand != (MagickWand *) NULL);
6063   assert(wand->signature == WandSignature);
6064   if (wand->debug != MagickFalse)
6065     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6066   if (wand->images == (Image *) NULL)
6067     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6068   *x=wand->images->chromaticity.white_point.x;
6069   *y=wand->images->chromaticity.white_point.y;
6070   return(MagickTrue);
6071 }
6072 \f
6073 /*
6074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6075 %                                                                             %
6076 %                                                                             %
6077 %                                                                             %
6078 %   M a g i c k G e t I m a g e W i d t h                                     %
6079 %                                                                             %
6080 %                                                                             %
6081 %                                                                             %
6082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6083 %
6084 %  MagickGetImageWidth() returns the image width.
6085 %
6086 %  The format of the MagickGetImageWidth method is:
6087 %
6088 %      size_t MagickGetImageWidth(MagickWand *wand)
6089 %
6090 %  A description of each parameter follows:
6091 %
6092 %    o wand: the magick wand.
6093 %
6094 */
6095 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6096 {
6097   assert(wand != (MagickWand *) NULL);
6098   assert(wand->signature == WandSignature);
6099   if (wand->debug != MagickFalse)
6100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6101   if (wand->images == (Image *) NULL)
6102     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6103   return(wand->images->columns);
6104 }
6105 \f
6106 /*
6107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6108 %                                                                             %
6109 %                                                                             %
6110 %                                                                             %
6111 %   M a g i c k G e t N u m b e r I m a g e s                                 %
6112 %                                                                             %
6113 %                                                                             %
6114 %                                                                             %
6115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6116 %
6117 %  MagickGetNumberImages() returns the number of images associated with a
6118 %  magick wand.
6119 %
6120 %  The format of the MagickGetNumberImages method is:
6121 %
6122 %      size_t MagickGetNumberImages(MagickWand *wand)
6123 %
6124 %  A description of each parameter follows:
6125 %
6126 %    o wand: the magick wand.
6127 %
6128 */
6129 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6130 {
6131   assert(wand != (MagickWand *) NULL);
6132   assert(wand->signature == WandSignature);
6133   if (wand->debug != MagickFalse)
6134     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6135   return(GetImageListLength(wand->images));
6136 }
6137 \f
6138 /*
6139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6140 %                                                                             %
6141 %                                                                             %
6142 %                                                                             %
6143 %   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                 %
6144 %                                                                             %
6145 %                                                                             %
6146 %                                                                             %
6147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6148 %
6149 %  MagickGetImageTotalInkDensity() gets the image total ink density.
6150 %
6151 %  The format of the MagickGetImageTotalInkDensity method is:
6152 %
6153 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
6154 %
6155 %  A description of each parameter follows:
6156 %
6157 %    o wand: the magick wand.
6158 %
6159 */
6160 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6161 {
6162   assert(wand != (MagickWand *) NULL);
6163   assert(wand->signature == WandSignature);
6164   if (wand->debug != MagickFalse)
6165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6166   if (wand->images == (Image *) NULL)
6167     {
6168       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6169         "ContainsNoImages","`%s'",wand->name);
6170       return(0.0);
6171     }
6172   return(GetImageTotalInkDensity(wand->images));
6173 }
6174 \f
6175 /*
6176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6177 %                                                                             %
6178 %                                                                             %
6179 %                                                                             %
6180 %   M a g i c k H a l d C l u t I m a g e                                     %
6181 %                                                                             %
6182 %                                                                             %
6183 %                                                                             %
6184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6185 %
6186 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6187 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6188 %  dimensions.  Create it with the HALD coder.  You can apply any color
6189 %  transformation to the Hald image and then use this method to apply the
6190 %  transform to the image.
6191 %
6192 %  The format of the MagickHaldClutImage method is:
6193 %
6194 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6195 %        const MagickWand *hald_wand)
6196 %      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6197 %        const ChannelType channel,const MagickWand *hald_wand)
6198 %
6199 %  A description of each parameter follows:
6200 %
6201 %    o wand: the magick wand.
6202 %
6203 %    o hald_image: the hald CLUT image.
6204 %
6205 */
6206
6207 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6208   const MagickWand *hald_wand)
6209 {
6210   MagickBooleanType
6211     status;
6212
6213   status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6214   return(status);
6215 }
6216
6217 WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6218   const ChannelType channel,const MagickWand *hald_wand)
6219 {
6220   MagickBooleanType
6221     status;
6222
6223   assert(wand != (MagickWand *) NULL);
6224   assert(wand->signature == WandSignature);
6225   if (wand->debug != MagickFalse)
6226     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6227   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6228     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6229   status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6230   if (status == MagickFalse)
6231     InheritException(wand->exception,&wand->images->exception);
6232   return(status);
6233 }
6234 \f
6235 /*
6236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6237 %                                                                             %
6238 %                                                                             %
6239 %                                                                             %
6240 %   M a g i c k H a s N e x t I m a g e                                       %
6241 %                                                                             %
6242 %                                                                             %
6243 %                                                                             %
6244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6245 %
6246 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
6247 %  traversing the list in the forward direction
6248 %
6249 %  The format of the MagickHasNextImage method is:
6250 %
6251 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6252 %
6253 %  A description of each parameter follows:
6254 %
6255 %    o wand: the magick wand.
6256 %
6257 */
6258 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
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   if (GetNextImageInList(wand->images) == (Image *) NULL)
6267     return(MagickFalse);
6268   return(MagickTrue);
6269 }
6270 \f
6271 /*
6272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6273 %                                                                             %
6274 %                                                                             %
6275 %                                                                             %
6276 %   M a g i c k H a s P r e v i o u s I m a g e                               %
6277 %                                                                             %
6278 %                                                                             %
6279 %                                                                             %
6280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6281 %
6282 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6283 %  traversing the list in the reverse direction
6284 %
6285 %  The format of the MagickHasPreviousImage method is:
6286 %
6287 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6288 %
6289 %  A description of each parameter follows:
6290 %
6291 %    o wand: the magick wand.
6292 %
6293 */
6294 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6295 {
6296   assert(wand != (MagickWand *) NULL);
6297   assert(wand->signature == WandSignature);
6298   if (wand->debug != MagickFalse)
6299     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6300   if (wand->images == (Image *) NULL)
6301     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6302   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6303     return(MagickFalse);
6304   return(MagickTrue);
6305 }
6306 \f
6307 /*
6308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6309 %                                                                             %
6310 %                                                                             %
6311 %                                                                             %
6312 %   M a g i c k I d e n t i f y I m a g e                                     %
6313 %                                                                             %
6314 %                                                                             %
6315 %                                                                             %
6316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6317 %
6318 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6319 %  file.  Attributes include the image width, height, size, and others.
6320 %
6321 %  The format of the MagickIdentifyImage method is:
6322 %
6323 %      const char *MagickIdentifyImage(MagickWand *wand)
6324 %
6325 %  A description of each parameter follows:
6326 %
6327 %    o wand: the magick wand.
6328 %
6329 */
6330 WandExport char *MagickIdentifyImage(MagickWand *wand)
6331 {
6332   char
6333     *description,
6334     filename[MaxTextExtent];
6335
6336   FILE
6337     *file;
6338
6339   int
6340     unique_file;
6341
6342   assert(wand != (MagickWand *) NULL);
6343   assert(wand->signature == WandSignature);
6344   if (wand->debug != MagickFalse)
6345     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6346   if (wand->images == (Image *) NULL)
6347     {
6348       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6349         "ContainsNoImages","`%s'",wand->name);
6350       return((char *) NULL);
6351     }
6352   description=(char *) NULL;
6353   unique_file=AcquireUniqueFileResource(filename);
6354   file=(FILE *) NULL;
6355   if (unique_file != -1)
6356     file=fdopen(unique_file,"wb");
6357   if ((unique_file == -1) || (file == (FILE *) NULL))
6358     {
6359       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6360         "UnableToCreateTemporaryFile","`%s'",wand->name);
6361       return((char *) NULL);
6362     }
6363   (void) IdentifyImage(wand->images,file,MagickTrue);
6364   (void) fclose(file);
6365   description=FileToString(filename,~0,wand->exception);
6366   (void) RelinquishUniqueFileResource(filename);
6367   return(description);
6368 }
6369 \f
6370 /*
6371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6372 %                                                                             %
6373 %                                                                             %
6374 %                                                                             %
6375 %   M a g i c k I m p l o d e I m a g e                                       %
6376 %                                                                             %
6377 %                                                                             %
6378 %                                                                             %
6379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6380 %
6381 %  MagickImplodeImage() creates a new image that is a copy of an existing
6382 %  one with the image pixels "implode" by the specified percentage.  It
6383 %  allocates the memory necessary for the new Image structure and returns a
6384 %  pointer to the new image.
6385 %
6386 %  The format of the MagickImplodeImage method is:
6387 %
6388 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6389 %        const double radius)
6390 %
6391 %  A description of each parameter follows:
6392 %
6393 %    o wand: the magick wand.
6394 %
6395 %    o amount: Define the extent of the implosion.
6396 %
6397 */
6398 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6399   const double amount)
6400 {
6401   Image
6402     *implode_image;
6403
6404   assert(wand != (MagickWand *) NULL);
6405   assert(wand->signature == WandSignature);
6406   if (wand->debug != MagickFalse)
6407     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6408   if (wand->images == (Image *) NULL)
6409     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6410   implode_image=ImplodeImage(wand->images,amount,wand->exception);
6411   if (implode_image == (Image *) NULL)
6412     return(MagickFalse);
6413   ReplaceImageInList(&wand->images,implode_image);
6414   return(MagickTrue);
6415 }
6416 \f
6417 /*
6418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6419 %                                                                             %
6420 %                                                                             %
6421 %                                                                             %
6422 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6423 %                                                                             %
6424 %                                                                             %
6425 %                                                                             %
6426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6427 %
6428 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6429 %  location you specify.  The method returns MagickFalse on success otherwise
6430 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6431 %  short int, int, ssize_t, float, or double in the order specified by map.
6432 %
6433 %  Suppose your want to upload the first scanline of a 640x480 image from
6434 %  character data in red-green-blue order:
6435 %
6436 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6437 %
6438 %  The format of the MagickImportImagePixels method is:
6439 %
6440 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6441 %        const ssize_t x,const ssize_t y,const size_t columns,
6442 %        const size_t rows,const char *map,const StorageType storage,
6443 %        const void *pixels)
6444 %
6445 %  A description of each parameter follows:
6446 %
6447 %    o wand: the magick wand.
6448 %
6449 %    o x, y, columns, rows:  These values define the perimeter of a region
6450 %      of pixels you want to define.
6451 %
6452 %    o map:  This string reflects the expected ordering of the pixel array.
6453 %      It can be any combination or order of R = red, G = green, B = blue,
6454 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6455 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6456 %      P = pad.
6457 %
6458 %    o storage: Define the data type of the pixels.  Float and double types are
6459 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6460 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6461 %      or DoublePixel.
6462 %
6463 %    o pixels: This array of values contain the pixel components as defined by
6464 %      map and type.  You must preallocate this array where the expected
6465 %      length varies depending on the values of width, height, map, and type.
6466 %
6467 */
6468 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6469   const ssize_t x,const ssize_t y,const size_t columns,
6470   const size_t rows,const char *map,const StorageType storage,
6471   const void *pixels)
6472 {
6473   MagickBooleanType
6474     status;
6475
6476   assert(wand != (MagickWand *) NULL);
6477   assert(wand->signature == WandSignature);
6478   if (wand->debug != MagickFalse)
6479     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6480   if (wand->images == (Image *) NULL)
6481     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6482   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6483   if (status == MagickFalse)
6484     InheritException(wand->exception,&wand->images->exception);
6485   return(status);
6486 }
6487 \f
6488 /*
6489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6490 %                                                                             %
6491 %                                                                             %
6492 %                                                                             %
6493 %   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       %
6494 %                                                                             %
6495 %                                                                             %
6496 %                                                                             %
6497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6498 %
6499 %  MagickInverseFourierTransformImage() implements the inverse discrete
6500 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6501 %  imaginary image pair.
6502 %
6503 %  The format of the MagickInverseFourierTransformImage method is:
6504 %
6505 %      MagickBooleanType MagickInverseFourierTransformImage(
6506 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6507 %        const MagickBooleanType magnitude)
6508 %
6509 %  A description of each parameter follows:
6510 %
6511 %    o magnitude_wand: the magnitude or real wand.
6512 %
6513 %    o phase_wand: the phase or imaginary wand.
6514 %
6515 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6516 %      imaginary image pair.
6517 %
6518 */
6519 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6520   MagickWand *magnitude_wand,MagickWand *phase_wand,
6521   const MagickBooleanType magnitude)
6522 {
6523   Image
6524     *inverse_image;
6525
6526   MagickWand
6527     *wand;
6528
6529   assert(magnitude_wand != (MagickWand *) NULL);
6530   assert(magnitude_wand->signature == WandSignature);
6531   if (magnitude_wand->debug != MagickFalse)
6532     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6533       magnitude_wand->name);
6534   wand=magnitude_wand;
6535   if (magnitude_wand->images == (Image *) NULL)
6536     ThrowWandException(WandError,"ContainsNoImages",
6537       magnitude_wand->name);
6538   assert(phase_wand != (MagickWand *) NULL);
6539   assert(phase_wand->signature == WandSignature);
6540   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6541     phase_wand->images,magnitude,wand->exception);
6542   if (inverse_image == (Image *) NULL)
6543     return(MagickFalse);
6544   ReplaceImageInList(&wand->images,inverse_image);
6545   return(MagickTrue);
6546 }
6547 \f
6548 /*
6549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6550 %                                                                             %
6551 %                                                                             %
6552 %                                                                             %
6553 %   M a g i c k L a b e l I m a g e                                           %
6554 %                                                                             %
6555 %                                                                             %
6556 %                                                                             %
6557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6558 %
6559 %  MagickLabelImage() adds a label to your image.
6560 %
6561 %  The format of the MagickLabelImage method is:
6562 %
6563 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6564 %
6565 %  A description of each parameter follows:
6566 %
6567 %    o wand: the magick wand.
6568 %
6569 %    o label: the image label.
6570 %
6571 */
6572 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6573   const char *label)
6574 {
6575   MagickBooleanType
6576     status;
6577
6578   assert(wand != (MagickWand *) NULL);
6579   assert(wand->signature == WandSignature);
6580   if (wand->debug != MagickFalse)
6581     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6582   if (wand->images == (Image *) NULL)
6583     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6584   status=SetImageProperty(wand->images,"label",label);
6585   if (status == MagickFalse)
6586     InheritException(wand->exception,&wand->images->exception);
6587   return(status);
6588 }
6589 \f
6590 /*
6591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6592 %                                                                             %
6593 %                                                                             %
6594 %                                                                             %
6595 %   M a g i c k L e v e l I m a g e                                           %
6596 %                                                                             %
6597 %                                                                             %
6598 %                                                                             %
6599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6600 %
6601 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6602 %  falling between specified white and black points to the full available
6603 %  quantum range. The parameters provided represent the black, mid, and white
6604 %  points. The black point specifies the darkest color in the image. Colors
6605 %  darker than the black point are set to zero. Mid point specifies a gamma
6606 %  correction to apply to the image.  White point specifies the lightest color
6607 %  in the image. Colors brighter than the white point are set to the maximum
6608 %  quantum value.
6609 %
6610 %  The format of the MagickLevelImage method is:
6611 %
6612 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6613 %        const double black_point,const double gamma,const double white_point)
6614 %      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6615 %        const ChannelType channel,const double black_point,const double gamma,
6616 %        const double white_point)
6617 %
6618 %  A description of each parameter follows:
6619 %
6620 %    o wand: the magick wand.
6621 %
6622 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6623 %
6624 %    o black_point: the black point.
6625 %
6626 %    o gamma: the gamma.
6627 %
6628 %    o white_point: the white point.
6629 %
6630 */
6631
6632 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6633   const double black_point,const double gamma,const double white_point)
6634 {
6635   MagickBooleanType
6636     status;
6637
6638   status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6639     white_point);
6640   return(status);
6641 }
6642
6643 WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6644   const ChannelType channel,const double black_point,const double gamma,
6645   const double white_point)
6646 {
6647   MagickBooleanType
6648     status;
6649
6650   assert(wand != (MagickWand *) NULL);
6651   assert(wand->signature == WandSignature);
6652   if (wand->debug != MagickFalse)
6653     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6654   if (wand->images == (Image *) NULL)
6655     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6656   status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6657   if (status == MagickFalse)
6658     InheritException(wand->exception,&wand->images->exception);
6659   return(status);
6660 }
6661 \f
6662 /*
6663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6664 %                                                                             %
6665 %                                                                             %
6666 %                                                                             %
6667 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6668 %                                                                             %
6669 %                                                                             %
6670 %                                                                             %
6671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6672 %
6673 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6674 %
6675 %  You can also reduce the influence of a particular channel with a gamma
6676 %  value of 0.
6677 %
6678 %  The format of the MagickLinearStretchImage method is:
6679 %
6680 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6681 %        const double black_point,const double white_point)
6682 %
6683 %  A description of each parameter follows:
6684 %
6685 %    o wand: the magick wand.
6686 %
6687 %    o black_point: the black point.
6688 %
6689 %    o white_point: the white point.
6690 %
6691 */
6692 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6693   const double black_point,const double white_point)
6694 {
6695   MagickBooleanType
6696     status;
6697
6698   assert(wand != (MagickWand *) NULL);
6699   assert(wand->signature == WandSignature);
6700   if (wand->debug != MagickFalse)
6701     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6702   if (wand->images == (Image *) NULL)
6703     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6704   status=LinearStretchImage(wand->images,black_point,white_point);
6705   if (status == MagickFalse)
6706     InheritException(wand->exception,&wand->images->exception);
6707   return(status);
6708 }
6709 \f
6710 /*
6711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6712 %                                                                             %
6713 %                                                                             %
6714 %                                                                             %
6715 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6716 %                                                                             %
6717 %                                                                             %
6718 %                                                                             %
6719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6720 %
6721 %  MagickLiquidRescaleImage() rescales image with seam carving.
6722 %
6723 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6724 %        const size_t columns,const size_t rows,
6725 %        const double delta_x,const double rigidity)
6726 %
6727 %  A description of each parameter follows:
6728 %
6729 %    o wand: the magick wand.
6730 %
6731 %    o columns: the number of columns in the scaled image.
6732 %
6733 %    o rows: the number of rows in the scaled image.
6734 %
6735 %    o delta_x: maximum seam transversal step (0 means straight seams).
6736 %
6737 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6738 %
6739 */
6740 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6741   const size_t columns,const size_t rows,const double delta_x,
6742   const double rigidity)
6743 {
6744   Image
6745     *rescale_image;
6746
6747   assert(wand != (MagickWand *) NULL);
6748   assert(wand->signature == WandSignature);
6749   if (wand->debug != MagickFalse)
6750     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6751   if (wand->images == (Image *) NULL)
6752     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6753   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6754     rigidity,wand->exception);
6755   if (rescale_image == (Image *) NULL)
6756     return(MagickFalse);
6757   ReplaceImageInList(&wand->images,rescale_image);
6758   return(MagickTrue);
6759 }
6760 \f
6761 /*
6762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6763 %                                                                             %
6764 %                                                                             %
6765 %                                                                             %
6766 %   M a g i c k M a g n i f y I m a g e                                       %
6767 %                                                                             %
6768 %                                                                             %
6769 %                                                                             %
6770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6771 %
6772 %  MagickMagnifyImage() is a convenience method that scales an image
6773 %  proportionally to twice its original size.
6774 %
6775 %  The format of the MagickMagnifyImage method is:
6776 %
6777 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6778 %
6779 %  A description of each parameter follows:
6780 %
6781 %    o wand: the magick wand.
6782 %
6783 */
6784 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6785 {
6786   Image
6787     *magnify_image;
6788
6789   assert(wand != (MagickWand *) NULL);
6790   assert(wand->signature == WandSignature);
6791   if (wand->debug != MagickFalse)
6792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6793   if (wand->images == (Image *) NULL)
6794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6795   magnify_image=MagnifyImage(wand->images,wand->exception);
6796   if (magnify_image == (Image *) NULL)
6797     return(MagickFalse);
6798   ReplaceImageInList(&wand->images,magnify_image);
6799   return(MagickTrue);
6800 }
6801 \f
6802 /*
6803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6804 %                                                                             %
6805 %                                                                             %
6806 %                                                                             %
6807 %   M a g i c k M e d i a n F i l t e r I m a g e                             %
6808 %                                                                             %
6809 %                                                                             %
6810 %                                                                             %
6811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6812 %
6813 %  MagickMedianFilterImage() applies a digital filter that improves the quality
6814 %  of a noisy image.  Each pixel is replaced by the median in a set of
6815 %  neighboring pixels as defined by radius.
6816 %
6817 %  The format of the MagickMedianFilterImage method is:
6818 %
6819 %      MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6820 %        const double radius)
6821 %
6822 %  A description of each parameter follows:
6823 %
6824 %    o wand: the magick wand.
6825 %
6826 %    o radius: the radius of the pixel neighborhood.
6827 %
6828 */
6829 WandExport MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6830   const double radius)
6831 {
6832   Image
6833     *median_image;
6834
6835   assert(wand != (MagickWand *) NULL);
6836   assert(wand->signature == WandSignature);
6837   if (wand->debug != MagickFalse)
6838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6839   if (wand->images == (Image *) NULL)
6840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6841   median_image=MedianFilterImage(wand->images,radius,wand->exception);
6842   if (median_image == (Image *) NULL)
6843     return(MagickFalse);
6844   ReplaceImageInList(&wand->images,median_image);
6845   return(MagickTrue);
6846 }
6847 \f
6848 /*
6849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6850 %                                                                             %
6851 %                                                                             %
6852 %                                                                             %
6853 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6854 %                                                                             %
6855 %                                                                             %
6856 %                                                                             %
6857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6858 %
6859 %  MagickMergeImageLayers() composes all the image layers from the current given
6860 %  image onward to produce a single image of the merged layers.
6861 %
6862 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6863 %  initialized using the first images background color.  The images
6864 %  are then compositied onto that image in sequence using the given
6865 %  composition that has been assigned to each individual image.
6866 %
6867 %  The format of the MagickMergeImageLayers method is:
6868 %
6869 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6870 %        const ImageLayerMethod method)
6871 %
6872 %  A description of each parameter follows:
6873 %
6874 %    o wand: the magick wand.
6875 %
6876 %    o method: the method of selecting the size of the initial canvas.
6877 %
6878 %        MergeLayer: Merge all layers onto a canvas just large enough
6879 %           to hold all the actual images. The virtual canvas of the
6880 %           first image is preserved but otherwise ignored.
6881 %
6882 %        FlattenLayer: Use the virtual canvas size of first image.
6883 %           Images which fall outside this canvas is clipped.
6884 %           This can be used to 'fill out' a given virtual canvas.
6885 %
6886 %        MosaicLayer: Start with the virtual canvas of the first image,
6887 %           enlarging left and right edges to contain all images.
6888 %           Images with negative offsets will be clipped.
6889 %
6890 */
6891 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6892   const ImageLayerMethod method)
6893 {
6894   Image
6895     *mosaic_image;
6896
6897   assert(wand != (MagickWand *) NULL);
6898   assert(wand->signature == WandSignature);
6899   if (wand->debug != MagickFalse)
6900     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6901   if (wand->images == (Image *) NULL)
6902     return((MagickWand *) NULL);
6903   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6904   if (mosaic_image == (Image *) NULL)
6905     return((MagickWand *) NULL);
6906   return(CloneMagickWandFromImages(wand,mosaic_image));
6907 }
6908 \f
6909 /*
6910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6911 %                                                                             %
6912 %                                                                             %
6913 %                                                                             %
6914 %   M a g i c k M i n i f y I m a g e                                         %
6915 %                                                                             %
6916 %                                                                             %
6917 %                                                                             %
6918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6919 %
6920 %  MagickMinifyImage() is a convenience method that scales an image
6921 %  proportionally to one-half its original size
6922 %
6923 %  The format of the MagickMinifyImage method is:
6924 %
6925 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6926 %
6927 %  A description of each parameter follows:
6928 %
6929 %    o wand: the magick wand.
6930 %
6931 */
6932 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6933 {
6934   Image
6935     *minify_image;
6936
6937   assert(wand != (MagickWand *) NULL);
6938   assert(wand->signature == WandSignature);
6939   if (wand->debug != MagickFalse)
6940     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6941   if (wand->images == (Image *) NULL)
6942     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6943   minify_image=MinifyImage(wand->images,wand->exception);
6944   if (minify_image == (Image *) NULL)
6945     return(MagickFalse);
6946   ReplaceImageInList(&wand->images,minify_image);
6947   return(MagickTrue);
6948 }
6949 \f
6950 /*
6951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6952 %                                                                             %
6953 %                                                                             %
6954 %                                                                             %
6955 %   M a g i c k M o d u l a t e I m a g e                                     %
6956 %                                                                             %
6957 %                                                                             %
6958 %                                                                             %
6959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6960 %
6961 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6962 %  of an image.  Hue is the percentage of absolute rotation from the current
6963 %  position.  For example 50 results in a counter-clockwise rotation of 90
6964 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6965 %  both resulting in a rotation of 180 degrees.
6966 %
6967 %  To increase the color brightness by 20% and decrease the color saturation by
6968 %  10% and leave the hue unchanged, use: 120,90,100.
6969 %
6970 %  The format of the MagickModulateImage method is:
6971 %
6972 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6973 %        const double brightness,const double saturation,const double hue)
6974 %
6975 %  A description of each parameter follows:
6976 %
6977 %    o wand: the magick wand.
6978 %
6979 %    o brightness: the percent change in brighness.
6980 %
6981 %    o saturation: the percent change in saturation.
6982 %
6983 %    o hue: the percent change in hue.
6984 %
6985 */
6986 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6987   const double brightness,const double saturation,const double hue)
6988 {
6989   char
6990     modulate[MaxTextExtent];
6991
6992   MagickBooleanType
6993     status;
6994
6995   assert(wand != (MagickWand *) NULL);
6996   assert(wand->signature == WandSignature);
6997   if (wand->debug != MagickFalse)
6998     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6999   if (wand->images == (Image *) NULL)
7000     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7001   (void) FormatMagickString(modulate,MaxTextExtent,"%g,%g,%g",
7002     brightness,saturation,hue);
7003   status=ModulateImage(wand->images,modulate);
7004   if (status == MagickFalse)
7005     InheritException(wand->exception,&wand->images->exception);
7006   return(status);
7007 }
7008 \f
7009 /*
7010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7011 %                                                                             %
7012 %                                                                             %
7013 %                                                                             %
7014 %   M a g i c k M o n t a g e I m a g e                                       %
7015 %                                                                             %
7016 %                                                                             %
7017 %                                                                             %
7018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7019 %
7020 %  MagickMontageImage() creates a composite image by combining several
7021 %  separate images. The images are tiled on the composite image with the name
7022 %  of the image optionally appearing just below the individual tile.
7023 %
7024 %  The format of the MagickMontageImage method is:
7025 %
7026 %      MagickWand *MagickMontageImage(MagickWand *wand,
7027 %        const DrawingWand drawing_wand,const char *tile_geometry,
7028 %        const char *thumbnail_geometry,const MontageMode mode,
7029 %        const char *frame)
7030 %
7031 %  A description of each parameter follows:
7032 %
7033 %    o wand: the magick wand.
7034 %
7035 %    o drawing_wand: the drawing wand.  The font name, size, and color are
7036 %      obtained from this wand.
7037 %
7038 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7039 %
7040 %    o thumbnail_geometry: Preferred image size and border size of each
7041 %      thumbnail (e.g. 120x120+4+3>).
7042 %
7043 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7044 %
7045 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7046 %      The frame color is that of the thumbnail's matte color.
7047 %
7048 */
7049 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7050   const DrawingWand *drawing_wand,const char *tile_geometry,
7051   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7052 {
7053   char
7054     *font;
7055
7056   Image
7057     *montage_image;
7058
7059   MontageInfo
7060     *montage_info;
7061
7062   PixelWand
7063     *pixel_wand;
7064
7065   assert(wand != (MagickWand *) NULL);
7066   assert(wand->signature == WandSignature);
7067   if (wand->debug != MagickFalse)
7068     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7069   if (wand->images == (Image *) NULL)
7070     return((MagickWand *) NULL);
7071   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7072   switch (mode)
7073   {
7074     case FrameMode:
7075     {
7076       (void) CloneString(&montage_info->frame,"15x15+3+3");
7077       montage_info->shadow=MagickTrue;
7078       break;
7079     }
7080     case UnframeMode:
7081     {
7082       montage_info->frame=(char *) NULL;
7083       montage_info->shadow=MagickFalse;
7084       montage_info->border_width=0;
7085       break;
7086     }
7087     case ConcatenateMode:
7088     {
7089       montage_info->frame=(char *) NULL;
7090       montage_info->shadow=MagickFalse;
7091       (void) CloneString(&montage_info->geometry,"+0+0");
7092       montage_info->border_width=0;
7093       break;
7094     }
7095     default:
7096       break;
7097   }
7098   font=DrawGetFont(drawing_wand);
7099   if (font != (char *) NULL)
7100     (void) CloneString(&montage_info->font,font);
7101   if (frame != (char *) NULL)
7102     (void) CloneString(&montage_info->frame,frame);
7103   montage_info->pointsize=DrawGetFontSize(drawing_wand);
7104   pixel_wand=NewPixelWand();
7105   DrawGetFillColor(drawing_wand,pixel_wand);
7106   PixelGetQuantumColor(pixel_wand,&montage_info->fill);
7107   DrawGetStrokeColor(drawing_wand,pixel_wand);
7108   PixelGetQuantumColor(pixel_wand,&montage_info->stroke);
7109   pixel_wand=DestroyPixelWand(pixel_wand);
7110   if (thumbnail_geometry != (char *) NULL)
7111     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7112   if (tile_geometry != (char *) NULL)
7113     (void) CloneString(&montage_info->tile,tile_geometry);
7114   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7115     wand->exception);
7116   montage_info=DestroyMontageInfo(montage_info);
7117   if (montage_image == (Image *) NULL)
7118     return((MagickWand *) NULL);
7119   return(CloneMagickWandFromImages(wand,montage_image));
7120 }
7121 \f
7122 /*
7123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7124 %                                                                             %
7125 %                                                                             %
7126 %                                                                             %
7127 %   M a g i c k M o r p h I m a g e s                                         %
7128 %                                                                             %
7129 %                                                                             %
7130 %                                                                             %
7131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7132 %
7133 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
7134 %  and size are linearly interpolated to give the appearance of a
7135 %  meta-morphosis from one image to the next.
7136 %
7137 %  The format of the MagickMorphImages method is:
7138 %
7139 %      MagickWand *MagickMorphImages(MagickWand *wand,
7140 %        const size_t number_frames)
7141 %
7142 %  A description of each parameter follows:
7143 %
7144 %    o wand: the magick wand.
7145 %
7146 %    o number_frames: the number of in-between images to generate.
7147 %
7148 */
7149 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7150   const size_t number_frames)
7151 {
7152   Image
7153     *morph_image;
7154
7155   assert(wand != (MagickWand *) NULL);
7156   assert(wand->signature == WandSignature);
7157   if (wand->debug != MagickFalse)
7158     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7159   if (wand->images == (Image *) NULL)
7160     return((MagickWand *) NULL);
7161   morph_image=MorphImages(wand->images,number_frames,wand->exception);
7162   if (morph_image == (Image *) NULL)
7163     return((MagickWand *) NULL);
7164   return(CloneMagickWandFromImages(wand,morph_image));
7165 }
7166 \f
7167 /*
7168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7169 %                                                                             %
7170 %                                                                             %
7171 %                                                                             %
7172 %   M a g i c k M o r p h o l o g y I m a g e                                 %
7173 %                                                                             %
7174 %                                                                             %
7175 %                                                                             %
7176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7177 %
7178 %  MagickMorphologyImage() applies a user supplied kernel to the image
7179 %  according to the given mophology method.
7180 %
7181 %  The format of the MagickMorphologyImage method is:
7182 %
7183 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7184 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7185 %      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7186 %        ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7187 %        KernelInfo *kernel)
7188 %
7189 %  A description of each parameter follows:
7190 %
7191 %    o wand: the magick wand.
7192 %
7193 %    o channel: the image channel(s).
7194 %
7195 %    o method: the morphology method to be applied.
7196 %
7197 %    o iterations: apply the operation this many times (or no change).
7198 %      A value of -1 means loop until no change found.  How this is applied
7199 %      may depend on the morphology method.  Typically this is a value of 1.
7200 %
7201 %    o kernel: An array of doubles representing the morphology kernel.
7202 %
7203 */
7204
7205 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7206   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7207 {
7208   MagickBooleanType
7209     status;
7210
7211   status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7212     kernel);
7213   return(status);
7214 }
7215
7216 WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7217   const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7218   KernelInfo *kernel)
7219 {
7220   Image
7221     *morphology_image;
7222
7223   assert(wand != (MagickWand *) NULL);
7224   assert(wand->signature == WandSignature);
7225   if (wand->debug != MagickFalse)
7226     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7227   if (kernel == (const KernelInfo *) NULL)
7228     return(MagickFalse);
7229   if (wand->images == (Image *) NULL)
7230     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7231   morphology_image=MorphologyImageChannel(wand->images,channel,method,
7232     iterations,kernel,wand->exception);
7233   if (morphology_image == (Image *) NULL)
7234     return(MagickFalse);
7235   ReplaceImageInList(&wand->images,morphology_image);
7236   return(MagickTrue);
7237 }
7238 \f
7239 /*
7240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7241 %                                                                             %
7242 %                                                                             %
7243 %                                                                             %
7244 %   M a g i c k M o t i o n B l u r I m a g e                                 %
7245 %                                                                             %
7246 %                                                                             %
7247 %                                                                             %
7248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7249 %
7250 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7251 %  Gaussian operator of the given radius and standard deviation (sigma).
7252 %  For reasonable results, radius should be larger than sigma.  Use a
7253 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7254 %  Angle gives the angle of the blurring motion.
7255 %
7256 %  The format of the MagickMotionBlurImage method is:
7257 %
7258 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7259 %        const double radius,const double sigma,const double angle)
7260 %      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7261 %        const ChannelType channel,const double radius,const double sigma,
7262 %        const double angle)
7263 %
7264 %  A description of each parameter follows:
7265 %
7266 %    o wand: the magick wand.
7267 %
7268 %    o channel: the image channel(s).
7269 %
7270 %    o radius: the radius of the Gaussian, in pixels, not counting
7271 %      the center pixel.
7272 %
7273 %    o sigma: the standard deviation of the Gaussian, in pixels.
7274 %
7275 %    o angle: Apply the effect along this angle.
7276 %
7277 */
7278
7279 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7280   const double radius,const double sigma,const double angle)
7281 {
7282   MagickBooleanType
7283     status;
7284
7285   status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7286   return(status);
7287 }
7288
7289 WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7290   const ChannelType channel,const double radius,const double sigma,
7291   const double angle)
7292 {
7293   Image
7294     *blur_image;
7295
7296   assert(wand != (MagickWand *) NULL);
7297   assert(wand->signature == WandSignature);
7298   if (wand->debug != MagickFalse)
7299     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7300   if (wand->images == (Image *) NULL)
7301     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7302   blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7303     wand->exception);
7304   if (blur_image == (Image *) NULL)
7305     return(MagickFalse);
7306   ReplaceImageInList(&wand->images,blur_image);
7307   return(MagickTrue);
7308 }
7309 \f
7310 /*
7311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7312 %                                                                             %
7313 %                                                                             %
7314 %                                                                             %
7315 %   M a g i c k N e g a t e I m a g e                                         %
7316 %                                                                             %
7317 %                                                                             %
7318 %                                                                             %
7319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7320 %
7321 %  MagickNegateImage() negates the colors in the reference image.  The
7322 %  Grayscale option means that only grayscale values within the image are
7323 %  negated.
7324 %
7325 %  You can also reduce the influence of a particular channel with a gamma
7326 %  value of 0.
7327 %
7328 %  The format of the MagickNegateImage method is:
7329 %
7330 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7331 %        const MagickBooleanType gray)
7332 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7333 %        const ChannelType channel,const MagickBooleanType gray)
7334 %
7335 %  A description of each parameter follows:
7336 %
7337 %    o wand: the magick wand.
7338 %
7339 %    o channel: the image channel(s).
7340 %
7341 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7342 %
7343 */
7344
7345 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7346   const MagickBooleanType gray)
7347 {
7348   MagickBooleanType
7349     status;
7350
7351   status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7352   return(status);
7353 }
7354
7355 WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7356   const ChannelType channel,const MagickBooleanType gray)
7357 {
7358   MagickBooleanType
7359     status;
7360
7361   assert(wand != (MagickWand *) NULL);
7362   assert(wand->signature == WandSignature);
7363   if (wand->debug != MagickFalse)
7364     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7365   if (wand->images == (Image *) NULL)
7366     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7367   status=NegateImageChannel(wand->images,channel,gray);
7368   if (status == MagickFalse)
7369     InheritException(wand->exception,&wand->images->exception);
7370   return(status);
7371 }
7372 \f
7373 /*
7374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7375 %                                                                             %
7376 %                                                                             %
7377 %                                                                             %
7378 %   M a g i c k N e w I m a g e                                               %
7379 %                                                                             %
7380 %                                                                             %
7381 %                                                                             %
7382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7383 %
7384 %  MagickNewImage() adds a blank image canvas of the specified size and
7385 %  background color to the wand.
7386 %
7387 %  The format of the MagickNewImage method is:
7388 %
7389 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7390 %        const size_t columns,const size_t rows,
7391 %        const PixelWand *background)
7392 %
7393 %  A description of each parameter follows:
7394 %
7395 %    o wand: the magick wand.
7396 %
7397 %    o width: the image width.
7398 %
7399 %    o height: the image height.
7400 %
7401 %    o background: the image color.
7402 %
7403 */
7404 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7405   const size_t width,const size_t height,
7406   const PixelWand *background)
7407 {
7408   Image
7409     *images;
7410
7411   MagickPixelPacket
7412     pixel;
7413
7414   assert(wand != (MagickWand *) NULL);
7415   assert(wand->signature == WandSignature);
7416   if (wand->debug != MagickFalse)
7417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7418   PixelGetMagickColor(background,&pixel);
7419   images=NewMagickImage(wand->image_info,width,height,&pixel);
7420   if (images == (Image *) NULL)
7421     return(MagickFalse);
7422   if (images->exception.severity != UndefinedException)
7423     InheritException(wand->exception,&images->exception);
7424   return(InsertImageInWand(wand,images));
7425 }
7426 \f
7427 /*
7428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7429 %                                                                             %
7430 %                                                                             %
7431 %                                                                             %
7432 %   M a g i c k N e x t I m a g e                                             %
7433 %                                                                             %
7434 %                                                                             %
7435 %                                                                             %
7436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7437 %
7438 %  MagickNextImage() associates the next image in the image list with a magick
7439 %  wand.
7440 %
7441 %  The format of the MagickNextImage method is:
7442 %
7443 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7444 %
7445 %  A description of each parameter follows:
7446 %
7447 %    o wand: the magick wand.
7448 %
7449 */
7450 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7451 {
7452   assert(wand != (MagickWand *) NULL);
7453   assert(wand->signature == WandSignature);
7454   if (wand->debug != MagickFalse)
7455     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7456   if (wand->images == (Image *) NULL)
7457     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7458   if (wand->pend != MagickFalse)
7459     {
7460       wand->pend=MagickFalse;
7461       return(MagickTrue);
7462     }
7463   if (GetNextImageInList(wand->images) == (Image *) NULL)
7464     {
7465       wand->pend=MagickTrue;
7466       return(MagickFalse);
7467     }
7468   wand->images=GetNextImageInList(wand->images);
7469   return(MagickTrue);
7470 }
7471 \f
7472 /*
7473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7474 %                                                                             %
7475 %                                                                             %
7476 %                                                                             %
7477 %   M a g i c k N o r m a l i z e I m a g e                                   %
7478 %                                                                             %
7479 %                                                                             %
7480 %                                                                             %
7481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7482 %
7483 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7484 %  the pixels color to span the entire range of colors available
7485 %
7486 %  You can also reduce the influence of a particular channel with a gamma
7487 %  value of 0.
7488 %
7489 %  The format of the MagickNormalizeImage method is:
7490 %
7491 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7492 %      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7493 %        const ChannelType channel)
7494 %
7495 %  A description of each parameter follows:
7496 %
7497 %    o wand: the magick wand.
7498 %
7499 %    o channel: the image channel(s).
7500 %
7501 */
7502
7503 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7504 {
7505   MagickBooleanType
7506     status;
7507
7508   status=MagickNormalizeImageChannel(wand,DefaultChannels);
7509   return(status);
7510 }
7511
7512 WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7513   const ChannelType channel)
7514 {
7515   MagickBooleanType
7516     status;
7517
7518   assert(wand != (MagickWand *) NULL);
7519   assert(wand->signature == WandSignature);
7520   if (wand->debug != MagickFalse)
7521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7522   if (wand->images == (Image *) NULL)
7523     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7524   status=NormalizeImageChannel(wand->images,channel);
7525   if (status == MagickFalse)
7526     InheritException(wand->exception,&wand->images->exception);
7527   return(status);
7528 }
7529 \f
7530 /*
7531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7532 %                                                                             %
7533 %                                                                             %
7534 %                                                                             %
7535 %   M a g i c k O i l P a i n t I m a g e                                     %
7536 %                                                                             %
7537 %                                                                             %
7538 %                                                                             %
7539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7540 %
7541 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7542 %  painting.  Each pixel is replaced by the most frequent color occurring
7543 %  in a circular region defined by radius.
7544 %
7545 %  The format of the MagickOilPaintImage method is:
7546 %
7547 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7548 %        const double radius)
7549 %
7550 %  A description of each parameter follows:
7551 %
7552 %    o wand: the magick wand.
7553 %
7554 %    o radius: the radius of the circular neighborhood.
7555 %
7556 */
7557 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7558   const double radius)
7559 {
7560   Image
7561     *paint_image;
7562
7563   assert(wand != (MagickWand *) NULL);
7564   assert(wand->signature == WandSignature);
7565   if (wand->debug != MagickFalse)
7566     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7567   if (wand->images == (Image *) NULL)
7568     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7569   paint_image=OilPaintImage(wand->images,radius,wand->exception);
7570   if (paint_image == (Image *) NULL)
7571     return(MagickFalse);
7572   ReplaceImageInList(&wand->images,paint_image);
7573   return(MagickTrue);
7574 }
7575 \f
7576 /*
7577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7578 %                                                                             %
7579 %                                                                             %
7580 %                                                                             %
7581 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7582 %                                                                             %
7583 %                                                                             %
7584 %                                                                             %
7585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7586 %
7587 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7588 %  defined by fill.
7589 %
7590 %  The format of the MagickOpaquePaintImage method is:
7591 %
7592 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7593 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7594 %        const MagickBooleanType invert)
7595 %      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7596 %        const ChannelType channel,const PixelWand *target,
7597 %        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7598 %
7599 %  A description of each parameter follows:
7600 %
7601 %    o wand: the magick wand.
7602 %
7603 %    o channel: the channel(s).
7604 %
7605 %    o target: Change this target color to the fill color within the image.
7606 %
7607 %    o fill: the fill pixel wand.
7608 %
7609 %    o fuzz: By default target must match a particular pixel color
7610 %      exactly.  However, in many cases two colors may differ by a small amount.
7611 %      The fuzz member of image defines how much tolerance is acceptable to
7612 %      consider two colors as the same.  For example, set fuzz to 10 and the
7613 %      color red at intensities of 100 and 102 respectively are now interpreted
7614 %      as the same color for the purposes of the floodfill.
7615 %
7616 %    o invert: paint any pixel that does not match the target color.
7617 %
7618 */
7619
7620 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7621   const PixelWand *target,const PixelWand *fill,const double fuzz,
7622   const MagickBooleanType invert)
7623 {
7624   MagickBooleanType
7625     status;
7626
7627   status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7628     invert);
7629   return(status);
7630 }
7631
7632 WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7633   const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7634   const double fuzz,const MagickBooleanType invert)
7635 {
7636   MagickBooleanType
7637     status;
7638
7639   MagickPixelPacket
7640     fill_pixel,
7641     target_pixel;
7642
7643   assert(wand != (MagickWand *) NULL);
7644   assert(wand->signature == WandSignature);
7645   if (wand->debug != MagickFalse)
7646     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7647   if (wand->images == (Image *) NULL)
7648     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7649   PixelGetMagickColor(target,&target_pixel);
7650   PixelGetMagickColor(fill,&fill_pixel);
7651   wand->images->fuzz=fuzz;
7652   status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7653     &fill_pixel,invert);
7654   if (status == MagickFalse)
7655     InheritException(wand->exception,&wand->images->exception);
7656   return(status);
7657 }
7658 \f
7659 /*
7660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7661 %                                                                             %
7662 %                                                                             %
7663 %                                                                             %
7664 %   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                         %
7665 %                                                                             %
7666 %                                                                             %
7667 %                                                                             %
7668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7669 %
7670 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7671 %  previous image in the sequence.  From this it attempts to select the
7672 %  smallest cropped image to replace each frame, while preserving the results
7673 %  of the animation.
7674 %
7675 %  The format of the MagickOptimizeImageLayers method is:
7676 %
7677 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7678 %
7679 %  A description of each parameter follows:
7680 %
7681 %    o wand: the magick wand.
7682 %
7683 */
7684 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7685 {
7686   Image
7687     *optimize_image;
7688
7689   assert(wand != (MagickWand *) NULL);
7690   assert(wand->signature == WandSignature);
7691   if (wand->debug != MagickFalse)
7692     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7693   if (wand->images == (Image *) NULL)
7694     return((MagickWand *) NULL);
7695   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7696   if (optimize_image == (Image *) NULL)
7697     return((MagickWand *) NULL);
7698   return(CloneMagickWandFromImages(wand,optimize_image));
7699 }
7700 \f
7701 /*
7702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7703 %                                                                             %
7704 %                                                                             %
7705 %                                                                             %
7706 %     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                   %
7707 %                                                                             %
7708 %                                                                             %
7709 %                                                                             %
7710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7711 %
7712 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7713 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7714 %  which can be different for different channels, according to the input
7715 %  arguments.
7716 %
7717 %  The format of the MagickOrderedPosterizeImage method is:
7718 %
7719 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7720 %        const char *threshold_map)
7721 %      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7722 %        const ChannelType channel,const char *threshold_map)
7723 %
7724 %  A description of each parameter follows:
7725 %
7726 %    o image: the image.
7727 %
7728 %    o channel: the channel or channels to be thresholded.
7729 %
7730 %    o threshold_map: A string containing the name of the threshold dither
7731 %      map to use, followed by zero or more numbers representing the number of
7732 %      color levels tho dither between.
7733 %
7734 %      Any level number less than 2 is equivelent to 2, and means only binary
7735 %      dithering will be applied to each color channel.
7736 %
7737 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7738 %      channels, while a single number is the number of levels applied to each
7739 %      channel in sequence.  More numbers will be applied in turn to each of
7740 %      the color channels.
7741 %
7742 %      For example: "o3x3,6" generates a 6 level posterization of the image
7743 %      with a ordered 3x3 diffused pixel dither being applied between each
7744 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7745 %      only a single checkerboard hash pattern (50% grey) between each color
7746 %      level, to basically double the number of color levels with a bare
7747 %      minimim of dithering.
7748 %
7749 */
7750
7751 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7752   const char *threshold_map)
7753 {
7754   MagickBooleanType
7755     status;
7756
7757   status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7758   return(status);
7759 }
7760
7761 WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7762   MagickWand *wand,const ChannelType channel,const char *threshold_map)
7763 {
7764   MagickBooleanType
7765     status;
7766
7767   assert(wand != (MagickWand *) NULL);
7768   assert(wand->signature == WandSignature);
7769   if (wand->debug != MagickFalse)
7770     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7771   if (wand->images == (Image *) NULL)
7772     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7773   status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7774     wand->exception);
7775   return(status);
7776 }
7777 \f
7778 /*
7779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7780 %                                                                             %
7781 %                                                                             %
7782 %                                                                             %
7783 %   M a g i c k P i n g I m a g e                                             %
7784 %                                                                             %
7785 %                                                                             %
7786 %                                                                             %
7787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7788 %
7789 %  MagickPingImage() is like MagickReadImage() except the only valid
7790 %  information returned is the image width, height, size, and format.  It
7791 %  is designed to efficiently obtain this information from a file without
7792 %  reading the entire image sequence into memory.
7793 %
7794 %  The format of the MagickPingImage method is:
7795 %
7796 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7797 %
7798 %  A description of each parameter follows:
7799 %
7800 %    o wand: the magick wand.
7801 %
7802 %    o filename: the image filename.
7803 %
7804 */
7805 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7806   const char *filename)
7807 {
7808   Image
7809     *images;
7810
7811   ImageInfo
7812     *ping_info;
7813
7814   assert(wand != (MagickWand *) NULL);
7815   assert(wand->signature == WandSignature);
7816   if (wand->debug != MagickFalse)
7817     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7818   ping_info=CloneImageInfo(wand->image_info);
7819   if (filename != (const char *) NULL)
7820     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7821   images=PingImage(ping_info,wand->exception);
7822   ping_info=DestroyImageInfo(ping_info);
7823   if (images == (Image *) NULL)
7824     return(MagickFalse);
7825   return(InsertImageInWand(wand,images));
7826 }
7827 \f
7828 /*
7829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7830 %                                                                             %
7831 %                                                                             %
7832 %                                                                             %
7833 %   M a g i c k P i n g I m a g e B l o b                                     %
7834 %                                                                             %
7835 %                                                                             %
7836 %                                                                             %
7837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7838 %
7839 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7840 %
7841 %  The format of the MagickPingImageBlob method is:
7842 %
7843 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7844 %        const void *blob,const size_t length)
7845 %
7846 %  A description of each parameter follows:
7847 %
7848 %    o wand: the magick wand.
7849 %
7850 %    o blob: the blob.
7851 %
7852 %    o length: the blob length.
7853 %
7854 */
7855 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7856   const void *blob,const size_t length)
7857 {
7858   Image
7859     *images;
7860
7861   ImageInfo
7862     *read_info;
7863
7864   assert(wand != (MagickWand *) NULL);
7865   assert(wand->signature == WandSignature);
7866   if (wand->debug != MagickFalse)
7867     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7868   read_info=CloneImageInfo(wand->image_info);
7869   SetImageInfoBlob(read_info,blob,length);
7870   images=PingImage(read_info,wand->exception);
7871   read_info=DestroyImageInfo(read_info);
7872   if (images == (Image *) NULL)
7873     return(MagickFalse);
7874   return(InsertImageInWand(wand,images));
7875 }
7876 \f
7877 /*
7878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7879 %                                                                             %
7880 %                                                                             %
7881 %                                                                             %
7882 %   M a g i c k P i n g I m a g e F i l e                                     %
7883 %                                                                             %
7884 %                                                                             %
7885 %                                                                             %
7886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7887 %
7888 %  MagickPingImageFile() pings an image or image sequence from an open file
7889 %  descriptor.
7890 %
7891 %  The format of the MagickPingImageFile method is:
7892 %
7893 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7894 %
7895 %  A description of each parameter follows:
7896 %
7897 %    o wand: the magick wand.
7898 %
7899 %    o file: the file descriptor.
7900 %
7901 */
7902 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7903 {
7904   Image
7905     *images;
7906
7907   ImageInfo
7908     *read_info;
7909
7910   assert(wand != (MagickWand *) NULL);
7911   assert(wand->signature == WandSignature);
7912   assert(file != (FILE *) NULL);
7913   if (wand->debug != MagickFalse)
7914     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7915   read_info=CloneImageInfo(wand->image_info);
7916   SetImageInfoFile(read_info,file);
7917   images=PingImage(read_info,wand->exception);
7918   read_info=DestroyImageInfo(read_info);
7919   if (images == (Image *) NULL)
7920     return(MagickFalse);
7921   return(InsertImageInWand(wand,images));
7922 }
7923 \f
7924 /*
7925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7926 %                                                                             %
7927 %                                                                             %
7928 %                                                                             %
7929 %   M a g i c k P o l a r o i d I m a g e                                     %
7930 %                                                                             %
7931 %                                                                             %
7932 %                                                                             %
7933 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7934 %
7935 %  MagickPolaroidImage() simulates a Polaroid picture.
7936 %
7937 %  The format of the MagickPolaroidImage method is:
7938 %
7939 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7940 %        const DrawingWand *drawing_wand,const double angle)
7941 %
7942 %  A description of each parameter follows:
7943 %
7944 %    o wand: the magick wand.
7945 %
7946 %    o drawing_wand: the draw wand.
7947 %
7948 %    o angle: Apply the effect along this angle.
7949 %
7950 */
7951 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7952   const DrawingWand *drawing_wand,const double angle)
7953 {
7954   DrawInfo
7955     *draw_info;
7956
7957   Image
7958     *polaroid_image;
7959
7960   assert(wand != (MagickWand *) NULL);
7961   assert(wand->signature == WandSignature);
7962   if (wand->debug != MagickFalse)
7963     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7964   if (wand->images == (Image *) NULL)
7965     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7966   draw_info=PeekDrawingWand(drawing_wand);
7967   if (draw_info == (DrawInfo *) NULL)
7968     return(MagickFalse);
7969   polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7970   if (polaroid_image == (Image *) NULL)
7971     return(MagickFalse);
7972   ReplaceImageInList(&wand->images,polaroid_image);
7973   return(MagickTrue);
7974 }
7975 \f
7976 /*
7977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7978 %                                                                             %
7979 %                                                                             %
7980 %                                                                             %
7981 %   M a g i c k P o s t e r i z e I m a g e                                   %
7982 %                                                                             %
7983 %                                                                             %
7984 %                                                                             %
7985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7986 %
7987 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7988 %
7989 %  The format of the MagickPosterizeImage method is:
7990 %
7991 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7992 %        const unsigned levels,const MagickBooleanType dither)
7993 %
7994 %  A description of each parameter follows:
7995 %
7996 %    o wand: the magick wand.
7997 %
7998 %    o levels: Number of color levels allowed in each channel.  Very low values
7999 %      (2, 3, or 4) have the most visible effect.
8000 %
8001 %    o dither: Set this integer value to something other than zero to dither
8002 %      the mapped image.
8003 %
8004 */
8005 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8006   const size_t levels,const MagickBooleanType dither)
8007 {
8008   MagickBooleanType
8009     status;
8010
8011   assert(wand != (MagickWand *) NULL);
8012   assert(wand->signature == WandSignature);
8013   if (wand->debug != MagickFalse)
8014     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8015   if (wand->images == (Image *) NULL)
8016     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8017   status=PosterizeImage(wand->images,levels,dither);
8018   if (status == MagickFalse)
8019     InheritException(wand->exception,&wand->images->exception);
8020   return(status);
8021 }
8022 \f
8023 /*
8024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8025 %                                                                             %
8026 %                                                                             %
8027 %                                                                             %
8028 %   M a g i c k P r e v i e w I m a g e s                                     %
8029 %                                                                             %
8030 %                                                                             %
8031 %                                                                             %
8032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8033 %
8034 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8035 %  image processing operation applied at varying strengths.  This helpful
8036 %  to quickly pin-point an appropriate parameter for an image processing
8037 %  operation.
8038 %
8039 %  The format of the MagickPreviewImages method is:
8040 %
8041 %      MagickWand *MagickPreviewImages(MagickWand *wand,
8042 %        const PreviewType preview)
8043 %
8044 %  A description of each parameter follows:
8045 %
8046 %    o wand: the magick wand.
8047 %
8048 %    o preview: the preview type.
8049 %
8050 */
8051 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8052   const PreviewType preview)
8053 {
8054   Image
8055     *preview_image;
8056
8057   assert(wand != (MagickWand *) NULL);
8058   assert(wand->signature == WandSignature);
8059   if (wand->debug != MagickFalse)
8060     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8061   if (wand->images == (Image *) NULL)
8062     return((MagickWand *) NULL);
8063   preview_image=PreviewImage(wand->images,preview,wand->exception);
8064   if (preview_image == (Image *) NULL)
8065     return((MagickWand *) NULL);
8066   return(CloneMagickWandFromImages(wand,preview_image));
8067 }
8068 \f
8069 /*
8070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8071 %                                                                             %
8072 %                                                                             %
8073 %                                                                             %
8074 %   M a g i c k P r e v i o u s I m a g e                                     %
8075 %                                                                             %
8076 %                                                                             %
8077 %                                                                             %
8078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8079 %
8080 %  MagickPreviousImage() assocates the previous image in an image list with
8081 %  the magick wand.
8082 %
8083 %  The format of the MagickPreviousImage method is:
8084 %
8085 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
8086 %
8087 %  A description of each parameter follows:
8088 %
8089 %    o wand: the magick wand.
8090 %
8091 */
8092 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8093 {
8094   assert(wand != (MagickWand *) NULL);
8095   assert(wand->signature == WandSignature);
8096   if (wand->debug != MagickFalse)
8097     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8098   if (wand->images == (Image *) NULL)
8099     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8100   if (wand->pend != MagickFalse)
8101     {
8102       wand->pend=MagickFalse;
8103       return(MagickTrue);
8104     }
8105   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8106     {
8107       wand->pend=MagickTrue;
8108       return(MagickFalse);
8109     }
8110   wand->images=GetPreviousImageInList(wand->images);
8111   return(MagickTrue);
8112 }
8113 \f
8114 /*
8115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8116 %                                                                             %
8117 %                                                                             %
8118 %                                                                             %
8119 %   M a g i c k Q u a n t i z e I m a g e                                     %
8120 %                                                                             %
8121 %                                                                             %
8122 %                                                                             %
8123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8124 %
8125 %  MagickQuantizeImage() analyzes the colors within a reference image and
8126 %  chooses a fixed number of colors to represent the image.  The goal of the
8127 %  algorithm is to minimize the color difference between the input and output
8128 %  image while minimizing the processing time.
8129 %
8130 %  The format of the MagickQuantizeImage method is:
8131 %
8132 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8133 %        const size_t number_colors,const ColorspaceType colorspace,
8134 %        const size_t treedepth,const MagickBooleanType dither,
8135 %        const MagickBooleanType measure_error)
8136 %
8137 %  A description of each parameter follows:
8138 %
8139 %    o wand: the magick wand.
8140 %
8141 %    o number_colors: the number of colors.
8142 %
8143 %    o colorspace: Perform color reduction in this colorspace, typically
8144 %      RGBColorspace.
8145 %
8146 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8147 %      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
8148 %      reference image with the least amount of memory and the fastest
8149 %      computational speed.  In some cases, such as an image with low color
8150 %      dispersion (a few number of colors), a value other than
8151 %      Log4(number_colors) is required.  To expand the color tree completely,
8152 %      use a value of 8.
8153 %
8154 %    o dither: A value other than zero distributes the difference between an
8155 %      original image and the corresponding color reduced image to
8156 %      neighboring pixels along a Hilbert curve.
8157 %
8158 %    o measure_error: A value other than zero measures the difference between
8159 %      the original and quantized images.  This difference is the total
8160 %      quantization error.  The error is computed by summing over all pixels
8161 %      in an image the distance squared in RGB space between each reference
8162 %      pixel value and its quantized value.
8163 %
8164 */
8165 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8166   const size_t number_colors,const ColorspaceType colorspace,
8167   const size_t treedepth,const MagickBooleanType dither,
8168   const MagickBooleanType measure_error)
8169 {
8170   MagickBooleanType
8171     status;
8172
8173   QuantizeInfo
8174     *quantize_info;
8175
8176   assert(wand != (MagickWand *) NULL);
8177   assert(wand->signature == WandSignature);
8178   if (wand->debug != MagickFalse)
8179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8180   if (wand->images == (Image *) NULL)
8181     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8182   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8183   quantize_info->number_colors=number_colors;
8184   quantize_info->dither=dither;
8185   quantize_info->tree_depth=treedepth;
8186   quantize_info->colorspace=colorspace;
8187   quantize_info->measure_error=measure_error;
8188   status=QuantizeImage(quantize_info,wand->images);
8189   if (status == MagickFalse)
8190     InheritException(wand->exception,&wand->images->exception);
8191   quantize_info=DestroyQuantizeInfo(quantize_info);
8192   return(status);
8193 }
8194 \f
8195 /*
8196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8197 %                                                                             %
8198 %                                                                             %
8199 %                                                                             %
8200 %   M a g i c k Q u a n t i z e I m a g e s                                   %
8201 %                                                                             %
8202 %                                                                             %
8203 %                                                                             %
8204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8205 %
8206 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
8207 %  chooses a fixed number of colors to represent the image.  The goal of the
8208 %  algorithm is to minimize the color difference between the input and output
8209 %  image while minimizing the processing time.
8210 %
8211 %  The format of the MagickQuantizeImages method is:
8212 %
8213 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8214 %        const size_t number_colors,const ColorspaceType colorspace,
8215 %        const size_t treedepth,const MagickBooleanType dither,
8216 %        const MagickBooleanType measure_error)
8217 %
8218 %  A description of each parameter follows:
8219 %
8220 %    o wand: the magick wand.
8221 %
8222 %    o number_colors: the number of colors.
8223 %
8224 %    o colorspace: Perform color reduction in this colorspace, typically
8225 %      RGBColorspace.
8226 %
8227 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8228 %      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
8229 %      reference image with the least amount of memory and the fastest
8230 %      computational speed.  In some cases, such as an image with low color
8231 %      dispersion (a few number of colors), a value other than
8232 %      Log4(number_colors) is required.  To expand the color tree completely,
8233 %      use a value of 8.
8234 %
8235 %    o dither: A value other than zero distributes the difference between an
8236 %      original image and the corresponding color reduced algorithm to
8237 %      neighboring pixels along a Hilbert curve.
8238 %
8239 %    o measure_error: A value other than zero measures the difference between
8240 %      the original and quantized images.  This difference is the total
8241 %      quantization error.  The error is computed by summing over all pixels
8242 %      in an image the distance squared in RGB space between each reference
8243 %      pixel value and its quantized value.
8244 %
8245 */
8246 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8247   const size_t number_colors,const ColorspaceType colorspace,
8248   const size_t treedepth,const MagickBooleanType dither,
8249   const MagickBooleanType measure_error)
8250 {
8251   MagickBooleanType
8252     status;
8253
8254   QuantizeInfo
8255     *quantize_info;
8256
8257   assert(wand != (MagickWand *) NULL);
8258   assert(wand->signature == WandSignature);
8259   if (wand->debug != MagickFalse)
8260     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8261   if (wand->images == (Image *) NULL)
8262     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8263   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8264   quantize_info->number_colors=number_colors;
8265   quantize_info->dither=dither;
8266   quantize_info->tree_depth=treedepth;
8267   quantize_info->colorspace=colorspace;
8268   quantize_info->measure_error=measure_error;
8269   status=QuantizeImages(quantize_info,wand->images);
8270   if (status == MagickFalse)
8271     InheritException(wand->exception,&wand->images->exception);
8272   quantize_info=DestroyQuantizeInfo(quantize_info);
8273   return(status);
8274 }
8275 \f
8276 /*
8277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8278 %                                                                             %
8279 %                                                                             %
8280 %                                                                             %
8281 %   M a g i c k R a d i a l B l u r I m a g e                                 %
8282 %                                                                             %
8283 %                                                                             %
8284 %                                                                             %
8285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8286 %
8287 %  MagickRadialBlurImage() radial blurs an image.
8288 %
8289 %  The format of the MagickRadialBlurImage method is:
8290 %
8291 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8292 %        const double angle)
8293 %      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8294 %        const ChannelType channel,const double angle)
8295 %
8296 %  A description of each parameter follows:
8297 %
8298 %    o wand: the magick wand.
8299 %
8300 %    o channel: the image channel(s).
8301 %
8302 %    o angle: the angle of the blur in degrees.
8303 %
8304 */
8305 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8306   const double angle)
8307 {
8308   MagickBooleanType
8309     status;
8310
8311   status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8312   return(status);
8313 }
8314
8315 WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8316   const ChannelType channel,const double angle)
8317 {
8318   Image
8319     *blur_image;
8320
8321   assert(wand != (MagickWand *) NULL);
8322   assert(wand->signature == WandSignature);
8323   if (wand->debug != MagickFalse)
8324     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8325   if (wand->images == (Image *) NULL)
8326     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8327   blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8328     wand->exception);
8329   if (blur_image == (Image *) NULL)
8330     return(MagickFalse);
8331   ReplaceImageInList(&wand->images,blur_image);
8332   return(MagickTrue);
8333 }
8334 \f
8335 /*
8336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8337 %                                                                             %
8338 %                                                                             %
8339 %                                                                             %
8340 %   M a g i c k R a i s e I m a g e                                           %
8341 %                                                                             %
8342 %                                                                             %
8343 %                                                                             %
8344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8345 %
8346 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8347 %  by lightening and darkening the edges of the image.  Members width and
8348 %  height of raise_info define the width of the vertical and horizontal
8349 %  edge of the effect.
8350 %
8351 %  The format of the MagickRaiseImage method is:
8352 %
8353 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8354 %        const size_t width,const size_t height,const ssize_t x,
8355 %        const ssize_t y,const MagickBooleanType raise)
8356 %
8357 %  A description of each parameter follows:
8358 %
8359 %    o wand: the magick wand.
8360 %
8361 %    o width,height,x,y:  Define the dimensions of the area to raise.
8362 %
8363 %    o raise: A value other than zero creates a 3-D raise effect,
8364 %      otherwise it has a lowered effect.
8365 %
8366 */
8367 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8368   const size_t width,const size_t height,const ssize_t x,
8369   const ssize_t y,const MagickBooleanType raise)
8370 {
8371   MagickBooleanType
8372     status;
8373
8374   RectangleInfo
8375     raise_info;
8376
8377   assert(wand != (MagickWand *) NULL);
8378   assert(wand->signature == WandSignature);
8379   if (wand->debug != MagickFalse)
8380     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8381   if (wand->images == (Image *) NULL)
8382     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8383   raise_info.width=width;
8384   raise_info.height=height;
8385   raise_info.x=x;
8386   raise_info.y=y;
8387   status=RaiseImage(wand->images,&raise_info,raise);
8388   if (status == MagickFalse)
8389     InheritException(wand->exception,&wand->images->exception);
8390   return(status);
8391 }
8392 \f
8393 /*
8394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8395 %                                                                             %
8396 %                                                                             %
8397 %                                                                             %
8398 %   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                       %
8399 %                                                                             %
8400 %                                                                             %
8401 %                                                                             %
8402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8403 %
8404 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8405 %  the intensity of each pixel compared to threshold.  The result is a
8406 %  high-contrast, two color image.
8407 %
8408 %  The format of the MagickRandomThresholdImage method is:
8409 %
8410 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8411 %        const double low,const double high)
8412 %      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8413 %        const ChannelType channel,const double low,const double high)
8414 %
8415 %  A description of each parameter follows:
8416 %
8417 %    o wand: the magick wand.
8418 %
8419 %    o channel: the image channel(s).
8420 %
8421 %    o low,high: Specify the high and low thresholds.  These values range from
8422 %      0 to QuantumRange.
8423 %
8424 */
8425
8426 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8427   const double low,const double high)
8428 {
8429   MagickBooleanType
8430     status;
8431
8432   status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8433   return(status);
8434 }
8435
8436 WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8437   MagickWand *wand,const ChannelType channel,const double low,
8438   const double high)
8439 {
8440   char
8441     threshold[MaxTextExtent];
8442
8443   MagickBooleanType
8444     status;
8445
8446   assert(wand != (MagickWand *) NULL);
8447   assert(wand->signature == WandSignature);
8448   if (wand->debug != MagickFalse)
8449     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8450   if (wand->images == (Image *) NULL)
8451     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8452   (void) FormatMagickString(threshold,MaxTextExtent,"%gx%g",low,high);
8453   status=RandomThresholdImageChannel(wand->images,channel,threshold,
8454     wand->exception);
8455   if (status == MagickFalse)
8456     InheritException(wand->exception,&wand->images->exception);
8457   return(status);
8458 }
8459 \f
8460 /*
8461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8462 %                                                                             %
8463 %                                                                             %
8464 %                                                                             %
8465 %   M a g i c k R e a d I m a g e                                             %
8466 %                                                                             %
8467 %                                                                             %
8468 %                                                                             %
8469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8470 %
8471 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8472 %  at the current image pointer position.   Use MagickSetFirstIterator(),
8473 %  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8474 %  image pointer position at the beginning of the image list, the end, or
8475 %  anywhere in-between respectively.
8476 %
8477 %  The format of the MagickReadImage method is:
8478 %
8479 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8480 %
8481 %  A description of each parameter follows:
8482 %
8483 %    o wand: the magick wand.
8484 %
8485 %    o filename: the image filename.
8486 %
8487 */
8488 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8489   const char *filename)
8490 {
8491   Image
8492     *images;
8493
8494   ImageInfo
8495     *read_info;
8496
8497   assert(wand != (MagickWand *) NULL);
8498   assert(wand->signature == WandSignature);
8499   if (wand->debug != MagickFalse)
8500     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8501   read_info=CloneImageInfo(wand->image_info);
8502   if (filename != (const char *) NULL)
8503     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8504   images=ReadImage(read_info,wand->exception);
8505   read_info=DestroyImageInfo(read_info);
8506   if (images == (Image *) NULL)
8507     return(MagickFalse);
8508   return(InsertImageInWand(wand,images));
8509 }
8510 \f
8511 /*
8512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8513 %                                                                             %
8514 %                                                                             %
8515 %                                                                             %
8516 %   M a g i c k R e a d I m a g e B l o b                                     %
8517 %                                                                             %
8518 %                                                                             %
8519 %                                                                             %
8520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8521 %
8522 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8523 %
8524 %  The format of the MagickReadImageBlob method is:
8525 %
8526 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8527 %        const void *blob,const size_t length)
8528 %
8529 %  A description of each parameter follows:
8530 %
8531 %    o wand: the magick wand.
8532 %
8533 %    o blob: the blob.
8534 %
8535 %    o length: the blob length.
8536 %
8537 */
8538 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8539   const void *blob,const size_t length)
8540 {
8541   Image
8542     *images;
8543
8544   assert(wand != (MagickWand *) NULL);
8545   assert(wand->signature == WandSignature);
8546   if (wand->debug != MagickFalse)
8547     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8548   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8549   if (images == (Image *) NULL)
8550     return(MagickFalse);
8551   return(InsertImageInWand(wand,images));
8552 }
8553 \f
8554 /*
8555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8556 %                                                                             %
8557 %                                                                             %
8558 %                                                                             %
8559 %   M a g i c k R e a d I m a g e F i l e                                     %
8560 %                                                                             %
8561 %                                                                             %
8562 %                                                                             %
8563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8564 %
8565 %  MagickReadImageFile() reads an image or image sequence from an open file
8566 %  descriptor.
8567 %
8568 %  The format of the MagickReadImageFile method is:
8569 %
8570 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8571 %
8572 %  A description of each parameter follows:
8573 %
8574 %    o wand: the magick wand.
8575 %
8576 %    o file: the file descriptor.
8577 %
8578 */
8579 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8580 {
8581   Image
8582     *images;
8583
8584   ImageInfo
8585     *read_info;
8586
8587   assert(wand != (MagickWand *) NULL);
8588   assert(wand->signature == WandSignature);
8589   assert(file != (FILE *) NULL);
8590   if (wand->debug != MagickFalse)
8591     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8592   read_info=CloneImageInfo(wand->image_info);
8593   SetImageInfoFile(read_info,file);
8594   images=ReadImage(read_info,wand->exception);
8595   read_info=DestroyImageInfo(read_info);
8596   if (images == (Image *) NULL)
8597     return(MagickFalse);
8598   return(InsertImageInWand(wand,images));
8599 }
8600 \f
8601 /*
8602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8603 %                                                                             %
8604 %                                                                             %
8605 %                                                                             %
8606 %     M a g i c k R e d u c e N o i s e I m a g e                             %
8607 %                                                                             %
8608 %                                                                             %
8609 %                                                                             %
8610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8611 %
8612 %  MagickReduceNoiseImage() smooths the contours of an image while still
8613 %  preserving edge information.  The algorithm works by replacing each pixel
8614 %  with its neighbor closest in value.  A neighbor is defined by radius.  Use
8615 %  a radius of 0 and ReduceNoise() selects a suitable radius for you.
8616 %
8617 %  The format of the MagickReduceNoiseImage method is:
8618 %
8619 %      MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8620 %        const double radius)
8621 %
8622 %  A description of each parameter follows:
8623 %
8624 %    o wand: the magick wand.
8625 %
8626 %    o radius: the radius of the pixel neighborhood.
8627 %
8628 */
8629 WandExport MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8630   const double radius)
8631 {
8632   Image
8633     *noise_image;
8634
8635   assert(wand != (MagickWand *) NULL);
8636   assert(wand->signature == WandSignature);
8637   if (wand->debug != MagickFalse)
8638     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8639   if (wand->images == (Image *) NULL)
8640     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8641   noise_image=ReduceNoiseImage(wand->images,radius,wand->exception);
8642   if (noise_image == (Image *) NULL)
8643     return(MagickFalse);
8644   ReplaceImageInList(&wand->images,noise_image);
8645   return(MagickTrue);
8646 }
8647 \f
8648 /*
8649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8650 %                                                                             %
8651 %                                                                             %
8652 %                                                                             %
8653 %   M a g i c k R e m a p I m a g e                                           %
8654 %                                                                             %
8655 %                                                                             %
8656 %                                                                             %
8657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8658 %
8659 %  MagickRemapImage() replaces the colors of an image with the closest color
8660 %  from a reference image.
8661 %
8662 %  The format of the MagickRemapImage method is:
8663 %
8664 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8665 %        const MagickWand *remap_wand,const DitherMethod method)
8666 %
8667 %  A description of each parameter follows:
8668 %
8669 %    o wand: the magick wand.
8670 %
8671 %    o affinity: the affinity wand.
8672 %
8673 %    o method: choose from these dither methods: NoDitherMethod,
8674 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8675 %
8676 */
8677 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8678   const MagickWand *remap_wand,const DitherMethod method)
8679 {
8680   MagickBooleanType
8681     status;
8682
8683   QuantizeInfo
8684     *quantize_info;
8685
8686   assert(wand != (MagickWand *) NULL);
8687   assert(wand->signature == WandSignature);
8688   if (wand->debug != MagickFalse)
8689     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8690   if ((wand->images == (Image *) NULL) ||
8691       (remap_wand->images == (Image *) NULL))
8692     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8693   quantize_info=AcquireQuantizeInfo(wand->image_info);
8694   quantize_info->dither_method=method;
8695   if (method == NoDitherMethod)
8696     quantize_info->dither=MagickFalse;
8697   status=RemapImage(quantize_info,wand->images,remap_wand->images);
8698   quantize_info=DestroyQuantizeInfo(quantize_info);
8699   if (status == MagickFalse)
8700     InheritException(wand->exception,&wand->images->exception);
8701   return(status);
8702 }
8703 \f
8704 /*
8705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8706 %                                                                             %
8707 %                                                                             %
8708 %                                                                             %
8709 %   M a g i c k R e m o v e I m a g e                                         %
8710 %                                                                             %
8711 %                                                                             %
8712 %                                                                             %
8713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8714 %
8715 %  MagickRemoveImage() removes an image from the image list.
8716 %
8717 %  The format of the MagickRemoveImage method is:
8718 %
8719 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8720 %
8721 %  A description of each parameter follows:
8722 %
8723 %    o wand: the magick wand.
8724 %
8725 %    o insert: the splice wand.
8726 %
8727 */
8728 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8729 {
8730   assert(wand != (MagickWand *) NULL);
8731   assert(wand->signature == WandSignature);
8732   if (wand->debug != MagickFalse)
8733     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8734   if (wand->images == (Image *) NULL)
8735     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8736   DeleteImageFromList(&wand->images);
8737   return(MagickTrue);
8738 }
8739 \f
8740 /*
8741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8742 %                                                                             %
8743 %                                                                             %
8744 %                                                                             %
8745 %   M a g i c k R e s a m p l e I m a g e                                     %
8746 %                                                                             %
8747 %                                                                             %
8748 %                                                                             %
8749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8750 %
8751 %  MagickResampleImage() resample image to desired resolution.
8752 %
8753 %    Bessel   Blackman   Box
8754 %    Catrom   Cubic      Gaussian
8755 %    Hanning  Hermite    Lanczos
8756 %    Mitchell Point      Quandratic
8757 %    Sinc     Triangle
8758 %
8759 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8760 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8761 %  are windowed (brought down to zero) with the Blackman filter.
8762 %
8763 %  The format of the MagickResampleImage method is:
8764 %
8765 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8766 %        const double x_resolution,const double y_resolution,
8767 %        const FilterTypes filter,const double blur)
8768 %
8769 %  A description of each parameter follows:
8770 %
8771 %    o wand: the magick wand.
8772 %
8773 %    o x_resolution: the new image x resolution.
8774 %
8775 %    o y_resolution: the new image y resolution.
8776 %
8777 %    o filter: Image filter to use.
8778 %
8779 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8780 %
8781 */
8782 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8783   const double x_resolution,const double y_resolution,const FilterTypes filter,
8784   const double blur)
8785 {
8786   Image
8787     *resample_image;
8788
8789   assert(wand != (MagickWand *) NULL);
8790   assert(wand->signature == WandSignature);
8791   if (wand->debug != MagickFalse)
8792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8793   if (wand->images == (Image *) NULL)
8794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8795   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8796     blur,wand->exception);
8797   if (resample_image == (Image *) NULL)
8798     return(MagickFalse);
8799   ReplaceImageInList(&wand->images,resample_image);
8800   return(MagickTrue);
8801 }
8802 \f
8803 /*
8804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8805 %                                                                             %
8806 %                                                                             %
8807 %                                                                             %
8808 %   M a g i c k R e s e t I m a g e P a g e                                   %
8809 %                                                                             %
8810 %                                                                             %
8811 %                                                                             %
8812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8813 %
8814 %  MagickResetImagePage() resets the Wand page canvas and position.
8815 %
8816 %  The format of the MagickResetImagePage method is:
8817 %
8818 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8819 %        const char *page)
8820 %
8821 %  A description of each parameter follows:
8822 %
8823 %    o wand: the magick wand.
8824 %
8825 %    o page: the relative page specification.
8826 %
8827 */
8828 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8829   const char *page)
8830 {
8831   assert(wand != (MagickWand *) NULL);
8832   assert(wand->signature == WandSignature);
8833   if (wand->debug != MagickFalse)
8834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8835   if (wand->images == (Image *) NULL)
8836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8837   if ((page == (char *) NULL) || (*page == '\0'))
8838     {
8839       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8840       return(MagickTrue);
8841     }
8842   return(ResetImagePage(wand->images,page));
8843 }
8844 \f
8845 /*
8846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8847 %                                                                             %
8848 %                                                                             %
8849 %                                                                             %
8850 %   M a g i c k R e s i z e I m a g e                                         %
8851 %                                                                             %
8852 %                                                                             %
8853 %                                                                             %
8854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8855 %
8856 %  MagickResizeImage() scales an image to the desired dimensions with one of
8857 %  these filters:
8858 %
8859 %    Bessel   Blackman   Box
8860 %    Catrom   Cubic      Gaussian
8861 %    Hanning  Hermite    Lanczos
8862 %    Mitchell Point      Quandratic
8863 %    Sinc     Triangle
8864 %
8865 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8866 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8867 %  are windowed (brought down to zero) with the Blackman filter.
8868 %
8869 %  The format of the MagickResizeImage method is:
8870 %
8871 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8872 %        const size_t columns,const size_t rows,
8873 %        const FilterTypes filter,const double blur)
8874 %
8875 %  A description of each parameter follows:
8876 %
8877 %    o wand: the magick wand.
8878 %
8879 %    o columns: the number of columns in the scaled image.
8880 %
8881 %    o rows: the number of rows in the scaled image.
8882 %
8883 %    o filter: Image filter to use.
8884 %
8885 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8886 %
8887 */
8888 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8889   const size_t columns,const size_t rows,const FilterTypes filter,
8890   const double blur)
8891 {
8892   Image
8893     *resize_image;
8894
8895   assert(wand != (MagickWand *) NULL);
8896   assert(wand->signature == WandSignature);
8897   if (wand->debug != MagickFalse)
8898     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8899   if (wand->images == (Image *) NULL)
8900     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8901   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8902     wand->exception);
8903   if (resize_image == (Image *) NULL)
8904     return(MagickFalse);
8905   ReplaceImageInList(&wand->images,resize_image);
8906   return(MagickTrue);
8907 }
8908 \f
8909 /*
8910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8911 %                                                                             %
8912 %                                                                             %
8913 %                                                                             %
8914 %   M a g i c k R o l l I m a g e                                             %
8915 %                                                                             %
8916 %                                                                             %
8917 %                                                                             %
8918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8919 %
8920 %  MagickRollImage() offsets an image as defined by x and y.
8921 %
8922 %  The format of the MagickRollImage method is:
8923 %
8924 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8925 %        const size_t y)
8926 %
8927 %  A description of each parameter follows:
8928 %
8929 %    o wand: the magick wand.
8930 %
8931 %    o x: the x offset.
8932 %
8933 %    o y: the y offset.
8934 %
8935 %
8936 */
8937 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8938   const ssize_t x,const ssize_t y)
8939 {
8940   Image
8941     *roll_image;
8942
8943   assert(wand != (MagickWand *) NULL);
8944   assert(wand->signature == WandSignature);
8945   if (wand->debug != MagickFalse)
8946     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8947   if (wand->images == (Image *) NULL)
8948     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8949   roll_image=RollImage(wand->images,x,y,wand->exception);
8950   if (roll_image == (Image *) NULL)
8951     return(MagickFalse);
8952   ReplaceImageInList(&wand->images,roll_image);
8953   return(MagickTrue);
8954 }
8955 \f
8956 /*
8957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8958 %                                                                             %
8959 %                                                                             %
8960 %                                                                             %
8961 %   M a g i c k R o t a t e I m a g e                                         %
8962 %                                                                             %
8963 %                                                                             %
8964 %                                                                             %
8965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8966 %
8967 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8968 %  triangles left over from rotating the image are filled with the
8969 %  background color.
8970 %
8971 %  The format of the MagickRotateImage method is:
8972 %
8973 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8974 %        const PixelWand *background,const double degrees)
8975 %
8976 %  A description of each parameter follows:
8977 %
8978 %    o wand: the magick wand.
8979 %
8980 %    o background: the background pixel wand.
8981 %
8982 %    o degrees: the number of degrees to rotate the image.
8983 %
8984 %
8985 */
8986 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8987   const PixelWand *background,const double degrees)
8988 {
8989   Image
8990     *rotate_image;
8991
8992   assert(wand != (MagickWand *) NULL);
8993   assert(wand->signature == WandSignature);
8994   if (wand->debug != MagickFalse)
8995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8996   if (wand->images == (Image *) NULL)
8997     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8998   PixelGetQuantumColor(background,&wand->images->background_color);
8999   rotate_image=RotateImage(wand->images,degrees,wand->exception);
9000   if (rotate_image == (Image *) NULL)
9001     return(MagickFalse);
9002   ReplaceImageInList(&wand->images,rotate_image);
9003   return(MagickTrue);
9004 }
9005 \f
9006 /*
9007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9008 %                                                                             %
9009 %                                                                             %
9010 %                                                                             %
9011 %   M a g i c k S a m p l e I m a g e                                         %
9012 %                                                                             %
9013 %                                                                             %
9014 %                                                                             %
9015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9016 %
9017 %  MagickSampleImage() scales an image to the desired dimensions with pixel
9018 %  sampling.  Unlike other scaling methods, this method does not introduce
9019 %  any additional color into the scaled image.
9020 %
9021 %  The format of the MagickSampleImage method is:
9022 %
9023 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
9024 %        const size_t columns,const size_t rows)
9025 %
9026 %  A description of each parameter follows:
9027 %
9028 %    o wand: the magick wand.
9029 %
9030 %    o columns: the number of columns in the scaled image.
9031 %
9032 %    o rows: the number of rows in the scaled image.
9033 %
9034 %
9035 */
9036 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9037   const size_t columns,const size_t rows)
9038 {
9039   Image
9040     *sample_image;
9041
9042   assert(wand != (MagickWand *) NULL);
9043   assert(wand->signature == WandSignature);
9044   if (wand->debug != MagickFalse)
9045     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9046   if (wand->images == (Image *) NULL)
9047     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9048   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9049   if (sample_image == (Image *) NULL)
9050     return(MagickFalse);
9051   ReplaceImageInList(&wand->images,sample_image);
9052   return(MagickTrue);
9053 }
9054 \f
9055 /*
9056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9057 %                                                                             %
9058 %                                                                             %
9059 %                                                                             %
9060 %   M a g i c k S c a l e I m a g e                                           %
9061 %                                                                             %
9062 %                                                                             %
9063 %                                                                             %
9064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9065 %
9066 %  MagickScaleImage() scales the size of an image to the given dimensions.
9067 %
9068 %  The format of the MagickScaleImage method is:
9069 %
9070 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
9071 %        const size_t columns,const size_t rows)
9072 %
9073 %  A description of each parameter follows:
9074 %
9075 %    o wand: the magick wand.
9076 %
9077 %    o columns: the number of columns in the scaled image.
9078 %
9079 %    o rows: the number of rows in the scaled image.
9080 %
9081 %
9082 */
9083 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9084   const size_t columns,const size_t rows)
9085 {
9086   Image
9087     *scale_image;
9088
9089   assert(wand != (MagickWand *) NULL);
9090   assert(wand->signature == WandSignature);
9091   if (wand->debug != MagickFalse)
9092     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9093   if (wand->images == (Image *) NULL)
9094     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9095   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9096   if (scale_image == (Image *) NULL)
9097     return(MagickFalse);
9098   ReplaceImageInList(&wand->images,scale_image);
9099   return(MagickTrue);
9100 }
9101 \f
9102 /*
9103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9104 %                                                                             %
9105 %                                                                             %
9106 %                                                                             %
9107 %   M a g i c k S e g m e n t I m a g e                                       %
9108 %                                                                             %
9109 %                                                                             %
9110 %                                                                             %
9111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9112 %
9113 %  MagickSegmentImage() segments an image by analyzing the histograms of the
9114 %  color components and identifying units that are homogeneous with the fuzzy
9115 %  C-means technique.
9116 %
9117 %  The format of the SegmentImage method is:
9118 %
9119 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
9120 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
9121 %        const double cluster_threshold,const double smooth_threshold)
9122 %
9123 %  A description of each parameter follows.
9124 %
9125 %    o wand: the wand.
9126 %
9127 %    o colorspace: the image colorspace.
9128 %
9129 %    o verbose:  Set to MagickTrue to print detailed information about the
9130 %      identified classes.
9131 %
9132 %    o cluster_threshold:  This represents the minimum number of pixels
9133 %      contained in a hexahedra before it can be considered valid (expressed as
9134 %      a percentage).
9135 %
9136 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
9137 %      derivative of the histogram.  As the value is increased, you can expect a
9138 %      smoother second derivative.
9139 %
9140 */
9141 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9142   const ColorspaceType colorspace,const MagickBooleanType verbose,
9143   const double cluster_threshold,const double smooth_threshold)
9144 {
9145   MagickBooleanType
9146     status;
9147
9148   assert(wand != (MagickWand *) NULL);
9149   assert(wand->signature == WandSignature);
9150   if (wand->debug != MagickFalse)
9151     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9152   if (wand->images == (Image *) NULL)
9153     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9154   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9155     smooth_threshold);
9156   if (status == MagickFalse)
9157     InheritException(wand->exception,&wand->images->exception);
9158   return(status);
9159 }
9160 \f
9161 /*
9162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9163 %                                                                             %
9164 %                                                                             %
9165 %                                                                             %
9166 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
9167 %                                                                             %
9168 %                                                                             %
9169 %                                                                             %
9170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9171 %
9172 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
9173 %  threshold. It is similar to the unsharpen mask that sharpens everything with
9174 %  contrast above a certain threshold.
9175 %
9176 %  The format of the MagickSelectiveBlurImage method is:
9177 %
9178 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9179 %        const double radius,const double sigma,const double threshold)
9180 %      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9181 %        const ChannelType channel,const double radius,const double sigma,
9182 %        const double threshold)
9183 %
9184 %  A description of each parameter follows:
9185 %
9186 %    o wand: the magick wand.
9187 %
9188 %    o channel: the image channel(s).
9189 %
9190 %    o radius: the radius of the gaussian, in pixels, not counting the center
9191 %      pixel.
9192 %
9193 %    o sigma: the standard deviation of the gaussian, in pixels.
9194 %
9195 %    o threshold: only pixels within this contrast threshold are included
9196 %      in the blur operation.
9197 %
9198 */
9199
9200 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9201   const double radius,const double sigma,const double threshold)
9202 {
9203   MagickBooleanType
9204     status;
9205
9206   status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9207     threshold);
9208   return(status);
9209 }
9210
9211 WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9212   const ChannelType channel,const double radius,const double sigma,
9213   const double threshold)
9214 {
9215   Image
9216     *blur_image;
9217
9218   assert(wand != (MagickWand *) NULL);
9219   assert(wand->signature == WandSignature);
9220   if (wand->debug != MagickFalse)
9221     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9222   if (wand->images == (Image *) NULL)
9223     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9224   blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9225     threshold,wand->exception);
9226   if (blur_image == (Image *) NULL)
9227     return(MagickFalse);
9228   ReplaceImageInList(&wand->images,blur_image);
9229   return(MagickTrue);
9230 }
9231 \f
9232 /*
9233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9234 %                                                                             %
9235 %                                                                             %
9236 %                                                                             %
9237 %   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                       %
9238 %                                                                             %
9239 %                                                                             %
9240 %                                                                             %
9241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9242 %
9243 %  MagickSeparateImageChannel() separates a channel from the image and returns a
9244 %  grayscale image.  A channel is a particular color component of each pixel
9245 %  in the image.
9246 %
9247 %  The format of the MagickSeparateImageChannel method is:
9248 %
9249 %      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9250 %        const ChannelType channel)
9251 %
9252 %  A description of each parameter follows:
9253 %
9254 %    o wand: the magick wand.
9255 %
9256 %    o channel: the image channel(s).
9257 %
9258 */
9259 WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9260   const ChannelType channel)
9261 {
9262   MagickBooleanType
9263     status;
9264
9265   assert(wand != (MagickWand *) NULL);
9266   assert(wand->signature == WandSignature);
9267   if (wand->debug != MagickFalse)
9268     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9269   if (wand->images == (Image *) NULL)
9270     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9271   status=SeparateImageChannel(wand->images,channel);
9272   if (status == MagickFalse)
9273     InheritException(wand->exception,&wand->images->exception);
9274   return(status);
9275 }
9276 \f
9277 /*
9278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9279 %                                                                             %
9280 %                                                                             %
9281 %                                                                             %
9282 %     M a g i c k S e p i a T o n e I m a g e                                 %
9283 %                                                                             %
9284 %                                                                             %
9285 %                                                                             %
9286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9287 %
9288 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
9289 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9290 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9291 %  threshold of 80% is a good starting point for a reasonable tone.
9292 %
9293 %  The format of the MagickSepiaToneImage method is:
9294 %
9295 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9296 %        const double threshold)
9297 %
9298 %  A description of each parameter follows:
9299 %
9300 %    o wand: the magick wand.
9301 %
9302 %    o threshold:  Define the extent of the sepia toning.
9303 %
9304 */
9305 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9306   const double threshold)
9307 {
9308   Image
9309     *sepia_image;
9310
9311   assert(wand != (MagickWand *) NULL);
9312   assert(wand->signature == WandSignature);
9313   if (wand->debug != MagickFalse)
9314     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9315   if (wand->images == (Image *) NULL)
9316     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9317   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9318   if (sepia_image == (Image *) NULL)
9319     return(MagickFalse);
9320   ReplaceImageInList(&wand->images,sepia_image);
9321   return(MagickTrue);
9322 }
9323 \f
9324 /*
9325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9326 %                                                                             %
9327 %                                                                             %
9328 %                                                                             %
9329 %   M a g i c k S e t I m a g e                                               %
9330 %                                                                             %
9331 %                                                                             %
9332 %                                                                             %
9333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9334 %
9335 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9336 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
9337 %  wand.
9338 %
9339 %  The format of the MagickSetImage method is:
9340 %
9341 %      MagickBooleanType MagickSetImage(MagickWand *wand,
9342 %        const MagickWand *set_wand)
9343 %
9344 %  A description of each parameter follows:
9345 %
9346 %    o wand: the magick wand.
9347 %
9348 %    o set_wand: the set_wand wand.
9349 %
9350 */
9351 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9352   const MagickWand *set_wand)
9353 {
9354   Image
9355     *images;
9356
9357   assert(wand != (MagickWand *) NULL);
9358   assert(wand->signature == WandSignature);
9359   if (wand->debug != MagickFalse)
9360     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9361   assert(set_wand != (MagickWand *) NULL);
9362   assert(set_wand->signature == WandSignature);
9363   if (wand->debug != MagickFalse)
9364     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9365   if (set_wand->images == (Image *) NULL)
9366     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9367   images=CloneImageList(set_wand->images,wand->exception);
9368   if (images == (Image *) NULL)
9369     return(MagickFalse);
9370   ReplaceImageInList(&wand->images,images);
9371   return(MagickTrue);
9372 }
9373 \f
9374 /*
9375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9376 %                                                                             %
9377 %                                                                             %
9378 %                                                                             %
9379 %   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                       %
9380 %                                                                             %
9381 %                                                                             %
9382 %                                                                             %
9383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9384 %
9385 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9386 %  alpha channel.
9387 %
9388 %  The format of the MagickSetImageAlphaChannel method is:
9389 %
9390 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9391 %        const AlphaChannelType alpha_type)
9392 %
9393 %  A description of each parameter follows:
9394 %
9395 %    o wand: the magick wand.
9396 %
9397 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9398 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9399 %
9400 */
9401 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9402   const AlphaChannelType alpha_type)
9403 {
9404   assert(wand != (MagickWand *) NULL);
9405   assert(wand->signature == WandSignature);
9406   if (wand->debug != MagickFalse)
9407     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9408   if (wand->images == (Image *) NULL)
9409     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9410   return(SetImageAlphaChannel(wand->images,alpha_type));
9411 }
9412 \f
9413 /*
9414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9415 %                                                                             %
9416 %                                                                             %
9417 %                                                                             %
9418 %   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                 %
9419 %                                                                             %
9420 %                                                                             %
9421 %                                                                             %
9422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9423 %
9424 %  MagickSetImageBackgroundColor() sets the image background color.
9425 %
9426 %  The format of the MagickSetImageBackgroundColor method is:
9427 %
9428 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9429 %        const PixelWand *background)
9430 %
9431 %  A description of each parameter follows:
9432 %
9433 %    o wand: the magick wand.
9434 %
9435 %    o background: the background pixel wand.
9436 %
9437 */
9438 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9439   const PixelWand *background)
9440 {
9441   assert(wand != (MagickWand *) NULL);
9442   assert(wand->signature == WandSignature);
9443   if (wand->debug != MagickFalse)
9444     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9445   if (wand->images == (Image *) NULL)
9446     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9447   PixelGetQuantumColor(background,&wand->images->background_color);
9448   return(MagickTrue);
9449 }
9450 \f
9451 /*
9452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9453 %                                                                             %
9454 %                                                                             %
9455 %                                                                             %
9456 %   M a g i c k S e t I m a g e B i a s                                       %
9457 %                                                                             %
9458 %                                                                             %
9459 %                                                                             %
9460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9461 %
9462 %  MagickSetImageBias() sets the image bias for any method that convolves an
9463 %  image (e.g. MagickConvolveImage()).
9464 %
9465 %  The format of the MagickSetImageBias method is:
9466 %
9467 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9468 %        const double bias)
9469 %
9470 %  A description of each parameter follows:
9471 %
9472 %    o wand: the magick wand.
9473 %
9474 %    o bias: the image bias.
9475 %
9476 */
9477 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9478   const double bias)
9479 {
9480   assert(wand != (MagickWand *) NULL);
9481   assert(wand->signature == WandSignature);
9482   if (wand->debug != MagickFalse)
9483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9484   if (wand->images == (Image *) NULL)
9485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9486   wand->images->bias=bias;
9487   return(MagickTrue);
9488 }
9489 \f
9490 /*
9491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9492 %                                                                             %
9493 %                                                                             %
9494 %                                                                             %
9495 %   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                         %
9496 %                                                                             %
9497 %                                                                             %
9498 %                                                                             %
9499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9500 %
9501 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9502 %
9503 %  The format of the MagickSetImageBluePrimary method is:
9504 %
9505 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9506 %        const double x,const double y)
9507 %
9508 %  A description of each parameter follows:
9509 %
9510 %    o wand: the magick wand.
9511 %
9512 %    o x: the blue primary x-point.
9513 %
9514 %    o y: the blue primary y-point.
9515 %
9516 */
9517 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9518   const double x,const double y)
9519 {
9520   assert(wand != (MagickWand *) NULL);
9521   assert(wand->signature == WandSignature);
9522   if (wand->debug != MagickFalse)
9523     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9524   if (wand->images == (Image *) NULL)
9525     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9526   wand->images->chromaticity.blue_primary.x=x;
9527   wand->images->chromaticity.blue_primary.y=y;
9528   return(MagickTrue);
9529 }
9530 \f
9531 /*
9532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9533 %                                                                             %
9534 %                                                                             %
9535 %                                                                             %
9536 %   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                         %
9537 %                                                                             %
9538 %                                                                             %
9539 %                                                                             %
9540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9541 %
9542 %  MagickSetImageBorderColor() sets the image border color.
9543 %
9544 %  The format of the MagickSetImageBorderColor method is:
9545 %
9546 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9547 %        const PixelWand *border)
9548 %
9549 %  A description of each parameter follows:
9550 %
9551 %    o wand: the magick wand.
9552 %
9553 %    o border: the border pixel wand.
9554 %
9555 */
9556 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9557   const PixelWand *border)
9558 {
9559   assert(wand != (MagickWand *) NULL);
9560   assert(wand->signature == WandSignature);
9561   if (wand->debug != MagickFalse)
9562     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9563   if (wand->images == (Image *) NULL)
9564     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9565   PixelGetQuantumColor(border,&wand->images->border_color);
9566   return(MagickTrue);
9567 }
9568 \f
9569 /*
9570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9571 %                                                                             %
9572 %                                                                             %
9573 %                                                                             %
9574 %   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                       %
9575 %                                                                             %
9576 %                                                                             %
9577 %                                                                             %
9578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9579 %
9580 %  MagickSetImageChannelDepth() sets the depth of a particular image channel.
9581 %
9582 %  The format of the MagickSetImageChannelDepth method is:
9583 %
9584 %      MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9585 %        const ChannelType channel,const size_t depth)
9586 %
9587 %  A description of each parameter follows:
9588 %
9589 %    o wand: the magick wand.
9590 %
9591 %    o channel: the image channel(s).
9592 %
9593 %    o depth: the image depth in bits.
9594 %
9595 */
9596 WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9597   const ChannelType channel,const size_t depth)
9598 {
9599   assert(wand != (MagickWand *) NULL);
9600   assert(wand->signature == WandSignature);
9601   if (wand->debug != MagickFalse)
9602     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9603   if (wand->images == (Image *) NULL)
9604     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9605   return(SetImageChannelDepth(wand->images,channel,depth));
9606 }
9607 \f
9608 /*
9609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9610 %                                                                             %
9611 %                                                                             %
9612 %                                                                             %
9613 %   M a g i c k S e t I m a g e C l i p M a s k                               %
9614 %                                                                             %
9615 %                                                                             %
9616 %                                                                             %
9617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9618 %
9619 %  MagickSetImageClipMask() sets image clip mask.
9620 %
9621 %  The format of the MagickSetImageClipMask method is:
9622 %
9623 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9624 %        const MagickWand *clip_mask)
9625 %
9626 %  A description of each parameter follows:
9627 %
9628 %    o wand: the magick wand.
9629 %
9630 %    o clip_mask: the clip_mask wand.
9631 %
9632 */
9633 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9634   const MagickWand *clip_mask)
9635 {
9636   assert(wand != (MagickWand *) NULL);
9637   assert(wand->signature == WandSignature);
9638   if (wand->debug != MagickFalse)
9639     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9640   assert(clip_mask != (MagickWand *) NULL);
9641   assert(clip_mask->signature == WandSignature);
9642   if (wand->debug != MagickFalse)
9643     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9644   if (clip_mask->images == (Image *) NULL)
9645     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9646   return(SetImageClipMask(wand->images,clip_mask->images));
9647 }
9648 \f
9649 /*
9650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9651 %                                                                             %
9652 %                                                                             %
9653 %                                                                             %
9654 %   M a g i c k S e t I m a g e C o l o r                                     %
9655 %                                                                             %
9656 %                                                                             %
9657 %                                                                             %
9658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9659 %
9660 %  MagickSetImageColor() set the entire wand canvas to the specified color.
9661 %
9662 %  The format of the MagickSetImageColor method is:
9663 %
9664 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9665 %        const PixelWand *color)
9666 %
9667 %  A description of each parameter follows:
9668 %
9669 %    o wand: the magick wand.
9670 %
9671 %    o background: the image color.
9672 %
9673 */
9674 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9675   const PixelWand *color)
9676 {
9677   MagickBooleanType
9678     status;
9679
9680   MagickPixelPacket
9681     pixel;
9682
9683   assert(wand != (MagickWand *) NULL);
9684   assert(wand->signature == WandSignature);
9685   if (wand->debug != MagickFalse)
9686     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9687   PixelGetMagickColor(color,&pixel);
9688   status=SetImageColor(wand->images,&pixel);
9689   if (status == MagickFalse)
9690     InheritException(wand->exception,&wand->images->exception);
9691   return(status);
9692 }
9693 \f
9694 /*
9695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9696 %                                                                             %
9697 %                                                                             %
9698 %                                                                             %
9699 %   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                     %
9700 %                                                                             %
9701 %                                                                             %
9702 %                                                                             %
9703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9704 %
9705 %  MagickSetImageColormapColor() sets the color of the specified colormap
9706 %  index.
9707 %
9708 %  The format of the MagickSetImageColormapColor method is:
9709 %
9710 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9711 %        const size_t index,const PixelWand *color)
9712 %
9713 %  A description of each parameter follows:
9714 %
9715 %    o wand: the magick wand.
9716 %
9717 %    o index: the offset into the image colormap.
9718 %
9719 %    o color: Return the colormap color in this wand.
9720 %
9721 */
9722 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9723   const size_t index,const PixelWand *color)
9724 {
9725   assert(wand != (MagickWand *) NULL);
9726   assert(wand->signature == WandSignature);
9727   if (wand->debug != MagickFalse)
9728     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9729   if (wand->images == (Image *) NULL)
9730     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9731   if ((wand->images->colormap == (PixelPacket *) NULL) ||
9732       (index >= wand->images->colors))
9733     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9734   PixelGetQuantumColor(color,wand->images->colormap+index);
9735   return(SyncImage(wand->images));
9736 }
9737 \f
9738 /*
9739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9740 %                                                                             %
9741 %                                                                             %
9742 %                                                                             %
9743 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9744 %                                                                             %
9745 %                                                                             %
9746 %                                                                             %
9747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9748 %
9749 %  MagickSetImageColorspace() sets the image colorspace.
9750 %
9751 %  The format of the MagickSetImageColorspace method is:
9752 %
9753 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9754 %        const ColorspaceType colorspace)
9755 %
9756 %  A description of each parameter follows:
9757 %
9758 %    o wand: the magick wand.
9759 %
9760 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9761 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9762 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9763 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9764 %      HSLColorspace, or HWBColorspace.
9765 %
9766 */
9767 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9768   const ColorspaceType colorspace)
9769 {
9770   assert(wand != (MagickWand *) NULL);
9771   assert(wand->signature == WandSignature);
9772   if (wand->debug != MagickFalse)
9773     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9774   if (wand->images == (Image *) NULL)
9775     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9776   return(SetImageColorspace(wand->images,colorspace));
9777 }
9778 \f
9779 /*
9780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9781 %                                                                             %
9782 %                                                                             %
9783 %                                                                             %
9784 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9785 %                                                                             %
9786 %                                                                             %
9787 %                                                                             %
9788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9789 %
9790 %  MagickSetImageCompose() sets the image composite operator, useful for
9791 %  specifying how to composite the image thumbnail when using the
9792 %  MagickMontageImage() method.
9793 %
9794 %  The format of the MagickSetImageCompose method is:
9795 %
9796 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9797 %        const CompositeOperator compose)
9798 %
9799 %  A description of each parameter follows:
9800 %
9801 %    o wand: the magick wand.
9802 %
9803 %    o compose: the image composite operator.
9804 %
9805 */
9806 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9807   const CompositeOperator compose)
9808 {
9809   assert(wand != (MagickWand *) NULL);
9810   assert(wand->signature == WandSignature);
9811   if (wand->debug != MagickFalse)
9812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9813   if (wand->images == (Image *) NULL)
9814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9815   wand->images->compose=compose;
9816   return(MagickTrue);
9817 }
9818 \f
9819 /*
9820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9821 %                                                                             %
9822 %                                                                             %
9823 %                                                                             %
9824 %   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                         %
9825 %                                                                             %
9826 %                                                                             %
9827 %                                                                             %
9828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9829 %
9830 %  MagickSetImageCompression() sets the image compression.
9831 %
9832 %  The format of the MagickSetImageCompression method is:
9833 %
9834 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9835 %        const CompressionType compression)
9836 %
9837 %  A description of each parameter follows:
9838 %
9839 %    o wand: the magick wand.
9840 %
9841 %    o compression: the image compression type.
9842 %
9843 */
9844 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9845   const CompressionType compression)
9846 {
9847   assert(wand != (MagickWand *) NULL);
9848   assert(wand->signature == WandSignature);
9849   if (wand->debug != MagickFalse)
9850     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9851   if (wand->images == (Image *) NULL)
9852     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9853   wand->images->compression=compression;
9854   return(MagickTrue);
9855 }
9856 \f
9857 /*
9858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9859 %                                                                             %
9860 %                                                                             %
9861 %                                                                             %
9862 %   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           %
9863 %                                                                             %
9864 %                                                                             %
9865 %                                                                             %
9866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9867 %
9868 %  MagickSetImageCompressionQuality() sets the image compression quality.
9869 %
9870 %  The format of the MagickSetImageCompressionQuality method is:
9871 %
9872 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9873 %        const size_t quality)
9874 %
9875 %  A description of each parameter follows:
9876 %
9877 %    o wand: the magick wand.
9878 %
9879 %    o quality: the image compression tlityype.
9880 %
9881 */
9882 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9883   const size_t quality)
9884 {
9885   assert(wand != (MagickWand *) NULL);
9886   assert(wand->signature == WandSignature);
9887   if (wand->debug != MagickFalse)
9888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9889   if (wand->images == (Image *) NULL)
9890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9891   wand->images->quality=quality;
9892   return(MagickTrue);
9893 }
9894 \f
9895 /*
9896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9897 %                                                                             %
9898 %                                                                             %
9899 %                                                                             %
9900 %   M a g i c k S e t I m a g e D e l a y                                     %
9901 %                                                                             %
9902 %                                                                             %
9903 %                                                                             %
9904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9905 %
9906 %  MagickSetImageDelay() sets the image delay.
9907 %
9908 %  The format of the MagickSetImageDelay method is:
9909 %
9910 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9911 %        const size_t delay)
9912 %
9913 %  A description of each parameter follows:
9914 %
9915 %    o wand: the magick wand.
9916 %
9917 %    o delay: the image delay in ticks-per-second units.
9918 %
9919 */
9920 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9921   const size_t delay)
9922 {
9923   assert(wand != (MagickWand *) NULL);
9924   assert(wand->signature == WandSignature);
9925   if (wand->debug != MagickFalse)
9926     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9927   if (wand->images == (Image *) NULL)
9928     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9929   wand->images->delay=delay;
9930   return(MagickTrue);
9931 }
9932 \f
9933 /*
9934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9935 %                                                                             %
9936 %                                                                             %
9937 %                                                                             %
9938 %   M a g i c k S e t I m a g e D e p t h                                     %
9939 %                                                                             %
9940 %                                                                             %
9941 %                                                                             %
9942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9943 %
9944 %  MagickSetImageDepth() sets the image depth.
9945 %
9946 %  The format of the MagickSetImageDepth method is:
9947 %
9948 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9949 %        const size_t depth)
9950 %
9951 %  A description of each parameter follows:
9952 %
9953 %    o wand: the magick wand.
9954 %
9955 %    o depth: the image depth in bits: 8, 16, or 32.
9956 %
9957 */
9958 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9959   const size_t depth)
9960 {
9961   assert(wand != (MagickWand *) NULL);
9962   assert(wand->signature == WandSignature);
9963   if (wand->debug != MagickFalse)
9964     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9965   if (wand->images == (Image *) NULL)
9966     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9967   wand->images->depth=depth;
9968   return(MagickTrue);
9969 }
9970 \f
9971 /*
9972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9973 %                                                                             %
9974 %                                                                             %
9975 %                                                                             %
9976 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9977 %                                                                             %
9978 %                                                                             %
9979 %                                                                             %
9980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9981 %
9982 %  MagickSetImageDispose() sets the image disposal method.
9983 %
9984 %  The format of the MagickSetImageDispose method is:
9985 %
9986 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9987 %        const DisposeType dispose)
9988 %
9989 %  A description of each parameter follows:
9990 %
9991 %    o wand: the magick wand.
9992 %
9993 %    o dispose: the image disposeal type.
9994 %
9995 */
9996 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9997   const DisposeType dispose)
9998 {
9999   assert(wand != (MagickWand *) NULL);
10000   assert(wand->signature == WandSignature);
10001   if (wand->debug != MagickFalse)
10002     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10003   if (wand->images == (Image *) NULL)
10004     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10005   wand->images->dispose=dispose;
10006   return(MagickTrue);
10007 }
10008 \f
10009 /*
10010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10011 %                                                                             %
10012 %                                                                             %
10013 %                                                                             %
10014 %   M a g i c k S e t I m a g e E x t e n t                                   %
10015 %                                                                             %
10016 %                                                                             %
10017 %                                                                             %
10018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10019 %
10020 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
10021 %
10022 %  The format of the MagickSetImageExtent method is:
10023 %
10024 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10025 %        const size_t columns,const unsigned rows)
10026 %
10027 %  A description of each parameter follows:
10028 %
10029 %    o wand: the magick wand.
10030 %
10031 %    o columns:  The image width in pixels.
10032 %
10033 %    o rows:  The image height in pixels.
10034 %
10035 */
10036 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10037   const size_t columns,const size_t rows)
10038 {
10039   assert(wand != (MagickWand *) NULL);
10040   assert(wand->signature == WandSignature);
10041   if (wand->debug != MagickFalse)
10042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10043   if (wand->images == (Image *) NULL)
10044     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10045   return(SetImageExtent(wand->images,columns,rows));
10046 }
10047 \f
10048 /*
10049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10050 %                                                                             %
10051 %                                                                             %
10052 %                                                                             %
10053 %   M a g i c k S e t I m a g e F i l e n a m e                               %
10054 %                                                                             %
10055 %                                                                             %
10056 %                                                                             %
10057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10058 %
10059 %  MagickSetImageFilename() sets the filename of a particular image in a
10060 %  sequence.
10061 %
10062 %  The format of the MagickSetImageFilename method is:
10063 %
10064 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10065 %        const char *filename)
10066 %
10067 %  A description of each parameter follows:
10068 %
10069 %    o wand: the magick wand.
10070 %
10071 %    o filename: the image filename.
10072 %
10073 */
10074 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10075   const char *filename)
10076 {
10077   assert(wand != (MagickWand *) NULL);
10078   assert(wand->signature == WandSignature);
10079   if (wand->debug != MagickFalse)
10080     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10081   if (wand->images == (Image *) NULL)
10082     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10083   if (filename != (const char *) NULL)
10084     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
10085   return(MagickTrue);
10086 }
10087 \f
10088 /*
10089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10090 %                                                                             %
10091 %                                                                             %
10092 %                                                                             %
10093 %   M a g i c k S e t I m a g e F o r m a t                                   %
10094 %                                                                             %
10095 %                                                                             %
10096 %                                                                             %
10097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10098 %
10099 %  MagickSetImageFormat() sets the format of a particular image in a
10100 %  sequence.
10101 %
10102 %  The format of the MagickSetImageFormat method is:
10103 %
10104 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10105 %        const char *format)
10106 %
10107 %  A description of each parameter follows:
10108 %
10109 %    o wand: the magick wand.
10110 %
10111 %    o format: the image format.
10112 %
10113 */
10114 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10115   const char *format)
10116 {
10117   const MagickInfo
10118     *magick_info;
10119
10120   assert(wand != (MagickWand *) NULL);
10121   assert(wand->signature == WandSignature);
10122   if (wand->debug != MagickFalse)
10123     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10124   if (wand->images == (Image *) NULL)
10125     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10126   if ((format == (char *) NULL) || (*format == '\0'))
10127     {
10128       *wand->images->magick='\0';
10129       return(MagickTrue);
10130     }
10131   magick_info=GetMagickInfo(format,wand->exception);
10132   if (magick_info == (const MagickInfo *) NULL)
10133     return(MagickFalse);
10134   ClearMagickException(wand->exception);
10135   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
10136   return(MagickTrue);
10137 }
10138 \f
10139 /*
10140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10141 %                                                                             %
10142 %                                                                             %
10143 %                                                                             %
10144 %   M a g i c k S e t I m a g e F u z z                                       %
10145 %                                                                             %
10146 %                                                                             %
10147 %                                                                             %
10148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10149 %
10150 %  MagickSetImageFuzz() sets the image fuzz.
10151 %
10152 %  The format of the MagickSetImageFuzz method is:
10153 %
10154 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10155 %        const double fuzz)
10156 %
10157 %  A description of each parameter follows:
10158 %
10159 %    o wand: the magick wand.
10160 %
10161 %    o fuzz: the image fuzz.
10162 %
10163 */
10164 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10165   const double fuzz)
10166 {
10167   assert(wand != (MagickWand *) NULL);
10168   assert(wand->signature == WandSignature);
10169   if (wand->debug != MagickFalse)
10170     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10171   if (wand->images == (Image *) NULL)
10172     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10173   wand->images->fuzz=fuzz;
10174   return(MagickTrue);
10175 }
10176 \f
10177 /*
10178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10179 %                                                                             %
10180 %                                                                             %
10181 %                                                                             %
10182 %   M a g i c k S e t I m a g e G a m m a                                     %
10183 %                                                                             %
10184 %                                                                             %
10185 %                                                                             %
10186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10187 %
10188 %  MagickSetImageGamma() sets the image gamma.
10189 %
10190 %  The format of the MagickSetImageGamma method is:
10191 %
10192 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10193 %        const double gamma)
10194 %
10195 %  A description of each parameter follows:
10196 %
10197 %    o wand: the magick wand.
10198 %
10199 %    o gamma: the image gamma.
10200 %
10201 */
10202 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10203   const double gamma)
10204 {
10205   assert(wand != (MagickWand *) NULL);
10206   assert(wand->signature == WandSignature);
10207   if (wand->debug != MagickFalse)
10208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10209   if (wand->images == (Image *) NULL)
10210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10211   wand->images->gamma=gamma;
10212   return(MagickTrue);
10213 }
10214 \f
10215 /*
10216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10217 %                                                                             %
10218 %                                                                             %
10219 %                                                                             %
10220 %   M a g i c k S e t I m a g e G r a v i t y                                 %
10221 %                                                                             %
10222 %                                                                             %
10223 %                                                                             %
10224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10225 %
10226 %  MagickSetImageGravity() sets the image gravity type.
10227 %
10228 %  The format of the MagickSetImageGravity method is:
10229 %
10230 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10231 %        const GravityType gravity)
10232 %
10233 %  A description of each parameter follows:
10234 %
10235 %    o wand: the magick wand.
10236 %
10237 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10238 %      PlaneInterlace, PartitionInterlace.
10239 %
10240 */
10241 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10242   const GravityType gravity)
10243 {
10244   assert(wand != (MagickWand *) NULL);
10245   assert(wand->signature == WandSignature);
10246   if (wand->debug != MagickFalse)
10247     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10248   if (wand->images == (Image *) NULL)
10249     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10250   wand->images->gravity=gravity;
10251   return(MagickTrue);
10252 }
10253 \f
10254 /*
10255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10256 %                                                                             %
10257 %                                                                             %
10258 %                                                                             %
10259 %   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                       %
10260 %                                                                             %
10261 %                                                                             %
10262 %                                                                             %
10263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10264 %
10265 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
10266 %  point.
10267 %
10268 %  The format of the MagickSetImageGreenPrimary method is:
10269 %
10270 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10271 %        const double x,const double y)
10272 %
10273 %  A description of each parameter follows:
10274 %
10275 %    o wand: the magick wand.
10276 %
10277 %    o x: the green primary x-point.
10278 %
10279 %    o y: the green primary y-point.
10280 %
10281 %
10282 */
10283 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10284   const double x,const double y)
10285 {
10286   assert(wand != (MagickWand *) NULL);
10287   assert(wand->signature == WandSignature);
10288   if (wand->debug != MagickFalse)
10289     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10290   if (wand->images == (Image *) NULL)
10291     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10292   wand->images->chromaticity.green_primary.x=x;
10293   wand->images->chromaticity.green_primary.y=y;
10294   return(MagickTrue);
10295 }
10296 \f
10297 /*
10298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10299 %                                                                             %
10300 %                                                                             %
10301 %                                                                             %
10302 %   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                 %
10303 %                                                                             %
10304 %                                                                             %
10305 %                                                                             %
10306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10307 %
10308 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10309 %
10310 %  The format of the MagickSetImageInterlaceScheme method is:
10311 %
10312 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10313 %        const InterlaceType interlace)
10314 %
10315 %  A description of each parameter follows:
10316 %
10317 %    o wand: the magick wand.
10318 %
10319 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10320 %      PlaneInterlace, PartitionInterlace.
10321 %
10322 */
10323 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10324   const InterlaceType interlace)
10325 {
10326   assert(wand != (MagickWand *) NULL);
10327   assert(wand->signature == WandSignature);
10328   if (wand->debug != MagickFalse)
10329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10330   if (wand->images == (Image *) NULL)
10331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10332   wand->images->interlace=interlace;
10333   return(MagickTrue);
10334 }
10335 \f
10336 /*
10337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10338 %                                                                             %
10339 %                                                                             %
10340 %                                                                             %
10341 %   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             %
10342 %                                                                             %
10343 %                                                                             %
10344 %                                                                             %
10345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10346 %
10347 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10348 %
10349 %  The format of the MagickSetImageInterpolateMethod method is:
10350 %
10351 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10352 %        const InterpolatePixelMethod method)
10353 %
10354 %  A description of each parameter follows:
10355 %
10356 %    o wand: the magick wand.
10357 %
10358 %    o method: the image interpole pixel methods: choose from Undefined,
10359 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10360 %
10361 */
10362 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10363   const InterpolatePixelMethod method)
10364 {
10365   assert(wand != (MagickWand *) NULL);
10366   assert(wand->signature == WandSignature);
10367   if (wand->debug != MagickFalse)
10368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10369   if (wand->images == (Image *) NULL)
10370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10371   wand->images->interpolate=method;
10372   return(MagickTrue);
10373 }
10374 \f
10375 /*
10376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10377 %                                                                             %
10378 %                                                                             %
10379 %                                                                             %
10380 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10381 %                                                                             %
10382 %                                                                             %
10383 %                                                                             %
10384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10385 %
10386 %  MagickSetImageIterations() sets the image iterations.
10387 %
10388 %  The format of the MagickSetImageIterations method is:
10389 %
10390 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10391 %        const size_t iterations)
10392 %
10393 %  A description of each parameter follows:
10394 %
10395 %    o wand: the magick wand.
10396 %
10397 %    o delay: the image delay in 1/100th of a second.
10398 %
10399 */
10400 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10401   const size_t iterations)
10402 {
10403   assert(wand != (MagickWand *) NULL);
10404   assert(wand->signature == WandSignature);
10405   if (wand->debug != MagickFalse)
10406     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10407   if (wand->images == (Image *) NULL)
10408     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10409   wand->images->iterations=iterations;
10410   return(MagickTrue);
10411 }
10412 \f
10413 /*
10414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10415 %                                                                             %
10416 %                                                                             %
10417 %                                                                             %
10418 %   M a g i c k S e t I m a g e M a t t e                                     %
10419 %                                                                             %
10420 %                                                                             %
10421 %                                                                             %
10422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10423 %
10424 %  MagickSetImageMatte() sets the image matte channel.
10425 %
10426 %  The format of the MagickSetImageMatteColor method is:
10427 %
10428 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10429 %        const MagickBooleanType *matte)
10430 %
10431 %  A description of each parameter follows:
10432 %
10433 %    o wand: the magick wand.
10434 %
10435 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10436 %      MagickFalse.
10437 %
10438 */
10439 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10440   const MagickBooleanType matte)
10441 {
10442   assert(wand != (MagickWand *) NULL);
10443   assert(wand->signature == WandSignature);
10444   if (wand->debug != MagickFalse)
10445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10446   if (wand->images == (Image *) NULL)
10447     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10448   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10449     (void) SetImageOpacity(wand->images,OpaqueOpacity);
10450   wand->images->matte=matte;
10451   return(MagickTrue);
10452 }
10453 \f
10454 /*
10455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10456 %                                                                             %
10457 %                                                                             %
10458 %                                                                             %
10459 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10460 %                                                                             %
10461 %                                                                             %
10462 %                                                                             %
10463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10464 %
10465 %  MagickSetImageMatteColor() sets the image matte color.
10466 %
10467 %  The format of the MagickSetImageMatteColor method is:
10468 %
10469 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10470 %        const PixelWand *matte)
10471 %
10472 %  A description of each parameter follows:
10473 %
10474 %    o wand: the magick wand.
10475 %
10476 %    o matte: the matte pixel wand.
10477 %
10478 */
10479 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10480   const PixelWand *matte)
10481 {
10482   assert(wand != (MagickWand *) NULL);
10483   assert(wand->signature == WandSignature);
10484   if (wand->debug != MagickFalse)
10485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10486   if (wand->images == (Image *) NULL)
10487     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10488   PixelGetQuantumColor(matte,&wand->images->matte_color);
10489   return(MagickTrue);
10490 }
10491 \f
10492 /*
10493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10494 %                                                                             %
10495 %                                                                             %
10496 %                                                                             %
10497 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10498 %                                                                             %
10499 %                                                                             %
10500 %                                                                             %
10501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10502 %
10503 %  MagickSetImageOpacity() sets the image to the specified opacity level.
10504 %
10505 %  The format of the MagickSetImageOpacity method is:
10506 %
10507 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10508 %        const double alpha)
10509 %
10510 %  A description of each parameter follows:
10511 %
10512 %    o wand: the magick wand.
10513 %
10514 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10515 %      transparent.
10516 %
10517 */
10518 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10519   const double alpha)
10520 {
10521   MagickBooleanType
10522     status;
10523
10524   assert(wand != (MagickWand *) NULL);
10525   assert(wand->signature == WandSignature);
10526   if (wand->debug != MagickFalse)
10527     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10528   if (wand->images == (Image *) NULL)
10529     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10530   status=SetImageOpacity(wand->images,ClampToQuantum((MagickRealType)
10531     QuantumRange-QuantumRange*alpha));
10532   if (status == MagickFalse)
10533     InheritException(wand->exception,&wand->images->exception);
10534   return(status);
10535 }
10536 \f
10537 /*
10538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10539 %                                                                             %
10540 %                                                                             %
10541 %                                                                             %
10542 %   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                         %
10543 %                                                                             %
10544 %                                                                             %
10545 %                                                                             %
10546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10547 %
10548 %  MagickSetImageOrientation() sets the image orientation.
10549 %
10550 %  The format of the MagickSetImageOrientation method is:
10551 %
10552 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10553 %        const OrientationType orientation)
10554 %
10555 %  A description of each parameter follows:
10556 %
10557 %    o wand: the magick wand.
10558 %
10559 %    o orientation: the image orientation type.
10560 %
10561 */
10562 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10563   const OrientationType orientation)
10564 {
10565   assert(wand != (MagickWand *) NULL);
10566   assert(wand->signature == WandSignature);
10567   if (wand->debug != MagickFalse)
10568     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10569   if (wand->images == (Image *) NULL)
10570     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10571   wand->images->orientation=orientation;
10572   return(MagickTrue);
10573 }
10574 \f
10575 /*
10576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10577 %                                                                             %
10578 %                                                                             %
10579 %                                                                             %
10580 %   M a g i c k S e t I m a g e P a g e                                       %
10581 %                                                                             %
10582 %                                                                             %
10583 %                                                                             %
10584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10585 %
10586 %  MagickSetImagePage() sets the page geometry of the image.
10587 %
10588 %  The format of the MagickSetImagePage method is:
10589 %
10590 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10591 %        const size_t width,const size_t height,const ssize_t x,
10592 %        const ssize_t y)
10593 %
10594 %  A description of each parameter follows:
10595 %
10596 %    o wand: the magick wand.
10597 %
10598 %    o width: the page width.
10599 %
10600 %    o height: the page height.
10601 %
10602 %    o x: the page x-offset.
10603 %
10604 %    o y: the page y-offset.
10605 %
10606 */
10607 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10608   const size_t width,const size_t height,const ssize_t x,
10609   const ssize_t y)
10610 {
10611   assert(wand != (MagickWand *) NULL);
10612   assert(wand->signature == WandSignature);
10613   if (wand->debug != MagickFalse)
10614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10615   if (wand->images == (Image *) NULL)
10616     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10617   wand->images->page.width=width;
10618   wand->images->page.height=height;
10619   wand->images->page.x=x;
10620   wand->images->page.y=y;
10621   return(MagickTrue);
10622 }
10623 \f
10624 /*
10625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10626 %                                                                             %
10627 %                                                                             %
10628 %                                                                             %
10629 %   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                 %
10630 %                                                                             %
10631 %                                                                             %
10632 %                                                                             %
10633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10634 %
10635 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10636 %  specified method and returns the previous progress monitor if any.  The
10637 %  progress monitor method looks like this:
10638 %
10639 %    MagickBooleanType MagickProgressMonitor(const char *text,
10640 %      const MagickOffsetType offset,const MagickSizeType span,
10641 %      void *client_data)
10642 %
10643 %  If the progress monitor returns MagickFalse, the current operation is
10644 %  interrupted.
10645 %
10646 %  The format of the MagickSetImageProgressMonitor method is:
10647 %
10648 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10649 %        const MagickProgressMonitor progress_monitor,void *client_data)
10650 %
10651 %  A description of each parameter follows:
10652 %
10653 %    o wand: the magick wand.
10654 %
10655 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10656 %      of an image operation.
10657 %
10658 %    o client_data: Specifies a pointer to any client data.
10659 %
10660 */
10661 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10662   const MagickProgressMonitor progress_monitor,void *client_data)
10663 {
10664   MagickProgressMonitor
10665     previous_monitor;
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     {
10673       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10674         "ContainsNoImages","`%s'",wand->name);
10675       return((MagickProgressMonitor) NULL);
10676     }
10677   previous_monitor=SetImageProgressMonitor(wand->images,
10678     progress_monitor,client_data);
10679   return(previous_monitor);
10680 }
10681 \f
10682 /*
10683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10684 %                                                                             %
10685 %                                                                             %
10686 %                                                                             %
10687 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10688 %                                                                             %
10689 %                                                                             %
10690 %                                                                             %
10691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10692 %
10693 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10694 %
10695 %  The format of the MagickSetImageRedPrimary method is:
10696 %
10697 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10698 %        const double x,const double y)
10699 %
10700 %  A description of each parameter follows:
10701 %
10702 %    o wand: the magick wand.
10703 %
10704 %    o x: the red primary x-point.
10705 %
10706 %    o y: the red primary y-point.
10707 %
10708 */
10709 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10710   const double x,const double y)
10711 {
10712   assert(wand != (MagickWand *) NULL);
10713   assert(wand->signature == WandSignature);
10714   if (wand->debug != MagickFalse)
10715     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10716   if (wand->images == (Image *) NULL)
10717     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10718   wand->images->chromaticity.red_primary.x=x;
10719   wand->images->chromaticity.red_primary.y=y;
10720   return(MagickTrue);
10721 }
10722 \f
10723 /*
10724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10725 %                                                                             %
10726 %                                                                             %
10727 %                                                                             %
10728 %   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                 %
10729 %                                                                             %
10730 %                                                                             %
10731 %                                                                             %
10732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10733 %
10734 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10735 %
10736 %  The format of the MagickSetImageRenderingIntent method is:
10737 %
10738 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10739 %        const RenderingIntent rendering_intent)
10740 %
10741 %  A description of each parameter follows:
10742 %
10743 %    o wand: the magick wand.
10744 %
10745 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10746 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10747 %
10748 */
10749 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10750   const RenderingIntent rendering_intent)
10751 {
10752   assert(wand != (MagickWand *) NULL);
10753   assert(wand->signature == WandSignature);
10754   if (wand->debug != MagickFalse)
10755     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10756   if (wand->images == (Image *) NULL)
10757     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10758   wand->images->rendering_intent=rendering_intent;
10759   return(MagickTrue);
10760 }
10761 \f
10762 /*
10763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10764 %                                                                             %
10765 %                                                                             %
10766 %                                                                             %
10767 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10768 %                                                                             %
10769 %                                                                             %
10770 %                                                                             %
10771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10772 %
10773 %  MagickSetImageResolution() sets the image resolution.
10774 %
10775 %  The format of the MagickSetImageResolution method is:
10776 %
10777 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10778 %        const double x_resolution,const doubtl y_resolution)
10779 %
10780 %  A description of each parameter follows:
10781 %
10782 %    o wand: the magick wand.
10783 %
10784 %    o x_resolution: the image x resolution.
10785 %
10786 %    o y_resolution: the image y resolution.
10787 %
10788 */
10789 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10790   const double x_resolution,const double y_resolution)
10791 {
10792   assert(wand != (MagickWand *) NULL);
10793   assert(wand->signature == WandSignature);
10794   if (wand->debug != MagickFalse)
10795     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10796   if (wand->images == (Image *) NULL)
10797     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10798   wand->images->x_resolution=x_resolution;
10799   wand->images->y_resolution=y_resolution;
10800   return(MagickTrue);
10801 }
10802 \f
10803 /*
10804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10805 %                                                                             %
10806 %                                                                             %
10807 %                                                                             %
10808 %   M a g i c k S e t I m a g e S c e n e                                     %
10809 %                                                                             %
10810 %                                                                             %
10811 %                                                                             %
10812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10813 %
10814 %  MagickSetImageScene() sets the image scene.
10815 %
10816 %  The format of the MagickSetImageScene method is:
10817 %
10818 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10819 %        const size_t scene)
10820 %
10821 %  A description of each parameter follows:
10822 %
10823 %    o wand: the magick wand.
10824 %
10825 %    o delay: the image scene number.
10826 %
10827 */
10828 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10829   const size_t scene)
10830 {
10831   assert(wand != (MagickWand *) NULL);
10832   assert(wand->signature == WandSignature);
10833   if (wand->debug != MagickFalse)
10834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10835   if (wand->images == (Image *) NULL)
10836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10837   wand->images->scene=scene;
10838   return(MagickTrue);
10839 }
10840 \f
10841 /*
10842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10843 %                                                                             %
10844 %                                                                             %
10845 %                                                                             %
10846 %   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                   %
10847 %                                                                             %
10848 %                                                                             %
10849 %                                                                             %
10850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10851 %
10852 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10853 %
10854 %  The format of the MagickSetImageTicksPerSecond method is:
10855 %
10856 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10857 %        const ssize_t ticks_per-second)
10858 %
10859 %  A description of each parameter follows:
10860 %
10861 %    o wand: the magick wand.
10862 %
10863 %    o ticks_per_second: the units to use for the image delay.
10864 %
10865 */
10866 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10867   const ssize_t ticks_per_second)
10868 {
10869   assert(wand != (MagickWand *) NULL);
10870   assert(wand->signature == WandSignature);
10871   if (wand->debug != MagickFalse)
10872     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10873   if (wand->images == (Image *) NULL)
10874     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10875   wand->images->ticks_per_second=ticks_per_second;
10876   return(MagickTrue);
10877 }
10878 \f
10879 /*
10880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10881 %                                                                             %
10882 %                                                                             %
10883 %                                                                             %
10884 %   M a g i c k S e t I m a g e T y p e                                       %
10885 %                                                                             %
10886 %                                                                             %
10887 %                                                                             %
10888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10889 %
10890 %  MagickSetImageType() sets the image type.
10891 %
10892 %  The format of the MagickSetImageType method is:
10893 %
10894 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10895 %        const ImageType image_type)
10896 %
10897 %  A description of each parameter follows:
10898 %
10899 %    o wand: the magick wand.
10900 %
10901 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10902 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10903 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10904 %      or OptimizeType.
10905 %
10906 */
10907 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10908   const ImageType image_type)
10909 {
10910   assert(wand != (MagickWand *) NULL);
10911   assert(wand->signature == WandSignature);
10912   if (wand->debug != MagickFalse)
10913     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10914   if (wand->images == (Image *) NULL)
10915     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10916   return(SetImageType(wand->images,image_type));
10917 }
10918 \f
10919 /*
10920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10921 %                                                                             %
10922 %                                                                             %
10923 %                                                                             %
10924 %   M a g i c k S e t I m a g e U n i t s                                     %
10925 %                                                                             %
10926 %                                                                             %
10927 %                                                                             %
10928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10929 %
10930 %  MagickSetImageUnits() sets the image units of resolution.
10931 %
10932 %  The format of the MagickSetImageUnits method is:
10933 %
10934 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10935 %        const ResolutionType units)
10936 %
10937 %  A description of each parameter follows:
10938 %
10939 %    o wand: the magick wand.
10940 %
10941 %    o units: the image units of resolution : UndefinedResolution,
10942 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10943 %
10944 */
10945 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10946   const ResolutionType units)
10947 {
10948   assert(wand != (MagickWand *) NULL);
10949   assert(wand->signature == WandSignature);
10950   if (wand->debug != MagickFalse)
10951     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10952   if (wand->images == (Image *) NULL)
10953     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10954   wand->images->units=units;
10955   return(MagickTrue);
10956 }
10957 \f
10958 /*
10959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10960 %                                                                             %
10961 %                                                                             %
10962 %                                                                             %
10963 %   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           %
10964 %                                                                             %
10965 %                                                                             %
10966 %                                                                             %
10967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10968 %
10969 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10970 %
10971 %  The format of the MagickSetImageVirtualPixelMethod method is:
10972 %
10973 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10974 %        const VirtualPixelMethod method)
10975 %
10976 %  A description of each parameter follows:
10977 %
10978 %    o wand: the magick wand.
10979 %
10980 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10981 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10982 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10983 %
10984 */
10985 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10986   const VirtualPixelMethod method)
10987 {
10988   assert(wand != (MagickWand *) NULL);
10989   assert(wand->signature == WandSignature);
10990   if (wand->debug != MagickFalse)
10991     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10992   if (wand->images == (Image *) NULL)
10993     return(UndefinedVirtualPixelMethod);
10994   return(SetImageVirtualPixelMethod(wand->images,method));
10995 }
10996 \f
10997 /*
10998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10999 %                                                                             %
11000 %                                                                             %
11001 %                                                                             %
11002 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
11003 %                                                                             %
11004 %                                                                             %
11005 %                                                                             %
11006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11007 %
11008 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
11009 %
11010 %  The format of the MagickSetImageWhitePoint method is:
11011 %
11012 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11013 %        const double x,const double y)
11014 %
11015 %  A description of each parameter follows:
11016 %
11017 %    o wand: the magick wand.
11018 %
11019 %    o x: the white x-point.
11020 %
11021 %    o y: the white y-point.
11022 %
11023 */
11024 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11025   const double x,const double y)
11026 {
11027   assert(wand != (MagickWand *) NULL);
11028   assert(wand->signature == WandSignature);
11029   if (wand->debug != MagickFalse)
11030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11031   if (wand->images == (Image *) NULL)
11032     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11033   wand->images->chromaticity.white_point.x=x;
11034   wand->images->chromaticity.white_point.y=y;
11035   return(MagickTrue);
11036 }
11037 \f
11038 /*
11039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11040 %                                                                             %
11041 %                                                                             %
11042 %                                                                             %
11043 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
11044 %                                                                             %
11045 %                                                                             %
11046 %                                                                             %
11047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11048 %
11049 %  MagickShadeImage() shines a distant light on an image to create a
11050 %  three-dimensional effect. You control the positioning of the light with
11051 %  azimuth and elevation; azimuth is measured in degrees off the x axis
11052 %  and elevation is measured in pixels above the Z axis.
11053 %
11054 %  The format of the MagickShadeImage method is:
11055 %
11056 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
11057 %        const MagickBooleanType gray,const double azimuth,
11058 %        const double elevation)
11059 %
11060 %  A description of each parameter follows:
11061 %
11062 %    o wand: the magick wand.
11063 %
11064 %    o gray: A value other than zero shades the intensity of each pixel.
11065 %
11066 %    o azimuth, elevation:  Define the light source direction.
11067 %
11068 */
11069 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11070   const MagickBooleanType gray,const double asimuth,const double elevation)
11071 {
11072   Image
11073     *shade_image;
11074
11075   assert(wand != (MagickWand *) NULL);
11076   assert(wand->signature == WandSignature);
11077   if (wand->debug != MagickFalse)
11078     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11079   if (wand->images == (Image *) NULL)
11080     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11081   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
11082   if (shade_image == (Image *) NULL)
11083     return(MagickFalse);
11084   ReplaceImageInList(&wand->images,shade_image);
11085   return(MagickTrue);
11086 }
11087 \f
11088 /*
11089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11090 %                                                                             %
11091 %                                                                             %
11092 %                                                                             %
11093 %   M a g i c k S h a d o w I m a g e                                         %
11094 %                                                                             %
11095 %                                                                             %
11096 %                                                                             %
11097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11098 %
11099 %  MagickShadowImage() simulates an image shadow.
11100 %
11101 %  The format of the MagickShadowImage method is:
11102 %
11103 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
11104 %        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11105 %
11106 %  A description of each parameter follows:
11107 %
11108 %    o wand: the magick wand.
11109 %
11110 %    o opacity: percentage transparency.
11111 %
11112 %    o sigma: the standard deviation of the Gaussian, in pixels.
11113 %
11114 %    o x: the shadow x-offset.
11115 %
11116 %    o y: the shadow y-offset.
11117 %
11118 */
11119 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11120   const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11121 {
11122   Image
11123     *shadow_image;
11124
11125   assert(wand != (MagickWand *) NULL);
11126   assert(wand->signature == WandSignature);
11127   if (wand->debug != MagickFalse)
11128     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11129   if (wand->images == (Image *) NULL)
11130     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11131   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
11132   if (shadow_image == (Image *) NULL)
11133     return(MagickFalse);
11134   ReplaceImageInList(&wand->images,shadow_image);
11135   return(MagickTrue);
11136 }
11137 \f
11138 /*
11139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11140 %                                                                             %
11141 %                                                                             %
11142 %                                                                             %
11143 %   M a g i c k S h a r p e n I m a g e                                       %
11144 %                                                                             %
11145 %                                                                             %
11146 %                                                                             %
11147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11148 %
11149 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
11150 %  Gaussian operator of the given radius and standard deviation (sigma).
11151 %  For reasonable results, the radius should be larger than sigma.  Use a
11152 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11153 %
11154 %  The format of the MagickSharpenImage method is:
11155 %
11156 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
11157 %        const double radius,const double sigma)
11158 %      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11159 %        const ChannelType channel,const double radius,const double sigma)
11160 %
11161 %  A description of each parameter follows:
11162 %
11163 %    o wand: the magick wand.
11164 %
11165 %    o channel: the image channel(s).
11166 %
11167 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11168 %      pixel.
11169 %
11170 %    o sigma: the standard deviation of the Gaussian, in pixels.
11171 %
11172 */
11173
11174 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11175   const double radius,const double sigma)
11176 {
11177   MagickBooleanType
11178     status;
11179
11180   status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11181   return(status);
11182 }
11183
11184 WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11185   const ChannelType channel,const double radius,const double sigma)
11186 {
11187   Image
11188     *sharp_image;
11189
11190   assert(wand != (MagickWand *) NULL);
11191   assert(wand->signature == WandSignature);
11192   if (wand->debug != MagickFalse)
11193     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11194   if (wand->images == (Image *) NULL)
11195     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11196   sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11197     wand->exception);
11198   if (sharp_image == (Image *) NULL)
11199     return(MagickFalse);
11200   ReplaceImageInList(&wand->images,sharp_image);
11201   return(MagickTrue);
11202 }
11203 \f
11204 /*
11205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11206 %                                                                             %
11207 %                                                                             %
11208 %                                                                             %
11209 %   M a g i c k S h a v e I m a g e                                           %
11210 %                                                                             %
11211 %                                                                             %
11212 %                                                                             %
11213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11214 %
11215 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
11216 %  memory necessary for the new Image structure and returns a pointer to the
11217 %  new image.
11218 %
11219 %  The format of the MagickShaveImage method is:
11220 %
11221 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
11222 %        const size_t columns,const size_t rows)
11223 %
11224 %  A description of each parameter follows:
11225 %
11226 %    o wand: the magick wand.
11227 %
11228 %    o columns: the number of columns in the scaled image.
11229 %
11230 %    o rows: the number of rows in the scaled image.
11231 %
11232 %
11233 */
11234 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11235   const size_t columns,const size_t rows)
11236 {
11237   Image
11238     *shave_image;
11239
11240   RectangleInfo
11241     shave_info;
11242
11243   assert(wand != (MagickWand *) NULL);
11244   assert(wand->signature == WandSignature);
11245   if (wand->debug != MagickFalse)
11246     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11247   if (wand->images == (Image *) NULL)
11248     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11249   shave_info.width=columns;
11250   shave_info.height=rows;
11251   shave_info.x=0;
11252   shave_info.y=0;
11253   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11254   if (shave_image == (Image *) NULL)
11255     return(MagickFalse);
11256   ReplaceImageInList(&wand->images,shave_image);
11257   return(MagickTrue);
11258 }
11259 \f
11260 /*
11261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11262 %                                                                             %
11263 %                                                                             %
11264 %                                                                             %
11265 %   M a g i c k S h e a r I m a g e                                           %
11266 %                                                                             %
11267 %                                                                             %
11268 %                                                                             %
11269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11270 %
11271 %  MagickShearImage() slides one edge of an image along the X or Y axis,
11272 %  creating a parallelogram.  An X direction shear slides an edge along the X
11273 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
11274 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
11275 %  is measured relative to the Y axis, and similarly, for Y direction shears
11276 %  y_shear is measured relative to the X axis.  Empty triangles left over from
11277 %  shearing the image are filled with the background color.
11278 %
11279 %  The format of the MagickShearImage method is:
11280 %
11281 %      MagickBooleanType MagickShearImage(MagickWand *wand,
11282 %        const PixelWand *background,const double x_shear,onst double y_shear)
11283 %
11284 %  A description of each parameter follows:
11285 %
11286 %    o wand: the magick wand.
11287 %
11288 %    o background: the background pixel wand.
11289 %
11290 %    o x_shear: the number of degrees to shear the image.
11291 %
11292 %    o y_shear: the number of degrees to shear the image.
11293 %
11294 */
11295 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11296   const PixelWand *background,const double x_shear,const double y_shear)
11297 {
11298   Image
11299     *shear_image;
11300
11301   assert(wand != (MagickWand *) NULL);
11302   assert(wand->signature == WandSignature);
11303   if (wand->debug != MagickFalse)
11304     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11305   if (wand->images == (Image *) NULL)
11306     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11307   PixelGetQuantumColor(background,&wand->images->background_color);
11308   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11309   if (shear_image == (Image *) NULL)
11310     return(MagickFalse);
11311   ReplaceImageInList(&wand->images,shear_image);
11312   return(MagickTrue);
11313 }
11314 \f
11315 /*
11316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11317 %                                                                             %
11318 %                                                                             %
11319 %                                                                             %
11320 %   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                   %
11321 %                                                                             %
11322 %                                                                             %
11323 %                                                                             %
11324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11325 %
11326 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11327 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11328 %  image using a sigmoidal transfer function without saturating highlights or
11329 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11330 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11331 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11332 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11333 %  is reduced.
11334 %
11335 %  The format of the MagickSigmoidalContrastImage method is:
11336 %
11337 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11338 %        const MagickBooleanType sharpen,const double alpha,const double beta)
11339 %      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11340 %        const ChannelType channel,const MagickBooleanType sharpen,
11341 %        const double alpha,const double beta)
11342 %
11343 %  A description of each parameter follows:
11344 %
11345 %    o wand: the magick wand.
11346 %
11347 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
11348 %
11349 %    o sharpen: Increase or decrease image contrast.
11350 %
11351 %    o alpha: control the "shoulder" of the contast curve.
11352 %
11353 %    o beta: control the "toe" of the contast curve.
11354 %
11355 */
11356
11357 WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11358   const MagickBooleanType sharpen,const double alpha,const double beta)
11359 {
11360   MagickBooleanType
11361     status;
11362
11363   status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11364     alpha,beta);
11365   return(status);
11366 }
11367
11368 WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11369   MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11370   const double alpha,const double beta)
11371 {
11372   MagickBooleanType
11373     status;
11374
11375   assert(wand != (MagickWand *) NULL);
11376   assert(wand->signature == WandSignature);
11377   if (wand->debug != MagickFalse)
11378     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11379   if (wand->images == (Image *) NULL)
11380     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11381   status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11382   if (status == MagickFalse)
11383     InheritException(wand->exception,&wand->images->exception);
11384   return(status);
11385 }
11386 \f
11387 /*
11388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11389 %                                                                             %
11390 %                                                                             %
11391 %                                                                             %
11392 %   M a g i c k S i m i l a r i t y I m a g e                                 %
11393 %                                                                             %
11394 %                                                                             %
11395 %                                                                             %
11396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11397 %
11398 %  MagickSimilarityImage() compares the reference image of the image and
11399 %  returns the best match offset.  In addition, it returns a similarity image
11400 %  such that an exact match location is completely white and if none of the
11401 %  pixels match, black, otherwise some gray level in-between.
11402 %
11403 %  The format of the MagickSimilarityImage method is:
11404 %
11405 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
11406 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11407 %
11408 %  A description of each parameter follows:
11409 %
11410 %    o wand: the magick wand.
11411 %
11412 %    o reference: the reference wand.
11413 %
11414 %    o offset: the best match offset of the reference image within the image.
11415 %
11416 %    o similarity: the computed similarity between the images.
11417 %
11418 */
11419 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11420   const MagickWand *reference,RectangleInfo *offset,double *similarity)
11421 {
11422   Image
11423     *similarity_image;
11424
11425   assert(wand != (MagickWand *) NULL);
11426   assert(wand->signature == WandSignature);
11427   if (wand->debug != MagickFalse)
11428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11429   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11430     {
11431       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11432         "ContainsNoImages","`%s'",wand->name);
11433       return((MagickWand *) NULL);
11434     }
11435   similarity_image=SimilarityImage(wand->images,reference->images,offset,
11436     similarity,&wand->images->exception);
11437   if (similarity_image == (Image *) NULL)
11438     return((MagickWand *) NULL);
11439   return(CloneMagickWandFromImages(wand,similarity_image));
11440 }
11441 \f
11442 /*
11443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11444 %                                                                             %
11445 %                                                                             %
11446 %                                                                             %
11447 %   M a g i c k S k e t c h I m a g e                                         %
11448 %                                                                             %
11449 %                                                                             %
11450 %                                                                             %
11451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11452 %
11453 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11454 %  a Gaussian operator of the given radius and standard deviation (sigma).
11455 %  For reasonable results, radius should be larger than sigma.  Use a
11456 %  radius of 0 and SketchImage() selects a suitable radius for you.
11457 %  Angle gives the angle of the blurring motion.
11458 %
11459 %  The format of the MagickSketchImage method is:
11460 %
11461 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11462 %        const double radius,const double sigma,const double angle)
11463 %
11464 %  A description of each parameter follows:
11465 %
11466 %    o wand: the magick wand.
11467 %
11468 %    o radius: the radius of the Gaussian, in pixels, not counting
11469 %      the center pixel.
11470 %
11471 %    o sigma: the standard deviation of the Gaussian, in pixels.
11472 %
11473 %    o angle: Apply the effect along this angle.
11474 %
11475 */
11476 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11477   const double radius,const double sigma,const double angle)
11478 {
11479   Image
11480     *sketch_image;
11481
11482   assert(wand != (MagickWand *) NULL);
11483   assert(wand->signature == WandSignature);
11484   if (wand->debug != MagickFalse)
11485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11486   if (wand->images == (Image *) NULL)
11487     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11488   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11489   if (sketch_image == (Image *) NULL)
11490     return(MagickFalse);
11491   ReplaceImageInList(&wand->images,sketch_image);
11492   return(MagickTrue);
11493 }
11494 \f
11495 /*
11496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11497 %                                                                             %
11498 %                                                                             %
11499 %                                                                             %
11500 %     M a g i c k S o l a r i z e I m a g e                                   %
11501 %                                                                             %
11502 %                                                                             %
11503 %                                                                             %
11504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11505 %
11506 %  MagickSolarizeImage() applies a special effect to the image, similar to the
11507 %  effect achieved in a photo darkroom by selectively exposing areas of photo
11508 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11509 %  measure of the extent of the solarization.
11510 %
11511 %  The format of the MagickSolarizeImage method is:
11512 %
11513 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11514 %        const double threshold)
11515 %
11516 %  A description of each parameter follows:
11517 %
11518 %    o wand: the magick wand.
11519 %
11520 %    o threshold:  Define the extent of the solarization.
11521 %
11522 */
11523 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11524   const double threshold)
11525 {
11526   MagickBooleanType
11527     status;
11528
11529   assert(wand != (MagickWand *) NULL);
11530   assert(wand->signature == WandSignature);
11531   if (wand->debug != MagickFalse)
11532     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11533   if (wand->images == (Image *) NULL)
11534     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11535   status=SolarizeImage(wand->images,threshold);
11536   if (status == MagickFalse)
11537     InheritException(wand->exception,&wand->images->exception);
11538   return(status);
11539 }
11540 \f
11541 /*
11542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11543 %                                                                             %
11544 %                                                                             %
11545 %                                                                             %
11546 %   M a g i c k S p a r s e C o l o r I m a g e                               %
11547 %                                                                             %
11548 %                                                                             %
11549 %                                                                             %
11550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11551 %
11552 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
11553 %  colors found at those coordinates, across the whole image, using various
11554 %  methods.
11555 %
11556 %  The format of the MagickSparseColorImage method is:
11557 %
11558 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11559 %        const ChannelType channel,const SparseColorMethod method,
11560 %        const size_t number_arguments,const double *arguments)
11561 %
11562 %  A description of each parameter follows:
11563 %
11564 %    o image: the image to be sparseed.
11565 %
11566 %    o method: the method of image sparseion.
11567 %
11568 %        ArcSparseColorion will always ignore source image offset, and always
11569 %        'bestfit' the destination image with the top left corner offset
11570 %        relative to the polar mapping center.
11571 %
11572 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11573 %        style of image sparseion.
11574 %
11575 %        Affine, Perspective, and Bilinear, will do least squares fitting of
11576 %        the distrotion when more than the minimum number of control point
11577 %        pairs are provided.
11578 %
11579 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
11580 %        less than 4 control point pairs are provided. While Affine sparseions
11581 %        will let you use any number of control point pairs, that is Zero pairs
11582 %        is a No-Op (viewport only) distrotion, one pair is a translation and
11583 %        two pairs of control points will do a scale-rotate-translate, without
11584 %        any shearing.
11585 %
11586 %    o number_arguments: the number of arguments given for this sparseion
11587 %      method.
11588 %
11589 %    o arguments: the arguments for this sparseion method.
11590 %
11591 */
11592 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11593   const ChannelType channel,const SparseColorMethod method,
11594   const size_t number_arguments,const double *arguments)
11595 {
11596   Image
11597     *sparse_image;
11598
11599   assert(wand != (MagickWand *) NULL);
11600   assert(wand->signature == WandSignature);
11601   if (wand->debug != MagickFalse)
11602     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11603   if (wand->images == (Image *) NULL)
11604     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11605   sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11606     arguments,wand->exception);
11607   if (sparse_image == (Image *) NULL)
11608     return(MagickFalse);
11609   ReplaceImageInList(&wand->images,sparse_image);
11610   return(MagickTrue);
11611 }
11612 \f
11613 /*
11614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11615 %                                                                             %
11616 %                                                                             %
11617 %                                                                             %
11618 %   M a g i c k S p l i c e I m a g e                                         %
11619 %                                                                             %
11620 %                                                                             %
11621 %                                                                             %
11622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11623 %
11624 %  MagickSpliceImage() splices a solid color into the image.
11625 %
11626 %  The format of the MagickSpliceImage method is:
11627 %
11628 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11629 %        const size_t width,const size_t height,const ssize_t x,
11630 %        const ssize_t y)
11631 %
11632 %  A description of each parameter follows:
11633 %
11634 %    o wand: the magick wand.
11635 %
11636 %    o width: the region width.
11637 %
11638 %    o height: the region height.
11639 %
11640 %    o x: the region x offset.
11641 %
11642 %    o y: the region y offset.
11643 %
11644 */
11645 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11646   const size_t width,const size_t height,const ssize_t x,
11647   const ssize_t y)
11648 {
11649   Image
11650     *splice_image;
11651
11652   RectangleInfo
11653     splice;
11654
11655   assert(wand != (MagickWand *) NULL);
11656   assert(wand->signature == WandSignature);
11657   if (wand->debug != MagickFalse)
11658     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11659   if (wand->images == (Image *) NULL)
11660     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11661   splice.width=width;
11662   splice.height=height;
11663   splice.x=x;
11664   splice.y=y;
11665   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11666   if (splice_image == (Image *) NULL)
11667     return(MagickFalse);
11668   ReplaceImageInList(&wand->images,splice_image);
11669   return(MagickTrue);
11670 }
11671 \f
11672 /*
11673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11674 %                                                                             %
11675 %                                                                             %
11676 %                                                                             %
11677 %   M a g i c k S p r e a d I m a g e                                         %
11678 %                                                                             %
11679 %                                                                             %
11680 %                                                                             %
11681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11682 %
11683 %  MagickSpreadImage() is a special effects method that randomly displaces each
11684 %  pixel in a block defined by the radius parameter.
11685 %
11686 %  The format of the MagickSpreadImage method is:
11687 %
11688 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11689 %
11690 %  A description of each parameter follows:
11691 %
11692 %    o wand: the magick wand.
11693 %
11694 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11695 %
11696 */
11697 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11698   const double radius)
11699 {
11700   Image
11701     *spread_image;
11702
11703   assert(wand != (MagickWand *) NULL);
11704   assert(wand->signature == WandSignature);
11705   if (wand->debug != MagickFalse)
11706     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11707   if (wand->images == (Image *) NULL)
11708     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11709   spread_image=SpreadImage(wand->images,radius,wand->exception);
11710   if (spread_image == (Image *) NULL)
11711     return(MagickFalse);
11712   ReplaceImageInList(&wand->images,spread_image);
11713   return(MagickTrue);
11714 }
11715 \f
11716 /*
11717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11718 %                                                                             %
11719 %                                                                             %
11720 %                                                                             %
11721 %   M a g i c k S t e g a n o I m a g e                                       %
11722 %                                                                             %
11723 %                                                                             %
11724 %                                                                             %
11725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11726 %
11727 %  MagickSteganoImage() hides a digital watermark within the image.
11728 %  Recover the hidden watermark later to prove that the authenticity of
11729 %  an image.  Offset defines the start position within the image to hide
11730 %  the watermark.
11731 %
11732 %  The format of the MagickSteganoImage method is:
11733 %
11734 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11735 %        const MagickWand *watermark_wand,const ssize_t offset)
11736 %
11737 %  A description of each parameter follows:
11738 %
11739 %    o wand: the magick wand.
11740 %
11741 %    o watermark_wand: the watermark wand.
11742 %
11743 %    o offset: Start hiding at this offset into the image.
11744 %
11745 */
11746 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11747   const MagickWand *watermark_wand,const ssize_t offset)
11748 {
11749   Image
11750     *stegano_image;
11751
11752   assert(wand != (MagickWand *) NULL);
11753   assert(wand->signature == WandSignature);
11754   if (wand->debug != MagickFalse)
11755     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11756   if ((wand->images == (Image *) NULL) ||
11757       (watermark_wand->images == (Image *) NULL))
11758     {
11759       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11760         "ContainsNoImages","`%s'",wand->name);
11761       return((MagickWand *) NULL);
11762     }
11763   wand->images->offset=offset;
11764   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11765     wand->exception);
11766   if (stegano_image == (Image *) NULL)
11767     return((MagickWand *) NULL);
11768   return(CloneMagickWandFromImages(wand,stegano_image));
11769 }
11770 \f
11771 /*
11772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11773 %                                                                             %
11774 %                                                                             %
11775 %                                                                             %
11776 %   M a g i c k S t e r e o I m a g e                                         %
11777 %                                                                             %
11778 %                                                                             %
11779 %                                                                             %
11780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11781 %
11782 %  MagickStereoImage() composites two images and produces a single image that
11783 %  is the composite of a left and right image of a stereo pair
11784 %
11785 %  The format of the MagickStereoImage method is:
11786 %
11787 %      MagickWand *MagickStereoImage(MagickWand *wand,
11788 %        const MagickWand *offset_wand)
11789 %
11790 %  A description of each parameter follows:
11791 %
11792 %    o wand: the magick wand.
11793 %
11794 %    o offset_wand: Another image wand.
11795 %
11796 */
11797 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11798   const MagickWand *offset_wand)
11799 {
11800   Image
11801     *stereo_image;
11802
11803   assert(wand != (MagickWand *) NULL);
11804   assert(wand->signature == WandSignature);
11805   if (wand->debug != MagickFalse)
11806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11807   if ((wand->images == (Image *) NULL) ||
11808       (offset_wand->images == (Image *) NULL))
11809     {
11810       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11811         "ContainsNoImages","`%s'",wand->name);
11812       return((MagickWand *) NULL);
11813     }
11814   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11815   if (stereo_image == (Image *) NULL)
11816     return((MagickWand *) NULL);
11817   return(CloneMagickWandFromImages(wand,stereo_image));
11818 }
11819 \f
11820 /*
11821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11822 %                                                                             %
11823 %                                                                             %
11824 %                                                                             %
11825 %   M a g i c k S t r i p I m a g e                                           %
11826 %                                                                             %
11827 %                                                                             %
11828 %                                                                             %
11829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11830 %
11831 %  MagickStripImage() strips an image of all profiles and comments.
11832 %
11833 %  The format of the MagickStripImage method is:
11834 %
11835 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11836 %
11837 %  A description of each parameter follows:
11838 %
11839 %    o wand: the magick wand.
11840 %
11841 */
11842 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11843 {
11844   MagickBooleanType
11845     status;
11846
11847   assert(wand != (MagickWand *) NULL);
11848   assert(wand->signature == WandSignature);
11849   if (wand->debug != MagickFalse)
11850     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11851   if (wand->images == (Image *) NULL)
11852     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11853   status=StripImage(wand->images);
11854   if (status == MagickFalse)
11855     InheritException(wand->exception,&wand->images->exception);
11856   return(status);
11857 }
11858 \f
11859 /*
11860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11861 %                                                                             %
11862 %                                                                             %
11863 %                                                                             %
11864 %   M a g i c k S w i r l I m a g e                                           %
11865 %                                                                             %
11866 %                                                                             %
11867 %                                                                             %
11868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11869 %
11870 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11871 %  degrees indicates the sweep of the arc through which each pixel is moved.
11872 %  You get a more dramatic effect as the degrees move from 1 to 360.
11873 %
11874 %  The format of the MagickSwirlImage method is:
11875 %
11876 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11877 %
11878 %  A description of each parameter follows:
11879 %
11880 %    o wand: the magick wand.
11881 %
11882 %    o degrees: Define the tightness of the swirling effect.
11883 %
11884 */
11885 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11886   const double degrees)
11887 {
11888   Image
11889     *swirl_image;
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     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11897   swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11898   if (swirl_image == (Image *) NULL)
11899     return(MagickFalse);
11900   ReplaceImageInList(&wand->images,swirl_image);
11901   return(MagickTrue);
11902 }
11903 \f
11904 /*
11905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11906 %                                                                             %
11907 %                                                                             %
11908 %                                                                             %
11909 %   M a g i c k T e x t u r e I m a g e                                       %
11910 %                                                                             %
11911 %                                                                             %
11912 %                                                                             %
11913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11914 %
11915 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11916 %  image canvas.
11917 %
11918 %  The format of the MagickTextureImage method is:
11919 %
11920 %      MagickWand *MagickTextureImage(MagickWand *wand,
11921 %        const MagickWand *texture_wand)
11922 %
11923 %  A description of each parameter follows:
11924 %
11925 %    o wand: the magick wand.
11926 %
11927 %    o texture_wand: the texture wand
11928 %
11929 */
11930 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11931   const MagickWand *texture_wand)
11932 {
11933   Image
11934     *texture_image;
11935
11936   MagickBooleanType
11937     status;
11938
11939   assert(wand != (MagickWand *) NULL);
11940   assert(wand->signature == WandSignature);
11941   if (wand->debug != MagickFalse)
11942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11943   if ((wand->images == (Image *) NULL) ||
11944       (texture_wand->images == (Image *) NULL))
11945     {
11946       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11947         "ContainsNoImages","`%s'",wand->name);
11948       return((MagickWand *) NULL);
11949     }
11950   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11951   if (texture_image == (Image *) NULL)
11952     return((MagickWand *) NULL);
11953   status=TextureImage(texture_image,texture_wand->images);
11954   if (status == MagickFalse)
11955     {
11956       InheritException(wand->exception,&texture_image->exception);
11957       texture_image=DestroyImage(texture_image);
11958       return((MagickWand *) NULL);
11959     }
11960   return(CloneMagickWandFromImages(wand,texture_image));
11961 }
11962 \f
11963 /*
11964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11965 %                                                                             %
11966 %                                                                             %
11967 %                                                                             %
11968 %   M a g i c k T h r e s h o l d I m a g e                                   %
11969 %                                                                             %
11970 %                                                                             %
11971 %                                                                             %
11972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11973 %
11974 %  MagickThresholdImage() changes the value of individual pixels based on
11975 %  the intensity of each pixel compared to threshold.  The result is a
11976 %  high-contrast, two color image.
11977 %
11978 %  The format of the MagickThresholdImage method is:
11979 %
11980 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11981 %        const double threshold)
11982 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11983 %        const ChannelType channel,const double threshold)
11984 %
11985 %  A description of each parameter follows:
11986 %
11987 %    o wand: the magick wand.
11988 %
11989 %    o channel: the image channel(s).
11990 %
11991 %    o threshold: Define the threshold value.
11992 %
11993 */
11994 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11995   const double threshold)
11996 {
11997   MagickBooleanType
11998     status;
11999
12000   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12001   return(status);
12002 }
12003
12004 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12005   const ChannelType channel,const double threshold)
12006 {
12007   MagickBooleanType
12008     status;
12009
12010   assert(wand != (MagickWand *) NULL);
12011   assert(wand->signature == WandSignature);
12012   if (wand->debug != MagickFalse)
12013     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12014   if (wand->images == (Image *) NULL)
12015     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12016   status=BilevelImageChannel(wand->images,channel,threshold);
12017   if (status == MagickFalse)
12018     InheritException(wand->exception,&wand->images->exception);
12019   return(status);
12020 }
12021 \f
12022 /*
12023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12024 %                                                                             %
12025 %                                                                             %
12026 %                                                                             %
12027 %   M a g i c k T h u m b n a i l I m a g e                                   %
12028 %                                                                             %
12029 %                                                                             %
12030 %                                                                             %
12031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12032 %
12033 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
12034 %  and removes any associated profiles.  The goal is to produce small low cost
12035 %  thumbnail images suited for display on the Web.
12036 %
12037 %  The format of the MagickThumbnailImage method is:
12038 %
12039 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12040 %        const size_t columns,const size_t rows)
12041 %
12042 %  A description of each parameter follows:
12043 %
12044 %    o wand: the magick wand.
12045 %
12046 %    o columns: the number of columns in the scaled image.
12047 %
12048 %    o rows: the number of rows in the scaled image.
12049 %
12050 */
12051 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12052   const size_t columns,const size_t rows)
12053 {
12054   Image
12055     *thumbnail_image;
12056
12057   assert(wand != (MagickWand *) NULL);
12058   assert(wand->signature == WandSignature);
12059   if (wand->debug != MagickFalse)
12060     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12061   if (wand->images == (Image *) NULL)
12062     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12063   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12064   if (thumbnail_image == (Image *) NULL)
12065     return(MagickFalse);
12066   ReplaceImageInList(&wand->images,thumbnail_image);
12067   return(MagickTrue);
12068 }
12069 \f
12070 /*
12071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12072 %                                                                             %
12073 %                                                                             %
12074 %                                                                             %
12075 %   M a g i c k T i n t I m a g e                                             %
12076 %                                                                             %
12077 %                                                                             %
12078 %                                                                             %
12079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12080 %
12081 %  MagickTintImage() applies a color vector to each pixel in the image.  The
12082 %  length of the vector is 0 for black and white and at its maximum for the
12083 %  midtones.  The vector weighting function is
12084 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12085 %
12086 %  The format of the MagickTintImage method is:
12087 %
12088 %      MagickBooleanType MagickTintImage(MagickWand *wand,
12089 %        const PixelWand *tint,const PixelWand *opacity)
12090 %
12091 %  A description of each parameter follows:
12092 %
12093 %    o wand: the magick wand.
12094 %
12095 %    o tint: the tint pixel wand.
12096 %
12097 %    o opacity: the opacity pixel wand.
12098 %
12099 */
12100 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12101   const PixelWand *tint,const PixelWand *opacity)
12102 {
12103   char
12104     percent_opaque[MaxTextExtent];
12105
12106   Image
12107     *tint_image;
12108
12109   PixelPacket
12110     target;
12111
12112   assert(wand != (MagickWand *) NULL);
12113   assert(wand->signature == WandSignature);
12114   if (wand->debug != MagickFalse)
12115     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12116   if (wand->images == (Image *) NULL)
12117     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12118   (void) FormatMagickString(percent_opaque,MaxTextExtent,
12119     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12120     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12121     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12122     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12123     PixelGetOpacityQuantum(opacity)));
12124   PixelGetQuantumColor(tint,&target);
12125   tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12126   if (tint_image == (Image *) NULL)
12127     return(MagickFalse);
12128   ReplaceImageInList(&wand->images,tint_image);
12129   return(MagickTrue);
12130 }
12131 \f
12132 /*
12133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12134 %                                                                             %
12135 %                                                                             %
12136 %                                                                             %
12137 %   M a g i c k T r a n s f o r m I m a g e                                   %
12138 %                                                                             %
12139 %                                                                             %
12140 %                                                                             %
12141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12142 %
12143 %  MagickTransformImage() is a convenience method that behaves like
12144 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12145 %  information as a region geometry specification.  If the operation fails,
12146 %  a NULL image handle is returned.
12147 %
12148 %  The format of the MagickTransformImage method is:
12149 %
12150 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12151 %        const char *geometry)
12152 %
12153 %  A description of each parameter follows:
12154 %
12155 %    o wand: the magick wand.
12156 %
12157 %    o crop: A crop geometry string.  This geometry defines a subregion of the
12158 %      image to crop.
12159 %
12160 %    o geometry: An image geometry string.  This geometry defines the final
12161 %      size of the image.
12162 %
12163 */
12164 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12165   const char *crop,const char *geometry)
12166 {
12167   Image
12168     *transform_image;
12169
12170   MagickBooleanType
12171     status;
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     return((MagickWand *) NULL);
12179   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12180   if (transform_image == (Image *) NULL)
12181     return((MagickWand *) NULL);
12182   status=TransformImage(&transform_image,crop,geometry);
12183   if (status == MagickFalse)
12184     {
12185       InheritException(wand->exception,&transform_image->exception);
12186       transform_image=DestroyImage(transform_image);
12187       return((MagickWand *) NULL);
12188     }
12189   return(CloneMagickWandFromImages(wand,transform_image));
12190 }
12191 \f
12192 /*
12193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12194 %                                                                             %
12195 %                                                                             %
12196 %                                                                             %
12197 %   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               %
12198 %                                                                             %
12199 %                                                                             %
12200 %                                                                             %
12201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12202 %
12203 %  MagickTransformImageColorspace() transform the image colorspace.
12204 %
12205 %  The format of the MagickTransformImageColorspace method is:
12206 %
12207 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12208 %        const ColorspaceType colorspace)
12209 %
12210 %  A description of each parameter follows:
12211 %
12212 %    o wand: the magick wand.
12213 %
12214 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
12215 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
12216 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
12217 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
12218 %      HSLColorspace, or HWBColorspace.
12219 %
12220 */
12221 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12222   const ColorspaceType colorspace)
12223 {
12224   assert(wand != (MagickWand *) NULL);
12225   assert(wand->signature == WandSignature);
12226   if (wand->debug != MagickFalse)
12227     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12228   if (wand->images == (Image *) NULL)
12229     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12230   return(TransformImageColorspace(wand->images,colorspace));
12231 }
12232 \f
12233 /*
12234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12235 %                                                                             %
12236 %                                                                             %
12237 %                                                                             %
12238 %   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                     %
12239 %                                                                             %
12240 %                                                                             %
12241 %                                                                             %
12242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12243 %
12244 %  MagickTransparentPaintImage() changes any pixel that matches color with the
12245 %  color defined by fill.
12246 %
12247 %  The format of the MagickTransparentPaintImage method is:
12248 %
12249 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12250 %        const PixelWand *target,const double alpha,const double fuzz,
12251 %        const MagickBooleanType invert)
12252 %
12253 %  A description of each parameter follows:
12254 %
12255 %    o wand: the magick wand.
12256 %
12257 %    o target: Change this target color to specified opacity value within
12258 %      the image.
12259 %
12260 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12261 %      transparent.
12262 %
12263 %    o fuzz: By default target must match a particular pixel color
12264 %      exactly.  However, in many cases two colors may differ by a small amount.
12265 %      The fuzz member of image defines how much tolerance is acceptable to
12266 %      consider two colors as the same.  For example, set fuzz to 10 and the
12267 %      color red at intensities of 100 and 102 respectively are now interpreted
12268 %      as the same color for the purposes of the floodfill.
12269 %
12270 %    o invert: paint any pixel that does not match the target color.
12271 %
12272 */
12273 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12274   const PixelWand *target,const double alpha,const double fuzz,
12275   const MagickBooleanType invert)
12276 {
12277   MagickBooleanType
12278     status;
12279
12280   MagickPixelPacket
12281     target_pixel;
12282
12283   assert(wand != (MagickWand *) NULL);
12284   assert(wand->signature == WandSignature);
12285   if (wand->debug != MagickFalse)
12286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12287   if (wand->images == (Image *) NULL)
12288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12289   PixelGetMagickColor(target,&target_pixel);
12290   wand->images->fuzz=fuzz;
12291   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12292     (MagickRealType) QuantumRange-QuantumRange*alpha),invert);
12293   if (status == MagickFalse)
12294     InheritException(wand->exception,&wand->images->exception);
12295   return(status);
12296 }
12297 \f
12298 /*
12299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12300 %                                                                             %
12301 %                                                                             %
12302 %                                                                             %
12303 %   M a g i c k T r a n s p o s e I m a g e                                   %
12304 %                                                                             %
12305 %                                                                             %
12306 %                                                                             %
12307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12308 %
12309 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
12310 %  pixels around the central x-axis while rotating them 90-degrees.
12311 %
12312 %  The format of the MagickTransposeImage method is:
12313 %
12314 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12315 %
12316 %  A description of each parameter follows:
12317 %
12318 %    o wand: the magick wand.
12319 %
12320 */
12321 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12322 {
12323   Image
12324     *transpose_image;
12325
12326   assert(wand != (MagickWand *) NULL);
12327   assert(wand->signature == WandSignature);
12328   if (wand->debug != MagickFalse)
12329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12330   if (wand->images == (Image *) NULL)
12331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12332   transpose_image=TransposeImage(wand->images,wand->exception);
12333   if (transpose_image == (Image *) NULL)
12334     return(MagickFalse);
12335   ReplaceImageInList(&wand->images,transpose_image);
12336   return(MagickTrue);
12337 }
12338 \f
12339 /*
12340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12341 %                                                                             %
12342 %                                                                             %
12343 %                                                                             %
12344 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12345 %                                                                             %
12346 %                                                                             %
12347 %                                                                             %
12348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12349 %
12350 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12351 %  pixels around the central y-axis while rotating them 270-degrees.
12352 %
12353 %  The format of the MagickTransverseImage method is:
12354 %
12355 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12356 %
12357 %  A description of each parameter follows:
12358 %
12359 %    o wand: the magick wand.
12360 %
12361 */
12362 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12363 {
12364   Image
12365     *transverse_image;
12366
12367   assert(wand != (MagickWand *) NULL);
12368   assert(wand->signature == WandSignature);
12369   if (wand->debug != MagickFalse)
12370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12371   if (wand->images == (Image *) NULL)
12372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12373   transverse_image=TransverseImage(wand->images,wand->exception);
12374   if (transverse_image == (Image *) NULL)
12375     return(MagickFalse);
12376   ReplaceImageInList(&wand->images,transverse_image);
12377   return(MagickTrue);
12378 }
12379 \f
12380 /*
12381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12382 %                                                                             %
12383 %                                                                             %
12384 %                                                                             %
12385 %   M a g i c k T r i m I m a g e                                             %
12386 %                                                                             %
12387 %                                                                             %
12388 %                                                                             %
12389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12390 %
12391 %  MagickTrimImage() remove edges that are the background color from the image.
12392 %
12393 %  The format of the MagickTrimImage method is:
12394 %
12395 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12396 %
12397 %  A description of each parameter follows:
12398 %
12399 %    o wand: the magick wand.
12400 %
12401 %    o fuzz: By default target must match a particular pixel color
12402 %      exactly.  However, in many cases two colors may differ by a small amount.
12403 %      The fuzz member of image defines how much tolerance is acceptable to
12404 %      consider two colors as the same.  For example, set fuzz to 10 and the
12405 %      color red at intensities of 100 and 102 respectively are now interpreted
12406 %      as the same color for the purposes of the floodfill.
12407 %
12408 */
12409 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12410 {
12411   Image
12412     *trim_image;
12413
12414   assert(wand != (MagickWand *) NULL);
12415   assert(wand->signature == WandSignature);
12416   if (wand->debug != MagickFalse)
12417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12418   if (wand->images == (Image *) NULL)
12419     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12420   wand->images->fuzz=fuzz;
12421   trim_image=TrimImage(wand->images,wand->exception);
12422   if (trim_image == (Image *) NULL)
12423     return(MagickFalse);
12424   ReplaceImageInList(&wand->images,trim_image);
12425   return(MagickTrue);
12426 }
12427 \f
12428 /*
12429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12430 %                                                                             %
12431 %                                                                             %
12432 %                                                                             %
12433 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
12434 %                                                                             %
12435 %                                                                             %
12436 %                                                                             %
12437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12438 %
12439 %  MagickUniqueImageColors() discards all but one of any pixel color.
12440 %
12441 %  The format of the MagickUniqueImageColors method is:
12442 %
12443 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12444 %
12445 %  A description of each parameter follows:
12446 %
12447 %    o wand: the magick wand.
12448 %
12449 */
12450 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12451 {
12452   Image
12453     *unique_image;
12454
12455   assert(wand != (MagickWand *) NULL);
12456   assert(wand->signature == WandSignature);
12457   if (wand->debug != MagickFalse)
12458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12459   if (wand->images == (Image *) NULL)
12460     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12461   unique_image=UniqueImageColors(wand->images,wand->exception);
12462   if (unique_image == (Image *) NULL)
12463     return(MagickFalse);
12464   ReplaceImageInList(&wand->images,unique_image);
12465   return(MagickTrue);
12466 }
12467 \f
12468 /*
12469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12470 %                                                                             %
12471 %                                                                             %
12472 %                                                                             %
12473 %   M a g i c k U n s h a r p M a s k I m a g e                               %
12474 %                                                                             %
12475 %                                                                             %
12476 %                                                                             %
12477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12478 %
12479 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12480 %  Gaussian operator of the given radius and standard deviation (sigma).
12481 %  For reasonable results, radius should be larger than sigma.  Use a radius
12482 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12483 %
12484 %  The format of the MagickUnsharpMaskImage method is:
12485 %
12486 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12487 %        const double radius,const double sigma,const double amount,
12488 %        const double threshold)
12489 %      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12490 %        const ChannelType channel,const double radius,const double sigma,
12491 %        const double amount,const double threshold)
12492 %
12493 %  A description of each parameter follows:
12494 %
12495 %    o wand: the magick wand.
12496 %
12497 %    o channel: the image channel(s).
12498 %
12499 %    o radius: the radius of the Gaussian, in pixels, not counting the center
12500 %      pixel.
12501 %
12502 %    o sigma: the standard deviation of the Gaussian, in pixels.
12503 %
12504 %    o amount: the percentage of the difference between the original and the
12505 %      blur image that is added back into the original.
12506 %
12507 %    o threshold: the threshold in pixels needed to apply the diffence amount.
12508 %
12509 */
12510
12511 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12512   const double radius,const double sigma,const double amount,
12513   const double threshold)
12514 {
12515   MagickBooleanType
12516     status;
12517
12518   status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12519     amount,threshold);
12520   return(status);
12521 }
12522
12523 WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12524   const ChannelType channel,const double radius,const double sigma,
12525   const double amount,const double threshold)
12526 {
12527   Image
12528     *unsharp_image;
12529
12530   assert(wand != (MagickWand *) NULL);
12531   assert(wand->signature == WandSignature);
12532   if (wand->debug != MagickFalse)
12533     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12534   if (wand->images == (Image *) NULL)
12535     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12536   unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12537     amount,threshold,wand->exception);
12538   if (unsharp_image == (Image *) NULL)
12539     return(MagickFalse);
12540   ReplaceImageInList(&wand->images,unsharp_image);
12541   return(MagickTrue);
12542 }
12543 \f
12544 /*
12545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12546 %                                                                             %
12547 %                                                                             %
12548 %                                                                             %
12549 %   M a g i c k V i g n e t t e I m a g e                                     %
12550 %                                                                             %
12551 %                                                                             %
12552 %                                                                             %
12553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12554 %
12555 %  MagickVignetteImage() softens the edges of the image in vignette style.
12556 %
12557 %  The format of the MagickVignetteImage method is:
12558 %
12559 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12560 %        const double black_point,const double white_point,const ssize_t x,
12561 %        const ssize_t y)
12562 %
12563 %  A description of each parameter follows:
12564 %
12565 %    o wand: the magick wand.
12566 %
12567 %    o black_point: the black point.
12568 %
12569 %    o white_point: the white point.
12570 %
12571 %    o x, y:  Define the x and y ellipse offset.
12572 %
12573 */
12574 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12575   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
12576 {
12577   Image
12578     *vignette_image;
12579
12580   assert(wand != (MagickWand *) NULL);
12581   assert(wand->signature == WandSignature);
12582   if (wand->debug != MagickFalse)
12583     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12584   if (wand->images == (Image *) NULL)
12585     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12586   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12587     wand->exception);
12588   if (vignette_image == (Image *) NULL)
12589     return(MagickFalse);
12590   ReplaceImageInList(&wand->images,vignette_image);
12591   return(MagickTrue);
12592 }
12593 \f
12594 /*
12595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12596 %                                                                             %
12597 %                                                                             %
12598 %                                                                             %
12599 %   M a g i c k W a v e I m a g e                                             %
12600 %                                                                             %
12601 %                                                                             %
12602 %                                                                             %
12603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12604 %
12605 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12606 %  the pixels vertically along a sine wave whose amplitude and wavelength
12607 %  is specified by the given parameters.
12608 %
12609 %  The format of the MagickWaveImage method is:
12610 %
12611 %      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12612 %        const double wave_length)
12613 %
12614 %  A description of each parameter follows:
12615 %
12616 %    o wand: the magick wand.
12617 %
12618 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12619 %      sine wave.
12620 %
12621 */
12622 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12623   const double amplitude,const double wave_length)
12624 {
12625   Image
12626     *wave_image;
12627
12628   assert(wand != (MagickWand *) NULL);
12629   assert(wand->signature == WandSignature);
12630   if (wand->debug != MagickFalse)
12631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12632   if (wand->images == (Image *) NULL)
12633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12634   wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12635   if (wave_image == (Image *) NULL)
12636     return(MagickFalse);
12637   ReplaceImageInList(&wand->images,wave_image);
12638   return(MagickTrue);
12639 }
12640 \f
12641 /*
12642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12643 %                                                                             %
12644 %                                                                             %
12645 %                                                                             %
12646 %   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                         %
12647 %                                                                             %
12648 %                                                                             %
12649 %                                                                             %
12650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12651 %
12652 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12653 %  above the threshold into white while leaving all pixels below the threshold
12654 %  unchanged.
12655 %
12656 %  The format of the MagickWhiteThresholdImage method is:
12657 %
12658 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12659 %        const PixelWand *threshold)
12660 %
12661 %  A description of each parameter follows:
12662 %
12663 %    o wand: the magick wand.
12664 %
12665 %    o threshold: the pixel wand.
12666 %
12667 */
12668 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12669   const PixelWand *threshold)
12670 {
12671   char
12672     thresholds[MaxTextExtent];
12673
12674   MagickBooleanType
12675     status;
12676
12677   assert(wand != (MagickWand *) NULL);
12678   assert(wand->signature == WandSignature);
12679   if (wand->debug != MagickFalse)
12680     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12681   if (wand->images == (Image *) NULL)
12682     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12683   (void) FormatMagickString(thresholds,MaxTextExtent,
12684     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12685     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12686     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12687   status=WhiteThresholdImage(wand->images,thresholds);
12688   if (status == MagickFalse)
12689     InheritException(wand->exception,&wand->images->exception);
12690   return(status);
12691 }
12692 \f
12693 /*
12694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12695 %                                                                             %
12696 %                                                                             %
12697 %                                                                             %
12698 %   M a g i c k W r i t e I m a g e                                           %
12699 %                                                                             %
12700 %                                                                             %
12701 %                                                                             %
12702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12703 %
12704 %  MagickWriteImage() writes an image to the specified filename.  If the
12705 %  filename parameter is NULL, the image is written to the filename set
12706 %  by MagickReadImage() or MagickSetImageFilename().
12707 %
12708 %  The format of the MagickWriteImage method is:
12709 %
12710 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12711 %        const char *filename)
12712 %
12713 %  A description of each parameter follows:
12714 %
12715 %    o wand: the magick wand.
12716 %
12717 %    o filename: the image filename.
12718 %
12719 %
12720 */
12721 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12722   const char *filename)
12723 {
12724   Image
12725     *image;
12726
12727   ImageInfo
12728     *write_info;
12729
12730   MagickBooleanType
12731     status;
12732
12733   assert(wand != (MagickWand *) NULL);
12734   assert(wand->signature == WandSignature);
12735   if (wand->debug != MagickFalse)
12736     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12737   if (wand->images == (Image *) NULL)
12738     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12739   if (filename != (const char *) NULL)
12740     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12741   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12742   if (image == (Image *) NULL)
12743     return(MagickFalse);
12744   write_info=CloneImageInfo(wand->image_info);
12745   write_info->adjoin=MagickTrue;
12746   status=WriteImage(write_info,image);
12747   if (status == MagickFalse)
12748     InheritException(wand->exception,&image->exception);
12749   image=DestroyImage(image);
12750   write_info=DestroyImageInfo(write_info);
12751   return(status);
12752 }
12753 \f
12754 /*
12755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12756 %                                                                             %
12757 %                                                                             %
12758 %                                                                             %
12759 %   M a g i c k W r i t e I m a g e F i l e                                   %
12760 %                                                                             %
12761 %                                                                             %
12762 %                                                                             %
12763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12764 %
12765 %  MagickWriteImageFile() writes an image to an open file descriptor.
12766 %
12767 %  The format of the MagickWriteImageFile method is:
12768 %
12769 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12770 %
12771 %  A description of each parameter follows:
12772 %
12773 %    o wand: the magick wand.
12774 %
12775 %    o file: the file descriptor.
12776 %
12777 */
12778 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12779 {
12780   Image
12781     *image;
12782
12783   ImageInfo
12784     *write_info;
12785
12786   MagickBooleanType
12787     status;
12788
12789   assert(wand != (MagickWand *) NULL);
12790   assert(wand->signature == WandSignature);
12791   assert(file != (FILE *) NULL);
12792   if (wand->debug != MagickFalse)
12793     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12794   if (wand->images == (Image *) NULL)
12795     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12796   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12797   if (image == (Image *) NULL)
12798     return(MagickFalse);
12799   write_info=CloneImageInfo(wand->image_info);
12800   SetImageInfoFile(write_info,file);
12801   write_info->adjoin=MagickTrue;
12802   status=WriteImage(write_info,image);
12803   write_info=DestroyImageInfo(write_info);
12804   if (status == MagickFalse)
12805     InheritException(wand->exception,&image->exception);
12806   image=DestroyImage(image);
12807   return(status);
12808 }
12809 \f
12810 /*
12811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12812 %                                                                             %
12813 %                                                                             %
12814 %                                                                             %
12815 %   M a g i c k W r i t e I m a g e s                                         %
12816 %                                                                             %
12817 %                                                                             %
12818 %                                                                             %
12819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12820 %
12821 %  MagickWriteImages() writes an image or image sequence.
12822 %
12823 %  The format of the MagickWriteImages method is:
12824 %
12825 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12826 %        const char *filename,const MagickBooleanType adjoin)
12827 %
12828 %  A description of each parameter follows:
12829 %
12830 %    o wand: the magick wand.
12831 %
12832 %    o filename: the image filename.
12833 %
12834 %    o adjoin: join images into a single multi-image file.
12835 %
12836 */
12837 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12838   const char *filename,const MagickBooleanType adjoin)
12839 {
12840   ImageInfo
12841     *write_info;
12842
12843   MagickBooleanType
12844     status;
12845
12846   assert(wand != (MagickWand *) NULL);
12847   assert(wand->signature == WandSignature);
12848   if (wand->debug != MagickFalse)
12849     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12850   if (wand->images == (Image *) NULL)
12851     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12852   write_info=CloneImageInfo(wand->image_info);
12853   write_info->adjoin=adjoin;
12854   status=WriteImages(write_info,wand->images,filename,wand->exception);
12855   if (status == MagickFalse)
12856     InheritException(wand->exception,&wand->images->exception);
12857   write_info=DestroyImageInfo(write_info);
12858   return(status);
12859 }
12860 \f
12861 /*
12862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12863 %                                                                             %
12864 %                                                                             %
12865 %                                                                             %
12866 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12867 %                                                                             %
12868 %                                                                             %
12869 %                                                                             %
12870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12871 %
12872 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12873 %
12874 %  The format of the MagickWriteImagesFile method is:
12875 %
12876 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12877 %
12878 %  A description of each parameter follows:
12879 %
12880 %    o wand: the magick wand.
12881 %
12882 %    o file: the file descriptor.
12883 %
12884 */
12885 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12886 {
12887   ImageInfo
12888     *write_info;
12889
12890   MagickBooleanType
12891     status;
12892
12893   assert(wand != (MagickWand *) NULL);
12894   assert(wand->signature == WandSignature);
12895   if (wand->debug != MagickFalse)
12896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12897   if (wand->images == (Image *) NULL)
12898     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12899   write_info=CloneImageInfo(wand->image_info);
12900   SetImageInfoFile(write_info,file);
12901   write_info->adjoin=MagickTrue;
12902   status=WriteImages(write_info,wand->images,(const char *) NULL,
12903     wand->exception);
12904   write_info=DestroyImageInfo(write_info);
12905   if (status == MagickFalse)
12906     InheritException(wand->exception,&wand->images->exception);
12907   return(status);
12908 }