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