MagickWand  7.0.7
Convert, Edit, Or Compose Bitmap Images
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-2018 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://www.imagemagick.org/script/license.php %
33 % %
34 % Unless required by applicable law or agreed to in writing, software %
35 % distributed under the License is distributed on an "AS IS" BASIS, %
36 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
37 % See the License for the specific language governing permissions and %
38 % limitations under the License. %
39 % %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 
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) ResetMagickMemory(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 m p I m a g e %
1258 % %
1259 % %
1260 % %
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262 %
1263 % MagickClampImage() restricts the color range from 0 to the quantum depth.
1264 %
1265 % The format of the MagickClampImage method is:
1266 %
1267 % MagickBooleanType MagickClampImage(MagickWand *wand)
1268 %
1269 % A description of each parameter follows:
1270 %
1271 % o wand: the magick wand.
1272 %
1273 % o channel: the channel.
1274 %
1275 */
1276 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1277 {
1278  assert(wand != (MagickWand *) NULL);
1279  assert(wand->signature == MagickWandSignature);
1280  if (wand->debug != MagickFalse)
1281  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1282  if (wand->images == (Image *) NULL)
1283  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1284  return(ClampImage(wand->images,wand->exception));
1285 }
1286 
1287 /*
1288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289 % %
1290 % %
1291 % %
1292 % M a g i c k C l i p I m a g e %
1293 % %
1294 % %
1295 % %
1296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297 %
1298 % MagickClipImage() clips along the first path from the 8BIM profile, if
1299 % present.
1300 %
1301 % The format of the MagickClipImage method is:
1302 %
1303 % MagickBooleanType MagickClipImage(MagickWand *wand)
1304 %
1305 % A description of each parameter follows:
1306 %
1307 % o wand: the magick wand.
1308 %
1309 */
1310 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1311 {
1312  MagickBooleanType
1313  status;
1314 
1315  assert(wand != (MagickWand *) NULL);
1316  assert(wand->signature == MagickWandSignature);
1317  if (wand->debug != MagickFalse)
1318  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1319  if (wand->images == (Image *) NULL)
1320  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1321  status=ClipImage(wand->images,wand->exception);
1322  return(status);
1323 }
1324 
1325 /*
1326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1327 % %
1328 % %
1329 % %
1330 % M a g i c k C l i p I m a g e P a t h %
1331 % %
1332 % %
1333 % %
1334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1335 %
1336 % MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1337 % present. Later operations take effect inside the path. Id may be a number
1338 % if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1339 % path.
1340 %
1341 % The format of the MagickClipImagePath method is:
1342 %
1343 % MagickBooleanType MagickClipImagePath(MagickWand *wand,
1344 % const char *pathname,const MagickBooleanType inside)
1345 %
1346 % A description of each parameter follows:
1347 %
1348 % o wand: the magick wand.
1349 %
1350 % o pathname: name of clipping path resource. If name is preceded by #, use
1351 % clipping path numbered by name.
1352 %
1353 % o inside: if non-zero, later operations take effect inside clipping path.
1354 % Otherwise later operations take effect outside clipping path.
1355 %
1356 */
1358  const char *pathname,const MagickBooleanType inside)
1359 {
1360  MagickBooleanType
1361  status;
1362 
1363  assert(wand != (MagickWand *) NULL);
1364  assert(wand->signature == MagickWandSignature);
1365  if (wand->debug != MagickFalse)
1366  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1367  if (wand->images == (Image *) NULL)
1368  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1369  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1370  return(status);
1371 }
1372 
1373 /*
1374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1375 % %
1376 % %
1377 % %
1378 % M a g i c k C l u t I m a g e %
1379 % %
1380 % %
1381 % %
1382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1383 %
1384 % MagickClutImage() replaces colors in the image from a color lookup table.
1385 %
1386 % The format of the MagickClutImage method is:
1387 %
1388 % MagickBooleanType MagickClutImage(MagickWand *wand,
1389 % const MagickWand *clut_wand,const PixelInterpolateMethod method)
1390 %
1391 % A description of each parameter follows:
1392 %
1393 % o wand: the magick wand.
1394 %
1395 % o clut_image: the clut image.
1396 %
1397 % o method: the pixel interpolation method.
1398 %
1399 */
1400 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1401  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1402 {
1403  MagickBooleanType
1404  status;
1405 
1406  assert(wand != (MagickWand *) NULL);
1407  assert(wand->signature == MagickWandSignature);
1408  if (wand->debug != MagickFalse)
1409  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1410  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1411  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1412  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1413  return(status);
1414 }
1415 
1416 /*
1417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418 % %
1419 % %
1420 % %
1421 % M a g i c k C o a l e s c e I m a g e s %
1422 % %
1423 % %
1424 % %
1425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426 %
1427 % MagickCoalesceImages() composites a set of images while respecting any page
1428 % offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1429 % typically start with an image background and each subsequent image
1430 % varies in size and offset. MagickCoalesceImages() returns a new sequence
1431 % where each image in the sequence is the same size as the first and
1432 % composited with the next image in the sequence.
1433 %
1434 % The format of the MagickCoalesceImages method is:
1435 %
1436 % MagickWand *MagickCoalesceImages(MagickWand *wand)
1437 %
1438 % A description of each parameter follows:
1439 %
1440 % o wand: the magick wand.
1441 %
1442 */
1444 {
1445  Image
1446  *coalesce_image;
1447 
1448  assert(wand != (MagickWand *) NULL);
1449  assert(wand->signature == MagickWandSignature);
1450  if (wand->debug != MagickFalse)
1451  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1452  if (wand->images == (Image *) NULL)
1453  return((MagickWand *) NULL);
1454  coalesce_image=CoalesceImages(wand->images,wand->exception);
1455  if (coalesce_image == (Image *) NULL)
1456  return((MagickWand *) NULL);
1457  return(CloneMagickWandFromImages(wand,coalesce_image));
1458 }
1459 
1460 /*
1461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462 % %
1463 % %
1464 % %
1465 % M a g i c k C o l o r D e c i s i o n I m a g e %
1466 % %
1467 % %
1468 % %
1469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1470 %
1471 % MagickColorDecisionListImage() accepts a lightweight Color Correction
1472 % Collection (CCC) file which solely contains one or more color corrections
1473 % and applies the color correction to the image. Here is a sample CCC file:
1474 %
1475 % <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1476 % <ColorCorrection id="cc03345">
1477 % <SOPNode>
1478 % <Slope> 0.9 1.2 0.5 </Slope>
1479 % <Offset> 0.4 -0.5 0.6 </Offset>
1480 % <Power> 1.0 0.8 1.5 </Power>
1481 % </SOPNode>
1482 % <SATNode>
1483 % <Saturation> 0.85 </Saturation>
1484 % </SATNode>
1485 % </ColorCorrection>
1486 % </ColorCorrectionCollection>
1487 %
1488 % which includes the offset, slope, and power for each of the RGB channels
1489 % as well as the saturation.
1490 %
1491 % The format of the MagickColorDecisionListImage method is:
1492 %
1493 % MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1494 % const char *color_correction_collection)
1495 %
1496 % A description of each parameter follows:
1497 %
1498 % o wand: the magick wand.
1499 %
1500 % o color_correction_collection: the color correction collection in XML.
1501 %
1502 */
1504  const char *color_correction_collection)
1505 {
1506  MagickBooleanType
1507  status;
1508 
1509  assert(wand != (MagickWand *) NULL);
1510  assert(wand->signature == MagickWandSignature);
1511  if (wand->debug != MagickFalse)
1512  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1513  if (wand->images == (Image *) NULL)
1514  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1515  status=ColorDecisionListImage(wand->images,color_correction_collection,
1516  wand->exception);
1517  return(status);
1518 }
1519 
1520 /*
1521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522 % %
1523 % %
1524 % %
1525 % M a g i c k C o l o r i z e I m a g e %
1526 % %
1527 % %
1528 % %
1529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1530 %
1531 % MagickColorizeImage() blends the fill color with each pixel in the image.
1532 %
1533 % The format of the MagickColorizeImage method is:
1534 %
1535 % MagickBooleanType MagickColorizeImage(MagickWand *wand,
1536 % const PixelWand *colorize,const PixelWand *blend)
1537 %
1538 % A description of each parameter follows:
1539 %
1540 % o wand: the magick wand.
1541 %
1542 % o colorize: the colorize pixel wand.
1543 %
1544 % o alpha: the alpha pixel wand.
1545 %
1546 */
1548  const PixelWand *colorize,const PixelWand *blend)
1549 {
1550  char
1551  percent_blend[MagickPathExtent];
1552 
1553  Image
1554  *colorize_image;
1555 
1556  PixelInfo
1557  target;
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  GetPixelInfo(wand->images,&target);
1566  if (target.colorspace != CMYKColorspace)
1567  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1568  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1569  PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1570  PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1571  PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1572  PixelGetAlphaQuantum(blend)));
1573  else
1574  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1575  "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1576  PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1577  PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1578  PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1579  PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1580  PixelGetAlphaQuantum(blend)));
1581  target=PixelGetPixel(colorize);
1582  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1583  wand->exception);
1584  if (colorize_image == (Image *) NULL)
1585  return(MagickFalse);
1586  ReplaceImageInList(&wand->images,colorize_image);
1587  return(MagickTrue);
1588 }
1589 
1590 /*
1591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1592 % %
1593 % %
1594 % %
1595 % M a g i c k C o l o r M a t r i x I m a g e %
1596 % %
1597 % %
1598 % %
1599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1600 %
1601 % MagickColorMatrixImage() apply color transformation to an image. The method
1602 % permits saturation changes, hue rotation, luminance to alpha, and various
1603 % other effects. Although variable-sized transformation matrices can be used,
1604 % typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1605 % (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1606 % except offsets are in column 6 rather than 5 (in support of CMYKA images)
1607 % and offsets are normalized (divide Flash offset by 255).
1608 %
1609 % The format of the MagickColorMatrixImage method is:
1610 %
1611 % MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1612 % const KernelInfo *color_matrix)
1613 %
1614 % A description of each parameter follows:
1615 %
1616 % o wand: the magick wand.
1617 %
1618 % o color_matrix: the color matrix.
1619 %
1620 */
1622  const KernelInfo *color_matrix)
1623 {
1624  Image
1625  *color_image;
1626 
1627  assert(wand != (MagickWand *) NULL);
1628  assert(wand->signature == MagickWandSignature);
1629  if (wand->debug != MagickFalse)
1630  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1631  if (color_matrix == (const KernelInfo *) NULL)
1632  return(MagickFalse);
1633  if (wand->images == (Image *) NULL)
1634  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1635  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1636  if (color_image == (Image *) NULL)
1637  return(MagickFalse);
1638  ReplaceImageInList(&wand->images,color_image);
1639  return(MagickTrue);
1640 }
1641 
1642 /*
1643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1644 % %
1645 % %
1646 % %
1647 % M a g i c k C o m b i n e I m a g e s %
1648 % %
1649 % %
1650 % %
1651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652 %
1653 % MagickCombineImages() combines one or more images into a single image. The
1654 % grayscale value of the pixels of each image in the sequence is assigned in
1655 % order to the specified hannels of the combined image. The typical
1656 % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1657 %
1658 % The format of the MagickCombineImages method is:
1659 %
1660 % MagickWand *MagickCombineImages(MagickWand *wand,
1661 % const ColorspaceType colorspace)
1662 %
1663 % A description of each parameter follows:
1664 %
1665 % o wand: the magick wand.
1666 %
1667 % o colorspace: the colorspace.
1668 %
1669 */
1671  const ColorspaceType colorspace)
1672 {
1673  Image
1674  *combine_image;
1675 
1676  assert(wand != (MagickWand *) NULL);
1677  assert(wand->signature == MagickWandSignature);
1678  if (wand->debug != MagickFalse)
1679  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1680  if (wand->images == (Image *) NULL)
1681  return((MagickWand *) NULL);
1682  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1683  if (combine_image == (Image *) NULL)
1684  return((MagickWand *) NULL);
1685  return(CloneMagickWandFromImages(wand,combine_image));
1686 }
1687 
1688 /*
1689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1690 % %
1691 % %
1692 % %
1693 % M a g i c k C o m m e n t I m a g e %
1694 % %
1695 % %
1696 % %
1697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1698 %
1699 % MagickCommentImage() adds a comment to your image.
1700 %
1701 % The format of the MagickCommentImage method is:
1702 %
1703 % MagickBooleanType MagickCommentImage(MagickWand *wand,
1704 % const char *comment)
1705 %
1706 % A description of each parameter follows:
1707 %
1708 % o wand: the magick wand.
1709 %
1710 % o comment: the image comment.
1711 %
1712 */
1713 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1714  const char *comment)
1715 {
1716  MagickBooleanType
1717  status;
1718 
1719  assert(wand != (MagickWand *) NULL);
1720  assert(wand->signature == MagickWandSignature);
1721  if (wand->debug != MagickFalse)
1722  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1723  if (wand->images == (Image *) NULL)
1724  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1725  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1726  return(status);
1727 }
1728 
1729 /*
1730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1731 % %
1732 % %
1733 % %
1734 % M a g i c k C o m p a r e I m a g e L a y e r s %
1735 % %
1736 % %
1737 % %
1738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1739 %
1740 % MagickCompareImagesLayers() compares each image with the next in a sequence
1741 % and returns the maximum bounding region of any pixel differences it
1742 % discovers.
1743 %
1744 % The format of the MagickCompareImagesLayers method is:
1745 %
1746 % MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1747 % const LayerMethod method)
1748 %
1749 % A description of each parameter follows:
1750 %
1751 % o wand: the magick wand.
1752 %
1753 % o method: the compare method.
1754 %
1755 */
1757  const LayerMethod method)
1758 {
1759  Image
1760  *layers_image;
1761 
1762  assert(wand != (MagickWand *) NULL);
1763  assert(wand->signature == MagickWandSignature);
1764  if (wand->debug != MagickFalse)
1765  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1766  if (wand->images == (Image *) NULL)
1767  return((MagickWand *) NULL);
1768  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1769  if (layers_image == (Image *) NULL)
1770  return((MagickWand *) NULL);
1771  return(CloneMagickWandFromImages(wand,layers_image));
1772 }
1773 
1774 /*
1775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1776 % %
1777 % %
1778 % %
1779 % M a g i c k C o m p a r e I m a g e s %
1780 % %
1781 % %
1782 % %
1783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1784 %
1785 % MagickCompareImages() compares an image to a reconstructed image and returns
1786 % the specified difference image.
1787 %
1788 % The format of the MagickCompareImages method is:
1789 %
1790 % MagickWand *MagickCompareImages(MagickWand *wand,
1791 % const MagickWand *reference,const MetricType metric,
1792 % double *distortion)
1793 %
1794 % A description of each parameter follows:
1795 %
1796 % o wand: the magick wand.
1797 %
1798 % o reference: the reference wand.
1799 %
1800 % o metric: the metric.
1801 %
1802 % o distortion: the computed distortion between the images.
1803 %
1804 */
1806  const MagickWand *reference,const MetricType metric,double *distortion)
1807 {
1808  Image
1809  *compare_image;
1810 
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) || (reference->images == (Image *) NULL))
1817  {
1818  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1819  "ContainsNoImages","`%s'",wand->name);
1820  return((MagickWand *) NULL);
1821  }
1822  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1823  wand->exception);
1824  if (compare_image == (Image *) NULL)
1825  return((MagickWand *) NULL);
1826  return(CloneMagickWandFromImages(wand,compare_image));
1827 }
1828 
1829 /*
1830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1831 % %
1832 % %
1833 % %
1834 % M a g i c k C o m p o s i t e I m a g e %
1835 % %
1836 % %
1837 % %
1838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1839 %
1840 % MagickCompositeImage() composite one image onto another at the specified
1841 % offset.
1842 %
1843 % The format of the MagickCompositeImage method is:
1844 %
1845 % MagickBooleanType MagickCompositeImage(MagickWand *wand,
1846 % const MagickWand *source_wand,const CompositeOperator compose,
1847 % const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1848 %
1849 % A description of each parameter follows:
1850 %
1851 % o wand: the magick wand holding the destination images
1852 %
1853 % o source_image: the magick wand holding source image.
1854 %
1855 % o compose: This operator affects how the composite is applied to the
1856 % image. The default is Over. These are some of the compose methods
1857 % availble.
1858 %
1859 % OverCompositeOp InCompositeOp OutCompositeOp
1860 % AtopCompositeOp XorCompositeOp PlusCompositeOp
1861 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
1862 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1863 % DisplaceCompositeOp
1864 %
1865 % o clip_to_self: set to MagickTrue to limit composition to area composed.
1866 %
1867 % o x: the column offset of the composited image.
1868 %
1869 % o y: the row offset of the composited image.
1870 %
1871 */
1873  const MagickWand *source_wand,const CompositeOperator compose,
1874  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1875 {
1876  MagickBooleanType
1877  status;
1878 
1879  assert(wand != (MagickWand *) NULL);
1880  assert(wand->signature == MagickWandSignature);
1881  if (wand->debug != MagickFalse)
1882  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1883  if ((wand->images == (Image *) NULL) ||
1884  (source_wand->images == (Image *) NULL))
1885  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1886  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1887  x,y,wand->exception);
1888  return(status);
1889 }
1890 
1891 /*
1892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1893 % %
1894 % %
1895 % %
1896 % 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 %
1897 % %
1898 % %
1899 % %
1900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901 %
1902 % MagickCompositeImageGravity() composite one image onto another using the
1903 % specified gravity.
1904 %
1905 % The format of the MagickCompositeImageGravity method is:
1906 %
1907 % MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1908 % const MagickWand *source_wand,const CompositeOperator compose,
1909 % const GravityType gravity)
1910 %
1911 % A description of each parameter follows:
1912 %
1913 % o wand: the magick wand holding the destination images
1914 %
1915 % o source_image: the magick wand holding source image.
1916 %
1917 % o compose: This operator affects how the composite is applied to the
1918 % image. The default is Over. These are some of the compose methods
1919 % availble.
1920 %
1921 % OverCompositeOp InCompositeOp OutCompositeOp
1922 % AtopCompositeOp XorCompositeOp PlusCompositeOp
1923 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
1924 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1925 % DisplaceCompositeOp
1926 %
1927 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
1928 % NorthEastGravity, WestGravity, CenterGravity,
1929 % EastGravity, SouthWestGravity, SouthGravity,
1930 % SouthEastGravity)
1931 %
1932 */
1934  const MagickWand *source_wand,const CompositeOperator compose,
1935  const GravityType gravity)
1936 {
1937  MagickBooleanType
1938  status;
1939 
1940  RectangleInfo
1941  geometry;
1942 
1943  assert(wand != (MagickWand *) NULL);
1944  assert(wand->signature == MagickWandSignature);
1945  if (wand->debug != MagickFalse)
1946  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1947  if ((wand->images == (Image *) NULL) ||
1948  (source_wand->images == (Image *) NULL))
1949  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1950  SetGeometry(source_wand->images,&geometry);
1951  GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
1952  &geometry);
1953  status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
1954  geometry.x,geometry.y,wand->exception);
1955  return(status);
1956 }
1957 
1958 /*
1959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1960 % %
1961 % %
1962 % %
1963 % M a g i c k C o m p o s i t e L a y e r s %
1964 % %
1965 % %
1966 % %
1967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1968 %
1969 % MagickCompositeLayers() composite the images in the source wand over the
1970 % images in the destination wand in sequence, starting with the current
1971 % image in both lists.
1972 %
1973 % Each layer from the two image lists are composted together until the end of
1974 % one of the image lists is reached. The offset of each composition is also
1975 % adjusted to match the virtual canvas offsets of each layer. As such the
1976 % given offset is relative to the virtual canvas, and not the actual image.
1977 %
1978 % Composition uses given x and y offsets, as the 'origin' location of the
1979 % source images virtual canvas (not the real image) allowing you to compose a
1980 % list of 'layer images' into the destiantioni images. This makes it well
1981 % sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1982 % Animations' onto a static or other 'Coaleased Animation' destination image
1983 % list. GIF disposal handling is not looked at.
1984 %
1985 % Special case:- If one of the image sequences is the last image (just a
1986 % single image remaining), that image is repeatally composed with all the
1987 % images in the other image list. Either the source or destination lists may
1988 % be the single image, for this situation.
1989 %
1990 % In the case of a single destination image (or last image given), that image
1991 % will ve cloned to match the number of images remaining in the source image
1992 % list.
1993 %
1994 % This is equivelent to the "-layer Composite" Shell API operator.
1995 %
1996 % The format of the MagickCompositeLayers method is:
1997 %
1998 % MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1999 % const MagickWand *source_wand, const CompositeOperator compose,
2000 % const ssize_t x,const ssize_t y)
2001 %
2002 % A description of each parameter follows:
2003 %
2004 % o wand: the magick wand holding destaintion images
2005 %
2006 % o source_wand: the wand holding the source images
2007 %
2008 % o compose, x, y: composition arguments
2009 %
2010 */
2012  const MagickWand *source_wand,const CompositeOperator compose,
2013  const ssize_t x,const ssize_t y)
2014 {
2015  MagickBooleanType
2016  status;
2017 
2018  assert(wand != (MagickWand *) NULL);
2019  assert(wand->signature == MagickWandSignature);
2020  if (wand->debug != MagickFalse)
2021  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2022  if ((wand->images == (Image *) NULL) ||
2023  (source_wand->images == (Image *) NULL))
2024  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2025  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2026  status=MagickTrue; /* FUTURE: determine status from exceptions */
2027  return(status);
2028 }
2029 
2030 /*
2031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2032 % %
2033 % %
2034 % %
2035 % M a g i c k C o n t r a s t I m a g e %
2036 % %
2037 % %
2038 % %
2039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040 %
2041 % MagickContrastImage() enhances the intensity differences between the lighter
2042 % and darker elements of the image. Set sharpen to a value other than 0 to
2043 % increase the image contrast otherwise the contrast is reduced.
2044 %
2045 % The format of the MagickContrastImage method is:
2046 %
2047 % MagickBooleanType MagickContrastImage(MagickWand *wand,
2048 % const MagickBooleanType sharpen)
2049 %
2050 % A description of each parameter follows:
2051 %
2052 % o wand: the magick wand.
2053 %
2054 % o sharpen: Increase or decrease image contrast.
2055 %
2056 %
2057 */
2059  const MagickBooleanType sharpen)
2060 {
2061  MagickBooleanType
2062  status;
2063 
2064  assert(wand != (MagickWand *) NULL);
2065  assert(wand->signature == MagickWandSignature);
2066  if (wand->debug != MagickFalse)
2067  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2068  if (wand->images == (Image *) NULL)
2069  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2070  status=ContrastImage(wand->images,sharpen,wand->exception);
2071  return(status);
2072 }
2073 
2074 /*
2075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2076 % %
2077 % %
2078 % %
2079 % 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 %
2080 % %
2081 % %
2082 % %
2083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2084 %
2085 % MagickContrastStretchImage() enhances the contrast of a color image by
2086 % adjusting the pixels color to span the entire range of colors available.
2087 % You can also reduce the influence of a particular channel with a gamma
2088 % value of 0.
2089 %
2090 % The format of the MagickContrastStretchImage method is:
2091 %
2092 % MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2093 % const double black_point,const double white_point)
2094 %
2095 % A description of each parameter follows:
2096 %
2097 % o wand: the magick wand.
2098 %
2099 % o black_point: the black point.
2100 %
2101 % o white_point: the white point.
2102 %
2103 */
2105  const double black_point,const double white_point)
2106 {
2107  MagickBooleanType
2108  status;
2109 
2110  assert(wand != (MagickWand *) NULL);
2111  assert(wand->signature == MagickWandSignature);
2112  if (wand->debug != MagickFalse)
2113  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2114  if (wand->images == (Image *) NULL)
2115  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2116  status=ContrastStretchImage(wand->images,black_point,white_point,
2117  wand->exception);
2118  return(status);
2119 }
2120 
2121 /*
2122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123 % %
2124 % %
2125 % %
2126 % M a g i c k C o n v o l v e I m a g e %
2127 % %
2128 % %
2129 % %
2130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2131 %
2132 % MagickConvolveImage() applies a custom convolution kernel to the image.
2133 %
2134 % The format of the MagickConvolveImage method is:
2135 %
2136 % MagickBooleanType MagickConvolveImage(MagickWand *wand,
2137 % const KernelInfo *kernel)
2138 %
2139 % A description of each parameter follows:
2140 %
2141 % o wand: the magick wand.
2142 %
2143 % o kernel: An array of doubles representing the convolution kernel.
2144 %
2145 */
2147  const KernelInfo *kernel)
2148 {
2149  Image
2150  *filter_image;
2151 
2152  assert(wand != (MagickWand *) NULL);
2153  assert(wand->signature == MagickWandSignature);
2154  if (wand->debug != MagickFalse)
2155  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2156  if (kernel == (const KernelInfo *) NULL)
2157  return(MagickFalse);
2158  if (wand->images == (Image *) NULL)
2159  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2160  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2161  if (filter_image == (Image *) NULL)
2162  return(MagickFalse);
2163  ReplaceImageInList(&wand->images,filter_image);
2164  return(MagickTrue);
2165 }
2166 
2167 /*
2168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2169 % %
2170 % %
2171 % %
2172 % M a g i c k C r o p I m a g e %
2173 % %
2174 % %
2175 % %
2176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2177 %
2178 % MagickCropImage() extracts a region of the image.
2179 %
2180 % The format of the MagickCropImage method is:
2181 %
2182 % MagickBooleanType MagickCropImage(MagickWand *wand,
2183 % const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2184 %
2185 % A description of each parameter follows:
2186 %
2187 % o wand: the magick wand.
2188 %
2189 % o width: the region width.
2190 %
2191 % o height: the region height.
2192 %
2193 % o x: the region x-offset.
2194 %
2195 % o y: the region y-offset.
2196 %
2197 */
2198 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2199  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2200 {
2201  Image
2202  *crop_image;
2203 
2204  RectangleInfo
2205  crop;
2206 
2207  assert(wand != (MagickWand *) NULL);
2208  assert(wand->signature == MagickWandSignature);
2209  if (wand->debug != MagickFalse)
2210  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2211  if (wand->images == (Image *) NULL)
2212  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2213  crop.width=width;
2214  crop.height=height;
2215  crop.x=x;
2216  crop.y=y;
2217  crop_image=CropImage(wand->images,&crop,wand->exception);
2218  if (crop_image == (Image *) NULL)
2219  return(MagickFalse);
2220  ReplaceImageInList(&wand->images,crop_image);
2221  return(MagickTrue);
2222 }
2223 
2224 /*
2225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2226 % %
2227 % %
2228 % %
2229 % M a g i c k C y c l e C o l o r m a p I m a g e %
2230 % %
2231 % %
2232 % %
2233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2234 %
2235 % MagickCycleColormapImage() displaces an image's colormap by a given number
2236 % of positions. If you cycle the colormap a number of times you can produce
2237 % a psychodelic effect.
2238 %
2239 % The format of the MagickCycleColormapImage method is:
2240 %
2241 % MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2242 % const ssize_t displace)
2243 %
2244 % A description of each parameter follows:
2245 %
2246 % o wand: the magick wand.
2247 %
2248 % o pixel_wand: the pixel wand.
2249 %
2250 */
2252  const ssize_t displace)
2253 {
2254  MagickBooleanType
2255  status;
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  status=CycleColormapImage(wand->images,displace,wand->exception);
2264  return(status);
2265 }
2266 
2267 /*
2268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2269 % %
2270 % %
2271 % %
2272 % M a g i c k C o n s t i t u t e I m a g e %
2273 % %
2274 % %
2275 % %
2276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2277 %
2278 % MagickConstituteImage() adds an image to the wand comprised of the pixel
2279 % data you supply. The pixel data must be in scanline order top-to-bottom.
2280 % The data can be char, short int, int, float, or double. Float and double
2281 % require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2282 % is the maximum value the type can accomodate (e.g. 255 for char). For
2283 % example, to create a 640x480 image from unsigned red-green-blue character
2284 % data, use
2285 %
2286 % MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2287 %
2288 % The format of the MagickConstituteImage method is:
2289 %
2290 % MagickBooleanType MagickConstituteImage(MagickWand *wand,
2291 % const size_t columns,const size_t rows,const char *map,
2292 % const StorageType storage,void *pixels)
2293 %
2294 % A description of each parameter follows:
2295 %
2296 % o wand: the magick wand.
2297 %
2298 % o columns: width in pixels of the image.
2299 %
2300 % o rows: height in pixels of the image.
2301 %
2302 % o map: This string reflects the expected ordering of the pixel array.
2303 % It can be any combination or order of R = red, G = green, B = blue,
2304 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2305 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2306 % P = pad.
2307 %
2308 % o storage: Define the data type of the pixels. Float and double types are
2309 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2310 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2311 % LongPixel, QuantumPixel, or ShortPixel.
2312 %
2313 % o pixels: This array of values contain the pixel components as defined by
2314 % map and type. You must preallocate this array where the expected
2315 % length varies depending on the values of width, height, map, and type.
2316 %
2317 %
2318 */
2320  const size_t columns,const size_t rows,const char *map,
2321  const StorageType storage,const void *pixels)
2322 {
2323  Image
2324  *images;
2325 
2326  assert(wand != (MagickWand *) NULL);
2327  assert(wand->signature == MagickWandSignature);
2328  if (wand->debug != MagickFalse)
2329  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2330  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2331  if (images == (Image *) NULL)
2332  return(MagickFalse);
2333  return(InsertImageInWand(wand,images));
2334 }
2335 
2336 /*
2337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338 % %
2339 % %
2340 % %
2341 % M a g i c k D e c i p h e r I m a g e %
2342 % %
2343 % %
2344 % %
2345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346 %
2347 % MagickDecipherImage() converts cipher pixels to plain pixels.
2348 %
2349 % The format of the MagickDecipherImage method is:
2350 %
2351 % MagickBooleanType MagickDecipherImage(MagickWand *wand,
2352 % const char *passphrase)
2353 %
2354 % A description of each parameter follows:
2355 %
2356 % o wand: the magick wand.
2357 %
2358 % o passphrase: the passphrase.
2359 %
2360 */
2362  const char *passphrase)
2363 {
2364  assert(wand != (MagickWand *) NULL);
2365  assert(wand->signature == MagickWandSignature);
2366  if (wand->debug != MagickFalse)
2367  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2368  if (wand->images == (Image *) NULL)
2369  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2370  return(DecipherImage(wand->images,passphrase,wand->exception));
2371 }
2372 
2373 /*
2374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375 % %
2376 % %
2377 % %
2378 % M a g i c k D e c o n s t r u c t I m a g e s %
2379 % %
2380 % %
2381 % %
2382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2383 %
2384 % MagickDeconstructImages() compares each image with the next in a sequence
2385 % and returns the maximum bounding region of any pixel differences it
2386 % discovers.
2387 %
2388 % The format of the MagickDeconstructImages method is:
2389 %
2390 % MagickWand *MagickDeconstructImages(MagickWand *wand)
2391 %
2392 % A description of each parameter follows:
2393 %
2394 % o wand: the magick wand.
2395 %
2396 */
2398 {
2399  Image
2400  *deconstruct_image;
2401 
2402  assert(wand != (MagickWand *) NULL);
2403  assert(wand->signature == MagickWandSignature);
2404  if (wand->debug != MagickFalse)
2405  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2406  if (wand->images == (Image *) NULL)
2407  return((MagickWand *) NULL);
2408  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2409  wand->exception);
2410  if (deconstruct_image == (Image *) NULL)
2411  return((MagickWand *) NULL);
2412  return(CloneMagickWandFromImages(wand,deconstruct_image));
2413 }
2414 
2415 /*
2416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2417 % %
2418 % %
2419 % %
2420 % M a g i c k D e s k e w I m a g e %
2421 % %
2422 % %
2423 % %
2424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2425 %
2426 % MagickDeskewImage() removes skew from the image. Skew is an artifact that
2427 % occurs in scanned images because of the camera being misaligned,
2428 % imperfections in the scanning or surface, or simply because the paper was
2429 % not placed completely flat when scanned.
2430 %
2431 % The format of the MagickDeskewImage method is:
2432 %
2433 % MagickBooleanType MagickDeskewImage(MagickWand *wand,
2434 % const double threshold)
2435 %
2436 % A description of each parameter follows:
2437 %
2438 % o wand: the magick wand.
2439 %
2440 % o threshold: separate background from foreground.
2441 %
2442 */
2443 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2444  const double threshold)
2445 {
2446  Image
2447  *sepia_image;
2448 
2449  assert(wand != (MagickWand *) NULL);
2450  assert(wand->signature == MagickWandSignature);
2451  if (wand->debug != MagickFalse)
2452  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2453  if (wand->images == (Image *) NULL)
2454  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2455  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2456  if (sepia_image == (Image *) NULL)
2457  return(MagickFalse);
2458  ReplaceImageInList(&wand->images,sepia_image);
2459  return(MagickTrue);
2460 }
2461 
2462 /*
2463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2464 % %
2465 % %
2466 % %
2467 % M a g i c k D e s p e c k l e I m a g e %
2468 % %
2469 % %
2470 % %
2471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472 %
2473 % MagickDespeckleImage() reduces the speckle noise in an image while
2474 % perserving the edges of the original image.
2475 %
2476 % The format of the MagickDespeckleImage method is:
2477 %
2478 % MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2479 %
2480 % A description of each parameter follows:
2481 %
2482 % o wand: the magick wand.
2483 %
2484 */
2486 {
2487  Image
2488  *despeckle_image;
2489 
2490  assert(wand != (MagickWand *) NULL);
2491  assert(wand->signature == MagickWandSignature);
2492  if (wand->debug != MagickFalse)
2493  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2494  if (wand->images == (Image *) NULL)
2495  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2496  despeckle_image=DespeckleImage(wand->images,wand->exception);
2497  if (despeckle_image == (Image *) NULL)
2498  return(MagickFalse);
2499  ReplaceImageInList(&wand->images,despeckle_image);
2500  return(MagickTrue);
2501 }
2502 
2503 /*
2504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2505 % %
2506 % %
2507 % %
2508 % M a g i c k D e s t r o y I m a g e %
2509 % %
2510 % %
2511 % %
2512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2513 %
2514 % MagickDestroyImage() dereferences an image, deallocating memory associated
2515 % with the image if the reference count becomes zero.
2516 %
2517 % The format of the MagickDestroyImage method is:
2518 %
2519 % Image *MagickDestroyImage(Image *image)
2520 %
2521 % A description of each parameter follows:
2522 %
2523 % o image: the image.
2524 %
2525 */
2527 {
2528  return(DestroyImage(image));
2529 }
2530 
2531 /*
2532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2533 % %
2534 % %
2535 % %
2536 % M a g i c k D i s p l a y I m a g e %
2537 % %
2538 % %
2539 % %
2540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2541 %
2542 % MagickDisplayImage() displays an image.
2543 %
2544 % The format of the MagickDisplayImage method is:
2545 %
2546 % MagickBooleanType MagickDisplayImage(MagickWand *wand,
2547 % const char *server_name)
2548 %
2549 % A description of each parameter follows:
2550 %
2551 % o wand: the magick wand.
2552 %
2553 % o server_name: the X server name.
2554 %
2555 */
2556 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2557  const char *server_name)
2558 {
2559  Image
2560  *image;
2561 
2562  MagickBooleanType
2563  status;
2564 
2565  assert(wand != (MagickWand *) NULL);
2566  assert(wand->signature == MagickWandSignature);
2567  if (wand->debug != MagickFalse)
2568  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2569  if (wand->images == (Image *) NULL)
2570  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2571  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2572  if (image == (Image *) NULL)
2573  return(MagickFalse);
2574  (void) CloneString(&wand->image_info->server_name,server_name);
2575  status=DisplayImages(wand->image_info,image,wand->exception);
2576  image=DestroyImage(image);
2577  return(status);
2578 }
2579 
2580 /*
2581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2582 % %
2583 % %
2584 % %
2585 % M a g i c k D i s p l a y I m a g e s %
2586 % %
2587 % %
2588 % %
2589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2590 %
2591 % MagickDisplayImages() displays an image or image sequence.
2592 %
2593 % The format of the MagickDisplayImages method is:
2594 %
2595 % MagickBooleanType MagickDisplayImages(MagickWand *wand,
2596 % const char *server_name)
2597 %
2598 % A description of each parameter follows:
2599 %
2600 % o wand: the magick wand.
2601 %
2602 % o server_name: the X server name.
2603 %
2604 */
2606  const char *server_name)
2607 {
2608  MagickBooleanType
2609  status;
2610 
2611  assert(wand != (MagickWand *) NULL);
2612  assert(wand->signature == MagickWandSignature);
2613  if (wand->debug != MagickFalse)
2614  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2615  (void) CloneString(&wand->image_info->server_name,server_name);
2616  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2617  return(status);
2618 }
2619 
2620 /*
2621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2622 % %
2623 % %
2624 % %
2625 % M a g i c k D i s t o r t I m a g e %
2626 % %
2627 % %
2628 % %
2629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2630 %
2631 % MagickDistortImage() distorts an image using various distortion methods, by
2632 % mapping color lookups of the source image to a new destination image
2633 % usally of the same size as the source image, unless 'bestfit' is set to
2634 % true.
2635 %
2636 % If 'bestfit' is enabled, and distortion allows it, the destination image is
2637 % adjusted to ensure the whole source 'image' will just fit within the final
2638 % destination image, which will be sized and offset accordingly. Also in
2639 % many cases the virtual offset of the source image will be taken into
2640 % account in the mapping.
2641 %
2642 % The format of the MagickDistortImage method is:
2643 %
2644 % MagickBooleanType MagickDistortImage(MagickWand *wand,
2645 % const DistortMethod method,const size_t number_arguments,
2646 % const double *arguments,const MagickBooleanType bestfit)
2647 %
2648 % A description of each parameter follows:
2649 %
2650 % o image: the image to be distorted.
2651 %
2652 % o method: the method of image distortion.
2653 %
2654 % ArcDistortion always ignores the source image offset, and always
2655 % 'bestfit' the destination image with the top left corner offset
2656 % relative to the polar mapping center.
2657 %
2658 % Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2659 % style of image distortion.
2660 %
2661 % Affine, Perspective, and Bilinear, do least squares fitting of the
2662 % distortion when more than the minimum number of control point pairs
2663 % are provided.
2664 %
2665 % Perspective, and Bilinear, falls back to a Affine distortion when less
2666 % that 4 control point pairs are provided. While Affine distortions let
2667 % you use any number of control point pairs, that is Zero pairs is a
2668 % no-Op (viewport only) distrotion, one pair is a translation and two
2669 % pairs of control points do a scale-rotate-translate, without any
2670 % shearing.
2671 %
2672 % o number_arguments: the number of arguments given for this distortion
2673 % method.
2674 %
2675 % o arguments: the arguments for this distortion method.
2676 %
2677 % o bestfit: Attempt to resize destination to fit distorted source.
2678 %
2679 */
2680 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2681  const DistortMethod method,const size_t number_arguments,
2682  const double *arguments,const MagickBooleanType bestfit)
2683 {
2684  Image
2685  *distort_image;
2686 
2687  assert(wand != (MagickWand *) NULL);
2688  assert(wand->signature == MagickWandSignature);
2689  if (wand->debug != MagickFalse)
2690  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2691  if (wand->images == (Image *) NULL)
2692  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2693  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2694  bestfit,wand->exception);
2695  if (distort_image == (Image *) NULL)
2696  return(MagickFalse);
2697  ReplaceImageInList(&wand->images,distort_image);
2698  return(MagickTrue);
2699 }
2700 
2701 /*
2702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2703 % %
2704 % %
2705 % %
2706 % M a g i c k D r a w I m a g e %
2707 % %
2708 % %
2709 % %
2710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2711 %
2712 % MagickDrawImage() renders the drawing wand on the current image.
2713 %
2714 % The format of the MagickDrawImage method is:
2715 %
2716 % MagickBooleanType MagickDrawImage(MagickWand *wand,
2717 % const DrawingWand *drawing_wand)
2718 %
2719 % A description of each parameter follows:
2720 %
2721 % o wand: the magick wand.
2722 %
2723 % o drawing_wand: the draw wand.
2724 %
2725 */
2726 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2727  const DrawingWand *drawing_wand)
2728 {
2729  char
2730  *primitive;
2731 
2732  DrawInfo
2733  *draw_info;
2734 
2735  MagickBooleanType
2736  status;
2737 
2738  assert(wand != (MagickWand *) NULL);
2739  assert(wand->signature == MagickWandSignature);
2740  if (wand->debug != MagickFalse)
2741  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2742  if (wand->images == (Image *) NULL)
2743  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2744  draw_info=PeekDrawingWand(drawing_wand);
2745  if ((draw_info == (DrawInfo *) NULL) ||
2746  (draw_info->primitive == (char *) NULL))
2747  return(MagickFalse);
2748  primitive=AcquireString(draw_info->primitive);
2749  draw_info=DestroyDrawInfo(draw_info);
2750  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2751  draw_info->primitive=primitive;
2752  status=DrawImage(wand->images,draw_info,wand->exception);
2753  draw_info=DestroyDrawInfo(draw_info);
2754  return(status);
2755 }
2756 
2757 /*
2758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2759 % %
2760 % %
2761 % %
2762 % M a g i c k E d g e I m a g e %
2763 % %
2764 % %
2765 % %
2766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2767 %
2768 % MagickEdgeImage() enhance edges within the image with a convolution filter
2769 % of the given radius. Use a radius of 0 and Edge() selects a suitable
2770 % radius for you.
2771 %
2772 % The format of the MagickEdgeImage method is:
2773 %
2774 % MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2775 %
2776 % A description of each parameter follows:
2777 %
2778 % o wand: the magick wand.
2779 %
2780 % o radius: the radius of the pixel neighborhood.
2781 %
2782 */
2783 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2784  const double radius)
2785 {
2786  Image
2787  *edge_image;
2788 
2789  assert(wand != (MagickWand *) NULL);
2790  assert(wand->signature == MagickWandSignature);
2791  if (wand->debug != MagickFalse)
2792  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2793  if (wand->images == (Image *) NULL)
2794  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2795  edge_image=EdgeImage(wand->images,radius,wand->exception);
2796  if (edge_image == (Image *) NULL)
2797  return(MagickFalse);
2798  ReplaceImageInList(&wand->images,edge_image);
2799  return(MagickTrue);
2800 }
2801 
2802 /*
2803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2804 % %
2805 % %
2806 % %
2807 % M a g i c k E m b o s s I m a g e %
2808 % %
2809 % %
2810 % %
2811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2812 %
2813 % MagickEmbossImage() returns a grayscale image with a three-dimensional
2814 % effect. We convolve the image with a Gaussian operator of the given radius
2815 % and standard deviation (sigma). For reasonable results, radius should be
2816 % larger than sigma. Use a radius of 0 and Emboss() selects a suitable
2817 % radius for you.
2818 %
2819 % The format of the MagickEmbossImage method is:
2820 %
2821 % MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2822 % const double sigma)
2823 %
2824 % A description of each parameter follows:
2825 %
2826 % o wand: the magick wand.
2827 %
2828 % o radius: the radius of the Gaussian, in pixels, not counting the center
2829 % pixel.
2830 %
2831 % o sigma: the standard deviation of the Gaussian, in pixels.
2832 %
2833 */
2834 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2835  const double radius,const double sigma)
2836 {
2837  Image
2838  *emboss_image;
2839 
2840  assert(wand != (MagickWand *) NULL);
2841  assert(wand->signature == MagickWandSignature);
2842  if (wand->debug != MagickFalse)
2843  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2844  if (wand->images == (Image *) NULL)
2845  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2846  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2847  if (emboss_image == (Image *) NULL)
2848  return(MagickFalse);
2849  ReplaceImageInList(&wand->images,emboss_image);
2850  return(MagickTrue);
2851 }
2852 
2853 /*
2854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2855 % %
2856 % %
2857 % %
2858 % M a g i c k E n c i p h e r I m a g e %
2859 % %
2860 % %
2861 % %
2862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2863 %
2864 % MagickEncipherImage() converts plaint pixels to cipher pixels.
2865 %
2866 % The format of the MagickEncipherImage method is:
2867 %
2868 % MagickBooleanType MagickEncipherImage(MagickWand *wand,
2869 % const char *passphrase)
2870 %
2871 % A description of each parameter follows:
2872 %
2873 % o wand: the magick wand.
2874 %
2875 % o passphrase: the passphrase.
2876 %
2877 */
2879  const char *passphrase)
2880 {
2881  assert(wand != (MagickWand *) NULL);
2882  assert(wand->signature == MagickWandSignature);
2883  if (wand->debug != MagickFalse)
2884  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2885  if (wand->images == (Image *) NULL)
2886  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2887  return(EncipherImage(wand->images,passphrase,wand->exception));
2888 }
2889 
2890 /*
2891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2892 % %
2893 % %
2894 % %
2895 % M a g i c k E n h a n c e I m a g e %
2896 % %
2897 % %
2898 % %
2899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2900 %
2901 % MagickEnhanceImage() applies a digital filter that improves the quality of a
2902 % noisy image.
2903 %
2904 % The format of the MagickEnhanceImage method is:
2905 %
2906 % MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2907 %
2908 % A description of each parameter follows:
2909 %
2910 % o wand: the magick wand.
2911 %
2912 */
2913 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2914 {
2915  Image
2916  *enhance_image;
2917 
2918  assert(wand != (MagickWand *) NULL);
2919  assert(wand->signature == MagickWandSignature);
2920  if (wand->debug != MagickFalse)
2921  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2922  if (wand->images == (Image *) NULL)
2923  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2924  enhance_image=EnhanceImage(wand->images,wand->exception);
2925  if (enhance_image == (Image *) NULL)
2926  return(MagickFalse);
2927  ReplaceImageInList(&wand->images,enhance_image);
2928  return(MagickTrue);
2929 }
2930 
2931 /*
2932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2933 % %
2934 % %
2935 % %
2936 % M a g i c k E q u a l i z e I m a g e %
2937 % %
2938 % %
2939 % %
2940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2941 %
2942 % MagickEqualizeImage() equalizes the image histogram.
2943 %
2944 % The format of the MagickEqualizeImage method is:
2945 %
2946 % MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2947 %
2948 % A description of each parameter follows:
2949 %
2950 % o wand: the magick wand.
2951 %
2952 % o channel: the image channel(s).
2953 %
2954 */
2956 {
2957  MagickBooleanType
2958  status;
2959 
2960  assert(wand != (MagickWand *) NULL);
2961  assert(wand->signature == MagickWandSignature);
2962  if (wand->debug != MagickFalse)
2963  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2964  if (wand->images == (Image *) NULL)
2965  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2966  status=EqualizeImage(wand->images,wand->exception);
2967  return(status);
2968 }
2969 
2970 /*
2971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2972 % %
2973 % %
2974 % %
2975 % M a g i c k E v a l u a t e I m a g e %
2976 % %
2977 % %
2978 % %
2979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2980 %
2981 % MagickEvaluateImage() applys an arithmetic, relational, or logical
2982 % expression to an image. Use these operators to lighten or darken an image,
2983 % to increase or decrease contrast in an image, or to produce the "negative"
2984 % of an image.
2985 %
2986 % The format of the MagickEvaluateImage method is:
2987 %
2988 % MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2989 % const MagickEvaluateOperator operator,const double value)
2990 % MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2991 % const MagickEvaluateOperator operator)
2992 %
2993 % A description of each parameter follows:
2994 %
2995 % o wand: the magick wand.
2996 %
2997 % o op: A channel operator.
2998 %
2999 % o value: A value value.
3000 %
3001 */
3002 
3004  const MagickEvaluateOperator op)
3005 {
3006  Image
3007  *evaluate_image;
3008 
3009  assert(wand != (MagickWand *) NULL);
3010  assert(wand->signature == MagickWandSignature);
3011  if (wand->debug != MagickFalse)
3012  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3013  if (wand->images == (Image *) NULL)
3014  return((MagickWand *) NULL);
3015  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3016  if (evaluate_image == (Image *) NULL)
3017  return((MagickWand *) NULL);
3018  return(CloneMagickWandFromImages(wand,evaluate_image));
3019 }
3020 
3022  const MagickEvaluateOperator op,const double value)
3023 {
3024  MagickBooleanType
3025  status;
3026 
3027  assert(wand != (MagickWand *) NULL);
3028  assert(wand->signature == MagickWandSignature);
3029  if (wand->debug != MagickFalse)
3030  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3031  if (wand->images == (Image *) NULL)
3032  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3033  status=EvaluateImage(wand->images,op,value,wand->exception);
3034  return(status);
3035 }
3036 
3037 /*
3038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3039 % %
3040 % %
3041 % %
3042 % M a g i c k E x p o r t I m a g e P i x e l s %
3043 % %
3044 % %
3045 % %
3046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3047 %
3048 % MagickExportImagePixels() extracts pixel data from an image and returns it
3049 % to you. The method returns MagickTrue on success otherwise MagickFalse if
3050 % an error is encountered. The data is returned as char, short int, int,
3051 % ssize_t, float, or double in the order specified by map.
3052 %
3053 % Suppose you want to extract the first scanline of a 640x480 image as
3054 % character data in red-green-blue order:
3055 %
3056 % MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3057 %
3058 % The format of the MagickExportImagePixels method is:
3059 %
3060 % MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3061 % const ssize_t x,const ssize_t y,const size_t columns,
3062 % const size_t rows,const char *map,const StorageType storage,
3063 % void *pixels)
3064 %
3065 % A description of each parameter follows:
3066 %
3067 % o wand: the magick wand.
3068 %
3069 % o x, y, columns, rows: These values define the perimeter
3070 % of a region of pixels you want to extract.
3071 %
3072 % o map: This string reflects the expected ordering of the pixel array.
3073 % It can be any combination or order of R = red, G = green, B = blue,
3074 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3075 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3076 % P = pad.
3077 %
3078 % o storage: Define the data type of the pixels. Float and double types are
3079 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3080 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3081 % LongPixel, QuantumPixel, or ShortPixel.
3082 %
3083 % o pixels: This array of values contain the pixel components as defined by
3084 % map and type. You must preallocate this array where the expected
3085 % length varies depending on the values of width, height, map, and type.
3086 %
3087 */
3089  const ssize_t x,const ssize_t y,const size_t columns,
3090  const size_t rows,const char *map,const StorageType storage,
3091  void *pixels)
3092 {
3093  MagickBooleanType
3094  status;
3095 
3096  assert(wand != (MagickWand *) NULL);
3097  assert(wand->signature == MagickWandSignature);
3098  if (wand->debug != MagickFalse)
3099  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3100  if (wand->images == (Image *) NULL)
3101  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3102  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3103  storage,pixels,wand->exception);
3104  return(status);
3105 }
3106 
3107 /*
3108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3109 % %
3110 % %
3111 % %
3112 % M a g i c k E x t e n t I m a g e %
3113 % %
3114 % %
3115 % %
3116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3117 %
3118 % MagickExtentImage() extends the image as defined by the geometry, gravity,
3119 % and wand background color. Set the (x,y) offset of the geometry to move
3120 % the original wand relative to the extended wand.
3121 %
3122 % The format of the MagickExtentImage method is:
3123 %
3124 % MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3125 % const size_t height,const ssize_t x,const ssize_t y)
3126 %
3127 % A description of each parameter follows:
3128 %
3129 % o wand: the magick wand.
3130 %
3131 % o width: the region width.
3132 %
3133 % o height: the region height.
3134 %
3135 % o x: the region x offset.
3136 %
3137 % o y: the region y offset.
3138 %
3139 */
3140 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3141  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3142 {
3143  Image
3144  *extent_image;
3145 
3146  RectangleInfo
3147  extent;
3148 
3149  assert(wand != (MagickWand *) NULL);
3150  assert(wand->signature == MagickWandSignature);
3151  if (wand->debug != MagickFalse)
3152  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3153  if (wand->images == (Image *) NULL)
3154  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3155  extent.width=width;
3156  extent.height=height;
3157  extent.x=x;
3158  extent.y=y;
3159  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3160  if (extent_image == (Image *) NULL)
3161  return(MagickFalse);
3162  ReplaceImageInList(&wand->images,extent_image);
3163  return(MagickTrue);
3164 }
3165 
3166 /*
3167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3168 % %
3169 % %
3170 % %
3171 % M a g i c k F l i p I m a g e %
3172 % %
3173 % %
3174 % %
3175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3176 %
3177 % MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3178 % around the central x-axis.
3179 %
3180 % The format of the MagickFlipImage method is:
3181 %
3182 % MagickBooleanType MagickFlipImage(MagickWand *wand)
3183 %
3184 % A description of each parameter follows:
3185 %
3186 % o wand: the magick wand.
3187 %
3188 */
3189 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3190 {
3191  Image
3192  *flip_image;
3193 
3194  assert(wand != (MagickWand *) NULL);
3195  assert(wand->signature == MagickWandSignature);
3196  if (wand->debug != MagickFalse)
3197  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3198  if (wand->images == (Image *) NULL)
3199  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3200  flip_image=FlipImage(wand->images,wand->exception);
3201  if (flip_image == (Image *) NULL)
3202  return(MagickFalse);
3203  ReplaceImageInList(&wand->images,flip_image);
3204  return(MagickTrue);
3205 }
3206 
3207 /*
3208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3209 % %
3210 % %
3211 % %
3212 % 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 %
3213 % %
3214 % %
3215 % %
3216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3217 %
3218 % MagickFloodfillPaintImage() changes the color value of any pixel that matches
3219 % target and is an immediate neighbor. If the method FillToBorderMethod is
3220 % specified, the color value is changed for any neighbor pixel that does not
3221 % match the bordercolor member of image.
3222 %
3223 % The format of the MagickFloodfillPaintImage method is:
3224 %
3225 % MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3226 % const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3227 % const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3228 %
3229 % A description of each parameter follows:
3230 %
3231 % o wand: the magick wand.
3232 %
3233 % o fill: the floodfill color pixel wand.
3234 %
3235 % o fuzz: By default target must match a particular pixel color
3236 % exactly. However, in many cases two colors may differ by a small amount.
3237 % The fuzz member of image defines how much tolerance is acceptable to
3238 % consider two colors as the same. For example, set fuzz to 10 and the
3239 % color red at intensities of 100 and 102 respectively are now interpreted
3240 % as the same color for the purposes of the floodfill.
3241 %
3242 % o bordercolor: the border color pixel wand.
3243 %
3244 % o x,y: the starting location of the operation.
3245 %
3246 % o invert: paint any pixel that does not match the target color.
3247 %
3248 */
3250  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3251  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3252 {
3253  DrawInfo
3254  *draw_info;
3255 
3256  MagickBooleanType
3257  status;
3258 
3259  PixelInfo
3260  target;
3261 
3262  assert(wand != (MagickWand *) NULL);
3263  assert(wand->signature == MagickWandSignature);
3264  if (wand->debug != MagickFalse)
3265  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3266  if (wand->images == (Image *) NULL)
3267  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3268  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3269  PixelGetQuantumPacket(fill,&draw_info->fill);
3270  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3271  wand->images->columns,y % wand->images->rows,&target,wand->exception);
3272  if (bordercolor != (PixelWand *) NULL)
3273  PixelGetMagickColor(bordercolor,&target);
3274  wand->images->fuzz=fuzz;
3275  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3276  wand->exception);
3277  draw_info=DestroyDrawInfo(draw_info);
3278  return(status);
3279 }
3280 
3281 /*
3282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3283 % %
3284 % %
3285 % %
3286 % M a g i c k F l o p I m a g e %
3287 % %
3288 % %
3289 % %
3290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3291 %
3292 % MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3293 % around the central y-axis.
3294 %
3295 % The format of the MagickFlopImage method is:
3296 %
3297 % MagickBooleanType MagickFlopImage(MagickWand *wand)
3298 %
3299 % A description of each parameter follows:
3300 %
3301 % o wand: the magick wand.
3302 %
3303 */
3304 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3305 {
3306  Image
3307  *flop_image;
3308 
3309  assert(wand != (MagickWand *) NULL);
3310  assert(wand->signature == MagickWandSignature);
3311  if (wand->debug != MagickFalse)
3312  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3313  if (wand->images == (Image *) NULL)
3314  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3315  flop_image=FlopImage(wand->images,wand->exception);
3316  if (flop_image == (Image *) NULL)
3317  return(MagickFalse);
3318  ReplaceImageInList(&wand->images,flop_image);
3319  return(MagickTrue);
3320 }
3321 
3322 /*
3323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3324 % %
3325 % %
3326 % %
3327 % 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 %
3328 % %
3329 % %
3330 % %
3331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3332 %
3333 % MagickForwardFourierTransformImage() implements the discrete Fourier
3334 % transform (DFT) of the image either as a magnitude / phase or real /
3335 % imaginary image pair.
3336 %
3337 % The format of the MagickForwardFourierTransformImage method is:
3338 %
3339 % MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3340 % const MagickBooleanType magnitude)
3341 %
3342 % A description of each parameter follows:
3343 %
3344 % o wand: the magick wand.
3345 %
3346 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
3347 % imaginary image pair.
3348 %
3349 */
3351  MagickWand *wand,const MagickBooleanType magnitude)
3352 {
3353  Image
3354  *forward_image;
3355 
3356  assert(wand != (MagickWand *) NULL);
3357  assert(wand->signature == MagickWandSignature);
3358  if (wand->debug != MagickFalse)
3359  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3360  if (wand->images == (Image *) NULL)
3361  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3362  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3363  wand->exception);
3364  if (forward_image == (Image *) NULL)
3365  return(MagickFalse);
3366  ReplaceImageInList(&wand->images,forward_image);
3367  return(MagickTrue);
3368 }
3369 
3370 /*
3371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3372 % %
3373 % %
3374 % %
3375 % M a g i c k F r a m e I m a g e %
3376 % %
3377 % %
3378 % %
3379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3380 %
3381 % MagickFrameImage() adds a simulated three-dimensional border around the
3382 % image. The width and height specify the border width of the vertical and
3383 % horizontal sides of the frame. The inner and outer bevels indicate the
3384 % width of the inner and outer shadows of the frame.
3385 %
3386 % The format of the MagickFrameImage method is:
3387 %
3388 % MagickBooleanType MagickFrameImage(MagickWand *wand,
3389 % const PixelWand *matte_color,const size_t width,
3390 % const size_t height,const ssize_t inner_bevel,
3391 % const ssize_t outer_bevel,const CompositeOperator compose)
3392 %
3393 % A description of each parameter follows:
3394 %
3395 % o wand: the magick wand.
3396 %
3397 % o matte_color: the frame color pixel wand.
3398 %
3399 % o width: the border width.
3400 %
3401 % o height: the border height.
3402 %
3403 % o inner_bevel: the inner bevel width.
3404 %
3405 % o outer_bevel: the outer bevel width.
3406 %
3407 % o compose: the composite operator.
3408 %
3409 */
3410 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3411  const PixelWand *matte_color,const size_t width,const size_t height,
3412  const ssize_t inner_bevel,const ssize_t outer_bevel,
3413  const CompositeOperator compose)
3414 {
3415  Image
3416  *frame_image;
3417 
3418  FrameInfo
3419  frame_info;
3420 
3421  assert(wand != (MagickWand *) NULL);
3422  assert(wand->signature == MagickWandSignature);
3423  if (wand->debug != MagickFalse)
3424  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3425  if (wand->images == (Image *) NULL)
3426  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3427  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3428  frame_info.width=wand->images->columns+2*width;
3429  frame_info.height=wand->images->rows+2*height;
3430  frame_info.x=(ssize_t) width;
3431  frame_info.y=(ssize_t) height;
3432  frame_info.inner_bevel=inner_bevel;
3433  frame_info.outer_bevel=outer_bevel;
3434  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3435  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3436  if (frame_image == (Image *) NULL)
3437  return(MagickFalse);
3438  ReplaceImageInList(&wand->images,frame_image);
3439  return(MagickTrue);
3440 }
3441 
3442 /*
3443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3444 % %
3445 % %
3446 % %
3447 % M a g i c k F u n c t i o n I m a g e %
3448 % %
3449 % %
3450 % %
3451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3452 %
3453 % MagickFunctionImage() applys an arithmetic, relational, or logical
3454 % expression to an image. Use these operators to lighten or darken an image,
3455 % to increase or decrease contrast in an image, or to produce the "negative"
3456 % of an image.
3457 %
3458 % The format of the MagickFunctionImage method is:
3459 %
3460 % MagickBooleanType MagickFunctionImage(MagickWand *wand,
3461 % const MagickFunction function,const size_t number_arguments,
3462 % const double *arguments)
3463 %
3464 % A description of each parameter follows:
3465 %
3466 % o wand: the magick wand.
3467 %
3468 % o function: the image function.
3469 %
3470 % o number_arguments: the number of function arguments.
3471 %
3472 % o arguments: the function arguments.
3473 %
3474 */
3476  const MagickFunction function,const size_t number_arguments,
3477  const double *arguments)
3478 {
3479  MagickBooleanType
3480  status;
3481 
3482  assert(wand != (MagickWand *) NULL);
3483  assert(wand->signature == MagickWandSignature);
3484  if (wand->debug != MagickFalse)
3485  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3486  if (wand->images == (Image *) NULL)
3487  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3488  status=FunctionImage(wand->images,function,number_arguments,arguments,
3489  wand->exception);
3490  return(status);
3491 }
3492 
3493 /*
3494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3495 % %
3496 % %
3497 % %
3498 % M a g i c k F x I m a g e %
3499 % %
3500 % %
3501 % %
3502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3503 %
3504 % MagickFxImage() evaluate expression for each pixel in the image.
3505 %
3506 % The format of the MagickFxImage method is:
3507 %
3508 % MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3509 %
3510 % A description of each parameter follows:
3511 %
3512 % o wand: the magick wand.
3513 %
3514 % o expression: the expression.
3515 %
3516 */
3517 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3518 {
3519  Image
3520  *fx_image;
3521 
3522  assert(wand != (MagickWand *) NULL);
3523  assert(wand->signature == MagickWandSignature);
3524  if (wand->debug != MagickFalse)
3525  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3526  if (wand->images == (Image *) NULL)
3527  return((MagickWand *) NULL);
3528  fx_image=FxImage(wand->images,expression,wand->exception);
3529  if (fx_image == (Image *) NULL)
3530  return((MagickWand *) NULL);
3531  return(CloneMagickWandFromImages(wand,fx_image));
3532 }
3533 
3534 /*
3535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3536 % %
3537 % %
3538 % %
3539 % M a g i c k G a m m a I m a g e %
3540 % %
3541 % %
3542 % %
3543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3544 %
3545 % MagickGammaImage() gamma-corrects an image. The same image viewed on
3546 % different devices will have perceptual differences in the way the image's
3547 % intensities are represented on the screen. Specify individual gamma levels
3548 % for the red, green, and blue channels, or adjust all three with the gamma
3549 % parameter. Values typically range from 0.8 to 2.3.
3550 %
3551 % You can also reduce the influence of a particular channel with a gamma
3552 % value of 0.
3553 %
3554 % The format of the MagickGammaImage method is:
3555 %
3556 % MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3557 %
3558 % A description of each parameter follows:
3559 %
3560 % o wand: the magick wand.
3561 %
3562 % o level: Define the level of gamma correction.
3563 %
3564 */
3565 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3566  const double gamma)
3567 {
3568  MagickBooleanType
3569  status;
3570 
3571  assert(wand != (MagickWand *) NULL);
3572  assert(wand->signature == MagickWandSignature);
3573  if (wand->debug != MagickFalse)
3574  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3575  if (wand->images == (Image *) NULL)
3576  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3577  status=GammaImage(wand->images,gamma,wand->exception);
3578  return(status);
3579 }
3580 
3581 /*
3582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3583 % %
3584 % %
3585 % %
3586 % M a g i c k G a u s s i a n B l u r I m a g e %
3587 % %
3588 % %
3589 % %
3590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3591 %
3592 % MagickGaussianBlurImage() blurs an image. We convolve the image with a
3593 % Gaussian operator of the given radius and standard deviation (sigma).
3594 % For reasonable results, the radius should be larger than sigma. Use a
3595 % radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3596 %
3597 % The format of the MagickGaussianBlurImage method is:
3598 %
3599 % MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3600 % const double radius,const double sigma)
3601 %
3602 % A description of each parameter follows:
3603 %
3604 % o wand: the magick wand.
3605 %
3606 % o radius: the radius of the Gaussian, in pixels, not counting the center
3607 % pixel.
3608 %
3609 % o sigma: the standard deviation of the Gaussian, in pixels.
3610 %
3611 */
3613  const double radius,const double sigma)
3614 {
3615  Image
3616  *blur_image;
3617 
3618  assert(wand != (MagickWand *) NULL);
3619  assert(wand->signature == MagickWandSignature);
3620  if (wand->debug != MagickFalse)
3621  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3622  if (wand->images == (Image *) NULL)
3623  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3624  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3625  if (blur_image == (Image *) NULL)
3626  return(MagickFalse);
3627  ReplaceImageInList(&wand->images,blur_image);
3628  return(MagickTrue);
3629 }
3630 
3631 /*
3632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633 % %
3634 % %
3635 % %
3636 % M a g i c k G e t I m a g e %
3637 % %
3638 % %
3639 % %
3640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641 %
3642 % MagickGetImage() gets the image at the current image index.
3643 %
3644 % The format of the MagickGetImage method is:
3645 %
3646 % MagickWand *MagickGetImage(MagickWand *wand)
3647 %
3648 % A description of each parameter follows:
3649 %
3650 % o wand: the magick wand.
3651 %
3652 */
3654 {
3655  Image
3656  *image;
3657 
3658  assert(wand != (MagickWand *) NULL);
3659  assert(wand->signature == MagickWandSignature);
3660  if (wand->debug != MagickFalse)
3661  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3662  if (wand->images == (Image *) NULL)
3663  {
3664  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3665  "ContainsNoImages","`%s'",wand->name);
3666  return((MagickWand *) NULL);
3667  }
3668  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3669  if (image == (Image *) NULL)
3670  return((MagickWand *) NULL);
3671  return(CloneMagickWandFromImages(wand,image));
3672 }
3673 
3674 /*
3675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3676 % %
3677 % %
3678 % %
3679 % 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 %
3680 % %
3681 % %
3682 % %
3683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3684 %
3685 % MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3686 % is not activated. That is, the image is RGB rather than RGBA or CMYK rather
3687 % than CMYKA.
3688 %
3689 % The format of the MagickGetImageAlphaChannel method is:
3690 %
3691 % MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3692 %
3693 % A description of each parameter follows:
3694 %
3695 % o wand: the magick wand.
3696 %
3697 */
3699 {
3700  assert(wand != (MagickWand *) NULL);
3701  assert(wand->signature == MagickWandSignature);
3702  if (wand->debug != MagickFalse)
3703  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3704  if (wand->images == (Image *) NULL)
3705  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3706  return(GetImageAlphaChannel(wand->images));
3707 }
3708 
3709 /*
3710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3711 % %
3712 % %
3713 % %
3714 % M a g i c k G e t I m a g e C l i p M a s k %
3715 % %
3716 % %
3717 % %
3718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3719 %
3720 % MagickGetImageMask() gets the image clip mask at the current image index.
3721 %
3722 % The format of the MagickGetImageMask method is:
3723 %
3724 % MagickWand *MagickGetImageMask(MagickWand *wand)
3725 %
3726 % A description of each parameter follows:
3727 %
3728 % o wand: the magick wand.
3729 %
3730 % o type: type of mask, ReadPixelMask or WritePixelMask.
3731 %
3732 */
3734  const PixelMask type)
3735 {
3736  Image
3737  *image;
3738 
3739  assert(wand != (MagickWand *) NULL);
3740  assert(wand->signature == MagickWandSignature);
3741  if (wand->debug != MagickFalse)
3742  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3743  if (wand->images == (Image *) NULL)
3744  {
3745  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3746  "ContainsNoImages","`%s'",wand->name);
3747  return((MagickWand *) NULL);
3748  }
3749  image=GetImageMask(wand->images,type,wand->exception);
3750  if (image == (Image *) NULL)
3751  return((MagickWand *) NULL);
3752  return(CloneMagickWandFromImages(wand,image));
3753 }
3754 
3755 /*
3756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3757 % %
3758 % %
3759 % %
3760 % 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 %
3761 % %
3762 % %
3763 % %
3764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3765 %
3766 % MagickGetImageBackgroundColor() returns the image background color.
3767 %
3768 % The format of the MagickGetImageBackgroundColor method is:
3769 %
3770 % MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3771 % PixelWand *background_color)
3772 %
3773 % A description of each parameter follows:
3774 %
3775 % o wand: the magick wand.
3776 %
3777 % o background_color: Return the background color.
3778 %
3779 */
3781  PixelWand *background_color)
3782 {
3783  assert(wand != (MagickWand *) NULL);
3784  assert(wand->signature == MagickWandSignature);
3785  if (wand->debug != MagickFalse)
3786  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3787  if (wand->images == (Image *) NULL)
3788  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3789  PixelSetPixelColor(background_color,&wand->images->background_color);
3790  return(MagickTrue);
3791 }
3792 
3793 /*
3794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3795 % %
3796 % %
3797 % %
3798 % M a g i c k G e t I m a g e B l o b %
3799 % %
3800 % %
3801 % %
3802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3803 %
3804 % MagickGetImageBlob() implements direct to memory image formats. It returns
3805 % the image as a blob (a formatted "file" in memory) and its length, starting
3806 % from the current position in the image sequence. Use MagickSetImageFormat()
3807 % to set the format to write to the blob (GIF, JPEG, PNG, etc.).
3808 %
3809 % Utilize MagickResetIterator() to ensure the write is from the beginning of
3810 % the image sequence.
3811 %
3812 % Use MagickRelinquishMemory() to free the blob when you are done with it.
3813 %
3814 % The format of the MagickGetImageBlob method is:
3815 %
3816 % unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3817 %
3818 % A description of each parameter follows:
3819 %
3820 % o wand: the magick wand.
3821 %
3822 % o length: the length of the blob.
3823 %
3824 */
3825 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3826 {
3827  unsigned char
3828  *blob;
3829 
3830  assert(wand != (MagickWand *) NULL);
3831  assert(wand->signature == MagickWandSignature);
3832  if (wand->debug != MagickFalse)
3833  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3834  if (wand->images == (Image *) NULL)
3835  {
3836  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3837  "ContainsNoImages","`%s'",wand->name);
3838  return((unsigned char *) NULL);
3839  }
3840  blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
3841  wand->exception);
3842  return(blob);
3843 }
3844 
3845 /*
3846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3847 % %
3848 % %
3849 % %
3850 % M a g i c k G e t I m a g e s B l o b %
3851 % %
3852 % %
3853 % %
3854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3855 %
3856 % MagickGetImageBlob() implements direct to memory image formats. It
3857 % returns the image sequence as a blob and its length. The format of the image
3858 % determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
3859 % return a different image format, use MagickSetImageFormat().
3860 %
3861 % Note, some image formats do not permit multiple images to the same image
3862 % stream (e.g. JPEG). in this instance, just the first image of the
3863 % sequence is returned as a blob.
3864 %
3865 % The format of the MagickGetImagesBlob method is:
3866 %
3867 % unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3868 %
3869 % A description of each parameter follows:
3870 %
3871 % o wand: the magick wand.
3872 %
3873 % o length: the length of the blob.
3874 %
3875 */
3876 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3877 {
3878  unsigned char
3879  *blob;
3880 
3881  assert(wand != (MagickWand *) NULL);
3882  assert(wand->signature == MagickWandSignature);
3883  if (wand->debug != MagickFalse)
3884  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3885  if (wand->images == (Image *) NULL)
3886  {
3887  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3888  "ContainsNoImages","`%s'",wand->name);
3889  return((unsigned char *) NULL);
3890  }
3891  blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
3892  wand->images),length,wand->exception);
3893  return(blob);
3894 }
3895 
3896 /*
3897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3898 % %
3899 % %
3900 % %
3901 % 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 %
3902 % %
3903 % %
3904 % %
3905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3906 %
3907 % MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3908 % image.
3909 %
3910 % The format of the MagickGetImageBluePrimary method is:
3911 %
3912 % MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3913 % double *y,double *z)
3914 %
3915 % A description of each parameter follows:
3916 %
3917 % o wand: the magick wand.
3918 %
3919 % o x: the chromaticity blue primary x-point.
3920 %
3921 % o y: the chromaticity blue primary y-point.
3922 %
3923 % o z: the chromaticity blue primary z-point.
3924 %
3925 */
3927  double *x,double *y,double *z)
3928 {
3929  assert(wand != (MagickWand *) NULL);
3930  assert(wand->signature == MagickWandSignature);
3931  if (wand->debug != MagickFalse)
3932  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3933  if (wand->images == (Image *) NULL)
3934  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3935  *x=wand->images->chromaticity.blue_primary.x;
3936  *y=wand->images->chromaticity.blue_primary.y;
3937  *z=wand->images->chromaticity.blue_primary.z;
3938  return(MagickTrue);
3939 }
3940 
3941 /*
3942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3943 % %
3944 % %
3945 % %
3946 % 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 %
3947 % %
3948 % %
3949 % %
3950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3951 %
3952 % MagickGetImageBorderColor() returns the image border color.
3953 %
3954 % The format of the MagickGetImageBorderColor method is:
3955 %
3956 % MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3957 % PixelWand *border_color)
3958 %
3959 % A description of each parameter follows:
3960 %
3961 % o wand: the magick wand.
3962 %
3963 % o border_color: Return the border color.
3964 %
3965 */
3967  PixelWand *border_color)
3968 {
3969  assert(wand != (MagickWand *) NULL);
3970  assert(wand->signature == MagickWandSignature);
3971  if (wand->debug != MagickFalse)
3972  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3973  if (wand->images == (Image *) NULL)
3974  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3975  PixelSetPixelColor(border_color,&wand->images->border_color);
3976  return(MagickTrue);
3977 }
3978 
3979 /*
3980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3981 % %
3982 % %
3983 % %
3984 % M a g i c k G e t I m a g e F e a t u r e s %
3985 % %
3986 % %
3987 % %
3988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3989 %
3990 % MagickGetImageFeatures() returns features for each channel in the
3991 % image in each of four directions (horizontal, vertical, left and right
3992 % diagonals) for the specified distance. The features include the angular
3993 % second moment, contrast, correlation, sum of squares: variance, inverse
3994 % difference moment, sum average, sum varience, sum entropy, entropy,
3995 % difference variance, difference entropy, information measures of
3996 % correlation 1, information measures of correlation 2, and maximum
3997 % correlation coefficient. You can access the red channel contrast, for
3998 % example, like this:
3999 %
4000 % channel_features=MagickGetImageFeatures(wand,1);
4001 % contrast=channel_features[RedPixelChannel].contrast[0];
4002 %
4003 % Use MagickRelinquishMemory() to free the statistics buffer.
4004 %
4005 % The format of the MagickGetImageFeatures method is:
4006 %
4007 % ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4008 % const size_t distance)
4009 %
4010 % A description of each parameter follows:
4011 %
4012 % o wand: the magick wand.
4013 %
4014 % o distance: the distance.
4015 %
4016 */
4018  const size_t distance)
4019 {
4020  assert(wand != (MagickWand *) NULL);
4021  assert(wand->signature == MagickWandSignature);
4022  if (wand->debug != MagickFalse)
4023  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4024  if (wand->images == (Image *) NULL)
4025  {
4026  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4027  "ContainsNoImages","`%s'",wand->name);
4028  return((ChannelFeatures *) NULL);
4029  }
4030  return(GetImageFeatures(wand->images,distance,wand->exception));
4031 }
4032 
4033 /*
4034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4035 % %
4036 % %
4037 % %
4038 % M a g i c k G e t I m a g e K u r t o s i s %
4039 % %
4040 % %
4041 % %
4042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4043 %
4044 % MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4045 % more image channels.
4046 %
4047 % The format of the MagickGetImageKurtosis method is:
4048 %
4049 % MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4050 % double *kurtosis,double *skewness)
4051 %
4052 % A description of each parameter follows:
4053 %
4054 % o wand: the magick wand.
4055 %
4056 % o kurtosis: The kurtosis for the specified channel(s).
4057 %
4058 % o skewness: The skewness for the specified channel(s).
4059 %
4060 */
4062  double *kurtosis,double *skewness)
4063 {
4064  MagickBooleanType
4065  status;
4066 
4067  assert(wand != (MagickWand *) NULL);
4068  assert(wand->signature == MagickWandSignature);
4069  if (wand->debug != MagickFalse)
4070  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4071  if (wand->images == (Image *) NULL)
4072  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4073  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4074  return(status);
4075 }
4076 
4077 /*
4078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4079 % %
4080 % %
4081 % %
4082 % M a g i c k G e t I m a g e M e a n %
4083 % %
4084 % %
4085 % %
4086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4087 %
4088 % MagickGetImageMean() gets the mean and standard deviation of one or more
4089 % image channels.
4090 %
4091 % The format of the MagickGetImageMean method is:
4092 %
4093 % MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4094 % double *standard_deviation)
4095 %
4096 % A description of each parameter follows:
4097 %
4098 % o wand: the magick wand.
4099 %
4100 % o channel: the image channel(s).
4101 %
4102 % o mean: The mean pixel value for the specified channel(s).
4103 %
4104 % o standard_deviation: The standard deviation for the specified channel(s).
4105 %
4106 */
4107 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4108  double *standard_deviation)
4109 {
4110  MagickBooleanType
4111  status;
4112 
4113  assert(wand != (MagickWand *) NULL);
4114  assert(wand->signature == MagickWandSignature);
4115  if (wand->debug != MagickFalse)
4116  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4117  if (wand->images == (Image *) NULL)
4118  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4119  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4120  return(status);
4121 }
4122 
4123 /*
4124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4125 % %
4126 % %
4127 % %
4128 % M a g i c k G e t I m a g e R a n g e %
4129 % %
4130 % %
4131 % %
4132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4133 %
4134 % MagickGetImageRange() gets the range for one or more image channels.
4135 %
4136 % The format of the MagickGetImageRange method is:
4137 %
4138 % MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4139 % double *maxima)
4140 %
4141 % A description of each parameter follows:
4142 %
4143 % o wand: the magick wand.
4144 %
4145 % o minima: The minimum pixel value for the specified channel(s).
4146 %
4147 % o maxima: The maximum pixel value for the specified channel(s).
4148 %
4149 */
4151  double *minima,double *maxima)
4152 {
4153  MagickBooleanType
4154  status;
4155 
4156  assert(wand != (MagickWand *) NULL);
4157  assert(wand->signature == MagickWandSignature);
4158  if (wand->debug != MagickFalse)
4159  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4160  if (wand->images == (Image *) NULL)
4161  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4162  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4163  return(status);
4164 }
4165 
4166 /*
4167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4168 % %
4169 % %
4170 % %
4171 % M a g i c k G e t I m a g e S t a t i s t i c s %
4172 % %
4173 % %
4174 % %
4175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4176 %
4177 % MagickGetImageStatistics() returns statistics for each channel in the
4178 % image. The statistics include the channel depth, its minima and
4179 % maxima, the mean, the standard deviation, the kurtosis and the skewness.
4180 % You can access the red channel mean, for example, like this:
4181 %
4182 % channel_statistics=MagickGetImageStatistics(wand);
4183 % red_mean=channel_statistics[RedPixelChannel].mean;
4184 %
4185 % Use MagickRelinquishMemory() to free the statistics buffer.
4186 %
4187 % The format of the MagickGetImageStatistics method is:
4188 %
4189 % ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4190 %
4191 % A description of each parameter follows:
4192 %
4193 % o wand: the magick wand.
4194 %
4195 */
4197 {
4198  assert(wand != (MagickWand *) NULL);
4199  assert(wand->signature == MagickWandSignature);
4200  if (wand->debug != MagickFalse)
4201  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4202  if (wand->images == (Image *) NULL)
4203  {
4204  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4205  "ContainsNoImages","`%s'",wand->name);
4206  return((ChannelStatistics *) NULL);
4207  }
4208  return(GetImageStatistics(wand->images,wand->exception));
4209 }
4210 
4211 /*
4212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4213 % %
4214 % %
4215 % %
4216 % 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 %
4217 % %
4218 % %
4219 % %
4220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4221 %
4222 % MagickGetImageColormapColor() returns the color of the specified colormap
4223 % index.
4224 %
4225 % The format of the MagickGetImageColormapColor method is:
4226 %
4227 % MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4228 % const size_t index,PixelWand *color)
4229 %
4230 % A description of each parameter follows:
4231 %
4232 % o wand: the magick wand.
4233 %
4234 % o index: the offset into the image colormap.
4235 %
4236 % o color: Return the colormap color in this wand.
4237 %
4238 */
4240  const size_t index,PixelWand *color)
4241 {
4242  assert(wand != (MagickWand *) NULL);
4243  assert(wand->signature == MagickWandSignature);
4244  if (wand->debug != MagickFalse)
4245  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4246  if (wand->images == (Image *) NULL)
4247  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4248  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4249  (index >= wand->images->colors))
4250  {
4251  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4252  "InvalidColormapIndex","`%s'",wand->name);
4253  return(MagickFalse);
4254  }
4255  PixelSetPixelColor(color,wand->images->colormap+index);
4256  return(MagickTrue);
4257 }
4258 
4259 /*
4260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4261 % %
4262 % %
4263 % %
4264 % M a g i c k G e t I m a g e C o l o r s %
4265 % %
4266 % %
4267 % %
4268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4269 %
4270 % MagickGetImageColors() gets the number of unique colors in the image.
4271 %
4272 % The format of the MagickGetImageColors method is:
4273 %
4274 % size_t MagickGetImageColors(MagickWand *wand)
4275 %
4276 % A description of each parameter follows:
4277 %
4278 % o wand: the magick wand.
4279 %
4280 */
4282 {
4283  assert(wand != (MagickWand *) NULL);
4284  assert(wand->signature == MagickWandSignature);
4285  if (wand->debug != MagickFalse)
4286  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4287  if (wand->images == (Image *) NULL)
4288  {
4289  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4290  "ContainsNoImages","`%s'",wand->name);
4291  return(0);
4292  }
4293  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4294 }
4295 
4296 /*
4297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4298 % %
4299 % %
4300 % %
4301 % M a g i c k G e t I m a g e C o l o r s p a c e %
4302 % %
4303 % %
4304 % %
4305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4306 %
4307 % MagickGetImageColorspace() gets the image colorspace.
4308 %
4309 % The format of the MagickGetImageColorspace method is:
4310 %
4311 % ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4312 %
4313 % A description of each parameter follows:
4314 %
4315 % o wand: the magick wand.
4316 %
4317 */
4319 {
4320  assert(wand != (MagickWand *) NULL);
4321  assert(wand->signature == MagickWandSignature);
4322  if (wand->debug != MagickFalse)
4323  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4324  if (wand->images == (Image *) NULL)
4325  {
4326  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4327  "ContainsNoImages","`%s'",wand->name);
4328  return(UndefinedColorspace);
4329  }
4330  return(wand->images->colorspace);
4331 }
4332 
4333 /*
4334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4335 % %
4336 % %
4337 % %
4338 % M a g i c k G e t I m a g e C o m p o s e %
4339 % %
4340 % %
4341 % %
4342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4343 %
4344 % MagickGetImageCompose() returns the composite operator associated with the
4345 % image.
4346 %
4347 % The format of the MagickGetImageCompose method is:
4348 %
4349 % CompositeOperator MagickGetImageCompose(MagickWand *wand)
4350 %
4351 % A description of each parameter follows:
4352 %
4353 % o wand: the magick wand.
4354 %
4355 */
4357 {
4358  assert(wand != (MagickWand *) NULL);
4359  assert(wand->signature == MagickWandSignature);
4360  if (wand->debug != MagickFalse)
4361  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4362  if (wand->images == (Image *) NULL)
4363  {
4364  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4365  "ContainsNoImages","`%s'",wand->name);
4366  return(UndefinedCompositeOp);
4367  }
4368  return(wand->images->compose);
4369 }
4370 
4371 /*
4372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4373 % %
4374 % %
4375 % %
4376 % 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 %
4377 % %
4378 % %
4379 % %
4380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4381 %
4382 % MagickGetImageCompression() gets the image compression.
4383 %
4384 % The format of the MagickGetImageCompression method is:
4385 %
4386 % CompressionType MagickGetImageCompression(MagickWand *wand)
4387 %
4388 % A description of each parameter follows:
4389 %
4390 % o wand: the magick wand.
4391 %
4392 */
4394 {
4395  assert(wand != (MagickWand *) NULL);
4396  assert(wand->signature == MagickWandSignature);
4397  if (wand->debug != MagickFalse)
4398  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4399  if (wand->images == (Image *) NULL)
4400  {
4401  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4402  "ContainsNoImages","`%s'",wand->name);
4403  return(UndefinedCompression);
4404  }
4405  return(wand->images->compression);
4406 }
4407 
4408 /*
4409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4410 % %
4411 % %
4412 % %
4413 % 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 %
4414 % %
4415 % %
4416 % %
4417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4418 %
4419 % MagickGetImageCompressionQuality() gets the image compression quality.
4420 %
4421 % The format of the MagickGetImageCompressionQuality method is:
4422 %
4423 % size_t MagickGetImageCompressionQuality(MagickWand *wand)
4424 %
4425 % A description of each parameter follows:
4426 %
4427 % o wand: the magick wand.
4428 %
4429 */
4431 {
4432  assert(wand != (MagickWand *) NULL);
4433  assert(wand->signature == MagickWandSignature);
4434  if (wand->debug != MagickFalse)
4435  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4436  if (wand->images == (Image *) NULL)
4437  {
4438  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4439  "ContainsNoImages","`%s'",wand->name);
4440  return(0UL);
4441  }
4442  return(wand->images->quality);
4443 }
4444 
4445 /*
4446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4447 % %
4448 % %
4449 % %
4450 % M a g i c k G e t I m a g e D e l a y %
4451 % %
4452 % %
4453 % %
4454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4455 %
4456 % MagickGetImageDelay() gets the image delay.
4457 %
4458 % The format of the MagickGetImageDelay method is:
4459 %
4460 % size_t MagickGetImageDelay(MagickWand *wand)
4461 %
4462 % A description of each parameter follows:
4463 %
4464 % o wand: the magick wand.
4465 %
4466 */
4468 {
4469  assert(wand != (MagickWand *) NULL);
4470  assert(wand->signature == MagickWandSignature);
4471  if (wand->debug != MagickFalse)
4472  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4473  if (wand->images == (Image *) NULL)
4474  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4475  return(wand->images->delay);
4476 }
4477 
4478 /*
4479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4480 % %
4481 % %
4482 % %
4483 % M a g i c k G e t I m a g e D e p t h %
4484 % %
4485 % %
4486 % %
4487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4488 %
4489 % MagickGetImageDepth() gets the image depth.
4490 %
4491 % The format of the MagickGetImageDepth method is:
4492 %
4493 % size_t MagickGetImageDepth(MagickWand *wand)
4494 %
4495 % A description of each parameter follows:
4496 %
4497 % o wand: the magick wand.
4498 %
4499 */
4501 {
4502  assert(wand != (MagickWand *) NULL);
4503  assert(wand->signature == MagickWandSignature);
4504  if (wand->debug != MagickFalse)
4505  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4506  if (wand->images == (Image *) NULL)
4507  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4508  return(wand->images->depth);
4509 }
4510 
4511 /*
4512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4513 % %
4514 % %
4515 % %
4516 % M a g i c k G e t I m a g e D i s p o s e %
4517 % %
4518 % %
4519 % %
4520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4521 %
4522 % MagickGetImageDispose() gets the image disposal method.
4523 %
4524 % The format of the MagickGetImageDispose method is:
4525 %
4526 % DisposeType MagickGetImageDispose(MagickWand *wand)
4527 %
4528 % A description of each parameter follows:
4529 %
4530 % o wand: the magick wand.
4531 %
4532 */
4534 {
4535  assert(wand != (MagickWand *) NULL);
4536  assert(wand->signature == MagickWandSignature);
4537  if (wand->debug != MagickFalse)
4538  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4539  if (wand->images == (Image *) NULL)
4540  {
4541  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4542  "ContainsNoImages","`%s'",wand->name);
4543  return(UndefinedDispose);
4544  }
4545  return((DisposeType) wand->images->dispose);
4546 }
4547 
4548 /*
4549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4550 % %
4551 % %
4552 % %
4553 % M a g i c k G e t I m a g e D i s t o r t i o n %
4554 % %
4555 % %
4556 % %
4557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4558 %
4559 % MagickGetImageDistortion() compares an image to a reconstructed image and
4560 % returns the specified distortion metric.
4561 %
4562 % The format of the MagickGetImageDistortion method is:
4563 %
4564 % MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4565 % const MagickWand *reference,const MetricType metric,
4566 % double *distortion)
4567 %
4568 % A description of each parameter follows:
4569 %
4570 % o wand: the magick wand.
4571 %
4572 % o reference: the reference wand.
4573 %
4574 % o metric: the metric.
4575 %
4576 % o distortion: the computed distortion between the images.
4577 %
4578 */
4580  const MagickWand *reference,const MetricType metric,double *distortion)
4581 {
4582  MagickBooleanType
4583  status;
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) || (reference->images == (Image *) NULL))
4590  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4591  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4592  wand->exception);
4593  return(status);
4594 }
4595 
4596 /*
4597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4598 % %
4599 % %
4600 % %
4601 % 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 %
4602 % %
4603 % %
4604 % %
4605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4606 %
4607 % MagickGetImageDistortions() compares one or more pixel channels of an
4608 % image to a reconstructed image and returns the specified distortion metrics.
4609 %
4610 % Use MagickRelinquishMemory() to free the metrics when you are done with them.
4611 %
4612 % The format of the MagickGetImageDistortion method is:
4613 %
4614 % double *MagickGetImageDistortion(MagickWand *wand,
4615 % const MagickWand *reference,const MetricType metric)
4616 %
4617 % A description of each parameter follows:
4618 %
4619 % o wand: the magick wand.
4620 %
4621 % o reference: the reference wand.
4622 %
4623 % o metric: the metric.
4624 %
4625 */
4627  const MagickWand *reference,const MetricType metric)
4628 {
4629  double
4630  *channel_distortion;
4631 
4632  assert(wand != (MagickWand *) NULL);
4633  assert(wand->signature == MagickWandSignature);
4634  if (wand->debug != MagickFalse)
4635  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4636  assert(reference != (MagickWand *) NULL);
4637  assert(reference->signature == MagickWandSignature);
4638  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4639  {
4640  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4641  "ContainsNoImages","`%s'",wand->name);
4642  return((double *) NULL);
4643  }
4644  channel_distortion=GetImageDistortions(wand->images,reference->images,
4645  metric,wand->exception);
4646  return(channel_distortion);
4647 }
4648 
4649 /*
4650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4651 % %
4652 % %
4653 % %
4654 % M a g i c k G e t I m a g e E n d i a n %
4655 % %
4656 % %
4657 % %
4658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4659 %
4660 % MagickGetImageEndian() gets the image endian.
4661 %
4662 % The format of the MagickGetImageEndian method is:
4663 %
4664 % EndianType MagickGetImageEndian(MagickWand *wand)
4665 %
4666 % A description of each parameter follows:
4667 %
4668 % o wand: the magick wand.
4669 %
4670 */
4672 {
4673  assert(wand != (MagickWand *) NULL);
4674  assert(wand->signature == MagickWandSignature);
4675  if (wand->debug != MagickFalse)
4676  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4677  if (wand->images == (Image *) NULL)
4678  {
4679  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4680  "ContainsNoImages","`%s'",wand->name);
4681  return(UndefinedEndian);
4682  }
4683  return(wand->images->endian);
4684 }
4685 
4686 /*
4687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4688 % %
4689 % %
4690 % %
4691 % M a g i c k G e t I m a g e F i l e n a m e %
4692 % %
4693 % %
4694 % %
4695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4696 %
4697 % MagickGetImageFilename() returns the filename of a particular image in a
4698 % sequence.
4699 %
4700 % The format of the MagickGetImageFilename method is:
4701 %
4702 % char *MagickGetImageFilename(MagickWand *wand)
4703 %
4704 % A description of each parameter follows:
4705 %
4706 % o wand: the magick wand.
4707 %
4708 */
4710 {
4711  assert(wand != (MagickWand *) NULL);
4712  assert(wand->signature == MagickWandSignature);
4713  if (wand->debug != MagickFalse)
4714  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4715  if (wand->images == (Image *) NULL)
4716  {
4717  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4718  "ContainsNoImages","`%s'",wand->name);
4719  return((char *) NULL);
4720  }
4721  return(AcquireString(wand->images->filename));
4722 }
4723 
4724 /*
4725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4726 % %
4727 % %
4728 % %
4729 % M a g i c k G e t I m a g e F o r m a t %
4730 % %
4731 % %
4732 % %
4733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4734 %
4735 % MagickGetImageFormat() returns the format of a particular image in a
4736 % sequence.
4737 %
4738 % The format of the MagickGetImageFormat method is:
4739 %
4740 % char *MagickGetImageFormat(MagickWand *wand)
4741 %
4742 % A description of each parameter follows:
4743 %
4744 % o wand: the magick wand.
4745 %
4746 */
4748 {
4749  assert(wand != (MagickWand *) NULL);
4750  assert(wand->signature == MagickWandSignature);
4751  if (wand->debug != MagickFalse)
4752  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4753  if (wand->images == (Image *) NULL)
4754  {
4755  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4756  "ContainsNoImages","`%s'",wand->name);
4757  return((char *) NULL);
4758  }
4759  return(AcquireString(wand->images->magick));
4760 }
4761 
4762 /*
4763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4764 % %
4765 % %
4766 % %
4767 % M a g i c k G e t I m a g e F u z z %
4768 % %
4769 % %
4770 % %
4771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4772 %
4773 % MagickGetImageFuzz() gets the image fuzz.
4774 %
4775 % The format of the MagickGetImageFuzz method is:
4776 %
4777 % double MagickGetImageFuzz(MagickWand *wand)
4778 %
4779 % A description of each parameter follows:
4780 %
4781 % o wand: the magick wand.
4782 %
4783 */
4785 {
4786  assert(wand != (MagickWand *) NULL);
4787  assert(wand->signature == MagickWandSignature);
4788  if (wand->debug != MagickFalse)
4789  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4790  if (wand->images == (Image *) NULL)
4791  {
4792  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4793  "ContainsNoImages","`%s'",wand->name);
4794  return(0.0);
4795  }
4796  return(wand->images->fuzz);
4797 }
4798 
4799 /*
4800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4801 % %
4802 % %
4803 % %
4804 % M a g i c k G e t I m a g e G a m m a %
4805 % %
4806 % %
4807 % %
4808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4809 %
4810 % MagickGetImageGamma() gets the image gamma.
4811 %
4812 % The format of the MagickGetImageGamma method is:
4813 %
4814 % double MagickGetImageGamma(MagickWand *wand)
4815 %
4816 % A description of each parameter follows:
4817 %
4818 % o wand: the magick wand.
4819 %
4820 */
4822 {
4823  assert(wand != (MagickWand *) NULL);
4824  assert(wand->signature == MagickWandSignature);
4825  if (wand->debug != MagickFalse)
4826  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4827  if (wand->images == (Image *) NULL)
4828  {
4829  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4830  "ContainsNoImages","`%s'",wand->name);
4831  return(0.0);
4832  }
4833  return(wand->images->gamma);
4834 }
4835 
4836 /*
4837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4838 % %
4839 % %
4840 % %
4841 % M a g i c k G e t I m a g e G r a v i t y %
4842 % %
4843 % %
4844 % %
4845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4846 %
4847 % MagickGetImageGravity() gets the image gravity.
4848 %
4849 % The format of the MagickGetImageGravity method is:
4850 %
4851 % GravityType MagickGetImageGravity(MagickWand *wand)
4852 %
4853 % A description of each parameter follows:
4854 %
4855 % o wand: the magick wand.
4856 %
4857 */
4859 {
4860  assert(wand != (MagickWand *) NULL);
4861  assert(wand->signature == MagickWandSignature);
4862  if (wand->debug != MagickFalse)
4863  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4864  if (wand->images == (Image *) NULL)
4865  {
4866  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4867  "ContainsNoImages","`%s'",wand->name);
4868  return(UndefinedGravity);
4869  }
4870  return(wand->images->gravity);
4871 }
4872 
4873 /*
4874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4875 % %
4876 % %
4877 % %
4878 % 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 %
4879 % %
4880 % %
4881 % %
4882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4883 %
4884 % MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4885 %
4886 % The format of the MagickGetImageGreenPrimary method is:
4887 %
4888 % MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4889 % double *y,double *z)
4890 %
4891 % A description of each parameter follows:
4892 %
4893 % o wand: the magick wand.
4894 %
4895 % o x: the chromaticity green primary x-point.
4896 %
4897 % o y: the chromaticity green primary y-point.
4898 %
4899 % o z: the chromaticity green primary z-point.
4900 %
4901 */
4903  double *x,double *y,double *z)
4904 {
4905  assert(wand != (MagickWand *) NULL);
4906  assert(wand->signature == MagickWandSignature);
4907  if (wand->debug != MagickFalse)
4908  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4909  if (wand->images == (Image *) NULL)
4910  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4911  *x=wand->images->chromaticity.green_primary.x;
4912  *y=wand->images->chromaticity.green_primary.y;
4913  *z=wand->images->chromaticity.green_primary.z;
4914  return(MagickTrue);
4915 }
4916 
4917 /*
4918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4919 % %
4920 % %
4921 % %
4922 % M a g i c k G e t I m a g e H e i g h t %
4923 % %
4924 % %
4925 % %
4926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4927 %
4928 % MagickGetImageHeight() returns the image height.
4929 %
4930 % The format of the MagickGetImageHeight method is:
4931 %
4932 % size_t MagickGetImageHeight(MagickWand *wand)
4933 %
4934 % A description of each parameter follows:
4935 %
4936 % o wand: the magick wand.
4937 %
4938 */
4940 {
4941  assert(wand != (MagickWand *) NULL);
4942  assert(wand->signature == MagickWandSignature);
4943  if (wand->debug != MagickFalse)
4944  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4945  if (wand->images == (Image *) NULL)
4946  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4947  return(wand->images->rows);
4948 }
4949 
4950 /*
4951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4952 % %
4953 % %
4954 % %
4955 % M a g i c k G e t I m a g e H i s t o g r a m %
4956 % %
4957 % %
4958 % %
4959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4960 %
4961 % MagickGetImageHistogram() returns the image histogram as an array of
4962 % PixelWand wands.
4963 %
4964 % The format of the MagickGetImageHistogram method is:
4965 %
4966 % PixelWand **MagickGetImageHistogram(MagickWand *wand,
4967 % size_t *number_colors)
4968 %
4969 % A description of each parameter follows:
4970 %
4971 % o wand: the magick wand.
4972 %
4973 % o number_colors: the number of unique colors in the image and the number
4974 % of pixel wands returned.
4975 %
4976 */
4978  size_t *number_colors)
4979 {
4980  PixelInfo
4981  *histogram;
4982 
4983  PixelWand
4984  **pixel_wands;
4985 
4986  register ssize_t
4987  i;
4988 
4989  assert(wand != (MagickWand *) NULL);
4990  assert(wand->signature == MagickWandSignature);
4991  if (wand->debug != MagickFalse)
4992  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4993  if (wand->images == (Image *) NULL)
4994  {
4995  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4996  "ContainsNoImages","`%s'",wand->name);
4997  return((PixelWand **) NULL);
4998  }
4999  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5000  if (histogram == (PixelInfo *) NULL)
5001  return((PixelWand **) NULL);
5002  pixel_wands=NewPixelWands(*number_colors);
5003  for (i=0; i < (ssize_t) *number_colors; i++)
5004  {
5005  PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5006  PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5007  }
5008  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5009  return(pixel_wands);
5010 }
5011 
5012 /*
5013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5014 % %
5015 % %
5016 % %
5017 % 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 %
5018 % %
5019 % %
5020 % %
5021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5022 %
5023 % MagickGetImageInterlaceScheme() gets the image interlace scheme.
5024 %
5025 % The format of the MagickGetImageInterlaceScheme method is:
5026 %
5027 % InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5028 %
5029 % A description of each parameter follows:
5030 %
5031 % o wand: the magick wand.
5032 %
5033 */
5035 {
5036  assert(wand != (MagickWand *) NULL);
5037  assert(wand->signature == MagickWandSignature);
5038  if (wand->debug != MagickFalse)
5039  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5040  if (wand->images == (Image *) NULL)
5041  {
5042  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5043  "ContainsNoImages","`%s'",wand->name);
5044  return(UndefinedInterlace);
5045  }
5046  return(wand->images->interlace);
5047 }
5048 
5049 /*
5050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5051 % %
5052 % %
5053 % %
5054 % 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 %
5055 % %
5056 % %
5057 % %
5058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5059 %
5060 % MagickGetImageInterpolateMethod() returns the interpolation method for the
5061 % sepcified image.
5062 %
5063 % The format of the MagickGetImageInterpolateMethod method is:
5064 %
5065 % PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5066 %
5067 % A description of each parameter follows:
5068 %
5069 % o wand: the magick wand.
5070 %
5071 */
5073  MagickWand *wand)
5074 {
5075  assert(wand != (MagickWand *) NULL);
5076  assert(wand->signature == MagickWandSignature);
5077  if (wand->debug != MagickFalse)
5078  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5079  if (wand->images == (Image *) NULL)
5080  {
5081  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5082  "ContainsNoImages","`%s'",wand->name);
5083  return(UndefinedInterpolatePixel);
5084  }
5085  return(wand->images->interpolate);
5086 }
5087 
5088 /*
5089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5090 % %
5091 % %
5092 % %
5093 % M a g i c k G e t I m a g e I t e r a t i o n s %
5094 % %
5095 % %
5096 % %
5097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5098 %
5099 % MagickGetImageIterations() gets the image iterations.
5100 %
5101 % The format of the MagickGetImageIterations method is:
5102 %
5103 % size_t MagickGetImageIterations(MagickWand *wand)
5104 %
5105 % A description of each parameter follows:
5106 %
5107 % o wand: the magick wand.
5108 %
5109 */
5111 {
5112  assert(wand != (MagickWand *) NULL);
5113  assert(wand->signature == MagickWandSignature);
5114  if (wand->debug != MagickFalse)
5115  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5116  if (wand->images == (Image *) NULL)
5117  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5118  return(wand->images->iterations);
5119 }
5120 
5121 /*
5122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5123 % %
5124 % %
5125 % %
5126 % M a g i c k G e t I m a g e L e n g t h %
5127 % %
5128 % %
5129 % %
5130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5131 %
5132 % MagickGetImageLength() returns the image length in bytes.
5133 %
5134 % The format of the MagickGetImageLength method is:
5135 %
5136 % MagickBooleanType MagickGetImageLength(MagickWand *wand,
5137 % MagickSizeType *length)
5138 %
5139 % A description of each parameter follows:
5140 %
5141 % o wand: the magick wand.
5142 %
5143 % o length: the image length in bytes.
5144 %
5145 */
5147  MagickSizeType *length)
5148 {
5149  assert(wand != (MagickWand *) NULL);
5150  assert(wand->signature == MagickWandSignature);
5151  if (wand->debug != MagickFalse)
5152  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5153  if (wand->images == (Image *) NULL)
5154  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5155  *length=GetBlobSize(wand->images);
5156  return(MagickTrue);
5157 }
5158 
5159 /*
5160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5161 % %
5162 % %
5163 % %
5164 % M a g i c k G e t I m a g e M a t t e C o l o r %
5165 % %
5166 % %
5167 % %
5168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5169 %
5170 % MagickGetImageMatteColor() returns the image matte color.
5171 %
5172 % The format of the MagickGetImageMatteColor method is:
5173 %
5174 % MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5175 % PixelWand *matte_color)
5176 %
5177 % A description of each parameter follows:
5178 %
5179 % o wand: the magick wand.
5180 %
5181 % o matte_color: return the alpha color.
5182 %
5183 */
5185  PixelWand *matte_color)
5186 {
5187  assert(wand != (MagickWand *)NULL);
5188  assert(wand->signature == MagickWandSignature);
5189  if (wand->debug != MagickFalse)
5190  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5191  if (wand->images == (Image *)NULL)
5192  ThrowWandException(WandError, "ContainsNoImages", wand->name);
5193  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5194  return(MagickTrue);
5195 }
5196 
5197 /*
5198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5199 % %
5200 % %
5201 % %
5202 % 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 %
5203 % %
5204 % %
5205 % %
5206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5207 %
5208 % MagickGetImageOrientation() returns the image orientation.
5209 %
5210 % The format of the MagickGetImageOrientation method is:
5211 %
5212 % OrientationType MagickGetImageOrientation(MagickWand *wand)
5213 %
5214 % A description of each parameter follows:
5215 %
5216 % o wand: the magick wand.
5217 %
5218 */
5220 {
5221  assert(wand != (MagickWand *) NULL);
5222  assert(wand->signature == MagickWandSignature);
5223  if (wand->debug != MagickFalse)
5224  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5225  if (wand->images == (Image *) NULL)
5226  {
5227  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5228  "ContainsNoImages","`%s'",wand->name);
5229  return(UndefinedOrientation);
5230  }
5231  return(wand->images->orientation);
5232 }
5233 
5234 /*
5235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5236 % %
5237 % %
5238 % %
5239 % M a g i c k G e t I m a g e P a g e %
5240 % %
5241 % %
5242 % %
5243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5244 %
5245 % MagickGetImagePage() returns the page geometry associated with the image.
5246 %
5247 % The format of the MagickGetImagePage method is:
5248 %
5249 % MagickBooleanType MagickGetImagePage(MagickWand *wand,
5250 % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5251 %
5252 % A description of each parameter follows:
5253 %
5254 % o wand: the magick wand.
5255 %
5256 % o width: the page width.
5257 %
5258 % o height: the page height.
5259 %
5260 % o x: the page x-offset.
5261 %
5262 % o y: the page y-offset.
5263 %
5264 */
5265 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5266  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5267 {
5268  assert(wand != (const MagickWand *) NULL);
5269  assert(wand->signature == MagickWandSignature);
5270  if (wand->debug != MagickFalse)
5271  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5272  if (wand->images == (Image *) NULL)
5273  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5274  *width=wand->images->page.width;
5275  *height=wand->images->page.height;
5276  *x=wand->images->page.x;
5277  *y=wand->images->page.y;
5278  return(MagickTrue);
5279 }
5280 
5281 /*
5282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5283 % %
5284 % %
5285 % %
5286 % M a g i c k G e t I m a g e P i x e l C o l o r %
5287 % %
5288 % %
5289 % %
5290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5291 %
5292 % MagickGetImagePixelColor() returns the color of the specified pixel.
5293 %
5294 % The format of the MagickGetImagePixelColor method is:
5295 %
5296 % MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5297 % const ssize_t x,const ssize_t y,PixelWand *color)
5298 %
5299 % A description of each parameter follows:
5300 %
5301 % o wand: the magick wand.
5302 %
5303 % o x,y: the pixel offset into the image.
5304 %
5305 % o color: Return the colormap color in this wand.
5306 %
5307 */
5309  const ssize_t x,const ssize_t y,PixelWand *color)
5310 {
5311  register const Quantum
5312  *p;
5313 
5314  CacheView
5315  *image_view;
5316 
5317  assert(wand != (MagickWand *) NULL);
5318  assert(wand->signature == MagickWandSignature);
5319  if (wand->debug != MagickFalse)
5320  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5321  if (wand->images == (Image *) NULL)
5322  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5323  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5324  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5325  if (p == (const Quantum *) NULL)
5326  {
5327  image_view=DestroyCacheView(image_view);
5328  return(MagickFalse);
5329  }
5330  PixelSetQuantumPixel(wand->images,p,color);
5331  image_view=DestroyCacheView(image_view);
5332  return(MagickTrue);
5333 }
5334 
5335 /*
5336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5337 % %
5338 % %
5339 % %
5340 % M a g i c k G e t I m a g e R e d P r i m a r y %
5341 % %
5342 % %
5343 % %
5344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5345 %
5346 % MagickGetImageRedPrimary() returns the chromaticy red primary point.
5347 %
5348 % The format of the MagickGetImageRedPrimary method is:
5349 %
5350 % MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5351 % double *y, double *z)
5352 %
5353 % A description of each parameter follows:
5354 %
5355 % o wand: the magick wand.
5356 %
5357 % o x: the chromaticity red primary x-point.
5358 %
5359 % o y: the chromaticity red primary y-point.
5360 %
5361 % o z: the chromaticity red primary z-point.
5362 %
5363 */
5365  double *x,double *y,double *z)
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  *x=wand->images->chromaticity.red_primary.x;
5374  *y=wand->images->chromaticity.red_primary.y;
5375  *z=wand->images->chromaticity.red_primary.z;
5376  return(MagickTrue);
5377 }
5378 
5379 /*
5380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5381 % %
5382 % %
5383 % %
5384 % M a g i c k G e t I m a g e R e g i o n %
5385 % %
5386 % %
5387 % %
5388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5389 %
5390 % MagickGetImageRegion() extracts a region of the image and returns it as a
5391 % a new wand.
5392 %
5393 % The format of the MagickGetImageRegion method is:
5394 %
5395 % MagickWand *MagickGetImageRegion(MagickWand *wand,
5396 % const size_t width,const size_t height,const ssize_t x,
5397 % const ssize_t y)
5398 %
5399 % A description of each parameter follows:
5400 %
5401 % o wand: the magick wand.
5402 %
5403 % o width: the region width.
5404 %
5405 % o height: the region height.
5406 %
5407 % o x: the region x offset.
5408 %
5409 % o y: the region y offset.
5410 %
5411 */
5413  const size_t width,const size_t height,const ssize_t x,
5414  const ssize_t y)
5415 {
5416  Image
5417  *region_image;
5418 
5419  RectangleInfo
5420  region;
5421 
5422  assert(wand != (MagickWand *) NULL);
5423  assert(wand->signature == MagickWandSignature);
5424  if (wand->debug != MagickFalse)
5425  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5426  if (wand->images == (Image *) NULL)
5427  return((MagickWand *) NULL);
5428  region.width=width;
5429  region.height=height;
5430  region.x=x;
5431  region.y=y;
5432  region_image=CropImage(wand->images,&region,wand->exception);
5433  if (region_image == (Image *) NULL)
5434  return((MagickWand *) NULL);
5435  return(CloneMagickWandFromImages(wand,region_image));
5436 }
5437 
5438 /*
5439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5440 % %
5441 % %
5442 % %
5443 % 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 %
5444 % %
5445 % %
5446 % %
5447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5448 %
5449 % MagickGetImageRenderingIntent() gets the image rendering intent.
5450 %
5451 % The format of the MagickGetImageRenderingIntent method is:
5452 %
5453 % RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5454 %
5455 % A description of each parameter follows:
5456 %
5457 % o wand: the magick wand.
5458 %
5459 */
5461 {
5462  assert(wand != (MagickWand *) NULL);
5463  assert(wand->signature == MagickWandSignature);
5464  if (wand->debug != MagickFalse)
5465  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5466  if (wand->images == (Image *) NULL)
5467  {
5468  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5469  "ContainsNoImages","`%s'",wand->name);
5470  return(UndefinedIntent);
5471  }
5472  return((RenderingIntent) wand->images->rendering_intent);
5473 }
5474 
5475 /*
5476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5477 % %
5478 % %
5479 % %
5480 % M a g i c k G e t I m a g e R e s o l u t i o n %
5481 % %
5482 % %
5483 % %
5484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5485 %
5486 % MagickGetImageResolution() gets the image X and Y resolution.
5487 %
5488 % The format of the MagickGetImageResolution method is:
5489 %
5490 % MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5491 % double *y)
5492 %
5493 % A description of each parameter follows:
5494 %
5495 % o wand: the magick wand.
5496 %
5497 % o x: the image x-resolution.
5498 %
5499 % o y: the image y-resolution.
5500 %
5501 */
5503  double *x,double *y)
5504 {
5505  assert(wand != (MagickWand *) NULL);
5506  assert(wand->signature == MagickWandSignature);
5507  if (wand->debug != MagickFalse)
5508  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5509  if (wand->images == (Image *) NULL)
5510  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5511  *x=wand->images->resolution.x;
5512  *y=wand->images->resolution.y;
5513  return(MagickTrue);
5514 }
5515 
5516 /*
5517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5518 % %
5519 % %
5520 % %
5521 % M a g i c k G e t I m a g e S c e n e %
5522 % %
5523 % %
5524 % %
5525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5526 %
5527 % MagickGetImageScene() gets the image scene.
5528 %
5529 % The format of the MagickGetImageScene method is:
5530 %
5531 % size_t MagickGetImageScene(MagickWand *wand)
5532 %
5533 % A description of each parameter follows:
5534 %
5535 % o wand: the magick wand.
5536 %
5537 */
5539 {
5540  assert(wand != (MagickWand *) NULL);
5541  assert(wand->signature == MagickWandSignature);
5542  if (wand->debug != MagickFalse)
5543  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5544  if (wand->images == (Image *) NULL)
5545  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5546  return(wand->images->scene);
5547 }
5548 
5549 /*
5550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5551 % %
5552 % %
5553 % %
5554 % M a g i c k G e t I m a g e S i g n a t u r e %
5555 % %
5556 % %
5557 % %
5558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5559 %
5560 % MagickGetImageSignature() generates an SHA-256 message digest for the image
5561 % pixel stream.
5562 %
5563 % The format of the MagickGetImageSignature method is:
5564 %
5565 % char *MagickGetImageSignature(MagickWand *wand)
5566 %
5567 % A description of each parameter follows:
5568 %
5569 % o wand: the magick wand.
5570 %
5571 */
5573 {
5574  const char
5575  *value;
5576 
5577  MagickBooleanType
5578  status;
5579 
5580  assert(wand != (MagickWand *) NULL);
5581  assert(wand->signature == MagickWandSignature);
5582  if (wand->debug != MagickFalse)
5583  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5584  if (wand->images == (Image *) NULL)
5585  {
5586  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5587  "ContainsNoImages","`%s'",wand->name);
5588  return((char *) NULL);
5589  }
5590  status=SignatureImage(wand->images,wand->exception);
5591  if (status == MagickFalse)
5592  return((char *) NULL);
5593  value=GetImageProperty(wand->images,"signature",wand->exception);
5594  if (value == (const char *) NULL)
5595  return((char *) NULL);
5596  return(AcquireString(value));
5597 }
5598 
5599 /*
5600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601 % %
5602 % %
5603 % %
5604 % 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 %
5605 % %
5606 % %
5607 % %
5608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609 %
5610 % MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5611 %
5612 % The format of the MagickGetImageTicksPerSecond method is:
5613 %
5614 % size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5615 %
5616 % A description of each parameter follows:
5617 %
5618 % o wand: the magick wand.
5619 %
5620 */
5622 {
5623  assert(wand != (MagickWand *) NULL);
5624  assert(wand->signature == MagickWandSignature);
5625  if (wand->debug != MagickFalse)
5626  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5627  if (wand->images == (Image *) NULL)
5628  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5629  return((size_t) wand->images->ticks_per_second);
5630 }
5631 
5632 /*
5633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634 % %
5635 % %
5636 % %
5637 % M a g i c k G e t I m a g e T y p e %
5638 % %
5639 % %
5640 % %
5641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5642 %
5643 % MagickGetImageType() gets the potential image type:
5644 %
5645 % Bilevel Grayscale GrayscaleMatte
5646 % Palette PaletteMatte TrueColor
5647 % TrueColorMatte ColorSeparation ColorSeparationMatte
5648 %
5649 % The format of the MagickGetImageType method is:
5650 %
5651 % ImageType MagickGetImageType(MagickWand *wand)
5652 %
5653 % A description of each parameter follows:
5654 %
5655 % o wand: the magick wand.
5656 %
5657 */
5659 {
5660  assert(wand != (MagickWand *) NULL);
5661  assert(wand->signature == MagickWandSignature);
5662  if (wand->debug != MagickFalse)
5663  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5664  if (wand->images == (Image *) NULL)
5665  {
5666  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5667  "ContainsNoImages","`%s'",wand->name);
5668  return(UndefinedType);
5669  }
5670  return(GetImageType(wand->images));
5671 }
5672 
5673 /*
5674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5675 % %
5676 % %
5677 % %
5678 % M a g i c k G e t I m a g e U n i t s %
5679 % %
5680 % %
5681 % %
5682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5683 %
5684 % MagickGetImageUnits() gets the image units of resolution.
5685 %
5686 % The format of the MagickGetImageUnits method is:
5687 %
5688 % ResolutionType MagickGetImageUnits(MagickWand *wand)
5689 %
5690 % A description of each parameter follows:
5691 %
5692 % o wand: the magick wand.
5693 %
5694 */
5696 {
5697  assert(wand != (MagickWand *) NULL);
5698  assert(wand->signature == MagickWandSignature);
5699  if (wand->debug != MagickFalse)
5700  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5701  if (wand->images == (Image *) NULL)
5702  {
5703  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5704  "ContainsNoImages","`%s'",wand->name);
5705  return(UndefinedResolution);
5706  }
5707  return(wand->images->units);
5708 }
5709 
5710 /*
5711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5712 % %
5713 % %
5714 % %
5715 % 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 %
5716 % %
5717 % %
5718 % %
5719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5720 %
5721 % MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5722 % sepcified image.
5723 %
5724 % The format of the MagickGetImageVirtualPixelMethod method is:
5725 %
5726 % VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5727 %
5728 % A description of each parameter follows:
5729 %
5730 % o wand: the magick wand.
5731 %
5732 */
5734 {
5735  assert(wand != (MagickWand *) NULL);
5736  assert(wand->signature == MagickWandSignature);
5737  if (wand->debug != MagickFalse)
5738  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5739  if (wand->images == (Image *) NULL)
5740  {
5741  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5742  "ContainsNoImages","`%s'",wand->name);
5743  return(UndefinedVirtualPixelMethod);
5744  }
5745  return(GetImageVirtualPixelMethod(wand->images));
5746 }
5747 
5748 /*
5749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5750 % %
5751 % %
5752 % %
5753 % M a g i c k G e t I m a g e W h i t e P o i n t %
5754 % %
5755 % %
5756 % %
5757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5758 %
5759 % MagickGetImageWhitePoint() returns the chromaticy white point.
5760 %
5761 % The format of the MagickGetImageWhitePoint method is:
5762 %
5763 % MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5764 % double *y,double *z)
5765 %
5766 % A description of each parameter follows:
5767 %
5768 % o wand: the magick wand.
5769 %
5770 % o x: the chromaticity white x-point.
5771 %
5772 % o y: the chromaticity white y-point.
5773 %
5774 % o z: the chromaticity white z-point.
5775 %
5776 */
5778  double *x,double *y,double *z)
5779 {
5780  assert(wand != (MagickWand *) NULL);
5781  assert(wand->signature == MagickWandSignature);
5782  if (wand->debug != MagickFalse)
5783  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5784  if (wand->images == (Image *) NULL)
5785  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5786  *x=wand->images->chromaticity.white_point.x;
5787  *y=wand->images->chromaticity.white_point.y;
5788  *z=wand->images->chromaticity.white_point.z;
5789  return(MagickTrue);
5790 }
5791 
5792 /*
5793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5794 % %
5795 % %
5796 % %
5797 % M a g i c k G e t I m a g e W i d t h %
5798 % %
5799 % %
5800 % %
5801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5802 %
5803 % MagickGetImageWidth() returns the image width.
5804 %
5805 % The format of the MagickGetImageWidth method is:
5806 %
5807 % size_t MagickGetImageWidth(MagickWand *wand)
5808 %
5809 % A description of each parameter follows:
5810 %
5811 % o wand: the magick wand.
5812 %
5813 */
5815 {
5816  assert(wand != (MagickWand *) NULL);
5817  assert(wand->signature == MagickWandSignature);
5818  if (wand->debug != MagickFalse)
5819  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5820  if (wand->images == (Image *) NULL)
5821  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5822  return(wand->images->columns);
5823 }
5824 
5825 /*
5826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5827 % %
5828 % %
5829 % %
5830 % M a g i c k G e t N u m b e r I m a g e s %
5831 % %
5832 % %
5833 % %
5834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5835 %
5836 % MagickGetNumberImages() returns the number of images associated with a
5837 % magick wand.
5838 %
5839 % The format of the MagickGetNumberImages method is:
5840 %
5841 % size_t MagickGetNumberImages(MagickWand *wand)
5842 %
5843 % A description of each parameter follows:
5844 %
5845 % o wand: the magick wand.
5846 %
5847 */
5849 {
5850  assert(wand != (MagickWand *) NULL);
5851  assert(wand->signature == MagickWandSignature);
5852  if (wand->debug != MagickFalse)
5853  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5854  return(GetImageListLength(wand->images));
5855 }
5856 
5857 /*
5858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5859 % %
5860 % %
5861 % %
5862 % 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 %
5863 % %
5864 % %
5865 % %
5866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5867 %
5868 % MagickGetImageTotalInkDensity() gets the image total ink density.
5869 %
5870 % The format of the MagickGetImageTotalInkDensity method is:
5871 %
5872 % double MagickGetImageTotalInkDensity(MagickWand *wand)
5873 %
5874 % A description of each parameter follows:
5875 %
5876 % o wand: the magick wand.
5877 %
5878 */
5880 {
5881  assert(wand != (MagickWand *) NULL);
5882  assert(wand->signature == MagickWandSignature);
5883  if (wand->debug != MagickFalse)
5884  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5885  if (wand->images == (Image *) NULL)
5886  {
5887  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5888  "ContainsNoImages","`%s'",wand->name);
5889  return(0.0);
5890  }
5891  return(GetImageTotalInkDensity(wand->images,wand->exception));
5892 }
5893 
5894 /*
5895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5896 % %
5897 % %
5898 % %
5899 % M a g i c k H a l d C l u t I m a g e %
5900 % %
5901 % %
5902 % %
5903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5904 %
5905 % MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5906 % table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
5907 % dimensions. Create it with the HALD coder. You can apply any color
5908 % transformation to the Hald image and then use this method to apply the
5909 % transform to the image.
5910 %
5911 % The format of the MagickHaldClutImage method is:
5912 %
5913 % MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5914 % const MagickWand *hald_wand)
5915 %
5916 % A description of each parameter follows:
5917 %
5918 % o wand: the magick wand.
5919 %
5920 % o hald_image: the hald CLUT image.
5921 %
5922 */
5924  const MagickWand *hald_wand)
5925 {
5926  MagickBooleanType
5927  status;
5928 
5929  assert(wand != (MagickWand *) NULL);
5930  assert(wand->signature == MagickWandSignature);
5931  if (wand->debug != MagickFalse)
5932  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5933  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5934  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5935  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5936  return(status);
5937 }
5938 
5939 /*
5940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5941 % %
5942 % %
5943 % %
5944 % M a g i c k H a s N e x t I m a g e %
5945 % %
5946 % %
5947 % %
5948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5949 %
5950 % MagickHasNextImage() returns MagickTrue if the wand has more images when
5951 % traversing the list in the forward direction
5952 %
5953 % The format of the MagickHasNextImage method is:
5954 %
5955 % MagickBooleanType MagickHasNextImage(MagickWand *wand)
5956 %
5957 % A description of each parameter follows:
5958 %
5959 % o wand: the magick wand.
5960 %
5961 */
5962 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5963 {
5964  assert(wand != (MagickWand *) NULL);
5965  assert(wand->