MagickWand  7.0.3
magick-image.c
Go to the documentation of this file.
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 % Cristy %
23 % August 2003 %
24 % %
25 % %
26 % Copyright 1999-2019 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 % https://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 
46 /*
47  Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
52 #include "MagickWand/wand.h"
54 #include "MagickCore/image-private.h"
55 
56 /*
57  Define declarations.
58 */
59 #define MagickWandId "MagickWand"
60 
61 /*
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % %
64 % %
65 % %
66 + 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 %
67 % %
68 % %
69 % %
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %
72 % CloneMagickWandFromImages() clones the magick wand and inserts a new image
73 % list.
74 %
75 % The format of the CloneMagickWandFromImages method is:
76 %
77 % MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
78 % Image *images)
79 %
80 % A description of each parameter follows:
81 %
82 % o wand: the magick wand.
83 %
84 % o images: replace the image list with these image(s).
85 %
86 */
88  Image *images)
89 {
91  *clone_wand;
92 
93  assert(wand != (MagickWand *) NULL);
94  assert(wand->signature == MagickWandSignature);
95  if (wand->debug != MagickFalse)
96  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
97  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
98  if (clone_wand == (MagickWand *) NULL)
99  ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
100  images->filename);
101  (void) memset(clone_wand,0,sizeof(*clone_wand));
102  clone_wand->id=AcquireWandId();
103  (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
104  MagickWandId,(double) clone_wand->id);
105  clone_wand->exception=AcquireExceptionInfo();
106  InheritException(clone_wand->exception,wand->exception);
107  clone_wand->image_info=CloneImageInfo(wand->image_info);
108  clone_wand->images=images;
109  clone_wand->debug=IsEventLogging();
110  clone_wand->signature=MagickWandSignature;
111  if (clone_wand->debug != MagickFalse)
112  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
113  return(clone_wand);
114 }
115 
116 /*
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 % %
119 % %
120 % %
121 % G e t I m a g e F r o m M a g i c k W a n d %
122 % %
123 % %
124 % %
125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126 %
127 % GetImageFromMagickWand() returns the current image from the magick wand.
128 %
129 % The format of the GetImageFromMagickWand method is:
130 %
131 % Image *GetImageFromMagickWand(const MagickWand *wand)
132 %
133 % A description of each parameter follows:
134 %
135 % o wand: the magick wand.
136 %
137 */
139 {
140  assert(wand != (MagickWand *) NULL);
141  assert(wand->signature == MagickWandSignature);
142  if (wand->debug != MagickFalse)
143  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
144  if (wand->images == (Image *) NULL)
145  {
146  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
147  "ContainsNoImages","`%s'",wand->name);
148  return((Image *) NULL);
149  }
150  return(wand->images);
151 }
152 
153 /*
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155 % %
156 % %
157 % %
158 % 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 %
159 % %
160 % %
161 % %
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 %
164 % MagickAdaptiveBlurImage() adaptively blurs the image by blurring
165 % less intensely near image edges and more intensely far from edges. We
166 % blur the image with a Gaussian operator of the given radius and standard
167 % deviation (sigma). For reasonable results, radius should be larger than
168 % sigma. Use a radius of 0 and MagickAdaptiveBlurImage() selects a
169 % suitable radius for you.
170 %
171 % The format of the MagickAdaptiveBlurImage method is:
172 %
173 % MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
174 % const double radius,const double sigma)
175 %
176 % A description of each parameter follows:
177 %
178 % o wand: the magick wand.
179 %
180 % o radius: the radius of the Gaussian, in pixels, not counting the center
181 % pixel.
182 %
183 % o sigma: the standard deviation of the Gaussian, in pixels.
184 %
185 */
187  const double radius,const double sigma)
188 {
189  Image
190  *sharp_image;
191 
192  assert(wand != (MagickWand *) NULL);
193  assert(wand->signature == MagickWandSignature);
194  if (wand->debug != MagickFalse)
195  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
196  if (wand->images == (Image *) NULL)
197  ThrowWandException(WandError,"ContainsNoImages",wand->name);
198  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
199  if (sharp_image == (Image *) NULL)
200  return(MagickFalse);
201  ReplaceImageInList(&wand->images,sharp_image);
202  return(MagickTrue);
203 }
204 
205 /*
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 % %
208 % %
209 % %
210 % 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 %
211 % %
212 % %
213 % %
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %
216 % MagickAdaptiveResizeImage() adaptively resize image with data dependent
217 % triangulation.
218 %
219 % MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
220 % const size_t columns,const size_t rows)
221 %
222 % A description of each parameter follows:
223 %
224 % o wand: the magick wand.
225 %
226 % o columns: the number of columns in the scaled image.
227 %
228 % o rows: the number of rows in the scaled image.
229 %
230 */
232  const size_t columns,const size_t rows)
233 {
234  Image
235  *resize_image;
236 
237  assert(wand != (MagickWand *) NULL);
238  assert(wand->signature == MagickWandSignature);
239  if (wand->debug != MagickFalse)
240  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
241  if (wand->images == (Image *) NULL)
242  ThrowWandException(WandError,"ContainsNoImages",wand->name);
243  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
244  if (resize_image == (Image *) NULL)
245  return(MagickFalse);
246  ReplaceImageInList(&wand->images,resize_image);
247  return(MagickTrue);
248 }
249 
250 /*
251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 % %
253 % %
254 % %
255 % 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 %
256 % %
257 % %
258 % %
259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260 %
261 % MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
262 % more intensely near image edges and less intensely far from edges. We
263 % sharpen the image with a Gaussian operator of the given radius and standard
264 % deviation (sigma). For reasonable results, radius should be larger than
265 % sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
266 % suitable radius for you.
267 %
268 % The format of the MagickAdaptiveSharpenImage method is:
269 %
270 % MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
271 % const double radius,const double sigma)
272 %
273 % A description of each parameter follows:
274 %
275 % o wand: the magick wand.
276 %
277 % o radius: the radius of the Gaussian, in pixels, not counting the center
278 % pixel.
279 %
280 % o sigma: the standard deviation of the Gaussian, in pixels.
281 %
282 */
284  const double radius,const double sigma)
285 {
286  Image
287  *sharp_image;
288 
289  assert(wand != (MagickWand *) NULL);
290  assert(wand->signature == MagickWandSignature);
291  if (wand->debug != MagickFalse)
292  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
293  if (wand->images == (Image *) NULL)
294  ThrowWandException(WandError,"ContainsNoImages",wand->name);
295  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
296  if (sharp_image == (Image *) NULL)
297  return(MagickFalse);
298  ReplaceImageInList(&wand->images,sharp_image);
299  return(MagickTrue);
300 }
301 
302 /*
303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304 % %
305 % %
306 % %
307 % 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 %
308 % %
309 % %
310 % %
311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312 %
313 % MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
314 % based on the range of intensity values in its local neighborhood. This
315 % allows for thresholding of an image whose global intensity histogram
316 % doesn't contain distinctive peaks.
317 %
318 % The format of the AdaptiveThresholdImage method is:
319 %
320 % MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
321 % const size_t width,const size_t height,const double bias)
322 %
323 % A description of each parameter follows:
324 %
325 % o wand: the magick wand.
326 %
327 % o width: the width of the local neighborhood.
328 %
329 % o height: the height of the local neighborhood.
330 %
331 % o offset: the mean bias.
332 %
333 */
335  const size_t width,const size_t height,const double bias)
336 {
337  Image
338  *threshold_image;
339 
340  assert(wand != (MagickWand *) NULL);
341  assert(wand->signature == MagickWandSignature);
342  if (wand->debug != MagickFalse)
343  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
344  if (wand->images == (Image *) NULL)
345  ThrowWandException(WandError,"ContainsNoImages",wand->name);
346  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
347  wand->exception);
348  if (threshold_image == (Image *) NULL)
349  return(MagickFalse);
350  ReplaceImageInList(&wand->images,threshold_image);
351  return(MagickTrue);
352 }
353 
354 /*
355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356 % %
357 % %
358 % %
359 % M a g i c k A d d I m a g e %
360 % %
361 % %
362 % %
363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 %
365 % MagickAddImage() adds a clone of the images from the second wand and
366 % inserts them into the first wand.
367 %
368 % Use MagickSetLastIterator(), to append new images into an existing wand,
369 % current image will be set to last image so later adds with also be
370 % appened to end of wand.
371 %
372 % Use MagickSetFirstIterator() to prepend new images into wand, any more
373 % images added will also be prepended before other images in the wand.
374 % However the order of a list of new images will not change.
375 %
376 % Otherwise the new images will be inserted just after the current image,
377 % and any later image will also be added after this current image but
378 % before the previously added images. Caution is advised when multiple
379 % image adds are inserted into the middle of the wand image list.
380 %
381 % The format of the MagickAddImage method is:
382 %
383 % MagickBooleanType MagickAddImage(MagickWand *wand,
384 % const MagickWand *add_wand)
385 %
386 % A description of each parameter follows:
387 %
388 % o wand: the magick wand.
389 %
390 % o add_wand: A wand that contains the image list to be added
391 %
392 */
393 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
394  Image *images)
395 {
396  if (wand->images == (Image *) NULL)
397  {
398  /*
399  No images in wand, just add them, set current as appropriate.
400  */
401  if (wand->insert_before != MagickFalse)
402  wand->images=GetFirstImageInList(images);
403  else
404  wand->images=GetLastImageInList(images);
405  return(MagickTrue);
406  }
407  /* user jumped to first image, so prepend new images - remain active */
408  if ((wand->insert_before != MagickFalse) &&
409  (wand->images->previous == (Image *) NULL))
410  {
411  PrependImageToList(&wand->images,images);
412  wand->images=GetFirstImageInList(images);
413  return(MagickTrue);
414  }
415  /*
416  Note you should never have 'insert_before' true when current image is not
417  the first image in the wand! That is no insert before current image, only
418  after current image
419  */
420  if (wand->images->next == (Image *) NULL)
421  {
422  /*
423  At last image, append new images.
424  */
425  InsertImageInList(&wand->images,images);
426  wand->images=GetLastImageInList(images);
427  return(MagickTrue);
428  }
429  /*
430  Insert new images, just after the current image.
431  */
432  InsertImageInList(&wand->images,images);
433  return(MagickTrue);
434 }
435 
436 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437  const MagickWand *add_wand)
438 {
439  Image
440  *images;
441 
442  assert(wand != (MagickWand *) NULL);
443  assert(wand->signature == MagickWandSignature);
444  if (wand->debug != MagickFalse)
445  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446  assert(add_wand != (MagickWand *) NULL);
447  assert(add_wand->signature == MagickWandSignature);
448  if (add_wand->images == (Image *) NULL)
449  ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
450  /*
451  Clone images in second wand, and insert into first.
452  */
453  images=CloneImageList(add_wand->images,wand->exception);
454  if (images == (Image *) NULL)
455  return(MagickFalse);
456  return(InsertImageInWand(wand,images));
457 }
458 
459 /*
460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461 % %
462 % %
463 % %
464 % M a g i c k A d d N o i s e I m a g e %
465 % %
466 % %
467 % %
468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469 %
470 % MagickAddNoiseImage() adds random noise to the image.
471 %
472 % The format of the MagickAddNoiseImage method is:
473 %
474 % MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
475 % const NoiseType noise_type,const double attenuate)
476 %
477 % A description of each parameter follows:
478 %
479 % o wand: the magick wand.
480 %
481 % o noise_type: The type of noise: Uniform, Gaussian, Multiplicative,
482 % Impulse, Laplacian, or Poisson.
483 %
484 % o attenuate: attenuate the random distribution.
485 %
486 */
487 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
488  const NoiseType noise_type,const double attenuate)
489 {
490  Image
491  *noise_image;
492 
493  assert(wand != (MagickWand *) NULL);
494  assert(wand->signature == MagickWandSignature);
495  if (wand->debug != MagickFalse)
496  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497  if (wand->images == (Image *) NULL)
498  ThrowWandException(WandError,"ContainsNoImages",wand->name);
499  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
500  if (noise_image == (Image *) NULL)
501  return(MagickFalse);
502  ReplaceImageInList(&wand->images,noise_image);
503  return(MagickTrue);
504 }
505 
506 /*
507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508 % %
509 % %
510 % %
511 % 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 %
512 % %
513 % %
514 % %
515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516 %
517 % MagickAffineTransformImage() transforms an image as dictated by the affine
518 % matrix of the drawing wand.
519 %
520 % The format of the MagickAffineTransformImage method is:
521 %
522 % MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
523 % const DrawingWand *drawing_wand)
524 %
525 % A description of each parameter follows:
526 %
527 % o wand: the magick wand.
528 %
529 % o drawing_wand: the draw wand.
530 %
531 */
533  const DrawingWand *drawing_wand)
534 {
535  DrawInfo
536  *draw_info;
537 
538  Image
539  *affine_image;
540 
541  assert(wand != (MagickWand *) NULL);
542  assert(wand->signature == MagickWandSignature);
543  if (wand->debug != MagickFalse)
544  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
545  if (wand->images == (Image *) NULL)
546  ThrowWandException(WandError,"ContainsNoImages",wand->name);
547  draw_info=PeekDrawingWand(drawing_wand);
548  if (draw_info == (DrawInfo *) NULL)
549  return(MagickFalse);
550  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
551  wand->exception);
552  draw_info=DestroyDrawInfo(draw_info);
553  if (affine_image == (Image *) NULL)
554  return(MagickFalse);
555  ReplaceImageInList(&wand->images,affine_image);
556  return(MagickTrue);
557 }
558 
559 /*
560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561 % %
562 % %
563 % %
564 % M a g i c k A n n o t a t e I m a g e %
565 % %
566 % %
567 % %
568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
569 %
570 % MagickAnnotateImage() annotates an image with text.
571 %
572 % The format of the MagickAnnotateImage method is:
573 %
574 % MagickBooleanType MagickAnnotateImage(MagickWand *wand,
575 % const DrawingWand *drawing_wand,const double x,const double y,
576 % const double angle,const char *text)
577 %
578 % A description of each parameter follows:
579 %
580 % o wand: the magick wand.
581 %
582 % o drawing_wand: the draw wand.
583 %
584 % o x: x ordinate to left of text
585 %
586 % o y: y ordinate to text baseline
587 %
588 % o angle: rotate text relative to this angle.
589 %
590 % o text: text to draw
591 %
592 */
593 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594  const DrawingWand *drawing_wand,const double x,const double y,
595  const double angle,const char *text)
596 {
597  char
598  geometry[MagickPathExtent];
599 
600  DrawInfo
601  *draw_info;
602 
603  MagickBooleanType
604  status;
605 
606  assert(wand != (MagickWand *) NULL);
607  assert(wand->signature == MagickWandSignature);
608  if (wand->debug != MagickFalse)
609  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
610  if (wand->images == (Image *) NULL)
611  ThrowWandException(WandError,"ContainsNoImages",wand->name);
612  draw_info=PeekDrawingWand(drawing_wand);
613  if (draw_info == (DrawInfo *) NULL)
614  return(MagickFalse);
615  (void) CloneString(&draw_info->text,text);
616  (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
617  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
618  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
619  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
620  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
621  (void) CloneString(&draw_info->geometry,geometry);
622  status=AnnotateImage(wand->images,draw_info,wand->exception);
623  draw_info=DestroyDrawInfo(draw_info);
624  return(status);
625 }
626 
627 /*
628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629 % %
630 % %
631 % %
632 % M a g i c k A n i m a t e I m a g e s %
633 % %
634 % %
635 % %
636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637 %
638 % MagickAnimateImages() animates an image or image sequence.
639 %
640 % The format of the MagickAnimateImages method is:
641 %
642 % MagickBooleanType MagickAnimateImages(MagickWand *wand,
643 % const char *server_name)
644 %
645 % A description of each parameter follows:
646 %
647 % o wand: the magick wand.
648 %
649 % o server_name: the X server name.
650 %
651 */
652 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653  const char *server_name)
654 {
655  MagickBooleanType
656  status;
657 
658  assert(wand != (MagickWand *) NULL);
659  assert(wand->signature == MagickWandSignature);
660  if (wand->debug != MagickFalse)
661  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662  (void) CloneString(&wand->image_info->server_name,server_name);
663  status=AnimateImages(wand->image_info,wand->images,wand->exception);
664  return(status);
665 }
666 
667 /*
668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669 % %
670 % %
671 % %
672 % M a g i c k A p p e n d I m a g e s %
673 % %
674 % %
675 % %
676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677 %
678 % MagickAppendImages() append the images in a wand from the current image
679 % onwards, creating a new wand with the single image result. This is
680 % affected by the gravity and background settings of the first image.
681 %
682 % Typically you would call either MagickResetIterator() or
683 % MagickSetFirstImage() before calling this function to ensure that all
684 % the images in the wand's image list will be appended together.
685 %
686 % The format of the MagickAppendImages method is:
687 %
688 % MagickWand *MagickAppendImages(MagickWand *wand,
689 % const MagickBooleanType stack)
690 %
691 % A description of each parameter follows:
692 %
693 % o wand: the magick wand.
694 %
695 % o stack: By default, images are stacked left-to-right. Set stack to
696 % MagickTrue to stack them top-to-bottom.
697 %
698 */
700  const MagickBooleanType stack)
701 {
702  Image
703  *append_image;
704 
705  assert(wand != (MagickWand *) NULL);
706  assert(wand->signature == MagickWandSignature);
707  if (wand->debug != MagickFalse)
708  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
709  if (wand->images == (Image *) NULL)
710  return((MagickWand *) NULL);
711  append_image=AppendImages(wand->images,stack,wand->exception);
712  if (append_image == (Image *) NULL)
713  return((MagickWand *) NULL);
714  return(CloneMagickWandFromImages(wand,append_image));
715 }
716 
717 /*
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 % %
720 % %
721 % %
722 % M a g i c k A u t o G a m m a I m a g e %
723 % %
724 % %
725 % %
726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727 %
728 % MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
729 % image to try make set its gamma appropriatally.
730 %
731 % The format of the MagickAutoGammaImage method is:
732 %
733 % MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
734 %
735 % A description of each parameter follows:
736 %
737 % o wand: the magick wand.
738 %
739 */
741 {
742  MagickBooleanType
743  status;
744 
745  assert(wand != (MagickWand *) NULL);
746  assert(wand->signature == MagickWandSignature);
747  if (wand->debug != MagickFalse)
748  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749  if (wand->images == (Image *) NULL)
750  ThrowWandException(WandError,"ContainsNoImages",wand->name);
751  status=AutoGammaImage(wand->images,wand->exception);
752  return(status);
753 }
754 
755 /*
756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757 % %
758 % %
759 % %
760 % M a g i c k A u t o L e v e l I m a g e %
761 % %
762 % %
763 % %
764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765 %
766 % MagickAutoLevelImage() adjusts the levels of a particular image channel by
767 % scaling the minimum and maximum values to the full quantum range.
768 %
769 % The format of the MagickAutoLevelImage method is:
770 %
771 % MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
772 %
773 % A description of each parameter follows:
774 %
775 % o wand: the magick wand.
776 %
777 */
779 {
780  MagickBooleanType
781  status;
782 
783  assert(wand != (MagickWand *) NULL);
784  assert(wand->signature == MagickWandSignature);
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=AutoLevelImage(wand->images,wand->exception);
790  return(status);
791 }
792 
793 /*
794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
795 % %
796 % %
797 % %
798 % M a g i c k A u t o O r i e n t I m a g e %
799 % %
800 % %
801 % %
802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803 %
804 % MagickAutoOrientImage() adjusts an image so that its orientation is suitable
805 $ for viewing (i.e. top-left orientation).
806 %
807 % The format of the MagickAutoOrientImage method is:
808 %
809 % MagickBooleanType MagickAutoOrientImage(MagickWand *image)
810 %
811 % A description of each parameter follows:
812 %
813 % o wand: the magick wand.
814 %
815 */
817 {
818 
819  Image
820  *orient_image;
821 
822  assert(wand != (MagickWand *) NULL);
823  assert(wand->signature == MagickWandSignature);
824  if (wand->debug != MagickFalse)
825  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826  if (wand->images == (Image *) NULL)
827  ThrowWandException(WandError,"ContainsNoImages",wand->name);
828  orient_image=AutoOrientImage(wand->images,wand->images->orientation,
829  wand->exception);
830  if (orient_image == (Image *) NULL)
831  return(MagickFalse);
832  ReplaceImageInList(&wand->images,orient_image);
833  return(MagickTrue);
834 }
835 
836 /*
837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838 % %
839 % %
840 % %
841 % 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 %
842 % %
843 % %
844 % %
845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846 %
847 % MagickBlackThresholdImage() is like MagickThresholdImage() but forces all
848 % pixels below the threshold into black while leaving all pixels above the
849 % threshold unchanged.
850 %
851 % The format of the MagickBlackThresholdImage method is:
852 %
853 % MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
854 % const PixelWand *threshold)
855 %
856 % A description of each parameter follows:
857 %
858 % o wand: the magick wand.
859 %
860 % o threshold: the pixel wand.
861 %
862 */
864  const PixelWand *threshold)
865 {
866  char
867  thresholds[MagickPathExtent];
868 
869  MagickBooleanType
870  status;
871 
872  assert(wand != (MagickWand *) NULL);
873  assert(wand->signature == MagickWandSignature);
874  if (wand->debug != MagickFalse)
875  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
876  if (wand->images == (Image *) NULL)
877  ThrowWandException(WandError,"ContainsNoImages",wand->name);
878  (void) FormatLocaleString(thresholds,MagickPathExtent,
879  QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
880  PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
881  PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
882  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
883  return(status);
884 }
885 
886 /*
887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888 % %
889 % %
890 % %
891 % M a g i c k B l u e S h i f t I m a g e %
892 % %
893 % %
894 % %
895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896 %
897 % MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
898 % nighttime in the moonlight.
899 %
900 % The format of the MagickBlueShiftImage method is:
901 %
902 % MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
903 % const double factor)
904 %
905 % A description of each parameter follows:
906 %
907 % o wand: the magick wand.
908 %
909 % o factor: the blue shift factor (default 1.5)
910 %
911 */
913  const double factor)
914 {
915  Image
916  *shift_image;
917 
918  assert(wand != (MagickWand *) NULL);
919  assert(wand->signature == MagickWandSignature);
920  if (wand->debug != MagickFalse)
921  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
922  if (wand->images == (Image *) NULL)
923  ThrowWandException(WandError,"ContainsNoImages",wand->name);
924  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
925  if (shift_image == (Image *) NULL)
926  return(MagickFalse);
927  ReplaceImageInList(&wand->images,shift_image);
928  return(MagickTrue);
929 }
930 
931 /*
932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
933 % %
934 % %
935 % %
936 % M a g i c k B l u r I m a g e %
937 % %
938 % %
939 % %
940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
941 %
942 % MagickBlurImage() blurs an image. We convolve the image with a
943 % gaussian operator of the given radius and standard deviation (sigma).
944 % For reasonable results, the radius should be larger than sigma. Use a
945 % radius of 0 and BlurImage() selects a suitable radius for you.
946 %
947 % The format of the MagickBlurImage method is:
948 %
949 % MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
950 % const double sigma)
951 %
952 % A description of each parameter follows:
953 %
954 % o wand: the magick wand.
955 %
956 % o radius: the radius of the , in pixels, not counting the center
957 % pixel.
958 %
959 % o sigma: the standard deviation of the , in pixels.
960 %
961 */
962 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
963  const double radius,const double sigma)
964 {
965  Image
966  *blur_image;
967 
968  assert(wand != (MagickWand *) NULL);
969  assert(wand->signature == MagickWandSignature);
970  if (wand->debug != MagickFalse)
971  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
972  if (wand->images == (Image *) NULL)
973  ThrowWandException(WandError,"ContainsNoImages",wand->name);
974  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
975  if (blur_image == (Image *) NULL)
976  return(MagickFalse);
977  ReplaceImageInList(&wand->images,blur_image);
978  return(MagickTrue);
979 }
980 
981 /*
982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983 % %
984 % %
985 % %
986 % M a g i c k B o r d e r I m a g e %
987 % %
988 % %
989 % %
990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991 %
992 % MagickBorderImage() surrounds the image with a border of the color defined
993 % by the bordercolor pixel wand.
994 %
995 % The format of the MagickBorderImage method is:
996 %
997 % MagickBooleanType MagickBorderImage(MagickWand *wand,
998 % const PixelWand *bordercolor,const size_t width,
999 % const size_t height,const CompositeOperator compose)
1000 %
1001 % A description of each parameter follows:
1002 %
1003 % o wand: the magick wand.
1004 %
1005 % o bordercolor: the border color pixel wand.
1006 %
1007 % o width: the border width.
1008 %
1009 % o height: the border height.
1010 %
1011 % o compose: the composite operator.
1012 %
1013 */
1014 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1015  const PixelWand *bordercolor,const size_t width,const size_t height,
1016  const CompositeOperator compose)
1017 {
1018  Image
1019  *border_image;
1020 
1021  RectangleInfo
1022  border_info;
1023 
1024  assert(wand != (MagickWand *) NULL);
1025  assert(wand->signature == MagickWandSignature);
1026  if (wand->debug != MagickFalse)
1027  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1028  if (wand->images == (Image *) NULL)
1029  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1030  border_info.width=width;
1031  border_info.height=height;
1032  border_info.x=0;
1033  border_info.y=0;
1034  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1035  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1036  if (border_image == (Image *) NULL)
1037  return(MagickFalse);
1038  ReplaceImageInList(&wand->images,border_image);
1039  return(MagickTrue);
1040 }
1041 
1042 /*
1043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044 % %
1045 % %
1046 % %
1047 % 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 %
1048 % %
1049 % %
1050 % %
1051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1052 %
1053 % Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1054 % of an image. It converts the brightness and contrast parameters into slope
1055 % and intercept and calls a polynomical function to apply to the image.
1056 
1057 %
1058 % The format of the MagickBrightnessContrastImage method is:
1059 %
1060 % MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1061 % const double brightness,const double contrast)
1062 %
1063 % A description of each parameter follows:
1064 %
1065 % o wand: the magick wand.
1066 %
1067 % o brightness: the brightness percent (-100 .. 100).
1068 %
1069 % o contrast: the contrast percent (-100 .. 100).
1070 %
1071 */
1073  MagickWand *wand,const double brightness,const double contrast)
1074 {
1075  MagickBooleanType
1076  status;
1077 
1078  assert(wand != (MagickWand *) NULL);
1079  assert(wand->signature == MagickWandSignature);
1080  if (wand->debug != MagickFalse)
1081  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1082  if (wand->images == (Image *) NULL)
1083  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1084  status=BrightnessContrastImage(wand->images,brightness,contrast,
1085  wand->exception);
1086  return(status);
1087 }
1088 
1089 /*
1090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1091 % %
1092 % %
1093 % %
1094 % M a g i c k C h a n n e l F x I m a g e %
1095 % %
1096 % %
1097 % %
1098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1099 %
1100 % MagickChannelFxImage() applies a channel expression to the specified image.
1101 % The expression consists of one or more channels, either mnemonic or numeric
1102 % (e.g. red, 1), separated by actions as follows:
1103 %
1104 % <=> exchange two channels (e.g. red<=>blue)
1105 % => transfer a channel to another (e.g. red=>green)
1106 % , separate channel operations (e.g. red, green)
1107 % | read channels from next input image (e.g. red | green)
1108 % ; write channels to next output image (e.g. red; green; blue)
1109 %
1110 % A channel without a operation symbol implies extract. For example, to create
1111 % 3 grayscale images from the red, green, and blue channels of an image, use:
1112 %
1113 % -channel-fx "red; green; blue"
1114 %
1115 % The format of the MagickChannelFxImage method is:
1116 %
1117 % MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1118 %
1119 % A description of each parameter follows:
1120 %
1121 % o wand: the magick wand.
1122 %
1123 % o expression: the expression.
1124 %
1125 */
1127  const char *expression)
1128 {
1129  Image
1130  *fx_image;
1131 
1132  assert(wand != (MagickWand *) NULL);
1133  assert(wand->signature == MagickWandSignature);
1134  if (wand->debug != MagickFalse)
1135  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1136  if (wand->images == (Image *) NULL)
1137  return((MagickWand *) NULL);
1138  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1139  if (fx_image == (Image *) NULL)
1140  return((MagickWand *) NULL);
1141  return(CloneMagickWandFromImages(wand,fx_image));
1142 }
1143 
1144 /*
1145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146 % %
1147 % %
1148 % %
1149 % M a g i c k C h a r c o a l I m a g e %
1150 % %
1151 % %
1152 % %
1153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154 %
1155 % MagickCharcoalImage() simulates a charcoal drawing.
1156 %
1157 % The format of the MagickCharcoalImage method is:
1158 %
1159 % MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1160 % const double radius,const double sigma)
1161 %
1162 % A description of each parameter follows:
1163 %
1164 % o wand: the magick wand.
1165 %
1166 % o radius: the radius of the Gaussian, in pixels, not counting the center
1167 % pixel.
1168 %
1169 % o sigma: the standard deviation of the Gaussian, in pixels.
1170 %
1171 */
1173  const double radius,const double sigma)
1174 {
1175  Image
1176  *charcoal_image;
1177 
1178  assert(wand != (MagickWand *) NULL);
1179  assert(wand->signature == MagickWandSignature);
1180  if (wand->debug != MagickFalse)
1181  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182  if (wand->images == (Image *) NULL)
1183  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1184  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1185  if (charcoal_image == (Image *) NULL)
1186  return(MagickFalse);
1187  ReplaceImageInList(&wand->images,charcoal_image);
1188  return(MagickTrue);
1189 }
1190 
1191 /*
1192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193 % %
1194 % %
1195 % %
1196 % M a g i c k C h o p I m a g e %
1197 % %
1198 % %
1199 % %
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201 %
1202 % MagickChopImage() removes a region of an image and collapses the image to
1203 % occupy the removed portion
1204 %
1205 % The format of the MagickChopImage method is:
1206 %
1207 % MagickBooleanType MagickChopImage(MagickWand *wand,
1208 % const size_t width,const size_t height,const ssize_t x,
1209 % const ssize_t y)
1210 %
1211 % A description of each parameter follows:
1212 %
1213 % o wand: the magick wand.
1214 %
1215 % o width: the region width.
1216 %
1217 % o height: the region height.
1218 %
1219 % o x: the region x offset.
1220 %
1221 % o y: the region y offset.
1222 %
1223 %
1224 */
1225 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1226  const size_t width,const size_t height,const ssize_t x,
1227  const ssize_t y)
1228 {
1229  Image
1230  *chop_image;
1231 
1232  RectangleInfo
1233  chop;
1234 
1235  assert(wand != (MagickWand *) NULL);
1236  assert(wand->signature == MagickWandSignature);
1237  if (wand->debug != MagickFalse)
1238  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239  if (wand->images == (Image *) NULL)
1240  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241  chop.width=width;
1242  chop.height=height;
1243  chop.x=x;
1244  chop.y=y;
1245  chop_image=ChopImage(wand->images,&chop,wand->exception);
1246  if (chop_image == (Image *) NULL)
1247  return(MagickFalse);
1248  ReplaceImageInList(&wand->images,chop_image);
1249  return(MagickTrue);
1250 }
1251 
1252 /*
1253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254 % %
1255 % %
1256 % %
1257 % M a g i c k C L A H E I m a g e %
1258 % %
1259 % %
1260 % %
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262 %
1263 % MagickCLAHEImage() selects an individual threshold for each pixel
1264 % based on the range of intensity values in its local neighborhood. This
1265 % allows for thresholding of an image whose global intensity histogram
1266 % doesn't contain distinctive peaks.
1267 %
1268 % The format of the CLAHEImage method is:
1269 %
1270 % MagickBooleanType MagickCLAHEImage(MagickWand *wand,const size_t width,
1271 % const size_t height,const double bias,const double sans)
1272 %
1273 % A description of each parameter follows:
1274 %
1275 % o wand: the magick wand.
1276 %
1277 % o width: the width of the local neighborhood.
1278 %
1279 % o height: the height of the local neighborhood.
1280 %
1281 % o offset: the mean bias.
1282 %
1283 % o sans: not used.
1284 %
1285 */
1286 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand,
1287  const size_t width,const size_t height,const double bias,const double sans)
1288 {
1289  MagickBooleanType
1290  status;
1291 
1292  assert(wand != (MagickWand *) NULL);
1293  assert(wand->signature == MagickWandSignature);
1294  if (wand->debug != MagickFalse)
1295  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1296  if (wand->images == (Image *) NULL)
1297  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1298  status=CLAHEImage(wand->images,width,height,bias,sans,wand->exception);
1299  return(status);
1300 }
1301 
1302 /*
1303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1304 % %
1305 % %
1306 % %
1307 % M a g i c k C l a m p I m a g e %
1308 % %
1309 % %
1310 % %
1311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1312 %
1313 % MagickClampImage() restricts the color range from 0 to the quantum depth.
1314 %
1315 % The format of the MagickClampImage method is:
1316 %
1317 % MagickBooleanType MagickClampImage(MagickWand *wand)
1318 %
1319 % A description of each parameter follows:
1320 %
1321 % o wand: the magick wand.
1322 %
1323 % o channel: the channel.
1324 %
1325 */
1326 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1327 {
1328  assert(wand != (MagickWand *) NULL);
1329  assert(wand->signature == MagickWandSignature);
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  return(ClampImage(wand->images,wand->exception));
1335 }
1336 
1337 /*
1338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1339 % %
1340 % %
1341 % %
1342 % M a g i c k C l i p I m a g e %
1343 % %
1344 % %
1345 % %
1346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1347 %
1348 % MagickClipImage() clips along the first path from the 8BIM profile, if
1349 % present.
1350 %
1351 % The format of the MagickClipImage method is:
1352 %
1353 % MagickBooleanType MagickClipImage(MagickWand *wand)
1354 %
1355 % A description of each parameter follows:
1356 %
1357 % o wand: the magick wand.
1358 %
1359 */
1360 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1361 {
1362  MagickBooleanType
1363  status;
1364 
1365  assert(wand != (MagickWand *) NULL);
1366  assert(wand->signature == MagickWandSignature);
1367  if (wand->debug != MagickFalse)
1368  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1369  if (wand->images == (Image *) NULL)
1370  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1371  status=ClipImage(wand->images,wand->exception);
1372  return(status);
1373 }
1374 
1375 /*
1376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1377 % %
1378 % %
1379 % %
1380 % M a g i c k C l i p I m a g e P a t h %
1381 % %
1382 % %
1383 % %
1384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1385 %
1386 % MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1387 % present. Later operations take effect inside the path. Id may be a number
1388 % if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1389 % path.
1390 %
1391 % The format of the MagickClipImagePath method is:
1392 %
1393 % MagickBooleanType MagickClipImagePath(MagickWand *wand,
1394 % const char *pathname,const MagickBooleanType inside)
1395 %
1396 % A description of each parameter follows:
1397 %
1398 % o wand: the magick wand.
1399 %
1400 % o pathname: name of clipping path resource. If name is preceded by #, use
1401 % clipping path numbered by name.
1402 %
1403 % o inside: if non-zero, later operations take effect inside clipping path.
1404 % Otherwise later operations take effect outside clipping path.
1405 %
1406 */
1408  const char *pathname,const MagickBooleanType inside)
1409 {
1410  MagickBooleanType
1411  status;
1412 
1413  assert(wand != (MagickWand *) NULL);
1414  assert(wand->signature == MagickWandSignature);
1415  if (wand->debug != MagickFalse)
1416  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1417  if (wand->images == (Image *) NULL)
1418  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1419  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1420  return(status);
1421 }
1422 
1423 /*
1424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1425 % %
1426 % %
1427 % %
1428 % M a g i c k C l u t I m a g e %
1429 % %
1430 % %
1431 % %
1432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1433 %
1434 % MagickClutImage() replaces colors in the image from a color lookup table.
1435 %
1436 % The format of the MagickClutImage method is:
1437 %
1438 % MagickBooleanType MagickClutImage(MagickWand *wand,
1439 % const MagickWand *clut_wand,const PixelInterpolateMethod method)
1440 %
1441 % A description of each parameter follows:
1442 %
1443 % o wand: the magick wand.
1444 %
1445 % o clut_image: the clut image.
1446 %
1447 % o method: the pixel interpolation method.
1448 %
1449 */
1450 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1451  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1452 {
1453  MagickBooleanType
1454  status;
1455 
1456  assert(wand != (MagickWand *) NULL);
1457  assert(wand->signature == MagickWandSignature);
1458  if (wand->debug != MagickFalse)
1459  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1460  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1461  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1462  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1463  return(status);
1464 }
1465 
1466 /*
1467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1468 % %
1469 % %
1470 % %
1471 % M a g i c k C o a l e s c e I m a g e s %
1472 % %
1473 % %
1474 % %
1475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1476 %
1477 % MagickCoalesceImages() composites a set of images while respecting any page
1478 % offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1479 % typically start with an image background and each subsequent image
1480 % varies in size and offset. MagickCoalesceImages() returns a new sequence
1481 % where each image in the sequence is the same size as the first and
1482 % composited with the next image in the sequence.
1483 %
1484 % The format of the MagickCoalesceImages method is:
1485 %
1486 % MagickWand *MagickCoalesceImages(MagickWand *wand)
1487 %
1488 % A description of each parameter follows:
1489 %
1490 % o wand: the magick wand.
1491 %
1492 */
1494 {
1495  Image
1496  *coalesce_image;
1497 
1498  assert(wand != (MagickWand *) NULL);
1499  assert(wand->signature == MagickWandSignature);
1500  if (wand->debug != MagickFalse)
1501  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1502  if (wand->images == (Image *) NULL)
1503  return((MagickWand *) NULL);
1504  coalesce_image=CoalesceImages(wand->images,wand->exception);
1505  if (coalesce_image == (Image *) NULL)
1506  return((MagickWand *) NULL);
1507  return(CloneMagickWandFromImages(wand,coalesce_image));
1508 }
1509 
1510 /*
1511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1512 % %
1513 % %
1514 % %
1515 % M a g i c k C o l o r D e c i s i o n I m a g e %
1516 % %
1517 % %
1518 % %
1519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520 %
1521 % MagickColorDecisionListImage() accepts a lightweight Color Correction
1522 % Collection (CCC) file which solely contains one or more color corrections
1523 % and applies the color correction to the image. Here is a sample CCC file:
1524 %
1525 % <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1526 % <ColorCorrection id="cc03345">
1527 % <SOPNode>
1528 % <Slope> 0.9 1.2 0.5 </Slope>
1529 % <Offset> 0.4 -0.5 0.6 </Offset>
1530 % <Power> 1.0 0.8 1.5 </Power>
1531 % </SOPNode>
1532 % <SATNode>
1533 % <Saturation> 0.85 </Saturation>
1534 % </SATNode>
1535 % </ColorCorrection>
1536 % </ColorCorrectionCollection>
1537 %
1538 % which includes the offset, slope, and power for each of the RGB channels
1539 % as well as the saturation.
1540 %
1541 % The format of the MagickColorDecisionListImage method is:
1542 %
1543 % MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1544 % const char *color_correction_collection)
1545 %
1546 % A description of each parameter follows:
1547 %
1548 % o wand: the magick wand.
1549 %
1550 % o color_correction_collection: the color correction collection in XML.
1551 %
1552 */
1554  const char *color_correction_collection)
1555 {
1556  MagickBooleanType
1557  status;
1558 
1559  assert(wand != (MagickWand *) NULL);
1560  assert(wand->signature == MagickWandSignature);
1561  if (wand->debug != MagickFalse)
1562  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1563  if (wand->images == (Image *) NULL)
1564  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1565  status=ColorDecisionListImage(wand->images,color_correction_collection,
1566  wand->exception);
1567  return(status);
1568 }
1569 
1570 /*
1571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572 % %
1573 % %
1574 % %
1575 % M a g i c k C o l o r i z e I m a g e %
1576 % %
1577 % %
1578 % %
1579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1580 %
1581 % MagickColorizeImage() blends the fill color with each pixel in the image.
1582 %
1583 % The format of the MagickColorizeImage method is:
1584 %
1585 % MagickBooleanType MagickColorizeImage(MagickWand *wand,
1586 % const PixelWand *colorize,const PixelWand *blend)
1587 %
1588 % A description of each parameter follows:
1589 %
1590 % o wand: the magick wand.
1591 %
1592 % o colorize: the colorize pixel wand.
1593 %
1594 % o alpha: the alpha pixel wand.
1595 %
1596 */
1598  const PixelWand *colorize,const PixelWand *blend)
1599 {
1600  char
1601  percent_blend[MagickPathExtent];
1602 
1603  Image
1604  *colorize_image;
1605 
1606  PixelInfo
1607  target;
1608 
1609  assert(wand != (MagickWand *) NULL);
1610  assert(wand->signature == MagickWandSignature);
1611  if (wand->debug != MagickFalse)
1612  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1613  if (wand->images == (Image *) NULL)
1614  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1615  GetPixelInfo(wand->images,&target);
1616  if (target.colorspace != CMYKColorspace)
1617  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1618  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1619  PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1620  PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1621  PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1622  PixelGetAlphaQuantum(blend)));
1623  else
1624  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1625  "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1626  PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1627  PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1628  PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1629  PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1630  PixelGetAlphaQuantum(blend)));
1631  target=PixelGetPixel(colorize);
1632  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1633  wand->exception);
1634  if (colorize_image == (Image *) NULL)
1635  return(MagickFalse);
1636  ReplaceImageInList(&wand->images,colorize_image);
1637  return(MagickTrue);
1638 }
1639 
1640 /*
1641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1642 % %
1643 % %
1644 % %
1645 % M a g i c k C o l o r M a t r i x I m a g e %
1646 % %
1647 % %
1648 % %
1649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1650 %
1651 % MagickColorMatrixImage() apply color transformation to an image. The method
1652 % permits saturation changes, hue rotation, luminance to alpha, and various
1653 % other effects. Although variable-sized transformation matrices can be used,
1654 % typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1655 % (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1656 % except offsets are in column 6 rather than 5 (in support of CMYKA images)
1657 % and offsets are normalized (divide Flash offset by 255).
1658 %
1659 % The format of the MagickColorMatrixImage method is:
1660 %
1661 % MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1662 % const KernelInfo *color_matrix)
1663 %
1664 % A description of each parameter follows:
1665 %
1666 % o wand: the magick wand.
1667 %
1668 % o color_matrix: the color matrix.
1669 %
1670 */
1672  const KernelInfo *color_matrix)
1673 {
1674  Image
1675  *color_image;
1676 
1677  assert(wand != (MagickWand *) NULL);
1678  assert(wand->signature == MagickWandSignature);
1679  if (wand->debug != MagickFalse)
1680  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1681  if (color_matrix == (const KernelInfo *) NULL)
1682  return(MagickFalse);
1683  if (wand->images == (Image *) NULL)
1684  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1685  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1686  if (color_image == (Image *) NULL)
1687  return(MagickFalse);
1688  ReplaceImageInList(&wand->images,color_image);
1689  return(MagickTrue);
1690 }
1691 
1692 /*
1693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1694 % %
1695 % %
1696 % %
1697 % M a g i c k C o m b i n e I m a g e s %
1698 % %
1699 % %
1700 % %
1701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1702 %
1703 % MagickCombineImages() combines one or more images into a single image. The
1704 % grayscale value of the pixels of each image in the sequence is assigned in
1705 % order to the specified hannels of the combined image. The typical
1706 % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1707 %
1708 % The format of the MagickCombineImages method is:
1709 %
1710 % MagickWand *MagickCombineImages(MagickWand *wand,
1711 % const ColorspaceType colorspace)
1712 %
1713 % A description of each parameter follows:
1714 %
1715 % o wand: the magick wand.
1716 %
1717 % o colorspace: the colorspace.
1718 %
1719 */
1721  const ColorspaceType colorspace)
1722 {
1723  Image
1724  *combine_image;
1725 
1726  assert(wand != (MagickWand *) NULL);
1727  assert(wand->signature == MagickWandSignature);
1728  if (wand->debug != MagickFalse)
1729  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1730  if (wand->images == (Image *) NULL)
1731  return((MagickWand *) NULL);
1732  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1733  if (combine_image == (Image *) NULL)
1734  return((MagickWand *) NULL);
1735  return(CloneMagickWandFromImages(wand,combine_image));
1736 }
1737 
1738 /*
1739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1740 % %
1741 % %
1742 % %
1743 % M a g i c k C o m m e n t I m a g e %
1744 % %
1745 % %
1746 % %
1747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1748 %
1749 % MagickCommentImage() adds a comment to your image.
1750 %
1751 % The format of the MagickCommentImage method is:
1752 %
1753 % MagickBooleanType MagickCommentImage(MagickWand *wand,
1754 % const char *comment)
1755 %
1756 % A description of each parameter follows:
1757 %
1758 % o wand: the magick wand.
1759 %
1760 % o comment: the image comment.
1761 %
1762 */
1763 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1764  const char *comment)
1765 {
1766  MagickBooleanType
1767  status;
1768 
1769  assert(wand != (MagickWand *) NULL);
1770  assert(wand->signature == MagickWandSignature);
1771  if (wand->debug != MagickFalse)
1772  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1773  if (wand->images == (Image *) NULL)
1774  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1775  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1776  return(status);
1777 }
1778 
1779 /*
1780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1781 % %
1782 % %
1783 % %
1784 % M a g i c k C o m p a r e I m a g e L a y e r s %
1785 % %
1786 % %
1787 % %
1788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1789 %
1790 % MagickCompareImagesLayers() compares each image with the next in a sequence
1791 % and returns the maximum bounding region of any pixel differences it
1792 % discovers.
1793 %
1794 % The format of the MagickCompareImagesLayers method is:
1795 %
1796 % MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1797 % const LayerMethod method)
1798 %
1799 % A description of each parameter follows:
1800 %
1801 % o wand: the magick wand.
1802 %
1803 % o method: the compare method.
1804 %
1805 */
1807  const LayerMethod method)
1808 {
1809  Image
1810  *layers_image;
1811 
1812  assert(wand != (MagickWand *) NULL);
1813  assert(wand->signature == MagickWandSignature);
1814  if (wand->debug != MagickFalse)
1815  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1816  if (wand->images == (Image *) NULL)
1817  return((MagickWand *) NULL);
1818  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1819  if (layers_image == (Image *) NULL)
1820  return((MagickWand *) NULL);
1821  return(CloneMagickWandFromImages(wand,layers_image));
1822 }
1823 
1824 /*
1825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1826 % %
1827 % %
1828 % %
1829 % M a g i c k C o m p a r e I m a g e s %
1830 % %
1831 % %
1832 % %
1833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1834 %
1835 % MagickCompareImages() compares an image to a reconstructed image and returns
1836 % the specified difference image.
1837 %
1838 % The format of the MagickCompareImages method is:
1839 %
1840 % MagickWand *MagickCompareImages(MagickWand *wand,
1841 % const MagickWand *reference,const MetricType metric,
1842 % double *distortion)
1843 %
1844 % A description of each parameter follows:
1845 %
1846 % o wand: the magick wand.
1847 %
1848 % o reference: the reference wand.
1849 %
1850 % o metric: the metric.
1851 %
1852 % o distortion: the computed distortion between the images.
1853 %
1854 */
1856  const MagickWand *reference,const MetricType metric,double *distortion)
1857 {
1858  Image
1859  *compare_image;
1860 
1861 
1862  assert(wand != (MagickWand *) NULL);
1863  assert(wand->signature == MagickWandSignature);
1864  if (wand->debug != MagickFalse)
1865  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1866  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1867  {
1868  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1869  "ContainsNoImages","`%s'",wand->name);
1870  return((MagickWand *) NULL);
1871  }
1872  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1873  wand->exception);
1874  if (compare_image == (Image *) NULL)
1875  return((MagickWand *) NULL);
1876  return(CloneMagickWandFromImages(wand,compare_image));
1877 }
1878 
1879 /*
1880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1881 % %
1882 % %
1883 % %
1884 % M a g i c k C o m p o s i t e I m a g e %
1885 % %
1886 % %
1887 % %
1888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1889 %
1890 % MagickCompositeImage() composite one image onto another at the specified
1891 % offset.
1892 %
1893 % The format of the MagickCompositeImage method is:
1894 %
1895 % MagickBooleanType MagickCompositeImage(MagickWand *wand,
1896 % const MagickWand *source_wand,const CompositeOperator compose,
1897 % const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1898 %
1899 % A description of each parameter follows:
1900 %
1901 % o wand: the magick wand holding the destination images
1902 %
1903 % o source_image: the magick wand holding source image.
1904 %
1905 % o compose: This operator affects how the composite is applied to the
1906 % image. The default is Over. These are some of the compose methods
1907 % availble.
1908 %
1909 % OverCompositeOp InCompositeOp OutCompositeOp
1910 % AtopCompositeOp XorCompositeOp PlusCompositeOp
1911 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
1912 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1913 % DisplaceCompositeOp
1914 %
1915 % o clip_to_self: set to MagickTrue to limit composition to area composed.
1916 %
1917 % o x: the column offset of the composited image.
1918 %
1919 % o y: the row offset of the composited image.
1920 %
1921 */
1923  const MagickWand *source_wand,const CompositeOperator compose,
1924  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1925 {
1926  MagickBooleanType
1927  status;
1928 
1929  assert(wand != (MagickWand *) NULL);
1930  assert(wand->signature == MagickWandSignature);
1931  if (wand->debug != MagickFalse)
1932  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1933  if ((wand->images == (Image *) NULL) ||
1934  (source_wand->images == (Image *) NULL))
1935  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1936  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1937  x,y,wand->exception);
1938  return(status);
1939 }
1940 
1941 /*
1942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1943 % %
1944 % %
1945 % %
1946 % M a g i c k C o m p o s i t e I m a g e G r a v i t y %
1947 % %
1948 % %
1949 % %
1950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1951 %
1952 % MagickCompositeImageGravity() composite one image onto another using the
1953 % specified gravity.
1954 %
1955 % The format of the MagickCompositeImageGravity method is:
1956 %
1957 % MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1958 % const MagickWand *source_wand,const CompositeOperator compose,
1959 % const GravityType gravity)
1960 %
1961 % A description of each parameter follows:
1962 %
1963 % o wand: the magick wand holding the destination images
1964 %
1965 % o source_image: the magick wand holding source image.
1966 %
1967 % o compose: This operator affects how the composite is applied to the
1968 % image. The default is Over. These are some of the compose methods
1969 % availble.
1970 %
1971 % OverCompositeOp InCompositeOp OutCompositeOp
1972 % AtopCompositeOp XorCompositeOp PlusCompositeOp
1973 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
1974 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1975 % DisplaceCompositeOp
1976 %
1977 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
1978 % NorthEastGravity, WestGravity, CenterGravity,
1979 % EastGravity, SouthWestGravity, SouthGravity,
1980 % SouthEastGravity)
1981 %
1982 */
1984  const MagickWand *source_wand,const CompositeOperator compose,
1985  const GravityType gravity)
1986 {
1987  MagickBooleanType
1988  status;
1989 
1990  RectangleInfo
1991  geometry;
1992 
1993  assert(wand != (MagickWand *) NULL);
1994  assert(wand->signature == MagickWandSignature);
1995  if (wand->debug != MagickFalse)
1996  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1997  if ((wand->images == (Image *) NULL) ||
1998  (source_wand->images == (Image *) NULL))
1999  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2000  SetGeometry(source_wand->images,&geometry);
2001  GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
2002  &geometry);
2003  status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
2004  geometry.x,geometry.y,wand->exception);
2005  return(status);
2006 }
2007 
2008 /*
2009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010 % %
2011 % %
2012 % %
2013 % M a g i c k C o m p o s i t e L a y e r s %
2014 % %
2015 % %
2016 % %
2017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018 %
2019 % MagickCompositeLayers() composite the images in the source wand over the
2020 % images in the destination wand in sequence, starting with the current
2021 % image in both lists.
2022 %
2023 % Each layer from the two image lists are composted together until the end of
2024 % one of the image lists is reached. The offset of each composition is also
2025 % adjusted to match the virtual canvas offsets of each layer. As such the
2026 % given offset is relative to the virtual canvas, and not the actual image.
2027 %
2028 % Composition uses given x and y offsets, as the 'origin' location of the
2029 % source images virtual canvas (not the real image) allowing you to compose a
2030 % list of 'layer images' into the destiantioni images. This makes it well
2031 % sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
2032 % Animations' onto a static or other 'Coaleased Animation' destination image
2033 % list. GIF disposal handling is not looked at.
2034 %
2035 % Special case:- If one of the image sequences is the last image (just a
2036 % single image remaining), that image is repeatally composed with all the
2037 % images in the other image list. Either the source or destination lists may
2038 % be the single image, for this situation.
2039 %
2040 % In the case of a single destination image (or last image given), that image
2041 % will ve cloned to match the number of images remaining in the source image
2042 % list.
2043 %
2044 % This is equivelent to the "-layer Composite" Shell API operator.
2045 %
2046 % The format of the MagickCompositeLayers method is:
2047 %
2048 % MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2049 % const MagickWand *source_wand, const CompositeOperator compose,
2050 % const ssize_t x,const ssize_t y)
2051 %
2052 % A description of each parameter follows:
2053 %
2054 % o wand: the magick wand holding destaintion images
2055 %
2056 % o source_wand: the wand holding the source images
2057 %
2058 % o compose, x, y: composition arguments
2059 %
2060 */
2062  const MagickWand *source_wand,const CompositeOperator compose,
2063  const ssize_t x,const ssize_t y)
2064 {
2065  MagickBooleanType
2066  status;
2067 
2068  assert(wand != (MagickWand *) NULL);
2069  assert(wand->signature == MagickWandSignature);
2070  if (wand->debug != MagickFalse)
2071  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2072  if ((wand->images == (Image *) NULL) ||
2073  (source_wand->images == (Image *) NULL))
2074  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2075  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2076  status=MagickTrue; /* FUTURE: determine status from exceptions */
2077  return(status);
2078 }
2079 
2080 /*
2081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2082 % %
2083 % %
2084 % %
2085 % M a g i c k C o n t r a s t I m a g e %
2086 % %
2087 % %
2088 % %
2089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2090 %
2091 % MagickContrastImage() enhances the intensity differences between the lighter
2092 % and darker elements of the image. Set sharpen to a value other than 0 to
2093 % increase the image contrast otherwise the contrast is reduced.
2094 %
2095 % The format of the MagickContrastImage method is:
2096 %
2097 % MagickBooleanType MagickContrastImage(MagickWand *wand,
2098 % const MagickBooleanType sharpen)
2099 %
2100 % A description of each parameter follows:
2101 %
2102 % o wand: the magick wand.
2103 %
2104 % o sharpen: Increase or decrease image contrast.
2105 %
2106 %
2107 */
2109  const MagickBooleanType sharpen)
2110 {
2111  MagickBooleanType
2112  status;
2113 
2114  assert(wand != (MagickWand *) NULL);
2115  assert(wand->signature == MagickWandSignature);
2116  if (wand->debug != MagickFalse)
2117  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2118  if (wand->images == (Image *) NULL)
2119  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2120  status=ContrastImage(wand->images,sharpen,wand->exception);
2121  return(status);
2122 }
2123 
2124 /*
2125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2126 % %
2127 % %
2128 % %
2129 % 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 %
2130 % %
2131 % %
2132 % %
2133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2134 %
2135 % MagickContrastStretchImage() enhances the contrast of a color image by
2136 % adjusting the pixels color to span the entire range of colors available.
2137 % You can also reduce the influence of a particular channel with a gamma
2138 % value of 0.
2139 %
2140 % The format of the MagickContrastStretchImage method is:
2141 %
2142 % MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2143 % const double black_point,const double white_point)
2144 %
2145 % A description of each parameter follows:
2146 %
2147 % o wand: the magick wand.
2148 %
2149 % o black_point: the black point.
2150 %
2151 % o white_point: the white point.
2152 %
2153 */
2155  const double black_point,const double white_point)
2156 {
2157  MagickBooleanType
2158  status;
2159 
2160  assert(wand != (MagickWand *) NULL);
2161  assert(wand->signature == MagickWandSignature);
2162  if (wand->debug != MagickFalse)
2163  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2164  if (wand->images == (Image *) NULL)
2165  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2166  status=ContrastStretchImage(wand->images,black_point,white_point,
2167  wand->exception);
2168  return(status);
2169 }
2170 
2171 /*
2172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2173 % %
2174 % %
2175 % %
2176 % M a g i c k C o n v o l v e I m a g e %
2177 % %
2178 % %
2179 % %
2180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2181 %
2182 % MagickConvolveImage() applies a custom convolution kernel to the image.
2183 %
2184 % The format of the MagickConvolveImage method is:
2185 %
2186 % MagickBooleanType MagickConvolveImage(MagickWand *wand,
2187 % const KernelInfo *kernel)
2188 %
2189 % A description of each parameter follows:
2190 %
2191 % o wand: the magick wand.
2192 %
2193 % o kernel: An array of doubles representing the convolution kernel.
2194 %
2195 */
2197  const KernelInfo *kernel)
2198 {
2199  Image
2200  *filter_image;
2201 
2202  assert(wand != (MagickWand *) NULL);
2203  assert(wand->signature == MagickWandSignature);
2204  if (wand->debug != MagickFalse)
2205  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2206  if (kernel == (const KernelInfo *) NULL)
2207  return(MagickFalse);
2208  if (wand->images == (Image *) NULL)
2209  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2210  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2211  if (filter_image == (Image *) NULL)
2212  return(MagickFalse);
2213  ReplaceImageInList(&wand->images,filter_image);
2214  return(MagickTrue);
2215 }
2216 
2217 /*
2218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2219 % %
2220 % %
2221 % %
2222 % M a g i c k C r o p I m a g e %
2223 % %
2224 % %
2225 % %
2226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2227 %
2228 % MagickCropImage() extracts a region of the image.
2229 %
2230 % The format of the MagickCropImage method is:
2231 %
2232 % MagickBooleanType MagickCropImage(MagickWand *wand,
2233 % const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2234 %
2235 % A description of each parameter follows:
2236 %
2237 % o wand: the magick wand.
2238 %
2239 % o width: the region width.
2240 %
2241 % o height: the region height.
2242 %
2243 % o x: the region x-offset.
2244 %
2245 % o y: the region y-offset.
2246 %
2247 */
2248 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2249  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2250 {
2251  Image
2252  *crop_image;
2253 
2254  RectangleInfo
2255  crop;
2256 
2257  assert(wand != (MagickWand *) NULL);
2258  assert(wand->signature == MagickWandSignature);
2259  if (wand->debug != MagickFalse)
2260  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2261  if (wand->images == (Image *) NULL)
2262  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2263  crop.width=width;
2264  crop.height=height;
2265  crop.x=x;
2266  crop.y=y;
2267  crop_image=CropImage(wand->images,&crop,wand->exception);
2268  if (crop_image == (Image *) NULL)
2269  return(MagickFalse);
2270  ReplaceImageInList(&wand->images,crop_image);
2271  return(MagickTrue);
2272 }
2273 
2274 /*
2275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2276 % %
2277 % %
2278 % %
2279 % M a g i c k C y c l e C o l o r m a p I m a g e %
2280 % %
2281 % %
2282 % %
2283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2284 %
2285 % MagickCycleColormapImage() displaces an image's colormap by a given number
2286 % of positions. If you cycle the colormap a number of times you can produce
2287 % a psychodelic effect.
2288 %
2289 % The format of the MagickCycleColormapImage method is:
2290 %
2291 % MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2292 % const ssize_t displace)
2293 %
2294 % A description of each parameter follows:
2295 %
2296 % o wand: the magick wand.
2297 %
2298 % o pixel_wand: the pixel wand.
2299 %
2300 */
2302  const ssize_t displace)
2303 {
2304  MagickBooleanType
2305  status;
2306 
2307  assert(wand != (MagickWand *) NULL);
2308  assert(wand->signature == MagickWandSignature);
2309  if (wand->debug != MagickFalse)
2310  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2311  if (wand->images == (Image *) NULL)
2312  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2313  status=CycleColormapImage(wand->images,displace,wand->exception);
2314  return(status);
2315 }
2316 
2317 /*
2318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2319 % %
2320 % %
2321 % %
2322 % M a g i c k C o n s t i t u t e I m a g e %
2323 % %
2324 % %
2325 % %
2326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2327 %
2328 % MagickConstituteImage() adds an image to the wand comprised of the pixel
2329 % data you supply. The pixel data must be in scanline order top-to-bottom.
2330 % The data can be char, short int, int, float, or double. Float and double
2331 % require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2332 % is the maximum value the type can accomodate (e.g. 255 for char). For
2333 % example, to create a 640x480 image from unsigned red-green-blue character
2334 % data, use
2335 %
2336 % MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2337 %
2338 % The format of the MagickConstituteImage method is:
2339 %
2340 % MagickBooleanType MagickConstituteImage(MagickWand *wand,
2341 % const size_t columns,const size_t rows,const char *map,
2342 % const StorageType storage,void *pixels)
2343 %
2344 % A description of each parameter follows:
2345 %
2346 % o wand: the magick wand.
2347 %
2348 % o columns: width in pixels of the image.
2349 %
2350 % o rows: height in pixels of the image.
2351 %
2352 % o map: This string reflects the expected ordering of the pixel array.
2353 % It can be any combination or order of R = red, G = green, B = blue,
2354 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2355 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2356 % P = pad.
2357 %
2358 % o storage: Define the data type of the pixels. Float and double types are
2359 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2360 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2361 % LongPixel, QuantumPixel, or ShortPixel.
2362 %
2363 % o pixels: This array of values contain the pixel components as defined by
2364 % map and type. You must preallocate this array where the expected
2365 % length varies depending on the values of width, height, map, and type.
2366 %
2367 %
2368 */
2370  const size_t columns,const size_t rows,const char *map,
2371  const StorageType storage,const void *pixels)
2372 {
2373  Image
2374  *images;
2375 
2376  assert(wand != (MagickWand *) NULL);
2377  assert(wand->signature == MagickWandSignature);
2378  if (wand->debug != MagickFalse)
2379  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2380  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2381  if (images == (Image *) NULL)
2382  return(MagickFalse);
2383  return(InsertImageInWand(wand,images));
2384 }
2385 
2386 /*
2387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2388 % %
2389 % %
2390 % %
2391 % M a g i c k D e c i p h e r I m a g e %
2392 % %
2393 % %
2394 % %
2395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2396 %
2397 % MagickDecipherImage() converts cipher pixels to plain pixels.
2398 %
2399 % The format of the MagickDecipherImage method is:
2400 %
2401 % MagickBooleanType MagickDecipherImage(MagickWand *wand,
2402 % const char *passphrase)
2403 %
2404 % A description of each parameter follows:
2405 %
2406 % o wand: the magick wand.
2407 %
2408 % o passphrase: the passphrase.
2409 %
2410 */
2412  const char *passphrase)
2413 {
2414  assert(wand != (MagickWand *) NULL);
2415  assert(wand->signature == MagickWandSignature);
2416  if (wand->debug != MagickFalse)
2417  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2418  if (wand->images == (Image *) NULL)
2419  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2420  return(DecipherImage(wand->images,passphrase,wand->exception));
2421 }
2422 
2423 /*
2424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2425 % %
2426 % %
2427 % %
2428 % M a g i c k D e c o n s t r u c t I m a g e s %
2429 % %
2430 % %
2431 % %
2432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2433 %
2434 % MagickDeconstructImages() compares each image with the next in a sequence
2435 % and returns the maximum bounding region of any pixel differences it
2436 % discovers.
2437 %
2438 % The format of the MagickDeconstructImages method is:
2439 %
2440 % MagickWand *MagickDeconstructImages(MagickWand *wand)
2441 %
2442 % A description of each parameter follows:
2443 %
2444 % o wand: the magick wand.
2445 %
2446 */
2448 {
2449  Image
2450  *deconstruct_image;
2451 
2452  assert(wand != (MagickWand *) NULL);
2453  assert(wand->signature == MagickWandSignature);
2454  if (wand->debug != MagickFalse)
2455  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2456  if (wand->images == (Image *) NULL)
2457  return((MagickWand *) NULL);
2458  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2459  wand->exception);
2460  if (deconstruct_image == (Image *) NULL)
2461  return((MagickWand *) NULL);
2462  return(CloneMagickWandFromImages(wand,deconstruct_image));
2463 }
2464 
2465 /*
2466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2467 % %
2468 % %
2469 % %
2470 % M a g i c k D e s k e w I m a g e %
2471 % %
2472 % %
2473 % %
2474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2475 %
2476 % MagickDeskewImage() removes skew from the image. Skew is an artifact that
2477 % occurs in scanned images because of the camera being misaligned,
2478 % imperfections in the scanning or surface, or simply because the paper was
2479 % not placed completely flat when scanned.
2480 %
2481 % The format of the MagickDeskewImage method is:
2482 %
2483 % MagickBooleanType MagickDeskewImage(MagickWand *wand,
2484 % const double threshold)
2485 %
2486 % A description of each parameter follows:
2487 %
2488 % o wand: the magick wand.
2489 %
2490 % o threshold: separate background from foreground.
2491 %
2492 */
2493 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2494  const double threshold)
2495 {
2496  Image
2497  *sepia_image;
2498 
2499  assert(wand != (MagickWand *) NULL);
2500  assert(wand->signature == MagickWandSignature);
2501  if (wand->debug != MagickFalse)
2502  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2503  if (wand->images == (Image *) NULL)
2504  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2505  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2506  if (sepia_image == (Image *) NULL)
2507  return(MagickFalse);
2508  ReplaceImageInList(&wand->images,sepia_image);
2509  return(MagickTrue);
2510 }
2511 
2512 /*
2513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2514 % %
2515 % %
2516 % %
2517 % M a g i c k D e s p e c k l e I m a g e %
2518 % %
2519 % %
2520 % %
2521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2522 %
2523 % MagickDespeckleImage() reduces the speckle noise in an image while
2524 % perserving the edges of the original image.
2525 %
2526 % The format of the MagickDespeckleImage method is:
2527 %
2528 % MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2529 %
2530 % A description of each parameter follows:
2531 %
2532 % o wand: the magick wand.
2533 %
2534 */
2536 {
2537  Image
2538  *despeckle_image;
2539 
2540  assert(wand != (MagickWand *) NULL);
2541  assert(wand->signature == MagickWandSignature);
2542  if (wand->debug != MagickFalse)
2543  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2544  if (wand->images == (Image *) NULL)
2545  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2546  despeckle_image=DespeckleImage(wand->images,wand->exception);
2547  if (despeckle_image == (Image *) NULL)
2548  return(MagickFalse);
2549  ReplaceImageInList(&wand->images,despeckle_image);
2550  return(MagickTrue);
2551 }
2552 
2553 /*
2554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555 % %
2556 % %
2557 % %
2558 % M a g i c k D e s t r o y I m a g e %
2559 % %
2560 % %
2561 % %
2562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563 %
2564 % MagickDestroyImage() dereferences an image, deallocating memory associated
2565 % with the image if the reference count becomes zero.
2566 %
2567 % The format of the MagickDestroyImage method is:
2568 %
2569 % Image *MagickDestroyImage(Image *image)
2570 %
2571 % A description of each parameter follows:
2572 %
2573 % o image: the image.
2574 %
2575 */
2577 {
2578  return(DestroyImage(image));
2579 }
2580 
2581 /*
2582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2583 % %
2584 % %
2585 % %
2586 % M a g i c k D i s p l a y I m a g e %
2587 % %
2588 % %
2589 % %
2590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2591 %
2592 % MagickDisplayImage() displays an image.
2593 %
2594 % The format of the MagickDisplayImage method is:
2595 %
2596 % MagickBooleanType MagickDisplayImage(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 MagickDisplayImage(MagickWand *wand,
2607  const char *server_name)
2608 {
2609  Image
2610  *image;
2611 
2612  MagickBooleanType
2613  status;
2614 
2615  assert(wand != (MagickWand *) NULL);
2616  assert(wand->signature == MagickWandSignature);
2617  if (wand->debug != MagickFalse)
2618  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2619  if (wand->images == (Image *) NULL)
2620  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2621  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2622  if (image == (Image *) NULL)
2623  return(MagickFalse);
2624  (void) CloneString(&wand->image_info->server_name,server_name);
2625  status=DisplayImages(wand->image_info,image,wand->exception);
2626  image=DestroyImage(image);
2627  return(status);
2628 }
2629 
2630 /*
2631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2632 % %
2633 % %
2634 % %
2635 % M a g i c k D i s p l a y I m a g e s %
2636 % %
2637 % %
2638 % %
2639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2640 %
2641 % MagickDisplayImages() displays an image or image sequence.
2642 %
2643 % The format of the MagickDisplayImages method is:
2644 %
2645 % MagickBooleanType MagickDisplayImages(MagickWand *wand,
2646 % const char *server_name)
2647 %
2648 % A description of each parameter follows:
2649 %
2650 % o wand: the magick wand.
2651 %
2652 % o server_name: the X server name.
2653 %
2654 */
2656  const char *server_name)
2657 {
2658  MagickBooleanType
2659  status;
2660 
2661  assert(wand != (MagickWand *) NULL);
2662  assert(wand->signature == MagickWandSignature);
2663  if (wand->debug != MagickFalse)
2664  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2665  (void) CloneString(&wand->image_info->server_name,server_name);
2666  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2667  return(status);
2668 }
2669 
2670 /*
2671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2672 % %
2673 % %
2674 % %
2675 % M a g i c k D i s t o r t I m a g e %
2676 % %
2677 % %
2678 % %
2679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2680 %
2681 % MagickDistortImage() distorts an image using various distortion methods, by
2682 % mapping color lookups of the source image to a new destination image
2683 % usally of the same size as the source image, unless 'bestfit' is set to
2684 % true.
2685 %
2686 % If 'bestfit' is enabled, and distortion allows it, the destination image is
2687 % adjusted to ensure the whole source 'image' will just fit within the final
2688 % destination image, which will be sized and offset accordingly. Also in
2689 % many cases the virtual offset of the source image will be taken into
2690 % account in the mapping.
2691 %
2692 % The format of the MagickDistortImage method is:
2693 %
2694 % MagickBooleanType MagickDistortImage(MagickWand *wand,
2695 % const DistortMethod method,const size_t number_arguments,
2696 % const double *arguments,const MagickBooleanType bestfit)
2697 %
2698 % A description of each parameter follows:
2699 %
2700 % o image: the image to be distorted.
2701 %
2702 % o method: the method of image distortion.
2703 %
2704 % ArcDistortion always ignores the source image offset, and always
2705 % 'bestfit' the destination image with the top left corner offset
2706 % relative to the polar mapping center.
2707 %
2708 % Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2709 % style of image distortion.
2710 %
2711 % Affine, Perspective, and Bilinear, do least squares fitting of the
2712 % distortion when more than the minimum number of control point pairs
2713 % are provided.
2714 %
2715 % Perspective, and Bilinear, falls back to a Affine distortion when less
2716 % that 4 control point pairs are provided. While Affine distortions let
2717 % you use any number of control point pairs, that is Zero pairs is a
2718 % no-Op (viewport only) distrotion, one pair is a translation and two
2719 % pairs of control points do a scale-rotate-translate, without any
2720 % shearing.
2721 %
2722 % o number_arguments: the number of arguments given for this distortion
2723 % method.
2724 %
2725 % o arguments: the arguments for this distortion method.
2726 %
2727 % o bestfit: Attempt to resize destination to fit distorted source.
2728 %
2729 */
2730 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2731  const DistortMethod method,const size_t number_arguments,
2732  const double *arguments,const MagickBooleanType bestfit)
2733 {
2734  Image
2735  *distort_image;
2736 
2737  assert(wand != (MagickWand *) NULL);
2738  assert(wand->signature == MagickWandSignature);
2739  if (wand->debug != MagickFalse)
2740  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2741  if (wand->images == (Image *) NULL)
2742  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2743  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2744  bestfit,wand->exception);
2745  if (distort_image == (Image *) NULL)
2746  return(MagickFalse);
2747  ReplaceImageInList(&wand->images,distort_image);
2748  return(MagickTrue);
2749 }
2750 
2751 /*
2752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2753 % %
2754 % %
2755 % %
2756 % M a g i c k D r a w I m a g e %
2757 % %
2758 % %
2759 % %
2760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2761 %
2762 % MagickDrawImage() renders the drawing wand on the current image.
2763 %
2764 % The format of the MagickDrawImage method is:
2765 %
2766 % MagickBooleanType MagickDrawImage(MagickWand *wand,
2767 % const DrawingWand *drawing_wand)
2768 %
2769 % A description of each parameter follows:
2770 %
2771 % o wand: the magick wand.
2772 %
2773 % o drawing_wand: the draw wand.
2774 %
2775 */
2776 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2777  const DrawingWand *drawing_wand)
2778 {
2779  char
2780  *primitive;
2781 
2782  DrawInfo
2783  *draw_info;
2784 
2785  MagickBooleanType
2786  status;
2787 
2788  assert(wand != (MagickWand *) NULL);
2789  assert(wand->signature == MagickWandSignature);
2790  if (wand->debug != MagickFalse)
2791  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2792  if (wand->images == (Image *) NULL)
2793  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2794  draw_info=PeekDrawingWand(drawing_wand);
2795  if ((draw_info == (DrawInfo *) NULL) ||
2796  (draw_info->primitive == (char *) NULL))
2797  return(MagickFalse);
2798  primitive=AcquireString(draw_info->primitive);
2799  draw_info=DestroyDrawInfo(draw_info);
2800  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2801  draw_info->primitive=primitive;
2802  status=DrawImage(wand->images,draw_info,wand->exception);
2803  draw_info=DestroyDrawInfo(draw_info);
2804  return(status);
2805 }
2806 
2807 /*
2808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2809 % %
2810 % %
2811 % %
2812 % M a g i c k E d g e I m a g e %
2813 % %
2814 % %
2815 % %
2816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2817 %
2818 % MagickEdgeImage() enhance edges within the image with a convolution filter
2819 % of the given radius. Use a radius of 0 and Edge() selects a suitable
2820 % radius for you.
2821 %
2822 % The format of the MagickEdgeImage method is:
2823 %
2824 % MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2825 %
2826 % A description of each parameter follows:
2827 %
2828 % o wand: the magick wand.
2829 %
2830 % o radius: the radius of the pixel neighborhood.
2831 %
2832 */
2833 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2834  const double radius)
2835 {
2836  Image
2837  *edge_image;
2838 
2839  assert(wand != (MagickWand *) NULL);
2840  assert(wand->signature == MagickWandSignature);
2841  if (wand->debug != MagickFalse)
2842  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2843  if (wand->images == (Image *) NULL)
2844  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2845  edge_image=EdgeImage(wand->images,radius,wand->exception);
2846  if (edge_image == (Image *) NULL)
2847  return(MagickFalse);
2848  ReplaceImageInList(&wand->images,edge_image);
2849  return(MagickTrue);
2850 }
2851 
2852 /*
2853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2854 % %
2855 % %
2856 % %
2857 % M a g i c k E m b o s s I m a g e %
2858 % %
2859 % %
2860 % %
2861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2862 %
2863 % MagickEmbossImage() returns a grayscale image with a three-dimensional
2864 % effect. We convolve the image with a Gaussian operator of the given radius
2865 % and standard deviation (sigma). For reasonable results, radius should be
2866 % larger than sigma. Use a radius of 0 and Emboss() selects a suitable
2867 % radius for you.
2868 %
2869 % The format of the MagickEmbossImage method is:
2870 %
2871 % MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2872 % const double sigma)
2873 %
2874 % A description of each parameter follows:
2875 %
2876 % o wand: the magick wand.
2877 %
2878 % o radius: the radius of the Gaussian, in pixels, not counting the center
2879 % pixel.
2880 %
2881 % o sigma: the standard deviation of the Gaussian, in pixels.
2882 %
2883 */
2884 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2885  const double radius,const double sigma)
2886 {
2887  Image
2888  *emboss_image;
2889 
2890  assert(wand != (MagickWand *) NULL);
2891  assert(wand->signature == MagickWandSignature);
2892  if (wand->debug != MagickFalse)
2893  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2894  if (wand->images == (Image *) NULL)
2895  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2896  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2897  if (emboss_image == (Image *) NULL)
2898  return(MagickFalse);
2899  ReplaceImageInList(&wand->images,emboss_image);
2900  return(MagickTrue);
2901 }
2902 
2903 /*
2904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2905 % %
2906 % %
2907 % %
2908 % M a g i c k E n c i p h e r I m a g e %
2909 % %
2910 % %
2911 % %
2912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2913 %
2914 % MagickEncipherImage() converts plaint pixels to cipher pixels.
2915 %
2916 % The format of the MagickEncipherImage method is:
2917 %
2918 % MagickBooleanType MagickEncipherImage(MagickWand *wand,
2919 % const char *passphrase)
2920 %
2921 % A description of each parameter follows:
2922 %
2923 % o wand: the magick wand.
2924 %
2925 % o passphrase: the passphrase.
2926 %
2927 */
2929  const char *passphrase)
2930 {
2931  assert(wand != (MagickWand *) NULL);
2932  assert(wand->signature == MagickWandSignature);
2933  if (wand->debug != MagickFalse)
2934  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2935  if (wand->images == (Image *) NULL)
2936  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2937  return(EncipherImage(wand->images,passphrase,wand->exception));
2938 }
2939 
2940 /*
2941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2942 % %
2943 % %
2944 % %
2945 % M a g i c k E n h a n c e I m a g e %
2946 % %
2947 % %
2948 % %
2949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2950 %
2951 % MagickEnhanceImage() applies a digital filter that improves the quality of a
2952 % noisy image.
2953 %
2954 % The format of the MagickEnhanceImage method is:
2955 %
2956 % MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2957 %
2958 % A description of each parameter follows:
2959 %
2960 % o wand: the magick wand.
2961 %
2962 */
2963 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2964 {
2965  Image
2966  *enhance_image;
2967 
2968  assert(wand != (MagickWand *) NULL);
2969  assert(wand->signature == MagickWandSignature);
2970  if (wand->debug != MagickFalse)
2971  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2972  if (wand->images == (Image *) NULL)
2973  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2974  enhance_image=EnhanceImage(wand->images,wand->exception);
2975  if (enhance_image == (Image *) NULL)
2976  return(MagickFalse);
2977  ReplaceImageInList(&wand->images,enhance_image);
2978  return(MagickTrue);
2979 }
2980 
2981 /*
2982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2983 % %
2984 % %
2985 % %
2986 % M a g i c k E q u a l i z e I m a g e %
2987 % %
2988 % %
2989 % %
2990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2991 %
2992 % MagickEqualizeImage() equalizes the image histogram.
2993 %
2994 % The format of the MagickEqualizeImage method is:
2995 %
2996 % MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2997 %
2998 % A description of each parameter follows:
2999 %
3000 % o wand: the magick wand.
3001 %
3002 % o channel: the image channel(s).
3003 %
3004 */
3006 {
3007  MagickBooleanType
3008  status;
3009 
3010  assert(wand != (MagickWand *) NULL);
3011  assert(wand->signature == MagickWandSignature);
3012  if (wand->debug != MagickFalse)
3013  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3014  if (wand->images == (Image *) NULL)
3015  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3016  status=EqualizeImage(wand->images,wand->exception);
3017  return(status);
3018 }
3019 
3020 /*
3021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3022 % %
3023 % %
3024 % %
3025 % M a g i c k E v a l u a t e I m a g e %
3026 % %
3027 % %
3028 % %
3029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3030 %
3031 % MagickEvaluateImage() applys an arithmetic, relational, or logical
3032 % expression to an image. Use these operators to lighten or darken an image,
3033 % to increase or decrease contrast in an image, or to produce the "negative"
3034 % of an image.
3035 %
3036 % The format of the MagickEvaluateImage method is:
3037 %
3038 % MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3039 % const MagickEvaluateOperator operator,const double value)
3040 % MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3041 % const MagickEvaluateOperator operator)
3042 %
3043 % A description of each parameter follows:
3044 %
3045 % o wand: the magick wand.
3046 %
3047 % o op: A channel operator.
3048 %
3049 % o value: A value value.
3050 %
3051 */
3052 
3054  const MagickEvaluateOperator op)
3055 {
3056  Image
3057  *evaluate_image;
3058 
3059  assert(wand != (MagickWand *) NULL);
3060  assert(wand->signature == MagickWandSignature);
3061  if (wand->debug != MagickFalse)
3062  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3063  if (wand->images == (Image *) NULL)
3064  return((MagickWand *) NULL);
3065  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3066  if (evaluate_image == (Image *) NULL)
3067  return((MagickWand *) NULL);
3068  return(CloneMagickWandFromImages(wand,evaluate_image));
3069 }
3070 
3072  const MagickEvaluateOperator op,const double value)
3073 {
3074  MagickBooleanType
3075  status;
3076 
3077  assert(wand != (MagickWand *) NULL);
3078  assert(wand->signature == MagickWandSignature);
3079  if (wand->debug != MagickFalse)
3080  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3081  if (wand->images == (Image *) NULL)
3082  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3083  status=EvaluateImage(wand->images,op,value,wand->exception);
3084  return(status);
3085 }
3086 
3087 /*
3088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3089 % %
3090 % %
3091 % %
3092 % M a g i c k E x p o r t I m a g e P i x e l s %
3093 % %
3094 % %
3095 % %
3096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3097 %
3098 % MagickExportImagePixels() extracts pixel data from an image and returns it
3099 % to you. The method returns MagickTrue on success otherwise MagickFalse if
3100 % an error is encountered. The data is returned as char, short int, int,
3101 % ssize_t, float, or double in the order specified by map.
3102 %
3103 % Suppose you want to extract the first scanline of a 640x480 image as
3104 % character data in red-green-blue order:
3105 %
3106 % MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3107 %
3108 % The format of the MagickExportImagePixels method is:
3109 %
3110 % MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3111 % const ssize_t x,const ssize_t y,const size_t columns,
3112 % const size_t rows,const char *map,const StorageType storage,
3113 % void *pixels)
3114 %
3115 % A description of each parameter follows:
3116 %
3117 % o wand: the magick wand.
3118 %
3119 % o x, y, columns, rows: These values define the perimeter
3120 % of a region of pixels you want to extract.
3121 %
3122 % o map: This string reflects the expected ordering of the pixel array.
3123 % It can be any combination or order of R = red, G = green, B = blue,
3124 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3125 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3126 % P = pad.
3127 %
3128 % o storage: Define the data type of the pixels. Float and double types are
3129 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3130 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3131 % LongPixel, QuantumPixel, or ShortPixel.
3132 %
3133 % o pixels: This array of values contain the pixel components as defined by
3134 % map and type. You must preallocate this array where the expected
3135 % length varies depending on the values of width, height, map, and type.
3136 %
3137 */
3139  const ssize_t x,const ssize_t y,const size_t columns,
3140  const size_t rows,const char *map,const StorageType storage,
3141  void *pixels)
3142 {
3143  MagickBooleanType
3144  status;
3145 
3146  assert(wand != (MagickWand *) NULL);
3147  assert(wand->signature == MagickWandSignature);
3148  if (wand->debug != MagickFalse)
3149  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3150  if (wand->images == (Image *) NULL)
3151  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3152  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3153  storage,pixels,wand->exception);
3154  return(status);
3155 }
3156 
3157 /*
3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3159 % %
3160 % %
3161 % %
3162 % M a g i c k E x t e n t I m a g e %
3163 % %
3164 % %
3165 % %
3166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3167 %
3168 % MagickExtentImage() extends the image as defined by the geometry, gravity,
3169 % and wand background color. Set the (x,y) offset of the geometry to move
3170 % the original wand relative to the extended wand.
3171 %
3172 % The format of the MagickExtentImage method is:
3173 %
3174 % MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3175 % const size_t height,const ssize_t x,const ssize_t y)
3176 %
3177 % A description of each parameter follows:
3178 %
3179 % o wand: the magick wand.
3180 %
3181 % o width: the region width.
3182 %
3183 % o height: the region height.
3184 %
3185 % o x: the region x offset.
3186 %
3187 % o y: the region y offset.
3188 %
3189 */
3190 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3191  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3192 {
3193  Image
3194  *extent_image;
3195 
3196  RectangleInfo
3197  extent;
3198 
3199  assert(wand != (MagickWand *) NULL);
3200  assert(wand->signature == MagickWandSignature);
3201  if (wand->debug != MagickFalse)
3202  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3203  if (wand->images == (Image *) NULL)
3204  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3205  extent.width=width;
3206  extent.height=height;
3207  extent.x=x;
3208  extent.y=y;
3209  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3210  if (extent_image == (Image *) NULL)
3211  return(MagickFalse);
3212  ReplaceImageInList(&wand->images,extent_image);
3213  return(MagickTrue);
3214 }
3215 
3216 /*
3217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3218 % %
3219 % %
3220 % %
3221 % M a g i c k F l i p I m a g e %
3222 % %
3223 % %
3224 % %
3225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3226 %
3227 % MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3228 % around the central x-axis.
3229 %
3230 % The format of the MagickFlipImage method is:
3231 %
3232 % MagickBooleanType MagickFlipImage(MagickWand *wand)
3233 %
3234 % A description of each parameter follows:
3235 %
3236 % o wand: the magick wand.
3237 %
3238 */
3239 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3240 {
3241  Image
3242  *flip_image;
3243 
3244  assert(wand != (MagickWand *) NULL);
3245  assert(wand->signature == MagickWandSignature);
3246  if (wand->debug != MagickFalse)
3247  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3248  if (wand->images == (Image *) NULL)
3249  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3250  flip_image=FlipImage(wand->images,wand->exception);
3251  if (flip_image == (Image *) NULL)
3252  return(MagickFalse);
3253  ReplaceImageInList(&wand->images,flip_image);
3254  return(MagickTrue);
3255 }
3256 
3257 /*
3258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3259 % %
3260 % %
3261 % %
3262 % 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 %
3263 % %
3264 % %
3265 % %
3266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3267 %
3268 % MagickFloodfillPaintImage() changes the color value of any pixel that matches
3269 % target and is an immediate neighbor. If the method FillToBorderMethod is
3270 % specified, the color value is changed for any neighbor pixel that does not
3271 % match the bordercolor member of image.
3272 %
3273 % The format of the MagickFloodfillPaintImage method is:
3274 %
3275 % MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3276 % const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3277 % const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3278 %
3279 % A description of each parameter follows:
3280 %
3281 % o wand: the magick wand.
3282 %
3283 % o fill: the floodfill color pixel wand.
3284 %
3285 % o fuzz: By default target must match a particular pixel color
3286 % exactly. However, in many cases two colors may differ by a small amount.
3287 % The fuzz member of image defines how much tolerance is acceptable to
3288 % consider two colors as the same. For example, set fuzz to 10 and the
3289 % color red at intensities of 100 and 102 respectively are now interpreted
3290 % as the same color for the purposes of the floodfill.
3291 %
3292 % o bordercolor: the border color pixel wand.
3293 %
3294 % o x,y: the starting location of the operation.
3295 %
3296 % o invert: paint any pixel that does not match the target color.
3297 %
3298 */
3300  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3301  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3302 {
3303  DrawInfo
3304  *draw_info;
3305 
3306  MagickBooleanType
3307  status;
3308 
3309  PixelInfo
3310  target;
3311 
3312  assert(wand != (MagickWand *) NULL);
3313  assert(wand->signature == MagickWandSignature);
3314  if (wand->debug != MagickFalse)
3315  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3316  if (wand->images == (Image *) NULL)
3317  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3318  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3319  PixelGetQuantumPacket(fill,&draw_info->fill);
3320  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3321  wand->images->columns,y % wand->images->rows,&target,wand->exception);
3322  if (bordercolor != (PixelWand *) NULL)
3323  PixelGetMagickColor(bordercolor,&target);
3324  wand->images->fuzz=fuzz;
3325  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3326  wand->exception);
3327  draw_info=DestroyDrawInfo(draw_info);
3328  return(status);
3329 }
3330 
3331 /*
3332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3333 % %
3334 % %
3335 % %
3336 % M a g i c k F l o p I m a g e %
3337 % %
3338 % %
3339 % %
3340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3341 %
3342 % MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3343 % around the central y-axis.
3344 %
3345 % The format of the MagickFlopImage method is:
3346 %
3347 % MagickBooleanType MagickFlopImage(MagickWand *wand)
3348 %
3349 % A description of each parameter follows:
3350 %
3351 % o wand: the magick wand.
3352 %
3353 */
3354 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3355 {
3356  Image
3357  *flop_image;
3358 
3359  assert(wand != (MagickWand *) NULL);
3360  assert(wand->signature == MagickWandSignature);
3361  if (wand->debug != MagickFalse)
3362  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3363  if (wand->images == (Image *) NULL)
3364  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3365  flop_image=FlopImage(wand->images,wand->exception);
3366  if (flop_image == (Image *) NULL)
3367  return(MagickFalse);
3368  ReplaceImageInList(&wand->images,flop_image);
3369  return(MagickTrue);
3370 }
3371 
3372 /*
3373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3374 % %
3375 % %
3376 % %
3377 % 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 %
3378 % %
3379 % %
3380 % %
3381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3382 %
3383 % MagickForwardFourierTransformImage() implements the discrete Fourier
3384 % transform (DFT) of the image either as a magnitude / phase or real /
3385 % imaginary image pair.
3386 %
3387 % The format of the MagickForwardFourierTransformImage method is:
3388 %
3389 % MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3390 % const MagickBooleanType magnitude)
3391 %
3392 % A description of each parameter follows:
3393 %
3394 % o wand: the magick wand.
3395 %
3396 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
3397 % imaginary image pair.
3398 %
3399 */
3401  MagickWand *wand,const MagickBooleanType magnitude)
3402 {
3403  Image
3404  *forward_image;
3405 
3406  assert(wand != (MagickWand *) NULL);
3407  assert(wand->signature == MagickWandSignature);
3408  if (wand->debug != MagickFalse)
3409  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3410  if (wand->images == (Image *) NULL)
3411  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3412  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3413  wand->exception);
3414  if (forward_image == (Image *) NULL)
3415  return(MagickFalse);
3416  ReplaceImageInList(&wand->images,forward_image);
3417  return(MagickTrue);
3418 }
3419 
3420 /*
3421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3422 % %
3423 % %
3424 % %
3425 % M a g i c k F r a m e I m a g e %
3426 % %
3427 % %
3428 % %
3429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3430 %
3431 % MagickFrameImage() adds a simulated three-dimensional border around the
3432 % image. The width and height specify the border width of the vertical and
3433 % horizontal sides of the frame. The inner and outer bevels indicate the
3434 % width of the inner and outer shadows of the frame.
3435 %
3436 % The format of the MagickFrameImage method is:
3437 %
3438 % MagickBooleanType MagickFrameImage(MagickWand *wand,
3439 % const PixelWand *matte_color,const size_t width,
3440 % const size_t height,const ssize_t inner_bevel,
3441 % const ssize_t outer_bevel,const CompositeOperator compose)
3442 %
3443 % A description of each parameter follows:
3444 %
3445 % o wand: the magick wand.
3446 %
3447 % o matte_color: the frame color pixel wand.
3448 %
3449 % o width: the border width.
3450 %
3451 % o height: the border height.
3452 %
3453 % o inner_bevel: the inner bevel width.
3454 %
3455 % o outer_bevel: the outer bevel width.
3456 %
3457 % o compose: the composite operator.
3458 %
3459 */
3460 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3461  const PixelWand *matte_color,const size_t width,const size_t height,
3462  const ssize_t inner_bevel,const ssize_t outer_bevel,
3463  const CompositeOperator compose)
3464 {
3465  Image
3466  *frame_image;
3467 
3468  FrameInfo
3469  frame_info;
3470 
3471  assert(wand != (MagickWand *) NULL);
3472  assert(wand->signature == MagickWandSignature);
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  (void) memset(&frame_info,0,sizeof(frame_info));
3478  frame_info.width=wand->images->columns+2*width;
3479  frame_info.height=wand->images->rows+2*height;
3480  frame_info.x=(ssize_t) width;
3481  frame_info.y=(ssize_t) height;
3482  frame_info.inner_bevel=inner_bevel;
3483  frame_info.outer_bevel=outer_bevel;
3484  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3485  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3486  if (frame_image == (Image *) NULL)
3487  return(MagickFalse);
3488  ReplaceImageInList(&wand->images,frame_image);
3489  return(MagickTrue);
3490 }
3491 
3492 /*
3493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3494 % %
3495 % %
3496 % %
3497 % M a g i c k F u n c t i o n I m a g e %
3498 % %
3499 % %
3500 % %
3501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3502 %
3503 % MagickFunctionImage() applys an arithmetic, relational, or logical
3504 % expression to an image. Use these operators to lighten or darken an image,
3505 % to increase or decrease contrast in an image, or to produce the "negative"
3506 % of an image.
3507 %
3508 % The format of the MagickFunctionImage method is:
3509 %
3510 % MagickBooleanType MagickFunctionImage(MagickWand *wand,
3511 % const MagickFunction function,const size_t number_arguments,
3512 % const double *arguments)
3513 %
3514 % A description of each parameter follows:
3515 %
3516 % o wand: the magick wand.
3517 %
3518 % o function: the image function.
3519 %
3520 % o number_arguments: the number of function arguments.
3521 %
3522 % o arguments: the function arguments.
3523 %
3524 */
3526  const MagickFunction function,const size_t number_arguments,
3527  const double *arguments)
3528 {
3529  MagickBooleanType
3530  status;
3531 
3532  assert(wand != (MagickWand *) NULL);
3533  assert(wand->signature == MagickWandSignature);
3534  if (wand->debug != MagickFalse)
3535  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3536  if (wand->images == (Image *) NULL)
3537  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3538  status=FunctionImage(wand->images,function,number_arguments,arguments,
3539  wand->exception);
3540  return(status);
3541 }
3542 
3543 /*
3544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3545 % %
3546 % %
3547 % %
3548 % M a g i c k F x I m a g e %
3549 % %
3550 % %
3551 % %
3552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3553 %
3554 % MagickFxImage() evaluate expression for each pixel in the image.
3555 %
3556 % The format of the MagickFxImage method is:
3557 %
3558 % MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3559 %
3560 % A description of each parameter follows:
3561 %
3562 % o wand: the magick wand.
3563 %
3564 % o expression: the expression.
3565 %
3566 */
3567 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3568 {
3569  Image
3570  *fx_image;
3571 
3572  assert(wand != (MagickWand *) NULL);
3573  assert(wand->signature == MagickWandSignature);
3574  if (wand->debug != MagickFalse)
3575  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3576  if (wand->images == (Image *) NULL)
3577  return((MagickWand *) NULL);
3578  fx_image=FxImage(wand->images,expression,wand->exception);
3579  if (fx_image == (Image *) NULL)
3580  return((MagickWand *) NULL);
3581  return(CloneMagickWandFromImages(wand,fx_image));
3582 }
3583 
3584 /*
3585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3586 % %
3587 % %
3588 % %
3589 % M a g i c k G a m m a I m a g e %
3590 % %
3591 % %
3592 % %
3593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3594 %
3595 % MagickGammaImage() gamma-corrects an image. The same image viewed on
3596 % different devices will have perceptual differences in the way the image's
3597 % intensities are represented on the screen. Specify individual gamma levels
3598 % for the red, green, and blue channels, or adjust all three with the gamma
3599 % parameter. Values typically range from 0.8 to 2.3.
3600 %
3601 % You can also reduce the influence of a particular channel with a gamma
3602 % value of 0.
3603 %
3604 % The format of the MagickGammaImage method is:
3605 %
3606 % MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3607 %
3608 % A description of each parameter follows:
3609 %
3610 % o wand: the magick wand.
3611 %
3612 % o level: Define the level of gamma correction.
3613 %
3614 */
3615 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3616  const double gamma)
3617 {
3618  MagickBooleanType
3619  status;
3620 
3621  assert(wand != (MagickWand *) NULL);
3622  assert(wand->signature == MagickWandSignature);
3623  if (wand->debug != MagickFalse)
3624  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3625  if (wand->images == (Image *) NULL)
3626  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3627  status=GammaImage(wand->images,gamma,wand->exception);
3628  return(status);
3629 }
3630 
3631 /*
3632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633 % %
3634 % %
3635 % %
3636 % M a g i c k G a u s s i a n B l u r I m a g e %
3637 % %
3638 % %
3639 % %
3640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641 %
3642 % MagickGaussianBlurImage() blurs an image. We convolve the image with a
3643 % Gaussian operator of the given radius and standard deviation (sigma).
3644 % For reasonable results, the radius should be larger than sigma. Use a
3645 % radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3646 %
3647 % The format of the MagickGaussianBlurImage method is:
3648 %
3649 % MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3650 % const double radius,const double sigma)
3651 %
3652 % A description of each parameter follows:
3653 %
3654 % o wand: the magick wand.
3655 %
3656 % o radius: the radius of the Gaussian, in pixels, not counting the center
3657 % pixel.
3658 %
3659 % o sigma: the standard deviation of the Gaussian, in pixels.
3660 %
3661 */
3663  const double radius,const double sigma)
3664 {
3665  Image
3666  *blur_image;
3667 
3668  assert(wand != (MagickWand *) NULL);
3669  assert(wand->signature == MagickWandSignature);
3670  if (wand->debug != MagickFalse)
3671  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3672  if (wand->images == (Image *) NULL)
3673  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3674  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3675  if (blur_image == (Image *) NULL)
3676  return(MagickFalse);
3677  ReplaceImageInList(&wand->images,blur_image);
3678  return(MagickTrue);
3679 }
3680 
3681 /*
3682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3683 % %
3684 % %
3685 % %
3686 % M a g i c k G e t I m a g e %
3687 % %
3688 % %
3689 % %
3690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3691 %
3692 % MagickGetImage() gets the image at the current image index.
3693 %
3694 % The format of the MagickGetImage method is:
3695 %
3696 % MagickWand *MagickGetImage(MagickWand *wand)
3697 %
3698 % A description of each parameter follows:
3699 %
3700 % o wand: the magick wand.
3701 %
3702 */
3704 {
3705  Image
3706  *image;
3707 
3708  assert(wand != (MagickWand *) NULL);
3709  assert(wand->signature == MagickWandSignature);
3710  if (wand->debug != MagickFalse)
3711  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3712  if (wand->images == (Image *) NULL)
3713  {
3714  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3715  "ContainsNoImages","`%s'",wand->name);
3716  return((MagickWand *) NULL);
3717  }
3718  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3719  if (image == (Image *) NULL)
3720  return((MagickWand *) NULL);
3721  return(CloneMagickWandFromImages(wand,image));
3722 }
3723 
3724 /*
3725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3726 % %
3727 % %
3728 % %
3729 % 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 %
3730 % %
3731 % %
3732 % %
3733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3734 %
3735 % MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3736 % is not activated. That is, the image is RGB rather than RGBA or CMYK rather
3737 % than CMYKA.
3738 %
3739 % The format of the MagickGetImageAlphaChannel method is:
3740 %
3741 % MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3742 %
3743 % A description of each parameter follows:
3744 %
3745 % o wand: the magick wand.
3746 %
3747 */
3749 {
3750  assert(wand != (MagickWand *) NULL);
3751  assert(wand->signature == MagickWandSignature);
3752  if (wand->debug != MagickFalse)
3753  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3754  if (wand->images == (Image *) NULL)
3755  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3756  return(GetImageAlphaChannel(wand->images));
3757 }
3758 
3759 /*
3760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3761 % %
3762 % %
3763 % %
3764 % M a g i c k G e t I m a g e C l i p M a s k %
3765 % %
3766 % %
3767 % %
3768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3769 %
3770 % MagickGetImageMask() gets the image clip mask at the current image index.
3771 %
3772 % The format of the MagickGetImageMask method is:
3773 %
3774 % MagickWand *MagickGetImageMask(MagickWand *wand)
3775 %
3776 % A description of each parameter follows:
3777 %
3778 % o wand: the magick wand.
3779 %
3780 % o type: type of mask, ReadPixelMask or WritePixelMask.
3781 %
3782 */
3784  const PixelMask type)
3785 {
3786  Image
3787  *image;
3788 
3789  assert(wand != (MagickWand *) NULL);
3790  assert(wand->signature == MagickWandSignature);
3791  if (wand->debug != MagickFalse)
3792  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3793  if (wand->images == (Image *) NULL)
3794  {
3795  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3796  "ContainsNoImages","`%s'",wand->name);
3797  return((MagickWand *) NULL);
3798  }
3799  image=GetImageMask(wand->images,type,wand->exception);
3800  if (image == (Image *) NULL)
3801  return((MagickWand *) NULL);
3802  return(CloneMagickWandFromImages(wand,image));
3803 }
3804 
3805 /*
3806 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3807 % %
3808 % %
3809 % %
3810 % 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 %
3811 % %
3812 % %
3813 % %
3814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3815 %
3816 % MagickGetImageBackgroundColor() returns the image background color.
3817 %
3818 % The format of the MagickGetImageBackgroundColor method is:
3819 %
3820 % MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3821 % PixelWand *background_color)
3822 %
3823 % A description of each parameter follows:
3824 %
3825 % o wand: the magick wand.
3826 %
3827 % o background_color: Return the background color.
3828 %
3829 */
3831  PixelWand *background_color)
3832 {
3833  assert(wand != (MagickWand *) NULL);
3834  assert(wand->signature == MagickWandSignature);
3835  if (wand->debug != MagickFalse)
3836  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3837  if (wand->images == (Image *) NULL)
3838  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3839  PixelSetPixelColor(background_color,&wand->images->background_color);
3840  return(MagickTrue);
3841 }
3842 
3843 /*
3844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3845 % %
3846 % %
3847 % %
3848 % M a g i c k G e t I m a g e B l o b %
3849 % %
3850 % %
3851 % %
3852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3853 %
3854 % MagickGetImageBlob() implements direct to memory image formats. It returns
3855 % the image as a blob (a formatted "file" in memory) and its length, starting
3856 % from the current position in the image sequence. Use MagickSetImageFormat()
3857 % to set the format to write to the blob (GIF, JPEG, PNG, etc.).
3858 %
3859 % Utilize MagickResetIterator() to ensure the write is from the beginning of
3860 % the image sequence.
3861 %
3862 % Use MagickRelinquishMemory() to free the blob when you are done with it.
3863 %
3864 % The format of the MagickGetImageBlob method is:
3865 %
3866 % unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3867 %
3868 % A description of each parameter follows:
3869 %
3870 % o wand: the magick wand.
3871 %
3872 % o length: the length of the blob.
3873 %
3874 */
3875 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3876 {
3877  unsigned char
3878  *blob;
3879 
3880  assert(wand != (MagickWand *) NULL);
3881  assert(wand->signature == MagickWandSignature);
3882  if (wand->debug != MagickFalse)
3883  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3884  if (wand->images == (Image *) NULL)
3885  {
3886  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3887  "ContainsNoImages","`%s'",wand->name);
3888  return((unsigned char *) NULL);
3889  }
3890  blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
3891  wand->exception);
3892  return(blob);
3893 }
3894 
3895 /*
3896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3897 % %
3898 % %
3899 % %
3900 % M a g i c k G e t I m a g e s B l o b %
3901 % %
3902 % %
3903 % %
3904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3905 %
3906 % MagickGetImagesBlob() implements direct to memory image formats. It
3907 % returns the image sequence as a blob and its length. The format of the image
3908 % determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
3909 % return a different image format, use MagickSetImageFormat().
3910 %
3911 % Note, some image formats do not permit multiple images to the same image
3912 % stream (e.g. JPEG). in this instance, just the first image of the
3913 % sequence is returned as a blob.
3914 %
3915 % The format of the MagickGetImagesBlob method is:
3916 %
3917 % unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3918 %
3919 % A description of each parameter follows:
3920 %
3921 % o wand: the magick wand.
3922 %
3923 % o length: the length of the blob.
3924 %
3925 */
3926 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3927 {
3928  unsigned char
3929  *blob;
3930 
3931  assert(wand != (MagickWand *) NULL);
3932  assert(wand->signature == MagickWandSignature);
3933  if (wand->debug != MagickFalse)
3934  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3935  if (wand->images == (Image *) NULL)
3936  {
3937  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3938  "ContainsNoImages","`%s'",wand->name);
3939  return((unsigned char *) NULL);
3940  }
3941  blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
3942  wand->images),length,wand->exception);
3943  return(blob);
3944 }
3945 
3946 /*
3947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3948 % %
3949 % %
3950 % %
3951 % 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 %
3952 % %
3953 % %
3954 % %
3955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3956 %
3957 % MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3958 % image.
3959 %
3960 % The format of the MagickGetImageBluePrimary method is:
3961 %
3962 % MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3963 % double *y,double *z)
3964 %
3965 % A description of each parameter follows:
3966 %
3967 % o wand: the magick wand.
3968 %
3969 % o x: the chromaticity blue primary x-point.
3970 %
3971 % o y: the chromaticity blue primary y-point.
3972 %
3973 % o z: the chromaticity blue primary z-point.
3974 %
3975 */
3977  double *x,double *y,double *z)
3978 {
3979  assert(wand != (MagickWand *) NULL);
3980  assert(wand->signature == MagickWandSignature);
3981  if (wand->debug != MagickFalse)
3982  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3983  if (wand->images == (Image *) NULL)
3984  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3985  *x=wand->images->chromaticity.blue_primary.x;
3986  *y=wand->images->chromaticity.blue_primary.y;
3987  *z=wand->images->chromaticity.blue_primary.z;
3988  return(MagickTrue);
3989 }
3990 
3991 /*
3992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3993 % %
3994 % %
3995 % %
3996 % 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 %
3997 % %
3998 % %
3999 % %
4000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4001 %
4002 % MagickGetImageBorderColor() returns the image border color.
4003 %
4004 % The format of the MagickGetImageBorderColor method is:
4005 %
4006 % MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4007 % PixelWand *border_color)
4008 %
4009 % A description of each parameter follows:
4010 %
4011 % o wand: the magick wand.
4012 %
4013 % o border_color: Return the border color.
4014 %
4015 */
4017  PixelWand *border_color)
4018 {
4019  assert(wand != (MagickWand *) NULL);
4020  assert(wand->signature == MagickWandSignature);
4021  if (wand->debug != MagickFalse)
4022  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4023  if (wand->images == (Image *) NULL)
4024  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4025  PixelSetPixelColor(border_color,&wand->images->border_color);
4026  return(MagickTrue);
4027 }
4028 
4029 /*
4030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4031 % %
4032 % %
4033 % %
4034 % M a g i c k G e t I m a g e F e a t u r e s %
4035 % %
4036 % %
4037 % %
4038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4039 %
4040 % MagickGetImageFeatures() returns features for each channel in the
4041 % image in each of four directions (horizontal, vertical, left and right
4042 % diagonals) for the specified distance. The features include the angular
4043 % second moment, contrast, correlation, sum of squares: variance, inverse
4044 % difference moment, sum average, sum varience, sum entropy, entropy,
4045 % difference variance, difference entropy, information measures of
4046 % correlation 1, information measures of correlation 2, and maximum
4047 % correlation coefficient. You can access the red channel contrast, for
4048 % example, like this:
4049 %
4050 % channel_features=MagickGetImageFeatures(wand,1);
4051 % contrast=channel_features[RedPixelChannel].contrast[0];
4052 %
4053 % Use MagickRelinquishMemory() to free the statistics buffer.
4054 %
4055 % The format of the MagickGetImageFeatures method is:
4056 %
4057 % ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4058 % const size_t distance)
4059 %
4060 % A description of each parameter follows:
4061 %
4062 % o wand: the magick wand.
4063 %
4064 % o distance: the distance.
4065 %
4066 */
4068  const size_t distance)
4069 {
4070  assert(wand != (MagickWand *) NULL);
4071  assert(wand->signature == MagickWandSignature);
4072  if (wand->debug != MagickFalse)
4073  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4074  if (wand->images == (Image *) NULL)
4075  {
4076  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4077  "ContainsNoImages","`%s'",wand->name);
4078  return((ChannelFeatures *) NULL);
4079  }
4080  return(GetImageFeatures(wand->images,distance,wand->exception));
4081 }
4082 
4083 /*
4084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4085 % %
4086 % %
4087 % %
4088 % M a g i c k G e t I m a g e K u r t o s i s %
4089 % %
4090 % %
4091 % %
4092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4093 %
4094 % MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4095 % more image channels.
4096 %
4097 % The format of the MagickGetImageKurtosis method is:
4098 %
4099 % MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4100 % double *kurtosis,double *skewness)
4101 %
4102 % A description of each parameter follows:
4103 %
4104 % o wand: the magick wand.
4105 %
4106 % o kurtosis: The kurtosis for the specified channel(s).
4107 %
4108 % o skewness: The skewness for the specified channel(s).
4109 %
4110 */
4112  double *kurtosis,double *skewness)
4113 {
4114  MagickBooleanType
4115  status;
4116 
4117  assert(wand != (MagickWand *) NULL);
4118  assert(wand->signature == MagickWandSignature);
4119  if (wand->debug != MagickFalse)
4120  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4121  if (wand->images == (Image *) NULL)
4122  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4123  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4124  return(status);
4125 }
4126 
4127 /*
4128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4129 % %
4130 % %
4131 % %
4132 % M a g i c k G e t I m a g e M e a n %
4133 % %
4134 % %
4135 % %
4136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4137 %
4138 % MagickGetImageMean() gets the mean and standard deviation of one or more
4139 % image channels.
4140 %
4141 % The format of the MagickGetImageMean method is:
4142 %
4143 % MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4144 % double *standard_deviation)
4145 %
4146 % A description of each parameter follows:
4147 %
4148 % o wand: the magick wand.
4149 %
4150 % o channel: the image channel(s).
4151 %
4152 % o mean: The mean pixel value for the specified channel(s).
4153 %
4154 % o standard_deviation: The standard deviation for the specified channel(s).
4155 %
4156 */
4157 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4158  double *standard_deviation)
4159 {
4160  MagickBooleanType
4161  status;
4162 
4163  assert(wand != (MagickWand *) NULL);
4164  assert(wand->signature == MagickWandSignature);
4165  if (wand->debug != MagickFalse)
4166  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4167  if (wand->images == (Image *) NULL)
4168  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4169  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4170  return(status);
4171 }
4172 
4173 /*
4174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4175 % %
4176 % %
4177 % %
4178 % M a g i c k G e t I m a g e R a n g e %
4179 % %
4180 % %
4181 % %
4182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4183 %
4184 % MagickGetImageRange() gets the range for one or more image channels.
4185 %
4186 % The format of the MagickGetImageRange method is:
4187 %
4188 % MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4189 % double *maxima)
4190 %
4191 % A description of each parameter follows:
4192 %
4193 % o wand: the magick wand.
4194 %
4195 % o minima: The minimum pixel value for the specified channel(s).
4196 %
4197 % o maxima: The maximum pixel value for the specified channel(s).
4198 %
4199 */
4201  double *minima,double *maxima)
4202 {
4203  MagickBooleanType
4204  status;
4205 
4206  assert(wand != (MagickWand *) NULL);
4207  assert(wand->signature == MagickWandSignature);
4208  if (wand->debug != MagickFalse)
4209  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4210  if (wand->images == (Image *) NULL)
4211  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4212  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4213  return(status);
4214 }
4215 
4216 /*
4217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4218 % %
4219 % %
4220 % %
4221 % M a g i c k G e t I m a g e S t a t i s t i c s %
4222 % %
4223 % %
4224 % %
4225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4226 %
4227 % MagickGetImageStatistics() returns statistics for each channel in the
4228 % image. The statistics include the channel depth, its minima and
4229 % maxima, the mean, the standard deviation, the kurtosis and the skewness.
4230 % You can access the red channel mean, for example, like this:
4231 %
4232 % channel_statistics=MagickGetImageStatistics(wand);
4233 % red_mean=channel_statistics[RedPixelChannel].mean;
4234 %
4235 % Use MagickRelinquishMemory() to free the statistics buffer.
4236 %
4237 % The format of the MagickGetImageStatistics method is:
4238 %
4239 % ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4240 %
4241 % A description of each parameter follows:
4242 %
4243 % o wand: the magick wand.
4244 %
4245 */
4247 {
4248  assert(wand != (MagickWand *) NULL);
4249  assert(wand->signature == MagickWandSignature);
4250  if (wand->debug != MagickFalse)
4251  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4252  if (wand->images == (Image *) NULL)
4253  {
4254  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4255  "ContainsNoImages","`%s'",wand->name);
4256  return((ChannelStatistics *) NULL);
4257  }
4258  return(GetImageStatistics(wand->images,wand->exception));
4259 }
4260 
4261 /*
4262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4263 % %
4264 % %
4265 % %
4266 % 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 %
4267 % %
4268 % %
4269 % %
4270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4271 %
4272 % MagickGetImageColormapColor() returns the color of the specified colormap
4273 % index.
4274 %
4275 % The format of the MagickGetImageColormapColor method is:
4276 %
4277 % MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4278 % const size_t index,PixelWand *color)
4279 %
4280 % A description of each parameter follows:
4281 %
4282 % o wand: the magick wand.
4283 %
4284 % o index: the offset into the image colormap.
4285 %
4286 % o color: Return the colormap color in this wand.
4287 %
4288 */
4290  const size_t index,PixelWand *color)
4291 {
4292  assert(wand != (MagickWand *) NULL);
4293  assert(wand->signature == MagickWandSignature);
4294  if (wand->debug != MagickFalse)
4295  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4296  if (wand->images == (Image *) NULL)
4297  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4298  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4299  (index >= wand->images->colors))
4300  {
4301  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4302  "InvalidColormapIndex","`%s'",wand->name);
4303  return(MagickFalse);
4304  }
4305  PixelSetPixelColor(color,wand->images->colormap+index);
4306  return(MagickTrue);
4307 }
4308 
4309 /*
4310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4311 % %
4312 % %
4313 % %
4314 % M a g i c k G e t I m a g e C o l o r s %
4315 % %
4316 % %
4317 % %
4318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4319 %
4320 % MagickGetImageColors() gets the number of unique colors in the image.
4321 %
4322 % The format of the MagickGetImageColors method is:
4323 %
4324 % size_t MagickGetImageColors(MagickWand *wand)
4325 %
4326 % A description of each parameter follows:
4327 %
4328 % o wand: the magick wand.
4329 %
4330 */
4332 {
4333  assert(wand != (MagickWand *) NULL);
4334  assert(wand->signature == MagickWandSignature);
4335  if (wand->debug != MagickFalse)
4336  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4337  if (wand->images == (Image *) NULL)
4338  {
4339  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4340  "ContainsNoImages","`%s'",wand->name);
4341  return(0);
4342  }
4343  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4344 }
4345 
4346 /*
4347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4348 % %
4349 % %
4350 % %
4351 % M a g i c k G e t I m a g e C o l o r s p a c e %
4352 % %
4353 % %
4354 % %
4355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4356 %
4357 % MagickGetImageColorspace() gets the image colorspace.
4358 %
4359 % The format of the MagickGetImageColorspace method is:
4360 %
4361 % ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4362 %
4363 % A description of each parameter follows:
4364 %
4365 % o wand: the magick wand.
4366 %
4367 */
4369 {
4370  assert(wand != (MagickWand *) NULL);
4371  assert(wand->signature == MagickWandSignature);
4372  if (wand->debug != MagickFalse)
4373  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4374  if (wand->images == (Image *) NULL)
4375  {
4376  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4377  "ContainsNoImages","`%s'",wand->name);
4378  return(UndefinedColorspace);
4379  }
4380  return(wand->images->colorspace);
4381 }
4382 
4383 /*
4384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4385 % %
4386 % %
4387 % %
4388 % M a g i c k G e t I m a g e C o m p o s e %
4389 % %
4390 % %
4391 % %
4392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4393 %
4394 % MagickGetImageCompose() returns the composite operator associated with the
4395 % image.
4396 %
4397 % The format of the MagickGetImageCompose method is:
4398 %
4399 % CompositeOperator MagickGetImageCompose(MagickWand *wand)
4400 %
4401 % A description of each parameter follows:
4402 %
4403 % o wand: the magick wand.
4404 %
4405 */
4407 {
4408  assert(wand != (MagickWand *) NULL);
4409  assert(wand->signature == MagickWandSignature);
4410  if (wand->debug != MagickFalse)
4411  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4412  if (wand->images == (Image *) NULL)
4413  {
4414  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4415  "ContainsNoImages","`%s'",wand->name);
4416  return(UndefinedCompositeOp);
4417  }
4418  return(wand->images->compose);
4419 }
4420 
4421 /*
4422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4423 % %
4424 % %
4425 % %
4426 % 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 %
4427 % %
4428 % %
4429 % %
4430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4431 %
4432 % MagickGetImageCompression() gets the image compression.
4433 %
4434 % The format of the MagickGetImageCompression method is:
4435 %
4436 % CompressionType MagickGetImageCompression(MagickWand *wand)
4437 %
4438 % A description of each parameter follows:
4439 %
4440 % o wand: the magick wand.
4441 %
4442 */
4444 {
4445  assert(wand != (MagickWand *) NULL);
4446  assert(wand->signature == MagickWandSignature);
4447  if (wand->debug != MagickFalse)
4448  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4449  if (wand->images == (Image *) NULL)
4450  {
4451  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4452  "ContainsNoImages","`%s'",wand->name);
4453  return(UndefinedCompression);
4454  }
4455  return(wand->images->compression);
4456 }
4457 
4458 /*
4459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4460 % %
4461 % %
4462 % %
4463 % 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 %
4464 % %
4465 % %
4466 % %
4467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4468 %
4469 % MagickGetImageCompressionQuality() gets the image compression quality.
4470 %
4471 % The format of the MagickGetImageCompressionQuality method is:
4472 %
4473 % size_t MagickGetImageCompressionQuality(MagickWand *wand)
4474 %
4475 % A description of each parameter follows:
4476 %
4477 % o wand: the magick wand.
4478 %
4479 */
4481 {
4482  assert(wand != (MagickWand *) NULL);
4483  assert(wand->signature == MagickWandSignature);
4484  if (wand->debug != MagickFalse)
4485  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4486  if (wand->images == (Image *) NULL)
4487  {
4488  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4489  "ContainsNoImages","`%s'",wand->name);
4490  return(0UL);
4491  }
4492  return(wand->images->quality);
4493 }
4494 
4495 /*
4496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4497 % %
4498 % %
4499 % %
4500 % M a g i c k G e t I m a g e D e l a y %
4501 % %
4502 % %
4503 % %
4504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4505 %
4506 % MagickGetImageDelay() gets the image delay.
4507 %
4508 % The format of the MagickGetImageDelay method is:
4509 %
4510 % size_t MagickGetImageDelay(MagickWand *wand)
4511 %
4512 % A description of each parameter follows:
4513 %
4514 % o wand: the magick wand.
4515 %
4516 */
4518 {
4519  assert(wand != (MagickWand *) NULL);
4520  assert(wand->signature == MagickWandSignature);
4521  if (wand->debug != MagickFalse)
4522  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4523  if (wand->images == (Image *) NULL)
4524  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4525  return(wand->images->delay);
4526 }
4527 
4528 /*
4529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4530 % %
4531 % %
4532 % %
4533 % M a g i c k G e t I m a g e D e p t h %
4534 % %
4535 % %
4536 % %
4537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4538 %
4539 % MagickGetImageDepth() gets the image depth.
4540 %
4541 % The format of the MagickGetImageDepth method is:
4542 %
4543 % size_t MagickGetImageDepth(MagickWand *wand)
4544 %
4545 % A description of each parameter follows:
4546 %
4547 % o wand: the magick wand.
4548 %
4549 */
4551 {
4552  assert(wand != (MagickWand *) NULL);
4553  assert(wand->signature == MagickWandSignature);
4554  if (wand->debug != MagickFalse)
4555  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556  if (wand->images == (Image *) NULL)
4557  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4558  return(wand->images->depth);
4559 }
4560 
4561 /*
4562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4563 % %
4564 % %
4565 % %
4566 % M a g i c k G e t I m a g e D i s p o s e %
4567 % %
4568 % %
4569 % %
4570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4571 %
4572 % MagickGetImageDispose() gets the image disposal method.
4573 %
4574 % The format of the MagickGetImageDispose method is:
4575 %
4576 % DisposeType MagickGetImageDispose(MagickWand *wand)
4577 %
4578 % A description of each parameter follows:
4579 %
4580 % o wand: the magick wand.
4581 %
4582 */
4584 {
4585  assert(wand != (MagickWand *) NULL);
4586  assert(wand->signature == MagickWandSignature);
4587  if (wand->debug != MagickFalse)
4588  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4589  if (wand->images == (Image *) NULL)
4590  {
4591  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4592  "ContainsNoImages","`%s'",wand->name);
4593  return(UndefinedDispose);
4594  }
4595  return((DisposeType) wand->images->dispose);
4596 }
4597 
4598 /*
4599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4600 % %
4601 % %
4602 % %
4603 % M a g i c k G e t I m a g e D i s t o r t i o n %
4604 % %
4605 % %
4606 % %
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4608 %
4609 % MagickGetImageDistortion() compares an image to a reconstructed image and
4610 % returns the specified distortion metric.
4611 %
4612 % The format of the MagickGetImageDistortion method is:
4613 %
4614 % MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4615 % const MagickWand *reference,const MetricType metric,
4616 % double *distortion)
4617 %
4618 % A description of each parameter follows:
4619 %
4620 % o wand: the magick wand.
4621 %
4622 % o reference: the reference wand.
4623 %
4624 % o metric: the metric.
4625 %
4626 % o distortion: the computed distortion between the images.
4627 %
4628 */
4630  const MagickWand *reference,const MetricType metric,double *distortion)
4631 {
4632  MagickBooleanType
4633  status;
4634 
4635  assert(wand != (MagickWand *) NULL);
4636  assert(wand->signature == MagickWandSignature);
4637  if (wand->debug != MagickFalse)
4638  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4639  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4640  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4641  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4642  wand->exception);
4643  return(status);
4644 }
4645 
4646 /*
4647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4648 % %
4649 % %
4650 % %
4651 % M a g i c k G e t I m a g e D i s t o r t i o n s %
4652 % %
4653 % %
4654 % %
4655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656 %
4657 % MagickGetImageDistortions() compares one or more pixel channels of an
4658 % image to a reconstructed image and returns the specified distortion metrics.
4659 %
4660 % Use MagickRelinquishMemory() to free the metrics when you are done with them.
4661 %
4662 % The format of the MagickGetImageDistortion method is:
4663 %
4664 % double *MagickGetImageDistortion(MagickWand *wand,
4665 % const MagickWand *reference,const MetricType metric)
4666 %
4667 % A description of each parameter follows:
4668 %
4669 % o wand: the magick wand.
4670 %
4671 % o reference: the reference wand.
4672 %
4673 % o metric: the metric.
4674 %
4675 */
4677  const MagickWand *reference,const MetricType metric)
4678 {
4679  double
4680  *channel_distortion;
4681 
4682  assert(wand != (MagickWand *) NULL);
4683  assert(wand->signature == MagickWandSignature);
4684  if (wand->debug != MagickFalse)
4685  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4686  assert(reference != (MagickWand *) NULL);
4687  assert(reference->signature == MagickWandSignature);
4688  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4689  {
4690  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4691  "ContainsNoImages","`%s'",wand->name);
4692  return((double *) NULL);
4693  }
4694  channel_distortion=GetImageDistortions(wand->images,reference->images,
4695  metric,wand->exception);
4696  return(channel_distortion);
4697 }
4698 
4699 /*
4700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4701 % %
4702 % %
4703 % %
4704 % M a g i c k G e t I m a g e E n d i a n %
4705 % %
4706 % %
4707 % %
4708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4709 %
4710 % MagickGetImageEndian() gets the image endian.
4711 %
4712 % The format of the MagickGetImageEndian method is:
4713 %
4714 % EndianType MagickGetImageEndian(MagickWand *wand)
4715 %
4716 % A description of each parameter follows:
4717 %
4718 % o wand: the magick wand.
4719 %
4720 */
4722 {
4723  assert(wand != (MagickWand *) NULL);
4724  assert(wand->signature == MagickWandSignature);
4725  if (wand->debug != MagickFalse)
4726  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4727  if (wand->images == (Image *) NULL)
4728  {
4729  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4730  "ContainsNoImages","`%s'",wand->name);
4731  return(UndefinedEndian);
4732  }
4733  return(wand->images->endian);
4734 }
4735 
4736 /*
4737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4738 % %
4739 % %
4740 % %
4741 % M a g i c k G e t I m a g e F i l e n a m e %
4742 % %
4743 % %
4744 % %
4745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4746 %
4747 % MagickGetImageFilename() returns the filename of a particular image in a
4748 % sequence.
4749 %
4750 % The format of the MagickGetImageFilename method is:
4751 %
4752 % char *MagickGetImageFilename(MagickWand *wand)
4753 %
4754 % A description of each parameter follows:
4755 %
4756 % o wand: the magick wand.
4757 %
4758 */
4760 {
4761  assert(wand != (MagickWand *) NULL);
4762  assert(wand->signature == MagickWandSignature);
4763  if (wand->debug != MagickFalse)
4764  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4765  if (wand->images == (Image *) NULL)
4766  {
4767  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4768  "ContainsNoImages","`%s'",wand->name);
4769  return((char *) NULL);
4770  }
4771  return(AcquireString(wand->images->filename));
4772 }
4773 
4774 /*
4775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4776 % %
4777 % %
4778 % %
4779 % M a g i c k G e t I m a g e F o r m a t %
4780 % %
4781 % %
4782 % %
4783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4784 %
4785 % MagickGetImageFormat() returns the format of a particular image in a
4786 % sequence.
4787 %
4788 % The format of the MagickGetImageFormat method is:
4789 %
4790 % char *MagickGetImageFormat(MagickWand *wand)
4791 %
4792 % A description of each parameter follows:
4793 %
4794 % o wand: the magick wand.
4795 %
4796 */
4798 {
4799  assert(wand != (MagickWand *) NULL);
4800  assert(wand->signature == MagickWandSignature);
4801  if (wand->debug != MagickFalse)
4802  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4803  if (wand->images == (Image *) NULL)
4804  {
4805  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4806  "ContainsNoImages","`%s'",wand->name);
4807  return((char *) NULL);
4808  }
4809  return(AcquireString(wand->images->magick));
4810 }
4811 
4812 /*
4813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4814 % %
4815 % %
4816 % %
4817 % M a g i c k G e t I m a g e F u z z %
4818 % %
4819 % %
4820 % %
4821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4822 %
4823 % MagickGetImageFuzz() gets the image fuzz.
4824 %
4825 % The format of the MagickGetImageFuzz method is:
4826 %
4827 % double MagickGetImageFuzz(MagickWand *wand)
4828 %
4829 % A description of each parameter follows:
4830 %
4831 % o wand: the magick wand.
4832 %
4833 */
4835 {
4836  assert(wand != (MagickWand *) NULL);
4837  assert(wand->signature == MagickWandSignature);
4838  if (wand->debug != MagickFalse)
4839  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4840  if (wand->images == (Image *) NULL)
4841  {
4842  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4843  "ContainsNoImages","`%s'",wand->name);
4844  return(0.0);
4845  }
4846  return(wand->images->fuzz);
4847 }
4848 
4849 /*
4850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4851 % %
4852 % %
4853 % %
4854 % M a g i c k G e t I m a g e G a m m a %
4855 % %
4856 % %
4857 % %
4858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4859 %
4860 % MagickGetImageGamma() gets the image gamma.
4861 %
4862 % The format of the MagickGetImageGamma method is:
4863 %
4864 % double MagickGetImageGamma(MagickWand *wand)
4865 %
4866 % A description of each parameter follows:
4867 %
4868 % o wand: the magick wand.
4869 %
4870 */
4872 {
4873  assert(wand != (MagickWand *) NULL);
4874  assert(wand->signature == MagickWandSignature);
4875  if (wand->debug != MagickFalse)
4876  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4877  if (wand->images == (Image *) NULL)
4878  {
4879  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4880  "ContainsNoImages","`%s'",wand->name);
4881  return(0.0);
4882  }
4883  return(wand->images->gamma);
4884 }
4885 
4886 /*
4887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4888 % %
4889 % %
4890 % %
4891 % M a g i c k G e t I m a g e G r a v i t y %
4892 % %
4893 % %
4894 % %
4895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4896 %
4897 % MagickGetImageGravity() gets the image gravity.
4898 %
4899 % The format of the MagickGetImageGravity method is:
4900 %
4901 % GravityType MagickGetImageGravity(MagickWand *wand)
4902 %
4903 % A description of each parameter follows:
4904 %
4905 % o wand: the magick wand.
4906 %
4907 */
4909 {
4910  assert(wand != (MagickWand *) NULL);
4911  assert(wand->signature == MagickWandSignature);
4912  if (wand->debug != MagickFalse)
4913  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4914  if (wand->images == (Image *) NULL)
4915  {
4916  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4917  "ContainsNoImages","`%s'",wand->name);
4918  return(UndefinedGravity);
4919  }
4920  return(wand->images->gravity);
4921 }
4922 
4923 /*
4924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4925 % %
4926 % %
4927 % %
4928 % 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 %
4929 % %
4930 % %
4931 % %
4932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4933 %
4934 % MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4935 %
4936 % The format of the MagickGetImageGreenPrimary method is:
4937 %
4938 % MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4939 % double *y,double *z)
4940 %
4941 % A description of each parameter follows:
4942 %
4943 % o wand: the magick wand.
4944 %
4945 % o x: the chromaticity green primary x-point.
4946 %
4947 % o y: the chromaticity green primary y-point.
4948 %
4949 % o z: the chromaticity green primary z-point.
4950 %
4951 */
4953  double *x,double *y,double *z)
4954 {
4955  assert(wand != (MagickWand *) NULL);
4956  assert(wand->signature == MagickWandSignature);
4957  if (wand->debug != MagickFalse)
4958  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4959  if (wand->images == (Image *) NULL)
4960  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4961  *x=wand->images->chromaticity.green_primary.x;
4962  *y=wand->images->chromaticity.green_primary.y;
4963  *z=wand->images->chromaticity.green_primary.z;
4964  return(MagickTrue);
4965 }
4966 
4967 /*
4968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4969 % %
4970 % %
4971 % %
4972 % M a g i c k G e t I m a g e H e i g h t %
4973 % %
4974 % %
4975 % %
4976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4977 %
4978 % MagickGetImageHeight() returns the image height.
4979 %
4980 % The format of the MagickGetImageHeight method is:
4981 %
4982 % size_t MagickGetImageHeight(MagickWand *wand)
4983 %
4984 % A description of each parameter follows:
4985 %
4986 % o wand: the magick wand.
4987 %
4988 */
4990 {
4991  assert(wand != (MagickWand *) NULL);
4992  assert(wand->signature == MagickWandSignature);
4993  if (wand->debug != MagickFalse)
4994  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4995  if (wand->images == (Image *) NULL)
4996  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4997  return(wand->images->rows);
4998 }
4999 
5000 /*
5001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5002 % %
5003 % %
5004 % %
5005 % M a g i c k G e t I m a g e H i s t o g r a m %
5006 % %
5007 % %
5008 % %
5009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5010 %
5011 % MagickGetImageHistogram() returns the image histogram as an array of
5012 % PixelWand wands.
5013 %
5014 % The format of the MagickGetImageHistogram method is:
5015 %
5016 % PixelWand **MagickGetImageHistogram(MagickWand *wand,
5017 % size_t *number_colors)
5018 %
5019 % A description of each parameter follows:
5020 %
5021 % o wand: the magick wand.
5022 %
5023 % o number_colors: the number of unique colors in the image and the number
5024 % of pixel wands returned.
5025 %
5026 */
5028  size_t *number_colors)
5029 {
5030  PixelInfo
5031  *histogram;
5032 
5033  PixelWand
5034  **pixel_wands;
5035 
5036  register ssize_t
5037  i;
5038 
5039  assert(wand != (MagickWand *) NULL);
5040  assert(wand->signature == MagickWandSignature);
5041  if (wand->debug != MagickFalse)
5042  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5043  if (wand->images == (Image *) NULL)
5044  {
5045  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5046  "ContainsNoImages","`%s'",wand->name);
5047  return((PixelWand **) NULL);
5048  }
5049  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5050  if (histogram == (PixelInfo *) NULL)
5051  return((PixelWand **) NULL);
5052  pixel_wands=NewPixelWands(*number_colors);
5053  for (i=0; i < (ssize_t) *number_colors; i++)
5054  {
5055  PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5056  PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5057  }
5058  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5059  return(pixel_wands);
5060 }
5061 
5062 /*
5063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5064 % %
5065 % %
5066 % %
5067 % 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 %
5068 % %
5069 % %
5070 % %
5071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5072 %
5073 % MagickGetImageInterlaceScheme() gets the image interlace scheme.
5074 %
5075 % The format of the MagickGetImageInterlaceScheme method is:
5076 %
5077 % InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5078 %
5079 % A description of each parameter follows:
5080 %
5081 % o wand: the magick wand.
5082 %
5083 */
5085 {
5086  assert(wand != (MagickWand *) NULL);
5087  assert(wand->signature == MagickWandSignature);
5088  if (wand->debug != MagickFalse)
5089  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5090  if (wand->images == (Image *) NULL)
5091  {
5092  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5093  "ContainsNoImages","`%s'",wand->name);
5094  return(UndefinedInterlace);
5095  }
5096  return(wand->images->interlace);
5097 }
5098 
5099 /*
5100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5101 % %
5102 % %
5103 % %
5104 % 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 %
5105 % %
5106 % %
5107 % %
5108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5109 %
5110 % MagickGetImageInterpolateMethod() returns the interpolation method for the
5111 % sepcified image.
5112 %
5113 % The format of the MagickGetImageInterpolateMethod method is:
5114 %
5115 % PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5116 %
5117 % A description of each parameter follows:
5118 %
5119 % o wand: the magick wand.
5120 %
5121 */
5123  MagickWand *wand)
5124 {
5125  assert(wand != (MagickWand *) NULL);
5126  assert(wand->signature == MagickWandSignature);
5127  if (wand->debug != MagickFalse)
5128  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5129  if (wand->images == (Image *) NULL)
5130  {
5131  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5132  "ContainsNoImages","`%s'",wand->name);
5133  return(UndefinedInterpolatePixel);
5134  }
5135  return(wand->images->interpolate);
5136 }
5137 
5138 /*
5139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5140 % %
5141 % %
5142 % %
5143 % M a g i c k G e t I m a g e I t e r a t i o n s %
5144 % %
5145 % %
5146 % %
5147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5148 %
5149 % MagickGetImageIterations() gets the image iterations.
5150 %
5151 % The format of the MagickGetImageIterations method is:
5152 %
5153 % size_t MagickGetImageIterations(MagickWand *wand)
5154 %
5155 % A description of each parameter follows:
5156 %
5157 % o wand: the magick wand.
5158 %
5159 */
5161 {
5162  assert(wand != (MagickWand *) NULL);
5163  assert(wand->signature == MagickWandSignature);
5164  if (wand->debug != MagickFalse)
5165  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5166  if (wand->images == (Image *) NULL)
5167  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5168  return(wand->images->iterations);
5169 }
5170 
5171 /*
5172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5173 % %
5174 % %
5175 % %
5176 % M a g i c k G e t I m a g e L e n g t h %
5177 % %
5178 % %
5179 % %
5180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5181 %
5182 % MagickGetImageLength() returns the image length in bytes.
5183 %
5184 % The format of the MagickGetImageLength method is:
5185 %
5186 % MagickBooleanType MagickGetImageLength(MagickWand *wand,
5187 % MagickSizeType *length)
5188 %
5189 % A description of each parameter follows:
5190 %
5191 % o wand: the magick wand.
5192 %
5193 % o length: the image length in bytes.
5194 %
5195 */
5197  MagickSizeType *length)
5198 {
5199  assert(wand != (MagickWand *) NULL);
5200  assert(wand->signature == MagickWandSignature);
5201  if (wand->debug != MagickFalse)
5202  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5203  if (wand->images == (Image *) NULL)
5204  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5205  *length=GetBlobSize(wand->images);
5206  return(MagickTrue);
5207 }
5208 
5209 /*
5210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5211 % %
5212 % %
5213 % %
5214 % M a g i c k G e t I m a g e M a t t e C o l o r %
5215 % %
5216 % %
5217 % %
5218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5219 %
5220 % MagickGetImageMatteColor() returns the image matte color.
5221 %
5222 % The format of the MagickGetImageMatteColor method is:
5223 %
5224 % MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5225 % PixelWand *matte_color)
5226 %
5227 % A description of each parameter follows:
5228 %
5229 % o wand: the magick wand.
5230 %
5231 % o matte_color: return the alpha color.
5232 %
5233 */
5235  PixelWand *matte_color)
5236 {
5237  assert(wand != (MagickWand *)NULL);
5238  assert(wand->signature == MagickWandSignature);
5239  if (wand->debug != MagickFalse)
5240  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5241  if (wand->images == (Image *)NULL)
5242  ThrowWandException(WandError, "ContainsNoImages", wand->name);
5243  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5244  return(MagickTrue);
5245 }
5246 
5247 /*
5248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5249 % %
5250 % %
5251 % %
5252 % 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 %
5253 % %
5254 % %
5255 % %
5256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5257 %
5258 % MagickGetImageOrientation() returns the image orientation.
5259 %
5260 % The format of the MagickGetImageOrientation method is:
5261 %
5262 % OrientationType MagickGetImageOrientation(MagickWand *wand)
5263 %
5264 % A description of each parameter follows:
5265 %
5266 % o wand: the magick wand.
5267 %
5268 */
5270 {
5271  assert(wand != (MagickWand *) NULL);
5272  assert(wand->signature == MagickWandSignature);
5273  if (wand->debug != MagickFalse)
5274  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5275  if (wand->images == (Image *) NULL)
5276  {
5277  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5278  "ContainsNoImages","`%s'",wand->name);
5279  return(UndefinedOrientation);
5280  }
5281  return(wand->images->orientation);
5282 }
5283 
5284 /*
5285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5286 % %
5287 % %
5288 % %
5289 % M a g i c k G e t I m a g e P a g e %
5290 % %
5291 % %
5292 % %
5293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5294 %
5295 % MagickGetImagePage() returns the page geometry associated with the image.
5296 %
5297 % The format of the MagickGetImagePage method is:
5298 %
5299 % MagickBooleanType MagickGetImagePage(MagickWand *wand,
5300 % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5301 %
5302 % A description of each parameter follows:
5303 %
5304 % o wand: the magick wand.
5305 %
5306 % o width: the page width.
5307 %
5308 % o height: the page height.
5309 %
5310 % o x: the page x-offset.
5311 %
5312 % o y: the page y-offset.
5313 %
5314 */
5315 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5316  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5317 {
5318  assert(wand != (const MagickWand *) NULL);
5319  assert(wand->signature == MagickWandSignature);
5320  if (wand->debug != MagickFalse)
5321  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5322  if (wand->images == (Image *) NULL)
5323  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5324  *width=wand->images->page.width;
5325  *height=wand->images->page.height;
5326  *x=wand->images->page.x;
5327  *y=wand->images->page.y;
5328  return(MagickTrue);
5329 }
5330 
5331 /*
5332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5333 % %
5334 % %
5335 % %
5336 % M a g i c k G e t I m a g e P i x e l C o l o r %
5337 % %
5338 % %
5339 % %
5340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5341 %
5342 % MagickGetImagePixelColor() returns the color of the specified pixel.
5343 %
5344 % The format of the MagickGetImagePixelColor method is:
5345 %
5346 % MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5347 % const ssize_t x,const ssize_t y,PixelWand *color)
5348 %
5349 % A description of each parameter follows:
5350 %
5351 % o wand: the magick wand.
5352 %
5353 % o x,y: the pixel offset into the image.
5354 %
5355 % o color: Return the colormap color in this wand.
5356 %
5357 */
5359  const ssize_t x,const ssize_t y,PixelWand *color)
5360 {
5361  register const Quantum
5362  *p;
5363 
5364  CacheView
5365  *image_view;
5366 
5367  assert(wand != (MagickWand *) NULL);
5368  assert(wand->signature == MagickWandSignature);
5369  if (wand->debug != MagickFalse)
5370  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5371  if (wand->images == (Image *) NULL)
5372  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5373  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5374  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5375  if (p == (const Quantum *) NULL)
5376  {
5377  image_view=DestroyCacheView(image_view);
5378  return(MagickFalse);
5379  }
5380  PixelSetQuantumPixel(wand->images,p,color);
5381  image_view=DestroyCacheView(image_view);
5382  return(MagickTrue);
5383 }
5384 
5385 /*
5386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5387 % %
5388 % %
5389 % %
5390 % M a g i c k G e t I m a g e R e d P r i m a r y %
5391 % %
5392 % %
5393 % %
5394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5395 %
5396 % MagickGetImageRedPrimary() returns the chromaticy red primary point.
5397 %
5398 % The format of the MagickGetImageRedPrimary method is:
5399 %
5400 % MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5401 % double *y, double *z)
5402 %
5403 % A description of each parameter follows:
5404 %
5405 % o wand: the magick wand.
5406 %
5407 % o x: the chromaticity red primary x-point.
5408 %
5409 % o y: the chromaticity red primary y-point.
5410 %
5411 % o z: the chromaticity red primary z-point.
5412 %
5413 */
5415  double *x,double *y,double *z)
5416 {
5417  assert(wand != (MagickWand *) NULL);
5418  assert(wand->signature == MagickWandSignature);
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  *x=wand->images->chromaticity.red_primary.x;
5424  *y=wand->images->chromaticity.red_primary.y;
5425  *z=wand->images->chromaticity.red_primary.z;
5426  return(MagickTrue);
5427 }
5428 
5429 /*
5430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5431 % %
5432 % %
5433 % %
5434 % M a g i c k G e t I m a g e R e g i o n %
5435 % %
5436 % %
5437 % %
5438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5439 %
5440 % MagickGetImageRegion() extracts a region of the image and returns it as a
5441 % a new wand.
5442 %
5443 % The format of the MagickGetImageRegion method is:
5444 %
5445 % MagickWand *MagickGetImageRegion(MagickWand *wand,
5446 % const size_t width,const size_t height,const ssize_t x,
5447 % const ssize_t y)
5448 %
5449 % A description of each parameter follows:
5450 %
5451 % o wand: the magick wand.
5452 %
5453 % o width: the region width.
5454 %
5455 % o height: the region height.
5456 %
5457 % o x: the region x offset.
5458 %
5459 % o y: the region y offset.
5460 %
5461 */
5463  const size_t width,const size_t height,const ssize_t x,
5464  const ssize_t y)
5465 {
5466  Image
5467  *region_image;
5468 
5469  RectangleInfo
5470  region;
5471 
5472  assert(wand != (MagickWand *) NULL);
5473  assert(wand->signature == MagickWandSignature);
5474  if (wand->debug != MagickFalse)
5475  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5476  if (wand->images == (Image *) NULL)
5477  return((MagickWand *) NULL);
5478  region.width=width;
5479  region.height=height;
5480  region.x=x;
5481  region.y=y;
5482  region_image=CropImage(wand->images,&region,wand->exception);
5483  if (region_image == (Image *) NULL)
5484  return((MagickWand *) NULL);
5485  return(CloneMagickWandFromImages(wand,region_image));
5486 }
5487 
5488 /*
5489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5490 % %
5491 % %
5492 % %
5493 % 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 %
5494 % %
5495 % %
5496 % %
5497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5498 %
5499 % MagickGetImageRenderingIntent() gets the image rendering intent.
5500 %
5501 % The format of the MagickGetImageRenderingIntent method is:
5502 %
5503 % RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5504 %
5505 % A description of each parameter follows:
5506 %
5507 % o wand: the magick wand.
5508 %
5509 */
5511 {
5512  assert(wand != (MagickWand *) NULL);
5513  assert(wand->signature == MagickWandSignature);
5514  if (wand->debug != MagickFalse)
5515  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5516  if (wand->images == (Image *) NULL)
5517  {
5518  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5519  "ContainsNoImages","`%s'",wand->name);
5520  return(UndefinedIntent);
5521  }
5522  return((RenderingIntent) wand->images->rendering_intent);
5523 }
5524 
5525 /*
5526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5527 % %
5528 % %
5529 % %
5530 % M a g i c k G e t I m a g e R e s o l u t i o n %
5531 % %
5532 % %
5533 % %
5534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5535 %
5536 % MagickGetImageResolution() gets the image X and Y resolution.
5537 %
5538 % The format of the MagickGetImageResolution method is:
5539 %
5540 % MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5541 % double *y)
5542 %
5543 % A description of each parameter follows:
5544 %
5545 % o wand: the magick wand.
5546 %
5547 % o x: the image x-resolution.
5548 %
5549 % o y: the image y-resolution.
5550 %
5551 */
5553  double *x,double *y)
5554 {
5555  assert(wand != (MagickWand *) NULL);
5556  assert(wand->signature == MagickWandSignature);
5557  if (wand->debug != MagickFalse)
5558  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5559  if (wand->images == (Image *) NULL)
5560  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5561  *x=wand->images->resolution.x;
5562  *y=wand->images->resolution.y;
5563  return(MagickTrue);
5564 }
5565 
5566 /*
5567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5568 % %
5569 % %
5570 % %
5571 % M a g i c k G e t I m a g e S c e n e %
5572 % %
5573 % %
5574 % %
5575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5576 %
5577 % MagickGetImageScene() gets the image scene.
5578 %
5579 % The format of the MagickGetImageScene method is:
5580 %
5581 % size_t MagickGetImageScene(MagickWand *wand)
5582 %
5583 % A description of each parameter follows:
5584 %
5585 % o wand: the magick wand.
5586 %
5587 */
5589 {
5590  assert(wand != (MagickWand *) NULL);
5591  assert(wand->signature == MagickWandSignature);
5592  if (wand->debug != MagickFalse)
5593  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5594  if (wand->images == (Image *) NULL)
5595  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5596  return(wand->images->scene);
5597 }
5598 
5599 /*
5600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601 % %
5602 % %
5603 % %
5604 % M a g i c k G e t I m a g e S i g n a t u r e %
5605 % %
5606 % %
5607 % %
5608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609 %
5610 % MagickGetImageSignature() generates an SHA-256 message digest for the image
5611 % pixel stream.
5612 %
5613 % The format of the MagickGetImageSignature method is:
5614 %
5615 % char *MagickGetImageSignature(MagickWand *wand)
5616 %
5617 % A description of each parameter follows:
5618 %
5619 % o wand: the magick wand.
5620 %
5621 */
5623 {
5624  const char
5625  *value;
5626 
5627  MagickBooleanType
5628  status;
5629 
5630  assert(wand != (MagickWand *) NULL);
5631  assert(wand->signature == MagickWandSignature);
5632  if (wand->debug != MagickFalse)
5633  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5634  if (wand->images == (Image *) NULL)
5635  {
5636  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5637  "ContainsNoImages","`%s'",wand->name);
5638  return((char *) NULL);
5639  }
5640  status=SignatureImage(wand->images,wand->exception);
5641  if (status == MagickFalse)
5642  return((char *) NULL);
5643  value=GetImageProperty(wand->images,"signature",wand->exception);
5644  if (value == (const char *) NULL)
5645  return((char *) NULL);
5646  return(AcquireString(value));
5647 }
5648 
5649 /*
5650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5651 % %
5652 % %
5653 % %
5654 % 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 %
5655 % %
5656 % %
5657 % %
5658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5659 %
5660 % MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5661 %
5662 % The format of the MagickGetImageTicksPerSecond method is:
5663 %
5664 % size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5665 %
5666 % A description of each parameter follows:
5667 %
5668 % o wand: the magick wand.
5669 %
5670 */
5672 {
5673  assert(wand != (MagickWand *) NULL);
5674  assert(wand->signature == MagickWandSignature);
5675  if (wand->debug != MagickFalse)
5676  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5677  if (wand->images == (Image *) NULL)
5678  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5679  return((size_t) wand->images->ticks_per_second);
5680 }
5681 
5682 /*
5683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5684 % %
5685 % %
5686 % %
5687 % M a g i c k G e t I m a g e T y p e %
5688 % %
5689 % %
5690 % %
5691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5692 %
5693 % MagickGetImageType() gets the potential image type:
5694 %
5695 % Bilevel Grayscale GrayscaleMatte
5696 % Palette PaletteMatte TrueColor
5697 % TrueColorMatte ColorSeparation ColorSeparationMatte
5698 %
5699 % The format of the MagickGetImageType method is:
5700 %
5701 % ImageType MagickGetImageType(MagickWand *wand)
5702 %
5703 % A description of each parameter follows:
5704 %
5705 % o wand: the magick wand.
5706 %
5707 */
5709 {
5710  assert(wand != (MagickWand *) NULL);
5711  assert(wand->signature == MagickWandSignature);
5712  if (wand->debug != MagickFalse)
5713  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5714  if (wand->images == (Image *) NULL)
5715  {
5716  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5717  "ContainsNoImages","`%s'",wand->name);
5718  return(UndefinedType);
5719  }
5720  return(GetImageType(wand->images));
5721 }
5722 
5723 /*
5724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5725 % %
5726 % %
5727 % %
5728 % M a g i c k G e t I m a g e U n i t s %
5729 % %
5730 % %
5731 % %
5732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5733 %
5734 % MagickGetImageUnits() gets the image units of resolution.
5735 %
5736 % The format of the MagickGetImageUnits method is:
5737 %
5738 % ResolutionType MagickGetImageUnits(MagickWand *wand)
5739 %
5740 % A description of each parameter follows:
5741 %
5742 % o wand: the magick wand.
5743 %
5744 */
5746 {
5747  assert(wand != (MagickWand *) NULL);
5748  assert(wand->signature == MagickWandSignature);
5749  if (wand->debug != MagickFalse)
5750  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5751  if (wand->images == (Image *) NULL)
5752  {
5753  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5754  "ContainsNoImages","`%s'",wand->name);
5755  return(UndefinedResolution);
5756  }
5757  return(wand->images->units);
5758 }
5759 
5760 /*
5761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5762 % %
5763 % %
5764 % %
5765 % 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 %
5766 % %
5767 % %
5768 % %
5769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5770 %
5771 % MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5772 % sepcified image.
5773 %
5774 % The format of the MagickGetImageVirtualPixelMethod method is:
5775 %
5776 % VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5777 %
5778 % A description of each parameter follows:
5779 %
5780 % o wand: the magick wand.
5781 %
5782 */
5784 {
5785  assert(wand != (MagickWand *) NULL);
5786  assert(wand->signature == MagickWandSignature);
5787  if (wand->debug != MagickFalse)
5788  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5789  if (wand->images == (Image *) NULL)
5790  {
5791  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5792  "ContainsNoImages","`%s'",wand->name);
5793  return(UndefinedVirtualPixelMethod);
5794  }
5795  return(GetImageVirtualPixelMethod(wand->images));
5796 }
5797 
5798 /*
5799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5800 % %
5801 % %
5802 % %
5803 % M a g i c k G e t I m a g e W h i t e P o i n t %
5804 % %
5805 % %
5806 % %
5807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5808 %
5809 % MagickGetImageWhitePoint() returns the chromaticy white point.
5810 %
5811 % The format of the MagickGetImageWhitePoint method is:
5812 %
5813 % MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5814 % double *y,double *z)
5815 %
5816 % A description of each parameter follows:
5817 %
5818 % o wand: the magick wand.
5819 %
5820 % o x: the chromaticity white x-point.
5821 %
5822 % o y: the chromaticity white y-point.
5823 %
5824 % o z: the chromaticity white z-point.
5825 %
5826 */
5828  double *x,double *y,double *z)
5829 {
5830  assert(wand != (MagickWand *) NULL);
5831  assert(wand->signature == MagickWandSignature);
5832  if (wand->debug != MagickFalse)
5833  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5834  if (wand->images == (Image *) NULL)
5835  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5836  *x=wand->images->chromaticity.white_point.x;
5837  *y=wand->images->chromaticity.white_point.y;
5838  *z=wand->images->chromaticity.white_point.z;
5839  return(MagickTrue);
5840 }
5841 
5842 /*
5843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5844 % %
5845 % %
5846 % %
5847 % M a g i c k G e t I m a g e W i d t h %
5848 % %
5849 % %
5850 % %
5851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5852 %
5853 % MagickGetImageWidth() returns the image width.
5854 %
5855 % The format of the MagickGetImageWidth method is:
5856 %
5857 % size_t MagickGetImageWidth(MagickWand *wand)
5858 %
5859 % A description of each parameter follows:
5860 %
5861 % o wand: the magick wand.
5862 %
5863 */
5865 {
5866  assert(wand != (MagickWand *) NULL);
5867  assert(wand->signature == MagickWandSignature);
5868  if (wand->debug != MagickFalse)
5869  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5870  if (wand->images == (Image *) NULL)
5871  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5872  return(wand->images->columns);
5873 }
5874 
5875 /*
5876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5877 % %
5878 % %
5879 % %
5880 % M a g i c k G e t N u m b e r I m a g e s %
5881 % %
5882 % %
5883 % %
5884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5885 %
5886 % MagickGetNumberImages() returns the number of images associated with a
5887 % magick wand.
5888 %
5889 % The format of the MagickGetNumberImages method is:
5890 %
5891 % size_t MagickGetNumberImages(MagickWand *wand)
5892 %
5893 % A description of each parameter follows:
5894 %
5895 % o wand: the magick wand.
5896 %
5897 */
5899 {
5900  assert(wand != (MagickWand *) NULL);
5901  assert(wand->signature == MagickWandSignature);
5902  if (wand->debug != MagickFalse)
5903  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5904  return(GetImageListLength(wand->images));
5905 }
5906 
5907 /*
5908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5909 % %
5910 % %
5911 % %
5912 % 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 %
5913 % %
5914 % %
5915 % %
5916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5917 %
5918 % MagickGetImageTotalInkDensity() gets the image total ink density.
5919 %
5920 % The format of the MagickGetImageTotalInkDensity method is:
5921 %
5922 % double MagickGetImageTotalInkDensity(MagickWand *wand)
5923 %
5924 % A description of each parameter follows:
5925 %
5926 % o wand: the magick wand.
5927 %
5928 */
5930 {
5931  assert(wand != (MagickWand *) NULL);
5932  assert(wand->signature == MagickWandSignature);
5933  if (wand->debug != MagickFalse)
5934  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5935  if (wand->images == (Image *) NULL)
5936  {
5937  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5938  "ContainsNoImages","`%s'",wand->name);
5939  return(0.0);
5940  }
5941  return(GetImageTotalInkDensity(wand->images,wand->exception));
5942 }
5943 
5944 /*
5945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5946 % %
5947 % %
5948 % %
5949 % M a g i c k H a l d C l u t I m a g e %
5950 % %
5951 % %
5952 % %
5953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5954 %
5955 % MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5956 % table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
5957 % dimensions. Create it with the HALD coder. You can apply any color
5958 % transformation to the Hald image and then use this method to apply the
5959 % transform to the image.
5960 %
5961 % The format of the MagickHaldClutImage method is:
5962 %
5963 % MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5964 % const MagickWand *hald_wand)
5965 %
5966 % A description of each parameter follows:
5967 %
5968 % o wand: the magick wand.
5969 %
5970 % o hald_image: the hald CLUT image.
5971 %
5972 */