MagickWand  7.1.0
Convert, Edit, Or Compose Bitmap Images
magick-image.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % M M AAA GGGG IIIII CCCC K K %
7 % MM MM A A G I C K K %
8 % M M M AAAAA G GGG I C KKK %
9 % M M A A G G I C K K %
10 % M M A A GGGG IIIII CCCC K K %
11 % %
12 % IIIII M M AAA GGGG EEEEE %
13 % I MM MM A A G E %
14 % I M M M AAAAA G GG EEE %
15 % I M M A A G G E %
16 % IIIII M M A A GGGG EEEEE %
17 % %
18 % %
19 % MagickWand Image Methods %
20 % %
21 % Software Design %
22 % Cristy %
23 % August 2003 %
24 % %
25 % %
26 % Copyright @ 2003 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"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.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 */
87 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
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 */
135 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
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 */
183 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
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 */
228 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
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 */
280 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
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 */
331 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
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 */
529 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
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 */
696 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
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 */
737 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
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 */
775 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
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 */
813 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
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 */
860 WandExport MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
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 */
918 WandExport MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
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 */
966 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
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 */
1011 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
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 */
1171 WandExport MagickBooleanType MagickBrightnessContrastImage(
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 */
1221 WandExport MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
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 */
1279 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
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 */
1325 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
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"). Although
1434 % parameter is currently a double, it is cast to size_t internally.
1435 %
1436 % o clip_limit: contrast limit for localised changes in contrast. A limit
1437 % less than 1 results in standard non-contrast limited AHE.
1438 %
1439 */
1440 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand,
1441  const size_t width,const size_t height,const double number_bins,
1442  const double clip_limit)
1443 {
1444  MagickBooleanType
1445  status;
1446 
1447  assert(wand != (MagickWand *) NULL);
1448  assert(wand->signature == MagickWandSignature);
1449  if (wand->debug != MagickFalse)
1450  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1451  if (wand->images == (Image *) NULL)
1452  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1453  status=CLAHEImage(wand->images,width,height,(size_t) number_bins,clip_limit,
1454  wand->exception);
1455  return(status);
1456 }
1457 ␌
1458 /*
1459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1460 % %
1461 % %
1462 % %
1463 % M a g i c k C l a m p I m a g e %
1464 % %
1465 % %
1466 % %
1467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1468 %
1469 % MagickClampImage() restricts the color range from 0 to the quantum depth.
1470 %
1471 % The format of the MagickClampImage method is:
1472 %
1473 % MagickBooleanType MagickClampImage(MagickWand *wand)
1474 %
1475 % A description of each parameter follows:
1476 %
1477 % o wand: the magick wand.
1478 %
1479 % o channel: the channel.
1480 %
1481 */
1482 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1483 {
1484  assert(wand != (MagickWand *) NULL);
1485  assert(wand->signature == MagickWandSignature);
1486  if (wand->debug != MagickFalse)
1487  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1488  if (wand->images == (Image *) NULL)
1489  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1490  return(ClampImage(wand->images,wand->exception));
1491 }
1492 ␌
1493 /*
1494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1495 % %
1496 % %
1497 % %
1498 % M a g i c k C l i p I m a g e %
1499 % %
1500 % %
1501 % %
1502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1503 %
1504 % MagickClipImage() clips along the first path from the 8BIM profile, if
1505 % present.
1506 %
1507 % The format of the MagickClipImage method is:
1508 %
1509 % MagickBooleanType MagickClipImage(MagickWand *wand)
1510 %
1511 % A description of each parameter follows:
1512 %
1513 % o wand: the magick wand.
1514 %
1515 */
1516 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1517 {
1518  MagickBooleanType
1519  status;
1520 
1521  assert(wand != (MagickWand *) NULL);
1522  assert(wand->signature == MagickWandSignature);
1523  if (wand->debug != MagickFalse)
1524  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1525  if (wand->images == (Image *) NULL)
1526  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1527  status=ClipImage(wand->images,wand->exception);
1528  return(status);
1529 }
1530 ␌
1531 /*
1532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1533 % %
1534 % %
1535 % %
1536 % M a g i c k C l i p I m a g e P a t h %
1537 % %
1538 % %
1539 % %
1540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1541 %
1542 % MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1543 % present. Later operations take effect inside the path. Id may be a number
1544 % if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1545 % path.
1546 %
1547 % The format of the MagickClipImagePath method is:
1548 %
1549 % MagickBooleanType MagickClipImagePath(MagickWand *wand,
1550 % const char *pathname,const MagickBooleanType inside)
1551 %
1552 % A description of each parameter follows:
1553 %
1554 % o wand: the magick wand.
1555 %
1556 % o pathname: name of clipping path resource. If name is preceded by #, use
1557 % clipping path numbered by name.
1558 %
1559 % o inside: if non-zero, later operations take effect inside clipping path.
1560 % Otherwise later operations take effect outside clipping path.
1561 %
1562 */
1563 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1564  const char *pathname,const MagickBooleanType inside)
1565 {
1566  MagickBooleanType
1567  status;
1568 
1569  assert(wand != (MagickWand *) NULL);
1570  assert(wand->signature == MagickWandSignature);
1571  if (wand->debug != MagickFalse)
1572  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1573  if (wand->images == (Image *) NULL)
1574  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1575  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1576  return(status);
1577 }
1578 ␌
1579 /*
1580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1581 % %
1582 % %
1583 % %
1584 % M a g i c k C l u t I m a g e %
1585 % %
1586 % %
1587 % %
1588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1589 %
1590 % MagickClutImage() replaces colors in the image from a color lookup table.
1591 %
1592 % The format of the MagickClutImage method is:
1593 %
1594 % MagickBooleanType MagickClutImage(MagickWand *wand,
1595 % const MagickWand *clut_wand,const PixelInterpolateMethod method)
1596 %
1597 % A description of each parameter follows:
1598 %
1599 % o wand: the magick wand.
1600 %
1601 % o clut_image: the clut image.
1602 %
1603 % o method: the pixel interpolation method.
1604 %
1605 */
1606 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1607  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1608 {
1609  MagickBooleanType
1610  status;
1611 
1612  assert(wand != (MagickWand *) NULL);
1613  assert(wand->signature == MagickWandSignature);
1614  if (wand->debug != MagickFalse)
1615  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1616  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1617  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1618  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1619  return(status);
1620 }
1621 ␌
1622 /*
1623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1624 % %
1625 % %
1626 % %
1627 % M a g i c k C o a l e s c e I m a g e s %
1628 % %
1629 % %
1630 % %
1631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1632 %
1633 % MagickCoalesceImages() composites a set of images while respecting any page
1634 % offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1635 % typically start with an image background and each subsequent image
1636 % varies in size and offset. MagickCoalesceImages() returns a new sequence
1637 % where each image in the sequence is the same size as the first and
1638 % composited with the next image in the sequence.
1639 %
1640 % The format of the MagickCoalesceImages method is:
1641 %
1642 % MagickWand *MagickCoalesceImages(MagickWand *wand)
1643 %
1644 % A description of each parameter follows:
1645 %
1646 % o wand: the magick wand.
1647 %
1648 */
1649 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1650 {
1651  Image
1652  *coalesce_image;
1653 
1654  assert(wand != (MagickWand *) NULL);
1655  assert(wand->signature == MagickWandSignature);
1656  if (wand->debug != MagickFalse)
1657  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1658  if (wand->images == (Image *) NULL)
1659  return((MagickWand *) NULL);
1660  coalesce_image=CoalesceImages(wand->images,wand->exception);
1661  if (coalesce_image == (Image *) NULL)
1662  return((MagickWand *) NULL);
1663  return(CloneMagickWandFromImages(wand,coalesce_image));
1664 }
1665 ␌
1666 /*
1667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1668 % %
1669 % %
1670 % %
1671 % M a g i c k C o l o r D e c i s i o n I m a g e %
1672 % %
1673 % %
1674 % %
1675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1676 %
1677 % MagickColorDecisionListImage() accepts a lightweight Color Correction
1678 % Collection (CCC) file which solely contains one or more color corrections
1679 % and applies the color correction to the image. Here is a sample CCC file:
1680 %
1681 % <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1682 % <ColorCorrection id="cc03345">
1683 % <SOPNode>
1684 % <Slope> 0.9 1.2 0.5 </Slope>
1685 % <Offset> 0.4 -0.5 0.6 </Offset>
1686 % <Power> 1.0 0.8 1.5 </Power>
1687 % </SOPNode>
1688 % <SATNode>
1689 % <Saturation> 0.85 </Saturation>
1690 % </SATNode>
1691 % </ColorCorrection>
1692 % </ColorCorrectionCollection>
1693 %
1694 % which includes the offset, slope, and power for each of the RGB channels
1695 % as well as the saturation.
1696 %
1697 % The format of the MagickColorDecisionListImage method is:
1698 %
1699 % MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1700 % const char *color_correction_collection)
1701 %
1702 % A description of each parameter follows:
1703 %
1704 % o wand: the magick wand.
1705 %
1706 % o color_correction_collection: the color correction collection in XML.
1707 %
1708 */
1709 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1710  const char *color_correction_collection)
1711 {
1712  MagickBooleanType
1713  status;
1714 
1715  assert(wand != (MagickWand *) NULL);
1716  assert(wand->signature == MagickWandSignature);
1717  if (wand->debug != MagickFalse)
1718  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1719  if (wand->images == (Image *) NULL)
1720  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1721  status=ColorDecisionListImage(wand->images,color_correction_collection,
1722  wand->exception);
1723  return(status);
1724 }
1725 ␌
1726 /*
1727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1728 % %
1729 % %
1730 % %
1731 % M a g i c k C o l o r i z e I m a g e %
1732 % %
1733 % %
1734 % %
1735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1736 %
1737 % MagickColorizeImage() blends the fill color with each pixel in the image.
1738 %
1739 % The format of the MagickColorizeImage method is:
1740 %
1741 % MagickBooleanType MagickColorizeImage(MagickWand *wand,
1742 % const PixelWand *colorize,const PixelWand *blend)
1743 %
1744 % A description of each parameter follows:
1745 %
1746 % o wand: the magick wand.
1747 %
1748 % o colorize: the colorize pixel wand.
1749 %
1750 % o alpha: the alpha pixel wand.
1751 %
1752 */
1753 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1754  const PixelWand *colorize,const PixelWand *blend)
1755 {
1756  char
1757  percent_blend[MagickPathExtent];
1758 
1759  Image
1760  *colorize_image;
1761 
1762  PixelInfo
1763  target;
1764 
1765  assert(wand != (MagickWand *) NULL);
1766  assert(wand->signature == MagickWandSignature);
1767  if (wand->debug != MagickFalse)
1768  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1769  if (wand->images == (Image *) NULL)
1770  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1771  GetPixelInfo(wand->images,&target);
1772  if (target.colorspace != CMYKColorspace)
1773  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1774  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1775  PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1776  PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1777  PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1778  PixelGetAlphaQuantum(blend)));
1779  else
1780  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1781  "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1782  PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1783  PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1784  PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1785  PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1786  PixelGetAlphaQuantum(blend)));
1787  target=PixelGetPixel(colorize);
1788  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1789  wand->exception);
1790  if (colorize_image == (Image *) NULL)
1791  return(MagickFalse);
1792  ReplaceImageInList(&wand->images,colorize_image);
1793  return(MagickTrue);
1794 }
1795 ␌
1796 /*
1797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1798 % %
1799 % %
1800 % %
1801 % M a g i c k C o l o r M a t r i x I m a g e %
1802 % %
1803 % %
1804 % %
1805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1806 %
1807 % MagickColorMatrixImage() apply color transformation to an image. The method
1808 % permits saturation changes, hue rotation, luminance to alpha, and various
1809 % other effects. Although variable-sized transformation matrices can be used,
1810 % typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1811 % (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1812 % except offsets are in column 6 rather than 5 (in support of CMYKA images)
1813 % and offsets are normalized (divide Flash offset by 255).
1814 %
1815 % The format of the MagickColorMatrixImage method is:
1816 %
1817 % MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1818 % const KernelInfo *color_matrix)
1819 %
1820 % A description of each parameter follows:
1821 %
1822 % o wand: the magick wand.
1823 %
1824 % o color_matrix: the color matrix.
1825 %
1826 */
1827 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1828  const KernelInfo *color_matrix)
1829 {
1830  Image
1831  *color_image;
1832 
1833  assert(wand != (MagickWand *) NULL);
1834  assert(wand->signature == MagickWandSignature);
1835  if (wand->debug != MagickFalse)
1836  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1837  if (color_matrix == (const KernelInfo *) NULL)
1838  return(MagickFalse);
1839  if (wand->images == (Image *) NULL)
1840  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1841  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1842  if (color_image == (Image *) NULL)
1843  return(MagickFalse);
1844  ReplaceImageInList(&wand->images,color_image);
1845  return(MagickTrue);
1846 }
1847 ␌
1848 /*
1849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1850 % %
1851 % %
1852 % %
1853 % 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 %
1854 % %
1855 % %
1856 % %
1857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1858 %
1859 % MagickColorThresholdImage() forces all pixels in the color range to white
1860 % otherwise black.
1861 %
1862 % The format of the MagickColorThresholdImage method is:
1863 %
1864 % MagickBooleanType MagickColorThresholdImage(MagickWand *wand,
1865 % const PixelWand *start_color,const PixelWand *stop_color)
1866 %
1867 % A description of each parameter follows:
1868 %
1869 % o wand: the magick wand.
1870 %
1871 % o start_color: the start color pixel wand.
1872 %
1873 % o stop_color: the stop color pixel wand.
1874 %
1875 */
1876 WandExport MagickBooleanType MagickColorThresholdImage(MagickWand *wand,
1877  const PixelWand *start_color,const PixelWand *stop_color)
1878 {
1879  PixelInfo
1880  start,
1881  stop;
1882 
1883  assert(wand != (MagickWand *) NULL);
1884  assert(wand->signature == MagickWandSignature);
1885  if (wand->debug != MagickFalse)
1886  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1887  if (wand->images == (Image *) NULL)
1888  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1889  PixelGetMagickColor(start_color,&start);
1890  PixelGetMagickColor(stop_color,&stop);
1891  return(ColorThresholdImage(wand->images,&start,&stop,wand->exception));
1892 }
1893 ␌
1894 /*
1895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1896 % %
1897 % %
1898 % %
1899 % M a g i c k C o m b i n e I m a g e s %
1900 % %
1901 % %
1902 % %
1903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1904 %
1905 % MagickCombineImages() combines one or more images into a single image. The
1906 % grayscale value of the pixels of each image in the sequence is assigned in
1907 % order to the specified hannels of the combined image. The typical
1908 % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1909 %
1910 % The format of the MagickCombineImages method is:
1911 %
1912 % MagickWand *MagickCombineImages(MagickWand *wand,
1913 % const ColorspaceType colorspace)
1914 %
1915 % A description of each parameter follows:
1916 %
1917 % o wand: the magick wand.
1918 %
1919 % o colorspace: the colorspace.
1920 %
1921 */
1922 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1923  const ColorspaceType colorspace)
1924 {
1925  Image
1926  *combine_image;
1927 
1928  assert(wand != (MagickWand *) NULL);
1929  assert(wand->signature == MagickWandSignature);
1930  if (wand->debug != MagickFalse)
1931  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1932  if (wand->images == (Image *) NULL)
1933  return((MagickWand *) NULL);
1934  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1935  if (combine_image == (Image *) NULL)
1936  return((MagickWand *) NULL);
1937  return(CloneMagickWandFromImages(wand,combine_image));
1938 }
1939 ␌
1940 /*
1941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1942 % %
1943 % %
1944 % %
1945 % M a g i c k C o m m e n t I m a g e %
1946 % %
1947 % %
1948 % %
1949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1950 %
1951 % MagickCommentImage() adds a comment to your image.
1952 %
1953 % The format of the MagickCommentImage method is:
1954 %
1955 % MagickBooleanType MagickCommentImage(MagickWand *wand,
1956 % const char *comment)
1957 %
1958 % A description of each parameter follows:
1959 %
1960 % o wand: the magick wand.
1961 %
1962 % o comment: the image comment.
1963 %
1964 */
1965 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1966  const char *comment)
1967 {
1968  MagickBooleanType
1969  status;
1970 
1971  assert(wand != (MagickWand *) NULL);
1972  assert(wand->signature == MagickWandSignature);
1973  if (wand->debug != MagickFalse)
1974  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1975  if (wand->images == (Image *) NULL)
1976  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1977  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1978  return(status);
1979 }
1980 ␌
1981 /*
1982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1983 % %
1984 % %
1985 % %
1986 % M a g i c k C o m p a r e I m a g e L a y e r s %
1987 % %
1988 % %
1989 % %
1990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1991 %
1992 % MagickCompareImagesLayers() compares each image with the next in a sequence
1993 % and returns the maximum bounding region of any pixel differences it
1994 % discovers.
1995 %
1996 % The format of the MagickCompareImagesLayers method is:
1997 %
1998 % MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1999 % const LayerMethod method)
2000 %
2001 % A description of each parameter follows:
2002 %
2003 % o wand: the magick wand.
2004 %
2005 % o method: the compare method.
2006 %
2007 */
2008 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
2009  const LayerMethod method)
2010 {
2011  Image
2012  *layers_image;
2013 
2014  assert(wand != (MagickWand *) NULL);
2015  assert(wand->signature == MagickWandSignature);
2016  if (wand->debug != MagickFalse)
2017  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2018  if (wand->images == (Image *) NULL)
2019  return((MagickWand *) NULL);
2020  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
2021  if (layers_image == (Image *) NULL)
2022  return((MagickWand *) NULL);
2023  return(CloneMagickWandFromImages(wand,layers_image));
2024 }
2025 ␌
2026 /*
2027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2028 % %
2029 % %
2030 % %
2031 % M a g i c k C o m p a r e I m a g e s %
2032 % %
2033 % %
2034 % %
2035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2036 %
2037 % MagickCompareImages() compares an image to a reconstructed image and returns
2038 % the specified difference image.
2039 %
2040 % The format of the MagickCompareImages method is:
2041 %
2042 % MagickWand *MagickCompareImages(MagickWand *wand,
2043 % const MagickWand *reference,const MetricType metric,
2044 % double *distortion)
2045 %
2046 % A description of each parameter follows:
2047 %
2048 % o wand: the magick wand.
2049 %
2050 % o reference: the reference wand.
2051 %
2052 % o metric: the metric.
2053 %
2054 % o distortion: the computed distortion between the images.
2055 %
2056 */
2057 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
2058  const MagickWand *reference,const MetricType metric,double *distortion)
2059 {
2060  Image
2061  *compare_image;
2062 
2063 
2064  assert(wand != (MagickWand *) NULL);
2065  assert(wand->signature == MagickWandSignature);
2066  if (wand->debug != MagickFalse)
2067  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2068  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
2069  {
2070  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
2071  "ContainsNoImages","`%s'",wand->name);
2072  return((MagickWand *) NULL);
2073  }
2074  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
2075  wand->exception);
2076  if (compare_image == (Image *) NULL)
2077  return((MagickWand *) NULL);
2078  return(CloneMagickWandFromImages(wand,compare_image));
2079 }
2080 ␌
2081 /*
2082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2083 % %
2084 % %
2085 % %
2086 % M a g i c k C o m p l e x I m a g e s %
2087 % %
2088 % %
2089 % %
2090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2091 %
2092 % MagickComplexImages() performs complex mathematics on an image sequence.
2093 %
2094 % The format of the MagickComplexImages method is:
2095 %
2096 % MagickWand *MagickComplexImages(MagickWand *wand,
2097 % const ComplexOperator op)
2098 %
2099 % A description of each parameter follows:
2100 %
2101 % o wand: the magick wand.
2102 %
2103 % o op: A complex operator. Choose from AddComplexOperator,
2104 % ConjugateComplexOperator,DivideComplexOperator,
2105 % MagnitudePhaseComplexOperator,MultiplyComplexOperator,
2106 % RealImaginaryComplexOperator, SubtractComplexOperator.
2107 %
2108 */
2109 WandExport MagickWand *MagickComplexImages(MagickWand *wand,
2110  const ComplexOperator op)
2111 {
2112  Image
2113  *complex_image;
2114 
2115  assert(wand != (MagickWand *) NULL);
2116  assert(wand->signature == MagickWandSignature);
2117  if (wand->debug != MagickFalse)
2118  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2119  if (wand->images == (Image *) NULL)
2120  return((MagickWand *) NULL);
2121  complex_image=ComplexImages(wand->images,op,wand->exception);
2122  if (complex_image == (Image *) NULL)
2123  return((MagickWand *) NULL);
2124  return(CloneMagickWandFromImages(wand,complex_image));
2125 }
2126 ␌
2127 /*
2128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2129 % %
2130 % %
2131 % %
2132 % M a g i c k C o m p o s i t e I m a g e %
2133 % %
2134 % %
2135 % %
2136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2137 %
2138 % MagickCompositeImage() composite one image onto another at the specified
2139 % offset.
2140 %
2141 % The format of the MagickCompositeImage method is:
2142 %
2143 % MagickBooleanType MagickCompositeImage(MagickWand *wand,
2144 % const MagickWand *source_wand,const CompositeOperator compose,
2145 % const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2146 %
2147 % A description of each parameter follows:
2148 %
2149 % o wand: the magick wand holding the destination images
2150 %
2151 % o source_image: the magick wand holding source image.
2152 %
2153 % o compose: This operator affects how the composite is applied to the
2154 % image. The default is Over. These are some of the compose methods
2155 % availble.
2156 %
2157 % OverCompositeOp InCompositeOp OutCompositeOp
2158 % AtopCompositeOp XorCompositeOp PlusCompositeOp
2159 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
2160 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
2161 % DisplaceCompositeOp
2162 %
2163 % o clip_to_self: set to MagickTrue to limit composition to area composed.
2164 %
2165 % o x: the column offset of the composited image.
2166 %
2167 % o y: the row offset of the composited image.
2168 %
2169 */
2170 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
2171  const MagickWand *source_wand,const CompositeOperator compose,
2172  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2173 {
2174  MagickBooleanType
2175  status;
2176 
2177  assert(wand != (MagickWand *) NULL);
2178  assert(wand->signature == MagickWandSignature);
2179  if (wand->debug != MagickFalse)
2180  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2181  if ((wand->images == (Image *) NULL) ||
2182  (source_wand->images == (Image *) NULL))
2183  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2184  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
2185  x,y,wand->exception);
2186  return(status);
2187 }
2188 ␌
2189 /*
2190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2191 % %
2192 % %
2193 % %
2194 % 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 %
2195 % %
2196 % %
2197 % %
2198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2199 %
2200 % MagickCompositeImageGravity() composite one image onto another using the
2201 % specified gravity.
2202 %
2203 % The format of the MagickCompositeImageGravity method is:
2204 %
2205 % MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2206 % const MagickWand *source_wand,const CompositeOperator compose,
2207 % const GravityType gravity)
2208 %
2209 % A description of each parameter follows:
2210 %
2211 % o wand: the magick wand holding the destination images
2212 %
2213 % o source_image: the magick wand holding source image.
2214 %
2215 % o compose: This operator affects how the composite is applied to the
2216 % image. The default is Over. These are some of the compose methods
2217 % availble.
2218 %
2219 % OverCompositeOp InCompositeOp OutCompositeOp
2220 % AtopCompositeOp XorCompositeOp PlusCompositeOp
2221 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
2222 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
2223 % DisplaceCompositeOp
2224 %
2225 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
2226 % NorthEastGravity, WestGravity, CenterGravity,
2227 % EastGravity, SouthWestGravity, SouthGravity,
2228 % SouthEastGravity)
2229 %
2230 */
2231 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2232  const MagickWand *source_wand,const CompositeOperator compose,
2233  const GravityType gravity)
2234 {
2235  MagickBooleanType
2236  status;
2237 
2238  RectangleInfo
2239  geometry;
2240 
2241  assert(wand != (MagickWand *) NULL);
2242  assert(wand->signature == MagickWandSignature);
2243  if (wand->debug != MagickFalse)
2244  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2245  if ((wand->images == (Image *) NULL) ||
2246  (source_wand->images == (Image *) NULL))
2247  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2248  SetGeometry(source_wand->images,&geometry);
2249  GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
2250  &geometry);
2251  status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
2252  geometry.x,geometry.y,wand->exception);
2253  return(status);
2254 }
2255 ␌
2256 /*
2257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2258 % %
2259 % %
2260 % %
2261 % M a g i c k C o m p o s i t e L a y e r s %
2262 % %
2263 % %
2264 % %
2265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2266 %
2267 % MagickCompositeLayers() composite the images in the source wand over the
2268 % images in the destination wand in sequence, starting with the current
2269 % image in both lists.
2270 %
2271 % Each layer from the two image lists are composted together until the end of
2272 % one of the image lists is reached. The offset of each composition is also
2273 % adjusted to match the virtual canvas offsets of each layer. As such the
2274 % given offset is relative to the virtual canvas, and not the actual image.
2275 %
2276 % Composition uses given x and y offsets, as the 'origin' location of the
2277 % source images virtual canvas (not the real image) allowing you to compose a
2278 % list of 'layer images' into the destiantioni images. This makes it well
2279 % sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
2280 % Animations' onto a static or other 'Coaleased Animation' destination image
2281 % list. GIF disposal handling is not looked at.
2282 %
2283 % Special case:- If one of the image sequences is the last image (just a
2284 % single image remaining), that image is repeatally composed with all the
2285 % images in the other image list. Either the source or destination lists may
2286 % be the single image, for this situation.
2287 %
2288 % In the case of a single destination image (or last image given), that image
2289 % will ve cloned to match the number of images remaining in the source image
2290 % list.
2291 %
2292 % This is equivelent to the "-layer Composite" Shell API operator.
2293 %
2294 % The format of the MagickCompositeLayers method is:
2295 %
2296 % MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2297 % const MagickWand *source_wand, const CompositeOperator compose,
2298 % const ssize_t x,const ssize_t y)
2299 %
2300 % A description of each parameter follows:
2301 %
2302 % o wand: the magick wand holding destaintion images
2303 %
2304 % o source_wand: the wand holding the source images
2305 %
2306 % o compose, x, y: composition arguments
2307 %
2308 */
2309 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2310  const MagickWand *source_wand,const CompositeOperator compose,
2311  const ssize_t x,const ssize_t y)
2312 {
2313  MagickBooleanType
2314  status;
2315 
2316  assert(wand != (MagickWand *) NULL);
2317  assert(wand->signature == MagickWandSignature);
2318  if (wand->debug != MagickFalse)
2319  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2320  if ((wand->images == (Image *) NULL) ||
2321  (source_wand->images == (Image *) NULL))
2322  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2323  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2324  status=MagickTrue; /* FUTURE: determine status from exceptions */
2325  return(status);
2326 }
2327 ␌
2328 /*
2329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2330 % %
2331 % %
2332 % %
2333 % 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 %
2334 % %
2335 % %
2336 % %
2337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338 %
2339 % MagickConnectedComponentsImage() returns the connected-components of the
2340 % image uniquely labeled. The returned connected components image colors
2341 % member defines the number of unique objects. Choose from 4 or 8-way
2342 % connectivity.
2343 %
2344 % The format of the MagickConnectedComponentsImage method is:
2345 %
2346 % MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2347 % const size_t connectivity,CCObjectInfo **objects)
2348 %
2349 % A description of each parameter follows:
2350 %
2351 % o wand: the magick wand.
2352 %
2353 % o connectivity: how many neighbors to visit, choose from 4 or 8.
2354 %
2355 % o objects: return the attributes of each unique object.
2356 %
2357 */
2358 WandExport MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2359  const size_t connectivity,CCObjectInfo **objects)
2360 {
2361  Image
2362  *connected_components_image;
2363 
2364  assert(wand != (MagickWand *) NULL);
2365  assert(wand->signature == MagickWandSignature);
2366  if (wand->debug != MagickFalse)
2367  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2368  if (wand->images == (Image *) NULL)
2369  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2370  connected_components_image=ConnectedComponentsImage(wand->images,connectivity,
2371  objects,wand->exception);
2372  if (connected_components_image == (Image *) NULL)
2373  return(MagickFalse);
2374  ReplaceImageInList(&wand->images,connected_components_image);
2375  return(MagickTrue);
2376 }
2377 ␌
2378 /*
2379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2380 % %
2381 % %
2382 % %
2383 % M a g i c k C o n t r a s t I m a g e %
2384 % %
2385 % %
2386 % %
2387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2388 %
2389 % MagickContrastImage() enhances the intensity differences between the lighter
2390 % and darker elements of the image. Set sharpen to a value other than 0 to
2391 % increase the image contrast otherwise the contrast is reduced.
2392 %
2393 % The format of the MagickContrastImage method is:
2394 %
2395 % MagickBooleanType MagickContrastImage(MagickWand *wand,
2396 % const MagickBooleanType sharpen)
2397 %
2398 % A description of each parameter follows:
2399 %
2400 % o wand: the magick wand.
2401 %
2402 % o sharpen: Increase or decrease image contrast.
2403 %
2404 %
2405 */
2406 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2407  const MagickBooleanType sharpen)
2408 {
2409  MagickBooleanType
2410  status;
2411 
2412  assert(wand != (MagickWand *) NULL);
2413  assert(wand->signature == MagickWandSignature);
2414  if (wand->debug != MagickFalse)
2415  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2416  if (wand->images == (Image *) NULL)
2417  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2418  status=ContrastImage(wand->images,sharpen,wand->exception);
2419  return(status);
2420 }
2421 ␌
2422 /*
2423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2424 % %
2425 % %
2426 % %
2427 % 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 %
2428 % %
2429 % %
2430 % %
2431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2432 %
2433 % MagickContrastStretchImage() enhances the contrast of a color image by
2434 % adjusting the pixels color to span the entire range of colors available.
2435 % You can also reduce the influence of a particular channel with a gamma
2436 % value of 0.
2437 %
2438 % The format of the MagickContrastStretchImage method is:
2439 %
2440 % MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2441 % const double black_point,const double white_point)
2442 %
2443 % A description of each parameter follows:
2444 %
2445 % o wand: the magick wand.
2446 %
2447 % o black_point: the black point.
2448 %
2449 % o white_point: the white point.
2450 %
2451 */
2452 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2453  const double black_point,const double white_point)
2454 {
2455  MagickBooleanType
2456  status;
2457 
2458  assert(wand != (MagickWand *) NULL);
2459  assert(wand->signature == MagickWandSignature);
2460  if (wand->debug != MagickFalse)
2461  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2462  if (wand->images == (Image *) NULL)
2463  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2464  status=ContrastStretchImage(wand->images,black_point,white_point,
2465  wand->exception);
2466  return(status);
2467 }
2468 ␌
2469 /*
2470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2471 % %
2472 % %
2473 % %
2474 % M a g i c k C o n v o l v e I m a g e %
2475 % %
2476 % %
2477 % %
2478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2479 %
2480 % MagickConvolveImage() applies a custom convolution kernel to the image.
2481 %
2482 % The format of the MagickConvolveImage method is:
2483 %
2484 % MagickBooleanType MagickConvolveImage(MagickWand *wand,
2485 % const KernelInfo *kernel)
2486 %
2487 % A description of each parameter follows:
2488 %
2489 % o wand: the magick wand.
2490 %
2491 % o kernel: An array of doubles representing the convolution kernel.
2492 %
2493 */
2494 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2495  const KernelInfo *kernel)
2496 {
2497  Image
2498  *filter_image;
2499 
2500  assert(wand != (MagickWand *) NULL);
2501  assert(wand->signature == MagickWandSignature);
2502  if (wand->debug != MagickFalse)
2503  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2504  if (kernel == (const KernelInfo *) NULL)
2505  return(MagickFalse);
2506  if (wand->images == (Image *) NULL)
2507  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2508  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2509  if (filter_image == (Image *) NULL)
2510  return(MagickFalse);
2511  ReplaceImageInList(&wand->images,filter_image);
2512  return(MagickTrue);
2513 }
2514 ␌
2515 /*
2516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2517 % %
2518 % %
2519 % %
2520 % M a g i c k C r o p I m a g e %
2521 % %
2522 % %
2523 % %
2524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2525 %
2526 % MagickCropImage() extracts a region of the image.
2527 %
2528 % The format of the MagickCropImage method is:
2529 %
2530 % MagickBooleanType MagickCropImage(MagickWand *wand,
2531 % const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2532 %
2533 % A description of each parameter follows:
2534 %
2535 % o wand: the magick wand.
2536 %
2537 % o width: the region width.
2538 %
2539 % o height: the region height.
2540 %
2541 % o x: the region x-offset.
2542 %
2543 % o y: the region y-offset.
2544 %
2545 */
2546 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2547  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2548 {
2549  Image
2550  *crop_image;
2551 
2552  RectangleInfo
2553  crop;
2554 
2555  assert(wand != (MagickWand *) NULL);
2556  assert(wand->signature == MagickWandSignature);
2557  if (wand->debug != MagickFalse)
2558  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2559  if (wand->images == (Image *) NULL)
2560  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2561  crop.width=width;
2562  crop.height=height;
2563  crop.x=x;
2564  crop.y=y;
2565  crop_image=CropImage(wand->images,&crop,wand->exception);
2566  if (crop_image == (Image *) NULL)
2567  return(MagickFalse);
2568  ReplaceImageInList(&wand->images,crop_image);
2569  return(MagickTrue);
2570 }
2571 ␌
2572 /*
2573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2574 % %
2575 % %
2576 % %
2577 % M a g i c k C y c l e C o l o r m a p I m a g e %
2578 % %
2579 % %
2580 % %
2581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2582 %
2583 % MagickCycleColormapImage() displaces an image's colormap by a given number
2584 % of positions. If you cycle the colormap a number of times you can produce
2585 % a psychodelic effect.
2586 %
2587 % The format of the MagickCycleColormapImage method is:
2588 %
2589 % MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2590 % const ssize_t displace)
2591 %
2592 % A description of each parameter follows:
2593 %
2594 % o wand: the magick wand.
2595 %
2596 % o pixel_wand: the pixel wand.
2597 %
2598 */
2599 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2600  const ssize_t displace)
2601 {
2602  MagickBooleanType
2603  status;
2604 
2605  assert(wand != (MagickWand *) NULL);
2606  assert(wand->signature == MagickWandSignature);
2607  if (wand->debug != MagickFalse)
2608  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2609  if (wand->images == (Image *) NULL)
2610  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2611  status=CycleColormapImage(wand->images,displace,wand->exception);
2612  return(status);
2613 }
2614 ␌
2615 /*
2616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2617 % %
2618 % %
2619 % %
2620 % M a g i c k C o n s t i t u t e I m a g e %
2621 % %
2622 % %
2623 % %
2624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2625 %
2626 % MagickConstituteImage() adds an image to the wand comprised of the pixel
2627 % data you supply. The pixel data must be in scanline order top-to-bottom.
2628 % The data can be char, short int, int, float, or double. Float and double
2629 % require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2630 % is the maximum value the type can accomodate (e.g. 255 for char). For
2631 % example, to create a 640x480 image from unsigned red-green-blue character
2632 % data, use
2633 %
2634 % MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2635 %
2636 % The format of the MagickConstituteImage method is:
2637 %
2638 % MagickBooleanType MagickConstituteImage(MagickWand *wand,
2639 % const size_t columns,const size_t rows,const char *map,
2640 % const StorageType storage,void *pixels)
2641 %
2642 % A description of each parameter follows:
2643 %
2644 % o wand: the magick wand.
2645 %
2646 % o columns: width in pixels of the image.
2647 %
2648 % o rows: height in pixels of the image.
2649 %
2650 % o map: This string reflects the expected ordering of the pixel array.
2651 % It can be any combination or order of R = red, G = green, B = blue,
2652 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2653 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2654 % P = pad.
2655 %
2656 % o storage: Define the data type of the pixels. Float and double types are
2657 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2658 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2659 % LongPixel, QuantumPixel, or ShortPixel.
2660 %
2661 % o pixels: This array of values contain the pixel components as defined by
2662 % map and type. You must preallocate this array where the expected
2663 % length varies depending on the values of width, height, map, and type.
2664 %
2665 %
2666 */
2667 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2668  const size_t columns,const size_t rows,const char *map,
2669  const StorageType storage,const void *pixels)
2670 {
2671  Image
2672  *images;
2673 
2674  assert(wand != (MagickWand *) NULL);
2675  assert(wand->signature == MagickWandSignature);
2676  if (wand->debug != MagickFalse)
2677  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2678  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2679  if (images == (Image *) NULL)
2680  return(MagickFalse);
2681  return(InsertImageInWand(wand,images));
2682 }
2683 ␌
2684 /*
2685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2686 % %
2687 % %
2688 % %
2689 % M a g i c k D e c i p h e r I m a g e %
2690 % %
2691 % %
2692 % %
2693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2694 %
2695 % MagickDecipherImage() converts cipher pixels to plain pixels.
2696 %
2697 % The format of the MagickDecipherImage method is:
2698 %
2699 % MagickBooleanType MagickDecipherImage(MagickWand *wand,
2700 % const char *passphrase)
2701 %
2702 % A description of each parameter follows:
2703 %
2704 % o wand: the magick wand.
2705 %
2706 % o passphrase: the passphrase.
2707 %
2708 */
2709 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2710  const char *passphrase)
2711 {
2712  assert(wand != (MagickWand *) NULL);
2713  assert(wand->signature == MagickWandSignature);
2714  if (wand->debug != MagickFalse)
2715  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2716  if (wand->images == (Image *) NULL)
2717  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2718  return(DecipherImage(wand->images,passphrase,wand->exception));
2719 }
2720 ␌
2721 /*
2722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2723 % %
2724 % %
2725 % %
2726 % M a g i c k D e c o n s t r u c t I m a g e s %
2727 % %
2728 % %
2729 % %
2730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2731 %
2732 % MagickDeconstructImages() compares each image with the next in a sequence
2733 % and returns the maximum bounding region of any pixel differences it
2734 % discovers.
2735 %
2736 % The format of the MagickDeconstructImages method is:
2737 %
2738 % MagickWand *MagickDeconstructImages(MagickWand *wand)
2739 %
2740 % A description of each parameter follows:
2741 %
2742 % o wand: the magick wand.
2743 %
2744 */
2745 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2746 {
2747  Image
2748  *deconstruct_image;
2749 
2750  assert(wand != (MagickWand *) NULL);
2751  assert(wand->signature == MagickWandSignature);
2752  if (wand->debug != MagickFalse)
2753  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2754  if (wand->images == (Image *) NULL)
2755  return((MagickWand *) NULL);
2756  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2757  wand->exception);
2758  if (deconstruct_image == (Image *) NULL)
2759  return((MagickWand *) NULL);
2760  return(CloneMagickWandFromImages(wand,deconstruct_image));
2761 }
2762 ␌
2763 /*
2764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2765 % %
2766 % %
2767 % %
2768 % M a g i c k D e s k e w I m a g e %
2769 % %
2770 % %
2771 % %
2772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2773 %
2774 % MagickDeskewImage() removes skew from the image. Skew is an artifact that
2775 % occurs in scanned images because of the camera being misaligned,
2776 % imperfections in the scanning or surface, or simply because the paper was
2777 % not placed completely flat when scanned.
2778 %
2779 % The format of the MagickDeskewImage method is:
2780 %
2781 % MagickBooleanType MagickDeskewImage(MagickWand *wand,
2782 % const double threshold)
2783 %
2784 % A description of each parameter follows:
2785 %
2786 % o wand: the magick wand.
2787 %
2788 % o threshold: separate background from foreground.
2789 %
2790 */
2791 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2792  const double threshold)
2793 {
2794  Image
2795  *sepia_image;
2796 
2797  assert(wand != (MagickWand *) NULL);
2798  assert(wand->signature == MagickWandSignature);
2799  if (wand->debug != MagickFalse)
2800  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2801  if (wand->images == (Image *) NULL)
2802  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2803  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2804  if (sepia_image == (Image *) NULL)
2805  return(MagickFalse);
2806  ReplaceImageInList(&wand->images,sepia_image);
2807  return(MagickTrue);
2808 }
2809 ␌
2810 /*
2811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2812 % %
2813 % %
2814 % %
2815 % M a g i c k D e s p e c k l e I m a g e %
2816 % %
2817 % %
2818 % %
2819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2820 %
2821 % MagickDespeckleImage() reduces the speckle noise in an image while
2822 % perserving the edges of the original image.
2823 %
2824 % The format of the MagickDespeckleImage method is:
2825 %
2826 % MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2827 %
2828 % A description of each parameter follows:
2829 %
2830 % o wand: the magick wand.
2831 %
2832 */
2833 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2834 {
2835  Image
2836  *despeckle_image;
2837 
2838  assert(wand != (MagickWand *) NULL);
2839  assert(wand->signature == MagickWandSignature);
2840  if (wand->debug != MagickFalse)
2841  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2842  if (wand->images == (Image *) NULL)
2843  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2844  despeckle_image=DespeckleImage(wand->images,wand->exception);
2845  if (despeckle_image == (Image *) NULL)
2846  return(MagickFalse);
2847  ReplaceImageInList(&wand->images,despeckle_image);
2848  return(MagickTrue);
2849 }
2850 ␌
2851 /*
2852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2853 % %
2854 % %
2855 % %
2856 % M a g i c k D e s t r o y I m a g e %
2857 % %
2858 % %
2859 % %
2860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2861 %
2862 % MagickDestroyImage() dereferences an image, deallocating memory associated
2863 % with the image if the reference count becomes zero.
2864 %
2865 % The format of the MagickDestroyImage method is:
2866 %
2867 % Image *MagickDestroyImage(Image *image)
2868 %
2869 % A description of each parameter follows:
2870 %
2871 % o image: the image.
2872 %
2873 */
2874 WandExport Image *MagickDestroyImage(Image *image)
2875 {
2876  return(DestroyImage(image));
2877 }
2878 ␌
2879 /*
2880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2881 % %
2882 % %
2883 % %
2884 % M a g i c k D i s p l a y I m a g e %
2885 % %
2886 % %
2887 % %
2888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2889 %
2890 % MagickDisplayImage() displays an image.
2891 %
2892 % The format of the MagickDisplayImage method is:
2893 %
2894 % MagickBooleanType MagickDisplayImage(MagickWand *wand,
2895 % const char *server_name)
2896 %
2897 % A description of each parameter follows:
2898 %
2899 % o wand: the magick wand.
2900 %
2901 % o server_name: the X server name.
2902 %
2903 */
2904 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2905  const char *server_name)
2906 {
2907  Image
2908  *image;
2909 
2910  MagickBooleanType
2911  status;
2912 
2913  assert(wand != (MagickWand *) NULL);
2914  assert(wand->signature == MagickWandSignature);
2915  if (wand->debug != MagickFalse)
2916  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2917  if (wand->images == (Image *) NULL)
2918  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2919  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2920  if (image == (Image *) NULL)
2921  return(MagickFalse);
2922  (void) CloneString(&wand->image_info->server_name,server_name);
2923  status=DisplayImages(wand->image_info,image,wand->exception);
2924  image=DestroyImage(image);
2925  return(status);
2926 }
2927 ␌
2928 /*
2929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2930 % %
2931 % %
2932 % %
2933 % M a g i c k D i s p l a y I m a g e s %
2934 % %
2935 % %
2936 % %
2937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2938 %
2939 % MagickDisplayImages() displays an image or image sequence.
2940 %
2941 % The format of the MagickDisplayImages method is:
2942 %
2943 % MagickBooleanType MagickDisplayImages(MagickWand *wand,
2944 % const char *server_name)
2945 %
2946 % A description of each parameter follows:
2947 %
2948 % o wand: the magick wand.
2949 %
2950 % o server_name: the X server name.
2951 %
2952 */
2953 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2954  const char *server_name)
2955 {
2956  MagickBooleanType
2957  status;
2958 
2959  assert(wand != (MagickWand *) NULL);
2960  assert(wand->signature == MagickWandSignature);
2961  if (wand->debug != MagickFalse)
2962  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2963  (void) CloneString(&wand->image_info->server_name,server_name);
2964  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2965  return(status);
2966 }
2967 ␌
2968 /*
2969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2970 % %
2971 % %
2972 % %
2973 % M a g i c k D i s t o r t I m a g e %
2974 % %
2975 % %
2976 % %
2977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2978 %
2979 % MagickDistortImage() distorts an image using various distortion methods, by
2980 % mapping color lookups of the source image to a new destination image
2981 % usally of the same size as the source image, unless 'bestfit' is set to
2982 % true.
2983 %
2984 % If 'bestfit' is enabled, and distortion allows it, the destination image is
2985 % adjusted to ensure the whole source 'image' will just fit within the final
2986 % destination image, which will be sized and offset accordingly. Also in
2987 % many cases the virtual offset of the source image will be taken into
2988 % account in the mapping.
2989 %
2990 % The format of the MagickDistortImage method is:
2991 %
2992 % MagickBooleanType MagickDistortImage(MagickWand *wand,
2993 % const DistortMethod method,const size_t number_arguments,
2994 % const double *arguments,const MagickBooleanType bestfit)
2995 %
2996 % A description of each parameter follows:
2997 %
2998 % o image: the image to be distorted.
2999 %
3000 % o method: the method of image distortion.
3001 %
3002 % ArcDistortion always ignores the source image offset, and always
3003 % 'bestfit' the destination image with the top left corner offset
3004 % relative to the polar mapping center.
3005 %
3006 % Bilinear has no simple inverse mapping so it does not allow 'bestfit'
3007 % style of image distortion.
3008 %
3009 % Affine, Perspective, and Bilinear, do least squares fitting of the
3010 % distortion when more than the minimum number of control point pairs
3011 % are provided.
3012 %
3013 % Perspective, and Bilinear, falls back to a Affine distortion when less
3014 % that 4 control point pairs are provided. While Affine distortions let
3015 % you use any number of control point pairs, that is Zero pairs is a
3016 % no-Op (viewport only) distrotion, one pair is a translation and two
3017 % pairs of control points do a scale-rotate-translate, without any
3018 % shearing.
3019 %
3020 % o number_arguments: the number of arguments given for this distortion
3021 % method.
3022 %
3023 % o arguments: the arguments for this distortion method.
3024 %
3025 % o bestfit: Attempt to resize destination to fit distorted source.
3026 %
3027 */
3028 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
3029  const DistortMethod method,const size_t number_arguments,
3030  const double *arguments,const MagickBooleanType bestfit)
3031 {
3032  Image
3033  *distort_image;
3034 
3035  assert(wand != (MagickWand *) NULL);
3036  assert(wand->signature == MagickWandSignature);
3037  if (wand->debug != MagickFalse)
3038  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3039  if (wand->images == (Image *) NULL)
3040  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3041  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
3042  bestfit,wand->exception);
3043  if (distort_image == (Image *) NULL)
3044  return(MagickFalse);
3045  ReplaceImageInList(&wand->images,distort_image);
3046  return(MagickTrue);
3047 }
3048 ␌
3049 /*
3050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3051 % %
3052 % %
3053 % %
3054 % M a g i c k D r a w I m a g e %
3055 % %
3056 % %
3057 % %
3058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3059 %
3060 % MagickDrawImage() renders the drawing wand on the current image.
3061 %
3062 % The format of the MagickDrawImage method is:
3063 %
3064 % MagickBooleanType MagickDrawImage(MagickWand *wand,
3065 % const DrawingWand *drawing_wand)
3066 %
3067 % A description of each parameter follows:
3068 %
3069 % o wand: the magick wand.
3070 %
3071 % o drawing_wand: the draw wand.
3072 %
3073 */
3074 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
3075  const DrawingWand *drawing_wand)
3076 {
3077  char
3078  *primitive;
3079 
3080  DrawInfo
3081  *draw_info;
3082 
3083  MagickBooleanType
3084  status;
3085 
3086  assert(wand != (MagickWand *) NULL);
3087  assert(wand->signature == MagickWandSignature);
3088  if (wand->debug != MagickFalse)
3089  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3090  if (wand->images == (Image *) NULL)
3091  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3092  draw_info=PeekDrawingWand(drawing_wand);
3093  if ((draw_info == (DrawInfo *) NULL) ||
3094  (draw_info->primitive == (char *) NULL))
3095  return(MagickFalse);
3096  primitive=AcquireString(draw_info->primitive);
3097  draw_info=DestroyDrawInfo(draw_info);
3098  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3099  draw_info->primitive=primitive;
3100  status=DrawImage(wand->images,draw_info,wand->exception);
3101  draw_info=DestroyDrawInfo(draw_info);
3102  return(status);
3103 }
3104 ␌
3105 /*
3106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3107 % %
3108 % %
3109 % %
3110 % M a g i c k E d g e I m a g e %
3111 % %
3112 % %
3113 % %
3114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3115 %
3116 % MagickEdgeImage() enhance edges within the image with a convolution filter
3117 % of the given radius. Use a radius of 0 and Edge() selects a suitable
3118 % radius for you.
3119 %
3120 % The format of the MagickEdgeImage method is:
3121 %
3122 % MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
3123 %
3124 % A description of each parameter follows:
3125 %
3126 % o wand: the magick wand.
3127 %
3128 % o radius: the radius of the pixel neighborhood.
3129 %
3130 */
3131 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
3132  const double radius)
3133 {
3134  Image
3135  *edge_image;
3136 
3137  assert(wand != (MagickWand *) NULL);
3138  assert(wand->signature == MagickWandSignature);
3139  if (wand->debug != MagickFalse)
3140  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3141  if (wand->images == (Image *) NULL)
3142  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3143  edge_image=EdgeImage(wand->images,radius,wand->exception);
3144  if (edge_image == (Image *) NULL)
3145  return(MagickFalse);
3146  ReplaceImageInList(&wand->images,edge_image);
3147  return(MagickTrue);
3148 }
3149 ␌
3150 /*
3151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3152 % %
3153 % %
3154 % %
3155 % M a g i c k E m b o s s I m a g e %
3156 % %
3157 % %
3158 % %
3159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3160 %
3161 % MagickEmbossImage() returns a grayscale image with a three-dimensional
3162 % effect. We convolve the image with a Gaussian operator of the given radius
3163 % and standard deviation (sigma). For reasonable results, radius should be
3164 % larger than sigma. Use a radius of 0 and Emboss() selects a suitable
3165 % radius for you.
3166 %
3167 % The format of the MagickEmbossImage method is:
3168 %
3169 % MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
3170 % const double sigma)
3171 %
3172 % A description of each parameter follows:
3173 %
3174 % o wand: the magick wand.
3175 %
3176 % o radius: the radius of the Gaussian, in pixels, not counting the center
3177 % pixel.
3178 %
3179 % o sigma: the standard deviation of the Gaussian, in pixels.
3180 %
3181 */
3182 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
3183  const double radius,const double sigma)
3184 {
3185  Image
3186  *emboss_image;
3187 
3188  assert(wand != (MagickWand *) NULL);
3189  assert(wand->signature == MagickWandSignature);
3190  if (wand->debug != MagickFalse)
3191  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3192  if (wand->images == (Image *) NULL)
3193  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3194  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
3195  if (emboss_image == (Image *) NULL)
3196  return(MagickFalse);
3197  ReplaceImageInList(&wand->images,emboss_image);
3198  return(MagickTrue);
3199 }
3200 ␌
3201 /*
3202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3203 % %
3204 % %
3205 % %
3206 % M a g i c k E n c i p h e r I m a g e %
3207 % %
3208 % %
3209 % %
3210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3211 %
3212 % MagickEncipherImage() converts plaint pixels to cipher pixels.
3213 %
3214 % The format of the MagickEncipherImage method is:
3215 %
3216 % MagickBooleanType MagickEncipherImage(MagickWand *wand,
3217 % const char *passphrase)
3218 %
3219 % A description of each parameter follows:
3220 %
3221 % o wand: the magick wand.
3222 %
3223 % o passphrase: the passphrase.
3224 %
3225 */
3226 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
3227  const char *passphrase)
3228 {
3229  assert(wand != (MagickWand *) NULL);
3230  assert(wand->signature == MagickWandSignature);
3231  if (wand->debug != MagickFalse)
3232  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3233  if (wand->images == (Image *) NULL)
3234  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3235  return(EncipherImage(wand->images,passphrase,wand->exception));
3236 }
3237 ␌
3238 /*
3239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3240 % %
3241 % %
3242 % %
3243 % M a g i c k E n h a n c e I m a g e %
3244 % %
3245 % %
3246 % %
3247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3248 %
3249 % MagickEnhanceImage() applies a digital filter that improves the quality of a
3250 % noisy image.
3251 %
3252 % The format of the MagickEnhanceImage method is:
3253 %
3254 % MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3255 %
3256 % A description of each parameter follows:
3257 %
3258 % o wand: the magick wand.
3259 %
3260 */
3261 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3262 {
3263  Image
3264  *enhance_image;
3265 
3266  assert(wand != (MagickWand *) NULL);
3267  assert(wand->signature == MagickWandSignature);
3268  if (wand->debug != MagickFalse)
3269  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3270  if (wand->images == (Image *) NULL)
3271  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3272  enhance_image=EnhanceImage(wand->images,wand->exception);
3273  if (enhance_image == (Image *) NULL)
3274  return(MagickFalse);
3275  ReplaceImageInList(&wand->images,enhance_image);
3276  return(MagickTrue);
3277 }
3278 ␌
3279 /*
3280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3281 % %
3282 % %
3283 % %
3284 % M a g i c k E q u a l i z e I m a g e %
3285 % %
3286 % %
3287 % %
3288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3289 %
3290 % MagickEqualizeImage() equalizes the image histogram.
3291 %
3292 % The format of the MagickEqualizeImage method is:
3293 %
3294 % MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3295 %
3296 % A description of each parameter follows:
3297 %
3298 % o wand: the magick wand.
3299 %
3300 % o channel: the image channel(s).
3301 %
3302 */
3303 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3304 {
3305  MagickBooleanType
3306  status;
3307 
3308  assert(wand != (MagickWand *) NULL);
3309  assert(wand->signature == MagickWandSignature);
3310  if (wand->debug != MagickFalse)
3311  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3312  if (wand->images == (Image *) NULL)
3313  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3314  status=EqualizeImage(wand->images,wand->exception);
3315  return(status);
3316 }
3317 ␌
3318 /*
3319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3320 % %
3321 % %
3322 % %
3323 % M a g i c k E v a l u a t e I m a g e %
3324 % %
3325 % %
3326 % %
3327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3328 %
3329 % MagickEvaluateImage() applys an arithmetic, relational, or logical
3330 % expression to an image. Use these operators to lighten or darken an image,
3331 % to increase or decrease contrast in an image, or to produce the "negative"
3332 % of an image.
3333 %
3334 % The format of the MagickEvaluateImage method is:
3335 %
3336 % MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3337 % const MagickEvaluateOperator operator,const double value)
3338 % MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3339 % const MagickEvaluateOperator operator)
3340 %
3341 % A description of each parameter follows:
3342 %
3343 % o wand: the magick wand.
3344 %
3345 % o op: A channel operator.
3346 %
3347 % o value: A value value.
3348 %
3349 */
3350 
3351 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3352  const MagickEvaluateOperator op)
3353 {
3354  Image
3355  *evaluate_image;
3356 
3357  assert(wand != (MagickWand *) NULL);
3358  assert(wand->signature == MagickWandSignature);
3359  if (wand->debug != MagickFalse)
3360  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3361  if (wand->images == (Image *) NULL)
3362  return((MagickWand *) NULL);
3363  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3364  if (evaluate_image == (Image *) NULL)
3365  return((MagickWand *) NULL);
3366  return(CloneMagickWandFromImages(wand,evaluate_image));
3367 }
3368 
3369 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3370  const MagickEvaluateOperator op,const double value)
3371 {
3372  MagickBooleanType
3373  status;
3374 
3375  assert(wand != (MagickWand *) NULL);
3376  assert(wand->signature == MagickWandSignature);
3377  if (wand->debug != MagickFalse)
3378  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3379  if (wand->images == (Image *) NULL)
3380  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3381  status=EvaluateImage(wand->images,op,value,wand->exception);
3382  return(status);
3383 }
3384 ␌
3385 /*
3386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3387 % %
3388 % %
3389 % %
3390 % M a g i c k E x p o r t I m a g e P i x e l s %
3391 % %
3392 % %
3393 % %
3394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3395 %
3396 % MagickExportImagePixels() extracts pixel data from an image and returns it
3397 % to you. The method returns MagickTrue on success otherwise MagickFalse if
3398 % an error is encountered. The data is returned as char, short int, int,
3399 % ssize_t, float, or double in the order specified by map.
3400 %
3401 % Suppose you want to extract the first scanline of a 640x480 image as
3402 % character data in red-green-blue order:
3403 %
3404 % MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3405 %
3406 % The format of the MagickExportImagePixels method is:
3407 %
3408 % MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3409 % const ssize_t x,const ssize_t y,const size_t columns,
3410 % const size_t rows,const char *map,const StorageType storage,
3411 % void *pixels)
3412 %
3413 % A description of each parameter follows:
3414 %
3415 % o wand: the magick wand.
3416 %
3417 % o x, y, columns, rows: These values define the perimeter
3418 % of a region of pixels you want to extract.
3419 %
3420 % o map: This string reflects the expected ordering of the pixel array.
3421 % It can be any combination or order of R = red, G = green, B = blue,
3422 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3423 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3424 % P = pad.
3425 %
3426 % o storage: Define the data type of the pixels. Float and double types are
3427 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3428 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3429 % LongPixel, QuantumPixel, or ShortPixel.
3430 %
3431 % o pixels: This array of values contain the pixel components as defined by
3432 % map and type. You must preallocate this array where the expected
3433 % length varies depending on the values of width, height, map, and type.
3434 %
3435 */
3436 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3437  const ssize_t x,const ssize_t y,const size_t columns,
3438  const size_t rows,const char *map,const StorageType storage,
3439  void *pixels)
3440 {
3441  MagickBooleanType
3442  status;
3443 
3444  assert(wand != (MagickWand *) NULL);
3445  assert(wand->signature == MagickWandSignature);
3446  if (wand->debug != MagickFalse)
3447  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3448  if (wand->images == (Image *) NULL)
3449  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3450  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3451  storage,pixels,wand->exception);
3452  return(status);
3453 }
3454 ␌
3455 /*
3456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3457 % %
3458 % %
3459 % %
3460 % M a g i c k E x t e n t I m a g e %
3461 % %
3462 % %
3463 % %
3464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3465 %
3466 % MagickExtentImage() extends the image as defined by the geometry, gravity,
3467 % and wand background color. Set the (x,y) offset of the geometry to move
3468 % the original wand relative to the extended wand.
3469 %
3470 % The format of the MagickExtentImage method is:
3471 %
3472 % MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3473 % const size_t height,const ssize_t x,const ssize_t y)
3474 %
3475 % A description of each parameter follows:
3476 %
3477 % o wand: the magick wand.
3478 %
3479 % o width: the region width.
3480 %
3481 % o height: the region height.
3482 %
3483 % o x: the region x offset.
3484 %
3485 % o y: the region y offset.
3486 %
3487 */
3488 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3489  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3490 {
3491  Image
3492  *extent_image;
3493 
3494  RectangleInfo
3495  extent;
3496 
3497  assert(wand != (MagickWand *) NULL);
3498  assert(wand->signature == MagickWandSignature);
3499  if (wand->debug != MagickFalse)
3500  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3501  if (wand->images == (Image *) NULL)
3502  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3503  extent.width=width;
3504  extent.height=height;
3505  extent.x=x;
3506  extent.y=y;
3507  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3508  if (extent_image == (Image *) NULL)
3509  return(MagickFalse);
3510  ReplaceImageInList(&wand->images,extent_image);
3511  return(MagickTrue);
3512 }
3513 ␌
3514 /*
3515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3516 % %
3517 % %
3518 % %
3519 % M a g i c k F l i p I m a g e %
3520 % %
3521 % %
3522 % %
3523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3524 %
3525 % MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3526 % around the central x-axis.
3527 %
3528 % The format of the MagickFlipImage method is:
3529 %
3530 % MagickBooleanType MagickFlipImage(MagickWand *wand)
3531 %
3532 % A description of each parameter follows:
3533 %
3534 % o wand: the magick wand.
3535 %
3536 */
3537 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3538 {
3539  Image
3540  *flip_image;
3541 
3542  assert(wand != (MagickWand *) NULL);
3543  assert(wand->signature == MagickWandSignature);
3544  if (wand->debug != MagickFalse)
3545  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3546  if (wand->images == (Image *) NULL)
3547  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3548  flip_image=FlipImage(wand->images,wand->exception);
3549  if (flip_image == (Image *) NULL)
3550  return(MagickFalse);
3551  ReplaceImageInList(&wand->images,flip_image);
3552  return(MagickTrue);
3553 }
3554 ␌
3555 /*
3556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3557 % %
3558 % %
3559 % %
3560 % 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 %
3561 % %
3562 % %
3563 % %
3564 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3565 %
3566 % MagickFloodfillPaintImage() changes the color value of any pixel that matches
3567 % target and is an immediate neighbor. If the method FillToBorderMethod is
3568 % specified, the color value is changed for any neighbor pixel that does not
3569 % match the bordercolor member of image.
3570 %
3571 % The format of the MagickFloodfillPaintImage method is:
3572 %
3573 % MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3574 % const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3575 % const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3576 %
3577 % A description of each parameter follows:
3578 %
3579 % o wand: the magick wand.
3580 %
3581 % o fill: the floodfill color pixel wand.
3582 %
3583 % o fuzz: By default target must match a particular pixel color
3584 % exactly. However, in many cases two colors may differ by a small amount.
3585 % The fuzz member of image defines how much tolerance is acceptable to
3586 % consider two colors as the same. For example, set fuzz to 10 and the
3587 % color red at intensities of 100 and 102 respectively are now interpreted
3588 % as the same color for the purposes of the floodfill.
3589 %
3590 % o bordercolor: the border color pixel wand.
3591 %
3592 % o x,y: the starting location of the operation.
3593 %
3594 % o invert: paint any pixel that does not match the target color.
3595 %
3596 */
3597 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3598  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3599  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3600 {
3601  DrawInfo
3602  *draw_info;
3603 
3604  MagickBooleanType
3605  status;
3606 
3607  PixelInfo
3608  target;
3609 
3610  assert(wand != (MagickWand *) NULL);
3611  assert(wand->signature == MagickWandSignature);
3612  if (wand->debug != MagickFalse)
3613  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3614  if (wand->images == (Image *) NULL)
3615  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3616  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3617  PixelGetQuantumPacket(fill,&draw_info->fill);
3618  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3619  wand->images->columns,y % wand->images->rows,&target,wand->exception);
3620  if (bordercolor != (PixelWand *) NULL)
3621  PixelGetMagickColor(bordercolor,&target);
3622  wand->images->fuzz=fuzz;
3623  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3624  wand->exception);
3625  draw_info=DestroyDrawInfo(draw_info);
3626  return(status);
3627 }
3628 ␌
3629 /*
3630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3631 % %
3632 % %
3633 % %
3634 % M a g i c k F l o p I m a g e %
3635 % %
3636 % %
3637 % %
3638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3639 %
3640 % MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3641 % around the central y-axis.
3642 %
3643 % The format of the MagickFlopImage method is:
3644 %
3645 % MagickBooleanType MagickFlopImage(MagickWand *wand)
3646 %
3647 % A description of each parameter follows:
3648 %
3649 % o wand: the magick wand.
3650 %
3651 */
3652 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3653 {
3654  Image
3655  *flop_image;
3656 
3657  assert(wand != (MagickWand *) NULL);
3658  assert(wand->signature == MagickWandSignature);
3659  if (wand->debug != MagickFalse)
3660  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3661  if (wand->images == (Image *) NULL)
3662  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3663  flop_image=FlopImage(wand->images,wand->exception);
3664  if (flop_image == (Image *) NULL)
3665  return(MagickFalse);
3666  ReplaceImageInList(&wand->images,flop_image);
3667  return(MagickTrue);
3668 }
3669 ␌
3670 /*
3671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3672 % %
3673 % %
3674 % %
3675 % 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 %
3676 % %
3677 % %
3678 % %
3679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3680 %
3681 % MagickForwardFourierTransformImage() implements the discrete Fourier
3682 % transform (DFT) of the image either as a magnitude / phase or real /
3683 % imaginary image pair.
3684 %
3685 % The format of the MagickForwardFourierTransformImage method is:
3686 %
3687 % MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3688 % const MagickBooleanType magnitude)
3689 %
3690 % A description of each parameter follows:
3691 %
3692 % o wand: the magick wand.
3693 %
3694 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
3695 % imaginary image pair.
3696 %
3697 */
3698 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3699  MagickWand *wand,const MagickBooleanType magnitude)
3700 {
3701  Image
3702  *forward_image;
3703 
3704  assert(wand != (MagickWand *) NULL);
3705  assert(wand->signature == MagickWandSignature);
3706  if (wand->debug != MagickFalse)
3707  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3708  if (wand->images == (Image *) NULL)
3709  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3710  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3711  wand->exception);
3712  if (forward_image == (Image *) NULL)
3713  return(MagickFalse);
3714  ReplaceImageInList(&wand->images,forward_image);
3715  return(MagickTrue);
3716 }
3717 ␌
3718 /*
3719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3720 % %
3721 % %
3722 % %
3723 % M a g i c k F r a m e I m a g e %
3724 % %
3725 % %
3726 % %
3727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3728 %
3729 % MagickFrameImage() adds a simulated three-dimensional border around the
3730 % image. The width and height specify the border width of the vertical and
3731 % horizontal sides of the frame. The inner and outer bevels indicate the
3732 % width of the inner and outer shadows of the frame.
3733 %
3734 % The format of the MagickFrameImage method is:
3735 %
3736 % MagickBooleanType MagickFrameImage(MagickWand *wand,
3737 % const PixelWand *matte_color,const size_t width,
3738 % const size_t height,const ssize_t inner_bevel,
3739 % const ssize_t outer_bevel,const CompositeOperator compose)
3740 %
3741 % A description of each parameter follows:
3742 %
3743 % o wand: the magick wand.
3744 %
3745 % o matte_color: the frame color pixel wand.
3746 %
3747 % o width: the border width.
3748 %
3749 % o height: the border height.
3750 %
3751 % o inner_bevel: the inner bevel width.
3752 %
3753 % o outer_bevel: the outer bevel width.
3754 %
3755 % o compose: the composite operator.
3756 %
3757 */
3758 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3759  const PixelWand *matte_color,const size_t width,const size_t height,
3760  const ssize_t inner_bevel,const ssize_t outer_bevel,
3761  const CompositeOperator compose)
3762 {
3763  Image
3764  *frame_image;
3765 
3766  FrameInfo
3767  frame_info;
3768 
3769  assert(wand != (MagickWand *) NULL);
3770  assert(wand->signature == MagickWandSignature);
3771  if (wand->debug != MagickFalse)
3772  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3773  if (wand->images == (Image *) NULL)
3774  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3775  (void) memset(&frame_info,0,sizeof(frame_info));
3776  frame_info.width=wand->images->columns+2*width;
3777  frame_info.height=wand->images->rows+2*height;
3778  frame_info.x=(ssize_t) width;
3779  frame_info.y=(ssize_t) height;
3780  frame_info.inner_bevel=inner_bevel;
3781  frame_info.outer_bevel=outer_bevel;
3782  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3783  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3784  if (frame_image == (Image *) NULL)
3785  return(MagickFalse);
3786  ReplaceImageInList(&wand->images,frame_image);
3787  return(MagickTrue);
3788 }
3789 ␌
3790 /*
3791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3792 % %
3793 % %
3794 % %
3795 % M a g i c k F u n c t i o n I m a g e %
3796 % %
3797 % %
3798 % %
3799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3800 %
3801 % MagickFunctionImage() applys an arithmetic, relational, or logical
3802 % expression to an image. Use these operators to lighten or darken an image,
3803 % to increase or decrease contrast in an image, or to produce the "negative"
3804 % of an image.
3805 %
3806 % The format of the MagickFunctionImage method is:
3807 %
3808 % MagickBooleanType MagickFunctionImage(MagickWand *wand,
3809 % const MagickFunction function,const size_t number_arguments,
3810 % const double *arguments)
3811 %
3812 % A description of each parameter follows:
3813 %
3814 % o wand: the magick wand.
3815 %
3816 % o function: the image function.
3817 %
3818 % o number_arguments: the number of function arguments.
3819 %
3820 % o arguments: the function arguments.
3821 %
3822 */
3823 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3824  const MagickFunction function,const size_t number_arguments,
3825  const double *arguments)
3826 {
3827  MagickBooleanType
3828  status;
3829 
3830  assert(wand != (MagickWand *) NULL);
3831  assert(wand->signature == MagickWandSignature);
3832  if (wand->debug != MagickFalse)
3833  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3834  if (wand->images == (Image *) NULL)
3835  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3836  status=FunctionImage(wand->images,function,number_arguments,arguments,
3837  wand->exception);
3838  return(status);
3839 }
3840 ␌
3841 /*
3842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3843 % %
3844 % %
3845 % %
3846 % M a g i c k F x I m a g e %
3847 % %
3848 % %
3849 % %
3850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3851 %
3852 % MagickFxImage() evaluate expression for each pixel in the image.
3853 %
3854 % The format of the MagickFxImage method is:
3855 %
3856 % MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3857 %
3858 % A description of each parameter follows:
3859 %
3860 % o wand: the magick wand.
3861 %
3862 % o expression: the expression.
3863 %
3864 */
3865 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3866 {
3867  Image
3868  *fx_image;
3869 
3870  assert(wand != (MagickWand *) NULL);
3871  assert(wand->signature == MagickWandSignature);
3872  if (wand->debug != MagickFalse)
3873  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3874  if (wand->images == (Image *) NULL)
3875  return((MagickWand *) NULL);
3876  fx_image=FxImage(wand->images,expression,wand->exception);
3877  if (fx_image == (Image *) NULL)
3878  return((MagickWand *) NULL);
3879  return(CloneMagickWandFromImages(wand,fx_image));
3880 }
3881 ␌
3882 /*
3883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3884 % %
3885 % %
3886 % %
3887 % M a g i c k G a m m a I m a g e %
3888 % %
3889 % %
3890 % %
3891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3892 %
3893 % MagickGammaImage() gamma-corrects an image. The same image viewed on
3894 % different devices will have perceptual differences in the way the image's
3895 % intensities are represented on the screen. Specify individual gamma levels
3896 % for the red, green, and blue channels, or adjust all three with the gamma
3897 % parameter. Values typically range from 0.8 to 2.3.
3898 %
3899 % You can also reduce the influence of a particular channel with a gamma
3900 % value of 0.
3901 %
3902 % The format of the MagickGammaImage method is:
3903 %
3904 % MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3905 %
3906 % A description of each parameter follows:
3907 %
3908 % o wand: the magick wand.
3909 %
3910 % o level: Define the level of gamma correction.
3911 %
3912 */
3913 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3914  const double gamma)
3915 {
3916  MagickBooleanType
3917  status;
3918 
3919  assert(wand != (MagickWand *) NULL);
3920  assert(wand->signature == MagickWandSignature);
3921  if (wand->debug != MagickFalse)
3922  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3923  if (wand->images == (Image *) NULL)
3924  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3925  status=GammaImage(wand->images,gamma,wand->exception);
3926  return(status);
3927 }
3928 ␌
3929 /*
3930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3931 % %
3932 % %
3933 % %
3934 % M a g i c k G a u s s i a n B l u r I m a g e %
3935 % %
3936 % %
3937 % %
3938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3939 %
3940 % MagickGaussianBlurImage() blurs an image. We convolve the image with a
3941 % Gaussian operator of the given radius and standard deviation (sigma).
3942 % For reasonable results, the radius should be larger than sigma. Use a
3943 % radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3944 %
3945 % The format of the MagickGaussianBlurImage method is:
3946 %
3947 % MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3948 % const double radius,const double sigma)
3949 %
3950 % A description of each parameter follows:
3951 %
3952 % o wand: the magick wand.
3953 %
3954 % o radius: the radius of the Gaussian, in pixels, not counting the center
3955 % pixel.
3956 %
3957 % o sigma: the standard deviation of the Gaussian, in pixels.
3958 %
3959 */
3960 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3961  const double radius,const double sigma)
3962 {
3963  Image
3964  *blur_image;
3965 
3966  assert(wand != (MagickWand *) NULL);
3967  assert(wand->signature == MagickWandSignature);
3968  if (wand->debug != MagickFalse)
3969  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3970  if (wand->images == (Image *) NULL)
3971  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3972  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3973  if (blur_image == (Image *) NULL)
3974  return(MagickFalse);
3975  ReplaceImageInList(&wand->images,blur_image);
3976  return(MagickTrue);
3977 }
3978 ␌
3979 /*
3980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3981 % %
3982 % %
3983 % %
3984 % M a g i c k G e t I m a g e %
3985 % %
3986 % %
3987 % %
3988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3989 %
3990 % MagickGetImage() gets the image at the current image index.
3991 %
3992 % The format of the MagickGetImage method is:
3993 %
3994 % MagickWand *MagickGetImage(MagickWand *wand)
3995 %
3996 % A description of each parameter follows:
3997 %
3998 % o wand: the magick wand.
3999 %
4000 */
4001 WandExport MagickWand *MagickGetImage(MagickWand *wand)
4002 {
4003  Image
4004  *image;
4005 
4006  assert(wand != (MagickWand *) NULL);
4007  assert(wand->signature == MagickWandSignature);
4008  if (wand->debug != MagickFalse)
4009  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4010  if (wand->images == (Image *) NULL)
4011  {
4012  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4013  "ContainsNoImages","`%s'",wand->name);
4014  return((MagickWand *) NULL);
4015  }
4016  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
4017  if (image == (Image *) NULL)
4018  return((MagickWand *) NULL);
4019  return(CloneMagickWandFromImages(wand,image));
4020 }
4021 ␌
4022 /*
4023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4024 % %
4025 % %
4026 % %
4027 % 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 %
4028 % %
4029 % %
4030 % %
4031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4032 %
4033 % MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
4034 % is not activated. That is, the image is RGB rather than RGBA or CMYK rather
4035 % than CMYKA.
4036 %
4037 % The format of the MagickGetImageAlphaChannel method is:
4038 %
4039 % MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4040 %
4041 % A description of each parameter follows:
4042 %
4043 % o wand: the magick wand.
4044 %
4045 */
4046 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4047 {
4048  assert(wand != (MagickWand *) NULL);
4049  assert(wand->signature == MagickWandSignature);
4050  if (wand->debug != MagickFalse)
4051  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4052  if (wand->images == (Image *) NULL)
4053  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4054  return(GetImageAlphaChannel(wand->images));
4055 }
4056 ␌
4057 /*
4058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4059 % %
4060 % %
4061 % %
4062 % M a g i c k G e t I m a g e C l i p M a s k %
4063 % %
4064 % %
4065 % %
4066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4067 %
4068 % MagickGetImageMask() gets the image clip mask at the current image index.
4069 %
4070 % The format of the MagickGetImageMask method is:
4071 %
4072 % MagickWand *MagickGetImageMask(MagickWand *wand)
4073 %
4074 % A description of each parameter follows:
4075 %
4076 % o wand: the magick wand.
4077 %
4078 % o type: type of mask, ReadPixelMask or WritePixelMask.
4079 %
4080 */
4081 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
4082  const PixelMask type)
4083 {
4084  Image
4085  *image;
4086 
4087  assert(wand != (MagickWand *) NULL);
4088  assert(wand->signature == MagickWandSignature);
4089  if (wand->debug != MagickFalse)
4090  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4091  if (wand->images == (Image *) NULL)
4092  {
4093  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4094  "ContainsNoImages","`%s'",wand->name);
4095  return((MagickWand *) NULL);
4096  }
4097  image=GetImageMask(wand->images,type,wand->exception);
4098  if (image == (Image *) NULL)
4099  return((MagickWand *) NULL);
4100  return(CloneMagickWandFromImages(wand,image));
4101 }
4102 ␌
4103 /*
4104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4105 % %
4106 % %
4107 % %
4108 % 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 %
4109 % %
4110 % %
4111 % %
4112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4113 %
4114 % MagickGetImageBackgroundColor() returns the image background color.
4115 %
4116 % The format of the MagickGetImageBackgroundColor method is:
4117 %
4118 % MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4119 % PixelWand *background_color)
4120 %
4121 % A description of each parameter follows:
4122 %
4123 % o wand: the magick wand.
4124 %
4125 % o background_color: Return the background color.
4126 %
4127 */
4128 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4129  PixelWand *background_color)
4130 {
4131  assert(wand != (MagickWand *) NULL);
4132  assert(wand->signature == MagickWandSignature);
4133  if (wand->debug != MagickFalse)
4134  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4135  if (wand->images == (Image *) NULL)
4136  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4137  PixelSetPixelColor(background_color,&wand->images->background_color);
4138  return(MagickTrue);
4139 }
4140 ␌
4141 /*
4142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4143 % %
4144 % %
4145 % %
4146 % M a g i c k G e t I m a g e B l o b %
4147 % %
4148 % %
4149 % %
4150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4151 %
4152 % MagickGetImageBlob() implements direct to memory image formats. It returns
4153 % the image as a blob (a formatted "file" in memory) and its length, starting
4154 % from the current position in the image sequence. Use MagickSetImageFormat()
4155 % to set the format to write to the blob (GIF, JPEG, PNG, etc.).
4156 %
4157 % Utilize MagickResetIterator() to ensure the write is from the beginning of
4158 % the image sequence.
4159 %
4160 % Use MagickRelinquishMemory() to free the blob when you are done with it.
4161 %
4162 % The format of the MagickGetImageBlob method is:
4163 %
4164 % unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4165 %
4166 % A description of each parameter follows:
4167 %
4168 % o wand: the magick wand.
4169 %
4170 % o length: the length of the blob.
4171 %
4172 */
4173 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4174 {
4175  unsigned char
4176  *blob;
4177 
4178  assert(wand != (MagickWand *) NULL);
4179  assert(wand->signature == MagickWandSignature);
4180  if (wand->debug != MagickFalse)
4181  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4182  if (wand->images == (Image *) NULL)
4183  {
4184  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4185  "ContainsNoImages","`%s'",wand->name);
4186  return((unsigned char *) NULL);
4187  }
4188  blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
4189  wand->exception);
4190  return(blob);
4191 }
4192 ␌
4193 /*
4194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4195 % %
4196 % %
4197 % %
4198 % M a g i c k G e t I m a g e s B l o b %
4199 % %
4200 % %
4201 % %
4202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4203 %
4204 % MagickGetImagesBlob() implements direct to memory image formats. It
4205 % returns the image sequence as a blob and its length. The format of the image
4206 % determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
4207 % return a different image format, use MagickSetImageFormat().
4208 %
4209 % Note, some image formats do not permit multiple images to the same image
4210 % stream (e.g. JPEG). in this instance, just the first image of the
4211 % sequence is returned as a blob.
4212 %
4213 % The format of the MagickGetImagesBlob method is:
4214 %
4215 % unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4216 %
4217 % A description of each parameter follows:
4218 %
4219 % o wand: the magick wand.
4220 %
4221 % o length: the length of the blob.
4222 %
4223 */
4224 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4225 {
4226  unsigned char
4227  *blob;
4228 
4229  assert(wand != (MagickWand *) NULL);
4230  assert(wand->signature == MagickWandSignature);
4231  if (wand->debug != MagickFalse)
4232  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4233  if (wand->images == (Image *) NULL)
4234  {
4235  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4236  "ContainsNoImages","`%s'",wand->name);
4237  return((unsigned char *) NULL);
4238  }
4239  blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
4240  wand->images),length,wand->exception);
4241  return(blob);
4242 }
4243 ␌
4244 /*
4245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4246 % %
4247 % %
4248 % %
4249 % 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 %
4250 % %
4251 % %
4252 % %
4253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4254 %
4255 % MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4256 % image.
4257 %
4258 % The format of the MagickGetImageBluePrimary method is:
4259 %
4260 % MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4261 % double *y,double *z)
4262 %
4263 % A description of each parameter follows:
4264 %
4265 % o wand: the magick wand.
4266 %
4267 % o x: the chromaticity blue primary x-point.
4268 %
4269 % o y: the chromaticity blue primary y-point.
4270 %
4271 % o z: the chromaticity blue primary z-point.
4272 %
4273 */
4274 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4275  double *x,double *y,double *z)
4276 {
4277  assert(wand != (MagickWand *) NULL);
4278  assert(wand->signature == MagickWandSignature);
4279  if (wand->debug != MagickFalse)
4280  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4281  if (wand->images == (Image *) NULL)
4282  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4283  *x=wand->images->chromaticity.blue_primary.x;
4284  *y=wand->images->chromaticity.blue_primary.y;
4285  *z=wand->images->chromaticity.blue_primary.z;
4286  return(MagickTrue);
4287 }
4288 ␌
4289 /*
4290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4291 % %
4292 % %
4293 % %
4294 % 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 %
4295 % %
4296 % %
4297 % %
4298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4299 %
4300 % MagickGetImageBorderColor() returns the image border color.
4301 %
4302 % The format of the MagickGetImageBorderColor method is:
4303 %
4304 % MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4305 % PixelWand *border_color)
4306 %
4307 % A description of each parameter follows:
4308 %
4309 % o wand: the magick wand.
4310 %
4311 % o border_color: Return the border color.
4312 %
4313 */
4314 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4315  PixelWand *border_color)
4316 {
4317  assert(wand != (MagickWand *) NULL);
4318  assert(wand->signature == MagickWandSignature);
4319  if (wand->debug != MagickFalse)
4320  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4321  if (wand->images == (Image *) NULL)
4322  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4323  PixelSetPixelColor(border_color,&wand->images->border_color);
4324  return(MagickTrue);
4325 }
4326 ␌
4327 /*
4328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4329 % %
4330 % %
4331 % %
4332 % M a g i c k G e t I m a g e F e a t u r e s %
4333 % %
4334 % %
4335 % %
4336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4337 %
4338 % MagickGetImageFeatures() returns features for each channel in the
4339 % image in each of four directions (horizontal, vertical, left and right
4340 % diagonals) for the specified distance. The features include the angular
4341 % second moment, contrast, correlation, sum of squares: variance, inverse
4342 % difference moment, sum average, sum varience, sum entropy, entropy,
4343 % difference variance, difference entropy, information measures of
4344 % correlation 1, information measures of correlation 2, and maximum
4345 % correlation coefficient. You can access the red channel contrast, for
4346 % example, like this:
4347 %
4348 % channel_features=MagickGetImageFeatures(wand,1);
4349 % contrast=channel_features[RedPixelChannel].contrast[0];
4350 %
4351 % Use MagickRelinquishMemory() to free the statistics buffer.
4352 %
4353 % The format of the MagickGetImageFeatures method is:
4354 %
4355 % ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4356 % const size_t distance)
4357 %
4358 % A description of each parameter follows:
4359 %
4360 % o wand: the magick wand.
4361 %
4362 % o distance: the distance.
4363 %
4364 */
4365 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4366  const size_t distance)
4367 {
4368  assert(wand != (MagickWand *) NULL);
4369  assert(wand->signature == MagickWandSignature);
4370  if (wand->debug != MagickFalse)
4371  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4372  if (wand->images == (Image *) NULL)
4373  {
4374  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4375  "ContainsNoImages","`%s'",wand->name);
4376  return((ChannelFeatures *) NULL);
4377  }
4378  return(GetImageFeatures(wand->images,distance,wand->exception));
4379 }
4380 ␌
4381 /*
4382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4383 % %
4384 % %
4385 % %
4386 % M a g i c k G e t I m a g e K u r t o s i s %
4387 % %
4388 % %
4389 % %
4390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4391 %
4392 % MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4393 % more image channels.
4394 %
4395 % The format of the MagickGetImageKurtosis method is:
4396 %
4397 % MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4398 % double *kurtosis,double *skewness)
4399 %
4400 % A description of each parameter follows:
4401 %
4402 % o wand: the magick wand.
4403 %
4404 % o kurtosis: The kurtosis for the specified channel(s).
4405 %
4406 % o skewness: The skewness for the specified channel(s).
4407 %
4408 */
4409 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4410  double *kurtosis,double *skewness)
4411 {
4412  MagickBooleanType
4413  status;
4414 
4415  assert(wand != (MagickWand *) NULL);
4416  assert(wand->signature == MagickWandSignature);
4417  if (wand->debug != MagickFalse)
4418  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4419  if (wand->images == (Image *) NULL)
4420  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4421  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4422  return(status);
4423 }
4424 ␌
4425 /*
4426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4427 % %
4428 % %
4429 % %
4430 % M a g i c k G e t I m a g e M e a n %
4431 % %
4432 % %
4433 % %
4434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4435 %
4436 % MagickGetImageMean() gets the mean and standard deviation of one or more
4437 % image channels.
4438 %
4439 % The format of the MagickGetImageMean method is:
4440 %
4441 % MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4442 % double *standard_deviation)
4443 %
4444 % A description of each parameter follows:
4445 %
4446 % o wand: the magick wand.
4447 %
4448 % o channel: the image channel(s).
4449 %
4450 % o mean: The mean pixel value for the specified channel(s).
4451 %
4452 % o standard_deviation: The standard deviation for the specified channel(s).
4453 %
4454 */
4455 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4456  double *standard_deviation)
4457 {
4458  MagickBooleanType
4459  status;
4460 
4461  assert(wand != (MagickWand *) NULL);
4462  assert(wand->signature == MagickWandSignature);
4463  if (wand->debug != MagickFalse)
4464  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4465  if (wand->images == (Image *) NULL)
4466  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4467  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4468  return(status);
4469 }
4470 ␌
4471 /*
4472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4473 % %
4474 % %
4475 % %
4476 % M a g i c k G e t I m a g e R a n g e %
4477 % %
4478 % %
4479 % %
4480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4481 %
4482 % MagickGetImageRange() gets the range for one or more image channels.
4483 %
4484 % The format of the MagickGetImageRange method is:
4485 %
4486 % MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4487 % double *maxima)
4488 %
4489 % A description of each parameter follows:
4490 %
4491 % o wand: the magick wand.
4492 %
4493 % o minima: The minimum pixel value for the specified channel(s).
4494 %
4495 % o maxima: The maximum pixel value for the specified channel(s).
4496 %
4497 */
4498 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4499  double *minima,double *maxima)
4500 {
4501  MagickBooleanType
4502  status;
4503 
4504  assert(wand != (MagickWand *) NULL);
4505  assert(wand->signature == MagickWandSignature);
4506  if (wand->debug != MagickFalse)
4507  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4508  if (wand->images == (Image *) NULL)
4509  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4510  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4511  return(status);
4512 }
4513 ␌
4514 /*
4515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4516 % %
4517 % %
4518 % %
4519 % M a g i c k G e t I m a g e S t a t i s t i c s %
4520 % %
4521 % %
4522 % %
4523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4524 %
4525 % MagickGetImageStatistics() returns statistics for each channel in the
4526 % image. The statistics include the channel depth, its minima and
4527 % maxima, the mean, the standard deviation, the kurtosis and the skewness.
4528 % You can access the red channel mean, for example, like this:
4529 %
4530 % channel_statistics=MagickGetImageStatistics(wand);
4531 % red_mean=channel_statistics[RedPixelChannel].mean;
4532 %
4533 % Use MagickRelinquishMemory() to free the statistics buffer.
4534 %
4535 % The format of the MagickGetImageStatistics method is:
4536 %
4537 % ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4538 %
4539 % A description of each parameter follows:
4540 %
4541 % o wand: the magick wand.
4542 %
4543 */
4544 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4545 {
4546  assert(wand != (MagickWand *) NULL);
4547  assert(wand->signature == MagickWandSignature);
4548  if (wand->debug != MagickFalse)
4549  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4550  if (wand->images == (Image *) NULL)
4551  {
4552  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4553  "ContainsNoImages","`%s'",wand->name);
4554  return((ChannelStatistics *) NULL);
4555  }
4556  return(GetImageStatistics(wand->images,wand->exception));
4557 }
4558 ␌
4559 /*
4560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4561 % %
4562 % %
4563 % %
4564 % 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 %
4565 % %
4566 % %
4567 % %
4568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4569 %
4570 % MagickGetImageColormapColor() returns the color of the specified colormap
4571 % index.
4572 %
4573 % The format of the MagickGetImageColormapColor method is:
4574 %
4575 % MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4576 % const size_t index,PixelWand *color)
4577 %
4578 % A description of each parameter follows:
4579 %
4580 % o wand: the magick wand.
4581 %
4582 % o index: the offset into the image colormap.
4583 %
4584 % o color: Return the colormap color in this wand.
4585 %
4586 */
4587 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4588  const size_t index,PixelWand *color)
4589 {
4590  assert(wand != (MagickWand *) NULL);
4591  assert(wand->signature == MagickWandSignature);
4592  if (wand->debug != MagickFalse)
4593  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4594  if (wand->images == (Image *) NULL)
4595  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4596  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4597  (index >= wand->images->colors))
4598  {
4599  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4600  "InvalidColormapIndex","`%s'",wand->name);
4601  return(MagickFalse);
4602  }
4603  PixelSetPixelColor(color,wand->images->colormap+index);
4604  return(MagickTrue);
4605 }
4606 ␌
4607 /*
4608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4609 % %
4610 % %
4611 % %
4612 % M a g i c k G e t I m a g e C o l o r s %
4613 % %
4614 % %
4615 % %
4616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4617 %
4618 % MagickGetImageColors() gets the number of unique colors in the image.
4619 %
4620 % The format of the MagickGetImageColors method is:
4621 %
4622 % size_t MagickGetImageColors(MagickWand *wand)
4623 %
4624 % A description of each parameter follows:
4625 %
4626 % o wand: the magick wand.
4627 %
4628 */
4629 WandExport size_t MagickGetImageColors(MagickWand *wand)
4630 {
4631  assert(wand != (MagickWand *) NULL);
4632  assert(wand->signature == MagickWandSignature);
4633  if (wand->debug != MagickFalse)
4634  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4635  if (wand->images == (Image *) NULL)
4636  {
4637  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4638  "ContainsNoImages","`%s'",wand->name);
4639  return(0);
4640  }
4641  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4642 }
4643 ␌
4644 /*
4645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4646 % %
4647 % %
4648 % %
4649 % M a g i c k G e t I m a g e C o l o r s p a c e %
4650 % %
4651 % %
4652 % %
4653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4654 %
4655 % MagickGetImageColorspace() gets the image colorspace.
4656 %
4657 % The format of the MagickGetImageColorspace method is:
4658 %
4659 % ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4660 %
4661 % A description of each parameter follows:
4662 %
4663 % o wand: the magick wand.
4664 %
4665 */
4666 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4667 {
4668  assert(wand != (MagickWand *) NULL);
4669  assert(wand->signature == MagickWandSignature);
4670  if (wand->debug != MagickFalse)
4671  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4672  if (wand->images == (Image *) NULL)
4673  {
4674  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4675  "ContainsNoImages","`%s'",wand->name);
4676  return(UndefinedColorspace);
4677  }
4678  return(wand->images->colorspace);
4679 }
4680 ␌
4681 /*
4682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4683 % %
4684 % %
4685 % %
4686 % M a g i c k G e t I m a g e C o m p o s e %
4687 % %
4688 % %
4689 % %
4690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4691 %
4692 % MagickGetImageCompose() returns the composite operator associated with the
4693 % image.
4694 %
4695 % The format of the MagickGetImageCompose method is:
4696 %
4697 % CompositeOperator MagickGetImageCompose(MagickWand *wand)
4698 %
4699 % A description of each parameter follows:
4700 %
4701 % o wand: the magick wand.
4702 %
4703 */
4704 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4705 {
4706  assert(wand != (MagickWand *) NULL);
4707  assert(wand->signature == MagickWandSignature);
4708  if (wand->debug != MagickFalse)
4709  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4710  if (wand->images == (Image *) NULL)
4711  {
4712  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4713  "ContainsNoImages","`%s'",wand->name);
4714  return(UndefinedCompositeOp);
4715  }
4716  return(wand->images->compose);
4717 }
4718 ␌
4719 /*
4720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4721 % %
4722 % %
4723 % %
4724 % 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 %
4725 % %
4726 % %
4727 % %
4728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4729 %
4730 % MagickGetImageCompression() gets the image compression.
4731 %
4732 % The format of the MagickGetImageCompression method is:
4733 %
4734 % CompressionType MagickGetImageCompression(MagickWand *wand)
4735 %
4736 % A description of each parameter follows:
4737 %
4738 % o wand: the magick wand.
4739 %
4740 */
4741 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4742 {
4743  assert(wand != (MagickWand *) NULL);
4744  assert(wand->signature == MagickWandSignature);
4745  if (wand->debug != MagickFalse)
4746  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4747  if (wand->images == (Image *) NULL)
4748  {
4749  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4750  "ContainsNoImages","`%s'",wand->name);
4751  return(UndefinedCompression);
4752  }
4753  return(wand->images->compression);
4754 }
4755 ␌
4756 /*
4757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4758 % %
4759 % %
4760 % %
4761 % 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 %
4762 % %
4763 % %
4764 % %
4765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4766 %
4767 % MagickGetImageCompressionQuality() gets the image compression quality.
4768 %
4769 % The format of the MagickGetImageCompressionQuality method is:
4770 %
4771 % size_t MagickGetImageCompressionQuality(MagickWand *wand)
4772 %
4773 % A description of each parameter follows:
4774 %
4775 % o wand: the magick wand.
4776 %
4777 */
4778 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4779 {
4780  assert(wand != (MagickWand *) NULL);
4781  assert(wand->signature == MagickWandSignature);
4782  if (wand->debug != MagickFalse)
4783  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4784  if (wand->images == (Image *) NULL)
4785  {
4786  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4787  "ContainsNoImages","`%s'",wand->name);
4788  return(0UL);
4789  }
4790  return(wand->images->quality);
4791 }
4792 ␌
4793 /*
4794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4795 % %
4796 % %
4797 % %
4798 % M a g i c k G e t I m a g e D e l a y %
4799 % %
4800 % %
4801 % %
4802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4803 %
4804 % MagickGetImageDelay() gets the image delay.
4805 %
4806 % The format of the MagickGetImageDelay method is:
4807 %
4808 % size_t MagickGetImageDelay(MagickWand *wand)
4809 %
4810 % A description of each parameter follows:
4811 %
4812 % o wand: the magick wand.
4813 %
4814 */
4815 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4816 {
4817  assert(wand != (MagickWand *) NULL);
4818  assert(wand->signature == MagickWandSignature);
4819  if (wand->debug != MagickFalse)
4820  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4821  if (wand->images == (Image *) NULL)
4822  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4823  return(wand->images->delay);
4824 }
4825 ␌
4826 /*
4827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4828 % %
4829 % %
4830 % %
4831 % M a g i c k G e t I m a g e D e p t h %
4832 % %
4833 % %
4834 % %
4835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4836 %
4837 % MagickGetImageDepth() gets the image depth.
4838 %
4839 % The format of the MagickGetImageDepth method is:
4840 %
4841 % size_t MagickGetImageDepth(MagickWand *wand)
4842 %
4843 % A description of each parameter follows:
4844 %
4845 % o wand: the magick wand.
4846 %
4847 */
4848 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4849 {
4850  assert(wand != (MagickWand *) NULL);
4851  assert(wand->signature == MagickWandSignature);
4852  if (wand->debug != MagickFalse)
4853  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4854  if (wand->images == (Image *) NULL)
4855  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4856  return(wand->images->depth);
4857 }
4858 ␌
4859 /*
4860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4861 % %
4862 % %
4863 % %
4864 % M a g i c k G e t I m a g e D i s p o s e %
4865 % %
4866 % %
4867 % %
4868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4869 %
4870 % MagickGetImageDispose() gets the image disposal method.
4871 %
4872 % The format of the MagickGetImageDispose method is:
4873 %
4874 % DisposeType MagickGetImageDispose(MagickWand *wand)
4875 %
4876 % A description of each parameter follows:
4877 %
4878 % o wand: the magick wand.
4879 %
4880 */
4881 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4882 {
4883  assert(wand != (MagickWand *) NULL);
4884  assert(wand->signature == MagickWandSignature);
4885  if (wand->debug != MagickFalse)
4886  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4887  if (wand->images == (Image *) NULL)
4888  {
4889  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4890  "ContainsNoImages","`%s'",wand->name);
4891  return(UndefinedDispose);
4892  }
4893  return((DisposeType) wand->images->dispose);
4894 }
4895 ␌
4896 /*
4897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4898 % %
4899 % %
4900 % %
4901 % M a g i c k G e t I m a g e D i s t o r t i o n %
4902 % %
4903 % %
4904 % %
4905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4906 %
4907 % MagickGetImageDistortion() compares an image to a reconstructed image and
4908 % returns the specified distortion metric.
4909 %
4910 % The format of the MagickGetImageDistortion method is:
4911 %
4912 % MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4913 % const MagickWand *reference,const MetricType metric,
4914 % double *distortion)
4915 %
4916 % A description of each parameter follows:
4917 %
4918 % o wand: the magick wand.
4919 %
4920 % o reference: the reference wand.
4921 %
4922 % o metric: the metric.
4923 %
4924 % o distortion: the computed distortion between the images.
4925 %
4926 */
4927 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4928  const MagickWand *reference,const MetricType metric,double *distortion)
4929 {
4930  MagickBooleanType
4931  status;
4932 
4933  assert(wand != (MagickWand *) NULL);
4934  assert(wand->signature == MagickWandSignature);
4935  if (wand->debug != MagickFalse)
4936  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4937  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4938  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4939  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4940  wand->exception);
4941  return(status);
4942 }
4943 ␌
4944 /*
4945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4946 % %
4947 % %
4948 % %
4949 % 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 %
4950 % %
4951 % %
4952 % %
4953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4954 %
4955 % MagickGetImageDistortions() compares one or more pixel channels of an
4956 % image to a reconstructed image and returns the specified distortion metrics.
4957 %
4958 % Use MagickRelinquishMemory() to free the metrics when you are done with them.
4959 %
4960 % The format of the MagickGetImageDistortion method is:
4961 %
4962 % double *MagickGetImageDistortion(MagickWand *wand,
4963 % const MagickWand *reference,const MetricType metric)
4964 %
4965 % A description of each parameter follows:
4966 %
4967 % o wand: the magick wand.
4968 %
4969 % o reference: the reference wand.
4970 %
4971 % o metric: the metric.
4972 %
4973 */
4974 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4975  const MagickWand *reference,const MetricType metric)
4976 {
4977  double
4978  *channel_distortion;
4979 
4980  assert(wand != (MagickWand *) NULL);
4981  assert(wand->signature == MagickWandSignature);
4982  if (wand->debug != MagickFalse)
4983  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4984  assert(reference != (MagickWand *) NULL);
4985  assert(reference->signature == MagickWandSignature);
4986  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4987  {
4988  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4989  "ContainsNoImages","`%s'",wand->name);
4990  return((double *) NULL);
4991  }
4992  channel_distortion=GetImageDistortions(wand->images,reference->images,
4993  metric,wand->exception);
4994  return(channel_distortion);
4995 }
4996 ␌
4997 /*
4998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4999 % %
5000 % %
5001 % %
5002 % M a g i c k G e t I m a g e E n d i a n %
5003 % %
5004 % %
5005 % %
5006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5007 %
5008 % MagickGetImageEndian() gets the image endian.
5009 %
5010 % The format of the MagickGetImageEndian method is:
5011 %
5012 % EndianType MagickGetImageEndian(MagickWand *wand)
5013 %
5014 % A description of each parameter follows:
5015 %
5016 % o wand: the magick wand.
5017 %
5018 */
5019 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
5020 {
5021  assert(wand != (MagickWand *) NULL);
5022  assert(wand->signature == MagickWandSignature);
5023  if (wand->debug != MagickFalse)
5024  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5025  if (wand->images == (Image *) NULL)
5026  {
5027  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5028  "ContainsNoImages","`%s'",wand->name);
5029  return(UndefinedEndian);
5030  }
5031  return(wand->images->endian);
5032 }
5033 ␌
5034 /*
5035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5036 % %
5037 % %
5038 % %
5039 % M a g i c k G e t I m a g e F i l e n a m e %
5040 % %
5041 % %
5042 % %
5043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5044 %
5045 % MagickGetImageFilename() returns the filename of a particular image in a
5046 % sequence.
5047 %
5048 % The format of the MagickGetImageFilename method is:
5049 %
5050 % char *MagickGetImageFilename(MagickWand *wand)
5051 %
5052 % A description of each parameter follows:
5053 %
5054 % o wand: the magick wand.
5055 %
5056 */
5057 WandExport char *MagickGetImageFilename(MagickWand *wand)
5058 {
5059  assert(wand != (MagickWand *) NULL);
5060  assert(wand->signature == MagickWandSignature);
5061  if (wand->debug != MagickFalse)
5062  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5063  if (wand->images == (Image *) NULL)
5064  {
5065  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5066  "ContainsNoImages","`%s'",wand->name);
5067  return((char *) NULL);
5068  }
5069  return(AcquireString(wand->images->filename));
5070 }
5071 ␌
5072 /*
5073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5074 % %
5075 % %
5076 % %
5077 % M a g i c k G e t I m a g e F o r m a t %
5078 % %
5079 % %
5080 % %
5081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5082 %
5083 % MagickGetImageFormat() returns the format of a particular image in a
5084 % sequence.
5085 %
5086 % The format of the MagickGetImageFormat method is:
5087 %
5088 % char *MagickGetImageFormat(MagickWand *wand)
5089 %
5090 % A description of each parameter follows:
5091 %
5092 % o wand: the magick wand.
5093 %
5094 */
5095 WandExport char *MagickGetImageFormat(MagickWand *wand)
5096 {
5097  assert(wand != (MagickWand *) NULL);
5098  assert(wand->signature == MagickWandSignature);
5099  if (wand->debug != MagickFalse)
5100  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5101  if (wand->images == (Image *) NULL)
5102  {
5103  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5104  "ContainsNoImages","`%s'",wand->name);
5105  return((char *) NULL);
5106  }
5107  return(AcquireString(wand->images->magick));
5108 }
5109 ␌
5110 /*
5111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5112 % %
5113 % %
5114 % %
5115 % M a g i c k G e t I m a g e F u z z %
5116 % %
5117 % %
5118 % %
5119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5120 %
5121 % MagickGetImageFuzz() gets the image fuzz.
5122 %
5123 % The format of the MagickGetImageFuzz method is:
5124 %
5125 % double MagickGetImageFuzz(MagickWand *wand)
5126 %
5127 % A description of each parameter follows:
5128 %
5129 % o wand: the magick wand.
5130 %
5131 */
5132 WandExport double MagickGetImageFuzz(MagickWand *wand)
5133 {
5134  assert(wand != (MagickWand *) NULL);
5135  assert(wand->signature == MagickWandSignature);
5136  if (wand->debug != MagickFalse)
5137  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5138  if (wand->images == (Image *) NULL)
5139  {
5140  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5141  "ContainsNoImages","`%s'",wand->name);
5142  return(0.0);
5143  }
5144  return(wand->images->fuzz);
5145 }
5146 ␌
5147 /*
5148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5149 % %
5150 % %
5151 % %
5152 % M a g i c k G e t I m a g e G a m m a %
5153 % %
5154 % %
5155 % %
5156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5157 %
5158 % MagickGetImageGamma() gets the image gamma.
5159 %
5160 % The format of the MagickGetImageGamma method is:
5161 %
5162 % double MagickGetImageGamma(MagickWand *wand)
5163 %
5164 % A description of each parameter follows:
5165 %
5166 % o wand: the magick wand.
5167 %
5168 */
5169 WandExport double MagickGetImageGamma(MagickWand *wand)
5170 {
5171  assert(wand != (MagickWand *) NULL);
5172  assert(wand->signature == MagickWandSignature);
5173  if (wand->debug != MagickFalse)
5174  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5175  if (wand->images == (Image *) NULL)
5176  {
5177  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5178  "ContainsNoImages","`%s'",wand->name);
5179  return(0.0);
5180  }
5181  return(wand->images->gamma);
5182 }
5183 ␌
5184 /*
5185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5186 % %
5187 % %
5188 % %
5189 % M a g i c k G e t I m a g e G r a v i t y %
5190 % %
5191 % %
5192 % %
5193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5194 %
5195 % MagickGetImageGravity() gets the image gravity.
5196 %
5197 % The format of the MagickGetImageGravity method is:
5198 %
5199 % GravityType MagickGetImageGravity(MagickWand *wand)
5200 %
5201 % A description of each parameter follows:
5202 %
5203 % o wand: the magick wand.
5204 %
5205 */
5206 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5207 {
5208  assert(wand != (MagickWand *) NULL);
5209  assert(wand->signature == MagickWandSignature);
5210  if (wand->debug != MagickFalse)
5211  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5212  if (wand->images == (Image *) NULL)
5213  {
5214  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5215  "ContainsNoImages","`%s'",wand->name);
5216  return(UndefinedGravity);
5217  }
5218  return(wand->images->gravity);
5219 }
5220 ␌
5221 /*
5222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5223 % %
5224 % %
5225 % %
5226 % 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 %
5227 % %
5228 % %
5229 % %
5230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5231 %
5232 % MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5233 %
5234 % The format of the MagickGetImageGreenPrimary method is:
5235 %
5236 % MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5237 % double *y,double *z)
5238 %
5239 % A description of each parameter follows:
5240 %
5241 % o wand: the magick wand.
5242 %
5243 % o x: the chromaticity green primary x-point.
5244 %
5245 % o y: the chromaticity green primary y-point.
5246 %
5247 % o z: the chromaticity green primary z-point.
5248 %
5249 */
5250 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5251  double *x,double *y,double *z)
5252 {
5253  assert(wand != (MagickWand *) NULL);
5254  assert(wand->signature == MagickWandSignature);
5255  if (wand->debug != MagickFalse)
5256  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5257  if (wand->images == (Image *) NULL)
5258  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5259  *x=wand->images->chromaticity.green_primary.x;
5260  *y=wand->images->chromaticity.green_primary.y;
5261  *z=wand->images->chromaticity.green_primary.z;
5262  return(MagickTrue);
5263 }
5264 ␌
5265 /*
5266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5267 % %
5268 % %
5269 % %
5270 % M a g i c k G e t I m a g e H e i g h t %
5271 % %
5272 % %
5273 % %
5274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5275 %
5276 % MagickGetImageHeight() returns the image height.
5277 %
5278 % The format of the MagickGetImageHeight method is:
5279 %
5280 % size_t MagickGetImageHeight(MagickWand *wand)
5281 %
5282 % A description of each parameter follows:
5283 %
5284 % o wand: the magick wand.
5285 %
5286 */
5287 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5288 {
5289  assert(wand != (MagickWand *) NULL);
5290  assert(wand->signature == MagickWandSignature);
5291  if (wand->debug != MagickFalse)
5292  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5293  if (wand->images == (Image *) NULL)
5294  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5295  return(wand->images->rows);
5296 }
5297 ␌
5298 /*
5299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5300 % %
5301 % %
5302 % %
5303 % M a g i c k G e t I m a g e H i s t o g r a m %
5304 % %
5305 % %
5306 % %
5307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5308 %
5309 % MagickGetImageHistogram() returns the image histogram as an array of
5310 % PixelWand wands.
5311 %
5312 % The format of the MagickGetImageHistogram method is:
5313 %
5314 % PixelWand **MagickGetImageHistogram(MagickWand *wand,
5315 % size_t *number_colors)
5316 %
5317 % A description of each parameter follows:
5318 %
5319 % o wand: the magick wand.
5320 %
5321 % o number_colors: the number of unique colors in the image and the number
5322 % of pixel wands returned.
5323 %
5324 */
5325 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5326  size_t *number_colors)
5327 {
5328  PixelInfo
5329  *histogram;
5330 
5331  PixelWand
5332  **pixel_wands;
5333 
5334  ssize_t
5335  i;
5336 
5337  assert(wand != (MagickWand *) NULL);
5338  assert(wand->signature == MagickWandSignature);
5339  if (wand->debug != MagickFalse)
5340  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5341  if (wand->images == (Image *) NULL)
5342  {
5343  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5344  "ContainsNoImages","`%s'",wand->name);
5345  return((PixelWand **) NULL);
5346  }
5347  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5348  if (histogram == (PixelInfo *) NULL)
5349  return((PixelWand **) NULL);
5350  pixel_wands=NewPixelWands(*number_colors);
5351  for (i=0; i < (ssize_t) *number_colors; i++)
5352  {
5353  PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5354  PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5355  }
5356  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5357  return(pixel_wands);
5358 }
5359 ␌
5360 /*
5361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5362 % %
5363 % %
5364 % %
5365 % 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 %
5366 % %
5367 % %
5368 % %
5369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5370 %
5371 % MagickGetImageInterlaceScheme() gets the image interlace scheme.
5372 %
5373 % The format of the MagickGetImageInterlaceScheme method is:
5374 %
5375 % InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5376 %
5377 % A description of each parameter follows:
5378 %
5379 % o wand: the magick wand.
5380 %
5381 */
5382 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5383 {
5384  assert(wand != (MagickWand *) NULL);
5385  assert(wand->signature == MagickWandSignature);
5386  if (wand->debug != MagickFalse)
5387  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5388  if (wand->images == (Image *) NULL)
5389  {
5390  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5391  "ContainsNoImages","`%s'",wand->name);
5392  return(UndefinedInterlace);
5393  }
5394  return(wand->images->interlace);
5395 }
5396 ␌
5397 /*
5398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5399 % %
5400 % %
5401 % %
5402 % 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 %
5403 % %
5404 % %
5405 % %
5406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5407 %
5408 % MagickGetImageInterpolateMethod() returns the interpolation method for the
5409 % sepcified image.
5410 %
5411 % The format of the MagickGetImageInterpolateMethod method is:
5412 %
5413 % PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5414 %
5415 % A description of each parameter follows:
5416 %
5417 % o wand: the magick wand.
5418 %
5419 */
5420 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5421  MagickWand *wand)
5422 {
5423  assert(wand != (MagickWand *) NULL);
5424  assert(wand->signature == MagickWandSignature);
5425  if (wand->debug != MagickFalse)
5426  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5427  if (wand->images == (Image *) NULL)
5428  {
5429  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5430  "ContainsNoImages","`%s'",wand->name);
5431  return(UndefinedInterpolatePixel);
5432  }
5433  return(wand->images->interpolate);
5434 }
5435 ␌
5436 /*
5437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5438 % %
5439 % %
5440 % %
5441 % M a g i c k G e t I m a g e I t e r a t i o n s %
5442 % %
5443 % %
5444 % %
5445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5446 %
5447 % MagickGetImageIterations() gets the image iterations.
5448 %
5449 % The format of the MagickGetImageIterations method is:
5450 %
5451 % size_t MagickGetImageIterations(MagickWand *wand)
5452 %
5453 % A description of each parameter follows:
5454 %
5455 % o wand: the magick wand.
5456 %
5457 */
5458 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5459 {
5460  assert(wand != (MagickWand *) NULL);
5461  assert(wand->signature == MagickWandSignature);
5462  if (wand->debug != MagickFalse)
5463  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5464  if (wand->images == (Image *) NULL)
5465  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5466  return(wand->images->iterations);
5467 }
5468 ␌
5469 /*
5470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5471 % %
5472 % %
5473 % %
5474 % M a g i c k G e t I m a g e L e n g t h %
5475 % %
5476 % %
5477 % %
5478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5479 %
5480 % MagickGetImageLength() returns the image length in bytes.
5481 %
5482 % The format of the MagickGetImageLength method is:
5483 %
5484 % MagickBooleanType MagickGetImageLength(MagickWand *wand,
5485 % MagickSizeType *length)
5486 %
5487 % A description of each parameter follows:
5488 %
5489 % o wand: the magick wand.
5490 %
5491 % o length: the image length in bytes.
5492 %
5493 */
5494 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5495  MagickSizeType *length)
5496 {
5497  assert(wand != (MagickWand *) NULL);
5498  assert(wand->signature == MagickWandSignature);
5499  if (wand->debug != MagickFalse)
5500  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5501  if (wand->images == (Image *) NULL)
5502  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5503  *length=GetBlobSize(wand->images);
5504  return(MagickTrue);
5505 }
5506 ␌
5507 /*
5508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5509 % %
5510 % %
5511 % %
5512 % M a g i c k G e t I m a g e M a t t e C o l o r %
5513 % %
5514 % %
5515 % %
5516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5517 %
5518 % MagickGetImageMatteColor() returns the image matte color.
5519 %
5520 % The format of the MagickGetImageMatteColor method is:
5521 %
5522 % MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5523 % PixelWand *matte_color)
5524 %
5525 % A description of each parameter follows:
5526 %
5527 % o wand: the magick wand.
5528 %
5529 % o matte_color: return the alpha color.
5530 %
5531 */
5532 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5533  PixelWand *matte_color)
5534 {
5535  assert(wand != (MagickWand *)NULL);
5536  assert(wand->signature == MagickWandSignature);
5537  if (wand->debug != MagickFalse)
5538  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5539  if (wand->images == (Image *)NULL)
5540  ThrowWandException(WandError, "ContainsNoImages", wand->name);
5541  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5542  return(MagickTrue);
5543 }
5544 ␌
5545 /*
5546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5547 % %
5548 % %
5549 % %
5550 % 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 %
5551 % %
5552 % %
5553 % %
5554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5555 %
5556 % MagickGetImageOrientation() returns the image orientation.
5557 %
5558 % The format of the MagickGetImageOrientation method is:
5559 %
5560 % OrientationType MagickGetImageOrientation(MagickWand *wand)
5561 %
5562 % A description of each parameter follows:
5563 %
5564 % o wand: the magick wand.
5565 %
5566 */
5567 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5568 {
5569  assert(wand != (MagickWand *) NULL);
5570  assert(wand->signature == MagickWandSignature);
5571  if (wand->debug != MagickFalse)
5572  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5573  if (wand->images == (Image *) NULL)
5574  {
5575  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5576  "ContainsNoImages","`%s'",wand->name);
5577  return(UndefinedOrientation);
5578  }
5579  return(wand->images->orientation);
5580 }
5581 ␌
5582 /*
5583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5584 % %
5585 % %
5586 % %
5587 % M a g i c k G e t I m a g e P a g e %
5588 % %
5589 % %
5590 % %
5591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5592 %
5593 % MagickGetImagePage() returns the page geometry associated with the image.
5594 %
5595 % The format of the MagickGetImagePage method is:
5596 %
5597 % MagickBooleanType MagickGetImagePage(MagickWand *wand,
5598 % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5599 %
5600 % A description of each parameter follows:
5601 %
5602 % o wand: the magick wand.
5603 %
5604 % o width: the page width.
5605 %
5606 % o height: the page height.
5607 %
5608 % o x: the page x-offset.
5609 %
5610 % o y: the page y-offset.
5611 %
5612 */
5613 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5614  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5615 {
5616  assert(wand != (const MagickWand *) NULL);
5617  assert(wand->signature == MagickWandSignature);
5618  if (wand->debug != MagickFalse)
5619  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5620  if (wand->images == (Image *) NULL)
5621  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5622  *width=wand->images->page.width;
5623  *height=wand->images->page.height;
5624  *x=wand->images->page.x;
5625  *y=wand->images->page.y;
5626  return(MagickTrue);
5627 }
5628 ␌
5629 /*
5630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5631 % %
5632 % %
5633 % %
5634 % M a g i c k G e t I m a g e P i x e l C o l o r %
5635 % %
5636 % %
5637 % %
5638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5639 %
5640 % MagickGetImagePixelColor() gets the color of the specified pixel.
5641 %
5642 % The format of the MagickGetImagePixelColor method is:
5643 %
5644 % MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5645 % const ssize_t x,const ssize_t y,PixelWand *color)
5646 %
5647 % A description of each parameter follows:
5648 %
5649 % o wand: the magick wand.
5650 %
5651 % o x,y: the pixel offset into the image.
5652 %
5653 % o color: Return the colormap color in this wand.
5654 %
5655 */
5656 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5657  const ssize_t x,const ssize_t y,PixelWand *color)
5658 {
5659  const Quantum
5660  *p;
5661 
5662  CacheView
5663  *image_view;
5664 
5665  assert(wand != (MagickWand *) NULL);
5666  assert(wand->signature == MagickWandSignature);
5667  if (wand->debug != MagickFalse)
5668  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5669  if (wand->images == (Image *) NULL)
5670  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5671  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5672  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5673  if (p == (const Quantum *) NULL)
5674  {
5675  image_view=DestroyCacheView(image_view);
5676  return(MagickFalse);
5677  }
5678  PixelSetQuantumPixel(wand->images,p,color);
5679  image_view=DestroyCacheView(image_view);
5680  return(MagickTrue);
5681 }
5682 ␌
5683 /*
5684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5685 % %
5686 % %
5687 % %
5688 % M a g i c k G e t I m a g e R e d P r i m a r y %
5689 % %
5690 % %
5691 % %
5692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5693 %
5694 % MagickGetImageRedPrimary() returns the chromaticy red primary point.
5695 %
5696 % The format of the MagickGetImageRedPrimary method is:
5697 %
5698 % MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5699 % double *y, double *z)
5700 %
5701 % A description of each parameter follows:
5702 %
5703 % o wand: the magick wand.
5704 %
5705 % o x: the chromaticity red primary x-point.
5706 %
5707 % o y: the chromaticity red primary y-point.
5708 %
5709 % o z: the chromaticity red primary z-point.
5710 %
5711 */
5712 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5713  double *x,double *y,double *z)
5714 {
5715  assert(wand != (MagickWand *) NULL);
5716  assert(wand->signature == MagickWandSignature);
5717  if (wand->debug != MagickFalse)
5718  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5719  if (wand->images == (Image *) NULL)
5720  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5721  *x=wand->images->chromaticity.red_primary.x;
5722  *y=wand->images->chromaticity.red_primary.y;
5723  *z=wand->images->chromaticity.red_primary.z;
5724  return(MagickTrue);
5725 }
5726 ␌
5727 /*
5728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5729 % %
5730 % %
5731 % %
5732 % M a g i c k G e t I m a g e R e g i o n %
5733 % %
5734 % %
5735 % %
5736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5737 %
5738 % MagickGetImageRegion() extracts a region of the image and returns it as a
5739 % a new wand.
5740 %
5741 % The format of the MagickGetImageRegion method is:
5742 %
5743 % MagickWand *MagickGetImageRegion(MagickWand *wand,
5744 % const size_t width,const size_t height,const ssize_t x,
5745 % const ssize_t y)
5746 %
5747 % A description of each parameter follows:
5748 %
5749 % o wand: the magick wand.
5750 %
5751 % o width: the region width.
5752 %
5753 % o height: the region height.
5754 %
5755 % o x: the region x offset.
5756 %
5757 % o y: the region y offset.
5758 %
5759 */
5760 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5761  const size_t width,const size_t height,const ssize_t x,
5762  const ssize_t y)
5763 {
5764  Image
5765  *region_image;
5766 
5767  RectangleInfo
5768  region;
5769 
5770  assert(wand != (MagickWand *) NULL);
5771  assert(wand->signature == MagickWandSignature);
5772  if (wand->debug != MagickFalse)
5773  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5774  if (wand->images == (Image *) NULL)
5775  return((MagickWand *) NULL);
5776  region.width=width;
5777  region.height=height;
5778  region.x=x;
5779  region.y=y;
5780  region_image=CropImage(wand->images,&region,wand->exception);
5781  if (region_image == (Image *) NULL)
5782  return((MagickWand *) NULL);
5783  return(CloneMagickWandFromImages(wand,region_image));
5784 }
5785 ␌
5786 /*
5787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5788 % %
5789 % %
5790 % %
5791 % 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 %
5792 % %
5793 % %
5794 % %
5795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5796 %
5797 % MagickGetImageRenderingIntent() gets the image rendering intent.
5798 %
5799 % The format of the MagickGetImageRenderingIntent method is:
5800 %
5801 % RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5802 %
5803 % A description of each parameter follows:
5804 %
5805 % o wand: the magick wand.
5806 %
5807 */
5808 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5809 {
5810  assert(wand != (MagickWand *) NULL);
5811  assert(wand->signature == MagickWandSignature);
5812  if (wand->debug != MagickFalse)
5813  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5814  if (wand->images == (Image *) NULL)
5815  {
5816  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5817  "ContainsNoImages","`%s'",wand->name);
5818  return(UndefinedIntent);
5819  }
5820  return((RenderingIntent) wand->images->rendering_intent);
5821 }
5822 ␌
5823 /*
5824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5825 % %
5826 % %
5827 % %
5828 % M a g i c k G e t I m a g e R e s o l u t i o n %
5829 % %
5830 % %
5831 % %
5832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5833 %
5834 % MagickGetImageResolution() gets the image X and Y resolution.
5835 %
5836 % The format of the MagickGetImageResolution method is:
5837 %
5838 % MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5839 % double *y)
5840 %
5841 % A description of each parameter follows:
5842 %
5843 % o wand: the magick wand.
5844 %
5845 % o x: the image x-resolution.
5846 %
5847 % o y: the image y-resolution.
5848 %
5849 */
5850 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5851  double *x,double *y)
5852 {
5853  assert(wand != (MagickWand *) NULL);
5854  assert(wand->signature == MagickWandSignature);
5855  if (wand->debug != MagickFalse)
5856  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5857  if (wand->images == (Image *) NULL)
5858  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5859  *x=wand->images->resolution.x;
5860  *y=wand->images->resolution.y;
5861  return(MagickTrue);
5862 }
5863 ␌
5864 /*
5865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5866 % %
5867 % %
5868 % %
5869 % M a g i c k G e t I m a g e S c e n e %
5870 % %
5871 % %
5872 % %
5873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5874 %
5875 % MagickGetImageScene() gets the image scene.
5876 %
5877 % The format of the MagickGetImageScene method is:
5878 %
5879 % size_t MagickGetImageScene(MagickWand *wand)
5880 %
5881 % A description of each parameter follows:
5882 %
5883 % o wand: the magick wand.
5884 %
5885 */
5886 WandExport size_t MagickGetImageScene(MagickWand *wand)
5887 {
5888  assert(wand != (MagickWand *) NULL);
5889  assert(wand->signature == MagickWandSignature);
5890  if (wand->debug != MagickFalse)
5891  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5892  if (wand->images == (Image *) NULL)
5893  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5894  return(wand->images->scene);
5895 }
5896 ␌
5897 /*
5898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5899 % %
5900 % %
5901 % %
5902 % M a g i c k G e t I m a g e S i g n a t u r e %
5903 % %
5904 % %
5905 % %
5906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5907 %
5908 % MagickGetImageSignature() generates an SHA-256 message digest for the image
5909 % pixel stream.
5910 %
5911 % The format of the MagickGetImageSignature method is:
5912 %
5913 % char *MagickGetImageSignature(MagickWand *wand)
5914 %
5915 % A description of each parameter follows:
5916 %
5917 % o wand: the magick wand.
5918 %
5919 */
5920 WandExport char *MagickGetImageSignature(MagickWand *wand)
5921 {
5922  const char
5923  *value;
5924 
5925  MagickBooleanType
5926  status;
5927 
5928  assert(wand != (MagickWand *) NULL);
5929  assert(wand->signature == MagickWandSignature);
5930  if (wand->debug != MagickFalse)
5931  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5932  if (wand->images == (Image *) NULL)
5933  {
5934  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5935  "ContainsNoImages","`%s'",wand->name);
5936  return((char *) NULL);
5937  }
5938  status=SignatureImage(wand->images,wand->exception);
5939  if (status == MagickFalse)
5940  return((char *) NULL);
5941  value=GetImageProperty(wand->images,"signature",wand->exception);
5942  if (value == (const char *) NULL)
5943  return((char *) NULL);
5944  return(AcquireString(value));
5945 }
5946 ␌
5947 /*
5948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5949 % %
5950 % %
5951 % %
5952 % 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 %
5953 % %
5954 % %
5955 % %
5956 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5957 %
5958 % MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5959 %
5960 % The format of the MagickGetImageTicksPerSecond method is:
5961 %
5962 % size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5963 %
5964 % A description of each parameter follows:
5965 %
5966 % o wand: the magick wand.
5967 %
5968 */
5969 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5970 {
5971  assert(wand != (MagickWand *) NULL);
5972  assert(wand->signature == MagickWandSignature);
5973  if (wand->debug != MagickFalse)
5974  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5975  if (wand->images == (Image *) NULL)
5976  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5977  return((size_t) wand->images->ticks_per_second);
5978 }
5979 ␌
5980 /*
5981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5982 % %
5983 % %
5984 % %
5985 % M a g i c k G e t I m a g e T y p e %
5986 % %
5987 % %
5988 % %
5989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5990 %
5991 % MagickGetImageType() gets the potential image type:
5992 %
5993 % Bilevel Grayscale GrayscaleMatte
5994 % Palette PaletteMatte TrueColor
5995 % TrueColorMatte ColorSeparation ColorSeparationMatte
5996 %
5997 % The format of the MagickGetImageType method is:
5998 %
5999 % ImageType MagickGetImageType(MagickWand *wand)
6000 %
6001 % A description of each parameter follows:
6002 %
6003 % o wand: the magick wand.
6004 %
6005 */
6006 WandExport ImageType MagickGetImageType(MagickWand *wand)
6007 {
6008  assert(wand != (MagickWand *) NULL);
6009  assert(wand->signature == MagickWandSignature);
6010  if (wand->debug != MagickFalse)
6011  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6012  if (wand->images == (Image *) NULL)
6013  {
6014  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6015  "ContainsNoImages","`%s'",wand->name);
6016  return(UndefinedType);
6017  }
6018  return(GetImageType(wand->images));
6019 }
6020 ␌
6021 /*
6022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6023 % %
6024 % %
6025 % %
6026 % M a g i c k G e t I m a g e U n i t s %
6027 % %
6028 % %
6029 % %
6030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6031 %
6032 % MagickGetImageUnits() gets the image units of resolution.
6033 %
6034 % The format of the MagickGetImageUnits method is:
6035 %
6036 % ResolutionType MagickGetImageUnits(MagickWand *wand)
6037 %
6038 % A description of each parameter follows:
6039 %
6040 % o wand: the magick wand.
6041 %
6042 */
6043 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
6044 {
6045  assert(wand != (MagickWand *) NULL);
6046  assert(wand->signature == MagickWandSignature);
6047  if (wand->debug != MagickFalse)
6048  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6049  if (wand->images == (Image *) NULL)
6050  {
6051  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6052  "ContainsNoImages","`%s'",wand->name);
6053  return(UndefinedResolution);
6054  }
6055  return(wand->images->units);
6056 }
6057 ␌
6058 /*
6059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6060 % %
6061 % %
6062 % %
6063 % M a g i c k G e t I m a g e V i r t u a l P i x e l M e t h o d %
6064 % %
6065 % %
6066 % %
6067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6068 %
6069 % MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6070 % sepcified image.
6071 %
6072 % The format of the MagickGetImageVirtualPixelMethod method is:
6073 %
6074 % VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6075 %
6076 % A description of each parameter follows:
6077 %
6078 % o wand: the magick wand.
6079 %
6080 */
6081 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6082 {
6083  assert(wand != (MagickWand *) NULL);
6084  assert(wand->signature == MagickWandSignature);
6085  if (wand->debug != MagickFalse)
6086  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6087  if (wand->images == (Image *) NULL)
6088  {
6089  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6090  "ContainsNoImages","`%s'",wand->name);
6091  return(UndefinedVirtualPixelMethod);
6092  }
6093  return(GetImageVirtualPixelMethod(wand->images));
6094 }
6095 ␌
6096 /*
6097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6098 % %
6099 % %
6100 % %
6101 % M a g i c k G e t I m a g e W h i t e P o i n t %
6102 % %
6103 % %
6104 % %
6105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6106 %
6107 % MagickGetImageWhitePoint() returns the chromaticy white point.
6108 %
6109 % The format of the MagickGetImageWhitePoint method is:
6110 %
6111 % MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6112 % double *y,double *z)
6113 %
6114 % A description of each parameter follows:
6115 %
6116 % o wand: the magick wand.
6117 %
6118 % o x: the chromaticity white x-point.
6119 %
6120 % o y: the chromaticity white y-point.
6121 %
6122 % o z: the chromaticity white z-point.
6123 %
6124 */
6125 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6126  double *x,double *y,double *z)
6127 {
6128  assert(wand != (MagickWand *) NULL);
6129  assert(wand->signature == MagickWandSignature);
6130  if (wand->debug != MagickFalse)
6131  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6132  if (wand->images == (Image *) NULL)
6133  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6134  *x=wand->images->chromaticity.white_point.x;
6135  *y=wand->images->chromaticity.white_point.y;
6136  *z=wand->images->chromaticity.white_point.z;
6137  return(MagickTrue);
6138 }
6139 ␌
6140 /*
6141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6142 % %
6143 % %
6144 % %
6145 % M a g i c k G e t I m a g e W i d t h %
6146 % %
6147 % %
6148 % %
6149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6150 %
6151 % MagickGetImageWidth() returns the image width.
6152 %
6153 % The format of the MagickGetImageWidth method is:
6154 %
6155 % size_t MagickGetImageWidth(MagickWand *wand)
6156 %
6157 % A description of each parameter follows:
6158 %
6159 % o wand: the magick wand.
6160 %
6161 */
6162 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6163 {
6164  assert(wand != (MagickWand *) NULL);
6165  assert(wand->signature == MagickWandSignature);
6166  if (wand->debug != MagickFalse)
6167  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6168  if (wand->images == (Image *) NULL)
6169  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6170  return(wand->images->columns);
6171 }
6172 ␌
6173 /*
6174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6175 % %
6176 % %
6177 % %
6178 % M a g i c k G e t N u m b e r I m a g e s %
6179 % %
6180 % %
6181 % %
6182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6183 %
6184 % MagickGetNumberImages() returns the number of images associated with a
6185 % magick wand.
6186 %
6187 % The format of the MagickGetNumberImages method is:
6188 %
6189 % size_t MagickGetNumberImages(MagickWand *wand)
6190 %
6191 % A description of each parameter follows:
6192 %
6193 % o wand: the magick wand.
6194 %
6195 */
6196 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6197 {
6198  assert(wand != (MagickWand *) NULL);
6199  assert(wand->signature == MagickWandSignature);
6200  if (wand->debug != MagickFalse)
6201  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6202  return(GetImageListLength(wand->images));
6203 }
6204 ␌
6205 /*
6206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6207 % %
6208 % %
6209 % %
6210 % M a g i c k I m a g e G e t T o t a l I n k D e n s i t y %
6211 % %
6212 % %
6213 % %
6214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6215 %
6216 % MagickGetImageTotalInkDensity() gets the image total ink density.
6217 %
6218 % The format of the MagickGetImageTotalInkDensity method is:
6219 %
6220 % double MagickGetImageTotalInkDensity(MagickWand *wand)
6221 %
6222 % A description of each parameter follows:
6223 %
6224 % o wand: the magick wand.
6225 %
6226 */
6227 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6228 {
6229  assert(wand != (MagickWand *) NULL);
6230  assert(wand->signature == MagickWandSignature);
6231  if (wand->debug != MagickFalse)
6232  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6233  if (wand->images == (Image *) NULL)
6234  {
6235  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6236  "ContainsNoImages","`%s'",wand->name);
6237  return(0.0);
6238  }
6239  return(GetImageTotalInkDensity(wand->images,wand->exception));
6240 }
6241 ␌
6242 /*
6243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6244 % %
6245 % %
6246 % %
6247 % M a g i c k H a l d C l u t I m a g e %
6248 % %
6249 % %
6250 % %
6251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6252 %
6253 % MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6254 % table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
6255 % dimensions. Create it with the HALD coder. You can apply any color
6256 % transformation to the Hald image and then use this method to apply the
6257 % transform to the image.
6258 %
6259 % The format of the MagickHaldClutImage method is:
6260 %
6261 % MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6262 % const MagickWand *hald_wand)
6263 %
6264 % A description of each parameter follows:
6265 %
6266 % o wand: the magick wand.
6267 %
6268 % o hald_image: the hald CLUT image.
6269 %
6270 */
6271 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6272  const MagickWand *hald_wand)
6273 {
6274  MagickBooleanType
6275  status;
6276 
6277  assert(wand != (MagickWand *) NULL);
6278  assert(wand->signature == MagickWandSignature);
6279  if (wand->debug != MagickFalse)
6280  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6281  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6282  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6283  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
6284  return(status);
6285 }
6286 ␌
6287 /*
6288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6289 % %
6290 % %
6291 % %
6292 % M a g i c k H a s N e x t I m a g e %
6293 % %
6294 % %
6295 % %
6296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6297 %
6298 % MagickHasNextImage() returns MagickTrue if the wand has more images when
6299 % traversing the list in the forward direction
6300 %
6301 % The format of the MagickHasNextImage method is:
6302 %
6303 % MagickBooleanType MagickHasNextImage(MagickWand *wand)
6304 %
6305 % A description of each parameter follows:
6306 %
6307 % o wand: the magick wand.
6308 %
6309 */
6310 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6311 {
6312  assert(wand != (MagickWand *) NULL);
6313  assert(wand->signature == MagickWandSignature);
6314  if (wand->debug != MagickFalse)
6315  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6316  if (wand->images == (Image *) NULL)
6317  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6318  if (GetNextImageInList(wand->images) == (Image *) NULL)
6319  return(MagickFalse);
6320  return(MagickTrue);
6321 }
6322 ␌
6323 /*
6324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6325 % %
6326 % %
6327 % %
6328 % M a g i c k H a s P r e v i o u s I m a g e %
6329 % %
6330 % %
6331 % %
6332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6333 %
6334 % MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6335 % traversing the list in the reverse direction
6336 %
6337 % The format of the MagickHasPreviousImage method is:
6338 %
6339 % MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6340 %
6341 % A description of each parameter follows:
6342 %
6343 % o wand: the magick wand.
6344 %
6345 */
6346 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6347 {
6348  assert(wand != (MagickWand *) NULL);
6349  assert(wand->signature == MagickWandSignature);
6350  if (wand->debug != MagickFalse)
6351  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6352  if (wand->images == (Image *) NULL)
6353  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6354  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6355  return(MagickFalse);
6356  return(MagickTrue);
6357 }
6358 ␌
6359 /*
6360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6361 % %
6362 % %
6363 % %
6364 % M a g i c k H o u g h L i n e I m a g e %
6365 % %
6366 % %
6367 % %
6368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6369 %
6370 % MagickHoughLineImage() can be used in conjunction with any binary edge
6371 % extracted image (we recommend Canny) to identify lines in the image. The
6372 % algorithm accumulates counts for every white pixel for every possible
6373 % orientation (for angles from 0 to 179 in 1 degree increments) and distance
6374 % from the center of the image to the corner (in 1 px increments) and stores
6375 % the counts in an accumulator matrix of angle vs distance. The size of the
6376 % accumulator is 180x(diagonal/2). Next it searches this space for peaks in
6377 % counts and converts the locations of the peaks to slope and intercept in the
6378 % normal x,y input image space. Use the slope/intercepts to find the endpoints
6379 % clipped to the bounds of the image. The lines are then drawn. The counts are
6380 % a measure of the length of the lines.
6381 %
6382 % The format of the MagickHoughLineImage method is:
6383 %
6384 % MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6385 % const size_t width,const size_t height,const size_t threshold)
6386 %
6387 % A description of each parameter follows:
6388 %
6389 % o wand: the magick wand.
6390 %
6391 % o width, height: find line pairs as local maxima in this neighborhood.
6392 %
6393 % o threshold: the line count threshold.
6394 %
6395 */
6396 WandExport MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6397  const size_t width,const size_t height,const size_t threshold)
6398 {
6399  Image
6400  *lines_image;
6401 
6402  assert(wand != (MagickWand *) NULL);
6403  assert(wand->signature == MagickWandSignature);
6404  if (wand->debug != MagickFalse)
6405  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6406  if (wand->images == (Image *) NULL)
6407  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6408  lines_image=HoughLineImage(wand->images,width,height,threshold,
6409  wand->exception);
6410  if (lines_image == (Image *) NULL)
6411  return(MagickFalse);
6412  ReplaceImageInList(&wand->images,lines_image);
6413  return(MagickTrue);
6414 }
6415 ␌
6416 /*
6417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6418 % %
6419 % %
6420 % %
6421 % M a g i c k I d e n t i f y I m a g e %
6422 % %
6423 % %
6424 % %
6425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6426 %
6427 % MagickIdentifyImage() identifies an image by printing its attributes to the
6428 % file. Attributes include the image width, height, size, and others.
6429 %
6430 % The format of the MagickIdentifyImage method is:
6431 %
6432 % const char *MagickIdentifyImage(MagickWand *wand)
6433 %
6434 % A description of each parameter follows:
6435 %
6436 % o wand: the magick wand.
6437 %
6438 */
6439 WandExport char *MagickIdentifyImage(MagickWand *wand)
6440 {
6441  char
6442  *description,
6443  filename[MagickPathExtent];
6444 
6445  FILE
6446  *file;
6447 
6448  int
6449  unique_file;
6450 
6451  assert(wand != (MagickWand *) NULL);
6452  assert(wand->signature == MagickWandSignature);
6453  if (wand->debug != MagickFalse)
6454  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6455  if (wand->images == (Image *) NULL)
6456  {
6457  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6458  "ContainsNoImages","`%s'",wand->name);
6459  return((char *) NULL);
6460  }
6461  description=(char *) NULL;
6462  unique_file=AcquireUniqueFileResource(filename);
6463  file=(FILE *) NULL;
6464  if (unique_file != -1)
6465  file=fdopen(unique_file,"wb");
6466  if ((unique_file == -1) || (file == (FILE *) NULL))
6467  {
6468  (void) RelinquishUniqueFileResource(filename);
6469  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6470  "UnableToCreateTemporaryFile","`%s'",wand->name);
6471  return((char *) NULL);
6472  }
6473  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6474  (void) fclose(file);
6475  description=FileToString(filename,~0UL,wand->exception);
6476  (void) RelinquishUniqueFileResource(filename);
6477  return(description);
6478 }
6479 
6480 /*
6481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6482 % %
6483 % %
6484 % %
6485 % M a g i c k I d e n t i f y I m a g e T y p e %
6486 % %
6487 % %
6488 % %
6489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6490 %
6491 % MagickIdentifyImageType() gets the potential image type:
6492 %
6493 % Bilevel Grayscale GrayscaleMatte
6494 % Palette PaletteMatte TrueColor
6495 % TrueColorMatte ColorSeparation ColorSeparationMatte
6496 %
6497 % To ensure the image type matches its potential, use MagickSetImageType():
6498 %
6499 % (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6500 %
6501 % The format of the MagickIdentifyImageType method is:
6502 %
6503 % ImageType MagickIdentifyImageType(MagickWand *wand)
6504 %
6505 % A description of each parameter follows:
6506 %
6507 % o wand: the magick wand.
6508 %
6509 */
6510 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6511 {
6512  assert(wand != (MagickWand *) NULL);
6513  assert(wand->signature == MagickWandSignature);
6514  if (wand->debug != MagickFalse)
6515  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6516  if (wand->images == (Image *) NULL)
6517  {
6518  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6519  "ContainsNoImages","`%s'",wand->name);
6520  return(UndefinedType);
6521  }
6522  return(IdentifyImageType(wand->images,wand->exception));
6523 }
6524 
6525 /*
6526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6527 % %
6528 % %
6529 % %
6530 % M a g i c k I m p l o d e I m a g e %
6531 % %
6532 % %
6533 % %
6534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6535 %
6536 % MagickImplodeImage() creates a new image that is a copy of an existing
6537 % one with the image pixels "implode" by the specified percentage. It
6538 % allocates the memory necessary for the new Image structure and returns a
6539 % pointer to the new image.
6540 %
6541 % The format of the MagickImplodeImage method is:
6542 %
6543 % MagickBooleanType MagickImplodeImage(MagickWand *wand,
6544 % const double radius,const PixelInterpolateMethod method)
6545 %
6546 % A description of each parameter follows:
6547 %
6548 % o wand: the magick wand.
6549 %
6550 % o amount: Define the extent of the implosion.
6551 %
6552 % o method: the pixel interpolation method.
6553 %
6554 */
6555 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6556  const double amount,const PixelInterpolateMethod method)
6557 {
6558  Image
6559  *implode_image;
6560 
6561  assert(wand != (MagickWand *) NULL);
6562  assert(wand->signature == MagickWandSignature);
6563  if (wand->debug != MagickFalse)
6564  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6565  if (wand->images == (Image *) NULL)
6566  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6567  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6568  if (implode_image == (Image *) NULL)
6569  return(MagickFalse);
6570  ReplaceImageInList(&wand->images,implode_image);
6571  return(MagickTrue);
6572 }
6573 ␌
6574 /*
6575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6576 % %
6577 % %
6578 % %
6579 % M a g i c k I m p o r t I m a g e P i x e l s %
6580 % %
6581 % %
6582 % %
6583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6584 %
6585 % MagickImportImagePixels() accepts pixel datand stores it in the image at the
6586 % location you specify. The method returns MagickTrue on success otherwise
6587 % MagickFalse if an error is encountered. The pixel data can be either char,
6588 % short int, int, ssize_t, float, or double in the order specified by map.
6589 %
6590 % Suppose your want to upload the first scanline of a 640x480 image from
6591 % character data in red-green-blue order:
6592 %
6593 % MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6594 %
6595 % The format of the MagickImportImagePixels method is:
6596 %
6597 % MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6598 % const ssize_t x,const ssize_t y,const size_t columns,
6599 % const size_t rows,const char *map,const StorageType storage,
6600 % const void *pixels)
6601 %
6602 % A description of each parameter follows:
6603 %
6604 % o wand: the magick wand.
6605 %
6606 % o x, y, columns, rows: These values define the perimeter of a region
6607 % of pixels you want to define.
6608 %
6609 % o map: This string reflects the expected ordering of the pixel array.
6610 % It can be any combination or order of R = red, G = green, B = blue,
6611 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6612 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6613 % P = pad.
6614 %
6615 % o storage: Define the data type of the pixels. Float and double types are
6616 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
6617 % these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6618 % or DoublePixel.
6619 %
6620 % o pixels: This array of values contain the pixel components as defined by
6621 % map and type. You must preallocate this array where the expected
6622 % length varies depending on the values of width, height, map, and type.
6623 %
6624 */
6625 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6626  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6627  const char *map,const StorageType storage,const void *pixels)
6628 {
6629  MagickBooleanType
6630  status;
6631 
6632  assert(wand != (MagickWand *) NULL);
6633  assert(wand->signature == MagickWandSignature);
6634  if (wand->debug != MagickFalse)
6635  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6636  if (wand->images == (Image *) NULL)
6637  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6638  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6639  wand->exception);
6640  return(status);
6641 }
6642 ␌
6643 /*
6644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6645 % %
6646 % %
6647 % %
6648 % M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e %
6649 % %
6650 % %
6651 % %
6652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6653 %
6654 % MagickInterpolativeResizeImage() resize image using a interpolative
6655 % method.
6656 %
6657 % MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6658 % const size_t columns,const size_t rows,
6659 % const PixelInterpolateMethod method)
6660 %
6661 % A description of each parameter follows:
6662 %
6663 % o wand: the magick wand.
6664 %
6665 % o columns: the number of columns in the scaled image.
6666 %
6667 % o rows: the number of rows in the scaled image.
6668 %
6669 % o interpolate: the pixel interpolation method.
6670 %
6671 */
6672 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6673  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6674 {
6675  Image
6676  *resize_image;
6677 
6678  assert(wand != (MagickWand *) NULL);
6679  assert(wand->signature == MagickWandSignature);
6680  if (wand->debug != MagickFalse)
6681  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6682  if (wand->images == (Image *) NULL)
6683  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6684  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6685  wand->exception);
6686  if (resize_image == (Image *) NULL)
6687  return(MagickFalse);
6688  ReplaceImageInList(&wand->images,resize_image);
6689  return(MagickTrue);
6690 }
6691 ␌
6692 /*
6693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6694 % %
6695 % %
6696 % %
6697 % M a g i c k I n v e r s e F o u r i e r T r a n s f o r m I m a g e %
6698 % %
6699 % %
6700 % %
6701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6702 %
6703 % MagickInverseFourierTransformImage() implements the inverse discrete
6704 % Fourier transform (DFT) of the image either as a magnitude / phase or real /
6705 % imaginary image pair.
6706 %
6707 % The format of the MagickInverseFourierTransformImage method is:
6708 %
6709 % MagickBooleanType MagickInverseFourierTransformImage(
6710 % MagickWand *magnitude_wand,MagickWand *phase_wand,
6711 % const MagickBooleanType magnitude)
6712 %
6713 % A description of each parameter follows:
6714 %
6715 % o magnitude_wand: the magnitude or real wand.
6716 %
6717 % o phase_wand: the phase or imaginary wand.
6718 %
6719 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
6720 % imaginary image pair.
6721 %
6722 */
6723 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6724  MagickWand *magnitude_wand,MagickWand *phase_wand,
6725  const MagickBooleanType magnitude)
6726 {
6727  Image
6728  *inverse_image;
6729 
6730  MagickWand
6731  *wand;
6732 
6733  assert(magnitude_wand != (MagickWand *) NULL);
6734  assert(magnitude_wand->signature == MagickWandSignature);
6735  if (magnitude_wand->debug != MagickFalse)
6736  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6737  magnitude_wand->name);
6738  wand=magnitude_wand;
6739  if (magnitude_wand->images == (Image *) NULL)
6740  ThrowWandException(WandError,"ContainsNoImages",
6741  magnitude_wand->name);
6742  assert(phase_wand != (MagickWand *) NULL);
6743  assert(phase_wand->signature == MagickWandSignature);
6744  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6745  phase_wand->images,magnitude,wand->exception);
6746  if (inverse_image == (Image *) NULL)
6747  return(MagickFalse);
6748  ReplaceImageInList(&wand->images,inverse_image);
6749  return(MagickTrue);
6750 }
6751 ␌
6752 /*
6753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6754 % %
6755 % %
6756 % %
6757 % M a g i c k K m e a n s I m a g e %
6758 % %
6759 % %
6760 % %
6761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6762 %
6763 % MagickKmeansImage() applies k-means color reduction to an image. This is a
6764 % colorspace clustering or segmentation technique.
6765 %
6766 % The format of the MagickKmeansImage method is:
6767 %
6768 % MagickBooleanType MagickKmeansImage(MagickWand *wand,
6769 % const size_t number_colors, const size_t max_iterations,
6770 % const double tolerance)
6771 %
6772 % A description of each parameter follows:
6773 %
6774 % o wand: the magick wand.
6775 %
6776 % o number_colors: number of colors to use as seeds.
6777 %
6778 % o max_iterations: maximum number of iterations while converging.
6779 %
6780 % o tolerance: the maximum tolerance.
6781 %
6782 */
6783 WandExport MagickBooleanType MagickKmeansImage(MagickWand *wand,
6784  const size_t number_colors,const size_t max_iterations,
6785  const double tolerance)
6786 {
6787  MagickBooleanType
6788  status;
6789 
6790  assert(wand != (MagickWand *) NULL);
6791  assert(wand->signature == MagickWandSignature);
6792  if (wand->debug != MagickFalse)
6793  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6794  if (wand->images == (Image *) NULL)
6795  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6796  status=KmeansImage(wand->images,number_colors,max_iterations,tolerance,
6797  wand->exception);
6798  return(status);
6799 }
6800 ␌
6801 /*
6802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6803 % %
6804 % %
6805 % %
6806 % M a g i c k K u w a h a r a I m a g e %
6807 % %
6808 % %
6809 % %
6810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6811 %
6812 % Use MagickKuwaharaImage() is an edge preserving noise reduction filter.
6813 %
6814 % The format of the MagickKuwaharaImage method is:
6815 %
6816 % MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6817 % const double radius,const double sigma)
6818 %
6819 % A description of each parameter follows:
6820 %
6821 % o wand: the magick wand.
6822 %
6823 % o radius: the square window radius.
6824 %
6825 % o sigma: the standard deviation of the Gaussian, in pixels.
6826 %
6827 */
6828 WandExport MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6829  const double radius,const double sigma)
6830 {
6831  Image
6832  *kuwahara_image;
6833 
6834  assert(wand != (MagickWand *) NULL);
6835  assert(wand->signature == MagickWandSignature);
6836  if (wand->debug != MagickFalse)
6837  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6838  if (wand->images == (Image *) NULL)
6839  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6840  kuwahara_image=KuwaharaImage(wand->images,radius,sigma,wand->exception);
6841  if (kuwahara_image == (Image *) NULL)
6842  return(MagickFalse);
6843  ReplaceImageInList(&wand->images,kuwahara_image);
6844  return(MagickTrue);
6845 }
6846 ␌
6847 /*
6848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6849 %