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