MagickWand  7.1.2-29
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 @ 1999 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/license/ %
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 #include "MagickCore/nt-base-private.h"
56 ␌
57 /*
58  Define declarations.
59 */
60 #define MagickWandId "MagickWand"
61 ␌
62 /*
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 % %
65 % %
66 % %
67 + 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 %
68 % %
69 % %
70 % %
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 %
73 % CloneMagickWandFromImages() clones the magick wand and inserts a new image
74 % list.
75 %
76 % The format of the CloneMagickWandFromImages method is:
77 %
78 % MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
79 % Image *images)
80 %
81 % A description of each parameter follows:
82 %
83 % o wand: the magick wand.
84 %
85 % o images: replace the image list with these image(s).
86 %
87 */
88 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
89  Image *images)
90 {
92  *clone_wand;
93 
94  assert(wand != (MagickWand *) NULL);
95  assert(wand->signature == MagickWandSignature);
96  if (wand->debug != MagickFalse)
97  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
98  clone_wand=(MagickWand *) AcquireCriticalMemory(sizeof(*clone_wand));
99  (void) memset(clone_wand,0,sizeof(*clone_wand));
100  clone_wand->id=AcquireWandId();
101  (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.17g",
102  MagickWandId,(double) clone_wand->id);
103  clone_wand->exception=AcquireExceptionInfo();
104  InheritException(clone_wand->exception,wand->exception);
105  clone_wand->image_info=CloneImageInfo(wand->image_info);
106  clone_wand->images=images;
107  clone_wand->debug=IsEventLogging();
108  clone_wand->signature=MagickWandSignature;
109  if (clone_wand->debug != MagickFalse)
110  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
111  return(clone_wand);
112 }
113 ␌
114 /*
115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
116 % %
117 % %
118 % %
119 % G e t I m a g e F r o m M a g i c k W a n d %
120 % %
121 % %
122 % %
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 %
125 % GetImageFromMagickWand() returns the current image from the magick wand.
126 %
127 % The format of the GetImageFromMagickWand method is:
128 %
129 % Image *GetImageFromMagickWand(const MagickWand *wand)
130 %
131 % A description of each parameter follows:
132 %
133 % o wand: the magick wand.
134 %
135 */
136 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
137 {
138  assert(wand != (MagickWand *) NULL);
139  assert(wand->signature == MagickWandSignature);
140  if (wand->debug != MagickFalse)
141  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
142  if (wand->images == (Image *) NULL)
143  {
144  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
145  "ContainsNoImages","`%s'",wand->name);
146  return((Image *) NULL);
147  }
148  return(wand->images);
149 }
150 ␌
151 /*
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153 % %
154 % %
155 % %
156 % M a g i c k A d a p t i v e B l u r I m a g e %
157 % %
158 % %
159 % %
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %
162 % MagickAdaptiveBlurImage() adaptively blurs the image by blurring
163 % less intensely near image edges and more intensely far from edges. We
164 % blur the image with a Gaussian operator of the given radius and standard
165 % deviation (sigma). For reasonable results, radius should be larger than
166 % sigma. Use a radius of 0 and MagickAdaptiveBlurImage() selects a
167 % suitable radius for you.
168 %
169 % The format of the MagickAdaptiveBlurImage method is:
170 %
171 % MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
172 % const double radius,const double sigma)
173 %
174 % A description of each parameter follows:
175 %
176 % o wand: the magick wand.
177 %
178 % o radius: the radius of the Gaussian, in pixels, not counting the center
179 % pixel.
180 %
181 % o sigma: the standard deviation of the Gaussian, in pixels.
182 %
183 */
184 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
185  const double radius,const double sigma)
186 {
187  Image
188  *sharp_image;
189 
190  assert(wand != (MagickWand *) NULL);
191  assert(wand->signature == MagickWandSignature);
192  if (wand->debug != MagickFalse)
193  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
194  if (wand->images == (Image *) NULL)
195  ThrowWandException(WandError,"ContainsNoImages",wand->name);
196  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
197  if (sharp_image == (Image *) NULL)
198  return(MagickFalse);
199  ReplaceImageInList(&wand->images,sharp_image);
200  return(MagickTrue);
201 }
202 ␌
203 /*
204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
205 % %
206 % %
207 % %
208 % 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 %
209 % %
210 % %
211 % %
212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213 %
214 % MagickAdaptiveResizeImage() adaptively resize image with data dependent
215 % triangulation.
216 %
217 % MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
218 % const size_t columns,const size_t rows)
219 %
220 % A description of each parameter follows:
221 %
222 % o wand: the magick wand.
223 %
224 % o columns: the number of columns in the scaled image.
225 %
226 % o rows: the number of rows in the scaled image.
227 %
228 */
229 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
230  const size_t columns,const size_t rows)
231 {
232  Image
233  *resize_image;
234 
235  assert(wand != (MagickWand *) NULL);
236  assert(wand->signature == MagickWandSignature);
237  if (wand->debug != MagickFalse)
238  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
239  if (wand->images == (Image *) NULL)
240  ThrowWandException(WandError,"ContainsNoImages",wand->name);
241  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
242  if (resize_image == (Image *) NULL)
243  return(MagickFalse);
244  ReplaceImageInList(&wand->images,resize_image);
245  return(MagickTrue);
246 }
247 ␌
248 /*
249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
250 % %
251 % %
252 % %
253 % 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 %
254 % %
255 % %
256 % %
257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258 %
259 % MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
260 % more intensely near image edges and less intensely far from edges. We
261 % sharpen the image with a Gaussian operator of the given radius and standard
262 % deviation (sigma). For reasonable results, radius should be larger than
263 % sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
264 % suitable radius for you.
265 %
266 % The format of the MagickAdaptiveSharpenImage method is:
267 %
268 % MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
269 % const double radius,const double sigma)
270 %
271 % A description of each parameter follows:
272 %
273 % o wand: the magick wand.
274 %
275 % o radius: the radius of the Gaussian, in pixels, not counting the center
276 % pixel.
277 %
278 % o sigma: the standard deviation of the Gaussian, in pixels.
279 %
280 */
281 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
282  const double radius,const double sigma)
283 {
284  Image
285  *sharp_image;
286 
287  assert(wand != (MagickWand *) NULL);
288  assert(wand->signature == MagickWandSignature);
289  if (wand->debug != MagickFalse)
290  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
291  if (wand->images == (Image *) NULL)
292  ThrowWandException(WandError,"ContainsNoImages",wand->name);
293  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
294  if (sharp_image == (Image *) NULL)
295  return(MagickFalse);
296  ReplaceImageInList(&wand->images,sharp_image);
297  return(MagickTrue);
298 }
299 ␌
300 /*
301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
302 % %
303 % %
304 % %
305 % 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 %
306 % %
307 % %
308 % %
309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310 %
311 % MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
312 % based on the range of intensity values in its local neighborhood. This
313 % allows for thresholding of an image whose global intensity histogram
314 % doesn't contain distinctive peaks.
315 %
316 % The format of the AdaptiveThresholdImage method is:
317 %
318 % MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
319 % const size_t width,const size_t height,const double bias)
320 %
321 % A description of each parameter follows:
322 %
323 % o wand: the magick wand.
324 %
325 % o width: the width of the local neighborhood.
326 %
327 % o height: the height of the local neighborhood.
328 %
329 % o offset: the mean bias.
330 %
331 */
332 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
333  const size_t width,const size_t height,const double bias)
334 {
335  Image
336  *threshold_image;
337 
338  assert(wand != (MagickWand *) NULL);
339  assert(wand->signature == MagickWandSignature);
340  if (wand->debug != MagickFalse)
341  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
342  if (wand->images == (Image *) NULL)
343  ThrowWandException(WandError,"ContainsNoImages",wand->name);
344  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
345  wand->exception);
346  if (threshold_image == (Image *) NULL)
347  return(MagickFalse);
348  ReplaceImageInList(&wand->images,threshold_image);
349  return(MagickTrue);
350 }
351 ␌
352 /*
353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
354 % %
355 % %
356 % %
357 % M a g i c k A d d I m a g e %
358 % %
359 % %
360 % %
361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362 %
363 % MagickAddImage() adds a clone of the images from the second wand and
364 % inserts them into the first wand.
365 %
366 % Use MagickSetLastIterator(), to append new images into an existing wand,
367 % current image will be set to last image so later adds with also be
368 % appended to end of wand.
369 %
370 % Use MagickSetFirstIterator() to prepend new images into wand, any more
371 % images added will also be prepended before other images in the wand.
372 % However the order of a list of new images will not change.
373 %
374 % Otherwise the new images will be inserted just after the current image,
375 % and any later image will also be added after this current image but
376 % before the previously added images. Caution is advised when multiple
377 % image adds are inserted into the middle of the wand image list.
378 %
379 % The format of the MagickAddImage method is:
380 %
381 % MagickBooleanType MagickAddImage(MagickWand *wand,
382 % const MagickWand *add_wand)
383 %
384 % A description of each parameter follows:
385 %
386 % o wand: the magick wand.
387 %
388 % o add_wand: A wand that contains the image list to be added
389 %
390 */
391 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
392  Image *images)
393 {
394  if (wand->images == (Image *) NULL)
395  {
396  /*
397  No images in wand, just add them, set current as appropriate.
398  */
399  if (wand->insert_before != MagickFalse)
400  wand->images=GetFirstImageInList(images);
401  else
402  wand->images=GetLastImageInList(images);
403  return(MagickTrue);
404  }
405  if ((wand->insert_before != MagickFalse) &&
406  (wand->images->previous == (Image *) NULL))
407  {
408  /*
409  User jumped to first image, so prepend new images - remain active.
410  */
411  PrependImageToList(&wand->images,images);
412  wand->images=GetFirstImageInList(images);
413  return(MagickTrue);
414  }
415  /*
416  Note you should never have 'insert_before' true when current image is not
417  the first image in the wand! That is no insert before current image, only
418  after current image.
419  */
420  if (wand->images->next == (Image *) NULL)
421  {
422  /*
423  At last image, append new images.
424  */
425  InsertImageInList(&wand->images,images);
426  wand->images=GetLastImageInList(images);
427  return(MagickTrue);
428  }
429  /*
430  Insert new images, just after the current image.
431  */
432  InsertImageInList(&wand->images,images);
433  return(MagickTrue);
434 }
435 
436 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437  const MagickWand *add_wand)
438 {
439  Image
440  *images;
441 
442  assert(wand != (MagickWand *) NULL);
443  assert(wand->signature == MagickWandSignature);
444  if (wand->debug != MagickFalse)
445  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446  assert(add_wand != (MagickWand *) NULL);
447  assert(add_wand->signature == MagickWandSignature);
448  if (add_wand->images == (Image *) NULL)
449  ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
450  /*
451  Clone images in second wand, and insert into first.
452  */
453  images=CloneImageList(add_wand->images,wand->exception);
454  if (images == (Image *) NULL)
455  return(MagickFalse);
456  return(InsertImageInWand(wand,images));
457 }
458 ␌
459 /*
460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461 % %
462 % %
463 % %
464 % M a g i c k A d d N o i s e I m a g e %
465 % %
466 % %
467 % %
468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469 %
470 % MagickAddNoiseImage() adds random noise to the image.
471 %
472 % The format of the MagickAddNoiseImage method is:
473 %
474 % MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
475 % const NoiseType noise_type,const double attenuate)
476 %
477 % A description of each parameter follows:
478 %
479 % o wand: the magick wand.
480 %
481 % o noise_type: The type of noise: Uniform, Gaussian, Multiplicative,
482 % Impulse, Laplacian, or Poisson.
483 %
484 % o attenuate: attenuate the random distribution.
485 %
486 */
487 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
488  const NoiseType noise_type,const double attenuate)
489 {
490  Image
491  *noise_image;
492 
493  assert(wand != (MagickWand *) NULL);
494  assert(wand->signature == MagickWandSignature);
495  if (wand->debug != MagickFalse)
496  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497  if (wand->images == (Image *) NULL)
498  ThrowWandException(WandError,"ContainsNoImages",wand->name);
499  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
500  if (noise_image == (Image *) NULL)
501  return(MagickFalse);
502  ReplaceImageInList(&wand->images,noise_image);
503  return(MagickTrue);
504 }
505 ␌
506 /*
507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508 % %
509 % %
510 % %
511 % M a g i c k A f f i n e T r a n s f o r m I m a g e %
512 % %
513 % %
514 % %
515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516 %
517 % MagickAffineTransformImage() transforms an image as dictated by the affine
518 % matrix of the drawing wand.
519 %
520 % The format of the MagickAffineTransformImage method is:
521 %
522 % MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
523 % const DrawingWand *drawing_wand)
524 %
525 % A description of each parameter follows:
526 %
527 % o wand: the magick wand.
528 %
529 % o drawing_wand: the draw wand.
530 %
531 */
532 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
533  const DrawingWand *drawing_wand)
534 {
535  DrawInfo
536  *draw_info;
537 
538  Image
539  *affine_image;
540 
541  assert(wand != (MagickWand *) NULL);
542  assert(wand->signature == MagickWandSignature);
543  if (wand->debug != MagickFalse)
544  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
545  if (wand->images == (Image *) NULL)
546  ThrowWandException(WandError,"ContainsNoImages",wand->name);
547  draw_info=PeekDrawingWand(drawing_wand);
548  if (draw_info == (DrawInfo *) NULL)
549  return(MagickFalse);
550  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
551  wand->exception);
552  draw_info=DestroyDrawInfo(draw_info);
553  if (affine_image == (Image *) NULL)
554  return(MagickFalse);
555  ReplaceImageInList(&wand->images,affine_image);
556  return(MagickTrue);
557 }
558 ␌
559 /*
560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561 % %
562 % %
563 % %
564 % M a g i c k A n n o t a t e I m a g e %
565 % %
566 % %
567 % %
568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
569 %
570 % MagickAnnotateImage() annotates an image with text.
571 %
572 % The format of the MagickAnnotateImage method is:
573 %
574 % MagickBooleanType MagickAnnotateImage(MagickWand *wand,
575 % const DrawingWand *drawing_wand,const double x,const double y,
576 % const double angle,const char *text)
577 %
578 % A description of each parameter follows:
579 %
580 % o wand: the magick wand.
581 %
582 % o drawing_wand: the draw wand.
583 %
584 % o x: x ordinate to left of text
585 %
586 % o y: y ordinate to text baseline
587 %
588 % o angle: rotate text relative to this angle.
589 %
590 % o text: text to draw
591 %
592 */
593 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594  const DrawingWand *drawing_wand,const double x,const double y,
595  const double angle,const char *text)
596 {
597  char
598  geometry[MagickPathExtent];
599 
600  DrawInfo
601  *draw_info;
602 
603  MagickBooleanType
604  status;
605 
606  assert(wand != (MagickWand *) NULL);
607  assert(wand->signature == MagickWandSignature);
608  if (wand->debug != MagickFalse)
609  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
610  if (wand->images == (Image *) NULL)
611  ThrowWandException(WandError,"ContainsNoImages",wand->name);
612  draw_info=PeekDrawingWand(drawing_wand);
613  if (draw_info == (DrawInfo *) NULL)
614  return(MagickFalse);
615  (void) CloneString(&draw_info->text,text);
616  (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
617  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
618  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
619  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
620  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
621  (void) CloneString(&draw_info->geometry,geometry);
622  status=AnnotateImage(wand->images,draw_info,wand->exception);
623  draw_info=DestroyDrawInfo(draw_info);
624  return(status);
625 }
626 ␌
627 /*
628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629 % %
630 % %
631 % %
632 % M a g i c k A n i m a t e I m a g e s %
633 % %
634 % %
635 % %
636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637 %
638 % MagickAnimateImages() animates an image or image sequence.
639 %
640 % The format of the MagickAnimateImages method is:
641 %
642 % MagickBooleanType MagickAnimateImages(MagickWand *wand,
643 % const char *server_name)
644 %
645 % A description of each parameter follows:
646 %
647 % o wand: the magick wand.
648 %
649 % o server_name: the X server name.
650 %
651 */
652 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653  const char *server_name)
654 {
655  MagickBooleanType
656  status;
657 
658  assert(wand != (MagickWand *) NULL);
659  assert(wand->signature == MagickWandSignature);
660  if (wand->debug != MagickFalse)
661  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662  (void) CloneString(&wand->image_info->server_name,server_name);
663  status=AnimateImages(wand->image_info,wand->images,wand->exception);
664  return(status);
665 }
666 ␌
667 /*
668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669 % %
670 % %
671 % %
672 % M a g i c k A p p e n d I m a g e s %
673 % %
674 % %
675 % %
676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677 %
678 % MagickAppendImages() append the images in a wand from the current image
679 % onwards, creating a new wand with the single image result. This is
680 % affected by the gravity and background settings of the first image.
681 %
682 % Typically you would call either MagickResetIterator() or
683 % MagickSetFirstImage() before calling this function to ensure that all
684 % the images in the wand's image list will be appended together.
685 %
686 % The format of the MagickAppendImages method is:
687 %
688 % MagickWand *MagickAppendImages(MagickWand *wand,
689 % const MagickBooleanType stack)
690 %
691 % A description of each parameter follows:
692 %
693 % o wand: the magick wand.
694 %
695 % o stack: By default, images are stacked left-to-right. Set stack to
696 % MagickTrue to stack them top-to-bottom.
697 %
698 */
699 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
700  const MagickBooleanType stack)
701 {
702  Image
703  *append_image;
704 
705  assert(wand != (MagickWand *) NULL);
706  assert(wand->signature == MagickWandSignature);
707  if (wand->debug != MagickFalse)
708  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
709  if (wand->images == (Image *) NULL)
710  return((MagickWand *) NULL);
711  append_image=AppendImages(wand->images,stack,wand->exception);
712  if (append_image == (Image *) NULL)
713  return((MagickWand *) NULL);
714  return(CloneMagickWandFromImages(wand,append_image));
715 }
716 ␌
717 /*
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 % %
720 % %
721 % %
722 % M a g i c k A u t o G a m m a I m a g e %
723 % %
724 % %
725 % %
726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727 %
728 % MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
729 % image to try make set its gamma appropriately.
730 %
731 % The format of the MagickAutoGammaImage method is:
732 %
733 % MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
734 %
735 % A description of each parameter follows:
736 %
737 % o wand: the magick wand.
738 %
739 */
740 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
741 {
742  MagickBooleanType
743  status;
744 
745  assert(wand != (MagickWand *) NULL);
746  assert(wand->signature == MagickWandSignature);
747  if (wand->debug != MagickFalse)
748  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749  if (wand->images == (Image *) NULL)
750  ThrowWandException(WandError,"ContainsNoImages",wand->name);
751  status=AutoGammaImage(wand->images,wand->exception);
752  return(status);
753 }
754 ␌
755 /*
756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757 % %
758 % %
759 % %
760 % M a g i c k A u t o L e v e l I m a g e %
761 % %
762 % %
763 % %
764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765 %
766 % MagickAutoLevelImage() adjusts the levels of a particular image channel by
767 % scaling the minimum and maximum values to the full quantum range.
768 %
769 % The format of the MagickAutoLevelImage method is:
770 %
771 % MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
772 %
773 % A description of each parameter follows:
774 %
775 % o wand: the magick wand.
776 %
777 */
778 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
779 {
780  MagickBooleanType
781  status;
782 
783  assert(wand != (MagickWand *) NULL);
784  assert(wand->signature == MagickWandSignature);
785  if (wand->debug != MagickFalse)
786  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787  if (wand->images == (Image *) NULL)
788  ThrowWandException(WandError,"ContainsNoImages",wand->name);
789  status=AutoLevelImage(wand->images,wand->exception);
790  return(status);
791 }
792 
793 /*
794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
795 % %
796 % %
797 % %
798 % M a g i c k A u t o O r i e n t I m a g e %
799 % %
800 % %
801 % %
802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803 %
804 % MagickAutoOrientImage() adjusts an image so that its orientation is suitable
805 $ for viewing (i.e. top-left orientation).
806 %
807 % The format of the MagickAutoOrientImage method is:
808 %
809 % MagickBooleanType MagickAutoOrientImage(MagickWand *image)
810 %
811 % A description of each parameter follows:
812 %
813 % o wand: the magick wand.
814 %
815 */
816 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
817 {
818 
819  Image
820  *orient_image;
821 
822  assert(wand != (MagickWand *) NULL);
823  assert(wand->signature == MagickWandSignature);
824  if (wand->debug != MagickFalse)
825  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826  if (wand->images == (Image *) NULL)
827  ThrowWandException(WandError,"ContainsNoImages",wand->name);
828  orient_image=AutoOrientImage(wand->images,wand->images->orientation,
829  wand->exception);
830  if (orient_image == (Image *) NULL)
831  return(MagickFalse);
832  ReplaceImageInList(&wand->images,orient_image);
833  return(MagickTrue);
834 }
835 ␌
836 /*
837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838 % %
839 % %
840 % %
841 % M a g i c k A u t o T h r e s h o l d I m a g e %
842 % %
843 % %
844 % %
845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846 %
847 % MagickAutoThresholdImage() automatically performs image thresholding
848 % dependent on which method you specify.
849 %
850 % The format of the AutoThresholdImage method is:
851 %
852 % MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
853 % const AutoThresholdMethod method)
854 %
855 % A description of each parameter follows:
856 %
857 % o wand: the magick wand.
858 %
859 % o method: choose from KapurThresholdMethod, OTSUThresholdMethod, or
860 % TriangleThresholdMethod.
861 %
862 */
863 WandExport MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
864  const AutoThresholdMethod method)
865 {
866  assert(wand != (MagickWand *) NULL);
867  assert(wand->signature == MagickWandSignature);
868  if (wand->debug != MagickFalse)
869  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
870  if (wand->images == (Image *) NULL)
871  ThrowWandException(WandError,"ContainsNoImages",wand->name);
872  return(AutoThresholdImage(wand->images,method,wand->exception));
873 }
874 ␌
875 /*
876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
877 % %
878 % %
879 % %
880 % M a g i c k B i l a t e r a l B l u r I m a g e %
881 % %
882 % %
883 % %
884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
885 %
886 % MagickBilateralBlurImage() is a non-linear, edge-preserving, and
887 % noise-reducing smoothing filter for images. It replaces the intensity of
888 % each pixel with a weighted average of intensity values from nearby pixels.
889 % This weight is based on a Gaussian distribution. The weights depend not
890 % only on Euclidean distance of pixels, but also on the radiometric
891 % differences (e.g., range differences, such as color intensity, depth
892 % distance, etc.). This preserves sharp edges.
893 %
894 % The format of the MagickBilateralBlurImage method is:
895 %
896 % MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
897 % const double radius,const double sigma,const double intensity_sigma,
898 % const double spatial_sigma)
899 %
900 % A description of each parameter follows:
901 %
902 % o wand: the magick wand.
903 %
904 % o radius: the radius of the Gaussian, in pixels, not counting the center
905 % pixel.
906 %
907 % o sigma: the standard deviation of the , in pixels.
908 %
909 % o intensity_sigma: sigma in the intensity space. A larger value means
910 % that farther colors within the pixel neighborhood (see spatial_sigma)
911 % will be mixed together, resulting in larger areas of semi-equal color.
912 %
913 % o spatial_sigma: sigma in the coordinate space. A larger value means that
914 % farther pixels influence each other as long as their colors are close
915 % enough (see intensity_sigma ). When the neighborhood diameter is greater
916 % than zero, it specifies the neighborhood size regardless of
917 % spatial_sigma. Otherwise, the neighborhood diameter is proportional to
918 % spatial_sigma.
919 %
920 */
921 WandExport MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
922  const double radius,const double sigma,const double intensity_sigma,
923  const double spatial_sigma)
924 {
925  Image
926  *blur_image;
927 
928  assert(wand != (MagickWand *) NULL);
929  assert(wand->signature == MagickWandSignature);
930  if (wand->debug != MagickFalse)
931  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
932  if (wand->images == (Image *) NULL)
933  ThrowWandException(WandError,"ContainsNoImages",wand->name);
934  blur_image=BilateralBlurImage(wand->images,(size_t) radius,(size_t) sigma,
935  intensity_sigma,spatial_sigma,wand->exception);
936  if (blur_image == (Image *) NULL)
937  return(MagickFalse);
938  ReplaceImageInList(&wand->images,blur_image);
939  return(MagickTrue);
940 }
941 ␌
942 /*
943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
944 % %
945 % %
946 % %
947 % 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 %
948 % %
949 % %
950 % %
951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
952 %
953 % MagickBlackThresholdImage() is like MagickThresholdImage() but forces all
954 % pixels below the threshold into black while leaving all pixels above the
955 % threshold unchanged.
956 %
957 % The format of the MagickBlackThresholdImage method is:
958 %
959 % MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
960 % const PixelWand *threshold)
961 %
962 % A description of each parameter follows:
963 %
964 % o wand: the magick wand.
965 %
966 % o threshold: the pixel wand.
967 %
968 */
969 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
970  const PixelWand *threshold)
971 {
972  char
973  thresholds[MagickPathExtent];
974 
975  assert(wand != (MagickWand *) NULL);
976  assert(wand->signature == MagickWandSignature);
977  if (wand->debug != MagickFalse)
978  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
979  if (wand->images == (Image *) NULL)
980  ThrowWandException(WandError,"ContainsNoImages",wand->name);
981  (void) FormatLocaleString(thresholds,MagickPathExtent,
982  "%g" "," "%g" "," "%g" "," "%g",
983  (double) PixelGetRedQuantum(threshold),
984  (double) PixelGetGreenQuantum(threshold),
985  (double) PixelGetBlueQuantum(threshold),
986  (double) PixelGetAlphaQuantum(threshold));
987  return(BlackThresholdImage(wand->images,thresholds,wand->exception));
988 }
989 ␌
990 /*
991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
992 % %
993 % %
994 % %
995 % M a g i c k B l u e S h i f t I m a g e %
996 % %
997 % %
998 % %
999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1000 %
1001 % MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
1002 % nighttime in the moonlight.
1003 %
1004 % The format of the MagickBlueShiftImage method is:
1005 %
1006 % MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
1007 % const double factor)
1008 %
1009 % A description of each parameter follows:
1010 %
1011 % o wand: the magick wand.
1012 %
1013 % o factor: the blue shift factor (default 1.5)
1014 %
1015 */
1016 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
1017  const double factor)
1018 {
1019  Image
1020  *shift_image;
1021 
1022  assert(wand != (MagickWand *) NULL);
1023  assert(wand->signature == MagickWandSignature);
1024  if (wand->debug != MagickFalse)
1025  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1026  if (wand->images == (Image *) NULL)
1027  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1028  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
1029  if (shift_image == (Image *) NULL)
1030  return(MagickFalse);
1031  ReplaceImageInList(&wand->images,shift_image);
1032  return(MagickTrue);
1033 }
1034 ␌
1035 /*
1036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1037 % %
1038 % %
1039 % %
1040 % M a g i c k B l u r I m a g e %
1041 % %
1042 % %
1043 % %
1044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1045 %
1046 % MagickBlurImage() blurs an image. We convolve the image with a
1047 % gaussian operator of the given radius and standard deviation (sigma).
1048 % For reasonable results, the radius should be larger than sigma. Use a
1049 % radius of 0 and BlurImage() selects a suitable radius for you.
1050 %
1051 % The format of the MagickBlurImage method is:
1052 %
1053 % MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
1054 % const double sigma)
1055 %
1056 % A description of each parameter follows:
1057 %
1058 % o wand: the magick wand.
1059 %
1060 % o radius: the radius of the Gaussian, in pixels, not counting the center
1061 % pixel.
1062 %
1063 % o sigma: the standard deviation of the , in pixels.
1064 %
1065 */
1066 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
1067  const double radius,const double sigma)
1068 {
1069  Image
1070  *blur_image;
1071 
1072  assert(wand != (MagickWand *) NULL);
1073  assert(wand->signature == MagickWandSignature);
1074  if (wand->debug != MagickFalse)
1075  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1076  if (wand->images == (Image *) NULL)
1077  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1078  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
1079  if (blur_image == (Image *) NULL)
1080  return(MagickFalse);
1081  ReplaceImageInList(&wand->images,blur_image);
1082  return(MagickTrue);
1083 }
1084 ␌
1085 /*
1086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1087 % %
1088 % %
1089 % %
1090 % M a g i c k B o r d e r I m a g e %
1091 % %
1092 % %
1093 % %
1094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1095 %
1096 % MagickBorderImage() surrounds the image with a border of the color defined
1097 % by the bordercolor pixel wand.
1098 %
1099 % The format of the MagickBorderImage method is:
1100 %
1101 % MagickBooleanType MagickBorderImage(MagickWand *wand,
1102 % const PixelWand *bordercolor,const size_t width,
1103 % const size_t height,const CompositeOperator compose)
1104 %
1105 % A description of each parameter follows:
1106 %
1107 % o wand: the magick wand.
1108 %
1109 % o bordercolor: the border color pixel wand.
1110 %
1111 % o width: the border width.
1112 %
1113 % o height: the border height.
1114 %
1115 % o compose: the composite operator.
1116 %
1117 */
1118 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1119  const PixelWand *bordercolor,const size_t width,const size_t height,
1120  const CompositeOperator compose)
1121 {
1122  Image
1123  *border_image;
1124 
1125  RectangleInfo
1126  border_info;
1127 
1128  assert(wand != (MagickWand *) NULL);
1129  assert(wand->signature == MagickWandSignature);
1130  if (wand->debug != MagickFalse)
1131  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1132  if (wand->images == (Image *) NULL)
1133  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1134  border_info.width=width;
1135  border_info.height=height;
1136  border_info.x=0;
1137  border_info.y=0;
1138  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1139  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1140  if (border_image == (Image *) NULL)
1141  return(MagickFalse);
1142  ReplaceImageInList(&wand->images,border_image);
1143  return(MagickTrue);
1144 }
1145 ␌
1146 /*
1147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1148 % %
1149 % %
1150 % %
1151 % 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 %
1152 % %
1153 % %
1154 % %
1155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1156 %
1157 % Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1158 % of an image. It converts the brightness and contrast parameters into slope
1159 % and intercept and calls a polynomial function to apply to the image.
1160 
1161 %
1162 % The format of the MagickBrightnessContrastImage method is:
1163 %
1164 % MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1165 % const double brightness,const double contrast)
1166 %
1167 % A description of each parameter follows:
1168 %
1169 % o wand: the magick wand.
1170 %
1171 % o brightness: the brightness percent (-100 .. 100).
1172 %
1173 % o contrast: the contrast percent (-100 .. 100).
1174 %
1175 */
1176 WandExport MagickBooleanType MagickBrightnessContrastImage(
1177  MagickWand *wand,const double brightness,const double contrast)
1178 {
1179  MagickBooleanType
1180  status;
1181 
1182  assert(wand != (MagickWand *) NULL);
1183  assert(wand->signature == MagickWandSignature);
1184  if (wand->debug != MagickFalse)
1185  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1186  if (wand->images == (Image *) NULL)
1187  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1188  status=BrightnessContrastImage(wand->images,brightness,contrast,
1189  wand->exception);
1190  return(status);
1191 }
1192 ␌
1193 /*
1194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1195 % %
1196 % %
1197 % %
1198 % M a g i c k C a n n y E d g e I m a g e %
1199 % %
1200 % %
1201 % %
1202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1203 %
1204 % MagickCannyEdgeImage() uses a multi-stage algorithm to detect a wide range of
1205 % edges in images.
1206 %
1207 % The format of the MagickCannyEdgeImage method is:
1208 %
1209 % MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
1210 % const double radius,const double sigma,const double lower_percent,
1211 % const double upper_percent)
1212 %
1213 % A description of each parameter follows:
1214 %
1215 % o wand: the magick wand.
1216 %
1217 % o radius: the radius of the gaussian smoothing filter.
1218 %
1219 % o sigma: the sigma of the gaussian smoothing filter.
1220 %
1221 % o lower_percent: percentage of edge pixels in the lower threshold.
1222 %
1223 % o upper_percent: percentage of edge pixels in the upper threshold.
1224 %
1225 */
1226 WandExport MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
1227  const double radius,const double sigma,const double lower_percent,
1228  const double upper_percent)
1229 {
1230  Image
1231  *edge_image;
1232 
1233  assert(wand != (MagickWand *) NULL);
1234  assert(wand->signature == MagickWandSignature);
1235  if (wand->debug != MagickFalse)
1236  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1237  if (wand->images == (Image *) NULL)
1238  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1239  edge_image=CannyEdgeImage(wand->images,radius,sigma,lower_percent,
1240  upper_percent,wand->exception);
1241  if (edge_image == (Image *) NULL)
1242  return(MagickFalse);
1243  ReplaceImageInList(&wand->images,edge_image);
1244  return(MagickTrue);
1245 }
1246 ␌
1247 /*
1248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1249 % %
1250 % %
1251 % %
1252 % M a g i c k C h a n n e l F x I m a g e %
1253 % %
1254 % %
1255 % %
1256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1257 %
1258 % MagickChannelFxImage() applies a channel expression to the specified image.
1259 % The expression consists of one or more channels, either mnemonic or numeric
1260 % (e.g. red, 1), separated by actions as follows:
1261 %
1262 % <=> exchange two channels (e.g. red<=>blue)
1263 % => transfer a channel to another (e.g. red=>green)
1264 % , separate channel operations (e.g. red, green)
1265 % | read channels from next input image (e.g. red | green)
1266 % ; write channels to next output image (e.g. red; green; blue)
1267 %
1268 % A channel without a operation symbol implies extract. For example, to create
1269 % 3 grayscale images from the red, green, and blue channels of an image, use:
1270 %
1271 % -channel-fx "red; green; blue"
1272 %
1273 % The format of the MagickChannelFxImage method is:
1274 %
1275 % MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1276 %
1277 % A description of each parameter follows:
1278 %
1279 % o wand: the magick wand.
1280 %
1281 % o expression: the expression.
1282 %
1283 */
1284 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1285  const char *expression)
1286 {
1287  Image
1288  *fx_image;
1289 
1290  assert(wand != (MagickWand *) NULL);
1291  assert(wand->signature == MagickWandSignature);
1292  if (wand->debug != MagickFalse)
1293  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1294  if (wand->images == (Image *) NULL)
1295  return((MagickWand *) NULL);
1296  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1297  if (fx_image == (Image *) NULL)
1298  return((MagickWand *) NULL);
1299  return(CloneMagickWandFromImages(wand,fx_image));
1300 }
1301 ␌
1302 /*
1303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1304 % %
1305 % %
1306 % %
1307 % M a g i c k C h a r c o a l I m a g e %
1308 % %
1309 % %
1310 % %
1311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1312 %
1313 % MagickCharcoalImage() simulates a charcoal drawing.
1314 %
1315 % The format of the MagickCharcoalImage method is:
1316 %
1317 % MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1318 % const double radius,const double sigma)
1319 %
1320 % A description of each parameter follows:
1321 %
1322 % o wand: the magick wand.
1323 %
1324 % o radius: the radius of the Gaussian, in pixels, not counting the center
1325 % pixel.
1326 %
1327 % o sigma: the standard deviation of the Gaussian, in pixels.
1328 %
1329 */
1330 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1331  const double radius,const double sigma)
1332 {
1333  Image
1334  *charcoal_image;
1335 
1336  assert(wand != (MagickWand *) NULL);
1337  assert(wand->signature == MagickWandSignature);
1338  if (wand->debug != MagickFalse)
1339  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1340  if (wand->images == (Image *) NULL)
1341  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1342  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1343  if (charcoal_image == (Image *) NULL)
1344  return(MagickFalse);
1345  ReplaceImageInList(&wand->images,charcoal_image);
1346  return(MagickTrue);
1347 }
1348 ␌
1349 /*
1350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1351 % %
1352 % %
1353 % %
1354 % M a g i c k C h o p I m a g e %
1355 % %
1356 % %
1357 % %
1358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1359 %
1360 % MagickChopImage() removes a region of an image and collapses the image to
1361 % occupy the removed portion
1362 %
1363 % The format of the MagickChopImage method is:
1364 %
1365 % MagickBooleanType MagickChopImage(MagickWand *wand,
1366 % const size_t width,const size_t height,const ssize_t x,
1367 % const ssize_t y)
1368 %
1369 % A description of each parameter follows:
1370 %
1371 % o wand: the magick wand.
1372 %
1373 % o width: the region width.
1374 %
1375 % o height: the region height.
1376 %
1377 % o x: the region x offset.
1378 %
1379 % o y: the region y offset.
1380 %
1381 %
1382 */
1383 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1384  const size_t width,const size_t height,const ssize_t x,
1385  const ssize_t y)
1386 {
1387  Image
1388  *chop_image;
1389 
1390  RectangleInfo
1391  chop;
1392 
1393  assert(wand != (MagickWand *) NULL);
1394  assert(wand->signature == MagickWandSignature);
1395  if (wand->debug != MagickFalse)
1396  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1397  if (wand->images == (Image *) NULL)
1398  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1399  chop.width=width;
1400  chop.height=height;
1401  chop.x=x;
1402  chop.y=y;
1403  chop_image=ChopImage(wand->images,&chop,wand->exception);
1404  if (chop_image == (Image *) NULL)
1405  return(MagickFalse);
1406  ReplaceImageInList(&wand->images,chop_image);
1407  return(MagickTrue);
1408 }
1409 ␌
1410 /*
1411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1412 % %
1413 % %
1414 % %
1415 % M a g i c k C L A H E I m a g e %
1416 % %
1417 % %
1418 % %
1419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1420 %
1421 % MagickCLAHEImage() is a variant of adaptive histogram equalization in which
1422 % the contrast amplification is limited, so as to reduce this problem of noise
1423 % amplification.
1424 %
1425 % The format of the CLAHEImage method is:
1426 %
1427 % MagickBooleanType MagickCLAHEImage(MagickWand *wand,const size_t width,
1428 % const size_t height,const double number_bins,const double clip_limit)
1429 %
1430 % A description of each parameter follows:
1431 %
1432 % o wand: the magick wand.
1433 %
1434 % o width: the width of the tile divisions to use in horizontal direction.
1435 %
1436 % o height: the height of the tile divisions to use in vertical direction.
1437 %
1438 % o number_bins: number of bins for histogram ("dynamic range"). Although
1439 % parameter is currently a double, it is cast to size_t internally.
1440 %
1441 % o clip_limit: contrast limit for localised changes in contrast. A limit
1442 % less than 1 results in standard non-contrast limited AHE.
1443 %
1444 */
1445 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand,
1446  const size_t width,const size_t height,const double number_bins,
1447  const double clip_limit)
1448 {
1449  MagickBooleanType
1450  status;
1451 
1452  assert(wand != (MagickWand *) NULL);
1453  assert(wand->signature == MagickWandSignature);
1454  if (wand->debug != MagickFalse)
1455  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1456  if (wand->images == (Image *) NULL)
1457  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1458  status=CLAHEImage(wand->images,width,height,(size_t) number_bins,clip_limit,
1459  wand->exception);
1460  return(status);
1461 }
1462 ␌
1463 /*
1464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1465 % %
1466 % %
1467 % %
1468 % M a g i c k C l a m p I m a g e %
1469 % %
1470 % %
1471 % %
1472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1473 %
1474 % MagickClampImage() restricts the color range from 0 to the quantum depth.
1475 %
1476 % The format of the MagickClampImage method is:
1477 %
1478 % MagickBooleanType MagickClampImage(MagickWand *wand)
1479 %
1480 % A description of each parameter follows:
1481 %
1482 % o wand: the magick wand.
1483 %
1484 % o channel: the channel.
1485 %
1486 */
1487 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1488 {
1489  assert(wand != (MagickWand *) NULL);
1490  assert(wand->signature == MagickWandSignature);
1491  if (wand->debug != MagickFalse)
1492  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1493  if (wand->images == (Image *) NULL)
1494  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1495  return(ClampImage(wand->images,wand->exception));
1496 }
1497 ␌
1498 /*
1499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1500 % %
1501 % %
1502 % %
1503 % M a g i c k C l i p I m a g e %
1504 % %
1505 % %
1506 % %
1507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1508 %
1509 % MagickClipImage() clips along the first path from the 8BIM profile, if
1510 % present.
1511 %
1512 % The format of the MagickClipImage method is:
1513 %
1514 % MagickBooleanType MagickClipImage(MagickWand *wand)
1515 %
1516 % A description of each parameter follows:
1517 %
1518 % o wand: the magick wand.
1519 %
1520 */
1521 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1522 {
1523  MagickBooleanType
1524  status;
1525 
1526  assert(wand != (MagickWand *) NULL);
1527  assert(wand->signature == MagickWandSignature);
1528  if (wand->debug != MagickFalse)
1529  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1530  if (wand->images == (Image *) NULL)
1531  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1532  status=ClipImage(wand->images,wand->exception);
1533  return(status);
1534 }
1535 ␌
1536 /*
1537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1538 % %
1539 % %
1540 % %
1541 % M a g i c k C l i p I m a g e P a t h %
1542 % %
1543 % %
1544 % %
1545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1546 %
1547 % MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1548 % present. Later operations take effect inside the path. Id may be a number
1549 % if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1550 % path.
1551 %
1552 % The format of the MagickClipImagePath method is:
1553 %
1554 % MagickBooleanType MagickClipImagePath(MagickWand *wand,
1555 % const char *pathname,const MagickBooleanType inside)
1556 %
1557 % A description of each parameter follows:
1558 %
1559 % o wand: the magick wand.
1560 %
1561 % o pathname: name of clipping path resource. If name is preceded by #, use
1562 % clipping path numbered by name.
1563 %
1564 % o inside: if non-zero, later operations take effect inside clipping path.
1565 % Otherwise later operations take effect outside clipping path.
1566 %
1567 */
1568 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1569  const char *pathname,const MagickBooleanType inside)
1570 {
1571  MagickBooleanType
1572  status;
1573 
1574  assert(wand != (MagickWand *) NULL);
1575  assert(wand->signature == MagickWandSignature);
1576  if (wand->debug != MagickFalse)
1577  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1578  if (wand->images == (Image *) NULL)
1579  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1580  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1581  return(status);
1582 }
1583 ␌
1584 /*
1585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1586 % %
1587 % %
1588 % %
1589 % M a g i c k C l u t I m a g e %
1590 % %
1591 % %
1592 % %
1593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1594 %
1595 % MagickClutImage() replaces colors in the image from a color lookup table.
1596 %
1597 % The format of the MagickClutImage method is:
1598 %
1599 % MagickBooleanType MagickClutImage(MagickWand *wand,
1600 % const MagickWand *clut_wand,const PixelInterpolateMethod method)
1601 %
1602 % A description of each parameter follows:
1603 %
1604 % o wand: the magick wand.
1605 %
1606 % o clut_image: the clut image.
1607 %
1608 % o method: the pixel interpolation method.
1609 %
1610 */
1611 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1612  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1613 {
1614  MagickBooleanType
1615  status;
1616 
1617  assert(wand != (MagickWand *) NULL);
1618  assert(wand->signature == MagickWandSignature);
1619  if (wand->debug != MagickFalse)
1620  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1621  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1622  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1623  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1624  return(status);
1625 }
1626 ␌
1627 /*
1628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1629 % %
1630 % %
1631 % %
1632 % M a g i c k C o a l e s c e I m a g e s %
1633 % %
1634 % %
1635 % %
1636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1637 %
1638 % MagickCoalesceImages() composites a set of images while respecting any page
1639 % offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1640 % typically start with an image background and each subsequent image
1641 % varies in size and offset. MagickCoalesceImages() returns a new sequence
1642 % where each image in the sequence is the same size as the first and
1643 % composited with the next image in the sequence.
1644 %
1645 % The format of the MagickCoalesceImages method is:
1646 %
1647 % MagickWand *MagickCoalesceImages(MagickWand *wand)
1648 %
1649 % A description of each parameter follows:
1650 %
1651 % o wand: the magick wand.
1652 %
1653 */
1654 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1655 {
1656  Image
1657  *coalesce_image;
1658 
1659  assert(wand != (MagickWand *) NULL);
1660  assert(wand->signature == MagickWandSignature);
1661  if (wand->debug != MagickFalse)
1662  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1663  if (wand->images == (Image *) NULL)
1664  return((MagickWand *) NULL);
1665  coalesce_image=CoalesceImages(wand->images,wand->exception);
1666  if (coalesce_image == (Image *) NULL)
1667  return((MagickWand *) NULL);
1668  return(CloneMagickWandFromImages(wand,coalesce_image));
1669 }
1670 ␌
1671 /*
1672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1673 % %
1674 % %
1675 % %
1676 % M a g i c k C o l o r D e c i s i o n I m a g e %
1677 % %
1678 % %
1679 % %
1680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1681 %
1682 % MagickColorDecisionListImage() accepts a lightweight Color Correction
1683 % Collection (CCC) file which solely contains one or more color corrections
1684 % and applies the color correction to the image. Here is a sample CCC file:
1685 %
1686 % <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1687 % <ColorCorrection id="cc03345">
1688 % <SOPNode>
1689 % <Slope> 0.9 1.2 0.5 </Slope>
1690 % <Offset> 0.4 -0.5 0.6 </Offset>
1691 % <Power> 1.0 0.8 1.5 </Power>
1692 % </SOPNode>
1693 % <SATNode>
1694 % <Saturation> 0.85 </Saturation>
1695 % </SATNode>
1696 % </ColorCorrection>
1697 % </ColorCorrectionCollection>
1698 %
1699 % which includes the offset, slope, and power for each of the RGB channels
1700 % as well as the saturation.
1701 %
1702 % The format of the MagickColorDecisionListImage method is:
1703 %
1704 % MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1705 % const char *color_correction_collection)
1706 %
1707 % A description of each parameter follows:
1708 %
1709 % o wand: the magick wand.
1710 %
1711 % o color_correction_collection: the color correction collection in XML.
1712 %
1713 */
1714 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1715  const char *color_correction_collection)
1716 {
1717  MagickBooleanType
1718  status;
1719 
1720  assert(wand != (MagickWand *) NULL);
1721  assert(wand->signature == MagickWandSignature);
1722  if (wand->debug != MagickFalse)
1723  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1724  if (wand->images == (Image *) NULL)
1725  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1726  status=ColorDecisionListImage(wand->images,color_correction_collection,
1727  wand->exception);
1728  return(status);
1729 }
1730 ␌
1731 /*
1732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1733 % %
1734 % %
1735 % %
1736 % M a g i c k C o l o r i z e I m a g e %
1737 % %
1738 % %
1739 % %
1740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1741 %
1742 % MagickColorizeImage() blends the fill color with each pixel in the image.
1743 %
1744 % The format of the MagickColorizeImage method is:
1745 %
1746 % MagickBooleanType MagickColorizeImage(MagickWand *wand,
1747 % const PixelWand *colorize,const PixelWand *blend)
1748 %
1749 % A description of each parameter follows:
1750 %
1751 % o wand: the magick wand.
1752 %
1753 % o colorize: the colorize pixel wand.
1754 %
1755 % o alpha: the alpha pixel wand.
1756 %
1757 */
1758 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1759  const PixelWand *colorize,const PixelWand *blend)
1760 {
1761  char
1762  percent_blend[MagickPathExtent];
1763 
1764  Image
1765  *colorize_image;
1766 
1767  PixelInfo
1768  target;
1769 
1770  assert(wand != (MagickWand *) NULL);
1771  assert(wand->signature == MagickWandSignature);
1772  if (wand->debug != MagickFalse)
1773  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1774  if (wand->images == (Image *) NULL)
1775  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1776  GetPixelInfo(wand->images,&target);
1777  if (target.colorspace != CMYKColorspace)
1778  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1779  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1780  (double) PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1781  (double) PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1782  (double) PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1783  (double) PixelGetAlphaQuantum(blend)));
1784  else
1785  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1786  "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1787  (double) PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1788  (double) PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1789  (double) PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1790  (double) PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1791  (double) PixelGetAlphaQuantum(blend)));
1792  target=PixelGetPixel(colorize);
1793  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1794  wand->exception);
1795  if (colorize_image == (Image *) NULL)
1796  return(MagickFalse);
1797  ReplaceImageInList(&wand->images,colorize_image);
1798  return(MagickTrue);
1799 }
1800 ␌
1801 /*
1802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1803 % %
1804 % %
1805 % %
1806 % M a g i c k C o l o r M a t r i x I m a g e %
1807 % %
1808 % %
1809 % %
1810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1811 %
1812 % MagickColorMatrixImage() apply color transformation to an image. The method
1813 % permits saturation changes, hue rotation, luminance to alpha, and various
1814 % other effects. Although variable-sized transformation matrices can be used,
1815 % typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1816 % (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1817 % except offsets are in column 6 rather than 5 (in support of CMYKA images)
1818 % and offsets are normalized (divide Flash offset by 255).
1819 %
1820 % The format of the MagickColorMatrixImage method is:
1821 %
1822 % MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1823 % const KernelInfo *color_matrix)
1824 %
1825 % A description of each parameter follows:
1826 %
1827 % o wand: the magick wand.
1828 %
1829 % o color_matrix: the color matrix.
1830 %
1831 */
1832 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1833  const KernelInfo *color_matrix)
1834 {
1835  Image
1836  *color_image;
1837 
1838  assert(wand != (MagickWand *) NULL);
1839  assert(wand->signature == MagickWandSignature);
1840  if (wand->debug != MagickFalse)
1841  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1842  if (color_matrix == (const KernelInfo *) NULL)
1843  return(MagickFalse);
1844  if (wand->images == (Image *) NULL)
1845  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1846  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1847  if (color_image == (Image *) NULL)
1848  return(MagickFalse);
1849  ReplaceImageInList(&wand->images,color_image);
1850  return(MagickTrue);
1851 }
1852 ␌
1853 /*
1854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1855 % %
1856 % %
1857 % %
1858 % 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 %
1859 % %
1860 % %
1861 % %
1862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1863 %
1864 % MagickColorThresholdImage() forces all pixels in the color range to white
1865 % otherwise black.
1866 %
1867 % The format of the MagickColorThresholdImage method is:
1868 %
1869 % MagickBooleanType MagickColorThresholdImage(MagickWand *wand,
1870 % const PixelWand *start_color,const PixelWand *stop_color)
1871 %
1872 % A description of each parameter follows:
1873 %
1874 % o wand: the magick wand.
1875 %
1876 % o start_color: the start color pixel wand.
1877 %
1878 % o stop_color: the stop color pixel wand.
1879 %
1880 */
1881 WandExport MagickBooleanType MagickColorThresholdImage(MagickWand *wand,
1882  const PixelWand *start_color,const PixelWand *stop_color)
1883 {
1884  PixelInfo
1885  start,
1886  stop;
1887 
1888  assert(wand != (MagickWand *) NULL);
1889  assert(wand->signature == MagickWandSignature);
1890  if (wand->debug != MagickFalse)
1891  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1892  if (wand->images == (Image *) NULL)
1893  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1894  PixelGetMagickColor(start_color,&start);
1895  PixelGetMagickColor(stop_color,&stop);
1896  return(ColorThresholdImage(wand->images,&start,&stop,wand->exception));
1897 }
1898 ␌
1899 /*
1900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901 % %
1902 % %
1903 % %
1904 % M a g i c k C o m b i n e I m a g e s %
1905 % %
1906 % %
1907 % %
1908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1909 %
1910 % MagickCombineImages() combines one or more images into a single image. The
1911 % grayscale value of the pixels of each image in the sequence is assigned in
1912 % order to the specified channels of the combined image. The typical
1913 % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1914 %
1915 % The format of the MagickCombineImages method is:
1916 %
1917 % MagickWand *MagickCombineImages(MagickWand *wand,
1918 % const ColorspaceType colorspace)
1919 %
1920 % A description of each parameter follows:
1921 %
1922 % o wand: the magick wand.
1923 %
1924 % o colorspace: the colorspace.
1925 %
1926 */
1927 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1928  const ColorspaceType colorspace)
1929 {
1930  Image
1931  *combine_image;
1932 
1933  assert(wand != (MagickWand *) NULL);
1934  assert(wand->signature == MagickWandSignature);
1935  if (wand->debug != MagickFalse)
1936  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1937  if (wand->images == (Image *) NULL)
1938  return((MagickWand *) NULL);
1939  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1940  if (combine_image == (Image *) NULL)
1941  return((MagickWand *) NULL);
1942  return(CloneMagickWandFromImages(wand,combine_image));
1943 }
1944 ␌
1945 /*
1946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1947 % %
1948 % %
1949 % %
1950 % M a g i c k C o m m e n t I m a g e %
1951 % %
1952 % %
1953 % %
1954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1955 %
1956 % MagickCommentImage() adds a comment to your image.
1957 %
1958 % The format of the MagickCommentImage method is:
1959 %
1960 % MagickBooleanType MagickCommentImage(MagickWand *wand,
1961 % const char *comment)
1962 %
1963 % A description of each parameter follows:
1964 %
1965 % o wand: the magick wand.
1966 %
1967 % o comment: the image comment.
1968 %
1969 */
1970 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1971  const char *comment)
1972 {
1973  MagickBooleanType
1974  status;
1975 
1976  assert(wand != (MagickWand *) NULL);
1977  assert(wand->signature == MagickWandSignature);
1978  if (wand->debug != MagickFalse)
1979  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1980  if (wand->images == (Image *) NULL)
1981  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1982  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1983  return(status);
1984 }
1985 ␌
1986 /*
1987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1988 % %
1989 % %
1990 % %
1991 % M a g i c k C o m p a r e I m a g e L a y e r s %
1992 % %
1993 % %
1994 % %
1995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1996 %
1997 % MagickCompareImagesLayers() compares each image with the next in a sequence
1998 % and returns the maximum bounding region of any pixel differences it
1999 % discovers.
2000 %
2001 % The format of the MagickCompareImagesLayers method is:
2002 %
2003 % MagickWand *MagickCompareImagesLayers(MagickWand *wand,
2004 % const LayerMethod method)
2005 %
2006 % A description of each parameter follows:
2007 %
2008 % o wand: the magick wand.
2009 %
2010 % o method: the compare method.
2011 %
2012 */
2013 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
2014  const LayerMethod method)
2015 {
2016  Image
2017  *layers_image;
2018 
2019  assert(wand != (MagickWand *) NULL);
2020  assert(wand->signature == MagickWandSignature);
2021  if (wand->debug != MagickFalse)
2022  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2023  if (wand->images == (Image *) NULL)
2024  return((MagickWand *) NULL);
2025  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
2026  if (layers_image == (Image *) NULL)
2027  return((MagickWand *) NULL);
2028  return(CloneMagickWandFromImages(wand,layers_image));
2029 }
2030 ␌
2031 /*
2032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2033 % %
2034 % %
2035 % %
2036 % M a g i c k C o m p a r e I m a g e s %
2037 % %
2038 % %
2039 % %
2040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2041 %
2042 % MagickCompareImages() compares an image to a reconstructed image and returns
2043 % the specified difference image.
2044 %
2045 % The format of the MagickCompareImages method is:
2046 %
2047 % MagickWand *MagickCompareImages(MagickWand *wand,
2048 % const MagickWand *reference,const MetricType metric,
2049 % double *distortion)
2050 %
2051 % A description of each parameter follows:
2052 %
2053 % o wand: the magick wand.
2054 %
2055 % o reference: the reference wand.
2056 %
2057 % o metric: the metric.
2058 %
2059 % o distortion: the computed distortion between the images.
2060 %
2061 */
2062 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
2063  const MagickWand *reference,const MetricType metric,double *distortion)
2064 {
2065  Image
2066  *compare_image;
2067 
2068 
2069  assert(wand != (MagickWand *) NULL);
2070  assert(wand->signature == MagickWandSignature);
2071  if (wand->debug != MagickFalse)
2072  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2073  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
2074  {
2075  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
2076  "ContainsNoImages","`%s'",wand->name);
2077  return((MagickWand *) NULL);
2078  }
2079  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
2080  wand->exception);
2081  if (compare_image == (Image *) NULL)
2082  return((MagickWand *) NULL);
2083  return(CloneMagickWandFromImages(wand,compare_image));
2084 }
2085 ␌
2086 /*
2087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2088 % %
2089 % %
2090 % %
2091 % M a g i c k C o m p l e x I m a g e s %
2092 % %
2093 % %
2094 % %
2095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2096 %
2097 % MagickComplexImages() performs complex mathematics on an image sequence.
2098 %
2099 % The format of the MagickComplexImages method is:
2100 %
2101 % MagickWand *MagickComplexImages(MagickWand *wand,
2102 % const ComplexOperator op)
2103 %
2104 % A description of each parameter follows:
2105 %
2106 % o wand: the magick wand.
2107 %
2108 % o op: A complex operator. Choose from AddComplexOperator,
2109 % ConjugateComplexOperator,DivideComplexOperator,
2110 % MagnitudePhaseComplexOperator,MultiplyComplexOperator,
2111 % RealImaginaryComplexOperator, SubtractComplexOperator.
2112 %
2113 */
2114 WandExport MagickWand *MagickComplexImages(MagickWand *wand,
2115  const ComplexOperator op)
2116 {
2117  Image
2118  *complex_image;
2119 
2120  assert(wand != (MagickWand *) NULL);
2121  assert(wand->signature == MagickWandSignature);
2122  if (wand->debug != MagickFalse)
2123  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2124  if (wand->images == (Image *) NULL)
2125  return((MagickWand *) NULL);
2126  complex_image=ComplexImages(wand->images,op,wand->exception);
2127  if (complex_image == (Image *) NULL)
2128  return((MagickWand *) NULL);
2129  return(CloneMagickWandFromImages(wand,complex_image));
2130 }
2131 ␌
2132 /*
2133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2134 % %
2135 % %
2136 % %
2137 % M a g i c k C o m p o s i t e I m a g e %
2138 % %
2139 % %
2140 % %
2141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2142 %
2143 % MagickCompositeImage() composite one image onto another at the specified
2144 % offset.
2145 %
2146 % The format of the MagickCompositeImage method is:
2147 %
2148 % MagickBooleanType MagickCompositeImage(MagickWand *wand,
2149 % const MagickWand *source_wand,const CompositeOperator compose,
2150 % const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2151 %
2152 % A description of each parameter follows:
2153 %
2154 % o wand: the magick wand holding the destination images
2155 %
2156 % o source_image: the magick wand holding source image.
2157 %
2158 % o compose: This operator affects how the composite is applied to the
2159 % image. The default is Over. These are some of the compose methods
2160 % available.
2161 %
2162 % OverCompositeOp InCompositeOp OutCompositeOp
2163 % AtopCompositeOp XorCompositeOp PlusCompositeOp
2164 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
2165 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
2166 % DisplaceCompositeOp
2167 %
2168 % o clip_to_self: set to MagickTrue to limit composition to area composed.
2169 %
2170 % o x: the column offset of the composited image.
2171 %
2172 % o y: the row offset of the composited image.
2173 %
2174 */
2175 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
2176  const MagickWand *source_wand,const CompositeOperator compose,
2177  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2178 {
2179  MagickBooleanType
2180  status;
2181 
2182  assert(wand != (MagickWand *) NULL);
2183  assert(wand->signature == MagickWandSignature);
2184  if (wand->debug != MagickFalse)
2185  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2186  if ((wand->images == (Image *) NULL) ||
2187  (source_wand->images == (Image *) NULL))
2188  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2189  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
2190  x,y,wand->exception);
2191  return(status);
2192 }
2193 ␌
2194 /*
2195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2196 % %
2197 % %
2198 % %
2199 % 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 %
2200 % %
2201 % %
2202 % %
2203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2204 %
2205 % MagickCompositeImageGravity() composite one image onto another using the
2206 % specified gravity.
2207 %
2208 % The format of the MagickCompositeImageGravity method is:
2209 %
2210 % MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2211 % const MagickWand *source_wand,const CompositeOperator compose,
2212 % const GravityType gravity)
2213 %
2214 % A description of each parameter follows:
2215 %
2216 % o wand: the magick wand holding the destination images
2217 %
2218 % o source_image: the magick wand holding source image.
2219 %
2220 % o compose: This operator affects how the composite is applied to the
2221 % image. The default is Over. These are some of the compose methods
2222 % available.
2223 %
2224 % OverCompositeOp InCompositeOp OutCompositeOp
2225 % AtopCompositeOp XorCompositeOp PlusCompositeOp
2226 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
2227 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
2228 % DisplaceCompositeOp
2229 %
2230 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
2231 % NorthEastGravity, WestGravity, CenterGravity,
2232 % EastGravity, SouthWestGravity, SouthGravity,
2233 % SouthEastGravity)
2234 %
2235 */
2236 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2237  const MagickWand *source_wand,const CompositeOperator compose,
2238  const GravityType gravity)
2239 {
2240  MagickBooleanType
2241  status;
2242 
2243  RectangleInfo
2244  geometry;
2245 
2246  assert(wand != (MagickWand *) NULL);
2247  assert(wand->signature == MagickWandSignature);
2248  if (wand->debug != MagickFalse)
2249  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2250  if ((wand->images == (Image *) NULL) ||
2251  (source_wand->images == (Image *) NULL))
2252  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2253  SetGeometry(source_wand->images,&geometry);
2254  GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
2255  &geometry);
2256  status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
2257  geometry.x,geometry.y,wand->exception);
2258  return(status);
2259 }
2260 ␌
2261 /*
2262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2263 % %
2264 % %
2265 % %
2266 % M a g i c k C o m p o s i t e L a y e r s %
2267 % %
2268 % %
2269 % %
2270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2271 %
2272 % MagickCompositeLayers() composite the images in the source wand over the
2273 % images in the destination wand in sequence, starting with the current
2274 % image in both lists.
2275 %
2276 % Each layer from the two image lists are composted together until the end of
2277 % one of the image lists is reached. The offset of each composition is also
2278 % adjusted to match the virtual canvas offsets of each layer. As such the
2279 % given offset is relative to the virtual canvas, and not the actual image.
2280 %
2281 % Composition uses given x and y offsets, as the 'origin' location of the
2282 % source images virtual canvas (not the real image) allowing you to compose a
2283 % list of 'layer images' into the destination images. This makes it well
2284 % suitable for directly composing 'Clears Frame Animations' or 'Coalesced
2285 % Animations' onto a static or other 'Coalesced Animation' destination image
2286 % list. GIF disposal handling is not looked at.
2287 %
2288 % Special case:- If one of the image sequences is the last image (just a
2289 % single image remaining), that image is repeatedly composed with all the
2290 % images in the other image list. Either the source or destination lists may
2291 % be the single image, for this situation.
2292 %
2293 % In the case of a single destination image (or last image given), that image
2294 % will ve cloned to match the number of images remaining in the source image
2295 % list.
2296 %
2297 % This is equivalent to the "-layer Composite" Shell API operator.
2298 %
2299 % The format of the MagickCompositeLayers method is:
2300 %
2301 % MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2302 % const MagickWand *source_wand, const CompositeOperator compose,
2303 % const ssize_t x,const ssize_t y)
2304 %
2305 % A description of each parameter follows:
2306 %
2307 % o wand: the magick wand holding destination images
2308 %
2309 % o source_wand: the wand holding the source images
2310 %
2311 % o compose, x, y: composition arguments
2312 %
2313 */
2314 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2315  const MagickWand *source_wand,const CompositeOperator compose,
2316  const ssize_t x,const ssize_t y)
2317 {
2318  MagickBooleanType
2319  status;
2320 
2321  assert(wand != (MagickWand *) NULL);
2322  assert(wand->signature == MagickWandSignature);
2323  if (wand->debug != MagickFalse)
2324  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2325  if ((wand->images == (Image *) NULL) ||
2326  (source_wand->images == (Image *) NULL))
2327  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2328  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2329  status=MagickTrue; /* FUTURE: determine status from exceptions */
2330  return(status);
2331 }
2332 ␌
2333 /*
2334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2335 % %
2336 % %
2337 % %
2338 % 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 %
2339 % %
2340 % %
2341 % %
2342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2343 %
2344 % MagickConnectedComponentsImage() returns the connected-components of the
2345 % image uniquely labeled. The returned connected components image colors
2346 % member defines the number of unique objects. Choose from 4 or 8-way
2347 % connectivity.
2348 %
2349 % The format of the MagickConnectedComponentsImage method is:
2350 %
2351 % MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2352 % const size_t connectivity,CCObjectInfo **objects)
2353 %
2354 % A description of each parameter follows:
2355 %
2356 % o wand: the magick wand.
2357 %
2358 % o connectivity: how many neighbors to visit, choose from 4 or 8.
2359 %
2360 % o objects: return the attributes of each unique object.
2361 %
2362 */
2363 WandExport MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2364  const size_t connectivity,CCObjectInfo **objects)
2365 {
2366  Image
2367  *connected_components_image;
2368 
2369  assert(wand != (MagickWand *) NULL);
2370  assert(wand->signature == MagickWandSignature);
2371  if (wand->debug != MagickFalse)
2372  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2373  if (wand->images == (Image *) NULL)
2374  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2375  connected_components_image=ConnectedComponentsImage(wand->images,connectivity,
2376  objects,wand->exception);
2377  if (connected_components_image == (Image *) NULL)
2378  return(MagickFalse);
2379  ReplaceImageInList(&wand->images,connected_components_image);
2380  return(MagickTrue);
2381 }
2382 ␌
2383 /*
2384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2385 % %
2386 % %
2387 % %
2388 % M a g i c k C o n t r a s t I m a g e %
2389 % %
2390 % %
2391 % %
2392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2393 %
2394 % MagickContrastImage() enhances the intensity differences between the lighter
2395 % and darker elements of the image. Set sharpen to a value other than 0 to
2396 % increase the image contrast otherwise the contrast is reduced.
2397 %
2398 % The format of the MagickContrastImage method is:
2399 %
2400 % MagickBooleanType MagickContrastImage(MagickWand *wand,
2401 % const MagickBooleanType sharpen)
2402 %
2403 % A description of each parameter follows:
2404 %
2405 % o wand: the magick wand.
2406 %
2407 % o sharpen: Increase or decrease image contrast.
2408 %
2409 %
2410 */
2411 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2412  const MagickBooleanType sharpen)
2413 {
2414  MagickBooleanType
2415  status;
2416 
2417  assert(wand != (MagickWand *) NULL);
2418  assert(wand->signature == MagickWandSignature);
2419  if (wand->debug != MagickFalse)
2420  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2421  if (wand->images == (Image *) NULL)
2422  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2423  status=ContrastImage(wand->images,sharpen,wand->exception);
2424  return(status);
2425 }
2426 ␌
2427 /*
2428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2429 % %
2430 % %
2431 % %
2432 % 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 %
2433 % %
2434 % %
2435 % %
2436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2437 %
2438 % MagickContrastStretchImage() enhances the contrast of a color image by
2439 % adjusting the pixels color to span the entire range of colors available.
2440 % You can also reduce the influence of a particular channel with a gamma
2441 % value of 0.
2442 %
2443 % The format of the MagickContrastStretchImage method is:
2444 %
2445 % MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2446 % const double black_point,const double white_point)
2447 %
2448 % A description of each parameter follows:
2449 %
2450 % o wand: the magick wand.
2451 %
2452 % o black_point: the black point.
2453 %
2454 % o white_point: the white point.
2455 %
2456 */
2457 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2458  const double black_point,const double white_point)
2459 {
2460  MagickBooleanType
2461  status;
2462 
2463  assert(wand != (MagickWand *) NULL);
2464  assert(wand->signature == MagickWandSignature);
2465  if (wand->debug != MagickFalse)
2466  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2467  if (wand->images == (Image *) NULL)
2468  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2469  status=ContrastStretchImage(wand->images,black_point,white_point,
2470  wand->exception);
2471  return(status);
2472 }
2473 ␌
2474 /*
2475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2476 % %
2477 % %
2478 % %
2479 % M a g i c k C o n v o l v e I m a g e %
2480 % %
2481 % %
2482 % %
2483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2484 %
2485 % MagickConvolveImage() applies a custom convolution kernel to the image.
2486 %
2487 % The format of the MagickConvolveImage method is:
2488 %
2489 % MagickBooleanType MagickConvolveImage(MagickWand *wand,
2490 % const KernelInfo *kernel)
2491 %
2492 % A description of each parameter follows:
2493 %
2494 % o wand: the magick wand.
2495 %
2496 % o kernel: An array of doubles representing the convolution kernel.
2497 %
2498 */
2499 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2500  const KernelInfo *kernel)
2501 {
2502  Image
2503  *filter_image;
2504 
2505  assert(wand != (MagickWand *) NULL);
2506  assert(wand->signature == MagickWandSignature);
2507  if (wand->debug != MagickFalse)
2508  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2509  if (kernel == (const KernelInfo *) NULL)
2510  return(MagickFalse);
2511  if (wand->images == (Image *) NULL)
2512  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2513  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2514  if (filter_image == (Image *) NULL)
2515  return(MagickFalse);
2516  ReplaceImageInList(&wand->images,filter_image);
2517  return(MagickTrue);
2518 }
2519 ␌
2520 /*
2521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2522 % %
2523 % %
2524 % %
2525 % M a g i c k C r o p I m a g e %
2526 % %
2527 % %
2528 % %
2529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2530 %
2531 % MagickCropImage() extracts a region of the image.
2532 %
2533 % The format of the MagickCropImage method is:
2534 %
2535 % MagickBooleanType MagickCropImage(MagickWand *wand,
2536 % const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2537 %
2538 % A description of each parameter follows:
2539 %
2540 % o wand: the magick wand.
2541 %
2542 % o width: the region width.
2543 %
2544 % o height: the region height.
2545 %
2546 % o x: the region x-offset.
2547 %
2548 % o y: the region y-offset.
2549 %
2550 */
2551 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2552  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2553 {
2554  Image
2555  *crop_image;
2556 
2557  RectangleInfo
2558  crop;
2559 
2560  assert(wand != (MagickWand *) NULL);
2561  assert(wand->signature == MagickWandSignature);
2562  if (wand->debug != MagickFalse)
2563  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2564  if (wand->images == (Image *) NULL)
2565  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2566  crop.width=width;
2567  crop.height=height;
2568  crop.x=x;
2569  crop.y=y;
2570  crop_image=CropImage(wand->images,&crop,wand->exception);
2571  if (crop_image == (Image *) NULL)
2572  return(MagickFalse);
2573  ReplaceImageInList(&wand->images,crop_image);
2574  return(MagickTrue);
2575 }
2576 ␌
2577 /*
2578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2579 % %
2580 % %
2581 % %
2582 % M a g i c k C y c l e C o l o r m a p I m a g e %
2583 % %
2584 % %
2585 % %
2586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2587 %
2588 % MagickCycleColormapImage() displaces an image's colormap by a given number
2589 % of positions. If you cycle the colormap a number of times you can produce
2590 % a psychodelic effect.
2591 %
2592 % The format of the MagickCycleColormapImage method is:
2593 %
2594 % MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2595 % const ssize_t displace)
2596 %
2597 % A description of each parameter follows:
2598 %
2599 % o wand: the magick wand.
2600 %
2601 % o pixel_wand: the pixel wand.
2602 %
2603 */
2604 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2605  const ssize_t displace)
2606 {
2607  MagickBooleanType
2608  status;
2609 
2610  assert(wand != (MagickWand *) NULL);
2611  assert(wand->signature == MagickWandSignature);
2612  if (wand->debug != MagickFalse)
2613  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2614  if (wand->images == (Image *) NULL)
2615  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2616  status=CycleColormapImage(wand->images,displace,wand->exception);
2617  return(status);
2618 }
2619 ␌
2620 /*
2621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2622 % %
2623 % %
2624 % %
2625 % M a g i c k C o n s t i t u t e I m a g e %
2626 % %
2627 % %
2628 % %
2629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2630 %
2631 % MagickConstituteImage() adds an image to the wand comprised of the pixel
2632 % data you supply. The pixel data must be in scanline order top-to-bottom.
2633 % The data can be char, short int, int, float, or double. Float and double
2634 % require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2635 % is the maximum value the type can accomodate (e.g. 255 for char). For
2636 % example, to create a 640x480 image from unsigned red-green-blue character
2637 % data, use
2638 %
2639 % MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2640 %
2641 % The format of the MagickConstituteImage method is:
2642 %
2643 % MagickBooleanType MagickConstituteImage(MagickWand *wand,
2644 % const size_t columns,const size_t rows,const char *map,
2645 % const StorageType storage,const void *pixels)
2646 %
2647 % A description of each parameter follows:
2648 %
2649 % o wand: the magick wand.
2650 %
2651 % o columns: width in pixels of the image.
2652 %
2653 % o rows: height in pixels of the image.
2654 %
2655 % o map: This string reflects the expected ordering of the pixel array.
2656 % It can be any combination or order of R = red, G = green, B = blue,
2657 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2658 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2659 % P = pad.
2660 %
2661 % o storage: Define the data type of the pixels. Float and double types are
2662 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2663 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2664 % LongPixel, QuantumPixel, or ShortPixel.
2665 %
2666 % o pixels: This array of values contain the pixel components as defined by
2667 % map and type. You must preallocate this array where the expected
2668 % length varies depending on the values of width, height, map, and type.
2669 %
2670 %
2671 */
2672 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2673  const size_t columns,const size_t rows,const char *map,
2674  const StorageType storage,const void *pixels)
2675 {
2676  Image
2677  *images;
2678 
2679  assert(wand != (MagickWand *) NULL);
2680  assert(wand->signature == MagickWandSignature);
2681  if (wand->debug != MagickFalse)
2682  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2683  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2684  if (images == (Image *) NULL)
2685  return(MagickFalse);
2686  return(InsertImageInWand(wand,images));
2687 }
2688 ␌
2689 /*
2690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2691 % %
2692 % %
2693 % %
2694 % M a g i c k D e c i p h e r I m a g e %
2695 % %
2696 % %
2697 % %
2698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2699 %
2700 % MagickDecipherImage() converts cipher pixels to plain pixels.
2701 %
2702 % The format of the MagickDecipherImage method is:
2703 %
2704 % MagickBooleanType MagickDecipherImage(MagickWand *wand,
2705 % const char *passphrase)
2706 %
2707 % A description of each parameter follows:
2708 %
2709 % o wand: the magick wand.
2710 %
2711 % o passphrase: the passphrase.
2712 %
2713 */
2714 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2715  const char *passphrase)
2716 {
2717  assert(wand != (MagickWand *) NULL);
2718  assert(wand->signature == MagickWandSignature);
2719  if (wand->debug != MagickFalse)
2720  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2721  if (wand->images == (Image *) NULL)
2722  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2723  return(DecipherImage(wand->images,passphrase,wand->exception));
2724 }
2725 ␌
2726 /*
2727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2728 % %
2729 % %
2730 % %
2731 % M a g i c k D e c o n s t r u c t I m a g e s %
2732 % %
2733 % %
2734 % %
2735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2736 %
2737 % MagickDeconstructImages() compares each image with the next in a sequence
2738 % and returns the maximum bounding region of any pixel differences it
2739 % discovers.
2740 %
2741 % The format of the MagickDeconstructImages method is:
2742 %
2743 % MagickWand *MagickDeconstructImages(MagickWand *wand)
2744 %
2745 % A description of each parameter follows:
2746 %
2747 % o wand: the magick wand.
2748 %
2749 */
2750 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2751 {
2752  Image
2753  *deconstruct_image;
2754 
2755  assert(wand != (MagickWand *) NULL);
2756  assert(wand->signature == MagickWandSignature);
2757  if (wand->debug != MagickFalse)
2758  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2759  if (wand->images == (Image *) NULL)
2760  return((MagickWand *) NULL);
2761  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2762  wand->exception);
2763  if (deconstruct_image == (Image *) NULL)
2764  return((MagickWand *) NULL);
2765  return(CloneMagickWandFromImages(wand,deconstruct_image));
2766 }
2767 ␌
2768 /*
2769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2770 % %
2771 % %
2772 % %
2773 % M a g i c k D e s k e w I m a g e %
2774 % %
2775 % %
2776 % %
2777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2778 %
2779 % MagickDeskewImage() removes skew from the image. Skew is an artifact that
2780 % occurs in scanned images because of the camera being misaligned,
2781 % imperfections in the scanning or surface, or simply because the paper was
2782 % not placed completely flat when scanned.
2783 %
2784 % The format of the MagickDeskewImage method is:
2785 %
2786 % MagickBooleanType MagickDeskewImage(MagickWand *wand,
2787 % const double threshold)
2788 %
2789 % A description of each parameter follows:
2790 %
2791 % o wand: the magick wand.
2792 %
2793 % o threshold: separate background from foreground.
2794 %
2795 */
2796 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2797  const double threshold)
2798 {
2799  Image
2800  *sepia_image;
2801 
2802  assert(wand != (MagickWand *) NULL);
2803  assert(wand->signature == MagickWandSignature);
2804  if (wand->debug != MagickFalse)
2805  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2806  if (wand->images == (Image *) NULL)
2807  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2808  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2809  if (sepia_image == (Image *) NULL)
2810  return(MagickFalse);
2811  ReplaceImageInList(&wand->images,sepia_image);
2812  return(MagickTrue);
2813 }
2814 ␌
2815 /*
2816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2817 % %
2818 % %
2819 % %
2820 % M a g i c k D e s p e c k l e I m a g e %
2821 % %
2822 % %
2823 % %
2824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2825 %
2826 % MagickDespeckleImage() reduces the speckle noise in an image while
2827 % preserving the edges of the original image.
2828 %
2829 % The format of the MagickDespeckleImage method is:
2830 %
2831 % MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2832 %
2833 % A description of each parameter follows:
2834 %
2835 % o wand: the magick wand.
2836 %
2837 */
2838 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2839 {
2840  Image
2841  *despeckle_image;
2842 
2843  assert(wand != (MagickWand *) NULL);
2844  assert(wand->signature == MagickWandSignature);
2845  if (wand->debug != MagickFalse)
2846  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2847  if (wand->images == (Image *) NULL)
2848  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2849  despeckle_image=DespeckleImage(wand->images,wand->exception);
2850  if (despeckle_image == (Image *) NULL)
2851  return(MagickFalse);
2852  ReplaceImageInList(&wand->images,despeckle_image);
2853  return(MagickTrue);
2854 }
2855 ␌
2856 /*
2857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2858 % %
2859 % %
2860 % %
2861 % M a g i c k D e s t r o y I m a g e %
2862 % %
2863 % %
2864 % %
2865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2866 %
2867 % MagickDestroyImage() dereferences an image, deallocating memory associated
2868 % with the image if the reference count becomes zero.
2869 %
2870 % The format of the MagickDestroyImage method is:
2871 %
2872 % Image *MagickDestroyImage(Image *image)
2873 %
2874 % A description of each parameter follows:
2875 %
2876 % o image: the image.
2877 %
2878 */
2879 WandExport Image *MagickDestroyImage(Image *image)
2880 {
2881  return(DestroyImage(image));
2882 }
2883 ␌
2884 /*
2885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2886 % %
2887 % %
2888 % %
2889 % M a g i c k D i s p l a y I m a g e %
2890 % %
2891 % %
2892 % %
2893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2894 %
2895 % MagickDisplayImage() displays an image.
2896 %
2897 % The format of the MagickDisplayImage method is:
2898 %
2899 % MagickBooleanType MagickDisplayImage(MagickWand *wand,
2900 % const char *server_name)
2901 %
2902 % A description of each parameter follows:
2903 %
2904 % o wand: the magick wand.
2905 %
2906 % o server_name: the X server name.
2907 %
2908 */
2909 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2910  const char *server_name)
2911 {
2912  Image
2913  *image;
2914 
2915  MagickBooleanType
2916  status;
2917 
2918  assert(wand != (MagickWand *) NULL);
2919  assert(wand->signature == MagickWandSignature);
2920  if (wand->debug != MagickFalse)
2921  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2922  if (wand->images == (Image *) NULL)
2923  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2924  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2925  if (image == (Image *) NULL)
2926  return(MagickFalse);
2927  (void) CloneString(&wand->image_info->server_name,server_name);
2928  status=DisplayImages(wand->image_info,image,wand->exception);
2929  image=DestroyImage(image);
2930  return(status);
2931 }
2932 ␌
2933 /*
2934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2935 % %
2936 % %
2937 % %
2938 % M a g i c k D i s p l a y I m a g e s %
2939 % %
2940 % %
2941 % %
2942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2943 %
2944 % MagickDisplayImages() displays an image or image sequence.
2945 %
2946 % The format of the MagickDisplayImages method is:
2947 %
2948 % MagickBooleanType MagickDisplayImages(MagickWand *wand,
2949 % const char *server_name)
2950 %
2951 % A description of each parameter follows:
2952 %
2953 % o wand: the magick wand.
2954 %
2955 % o server_name: the X server name.
2956 %
2957 */
2958 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2959  const char *server_name)
2960 {
2961  MagickBooleanType
2962  status;
2963 
2964  assert(wand != (MagickWand *) NULL);
2965  assert(wand->signature == MagickWandSignature);
2966  if (wand->debug != MagickFalse)
2967  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2968  (void) CloneString(&wand->image_info->server_name,server_name);
2969  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2970  return(status);
2971 }
2972 ␌
2973 /*
2974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2975 % %
2976 % %
2977 % %
2978 % M a g i c k D i s t o r t I m a g e %
2979 % %
2980 % %
2981 % %
2982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2983 %
2984 % MagickDistortImage() distorts an image using various distortion methods, by
2985 % mapping color lookups of the source image to a new destination image
2986 % usually of the same size as the source image, unless 'bestfit' is set to
2987 % true.
2988 %
2989 % If 'bestfit' is enabled, and distortion allows it, the destination image is
2990 % adjusted to ensure the whole source 'image' will just fit within the final
2991 % destination image, which will be sized and offset accordingly. Also in
2992 % many cases the virtual offset of the source image will be taken into
2993 % account in the mapping.
2994 %
2995 % The format of the MagickDistortImage method is:
2996 %
2997 % MagickBooleanType MagickDistortImage(MagickWand *wand,
2998 % const DistortMethod method,const size_t number_arguments,
2999 % const double *arguments,const MagickBooleanType bestfit)
3000 %
3001 % A description of each parameter follows:
3002 %
3003 % o image: the image to be distorted.
3004 %
3005 % o method: the method of image distortion.
3006 %
3007 % ArcDistortion always ignores the source image offset, and always
3008 % 'bestfit' the destination image with the top left corner offset
3009 % relative to the polar mapping center.
3010 %
3011 % Bilinear has no simple inverse mapping so it does not allow 'bestfit'
3012 % style of image distortion.
3013 %
3014 % Affine, Perspective, and Bilinear, do least squares fitting of the
3015 % distortion when more than the minimum number of control point pairs
3016 % are provided.
3017 %
3018 % Perspective, and Bilinear, falls back to a Affine distortion when less
3019 % that 4 control point pairs are provided. While Affine distortions let
3020 % you use any number of control point pairs, that is Zero pairs is a
3021 % no-Op (viewport only) distortion, one pair is a translation and two
3022 % pairs of control points do a scale-rotate-translate, without any
3023 % shearing.
3024 %
3025 % o number_arguments: the number of arguments given for this distortion
3026 % method.
3027 %
3028 % o arguments: the arguments for this distortion method.
3029 %
3030 % o bestfit: Attempt to resize destination to fit distorted source.
3031 %
3032 */
3033 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
3034  const DistortMethod method,const size_t number_arguments,
3035  const double *arguments,const MagickBooleanType bestfit)
3036 {
3037  Image
3038  *distort_image;
3039 
3040  assert(wand != (MagickWand *) NULL);
3041  assert(wand->signature == MagickWandSignature);
3042  if (wand->debug != MagickFalse)
3043  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3044  if (wand->images == (Image *) NULL)
3045  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3046  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
3047  bestfit,wand->exception);
3048  if (distort_image == (Image *) NULL)
3049  return(MagickFalse);
3050  ReplaceImageInList(&wand->images,distort_image);
3051  return(MagickTrue);
3052 }
3053 ␌
3054 /*
3055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3056 % %
3057 % %
3058 % %
3059 % M a g i c k D r a w I m a g e %
3060 % %
3061 % %
3062 % %
3063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3064 %
3065 % MagickDrawImage() renders the drawing wand on the current image.
3066 %
3067 % The format of the MagickDrawImage method is:
3068 %
3069 % MagickBooleanType MagickDrawImage(MagickWand *wand,
3070 % const DrawingWand *drawing_wand)
3071 %
3072 % A description of each parameter follows:
3073 %
3074 % o wand: the magick wand.
3075 %
3076 % o drawing_wand: the draw wand.
3077 %
3078 */
3079 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
3080  const DrawingWand *drawing_wand)
3081 {
3082  char
3083  *primitive;
3084 
3085  DrawInfo
3086  *draw_info;
3087 
3088  MagickBooleanType
3089  status;
3090 
3091  assert(wand != (MagickWand *) NULL);
3092  assert(wand->signature == MagickWandSignature);
3093  if (wand->debug != MagickFalse)
3094  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3095  if (wand->images == (Image *) NULL)
3096  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3097  draw_info=PeekDrawingWand(drawing_wand);
3098  if ((draw_info == (DrawInfo *) NULL) ||
3099  (draw_info->primitive == (char *) NULL))
3100  return(MagickFalse);
3101  primitive=AcquireString(draw_info->primitive);
3102  draw_info=DestroyDrawInfo(draw_info);
3103  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3104  draw_info->primitive=primitive;
3105  status=DrawImage(wand->images,draw_info,wand->exception);
3106  draw_info=DestroyDrawInfo(draw_info);
3107  return(status);
3108 }
3109 ␌
3110 /*
3111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3112 % %
3113 % %
3114 % %
3115 % M a g i c k E d g e I m a g e %
3116 % %
3117 % %
3118 % %
3119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3120 %
3121 % MagickEdgeImage() enhance edges within the image with a convolution filter
3122 % of the given radius. Use a radius of 0 and Edge() selects a suitable
3123 % radius for you.
3124 %
3125 % The format of the MagickEdgeImage method is:
3126 %
3127 % MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
3128 %
3129 % A description of each parameter follows:
3130 %
3131 % o wand: the magick wand.
3132 %
3133 % o radius: the radius of the pixel neighborhood.
3134 %
3135 */
3136 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
3137  const double radius)
3138 {
3139  Image
3140  *edge_image;
3141 
3142  assert(wand != (MagickWand *) NULL);
3143  assert(wand->signature == MagickWandSignature);
3144  if (wand->debug != MagickFalse)
3145  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3146  if (wand->images == (Image *) NULL)
3147  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3148  edge_image=EdgeImage(wand->images,radius,wand->exception);
3149  if (edge_image == (Image *) NULL)
3150  return(MagickFalse);
3151  ReplaceImageInList(&wand->images,edge_image);
3152  return(MagickTrue);
3153 }
3154 ␌
3155 /*
3156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3157 % %
3158 % %
3159 % %
3160 % M a g i c k E m b o s s I m a g e %
3161 % %
3162 % %
3163 % %
3164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3165 %
3166 % MagickEmbossImage() returns a grayscale image with a three-dimensional
3167 % effect. We convolve the image with a Gaussian operator of the given radius
3168 % and standard deviation (sigma). For reasonable results, radius should be
3169 % larger than sigma. Use a radius of 0 and Emboss() selects a suitable
3170 % radius for you.
3171 %
3172 % The format of the MagickEmbossImage method is:
3173 %
3174 % MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
3175 % const double sigma)
3176 %
3177 % A description of each parameter follows:
3178 %
3179 % o wand: the magick wand.
3180 %
3181 % o radius: the radius of the Gaussian, in pixels, not counting the center
3182 % pixel.
3183 %
3184 % o sigma: the standard deviation of the Gaussian, in pixels.
3185 %
3186 */
3187 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
3188  const double radius,const double sigma)
3189 {
3190  Image
3191  *emboss_image;
3192 
3193  assert(wand != (MagickWand *) NULL);
3194  assert(wand->signature == MagickWandSignature);
3195  if (wand->debug != MagickFalse)
3196  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3197  if (wand->images == (Image *) NULL)
3198  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3199  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
3200  if (emboss_image == (Image *) NULL)
3201  return(MagickFalse);
3202  ReplaceImageInList(&wand->images,emboss_image);
3203  return(MagickTrue);
3204 }
3205 ␌
3206 /*
3207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3208 % %
3209 % %
3210 % %
3211 % M a g i c k E n c i p h e r I m a g e %
3212 % %
3213 % %
3214 % %
3215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3216 %
3217 % MagickEncipherImage() converts plaint pixels to cipher pixels.
3218 %
3219 % The format of the MagickEncipherImage method is:
3220 %
3221 % MagickBooleanType MagickEncipherImage(MagickWand *wand,
3222 % const char *passphrase)
3223 %
3224 % A description of each parameter follows:
3225 %
3226 % o wand: the magick wand.
3227 %
3228 % o passphrase: the passphrase.
3229 %
3230 */
3231 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
3232  const char *passphrase)
3233 {
3234  assert(wand != (MagickWand *) NULL);
3235  assert(wand->signature == MagickWandSignature);
3236  if (wand->debug != MagickFalse)
3237  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3238  if (wand->images == (Image *) NULL)
3239  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3240  return(EncipherImage(wand->images,passphrase,wand->exception));
3241 }
3242 ␌
3243 /*
3244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3245 % %
3246 % %
3247 % %
3248 % M a g i c k E n h a n c e I m a g e %
3249 % %
3250 % %
3251 % %
3252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3253 %
3254 % MagickEnhanceImage() applies a digital filter that improves the quality of a
3255 % noisy image.
3256 %
3257 % The format of the MagickEnhanceImage method is:
3258 %
3259 % MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3260 %
3261 % A description of each parameter follows:
3262 %
3263 % o wand: the magick wand.
3264 %
3265 */
3266 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3267 {
3268  Image
3269  *enhance_image;
3270 
3271  assert(wand != (MagickWand *) NULL);
3272  assert(wand->signature == MagickWandSignature);
3273  if (wand->debug != MagickFalse)
3274  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3275  if (wand->images == (Image *) NULL)
3276  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3277  enhance_image=EnhanceImage(wand->images,wand->exception);
3278  if (enhance_image == (Image *) NULL)
3279  return(MagickFalse);
3280  ReplaceImageInList(&wand->images,enhance_image);
3281  return(MagickTrue);
3282 }
3283 ␌
3284 /*
3285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3286 % %
3287 % %
3288 % %
3289 % M a g i c k E q u a l i z e I m a g e %
3290 % %
3291 % %
3292 % %
3293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3294 %
3295 % MagickEqualizeImage() equalizes the image histogram.
3296 %
3297 % The format of the MagickEqualizeImage method is:
3298 %
3299 % MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3300 %
3301 % A description of each parameter follows:
3302 %
3303 % o wand: the magick wand.
3304 %
3305 % o channel: the image channel(s).
3306 %
3307 */
3308 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3309 {
3310  MagickBooleanType
3311  status;
3312 
3313  assert(wand != (MagickWand *) NULL);
3314  assert(wand->signature == MagickWandSignature);
3315  if (wand->debug != MagickFalse)
3316  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3317  if (wand->images == (Image *) NULL)
3318  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3319  status=EqualizeImage(wand->images,wand->exception);
3320  return(status);
3321 }
3322 ␌
3323 /*
3324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3325 % %
3326 % %
3327 % %
3328 % M a g i c k E v a l u a t e I m a g e %
3329 % %
3330 % %
3331 % %
3332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3333 %
3334 % MagickEvaluateImage() applies an arithmetic, relational, or logical
3335 % expression to an image. Use these operators to lighten or darken an image,
3336 % to increase or decrease contrast in an image, or to produce the "negative"
3337 % of an image.
3338 %
3339 % The format of the MagickEvaluateImage method is:
3340 %
3341 % MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3342 % const MagickEvaluateOperator operator,const double value)
3343 % MagickWand *MagickEvaluateImages(MagickWand *wand,
3344 % const MagickEvaluateOperator operator)
3345 %
3346 % A description of each parameter follows:
3347 %
3348 % o wand: the magick wand.
3349 %
3350 % o op: A channel operator.
3351 %
3352 % o value: A value value.
3353 %
3354 */
3355 
3356 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3357  const MagickEvaluateOperator op)
3358 {
3359  Image
3360  *evaluate_image;
3361 
3362  assert(wand != (MagickWand *) NULL);
3363  assert(wand->signature == MagickWandSignature);
3364  if (wand->debug != MagickFalse)
3365  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3366  if (wand->images == (Image *) NULL)
3367  return((MagickWand *) NULL);
3368  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3369  if (evaluate_image == (Image *) NULL)
3370  return((MagickWand *) NULL);
3371  return(CloneMagickWandFromImages(wand,evaluate_image));
3372 }
3373 
3374 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3375  const MagickEvaluateOperator op,const double value)
3376 {
3377  MagickBooleanType
3378  status;
3379 
3380  assert(wand != (MagickWand *) NULL);
3381  assert(wand->signature == MagickWandSignature);
3382  if (wand->debug != MagickFalse)
3383  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3384  if (wand->images == (Image *) NULL)
3385  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3386  status=EvaluateImage(wand->images,op,value,wand->exception);
3387  return(status);
3388 }
3389 ␌
3390 /*
3391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3392 % %
3393 % %
3394 % %
3395 % M a g i c k E x p o r t I m a g e P i x e l s %
3396 % %
3397 % %
3398 % %
3399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3400 %
3401 % MagickExportImagePixels() extracts pixel data from an image and returns it
3402 % to you. The method returns MagickTrue on success otherwise MagickFalse if
3403 % an error is encountered. The data is returned as char, short int, int,
3404 % ssize_t, float, or double in the order specified by map.
3405 %
3406 % Suppose you want to extract the first scanline of a 640x480 image as
3407 % character data in red-green-blue order:
3408 %
3409 % MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3410 %
3411 % The format of the MagickExportImagePixels method is:
3412 %
3413 % MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3414 % const ssize_t x,const ssize_t y,const size_t columns,
3415 % const size_t rows,const char *map,const StorageType storage,
3416 % void *pixels)
3417 %
3418 % A description of each parameter follows:
3419 %
3420 % o wand: the magick wand.
3421 %
3422 % o x, y, columns, rows: These values define the perimeter
3423 % of a region of pixels you want to extract.
3424 %
3425 % o map: This string reflects the expected ordering of the pixel array.
3426 % It can be any combination or order of R = red, G = green, B = blue,
3427 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3428 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3429 % P = pad.
3430 %
3431 % o storage: Define the data type of the pixels. Float and double types are
3432 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3433 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3434 % LongPixel, QuantumPixel, or ShortPixel.
3435 %
3436 % o pixels: This array of values contain the pixel components as defined by
3437 % map and type. You must preallocate this array where the expected
3438 % length varies depending on the values of width, height, map, and type.
3439 %
3440 */
3441 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3442  const ssize_t x,const ssize_t y,const size_t columns,
3443  const size_t rows,const char *map,const StorageType storage,
3444  void *pixels)
3445 {
3446  MagickBooleanType
3447  status;
3448 
3449  assert(wand != (MagickWand *) NULL);
3450  assert(wand->signature == MagickWandSignature);
3451  if (wand->debug != MagickFalse)
3452  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3453  if (wand->images == (Image *) NULL)
3454  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3455  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3456  storage,pixels,wand->exception);
3457  return(status);
3458 }
3459 ␌
3460 /*
3461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3462 % %
3463 % %
3464 % %
3465 % M a g i c k E x t e n t I m a g e %
3466 % %
3467 % %
3468 % %
3469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3470 %
3471 % MagickExtentImage() extends the image as defined by the geometry, gravity,
3472 % and wand background color. Set the (x,y) offset of the geometry to move
3473 % the original wand relative to the extended wand.
3474 %
3475 % The format of the MagickExtentImage method is:
3476 %
3477 % MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3478 % const size_t height,const ssize_t x,const ssize_t y)
3479 %
3480 % A description of each parameter follows:
3481 %
3482 % o wand: the magick wand.
3483 %
3484 % o width: the region width.
3485 %
3486 % o height: the region height.
3487 %
3488 % o x: the region x offset.
3489 %
3490 % o y: the region y offset.
3491 %
3492 */
3493 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3494  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3495 {
3496  Image
3497  *extent_image;
3498 
3499  RectangleInfo
3500  extent;
3501 
3502  assert(wand != (MagickWand *) NULL);
3503  assert(wand->signature == MagickWandSignature);
3504  if (wand->debug != MagickFalse)
3505  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3506  if (wand->images == (Image *) NULL)
3507  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3508  extent.width=width;
3509  extent.height=height;
3510  extent.x=x;
3511  extent.y=y;
3512  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3513  if (extent_image == (Image *) NULL)
3514  return(MagickFalse);
3515  ReplaceImageInList(&wand->images,extent_image);
3516  return(MagickTrue);
3517 }
3518 ␌
3519 /*
3520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3521 % %
3522 % %
3523 % %
3524 % M a g i c k F l i p I m a g e %
3525 % %
3526 % %
3527 % %
3528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3529 %
3530 % MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3531 % around the central x-axis.
3532 %
3533 % The format of the MagickFlipImage method is:
3534 %
3535 % MagickBooleanType MagickFlipImage(MagickWand *wand)
3536 %
3537 % A description of each parameter follows:
3538 %
3539 % o wand: the magick wand.
3540 %
3541 */
3542 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3543 {
3544  Image
3545  *flip_image;
3546 
3547  assert(wand != (MagickWand *) NULL);
3548  assert(wand->signature == MagickWandSignature);
3549  if (wand->debug != MagickFalse)
3550  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3551  if (wand->images == (Image *) NULL)
3552  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3553  flip_image=FlipImage(wand->images,wand->exception);
3554  if (flip_image == (Image *) NULL)
3555  return(MagickFalse);
3556  ReplaceImageInList(&wand->images,flip_image);
3557  return(MagickTrue);
3558 }
3559 ␌
3560 /*
3561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3562 % %
3563 % %
3564 % %
3565 % 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 %
3566 % %
3567 % %
3568 % %
3569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3570 %
3571 % MagickFloodfillPaintImage() changes the color value of any pixel that matches
3572 % target and is an immediate neighbor. If the method FillToBorderMethod is
3573 % specified, the color value is changed for any neighbor pixel that does not
3574 % match the bordercolor member of image.
3575 %
3576 % The format of the MagickFloodfillPaintImage method is:
3577 %
3578 % MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3579 % const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3580 % const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3581 %
3582 % A description of each parameter follows:
3583 %
3584 % o wand: the magick wand.
3585 %
3586 % o fill: the floodfill color pixel wand.
3587 %
3588 % o fuzz: By default target must match a particular pixel color
3589 % exactly. However, in many cases two colors may differ by a small amount.
3590 % The fuzz member of image defines how much tolerance is acceptable to
3591 % consider two colors as the same. For example, set fuzz to 10 and the
3592 % color red at intensities of 100 and 102 respectively are now interpreted
3593 % as the same color for the purposes of the floodfill.
3594 %
3595 % o bordercolor: the border color pixel wand.
3596 %
3597 % o x,y: the starting location of the operation.
3598 %
3599 % o invert: paint any pixel that does not match the target color.
3600 %
3601 */
3602 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3603  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3604  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3605 {
3606  DrawInfo
3607  *draw_info;
3608 
3609  MagickBooleanType
3610  status;
3611 
3612  PixelInfo
3613  target;
3614 
3615  assert(wand != (MagickWand *) NULL);
3616  assert(wand->signature == MagickWandSignature);
3617  if (wand->debug != MagickFalse)
3618  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3619  if (wand->images == (Image *) NULL)
3620  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3621  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3622  PixelGetQuantumPacket(fill,&draw_info->fill);
3623  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3624  (ssize_t) wand->images->columns,y % (ssize_t) wand->images->rows,&target,
3625  wand->exception);
3626  if (bordercolor != (PixelWand *) NULL)
3627  PixelGetMagickColor(bordercolor,&target);
3628  wand->images->fuzz=fuzz;
3629  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3630  wand->exception);
3631  draw_info=DestroyDrawInfo(draw_info);
3632  return(status);
3633 }
3634 ␌
3635 /*
3636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3637 % %
3638 % %
3639 % %
3640 % M a g i c k F l o p I m a g e %
3641 % %
3642 % %
3643 % %
3644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3645 %
3646 % MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3647 % around the central y-axis.
3648 %
3649 % The format of the MagickFlopImage method is:
3650 %
3651 % MagickBooleanType MagickFlopImage(MagickWand *wand)
3652 %
3653 % A description of each parameter follows:
3654 %
3655 % o wand: the magick wand.
3656 %
3657 */
3658 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3659 {
3660  Image
3661  *flop_image;
3662 
3663  assert(wand != (MagickWand *) NULL);
3664  assert(wand->signature == MagickWandSignature);
3665  if (wand->debug != MagickFalse)
3666  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3667  if (wand->images == (Image *) NULL)
3668  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3669  flop_image=FlopImage(wand->images,wand->exception);
3670  if (flop_image == (Image *) NULL)
3671  return(MagickFalse);
3672  ReplaceImageInList(&wand->images,flop_image);
3673  return(MagickTrue);
3674 }
3675 ␌
3676 /*
3677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3678 % %
3679 % %
3680 % %
3681 % 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 %
3682 % %
3683 % %
3684 % %
3685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3686 %
3687 % MagickForwardFourierTransformImage() implements the discrete Fourier
3688 % transform (DFT) of the image either as a magnitude / phase or real /
3689 % imaginary image pair.
3690 %
3691 % The format of the MagickForwardFourierTransformImage method is:
3692 %
3693 % MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3694 % const MagickBooleanType magnitude)
3695 %
3696 % A description of each parameter follows:
3697 %
3698 % o wand: the magick wand.
3699 %
3700 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
3701 % imaginary image pair.
3702 %
3703 */
3704 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3705  MagickWand *wand,const MagickBooleanType magnitude)
3706 {
3707  Image
3708  *forward_image;
3709 
3710  assert(wand != (MagickWand *) NULL);
3711  assert(wand->signature == MagickWandSignature);
3712  if (wand->debug != MagickFalse)
3713  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3714  if (wand->images == (Image *) NULL)
3715  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3716  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3717  wand->exception);
3718  if (forward_image == (Image *) NULL)
3719  return(MagickFalse);
3720  ReplaceImageInList(&wand->images,forward_image);
3721  return(MagickTrue);
3722 }
3723 ␌
3724 /*
3725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3726 % %
3727 % %
3728 % %
3729 % M a g i c k F r a m e I m a g e %
3730 % %
3731 % %
3732 % %
3733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3734 %
3735 % MagickFrameImage() adds a simulated three-dimensional border around the
3736 % image. The width and height specify the border width of the vertical and
3737 % horizontal sides of the frame. The inner and outer bevels indicate the
3738 % width of the inner and outer shadows of the frame.
3739 %
3740 % The format of the MagickFrameImage method is:
3741 %
3742 % MagickBooleanType MagickFrameImage(MagickWand *wand,
3743 % const PixelWand *matte_color,const size_t width,
3744 % const size_t height,const ssize_t inner_bevel,
3745 % const ssize_t outer_bevel,const CompositeOperator compose)
3746 %
3747 % A description of each parameter follows:
3748 %
3749 % o wand: the magick wand.
3750 %
3751 % o matte_color: the frame color pixel wand.
3752 %
3753 % o width: the border width.
3754 %
3755 % o height: the border height.
3756 %
3757 % o inner_bevel: the inner bevel width.
3758 %
3759 % o outer_bevel: the outer bevel width.
3760 %
3761 % o compose: the composite operator.
3762 %
3763 */
3764 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3765  const PixelWand *matte_color,const size_t width,const size_t height,
3766  const ssize_t inner_bevel,const ssize_t outer_bevel,
3767  const CompositeOperator compose)
3768 {
3769  Image
3770  *frame_image;
3771 
3772  FrameInfo
3773  frame_info;
3774 
3775  assert(wand != (MagickWand *) NULL);
3776  assert(wand->signature == MagickWandSignature);
3777  if (wand->debug != MagickFalse)
3778  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3779  if (wand->images == (Image *) NULL)
3780  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3781  (void) memset(&frame_info,0,sizeof(frame_info));
3782  frame_info.width=wand->images->columns+2*width;
3783  frame_info.height=wand->images->rows+2*height;
3784  frame_info.x=(ssize_t) width;
3785  frame_info.y=(ssize_t) height;
3786  frame_info.inner_bevel=inner_bevel;
3787  frame_info.outer_bevel=outer_bevel;
3788  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3789  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3790  if (frame_image == (Image *) NULL)
3791  return(MagickFalse);
3792  ReplaceImageInList(&wand->images,frame_image);
3793  return(MagickTrue);
3794 }
3795 ␌
3796 /*
3797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3798 % %
3799 % %
3800 % %
3801 % M a g i c k F u n c t i o n I m a g e %
3802 % %
3803 % %
3804 % %
3805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3806 %
3807 % MagickFunctionImage() applies an arithmetic, relational, or logical
3808 % expression to an image. Use these operators to lighten or darken an image,
3809 % to increase or decrease contrast in an image, or to produce the "negative"
3810 % of an image.
3811 %
3812 % The format of the MagickFunctionImage method is:
3813 %
3814 % MagickBooleanType MagickFunctionImage(MagickWand *wand,
3815 % const MagickFunction function,const size_t number_arguments,
3816 % const double *arguments)
3817 %
3818 % A description of each parameter follows:
3819 %
3820 % o wand: the magick wand.
3821 %
3822 % o function: the image function.
3823 %
3824 % o number_arguments: the number of function arguments.
3825 %
3826 % o arguments: the function arguments.
3827 %
3828 */
3829 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3830  const MagickFunction function,const size_t number_arguments,
3831  const double *arguments)
3832 {
3833  MagickBooleanType
3834  status;
3835 
3836  assert(wand != (MagickWand *) NULL);
3837  assert(wand->signature == MagickWandSignature);
3838  if (wand->debug != MagickFalse)
3839  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3840  if (wand->images == (Image *) NULL)
3841  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3842  status=FunctionImage(wand->images,function,number_arguments,arguments,
3843  wand->exception);
3844  return(status);
3845 }
3846 ␌
3847 /*
3848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3849 % %
3850 % %
3851 % %
3852 % M a g i c k F x I m a g e %
3853 % %
3854 % %
3855 % %
3856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3857 %
3858 % MagickFxImage() evaluate expression for each pixel in the image.
3859 %
3860 % The format of the MagickFxImage method is:
3861 %
3862 % MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3863 %
3864 % A description of each parameter follows:
3865 %
3866 % o wand: the magick wand.
3867 %
3868 % o expression: the expression.
3869 %
3870 */
3871 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3872 {
3873  Image
3874  *fx_image;
3875 
3876  assert(wand != (MagickWand *) NULL);
3877  assert(wand->signature == MagickWandSignature);
3878  if (wand->debug != MagickFalse)
3879  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3880  if (wand->images == (Image *) NULL)
3881  return((MagickWand *) NULL);
3882  fx_image=FxImage(wand->images,expression,wand->exception);
3883  if (fx_image == (Image *) NULL)
3884  return((MagickWand *) NULL);
3885  return(CloneMagickWandFromImages(wand,fx_image));
3886 }
3887 ␌
3888 /*
3889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3890 % %
3891 % %
3892 % %
3893 % M a g i c k G a m m a I m a g e %
3894 % %
3895 % %
3896 % %
3897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3898 %
3899 % MagickGammaImage() gamma-corrects an image. The same image viewed on
3900 % different devices will have perceptual differences in the way the image's
3901 % intensities are represented on the screen. Specify individual gamma levels
3902 % for the red, green, and blue channels, or adjust all three with the gamma
3903 % parameter. Values typically range from 0.8 to 2.3.
3904 %
3905 % You can also reduce the influence of a particular channel with a gamma
3906 % value of 0.
3907 %
3908 % The format of the MagickGammaImage method is:
3909 %
3910 % MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3911 %
3912 % A description of each parameter follows:
3913 %
3914 % o wand: the magick wand.
3915 %
3916 % o level: Define the level of gamma correction.
3917 %
3918 */
3919 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3920  const double gamma)
3921 {
3922  MagickBooleanType
3923  status;
3924 
3925  assert(wand != (MagickWand *) NULL);
3926  assert(wand->signature == MagickWandSignature);
3927  if (wand->debug != MagickFalse)
3928  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3929  if (wand->images == (Image *) NULL)
3930  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3931  status=GammaImage(wand->images,gamma,wand->exception);
3932  return(status);
3933 }
3934 ␌
3935 /*
3936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3937 % %
3938 % %
3939 % %
3940 % M a g i c k G a u s s i a n B l u r I m a g e %
3941 % %
3942 % %
3943 % %
3944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3945 %
3946 % MagickGaussianBlurImage() blurs an image. We convolve the image with a
3947 % Gaussian operator of the given radius and standard deviation (sigma).
3948 % For reasonable results, the radius should be larger than sigma. Use a
3949 % radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3950 %
3951 % The format of the MagickGaussianBlurImage method is:
3952 %
3953 % MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3954 % const double radius,const double sigma)
3955 %
3956 % A description of each parameter follows:
3957 %
3958 % o wand: the magick wand.
3959 %
3960 % o radius: the radius of the Gaussian, in pixels, not counting the center
3961 % pixel.
3962 %
3963 % o sigma: the standard deviation of the Gaussian, in pixels.
3964 %
3965 */
3966 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3967  const double radius,const double sigma)
3968 {
3969  Image
3970  *blur_image;
3971 
3972  assert(wand != (MagickWand *) NULL);
3973  assert(wand->signature == MagickWandSignature);
3974  if (wand->debug != MagickFalse)
3975  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3976  if (wand->images == (Image *) NULL)
3977  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3978  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3979  if (blur_image == (Image *) NULL)
3980  return(MagickFalse);
3981  ReplaceImageInList(&wand->images,blur_image);
3982  return(MagickTrue);
3983 }
3984 ␌
3985 /*
3986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3987 % %
3988 % %
3989 % %
3990 % M a g i c k G e t I m a g e %
3991 % %
3992 % %
3993 % %
3994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3995 %
3996 % MagickGetImage() gets the image at the current image index.
3997 %
3998 % The format of the MagickGetImage method is:
3999 %
4000 % MagickWand *MagickGetImage(MagickWand *wand)
4001 %
4002 % A description of each parameter follows:
4003 %
4004 % o wand: the magick wand.
4005 %
4006 */
4007 WandExport MagickWand *MagickGetImage(MagickWand *wand)
4008 {
4009  Image
4010  *image;
4011 
4012  assert(wand != (MagickWand *) NULL);
4013  assert(wand->signature == MagickWandSignature);
4014  if (wand->debug != MagickFalse)
4015  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4016  if (wand->images == (Image *) NULL)
4017  {
4018  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4019  "ContainsNoImages","`%s'",wand->name);
4020  return((MagickWand *) NULL);
4021  }
4022  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
4023  if (image == (Image *) NULL)
4024  return((MagickWand *) NULL);
4025  return(CloneMagickWandFromImages(wand,image));
4026 }
4027 ␌
4028 /*
4029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4030 % %
4031 % %
4032 % %
4033 % 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 %
4034 % %
4035 % %
4036 % %
4037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4038 %
4039 % MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
4040 % is not activated. That is, the image is RGB rather than RGBA or CMYK rather
4041 % than CMYKA.
4042 %
4043 % The format of the MagickGetImageAlphaChannel method is:
4044 %
4045 % MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4046 %
4047 % A description of each parameter follows:
4048 %
4049 % o wand: the magick wand.
4050 %
4051 */
4052 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4053 {
4054  assert(wand != (MagickWand *) NULL);
4055  assert(wand->signature == MagickWandSignature);
4056  if (wand->debug != MagickFalse)
4057  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4058  if (wand->images == (Image *) NULL)
4059  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4060  return(GetImageAlphaChannel(wand->images));
4061 }
4062 ␌
4063 /*
4064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4065 % %
4066 % %
4067 % %
4068 % M a g i c k G e t I m a g e C l i p M a s k %
4069 % %
4070 % %
4071 % %
4072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4073 %
4074 % MagickGetImageMask() gets the image clip mask at the current image index.
4075 %
4076 % The format of the MagickGetImageMask method is:
4077 %
4078 % MagickWand *MagickGetImageMask(MagickWand *wand, const PixelMask type)
4079 %
4080 % A description of each parameter follows:
4081 %
4082 % o wand: the magick wand.
4083 %
4084 % o type: type of mask, ReadPixelMask or WritePixelMask.
4085 %
4086 */
4087 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
4088  const PixelMask type)
4089 {
4090  Image
4091  *image;
4092 
4093  assert(wand != (MagickWand *) NULL);
4094  assert(wand->signature == MagickWandSignature);
4095  if (wand->debug != MagickFalse)
4096  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4097  if (wand->images == (Image *) NULL)
4098  {
4099  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4100  "ContainsNoImages","`%s'",wand->name);
4101  return((MagickWand *) NULL);
4102  }
4103  image=GetImageMask(wand->images,type,wand->exception);
4104  if (image == (Image *) NULL)
4105  return((MagickWand *) NULL);
4106  return(CloneMagickWandFromImages(wand,image));
4107 }
4108 ␌
4109 /*
4110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4111 % %
4112 % %
4113 % %
4114 % 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 %
4115 % %
4116 % %
4117 % %
4118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4119 %
4120 % MagickGetImageBackgroundColor() returns the image background color.
4121 %
4122 % The format of the MagickGetImageBackgroundColor method is:
4123 %
4124 % MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4125 % PixelWand *background_color)
4126 %
4127 % A description of each parameter follows:
4128 %
4129 % o wand: the magick wand.
4130 %
4131 % o background_color: Return the background color.
4132 %
4133 */
4134 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4135  PixelWand *background_color)
4136 {
4137  assert(wand != (MagickWand *) NULL);
4138  assert(wand->signature == MagickWandSignature);
4139  if (wand->debug != MagickFalse)
4140  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4141  if (wand->images == (Image *) NULL)
4142  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4143  PixelSetPixelColor(background_color,&wand->images->background_color);
4144  return(MagickTrue);
4145 }
4146 ␌
4147 /*
4148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4149 % %
4150 % %
4151 % %
4152 % M a g i c k G e t I m a g e B l o b %
4153 % %
4154 % %
4155 % %
4156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4157 %
4158 % MagickGetImageBlob() implements direct to memory image formats. It returns
4159 % the image as a blob (a formatted "file" in memory) and its length, starting
4160 % from the current position in the image sequence. Use MagickSetImageFormat()
4161 % to set the format to write to the blob (GIF, JPEG, PNG, etc.).
4162 %
4163 % Utilize MagickResetIterator() to ensure the write is from the beginning of
4164 % the image sequence.
4165 %
4166 % Use MagickRelinquishMemory() to free the blob when you are done with it.
4167 %
4168 % The format of the MagickGetImageBlob method is:
4169 %
4170 % unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4171 %
4172 % A description of each parameter follows:
4173 %
4174 % o wand: the magick wand.
4175 %
4176 % o length: the length of the blob.
4177 %
4178 */
4179 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4180 {
4181  unsigned char
4182  *blob;
4183 
4184  assert(wand != (MagickWand *) NULL);
4185  assert(wand->signature == MagickWandSignature);
4186  if (wand->debug != MagickFalse)
4187  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4188  if (wand->images == (Image *) NULL)
4189  {
4190  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4191  "ContainsNoImages","`%s'",wand->name);
4192  return((unsigned char *) NULL);
4193  }
4194  blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
4195  wand->exception);
4196  return(blob);
4197 }
4198 ␌
4199 /*
4200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4201 % %
4202 % %
4203 % %
4204 % M a g i c k G e t I m a g e s B l o b %
4205 % %
4206 % %
4207 % %
4208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4209 %
4210 % MagickGetImagesBlob() implements direct to memory image formats. It
4211 % returns the image sequence as a blob and its length. The format of the image
4212 % determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
4213 % return a different image format, use MagickSetImageFormat().
4214 %
4215 % Note, some image formats do not permit multiple images to the same image
4216 % stream (e.g. JPEG). in this instance, just the first image of the
4217 % sequence is returned as a blob.
4218 %
4219 % The format of the MagickGetImagesBlob method is:
4220 %
4221 % unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4222 %
4223 % A description of each parameter follows:
4224 %
4225 % o wand: the magick wand.
4226 %
4227 % o length: the length of the blob.
4228 %
4229 */
4230 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4231 {
4232  unsigned char
4233  *blob;
4234 
4235  assert(wand != (MagickWand *) NULL);
4236  assert(wand->signature == MagickWandSignature);
4237  if (wand->debug != MagickFalse)
4238  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4239  if (wand->images == (Image *) NULL)
4240  {
4241  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4242  "ContainsNoImages","`%s'",wand->name);
4243  return((unsigned char *) NULL);
4244  }
4245  blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
4246  wand->images),length,wand->exception);
4247  return(blob);
4248 }
4249 ␌
4250 /*
4251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4252 % %
4253 % %
4254 % %
4255 % 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 %
4256 % %
4257 % %
4258 % %
4259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4260 %
4261 % MagickGetImageBluePrimary() returns the chromaticity blue primary point for the
4262 % image.
4263 %
4264 % The format of the MagickGetImageBluePrimary method is:
4265 %
4266 % MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4267 % double *y,double *z)
4268 %
4269 % A description of each parameter follows:
4270 %
4271 % o wand: the magick wand.
4272 %
4273 % o x: the chromaticity blue primary x-point.
4274 %
4275 % o y: the chromaticity blue primary y-point.
4276 %
4277 % o z: the chromaticity blue primary z-point.
4278 %
4279 */
4280 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4281  double *x,double *y,double *z)
4282 {
4283  assert(wand != (MagickWand *) NULL);
4284  assert(wand->signature == MagickWandSignature);
4285  if (wand->debug != MagickFalse)
4286  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4287  if (wand->images == (Image *) NULL)
4288  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4289  *x=wand->images->chromaticity.blue_primary.x;
4290  *y=wand->images->chromaticity.blue_primary.y;
4291  *z=wand->images->chromaticity.blue_primary.z;
4292  return(MagickTrue);
4293 }
4294 ␌
4295 /*
4296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4297 % %
4298 % %
4299 % %
4300 % 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 %
4301 % %
4302 % %
4303 % %
4304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4305 %
4306 % MagickGetImageBorderColor() returns the image border color.
4307 %
4308 % The format of the MagickGetImageBorderColor method is:
4309 %
4310 % MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4311 % PixelWand *border_color)
4312 %
4313 % A description of each parameter follows:
4314 %
4315 % o wand: the magick wand.
4316 %
4317 % o border_color: Return the border color.
4318 %
4319 */
4320 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4321  PixelWand *border_color)
4322 {
4323  assert(wand != (MagickWand *) NULL);
4324  assert(wand->signature == MagickWandSignature);
4325  if (wand->debug != MagickFalse)
4326  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4327  if (wand->images == (Image *) NULL)
4328  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4329  PixelSetPixelColor(border_color,&wand->images->border_color);
4330  return(MagickTrue);
4331 }
4332 ␌
4333 /*
4334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4335 % %
4336 % %
4337 % %
4338 % M a g i c k G e t I m a g e F e a t u r e s %
4339 % %
4340 % %
4341 % %
4342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4343 %
4344 % MagickGetImageFeatures() returns features for each channel in the
4345 % image in each of four directions (horizontal, vertical, left and right
4346 % diagonals) for the specified distance. The features include the angular
4347 % second moment, contrast, correlation, sum of squares: variance, inverse
4348 % difference moment, sum average, sum variance, sum entropy, entropy,
4349 % difference variance, difference entropy, information measures of
4350 % correlation 1, information measures of correlation 2, and maximum
4351 % correlation coefficient. You can access the red channel contrast, for
4352 % example, like this:
4353 %
4354 % channel_features=MagickGetImageFeatures(wand,1);
4355 % contrast=channel_features[RedPixelChannel].contrast[0];
4356 %
4357 % Use MagickRelinquishMemory() to free the statistics buffer.
4358 %
4359 % The format of the MagickGetImageFeatures method is:
4360 %
4361 % ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4362 % const size_t distance)
4363 %
4364 % A description of each parameter follows:
4365 %
4366 % o wand: the magick wand.
4367 %
4368 % o distance: the distance.
4369 %
4370 */
4371 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4372  const size_t distance)
4373 {
4374  assert(wand != (MagickWand *) NULL);
4375  assert(wand->signature == MagickWandSignature);
4376  if (wand->debug != MagickFalse)
4377  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4378  if (wand->images == (Image *) NULL)
4379  {
4380  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4381  "ContainsNoImages","`%s'",wand->name);
4382  return((ChannelFeatures *) NULL);
4383  }
4384  return(GetImageFeatures(wand->images,distance,wand->exception));
4385 }
4386 ␌
4387 /*
4388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4389 % %
4390 % %
4391 % %
4392 % M a g i c k G e t I m a g e K u r t o s i s %
4393 % %
4394 % %
4395 % %
4396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4397 %
4398 % MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4399 % more image channels.
4400 %
4401 % The format of the MagickGetImageKurtosis method is:
4402 %
4403 % MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4404 % double *kurtosis,double *skewness)
4405 %
4406 % A description of each parameter follows:
4407 %
4408 % o wand: the magick wand.
4409 %
4410 % o kurtosis: The kurtosis for the specified channel(s).
4411 %
4412 % o skewness: The skewness for the specified channel(s).
4413 %
4414 */
4415 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4416  double *kurtosis,double *skewness)
4417 {
4418  MagickBooleanType
4419  status;
4420 
4421  assert(wand != (MagickWand *) NULL);
4422  assert(wand->signature == MagickWandSignature);
4423  if (wand->debug != MagickFalse)
4424  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4425  if (wand->images == (Image *) NULL)
4426  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4427  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4428  return(status);
4429 }
4430 ␌
4431 /*
4432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4433 % %
4434 % %
4435 % %
4436 % M a g i c k G e t I m a g e M e a n %
4437 % %
4438 % %
4439 % %
4440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4441 %
4442 % MagickGetImageMean() gets the mean and standard deviation of one or more
4443 % image channels.
4444 %
4445 % The format of the MagickGetImageMean method is:
4446 %
4447 % MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4448 % double *standard_deviation)
4449 %
4450 % A description of each parameter follows:
4451 %
4452 % o wand: the magick wand.
4453 %
4454 % o channel: the image channel(s).
4455 %
4456 % o mean: The mean pixel value for the specified channel(s).
4457 %
4458 % o standard_deviation: The standard deviation for the specified channel(s).
4459 %
4460 */
4461 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4462  double *standard_deviation)
4463 {
4464  MagickBooleanType
4465  status;
4466 
4467  assert(wand != (MagickWand *) NULL);
4468  assert(wand->signature == MagickWandSignature);
4469  if (wand->debug != MagickFalse)
4470  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4471  if (wand->images == (Image *) NULL)
4472  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4473  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4474  return(status);
4475 }
4476 ␌
4477 /*
4478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4479 % %
4480 % %
4481 % %
4482 % M a g i c k G e t I m a g e R a n g e %
4483 % %
4484 % %
4485 % %
4486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4487 %
4488 % MagickGetImageRange() gets the range for one or more image channels.
4489 %
4490 % The format of the MagickGetImageRange method is:
4491 %
4492 % MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4493 % double *maxima)
4494 %
4495 % A description of each parameter follows:
4496 %
4497 % o wand: the magick wand.
4498 %
4499 % o minima: The minimum pixel value for the specified channel(s).
4500 %
4501 % o maxima: The maximum pixel value for the specified channel(s).
4502 %
4503 */
4504 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4505  double *minima,double *maxima)
4506 {
4507  MagickBooleanType
4508  status;
4509 
4510  assert(wand != (MagickWand *) NULL);
4511  assert(wand->signature == MagickWandSignature);
4512  if (wand->debug != MagickFalse)
4513  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4514  if (wand->images == (Image *) NULL)
4515  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4516  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4517  return(status);
4518 }
4519 ␌
4520 /*
4521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4522 % %
4523 % %
4524 % %
4525 % M a g i c k G e t I m a g e S t a t i s t i c s %
4526 % %
4527 % %
4528 % %
4529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4530 %
4531 % MagickGetImageStatistics() returns statistics for each channel in the
4532 % image. The statistics include the channel depth, its minima and
4533 % maxima, the mean, the standard deviation, the kurtosis and the skewness.
4534 % You can access the red channel mean, for example, like this:
4535 %
4536 % channel_statistics=MagickGetImageStatistics(wand);
4537 % red_mean=channel_statistics[RedPixelChannel].mean;
4538 %
4539 % Use MagickRelinquishMemory() to free the statistics buffer.
4540 %
4541 % The format of the MagickGetImageStatistics method is:
4542 %
4543 % ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4544 %
4545 % A description of each parameter follows:
4546 %
4547 % o wand: the magick wand.
4548 %
4549 */
4550 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4551 {
4552  assert(wand != (MagickWand *) NULL);
4553  assert(wand->signature == MagickWandSignature);
4554  if (wand->debug != MagickFalse)
4555  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556  if (wand->images == (Image *) NULL)
4557  {
4558  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4559  "ContainsNoImages","`%s'",wand->name);
4560  return((ChannelStatistics *) NULL);
4561  }
4562  return(GetImageStatistics(wand->images,wand->exception));
4563 }
4564 ␌
4565 /*
4566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4567 % %
4568 % %
4569 % %
4570 % 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 %
4571 % %
4572 % %
4573 % %
4574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4575 %
4576 % MagickGetImageColormapColor() returns the color of the specified colormap
4577 % index.
4578 %
4579 % The format of the MagickGetImageColormapColor method is:
4580 %
4581 % MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4582 % const size_t index,PixelWand *color)
4583 %
4584 % A description of each parameter follows:
4585 %
4586 % o wand: the magick wand.
4587 %
4588 % o index: the offset into the image colormap.
4589 %
4590 % o color: Return the colormap color in this wand.
4591 %
4592 */
4593 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4594  const size_t index,PixelWand *color)
4595 {
4596  assert(wand != (MagickWand *) NULL);
4597  assert(wand->signature == MagickWandSignature);
4598  if (wand->debug != MagickFalse)
4599  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4600  if (wand->images == (Image *) NULL)
4601  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4602  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4603  (index >= wand->images->colors))
4604  {
4605  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4606  "InvalidColormapIndex","`%s'",wand->name);
4607  return(MagickFalse);
4608  }
4609  PixelSetPixelColor(color,wand->images->colormap+index);
4610  return(MagickTrue);
4611 }
4612 ␌
4613 /*
4614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4615 % %
4616 % %
4617 % %
4618 % M a g i c k G e t I m a g e C o l o r s %
4619 % %
4620 % %
4621 % %
4622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4623 %
4624 % MagickGetImageColors() gets the number of unique colors in the image.
4625 %
4626 % The format of the MagickGetImageColors method is:
4627 %
4628 % size_t MagickGetImageColors(MagickWand *wand)
4629 %
4630 % A description of each parameter follows:
4631 %
4632 % o wand: the magick wand.
4633 %
4634 */
4635 WandExport size_t MagickGetImageColors(MagickWand *wand)
4636 {
4637  assert(wand != (MagickWand *) NULL);
4638  assert(wand->signature == MagickWandSignature);
4639  if (wand->debug != MagickFalse)
4640  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4641  if (wand->images == (Image *) NULL)
4642  {
4643  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4644  "ContainsNoImages","`%s'",wand->name);
4645  return(0);
4646  }
4647  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4648 }
4649 ␌
4650 /*
4651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4652 % %
4653 % %
4654 % %
4655 % M a g i c k G e t I m a g e C o l o r s p a c e %
4656 % %
4657 % %
4658 % %
4659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4660 %
4661 % MagickGetImageColorspace() gets the image colorspace.
4662 %
4663 % The format of the MagickGetImageColorspace method is:
4664 %
4665 % ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4666 %
4667 % A description of each parameter follows:
4668 %
4669 % o wand: the magick wand.
4670 %
4671 */
4672 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4673 {
4674  assert(wand != (MagickWand *) NULL);
4675  assert(wand->signature == MagickWandSignature);
4676  if (wand->debug != MagickFalse)
4677  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4678  if (wand->images == (Image *) NULL)
4679  {
4680  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4681  "ContainsNoImages","`%s'",wand->name);
4682  return(UndefinedColorspace);
4683  }
4684  return(wand->images->colorspace);
4685 }
4686 ␌
4687 /*
4688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4689 % %
4690 % %
4691 % %
4692 % M a g i c k G e t I m a g e C o m p o s e %
4693 % %
4694 % %
4695 % %
4696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4697 %
4698 % MagickGetImageCompose() returns the composite operator associated with the
4699 % image.
4700 %
4701 % The format of the MagickGetImageCompose method is:
4702 %
4703 % CompositeOperator MagickGetImageCompose(MagickWand *wand)
4704 %
4705 % A description of each parameter follows:
4706 %
4707 % o wand: the magick wand.
4708 %
4709 */
4710 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4711 {
4712  assert(wand != (MagickWand *) NULL);
4713  assert(wand->signature == MagickWandSignature);
4714  if (wand->debug != MagickFalse)
4715  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4716  if (wand->images == (Image *) NULL)
4717  {
4718  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4719  "ContainsNoImages","`%s'",wand->name);
4720  return(UndefinedCompositeOp);
4721  }
4722  return(wand->images->compose);
4723 }
4724 ␌
4725 /*
4726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4727 % %
4728 % %
4729 % %
4730 % 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 %
4731 % %
4732 % %
4733 % %
4734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4735 %
4736 % MagickGetImageCompression() gets the image compression.
4737 %
4738 % The format of the MagickGetImageCompression method is:
4739 %
4740 % CompressionType MagickGetImageCompression(MagickWand *wand)
4741 %
4742 % A description of each parameter follows:
4743 %
4744 % o wand: the magick wand.
4745 %
4746 */
4747 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4748 {
4749  assert(wand != (MagickWand *) NULL);
4750  assert(wand->signature == MagickWandSignature);
4751  if (wand->debug != MagickFalse)
4752  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4753  if (wand->images == (Image *) NULL)
4754  {
4755  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4756  "ContainsNoImages","`%s'",wand->name);
4757  return(UndefinedCompression);
4758  }
4759  return(wand->images->compression);
4760 }
4761 ␌
4762 /*
4763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4764 % %
4765 % %
4766 % %
4767 % 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 %
4768 % %
4769 % %
4770 % %
4771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4772 %
4773 % MagickGetImageCompressionQuality() gets the image compression quality.
4774 %
4775 % The format of the MagickGetImageCompressionQuality method is:
4776 %
4777 % size_t MagickGetImageCompressionQuality(MagickWand *wand)
4778 %
4779 % A description of each parameter follows:
4780 %
4781 % o wand: the magick wand.
4782 %
4783 */
4784 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4785 {
4786  assert(wand != (MagickWand *) NULL);
4787  assert(wand->signature == MagickWandSignature);
4788  if (wand->debug != MagickFalse)
4789  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4790  if (wand->images == (Image *) NULL)
4791  {
4792  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4793  "ContainsNoImages","`%s'",wand->name);
4794  return(0UL);
4795  }
4796  return(wand->images->quality);
4797 }
4798 ␌
4799 /*
4800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4801 % %
4802 % %
4803 % %
4804 % M a g i c k G e t I m a g e D e l a y %
4805 % %
4806 % %
4807 % %
4808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4809 %
4810 % MagickGetImageDelay() gets the image delay.
4811 %
4812 % The format of the MagickGetImageDelay method is:
4813 %
4814 % size_t MagickGetImageDelay(MagickWand *wand)
4815 %
4816 % A description of each parameter follows:
4817 %
4818 % o wand: the magick wand.
4819 %
4820 */
4821 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4822 {
4823  assert(wand != (MagickWand *) NULL);
4824  assert(wand->signature == MagickWandSignature);
4825  if (wand->debug != MagickFalse)
4826  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4827  if (wand->images == (Image *) NULL)
4828  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4829  return(wand->images->delay);
4830 }
4831 ␌
4832 /*
4833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4834 % %
4835 % %
4836 % %
4837 % M a g i c k G e t I m a g e D e p t h %
4838 % %
4839 % %
4840 % %
4841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4842 %
4843 % MagickGetImageDepth() gets the image depth.
4844 %
4845 % The format of the MagickGetImageDepth method is:
4846 %
4847 % size_t MagickGetImageDepth(MagickWand *wand)
4848 %
4849 % A description of each parameter follows:
4850 %
4851 % o wand: the magick wand.
4852 %
4853 */
4854 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4855 {
4856  assert(wand != (MagickWand *) NULL);
4857  assert(wand->signature == MagickWandSignature);
4858  if (wand->debug != MagickFalse)
4859  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4860  if (wand->images == (Image *) NULL)
4861  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4862  return(wand->images->depth);
4863 }
4864 ␌
4865 /*
4866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4867 % %
4868 % %
4869 % %
4870 % M a g i c k G e t I m a g e D i s p o s e %
4871 % %
4872 % %
4873 % %
4874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4875 %
4876 % MagickGetImageDispose() gets the image disposal method.
4877 %
4878 % The format of the MagickGetImageDispose method is:
4879 %
4880 % DisposeType MagickGetImageDispose(MagickWand *wand)
4881 %
4882 % A description of each parameter follows:
4883 %
4884 % o wand: the magick wand.
4885 %
4886 */
4887 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4888 {
4889  assert(wand != (MagickWand *) NULL);
4890  assert(wand->signature == MagickWandSignature);
4891  if (wand->debug != MagickFalse)
4892  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4893  if (wand->images == (Image *) NULL)
4894  {
4895  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4896  "ContainsNoImages","`%s'",wand->name);
4897  return(UndefinedDispose);
4898  }
4899  return((DisposeType) wand->images->dispose);
4900 }
4901 ␌
4902 /*
4903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4904 % %
4905 % %
4906 % %
4907 % M a g i c k G e t I m a g e D i s t o r t i o n %
4908 % %
4909 % %
4910 % %
4911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4912 %
4913 % MagickGetImageDistortion() compares an image to a reconstructed image and
4914 % returns the specified distortion metric.
4915 %
4916 % The format of the MagickGetImageDistortion method is:
4917 %
4918 % MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4919 % const MagickWand *reference,const MetricType metric,
4920 % double *distortion)
4921 %
4922 % A description of each parameter follows:
4923 %
4924 % o wand: the magick wand.
4925 %
4926 % o reference: the reference wand.
4927 %
4928 % o metric: the metric.
4929 %
4930 % o distortion: the computed distortion between the images.
4931 %
4932 */
4933 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4934  const MagickWand *reference,const MetricType metric,double *distortion)
4935 {
4936  MagickBooleanType
4937  status;
4938 
4939  assert(wand != (MagickWand *) NULL);
4940  assert(wand->signature == MagickWandSignature);
4941  if (wand->debug != MagickFalse)
4942  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4943  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4944  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4945  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4946  wand->exception);
4947  return(status);
4948 }
4949 ␌
4950 /*
4951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4952 % %
4953 % %
4954 % %
4955 % 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 %
4956 % %
4957 % %
4958 % %
4959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4960 %
4961 % MagickGetImageDistortions() compares one or more pixel channels of an
4962 % image to a reconstructed image and returns the specified distortion metrics.
4963 %
4964 % Use MagickRelinquishMemory() to free the metrics when you are done with them.
4965 %
4966 % The format of the MagickGetImageDistortions method is:
4967 %
4968 % double *MagickGetImageDistortions(MagickWand *wand,
4969 % const MagickWand *reference,const MetricType metric)
4970 %
4971 % A description of each parameter follows:
4972 %
4973 % o wand: the magick wand.
4974 %
4975 % o reference: the reference wand.
4976 %
4977 % o metric: the metric.
4978 %
4979 */
4980 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4981  const MagickWand *reference,const MetricType metric)
4982 {
4983  double
4984  *channel_distortion;
4985 
4986  assert(wand != (MagickWand *) NULL);
4987  assert(wand->signature == MagickWandSignature);
4988  if (wand->debug != MagickFalse)
4989  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4990  assert(reference != (MagickWand *) NULL);
4991  assert(reference->signature == MagickWandSignature);
4992  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4993  {
4994  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4995  "ContainsNoImages","`%s'",wand->name);
4996  return((double *) NULL);
4997  }
4998  channel_distortion=GetImageDistortions(wand->images,reference->images,
4999  metric,wand->exception);
5000  return(channel_distortion);
5001 }
5002 ␌
5003 /*
5004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5005 % %
5006 % %
5007 % %
5008 % M a g i c k G e t I m a g e E n d i a n %
5009 % %
5010 % %
5011 % %
5012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5013 %
5014 % MagickGetImageEndian() gets the image endian.
5015 %
5016 % The format of the MagickGetImageEndian method is:
5017 %
5018 % EndianType MagickGetImageEndian(MagickWand *wand)
5019 %
5020 % A description of each parameter follows:
5021 %
5022 % o wand: the magick wand.
5023 %
5024 */
5025 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
5026 {
5027  assert(wand != (MagickWand *) NULL);
5028  assert(wand->signature == MagickWandSignature);
5029  if (wand->debug != MagickFalse)
5030  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5031  if (wand->images == (Image *) NULL)
5032  {
5033  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5034  "ContainsNoImages","`%s'",wand->name);
5035  return(UndefinedEndian);
5036  }
5037  return(wand->images->endian);
5038 }
5039 ␌
5040 /*
5041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5042 % %
5043 % %
5044 % %
5045 % M a g i c k G e t I m a g e F i l e n a m e %
5046 % %
5047 % %
5048 % %
5049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5050 %
5051 % MagickGetImageFilename() returns the filename of a particular image in a
5052 % sequence.
5053 %
5054 % The format of the MagickGetImageFilename method is:
5055 %
5056 % char *MagickGetImageFilename(MagickWand *wand)
5057 %
5058 % A description of each parameter follows:
5059 %
5060 % o wand: the magick wand.
5061 %
5062 */
5063 WandExport char *MagickGetImageFilename(MagickWand *wand)
5064 {
5065  assert(wand != (MagickWand *) NULL);
5066  assert(wand->signature == MagickWandSignature);
5067  if (wand->debug != MagickFalse)
5068  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5069  if (wand->images == (Image *) NULL)
5070  {
5071  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5072  "ContainsNoImages","`%s'",wand->name);
5073  return((char *) NULL);
5074  }
5075  return(AcquireString(wand->images->filename));
5076 }
5077 ␌
5078 /*
5079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5080 % %
5081 % %
5082 % %
5083 % M a g i c k G e t I m a g e F i l t e r %
5084 % %
5085 % %
5086 % %
5087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5088 %
5089 % MagickGetImageFilter() gets the image filter.
5090 %
5091 % The format of the MagickGetImageFilter method is:
5092 %
5093 % FilterType MagickGetImageFilter(MagickWand *wand)
5094 %
5095 % A description of each parameter follows:
5096 %
5097 % o wand: the magick wand.
5098 %
5099 */
5100 WandExport FilterType MagickGetImageFilter(MagickWand *wand)
5101 {
5102  assert(wand != (MagickWand *) NULL);
5103  assert(wand->signature == MagickWandSignature);
5104  if (wand->debug != MagickFalse)
5105  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5106  if (wand->images == (Image *) NULL)
5107  {
5108  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5109  "ContainsNoImages","`%s'",wand->name);
5110  return(UndefinedFilter);
5111  }
5112  return(wand->images->filter);
5113 }
5114 ␌
5115 /*
5116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5117 % %
5118 % %
5119 % %
5120 % M a g i c k G e t I m a g e F o r m a t %
5121 % %
5122 % %
5123 % %
5124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5125 %
5126 % MagickGetImageFormat() returns the format of a particular image in a
5127 % sequence.
5128 %
5129 % The format of the MagickGetImageFormat method is:
5130 %
5131 % char *MagickGetImageFormat(MagickWand *wand)
5132 %
5133 % A description of each parameter follows:
5134 %
5135 % o wand: the magick wand.
5136 %
5137 */
5138 WandExport char *MagickGetImageFormat(MagickWand *wand)
5139 {
5140  assert(wand != (MagickWand *) NULL);
5141  assert(wand->signature == MagickWandSignature);
5142  if (wand->debug != MagickFalse)
5143  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5144  if (wand->images == (Image *) NULL)
5145  {
5146  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5147  "ContainsNoImages","`%s'",wand->name);
5148  return((char *) NULL);
5149  }
5150  return(AcquireString(wand->images->magick));
5151 }
5152 ␌
5153 /*
5154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5155 % %
5156 % %
5157 % %
5158 % M a g i c k G e t I m a g e F u z z %
5159 % %
5160 % %
5161 % %
5162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5163 %
5164 % MagickGetImageFuzz() gets the image fuzz.
5165 %
5166 % The format of the MagickGetImageFuzz method is:
5167 %
5168 % double MagickGetImageFuzz(MagickWand *wand)
5169 %
5170 % A description of each parameter follows:
5171 %
5172 % o wand: the magick wand.
5173 %
5174 */
5175 WandExport double MagickGetImageFuzz(MagickWand *wand)
5176 {
5177  assert(wand != (MagickWand *) NULL);
5178  assert(wand->signature == MagickWandSignature);
5179  if (wand->debug != MagickFalse)
5180  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5181  if (wand->images == (Image *) NULL)
5182  {
5183  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5184  "ContainsNoImages","`%s'",wand->name);
5185  return(0.0);
5186  }
5187  return(wand->images->fuzz);
5188 }
5189 ␌
5190 /*
5191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5192 % %
5193 % %
5194 % %
5195 % M a g i c k G e t I m a g e G a m m a %
5196 % %
5197 % %
5198 % %
5199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5200 %
5201 % MagickGetImageGamma() gets the image gamma.
5202 %
5203 % The format of the MagickGetImageGamma method is:
5204 %
5205 % double MagickGetImageGamma(MagickWand *wand)
5206 %
5207 % A description of each parameter follows:
5208 %
5209 % o wand: the magick wand.
5210 %
5211 */
5212 WandExport double MagickGetImageGamma(MagickWand *wand)
5213 {
5214  assert(wand != (MagickWand *) NULL);
5215  assert(wand->signature == MagickWandSignature);
5216  if (wand->debug != MagickFalse)
5217  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5218  if (wand->images == (Image *) NULL)
5219  {
5220  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5221  "ContainsNoImages","`%s'",wand->name);
5222  return(0.0);
5223  }
5224  return(wand->images->gamma);
5225 }
5226 ␌
5227 /*
5228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5229 % %
5230 % %
5231 % %
5232 % M a g i c k G e t I m a g e G r a v i t y %
5233 % %
5234 % %
5235 % %
5236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5237 %
5238 % MagickGetImageGravity() gets the image gravity.
5239 %
5240 % The format of the MagickGetImageGravity method is:
5241 %
5242 % GravityType MagickGetImageGravity(MagickWand *wand)
5243 %
5244 % A description of each parameter follows:
5245 %
5246 % o wand: the magick wand.
5247 %
5248 */
5249 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5250 {
5251  assert(wand != (MagickWand *) NULL);
5252  assert(wand->signature == MagickWandSignature);
5253  if (wand->debug != MagickFalse)
5254  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5255  if (wand->images == (Image *) NULL)
5256  {
5257  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5258  "ContainsNoImages","`%s'",wand->name);
5259  return(UndefinedGravity);
5260  }
5261  return(wand->images->gravity);
5262 }
5263 ␌
5264 /*
5265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5266 % %
5267 % %
5268 % %
5269 % 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 %
5270 % %
5271 % %
5272 % %
5273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5274 %
5275 % MagickGetImageGreenPrimary() returns the chromaticity green primary point.
5276 %
5277 % The format of the MagickGetImageGreenPrimary method is:
5278 %
5279 % MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5280 % double *y,double *z)
5281 %
5282 % A description of each parameter follows:
5283 %
5284 % o wand: the magick wand.
5285 %
5286 % o x: the chromaticity green primary x-point.
5287 %
5288 % o y: the chromaticity green primary y-point.
5289 %
5290 % o z: the chromaticity green primary z-point.
5291 %
5292 */
5293 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5294  double *x,double *y,double *z)
5295 {
5296  assert(wand != (MagickWand *) NULL);
5297  assert(wand->signature == MagickWandSignature);
5298  if (wand->debug != MagickFalse)
5299  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5300  if (wand->images == (Image *) NULL)
5301  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5302  *x=wand->images->chromaticity.green_primary.x;
5303  *y=wand->images->chromaticity.green_primary.y;
5304  *z=wand->images->chromaticity.green_primary.z;
5305  return(MagickTrue);
5306 }
5307 ␌
5308 /*
5309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5310 % %
5311 % %
5312 % %
5313 % M a g i c k G e t I m a g e H e i g h t %
5314 % %
5315 % %
5316 % %
5317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5318 %
5319 % MagickGetImageHeight() returns the image height.
5320 %
5321 % The format of the MagickGetImageHeight method is:
5322 %
5323 % size_t MagickGetImageHeight(MagickWand *wand)
5324 %
5325 % A description of each parameter follows:
5326 %
5327 % o wand: the magick wand.
5328 %
5329 */
5330 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5331 {
5332  assert(wand != (MagickWand *) NULL);
5333  assert(wand->signature == MagickWandSignature);
5334  if (wand->debug != MagickFalse)
5335  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5336  if (wand->images == (Image *) NULL)
5337  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5338  return(wand->images->rows);
5339 }
5340 ␌
5341 /*
5342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5343 % %
5344 % %
5345 % %
5346 % M a g i c k G e t I m a g e H i s t o g r a m %
5347 % %
5348 % %
5349 % %
5350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5351 %
5352 % MagickGetImageHistogram() returns the image histogram as an array of
5353 % PixelWand wands.
5354 %
5355 % The format of the MagickGetImageHistogram method is:
5356 %
5357 % PixelWand **MagickGetImageHistogram(MagickWand *wand,
5358 % size_t *number_colors)
5359 %
5360 % A description of each parameter follows:
5361 %
5362 % o wand: the magick wand.
5363 %
5364 % o number_colors: the number of unique colors in the image and the number
5365 % of pixel wands returned.
5366 %
5367 */
5368 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5369  size_t *number_colors)
5370 {
5371  PixelInfo
5372  *histogram;
5373 
5374  PixelWand
5375  **pixel_wands;
5376 
5377  ssize_t
5378  i;
5379 
5380  assert(wand != (MagickWand *) NULL);
5381  assert(wand->signature == MagickWandSignature);
5382  if (wand->debug != MagickFalse)
5383  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5384  if (wand->images == (Image *) NULL)
5385  {
5386  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5387  "ContainsNoImages","`%s'",wand->name);
5388  return((PixelWand **) NULL);
5389  }
5390  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5391  if (histogram == (PixelInfo *) NULL)
5392  return((PixelWand **) NULL);
5393  pixel_wands=NewPixelWands(*number_colors);
5394  for (i=0; i < (ssize_t) *number_colors; i++)
5395  {
5396  PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5397  PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5398  }
5399  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5400  return(pixel_wands);
5401 }
5402 ␌
5403 /*
5404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5405 % %
5406 % %
5407 % %
5408 % 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 %
5409 % %
5410 % %
5411 % %
5412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5413 %
5414 % MagickGetImageInterlaceScheme() gets the image interlace scheme.
5415 %
5416 % The format of the MagickGetImageInterlaceScheme method is:
5417 %
5418 % InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5419 %
5420 % A description of each parameter follows:
5421 %
5422 % o wand: the magick wand.
5423 %
5424 */
5425 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5426 {
5427  assert(wand != (MagickWand *) NULL);
5428  assert(wand->signature == MagickWandSignature);
5429  if (wand->debug != MagickFalse)
5430  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5431  if (wand->images == (Image *) NULL)
5432  {
5433  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5434  "ContainsNoImages","`%s'",wand->name);
5435  return(UndefinedInterlace);
5436  }
5437  return(wand->images->interlace);
5438 }
5439 ␌
5440 /*
5441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5442 % %
5443 % %
5444 % %
5445 % 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 %
5446 % %
5447 % %
5448 % %
5449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5450 %
5451 % MagickGetImageInterpolateMethod() returns the interpolation method for the
5452 % specified image.
5453 %
5454 % The format of the MagickGetImageInterpolateMethod method is:
5455 %
5456 % PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5457 %
5458 % A description of each parameter follows:
5459 %
5460 % o wand: the magick wand.
5461 %
5462 */
5463 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5464  MagickWand *wand)
5465 {
5466  assert(wand != (MagickWand *) NULL);
5467  assert(wand->signature == MagickWandSignature);
5468  if (wand->debug != MagickFalse)
5469  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5470  if (wand->images == (Image *) NULL)
5471  {
5472  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5473  "ContainsNoImages","`%s'",wand->name);
5474  return(UndefinedInterpolatePixel);
5475  }
5476  return(wand->images->interpolate);
5477 }
5478 ␌
5479 /*
5480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5481 % %
5482 % %
5483 % %
5484 % M a g i c k G e t I m a g e I t e r a t i o n s %
5485 % %
5486 % %
5487 % %
5488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5489 %
5490 % MagickGetImageIterations() gets the image iterations.
5491 %
5492 % The format of the MagickGetImageIterations method is:
5493 %
5494 % size_t MagickGetImageIterations(MagickWand *wand)
5495 %
5496 % A description of each parameter follows:
5497 %
5498 % o wand: the magick wand.
5499 %
5500 */
5501 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5502 {
5503  assert(wand != (MagickWand *) NULL);
5504  assert(wand->signature == MagickWandSignature);
5505  if (wand->debug != MagickFalse)
5506  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5507  if (wand->images == (Image *) NULL)
5508  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5509  return(wand->images->iterations);
5510 }
5511 ␌
5512 /*
5513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5514 % %
5515 % %
5516 % %
5517 % M a g i c k G e t I m a g e L e n g t h %
5518 % %
5519 % %
5520 % %
5521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5522 %
5523 % MagickGetImageLength() returns the image length in bytes.
5524 %
5525 % The format of the MagickGetImageLength method is:
5526 %
5527 % MagickBooleanType MagickGetImageLength(MagickWand *wand,
5528 % MagickSizeType *length)
5529 %
5530 % A description of each parameter follows:
5531 %
5532 % o wand: the magick wand.
5533 %
5534 % o length: the image length in bytes.
5535 %
5536 */
5537 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5538  MagickSizeType *length)
5539 {
5540  assert(wand != (MagickWand *) NULL);
5541  assert(wand->signature == MagickWandSignature);
5542  if (wand->debug != MagickFalse)
5543  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5544  if (wand->images == (Image *) NULL)
5545  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5546  *length=GetBlobSize(wand->images);
5547  return(MagickTrue);
5548 }
5549 ␌
5550 /*
5551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5552 % %
5553 % %
5554 % %
5555 % M a g i c k G e t I m a g e M a t t e C o l o r %
5556 % %
5557 % %
5558 % %
5559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5560 %
5561 % MagickGetImageMatteColor() returns the image matte color.
5562 %
5563 % The format of the MagickGetImageMatteColor method is:
5564 %
5565 % MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5566 % PixelWand *matte_color)
5567 %
5568 % A description of each parameter follows:
5569 %
5570 % o wand: the magick wand.
5571 %
5572 % o matte_color: return the alpha color.
5573 %
5574 */
5575 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5576  PixelWand *matte_color)
5577 {
5578  assert(wand != (MagickWand *)NULL);
5579  assert(wand->signature == MagickWandSignature);
5580  if (wand->debug != MagickFalse)
5581  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5582  if (wand->images == (Image *)NULL)
5583  ThrowWandException(WandError, "ContainsNoImages", wand->name);
5584  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5585  return(MagickTrue);
5586 }
5587 ␌
5588 /*
5589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5590 % %
5591 % %
5592 % %
5593 % 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 %
5594 % %
5595 % %
5596 % %
5597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5598 %
5599 % MagickGetImageOrientation() returns the image orientation.
5600 %
5601 % The format of the MagickGetImageOrientation method is:
5602 %
5603 % OrientationType MagickGetImageOrientation(MagickWand *wand)
5604 %
5605 % A description of each parameter follows:
5606 %
5607 % o wand: the magick wand.
5608 %
5609 */
5610 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5611 {
5612  assert(wand != (MagickWand *) NULL);
5613  assert(wand->signature == MagickWandSignature);
5614  if (wand->debug != MagickFalse)
5615  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5616  if (wand->images == (Image *) NULL)
5617  {
5618  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5619  "ContainsNoImages","`%s'",wand->name);
5620  return(UndefinedOrientation);
5621  }
5622  return(wand->images->orientation);
5623 }
5624 ␌
5625 /*
5626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5627 % %
5628 % %
5629 % %
5630 % M a g i c k G e t I m a g e P a g e %
5631 % %
5632 % %
5633 % %
5634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5635 %
5636 % MagickGetImagePage() returns the page geometry associated with the image.
5637 %
5638 % The format of the MagickGetImagePage method is:
5639 %
5640 % MagickBooleanType MagickGetImagePage(MagickWand *wand,
5641 % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5642 %
5643 % A description of each parameter follows:
5644 %
5645 % o wand: the magick wand.
5646 %
5647 % o width: the page width.
5648 %
5649 % o height: the page height.
5650 %
5651 % o x: the page x-offset.
5652 %
5653 % o y: the page y-offset.
5654 %
5655 */
5656 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5657  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5658 {
5659  assert(wand != (const MagickWand *) NULL);
5660  assert(wand->signature == MagickWandSignature);
5661  if (wand->debug != MagickFalse)
5662  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5663  if (wand->images == (Image *) NULL)
5664  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5665  *width=wand->images->page.width;
5666  *height=wand->images->page.height;
5667  *x=wand->images->page.x;
5668  *y=wand->images->page.y;
5669  return(MagickTrue);
5670 }
5671 ␌
5672 /*
5673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5674 % %
5675 % %
5676 % %
5677 % M a g i c k G e t I m a g e P i x e l C o l o r %
5678 % %
5679 % %
5680 % %
5681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5682 %
5683 % MagickGetImagePixelColor() gets the color of the specified pixel.
5684 %
5685 % The format of the MagickGetImagePixelColor method is:
5686 %
5687 % MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5688 % const ssize_t x,const ssize_t y,PixelWand *color)
5689 %
5690 % A description of each parameter follows:
5691 %
5692 % o wand: the magick wand.
5693 %
5694 % o x,y: the pixel offset into the image.
5695 %
5696 % o color: Return the colormap color in this wand.
5697 %
5698 */
5699 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5700  const ssize_t x,const ssize_t y,PixelWand *color)
5701 {
5702  const Quantum
5703  *p;
5704 
5705  CacheView
5706  *image_view;
5707 
5708  assert(wand != (MagickWand *) NULL);
5709  assert(wand->signature == MagickWandSignature);
5710  if (wand->debug != MagickFalse)
5711  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5712  if (wand->images == (Image *) NULL)
5713  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5714  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5715  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5716  if (p == (const Quantum *) NULL)
5717  {
5718  image_view=DestroyCacheView(image_view);
5719  return(MagickFalse);
5720  }
5721  PixelSetQuantumPixel(wand->images,p,color);
5722  image_view=DestroyCacheView(image_view);
5723  return(MagickTrue);
5724 }
5725 ␌
5726 /*
5727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5728 % %
5729 % %
5730 % %
5731 % M a g i c k G e t I m a g e R e d P r i m a r y %
5732 % %
5733 % %
5734 % %
5735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5736 %
5737 % MagickGetImageRedPrimary() returns the chromaticity red primary point.
5738 %
5739 % The format of the MagickGetImageRedPrimary method is:
5740 %
5741 % MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5742 % double *y, double *z)
5743 %
5744 % A description of each parameter follows:
5745 %
5746 % o wand: the magick wand.
5747 %
5748 % o x: the chromaticity red primary x-point.
5749 %
5750 % o y: the chromaticity red primary y-point.
5751 %
5752 % o z: the chromaticity red primary z-point.
5753 %
5754 */
5755 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5756  double *x,double *y,double *z)
5757 {
5758  assert(wand != (MagickWand *) NULL);
5759  assert(wand->signature == MagickWandSignature);
5760  if (wand->debug != MagickFalse)
5761  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5762  if (wand->images == (Image *) NULL)
5763  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5764  *x=wand->images->chromaticity.red_primary.x;
5765  *y=wand->images->chromaticity.red_primary.y;
5766  *z=wand->images->chromaticity.red_primary.z;
5767  return(MagickTrue);
5768 }
5769 ␌
5770 /*
5771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5772 % %
5773 % %
5774 % %
5775 % M a g i c k G e t I m a g e R e g i o n %
5776 % %
5777 % %
5778 % %
5779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5780 %
5781 % MagickGetImageRegion() extracts a region of the image and returns it as a
5782 % a new wand.
5783 %
5784 % The format of the MagickGetImageRegion method is:
5785 %
5786 % MagickWand *MagickGetImageRegion(MagickWand *wand,
5787 % const size_t width,const size_t height,const ssize_t x,
5788 % const ssize_t y)
5789 %
5790 % A description of each parameter follows:
5791 %
5792 % o wand: the magick wand.
5793 %
5794 % o width: the region width.
5795 %
5796 % o height: the region height.
5797 %
5798 % o x: the region x offset.
5799 %
5800 % o y: the region y offset.
5801 %
5802 */
5803 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5804  const size_t width,const size_t height,const ssize_t x,
5805  const ssize_t y)
5806 {
5807  Image
5808  *region_image;
5809 
5810  RectangleInfo
5811  region;
5812 
5813  assert(wand != (MagickWand *) NULL);
5814  assert(wand->signature == MagickWandSignature);
5815  if (wand->debug != MagickFalse)
5816  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5817  if (wand->images == (Image *) NULL)
5818  return((MagickWand *) NULL);
5819  region.width=width;
5820  region.height=height;
5821  region.x=x;
5822  region.y=y;
5823  region_image=CropImage(wand->images,&region,wand->exception);
5824  if (region_image == (Image *) NULL)
5825  return((MagickWand *) NULL);
5826  return(CloneMagickWandFromImages(wand,region_image));
5827 }
5828 ␌
5829 /*
5830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5831 % %
5832 % %
5833 % %
5834 % 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 %
5835 % %
5836 % %
5837 % %
5838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5839 %
5840 % MagickGetImageRenderingIntent() gets the image rendering intent.
5841 %
5842 % The format of the MagickGetImageRenderingIntent method is:
5843 %
5844 % RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5845 %
5846 % A description of each parameter follows:
5847 %
5848 % o wand: the magick wand.
5849 %
5850 */
5851 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
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  {
5859  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5860  "ContainsNoImages","`%s'",wand->name);
5861  return(UndefinedIntent);
5862  }
5863  return((RenderingIntent) wand->images->rendering_intent);
5864 }
5865 ␌
5866 /*
5867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5868 % %
5869 % %
5870 % %
5871 % M a g i c k G e t I m a g e R e s o l u t i o n %
5872 % %
5873 % %
5874 % %
5875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5876 %
5877 % MagickGetImageResolution() gets the image X and Y resolution.
5878 %
5879 % The format of the MagickGetImageResolution method is:
5880 %
5881 % MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5882 % double *y)
5883 %
5884 % A description of each parameter follows:
5885 %
5886 % o wand: the magick wand.
5887 %
5888 % o x: the image x-resolution.
5889 %
5890 % o y: the image y-resolution.
5891 %
5892 */
5893 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5894  double *x,double *y)
5895 {
5896  assert(wand != (MagickWand *) NULL);
5897  assert(wand->signature == MagickWandSignature);
5898  if (wand->debug != MagickFalse)
5899  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5900  if (wand->images == (Image *) NULL)
5901  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5902  *x=wand->images->resolution.x;
5903  *y=wand->images->resolution.y;
5904  return(MagickTrue);
5905 }
5906 ␌
5907 /*
5908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5909 % %
5910 % %
5911 % %
5912 % M a g i c k G e t I m a g e S c e n e %
5913 % %
5914 % %
5915 % %
5916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5917 %
5918 % MagickGetImageScene() gets the image scene.
5919 %
5920 % The format of the MagickGetImageScene method is:
5921 %
5922 % size_t MagickGetImageScene(MagickWand *wand)
5923 %
5924 % A description of each parameter follows:
5925 %
5926 % o wand: the magick wand.
5927 %
5928 */
5929 WandExport size_t MagickGetImageScene(MagickWand *wand)
5930 {
5931  assert(wand != (MagickWand *) NULL);
5932  assert(wand->signature == MagickWandSignature);
5933  if (wand->debug != MagickFalse)
5934  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5935  if (wand->images == (Image *) NULL)
5936  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5937  return(wand->images->scene);
5938 }
5939 ␌
5940 /*
5941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5942 % %
5943 % %
5944 % %
5945 % M a g i c k G e t I m a g e S i g n a t u r e %
5946 % %
5947 % %
5948 % %
5949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5950 %
5951 % MagickGetImageSignature() generates an SHA-256 message digest for the image
5952 % pixel stream.
5953 %
5954 % The format of the MagickGetImageSignature method is:
5955 %
5956 % char *MagickGetImageSignature(MagickWand *wand)
5957 %
5958 % A description of each parameter follows:
5959 %
5960 % o wand: the magick wand.
5961 %
5962 */
5963 WandExport char *MagickGetImageSignature(MagickWand *wand)
5964 {
5965  const char
5966  *value;
5967 
5968  MagickBooleanType
5969  status;
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  {
5977  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5978  "ContainsNoImages","`%s'",wand->name);
5979  return((char *) NULL);
5980  }
5981  status=SignatureImage(wand->images,wand->exception);
5982  if (status == MagickFalse)
5983  return((char *) NULL);
5984  value=GetImageProperty(wand->images,"signature",wand->exception);
5985  if (value == (const char *) NULL)
5986  return((char *) NULL);
5987  return(AcquireString(value));
5988 }
5989 ␌
5990 /*
5991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5992 % %
5993 % %
5994 % %
5995 % 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 %
5996 % %
5997 % %
5998 % %
5999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6000 %
6001 % MagickGetImageTicksPerSecond() gets the image ticks-per-second.
6002 %
6003 % The format of the MagickGetImageTicksPerSecond method is:
6004 %
6005 % size_t MagickGetImageTicksPerSecond(MagickWand *wand)
6006 %
6007 % A description of each parameter follows:
6008 %
6009 % o wand: the magick wand.
6010 %
6011 */
6012 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
6013 {
6014  assert(wand != (MagickWand *) NULL);
6015  assert(wand->signature == MagickWandSignature);
6016  if (wand->debug != MagickFalse)
6017  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6018  if (wand->images == (Image *) NULL)
6019  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6020  return((size_t) wand->images->ticks_per_second);
6021 }
6022 ␌
6023 /*
6024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6025 % %
6026 % %
6027 % %
6028 % M a g i c k G e t I m a g e T y p e %
6029 % %
6030 % %
6031 % %
6032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6033 %
6034 % MagickGetImageType() gets the potential image type:
6035 %
6036 % Bilevel Grayscale GrayscaleMatte
6037 % Palette PaletteMatte TrueColor
6038 % TrueColorMatte ColorSeparation ColorSeparationMatte
6039 %
6040 % The format of the MagickGetImageType method is:
6041 %
6042 % ImageType MagickGetImageType(MagickWand *wand)
6043 %
6044 % A description of each parameter follows:
6045 %
6046 % o wand: the magick wand.
6047 %
6048 */
6049 WandExport ImageType MagickGetImageType(MagickWand *wand)
6050 {
6051  assert(wand != (MagickWand *) NULL);
6052  assert(wand->signature == MagickWandSignature);
6053  if (wand->debug != MagickFalse)
6054  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6055  if (wand->images == (Image *) NULL)
6056  {
6057  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6058  "ContainsNoImages","`%s'",wand->name);
6059  return(UndefinedType);
6060  }
6061  return(GetImageType(wand->images));
6062 }
6063 ␌
6064 /*
6065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6066 % %
6067 % %
6068 % %
6069 % M a g i c k G e t I m a g e U n i t s %
6070 % %
6071 % %
6072 % %
6073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6074 %
6075 % MagickGetImageUnits() gets the image units of resolution.
6076 %
6077 % The format of the MagickGetImageUnits method is:
6078 %
6079 % ResolutionType MagickGetImageUnits(MagickWand *wand)
6080 %
6081 % A description of each parameter follows:
6082 %
6083 % o wand: the magick wand.
6084 %
6085 */
6086 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
6087 {
6088  assert(wand != (MagickWand *) NULL);
6089  assert(wand->signature == MagickWandSignature);
6090  if (wand->debug != MagickFalse)
6091  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6092  if (wand->images == (Image *) NULL)
6093  {
6094  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6095  "ContainsNoImages","`%s'",wand->name);
6096  return(UndefinedResolution);
6097  }
6098  return(wand->images->units);
6099 }
6100 ␌
6101 /*
6102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6103 % %
6104 % %
6105 % %
6106 % 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 %
6107 % %
6108 % %
6109 % %
6110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6111 %
6112 % MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6113 % specified image.
6114 %
6115 % The format of the MagickGetImageVirtualPixelMethod method is:
6116 %
6117 % VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6118 %
6119 % A description of each parameter follows:
6120 %
6121 % o wand: the magick wand.
6122 %
6123 */
6124 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6125 {
6126  assert(wand != (MagickWand *) NULL);
6127  assert(wand->signature == MagickWandSignature);
6128  if (wand->debug != MagickFalse)
6129  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6130  if (wand->images == (Image *) NULL)
6131  {
6132  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6133  "ContainsNoImages","`%s'",wand->name);
6134  return(UndefinedVirtualPixelMethod);
6135  }
6136  return(GetImageVirtualPixelMethod(wand->images));
6137 }
6138 ␌
6139 /*
6140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6141 % %
6142 % %
6143 % %
6144 % M a g i c k G e t I m a g e W h i t e P o i n t %
6145 % %
6146 % %
6147 % %
6148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6149 %
6150 % MagickGetImageWhitePoint() returns the chromaticity white point.
6151 %
6152 % The format of the MagickGetImageWhitePoint method is:
6153 %
6154 % MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6155 % double *y,double *z)
6156 %
6157 % A description of each parameter follows:
6158 %
6159 % o wand: the magick wand.
6160 %
6161 % o x: the chromaticity white x-point.
6162 %
6163 % o y: the chromaticity white y-point.
6164 %
6165 % o z: the chromaticity white z-point.
6166 %
6167 */
6168 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6169  double *x,double *y,double *z)
6170 {
6171  assert(wand != (MagickWand *) NULL);
6172  assert(wand->signature == MagickWandSignature);
6173  if (wand->debug != MagickFalse)
6174  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6175  if (wand->images == (Image *) NULL)
6176  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6177  *x=wand->images->chromaticity.white_point.x;
6178  *y=wand->images->chromaticity.white_point.y;
6179  *z=wand->images->chromaticity.white_point.z;
6180  return(MagickTrue);
6181 }
6182 ␌
6183 /*
6184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6185 % %
6186 % %
6187 % %
6188 % M a g i c k G e t I m a g e W i d t h %
6189 % %
6190 % %
6191 % %
6192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6193 %
6194 % MagickGetImageWidth() returns the image width.
6195 %
6196 % The format of the MagickGetImageWidth method is:
6197 %
6198 % size_t MagickGetImageWidth(MagickWand *wand)
6199 %
6200 % A description of each parameter follows:
6201 %
6202 % o wand: the magick wand.
6203 %
6204 */
6205 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6206 {
6207  assert(wand != (MagickWand *) NULL);
6208  assert(wand->signature == MagickWandSignature);
6209  if (wand->debug != MagickFalse)
6210  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6211  if (wand->images == (Image *) NULL)
6212  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6213  return(wand->images->columns);
6214 }
6215 ␌
6216 /*
6217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6218 % %
6219 % %
6220 % %
6221 % M a g i c k G e t N u m b e r I m a g e s %
6222 % %
6223 % %
6224 % %
6225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6226 %
6227 % MagickGetNumberImages() returns the number of images associated with a
6228 % magick wand.
6229 %
6230 % The format of the MagickGetNumberImages method is:
6231 %
6232 % size_t MagickGetNumberImages(MagickWand *wand)
6233 %
6234 % A description of each parameter follows:
6235 %
6236 % o wand: the magick wand.
6237 %
6238 */
6239 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6240 {
6241  assert(wand != (MagickWand *) NULL);
6242  assert(wand->signature == MagickWandSignature);
6243  if (wand->debug != MagickFalse)
6244  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6245  return(GetImageListLength(wand->images));
6246 }
6247 ␌
6248 /*
6249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6250 % %
6251 % %
6252 % %
6253 % 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 %
6254 % %
6255 % %
6256 % %
6257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6258 %
6259 % MagickGetImageTotalInkDensity() gets the image total ink density.
6260 %
6261 % The format of the MagickGetImageTotalInkDensity method is:
6262 %
6263 % double MagickGetImageTotalInkDensity(MagickWand *wand)
6264 %
6265 % A description of each parameter follows:
6266 %
6267 % o wand: the magick wand.
6268 %
6269 */
6270 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6271 {
6272  assert(wand != (MagickWand *) NULL);
6273  assert(wand->signature == MagickWandSignature);
6274  if (wand->debug != MagickFalse)
6275  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6276  if (wand->images == (Image *) NULL)
6277  {
6278  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6279  "ContainsNoImages","`%s'",wand->name);
6280  return(0.0);
6281  }
6282  return(GetImageTotalInkDensity(wand->images,wand->exception));
6283 }
6284 ␌
6285 /*
6286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6287 % %
6288 % %
6289 % %
6290 % M a g i c k H a l d C l u t I m a g e %
6291 % %
6292 % %
6293 % %
6294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6295 %
6296 % MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6297 % table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
6298 % dimensions. Create it with the HALD coder. You can apply any color
6299 % transformation to the Hald image and then use this method to apply the
6300 % transform to the image.
6301 %
6302 % The format of the MagickHaldClutImage method is:
6303 %
6304 % MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6305 % const MagickWand *hald_wand)
6306 %
6307 % A description of each parameter follows:
6308 %
6309 % o wand: the magick wand.
6310 %
6311 % o hald_image: the hald CLUT image.
6312 %
6313 */
6314 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6315  const MagickWand *hald_wand)
6316 {
6317  MagickBooleanType
6318  status;
6319 
6320  assert(wand != (MagickWand *) NULL);
6321  assert(wand->signature == MagickWandSignature);
6322  if (wand->debug != MagickFalse)
6323  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6324  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6325  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6326  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
6327  return(status);
6328 }
6329 ␌
6330 /*
6331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6332 % %
6333 % %
6334 % %
6335 % M a g i c k H a s N e x t I m a g e %
6336 % %
6337 % %
6338 % %
6339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6340 %
6341 % MagickHasNextImage() returns MagickTrue if the wand has more images when
6342 % traversing the list in the forward direction
6343 %
6344 % The format of the MagickHasNextImage method is:
6345 %
6346 % MagickBooleanType MagickHasNextImage(MagickWand *wand)
6347 %
6348 % A description of each parameter follows:
6349 %
6350 % o wand: the magick wand.
6351 %
6352 */
6353 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6354 {
6355  assert(wand != (MagickWand *) NULL);
6356  assert(wand->signature == MagickWandSignature);
6357  if (wand->debug != MagickFalse)
6358  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6359  if (wand->images == (Image *) NULL)
6360  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6361  if (GetNextImageInList(wand->images) == (Image *) NULL)
6362  return(MagickFalse);
6363  return(MagickTrue);
6364 }
6365 ␌
6366 /*
6367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6368 % %
6369 % %
6370 % %
6371 % M a g i c k H a s P r e v i o u s I m a g e %
6372 % %
6373 % %
6374 % %
6375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6376 %
6377 % MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6378 % traversing the list in the reverse direction
6379 %
6380 % The format of the MagickHasPreviousImage method is:
6381 %
6382 % MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6383 %
6384 % A description of each parameter follows:
6385 %
6386 % o wand: the magick wand.
6387 %
6388 */
6389 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6390 {
6391  assert(wand != (MagickWand *) NULL);
6392  assert(wand->signature == MagickWandSignature);
6393  if (wand->debug != MagickFalse)
6394  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6395  if (wand->images == (Image *) NULL)
6396  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6397  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6398  return(MagickFalse);
6399  return(MagickTrue);
6400 }
6401 ␌
6402 /*
6403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6404 % %
6405 % %
6406 % %
6407 % M a g i c k H o u g h L i n e I m a g e %
6408 % %
6409 % %
6410 % %
6411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6412 %
6413 % MagickHoughLineImage() can be used in conjunction with any binary edge
6414 % extracted image (we recommend Canny) to identify lines in the image. The
6415 % algorithm accumulates counts for every white pixel for every possible
6416 % orientation (for angles from 0 to 179 in 1 degree increments) and distance
6417 % from the center of the image to the corner (in 1 px increments) and stores
6418 % the counts in an accumulator matrix of angle vs distance. The size of the
6419 % accumulator is 180x(diagonal/2). Next it searches this space for peaks in
6420 % counts and converts the locations of the peaks to slope and intercept in the
6421 % normal x,y input image space. Use the slope/intercepts to find the endpoints
6422 % clipped to the bounds of the image. The lines are then drawn. The counts are
6423 % a measure of the length of the lines.
6424 %
6425 % The format of the MagickHoughLineImage method is:
6426 %
6427 % MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6428 % const size_t width,const size_t height,const size_t threshold)
6429 %
6430 % A description of each parameter follows:
6431 %
6432 % o wand: the magick wand.
6433 %
6434 % o width, height: find line pairs as local maxima in this neighborhood.
6435 %
6436 % o threshold: the line count threshold.
6437 %
6438 */
6439 WandExport MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6440  const size_t width,const size_t height,const size_t threshold)
6441 {
6442  Image
6443  *lines_image;
6444 
6445  assert(wand != (MagickWand *) NULL);
6446  assert(wand->signature == MagickWandSignature);
6447  if (wand->debug != MagickFalse)
6448  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6449  if (wand->images == (Image *) NULL)
6450  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6451  lines_image=HoughLineImage(wand->images,width,height,threshold,
6452  wand->exception);
6453  if (lines_image == (Image *) NULL)
6454  return(MagickFalse);
6455  ReplaceImageInList(&wand->images,lines_image);
6456  return(MagickTrue);
6457 }
6458 ␌
6459 /*
6460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6461 % %
6462 % %
6463 % %
6464 % M a g i c k I d e n t i f y I m a g e %
6465 % %
6466 % %
6467 % %
6468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6469 %
6470 % MagickIdentifyImage() identifies an image by printing its attributes to the
6471 % file. Attributes include the image width, height, size, and others.
6472 %
6473 % The format of the MagickIdentifyImage method is:
6474 %
6475 % const char *MagickIdentifyImage(MagickWand *wand)
6476 %
6477 % A description of each parameter follows:
6478 %
6479 % o wand: the magick wand.
6480 %
6481 */
6482 WandExport char *MagickIdentifyImage(MagickWand *wand)
6483 {
6484  char
6485  *description,
6486  filename[MagickPathExtent];
6487 
6488  FILE
6489  *file;
6490 
6491  int
6492  unique_file;
6493 
6494  assert(wand != (MagickWand *) NULL);
6495  assert(wand->signature == MagickWandSignature);
6496  if (wand->debug != MagickFalse)
6497  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6498  if (wand->images == (Image *) NULL)
6499  {
6500  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6501  "ContainsNoImages","`%s'",wand->name);
6502  return((char *) NULL);
6503  }
6504  description=(char *) NULL;
6505  unique_file=AcquireUniqueFileResource(filename);
6506  file=(FILE *) NULL;
6507  if (unique_file != -1)
6508  file=fdopen(unique_file,"wb");
6509  if ((unique_file == -1) || (file == (FILE *) NULL))
6510  {
6511  (void) RelinquishUniqueFileResource(filename);
6512  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6513  "UnableToCreateTemporaryFile","`%s'",wand->name);
6514  return((char *) NULL);
6515  }
6516  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6517  (void) fclose(file);
6518  description=FileToString(filename,~0UL,wand->exception);
6519  (void) RelinquishUniqueFileResource(filename);
6520  return(description);
6521 }
6522 
6523 /*
6524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6525 % %
6526 % %
6527 % %
6528 % M a g i c k I d e n t i f y I m a g e T y p e %
6529 % %
6530 % %
6531 % %
6532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6533 %
6534 % MagickIdentifyImageType() gets the potential image type:
6535 %
6536 % Bilevel Grayscale GrayscaleMatte
6537 % Palette PaletteMatte TrueColor
6538 % TrueColorMatte ColorSeparation ColorSeparationMatte
6539 %
6540 % To ensure the image type matches its potential, use MagickSetImageType():
6541 %
6542 % (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6543 %
6544 % The format of the MagickIdentifyImageType method is:
6545 %
6546 % ImageType MagickIdentifyImageType(MagickWand *wand)
6547 %
6548 % A description of each parameter follows:
6549 %
6550 % o wand: the magick wand.
6551 %
6552 */
6553 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6554 {
6555  assert(wand != (MagickWand *) NULL);
6556  assert(wand->signature == MagickWandSignature);
6557  if (wand->debug != MagickFalse)
6558  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6559  if (wand->images == (Image *) NULL)
6560  {
6561  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6562  "ContainsNoImages","`%s'",wand->name);
6563  return(UndefinedType);
6564  }
6565  return(IdentifyImageType(wand->images,wand->exception));
6566 }
6567 
6568 /*
6569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6570 % %
6571 % %
6572 % %
6573 % M a g i c k I m p l o d e I m a g e %
6574 % %
6575 % %
6576 % %
6577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6578 %
6579 % MagickImplodeImage() creates a new image that is a copy of an existing
6580 % one with the image pixels "implode" by the specified percentage. It
6581 % allocates the memory necessary for the new Image structure and returns a
6582 % pointer to the new image.
6583 %
6584 % The format of the MagickImplodeImage method is:
6585 %
6586 % MagickBooleanType MagickImplodeImage(MagickWand *wand,
6587 % const double radius,const PixelInterpolateMethod method)
6588 %
6589 % A description of each parameter follows:
6590 %
6591 % o wand: the magick wand.
6592 %
6593 % o amount: Define the extent of the implosion.
6594 %
6595 % o method: the pixel interpolation method.
6596 %
6597 */
6598 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6599  const double amount,const PixelInterpolateMethod method)
6600 {
6601  Image
6602  *implode_image;
6603 
6604  assert(wand != (MagickWand *) NULL);
6605  assert(wand->signature == MagickWandSignature);
6606  if (wand->debug != MagickFalse)
6607  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6608  if (wand->images == (Image *) NULL)
6609  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6610  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6611  if (implode_image == (Image *) NULL)
6612  return(MagickFalse);
6613  ReplaceImageInList(&wand->images,implode_image);
6614  return(MagickTrue);
6615 }
6616 ␌
6617 /*
6618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6619 % %
6620 % %
6621 % %
6622 % M a g i c k I m p o r t I m a g e P i x e l s %
6623 % %
6624 % %
6625 % %
6626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6627 %
6628 % MagickImportImagePixels() accepts pixel datand stores it in the image at the
6629 % location you specify. The method returns MagickTrue on success otherwise
6630 % MagickFalse if an error is encountered. The pixel data can be either char,
6631 % short int, int, ssize_t, float, or double in the order specified by map.
6632 %
6633 % Suppose your want to upload the first scanline of a 640x480 image from
6634 % character data in red-green-blue order:
6635 %
6636 % MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6637 %
6638 % The format of the MagickImportImagePixels method is:
6639 %
6640 % MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6641 % const ssize_t x,const ssize_t y,const size_t columns,
6642 % const size_t rows,const char *map,const StorageType storage,
6643 % const void *pixels)
6644 %
6645 % A description of each parameter follows:
6646 %
6647 % o wand: the magick wand.
6648 %
6649 % o x, y, columns, rows: These values define the perimeter of a region
6650 % of pixels you want to define.
6651 %
6652 % o map: This string reflects the expected ordering of the pixel array.
6653 % It can be any combination or order of R = red, G = green, B = blue,
6654 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6655 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6656 % P = pad.
6657 %
6658 % o storage: Define the data type of the pixels. Float and double types are
6659 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
6660 % these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6661 % or DoublePixel.
6662 %
6663 % o pixels: This array of values contain the pixel components as defined by
6664 % map and type. You must preallocate this array where the expected
6665 % length varies depending on the values of width, height, map, and type.
6666 %
6667 */
6668 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6669  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6670  const char *map,const StorageType storage,const void *pixels)
6671 {
6672  MagickBooleanType
6673  status;
6674 
6675  assert(wand != (MagickWand *) NULL);
6676  assert(wand->signature == MagickWandSignature);
6677  if (wand->debug != MagickFalse)
6678  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6679  if (wand->images == (Image *) NULL)
6680  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6681  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6682  wand->exception);
6683  return(status);
6684 }
6685 ␌
6686 /*
6687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6688 % %
6689 % %
6690 % %
6691 % 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 %
6692 % %
6693 % %
6694 % %
6695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6696 %
6697 % MagickInterpolativeResizeImage() resize image using a interpolative
6698 % method.
6699 %
6700 % MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6701 % const size_t columns,const size_t rows,
6702 % const PixelInterpolateMethod method)
6703 %
6704 % A description of each parameter follows:
6705 %
6706 % o wand: the magick wand.
6707 %
6708 % o columns: the number of columns in the scaled image.
6709 %
6710 % o rows: the number of rows in the scaled image.
6711 %
6712 % o interpolate: the pixel interpolation method.
6713 %
6714 */
6715 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6716  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6717 {
6718  Image
6719  *resize_image;
6720 
6721  assert(wand != (MagickWand *) NULL);
6722  assert(wand->signature == MagickWandSignature);
6723  if (wand->debug != MagickFalse)
6724  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6725  if (wand->images == (Image *) NULL)
6726  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6727  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6728  wand->exception);
6729  if (resize_image == (Image *) NULL)
6730  return(MagickFalse);
6731  ReplaceImageInList(&wand->images,resize_image);
6732  return(MagickTrue);
6733 }
6734 ␌
6735 /*
6736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6737 % %
6738 % %
6739 % %
6740 % 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 %
6741 % %
6742 % %
6743 % %
6744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6745 %
6746 % MagickInverseFourierTransformImage() implements the inverse discrete
6747 % Fourier transform (DFT) of the image either as a magnitude / phase or real /
6748 % imaginary image pair.
6749 %
6750 % The format of the MagickInverseFourierTransformImage method is:
6751 %
6752 % MagickBooleanType MagickInverseFourierTransformImage(
6753 % MagickWand *magnitude_wand,MagickWand *phase_wand,
6754 % const MagickBooleanType magnitude)
6755 %
6756 % A description of each parameter follows:
6757 %
6758 % o magnitude_wand: the magnitude or real wand.
6759 %
6760 % o phase_wand: the phase or imaginary wand.
6761 %
6762 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
6763 % imaginary image pair.
6764 %
6765 */
6766 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6767  MagickWand *magnitude_wand,MagickWand *phase_wand,
6768  const MagickBooleanType magnitude)
6769 {
6770  Image
6771  *inverse_image;
6772 
6773  MagickWand
6774  *wand;
6775 
6776  assert(magnitude_wand != (MagickWand *) NULL);
6777  assert(magnitude_wand->signature == MagickWandSignature);
6778  if (magnitude_wand->debug != MagickFalse)
6779  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6780  magnitude_wand->name);
6781  wand=magnitude_wand;
6782  if (magnitude_wand->images == (Image *) NULL)
6783  ThrowWandException(WandError,"ContainsNoImages",
6784  magnitude_wand->name);
6785  assert(phase_wand != (MagickWand *) NULL);
6786  assert(phase_wand->signature == MagickWandSignature);
6787  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6788  phase_wand->images,magnitude,wand->exception);
6789  if (inverse_image == (Image *) NULL)
6790  return(MagickFalse);
6791  ReplaceImageInList(&wand->images,inverse_image);
6792  return(MagickTrue);
6793 }
6794 ␌
6795 /*
6796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6797 % %
6798 % %
6799 % %
6800 % M a g i c k K m e a n s I m a g e %
6801 % %
6802 % %
6803 % %
6804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6805 %
6806 % MagickKmeansImage() applies k-means color reduction to an image. This is a
6807 % colorspace clustering or segmentation technique.
6808 %
6809 % The format of the MagickKmeansImage method is:
6810 %
6811 % MagickBooleanType MagickKmeansImage(MagickWand *wand,
6812 % const size_t number_colors, const size_t max_iterations,
6813 % const double tolerance)
6814 %
6815 % A description of each parameter follows:
6816 %
6817 % o wand: the magick wand.
6818 %
6819 % o number_colors: number of colors to use as seeds.
6820 %
6821 % o max_iterations: maximum number of iterations while converging.
6822 %
6823 % o tolerance: the maximum tolerance.
6824 %
6825 */
6826 WandExport MagickBooleanType MagickKmeansImage(MagickWand *wand,
6827  const size_t number_colors,const size_t max_iterations,
6828  const double tolerance)
6829 {
6830  MagickBooleanType
6831  status;
6832 
6833  assert(wand != (MagickWand *) NULL);
6834  assert(wand->signature == MagickWandSignature);
6835  if (wand->debug != MagickFalse)
6836  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6837  if (wand->images == (Image *) NULL)
6838  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6839  status=KmeansImage(wand->images,number_colors,max_iterations,tolerance,
6840  wand->exception);
6841  return(status);
6842 }
6843 ␌
6844 /*
6845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6846 % %
6847 % %
6848 % %
6849 % M a g i c k K u w a h a r a I m a g e %
6850 % %
6851 % %
6852 % %
6853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6854 %
6855 % Use MagickKuwaharaImage() is an edge preserving noise reduction filter.
6856 %
6857 % The format of the MagickKuwaharaImage method is:
6858 %
6859 % MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6860 % const double radius,const double sigma)
6861 %
6862 % A description of each parameter follows:
6863 %
6864 % o wand: the magick wand.
6865 %
6866 % o radius: the square window radius.
6867 %
6868 % o sigma: the standard deviation of the Gaussian, in pixels.
6869 %
6870 */
6871 WandExport MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6872  const double radius,const double sigma)
6873 {
6874  Image
6875  *kuwahara_image;
6876 
6877  assert(wand != (MagickWand *) NULL);
6878  assert(wand->signature == MagickWandSignature);
6879  if (wand->debug != MagickFalse)
6880  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6881  if (wand->images == (Image *) NULL)
6882  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6883  kuwahara_image=KuwaharaImage(wand->images,radius,sigma,wand->exception);
6884  if (kuwahara_image == (Image *) NULL)
6885  return(MagickFalse);
6886  ReplaceImageInList(&wand->images,kuwahara_image);
6887  return(MagickTrue);
6888 }
6889 ␌
6890 /*
6891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6892 % %
6893 % %
6894 % %
6895 % M a g i c k L a b e l I m a g e %
6896 % %
6897 % %
6898 % %
6899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6900 %
6901 % MagickLabelImage() adds a label to your image.
6902 %
6903 % The format of the MagickLabelImage method is:
6904 %
6905 % MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6906 %
6907 % A description of each parameter follows:
6908 %
6909 % o wand: the magick wand.
6910 %
6911 % o label: the image label.
6912 %
6913 */
6914 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6915  const char *label)
6916 {
6917  MagickBooleanType
6918  status;
6919 
6920  assert(wand != (MagickWand *) NULL);
6921  assert(wand->signature == MagickWandSignature);
6922  if (wand->debug != MagickFalse)
6923  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6924  if (wand->images == (Image *) NULL)
6925  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6926  status=SetImageProperty(wand->images,"label",label,wand->exception);
6927  return(status);
6928 }
6929 ␌
6930 /*
6931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6932 % %
6933 % %
6934 % %
6935 % M a g i c k L e v e l I m a g e %
6936 % %
6937 % %
6938 % %
6939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6940 %
6941 % MagickLevelImage() adjusts the levels of an image by scaling the colors
6942 % falling between specified white and black points to the full available
6943 % quantum range. The parameters provided represent the black, mid, and white
6944 % points. The black point specifies the darkest color in the image. Colors
6945 % darker than the black point are set to zero. Mid point specifies a gamma
6946 % correction to apply to the image. White point specifies the lightest color
6947 % in the image. Colors brighter than the white point are set to the maximum
6948 % quantum value.
6949 %
6950 % The format of the MagickLevelImage method is:
6951 %
6952 % MagickBooleanType MagickLevelImage(MagickWand *wand,
6953 % const double black_point,const double gamma,const double white_point)
6954 %
6955 % A description of each parameter follows:
6956 %
6957 % o wand: the magick wand.
6958 %
6959 % o channel: Identify which channel to level: RedPixelChannel,
6960 % GreenPixelChannel, etc.
6961 %
6962 % o black_point: the black point.
6963 %
6964 % o gamma: the gamma.
6965 %
6966 % o white_point: the white point.
6967 %
6968 */
6969 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6970  const double black_point,const double gamma,const double white_point)
6971 {
6972  MagickBooleanType
6973  status;
6974 
6975  assert(wand != (MagickWand *) NULL);
6976  assert(wand->signature == MagickWandSignature);
6977  if (wand->debug != MagickFalse)
6978  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6979  if (wand->images == (Image *) NULL)
6980  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6981  status=LevelImage(wand->images,black_point,white_point,gamma,
6982  wand->exception);
6983  return(status);
6984 }
6985 ␌
6986 /*
6987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6988 % %
6989 % %
6990 % %
6991 % M a g i c k L e v e l I m a g e C o l o r s %
6992 % %
6993 % %
6994 % %
6995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6996 %
6997 % MagickLevelImageColors() maps the given color to "black" and "white" values,
6998 % linearly spreading out the colors, and level values on a channel by channel
6999 % bases, as per LevelImage(). The given colors allows you to specify
7000 % different level ranges for each of the color channels separately.
7001 %
7002 % The format of the MagickLevelImageColors method is:
7003 %
7004 % MagickBooleanType MagickLevelImageColors(MagickWand *wand,
7005 % const PixelWand *black_color,const PixelWand *white_color,
7006 % const MagickBooleanType invert)
7007 %
7008 % A description of each parameter follows:
7009 %
7010 % o wand: the magick wand.
7011 %
7012 % o black_color: the black color.
7013 %
7014 % o white_color: the white color.
7015 %
7016 % o invert: if true map the colors (levelize), rather than from (level)
7017 %
7018 */
7019 WandExport MagickBooleanType MagickLevelImageColors(MagickWand *wand,
7020  const PixelWand *black_color,const PixelWand *white_color,
7021  const MagickBooleanType invert)
7022 {
7023  MagickBooleanType
7024  status;
7025 
7026  PixelInfo
7027  black,
7028  white;
7029 
7030  assert(wand != (MagickWand *) NULL);
7031  assert(wand->signature == MagickWandSignature);
7032  if (wand->debug != MagickFalse)
7033  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7034  if (wand->images == (Image *) NULL)
7035  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7036  PixelGetMagickColor(black_color,&black);
7037  PixelGetMagickColor(white_color,&white);
7038  status=LevelImageColors(wand->images,&black,&white,invert,wand->exception);
7039  return(status);
7040 }
7041 ␌
7042 /*
7043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7044 % %
7045 % %
7046 % %
7047 % M a g i c k L e v e l i z e I m a g e %
7048 % %
7049 % %
7050 % %
7051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7052 %
7053 % MagickLevelizeImage() applies the reversed MagickLevelImage(). It compresses
7054 % the full range of color values, so that they lie between the given black and
7055 % white points. Gamma is applied before the values are mapped. It can be
7056 % used to de-contrast a greyscale image to the exact levels specified.
7057 %
7058 % The format of the MagickLevelizeImage method is:
7059 %
7060 % MagickBooleanType MagickLevelizeImage(MagickWand *wand,
7061 % const double black_point, const double white_point,const double gamma)
7062 %
7063 % A description of each parameter follows:
7064 %
7065 % o wand: the magick wand.
7066 %
7067 % o black_point: The level to map zero (black) to.
7068 %
7069 % o white_point: The level to map QuantumRange (white) to.
7070 %
7071 % o gamma: adjust gamma by this factor before mapping values.
7072 %
7073 */
7074 WandExport MagickBooleanType MagickLevelizeImage(MagickWand *wand,
7075  const double black_point,const double gamma,const double white_point)
7076 {
7077  MagickBooleanType
7078  status;
7079 
7080  assert(wand != (MagickWand *) NULL);
7081  assert(wand->signature == MagickWandSignature);
7082  if (wand->debug != MagickFalse)
7083  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7084  if (wand->images == (Image *) NULL)
7085  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7086  status=LevelizeImage(wand->images,black_point,white_point,gamma,
7087  wand->exception);
7088  return(status);
7089 }
7090 ␌
7091 /*
7092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7093 % %
7094 % %
7095 % %
7096 % M a g i c k L i n e a r S t r e t c h I m a g e %
7097 % %
7098 % %
7099 % %
7100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7101 %
7102 % MagickLinearStretchImage() stretches with saturation the image intensity.
7103 %
7104 % You can also reduce the influence of a particular channel with a gamma
7105 % value of 0.
7106 %
7107 % The format of the MagickLinearStretchImage method is:
7108 %
7109 % MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7110 % const double black_point,const double white_point)
7111 %
7112 % A description of each parameter follows:
7113 %
7114 % o wand: the magick wand.
7115 %
7116 % o black_point: the black point.
7117 %
7118 % o white_point: the white point.
7119 %
7120 */
7121 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7122  const double black_point,const double white_point)
7123 {
7124  MagickBooleanType
7125  status;
7126 
7127  assert(wand != (MagickWand *) NULL);
7128  assert(wand->signature == MagickWandSignature);
7129  if (wand->debug != MagickFalse)
7130  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7131  if (wand->images == (Image *) NULL)
7132  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7133  status=LinearStretchImage(wand->images,black_point,white_point,
7134  wand->exception);
7135  return(status);
7136 }
7137 ␌
7138 /*
7139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7140 % %
7141 % %
7142 % %
7143 % M a g i c k L i q u i d R e s c a l e I m a g e %
7144 % %
7145 % %
7146 % %
7147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7148 %
7149 % MagickLiquidRescaleImage() rescales image with seam carving.
7150 %
7151 % MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7152 % const size_t columns,const size_t rows,
7153 % const double delta_x,const double rigidity)
7154 %
7155 % A description of each parameter follows:
7156 %
7157 % o wand: the magick wand.
7158 %
7159 % o columns: the number of columns in the scaled image.
7160 %
7161 % o rows: the number of rows in the scaled image.
7162 %
7163 % o delta_x: maximum seam transversal step (0 means straight seams).
7164 %
7165 % o rigidity: introduce a bias for non-straight seams (typically 0).
7166 %
7167 */
7168 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7169  const size_t columns,const size_t rows,const double delta_x,
7170  const double rigidity)
7171 {
7172  Image
7173  *rescale_image;
7174 
7175  assert(wand != (MagickWand *) NULL);
7176  assert(wand->signature == MagickWandSignature);
7177  if (wand->debug != MagickFalse)
7178  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7179  if (wand->images == (Image *) NULL)
7180  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7181  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
7182  rigidity,wand->exception);
7183  if (rescale_image == (Image *) NULL)
7184  return(MagickFalse);
7185  ReplaceImageInList(&wand->images,rescale_image);
7186  return(MagickTrue);
7187 }
7188 
7189 /*
7190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7191 % %
7192 % %
7193 % %
7194 % M a g i c k L o c a l C o n t r a s t I m a g e %
7195 % %
7196 % %
7197 % %
7198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7199 %
7200 % MagickLocalContrastImage() attempts to increase the appearance of
7201 % large-scale light-dark transitions. Local contrast enhancement works
7202 % similarly to sharpening with an unsharp mask, however the mask is instead
7203 % created using an image with a greater blur distance.
7204 %
7205 % MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7206 % const double radius,const double strength)
7207 %
7208 % A description of each parameter follows:
7209 %
7210 % o image: the image.
7211 %
7212 % o radius: the radius of the Gaussian, in pixels, not counting
7213 % the center pixel.
7214 %
7215 % o strength: the strength of the blur mask in percentage.
7216 %
7217 */
7218 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7219  const double radius, const double strength)
7220 {
7221  Image
7222  *contrast_image;
7223 
7224  assert(wand != (MagickWand *)NULL);
7225  assert(wand->signature == MagickWandSignature);
7226  if (wand->debug != MagickFalse)
7227  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
7228  if (wand->images == (Image *)NULL)
7229  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7230  contrast_image=LocalContrastImage(wand->images,radius,strength,
7231  wand->exception);
7232  if (contrast_image == (Image *)NULL)
7233  return(MagickFalse);
7234  ReplaceImageInList(&wand->images,contrast_image);
7235  return(MagickTrue);
7236 }
7237 ␌
7238 /*
7239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7240 % %
7241 % %
7242 % %
7243 % M a g i c k M a g n i f y I m a g e %
7244 % %
7245 % %
7246 % %
7247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7248 %
7249 % MagickMagnifyImage() is a convenience method that scales an image
7250 % proportionally to twice its original size.
7251 %
7252 % The format of the MagickMagnifyImage method is:
7253 %
7254 % MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7255 %
7256 % A description of each parameter follows:
7257 %
7258 % o wand: the magick wand.
7259 %
7260 */
7261 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7262 {
7263  Image
7264  *magnify_image;
7265 
7266  assert(wand != (MagickWand *) NULL);
7267  assert(wand->signature == MagickWandSignature);
7268  if (wand->debug != MagickFalse)
7269  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7270  if (wand->images == (Image *) NULL)
7271  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7272  magnify_image=MagnifyImage(wand->images,wand->exception);
7273  if (magnify_image == (Image *) NULL)
7274  return(MagickFalse);
7275  ReplaceImageInList(&wand->images,magnify_image);
7276  return(MagickTrue);
7277 }
7278 ␌
7279 /*
7280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7281 % %
7282 % %
7283 % %
7284 % M a g i c k M e a n S h i f t I m a g e %
7285 % %
7286 % %
7287 % %
7288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7289 %
7290 % MagickMeanShiftImage() delineate arbitrarily shaped clusters in the image. For
7291 % each pixel, it visits all the pixels in the neighborhood specified by
7292 % the window centered at the pixel and excludes those that are outside the
7293 % radius=(window-1)/2 surrounding the pixel. From those pixels, it finds those
7294 % that are within the specified color distance from the current mean, and
7295 % computes a new x,y centroid from those coordinates and a new mean. This new
7296 % x,y centroid is used as the center for a new window. This process iterates
7297 % until it converges and the final mean is replaces the (original window
7298 % center) pixel value. It repeats this process for the next pixel, etc.,
7299 % until it processes all pixels in the image. Results are typically better with
7300 % colorspaces other than sRGB. We recommend YIQ, YUV or YCbCr.
7301 %
7302 % The format of the MagickMeanShiftImage method is:
7303 %
7304 % MagickBooleanType MagickMeanShiftImage(MagickWand *wand,
7305 % const size_t width,const size_t height,const double color_distance)
7306 %
7307 % A description of each parameter follows:
7308 %
7309 % o wand: the magick wand.
7310 %
7311 % o width, height: find pixels in this neighborhood.
7312 %
7313 % o color_distance: the color distance.
7314 %
7315 */
7316 WandExport MagickBooleanType MagickMeanShiftImage(MagickWand *wand,
7317  const size_t width,const size_t height,const double color_distance)
7318 {
7319  Image
7320  *mean_image;
7321 
7322  assert(wand != (MagickWand *) NULL);
7323  assert(wand->signature == MagickWandSignature);
7324  if (wand->debug != MagickFalse)
7325  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7326  if (wand->images == (Image *) NULL)
7327  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7328  mean_image=MeanShiftImage(wand->images,width,height,color_distance,
7329  wand->exception);
7330  if (mean_image == (Image *) NULL)
7331  return(MagickFalse);
7332  ReplaceImageInList(&wand->images,mean_image);
7333  return(MagickTrue);
7334 }
7335 ␌
7336 /*
7337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7338 % %
7339 % %
7340 % %
7341 % M a g i c k M e r g e I m a g e L a y e r s %
7342 % %
7343 % %
7344 % %
7345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7346 %
7347 % MagickMergeImageLayers() composes all the image layers from the current
7348 % given image onward to produce a single image of the merged layers.
7349 %
7350 % The inital canvas's size depends on the given LayerMethod, and is
7351 % initialized using the first images background color. The images
7352 % are then composited onto that image in sequence using the given
7353 % composition that has been assigned to each individual image.
7354 %
7355 % The format of the MagickMergeImageLayers method is:
7356 %
7357 % MagickWand *MagickMergeImageLayers(MagickWand *wand,
7358 % const LayerMethod method)
7359 %
7360 % A description of each parameter follows:
7361 %
7362 % o wand: the magick wand.
7363 %
7364 % o method: the method of selecting the size of the initial canvas.
7365 %
7366 % MergeLayer: Merge all layers onto a canvas just large enough
7367 % to hold all the actual images. The virtual canvas of the
7368 % first image is preserved but otherwise ignored.
7369 %
7370 % FlattenLayer: Use the virtual canvas size of first image.
7371 % Images which fall outside this canvas is clipped.
7372 % This can be used to 'fill out' a given virtual canvas.
7373 %
7374 % MosaicLayer: Start with the virtual canvas of the first image,
7375 % enlarging left and right edges to contain all images.
7376 % Images with negative offsets will be clipped.
7377 %
7378 */
7379 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
7380  const LayerMethod method)
7381 {
7382  Image
7383  *mosaic_image;
7384 
7385  assert(wand != (MagickWand *) NULL);
7386  assert(wand->signature == MagickWandSignature);
7387  if (wand->debug != MagickFalse)
7388  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7389  if (wand->images == (Image *) NULL)
7390  return((MagickWand *) NULL);
7391  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
7392  if (mosaic_image == (Image *) NULL)
7393  return((MagickWand *) NULL);
7394  return(CloneMagickWandFromImages(wand,mosaic_image));
7395 }
7396 ␌
7397 /*
7398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7399 % %
7400 % %
7401 % %
7402 % M a g i c k M i n i f y I m a g e %
7403 % %
7404 % %
7405 % %
7406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7407 %
7408 % MagickMinifyImage() is a convenience method that scales an image
7409 % proportionally to one-half its original size
7410 %
7411 % The format of the MagickMinifyImage method is:
7412 %
7413 % MagickBooleanType MagickMinifyImage(MagickWand *wand)
7414 %
7415 % A description of each parameter follows:
7416 %
7417 % o wand: the magick wand.
7418 %
7419 */
7420 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
7421 {
7422  Image
7423  *minify_image;
7424 
7425  assert(wand != (MagickWand *) NULL);
7426  assert(wand->signature == MagickWandSignature);
7427  if (wand->debug != MagickFalse)
7428  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7429  if (wand->images == (Image *) NULL)
7430  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7431  minify_image=MinifyImage(wand->images,wand->exception);
7432  if (minify_image == (Image *) NULL)
7433  return(MagickFalse);
7434  ReplaceImageInList(&wand->images,minify_image);
7435  return(MagickTrue);
7436 }
7437 ␌
7438 /*
7439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7440 % %
7441 % %
7442 % %
7443 % M a g i c k M o d u l a t e I m a g e %
7444 % %
7445 % %
7446 % %
7447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7448 %
7449 % MagickModulateImage() lets you control the brightness, saturation, and hue
7450 % of an image. Hue is the percentage of absolute rotation from the current
7451 % position. For example 50 results in a counter-clockwise rotation of 90
7452 % degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
7453 % both resulting in a rotation of 180 degrees.
7454 %
7455 % To increase the color brightness by 20% and decrease the color saturation by
7456 % 10% and leave the hue unchanged, use: 120,90,100.
7457 %
7458 % The format of the MagickModulateImage method is:
7459 %
7460 % MagickBooleanType MagickModulateImage(MagickWand *wand,
7461 % const double brightness,const double saturation,const double hue)
7462 %
7463 % A description of each parameter follows:
7464 %
7465 % o wand: the magick wand.
7466 %
7467 % o brightness: the percent change in brightness.
7468 %
7469 % o saturation: the percent change in saturation.
7470 %
7471 % o hue: the percent change in hue.
7472 %
7473 */
7474 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
7475  const double brightness,const double saturation,const double hue)
7476 {
7477  char
7478  modulate[MagickPathExtent];
7479 
7480  MagickBooleanType
7481  status;
7482 
7483  assert(wand != (MagickWand *) NULL);
7484  assert(wand->signature == MagickWandSignature);
7485  if (wand->debug != MagickFalse)
7486  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7487  if (wand->images == (Image *) NULL)
7488  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7489  (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
7490  brightness,saturation,hue);
7491  status=ModulateImage(wand->images,modulate,wand->exception);
7492  return(status);
7493 }
7494 ␌
7495 /*
7496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7497 % %
7498 % %
7499 % %
7500 % M a g i c k M o n t a g e I m a g e %
7501 % %
7502 % %
7503 % %
7504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7505 %
7506 % MagickMontageImage() creates a composite image by combining several
7507 % separate images. The images are tiled on the composite image with the name
7508 % of the image optionally appearing just below the individual tile.
7509 %
7510 % The format of the MagickMontageImage method is:
7511 %
7512 % MagickWand *MagickMontageImage(MagickWand *wand,
7513 % const DrawingWand *drawing_wand,const char *tile_geometry,
7514 % const char *thumbnail_geometry,const MontageMode mode,
7515 % const char *frame)
7516 %
7517 % A description of each parameter follows:
7518 %
7519 % o wand: the magick wand.
7520 %
7521 % o drawing_wand: the drawing wand. The font name, size, and color are
7522 % obtained from this wand.
7523 %
7524 % o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7525 %
7526 % o thumbnail_geometry: Preferred image size and border size of each
7527 % thumbnail (e.g. 120x120+4+3>).
7528 %
7529 % o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7530 %
7531 % o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7532 % The frame color is that of the thumbnail's matte color.
7533 %
7534 */
7535 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7536  const DrawingWand *drawing_wand,const char *tile_geometry,
7537  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7538 {
7539  char
7540  *font;
7541 
7542  Image
7543  *montage_image;
7544 
7545  MontageInfo
7546  *montage_info;
7547 
7548  PixelWand
7549  *pixel_wand;
7550 
7551  assert(wand != (MagickWand *) NULL);
7552  assert(wand->signature == MagickWandSignature);
7553  if (wand->debug != MagickFalse)
7554  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7555  if (wand->images == (Image *) NULL)
7556  return((MagickWand *) NULL);
7557  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7558  switch (mode)
7559  {
7560  case FrameMode:
7561  {
7562  (void) CloneString(&montage_info->frame,"15x15+3+3");
7563  montage_info->shadow=MagickTrue;
7564  break;
7565  }
7566  case UnframeMode:
7567  {
7568  montage_info->frame=(char *) NULL;
7569  montage_info->shadow=MagickFalse;
7570  montage_info->border_width=0;
7571  break;
7572  }
7573  case ConcatenateMode:
7574  {
7575  montage_info->frame=(char *) NULL;
7576  montage_info->shadow=MagickFalse;
7577  (void) CloneString(&montage_info->geometry,"+0+0");
7578  montage_info->border_width=0;
7579  break;
7580  }
7581  default:
7582  break;
7583  }
7584  font=DrawGetFont(drawing_wand);
7585  if (font != (char *) NULL)
7586  (void) CloneString(&montage_info->font,font);
7587  if (frame != (char *) NULL)
7588  (void) CloneString(&montage_info->frame,frame);
7589  montage_info->pointsize=DrawGetFontSize(drawing_wand);
7590  pixel_wand=NewPixelWand();
7591  DrawGetFillColor(drawing_wand,pixel_wand);
7592  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
7593  DrawGetStrokeColor(drawing_wand,pixel_wand);
7594  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
7595  pixel_wand=DestroyPixelWand(pixel_wand);
7596  if (thumbnail_geometry != (char *) NULL)
7597  (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7598  if (tile_geometry != (char *) NULL)
7599  (void) CloneString(&montage_info->tile,tile_geometry);
7600  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7601  wand->exception);
7602  montage_info=DestroyMontageInfo(montage_info);
7603  if (montage_image == (Image *) NULL)
7604  return((MagickWand *) NULL);
7605  return(CloneMagickWandFromImages(wand,montage_image));
7606 }
7607 ␌
7608 /*
7609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7610 % %
7611 % %
7612 % %
7613 % M a g i c k M o r p h I m a g e s %
7614 % %
7615 % %
7616 % %
7617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7618 %
7619 % MagickMorphImages() method morphs a set of images. Both the image pixels
7620 % and size are linearly interpolated to give the appearance of a
7621 % meta-morphosis from one image to the next.
7622 %
7623 % The format of the MagickMorphImages method is:
7624 %
7625 % MagickWand *MagickMorphImages(MagickWand *wand,
7626 % const size_t number_frames)
7627 %
7628 % A description of each parameter follows:
7629 %
7630 % o wand: the magick wand.
7631 %
7632 % o number_frames: the number of in-between images to generate.
7633 %
7634 */
7635 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7636  const size_t number_frames)
7637 {
7638  Image
7639  *morph_image;
7640 
7641  assert(wand != (MagickWand *) NULL);
7642  assert(wand->signature == MagickWandSignature);
7643  if (wand->debug != MagickFalse)
7644  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7645  if (wand->images == (Image *) NULL)
7646  return((MagickWand *) NULL);
7647  morph_image=MorphImages(wand->images,number_frames,wand->exception);
7648  if (morph_image == (Image *) NULL)
7649  return((MagickWand *) NULL);
7650  return(CloneMagickWandFromImages(wand,morph_image));
7651 }
7652 ␌
7653 /*
7654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7655 % %
7656 % %
7657 % %
7658 % M a g i c k M o r p h o l o g y I m a g e %
7659 % %
7660 % %
7661 % %
7662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7663 %
7664 % MagickMorphologyImage() applies a user supplied kernel to the image
7665 % according to the given morphology method.
7666 %
7667 % The format of the MagickMorphologyImage method is:
7668 %
7669 % MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7670 % const MorphologyMethod method,const ssize_t iterations,
7671 % const KernelInfo *kernel)
7672 %
7673 % A description of each parameter follows:
7674 %
7675 % o wand: the magick wand.
7676 %
7677 % o method: the morphology method to be applied.
7678 %
7679 % o iterations: apply the operation this many times (or no change).
7680 % A value of -1 means loop until no change found. How this is applied
7681 % may depend on the morphology method. Typically this is a value of 1.
7682 %
7683 % o kernel: An array of doubles representing the morphology kernel.
7684 %
7685 */
7686 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7687  const MorphologyMethod method,const ssize_t iterations,
7688  const KernelInfo *kernel)
7689 {
7690  Image
7691  *morphology_image;
7692 
7693  assert(wand != (MagickWand *) NULL);
7694  assert(wand->signature == MagickWandSignature);
7695  if (wand->debug != MagickFalse)
7696  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7697  if (kernel == (const KernelInfo *) NULL)
7698  return(MagickFalse);
7699  if (wand->images == (Image *) NULL)
7700  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7701  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
7702  wand->exception);
7703  if (morphology_image == (Image *) NULL)
7704  return(MagickFalse);
7705  ReplaceImageInList(&wand->images,morphology_image);
7706  return(MagickTrue);
7707 }
7708 ␌
7709 /*
7710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7711 % %
7712 % %
7713 % %
7714 % M a g i c k M o t i o n B l u r I m a g e %
7715 % %
7716 % %
7717 % %
7718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7719 %
7720 % MagickMotionBlurImage() simulates motion blur. We convolve the image with a
7721 % Gaussian operator of the given radius and standard deviation (sigma).
7722 % For reasonable results, radius should be larger than sigma. Use a
7723 % radius of 0 and MotionBlurImage() selects a suitable radius for you.
7724 % Angle gives the angle of the blurring motion.
7725 %
7726 % The format of the MagickMotionBlurImage method is:
7727 %
7728 % MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7729 % const double radius,const double sigma,const double angle)
7730 %
7731 % A description of each parameter follows:
7732 %
7733 % o wand: the magick wand.
7734 %
7735 % o radius: the radius of the Gaussian, in pixels, not counting
7736 % the center pixel.
7737 %
7738 % o sigma: the standard deviation of the Gaussian, in pixels.
7739 %
7740 % o angle: Apply the effect along this angle.
7741 %
7742 */
7743 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7744  const double radius,const double sigma,const double angle)
7745 {
7746  Image
7747  *blur_image;
7748 
7749  assert(wand != (MagickWand *) NULL);
7750  assert(wand->signature == MagickWandSignature);
7751  if (wand->debug != MagickFalse)
7752  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7753  if (wand->images == (Image *) NULL)
7754  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7755  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
7756  if (blur_image == (Image *) NULL)
7757  return(MagickFalse);
7758  ReplaceImageInList(&wand->images,blur_image);
7759  return(MagickTrue);
7760 }
7761 ␌
7762 /*
7763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7764 % %
7765 % %
7766 % %
7767 % M a g i c k N e g a t e I m a g e %
7768 % %
7769 % %
7770 % %
7771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7772 %
7773 % MagickNegateImage() negates the colors in the reference image. The
7774 % Grayscale option means that only grayscale values within the image are
7775 % negated.
7776 %
7777 % You can also reduce the influence of a particular channel with a gamma
7778 % value of 0.
7779 %
7780 % The format of the MagickNegateImage method is:
7781 %
7782 % MagickBooleanType MagickNegateImage(MagickWand *wand,
7783 % const MagickBooleanType gray)
7784 %
7785 % A description of each parameter follows:
7786 %
7787 % o wand: the magick wand.
7788 %
7789 % o gray: If MagickTrue, only negate grayscale pixels within the image.
7790 %
7791 */
7792 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7793  const MagickBooleanType gray)
7794 {
7795  MagickBooleanType
7796  status;
7797 
7798  assert(wand != (MagickWand *) NULL);
7799  assert(wand->signature == MagickWandSignature);
7800  if (wand->debug != MagickFalse)
7801  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7802  if (wand->images == (Image *) NULL)
7803  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7804  status=NegateImage(wand->images,gray,wand->exception);
7805  return(status);
7806 }
7807 ␌
7808 /*
7809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7810 % %
7811 % %
7812 % %
7813 % M a g i c k N e w I m a g e %
7814 % %
7815 % %
7816 % %
7817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7818 %
7819 % MagickNewImage() adds a blank image canvas of the specified size and
7820 % background color to the wand.
7821 %
7822 % The format of the MagickNewImage method is:
7823 %
7824 % MagickBooleanType MagickNewImage(MagickWand *wand,
7825 % const size_t columns,const size_t rows,
7826 % const PixelWand *background)
7827 %
7828 % A description of each parameter follows:
7829 %
7830 % o wand: the magick wand.
7831 %
7832 % o width: the image width.
7833 %
7834 % o height: the image height.
7835 %
7836 % o background: the image color.
7837 %
7838 */
7839 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7840  const size_t height,const PixelWand *background)
7841 {
7842  Image
7843  *images;
7844 
7845  PixelInfo
7846  pixel;
7847 
7848  assert(wand != (MagickWand *) NULL);
7849  assert(wand->signature == MagickWandSignature);
7850  if (wand->debug != MagickFalse)
7851  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7852  PixelGetMagickColor(background,&pixel);
7853  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7854  if (images == (Image *) NULL)
7855  return(MagickFalse);
7856  return(InsertImageInWand(wand,images));
7857 }
7858 ␌
7859 /*
7860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7861 % %
7862 % %
7863 % %
7864 % M a g i c k N e x t I m a g e %
7865 % %
7866 % %
7867 % %
7868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7869 %
7870 % MagickNextImage() sets the next image in the wand as the current image.
7871 %
7872 % It is typically used after MagickResetIterator(), after which its first use
7873 % will set the first image as the current image (unless the wand is empty).
7874 %
7875 % It will return MagickFalse when no more images are left to be returned
7876 % which happens when the wand is empty, or the current image is the last
7877 % image.
7878 %
7879 % When the above condition (end of image list) is reached, the iterator is
7880 % automatically set so that you can start using MagickPreviousImage() to
7881 % again iterate over the images in the reverse direction, starting with the
7882 % last image (again). You can jump to this condition immediately using
7883 % MagickSetLastIterator().
7884 %
7885 % The format of the MagickNextImage method is:
7886 %
7887 % MagickBooleanType MagickNextImage(MagickWand *wand)
7888 %
7889 % A description of each parameter follows:
7890 %
7891 % o wand: the magick wand.
7892 %
7893 */
7894 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7895 {
7896  assert(wand != (MagickWand *) NULL);
7897  assert(wand->signature == MagickWandSignature);
7898  if (wand->debug != MagickFalse)
7899  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7900  if (wand->images == (Image *) NULL)
7901  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7902  wand->insert_before=MagickFalse; /* Inserts is now appended */
7903  if (wand->image_pending != MagickFalse)
7904  {
7905  wand->image_pending=MagickFalse;
7906  return(MagickTrue);
7907  }
7908  if (GetNextImageInList(wand->images) == (Image *) NULL)
7909  {
7910  wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7911  return(MagickFalse);
7912  }
7913  wand->images=GetNextImageInList(wand->images);
7914  return(MagickTrue);
7915 }
7916 ␌
7917 /*
7918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7919 % %
7920 % %
7921 % %
7922 % M a g i c k N o r m a l i z e I m a g e %
7923 % %
7924 % %
7925 % %
7926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7927 %
7928 % MagickNormalizeImage() enhances the contrast of a color image by adjusting
7929 % the pixels color to span the entire range of colors available
7930 %
7931 % You can also reduce the influence of a particular channel with a gamma
7932 % value of 0.
7933 %
7934 % The format of the MagickNormalizeImage method is:
7935 %
7936 % MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7937 %
7938 % A description of each parameter follows:
7939 %
7940 % o wand: the magick wand.
7941 %
7942 */
7943 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7944 {
7945  MagickBooleanType
7946  status;
7947 
7948  assert(wand != (MagickWand *) NULL);
7949  assert(wand->signature == MagickWandSignature);
7950  if (wand->debug != MagickFalse)
7951  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7952  if (wand->images == (Image *) NULL)
7953  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7954  status=NormalizeImage(wand->images,wand->exception);
7955  return(status);
7956 }
7957 ␌
7958 /*
7959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7960 % %
7961 % %
7962 % %
7963 % M a g i c k O i l P a i n t I m a g e %
7964 % %
7965 % %
7966 % %
7967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7968 %
7969 % MagickOilPaintImage() applies a special effect filter that simulates an oil
7970 % painting. Each pixel is replaced by the most frequent color occurring
7971 % in a circular region defined by radius.
7972 %
7973 % The format of the MagickOilPaintImage method is:
7974 %
7975 % MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7976 % const double radius,const double sigma)
7977 %
7978 % A description of each parameter follows:
7979 %
7980 % o wand: the magick wand.
7981 %
7982 % o radius: the radius of the circular neighborhood.
7983 %
7984 % o sigma: the standard deviation of the Gaussian, in pixels.
7985 %
7986 */
7987 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7988  const double radius,const double sigma)
7989 {
7990  Image
7991  *paint_image;
7992 
7993  assert(wand != (MagickWand *) NULL);
7994  assert(wand->signature == MagickWandSignature);
7995  if (wand->debug != MagickFalse)
7996  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7997  if (wand->images == (Image *) NULL)
7998  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7999  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
8000  if (paint_image == (Image *) NULL)
8001  return(MagickFalse);
8002  ReplaceImageInList(&wand->images,paint_image);
8003  return(MagickTrue);
8004 }
8005 ␌
8006 /*
8007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8008 % %
8009 % %
8010 % %
8011 % M a g i c k O p a q u e P a i n t I m a g e %
8012 % %
8013 % %
8014 % %
8015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8016 %
8017 % MagickOpaquePaintImage() changes any pixel that matches color with the color
8018 % defined by fill.
8019 %
8020 % The format of the MagickOpaquePaintImage method is:
8021 %
8022 % MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
8023 % const PixelWand *target,const PixelWand *fill,const double fuzz,
8024 % const MagickBooleanType invert)
8025 %
8026 % A description of each parameter follows:
8027 %
8028 % o wand: the magick wand.
8029 %
8030 % o target: Change this target color to the fill color within the image.
8031 %
8032 % o fill: the fill pixel wand.
8033 %
8034 % o fuzz: By default target must match a particular pixel color
8035 % exactly. However, in many cases two colors may differ by a small amount.
8036 % The fuzz member of image defines how much tolerance is acceptable to
8037 % consider two colors as the same. For example, set fuzz to 10 and the
8038 % color red at intensities of 100 and 102 respectively are now interpreted
8039 % as the same color for the purposes of the floodfill.
8040 %
8041 % o invert: paint any pixel that does not match the target color.
8042 %
8043 */
8044 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
8045  const PixelWand *target,const PixelWand *fill,const double fuzz,
8046  const MagickBooleanType invert)
8047 {
8048  MagickBooleanType
8049  status;
8050 
8051  PixelInfo
8052  fill_pixel,
8053  target_pixel;
8054 
8055  assert(wand != (MagickWand *) NULL);
8056  assert(wand->signature == MagickWandSignature);
8057  if (wand->debug != MagickFalse)
8058  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8059  if (wand->images == (Image *) NULL)
8060  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8061  PixelGetMagickColor(target,&target_pixel);
8062  PixelGetMagickColor(fill,&fill_pixel);
8063  wand->images->fuzz=fuzz;
8064  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
8065  wand->exception);
8066  return(status);
8067 }
8068 ␌
8069 /*
8070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8071 % %
8072 % %
8073 % %
8074 % M a g i c k O p t i m i z e I m a g e L a y e r s %
8075 % %
8076 % %
8077 % %
8078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8079 %
8080 % MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
8081 % previous image in the sequence. From this it attempts to select the
8082 % smallest cropped image to replace each frame, while preserving the results
8083 % of the animation.
8084 %
8085 % The format of the MagickOptimizeImageLayers method is:
8086 %
8087 % MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8088 %
8089 % A description of each parameter follows:
8090 %
8091 % o wand: the magick wand.
8092 %
8093 */
8094 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8095 {
8096  Image
8097  *optimize_image;
8098 
8099  assert(wand != (MagickWand *) NULL);
8100  assert(wand->signature == MagickWandSignature);
8101  if (wand->debug != MagickFalse)
8102  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8103  if (wand->images == (Image *) NULL)
8104  return((MagickWand *) NULL);
8105  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
8106  if (optimize_image == (Image *) NULL)
8107  return((MagickWand *) NULL);
8108  return(CloneMagickWandFromImages(wand,optimize_image));
8109 }
8110 ␌
8111 /*
8112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8113 % %
8114 % %
8115 % %
8116 % M a g i c k O p t i m i z e I m a g e T r a n s p a r e n c y %
8117 % %
8118 % %
8119 % %
8120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8121 %
8122 % MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
8123 % compares the overlayed pixels against the disposal image resulting from all
8124 % the previous frames in the animation. Any pixel that does not change the
8125 % disposal image (and thus does not effect the outcome of an overlay) is made
8126 % transparent.
8127 %
8128 % WARNING: This modifies the current images directly, rather than generate
8129 % a new image sequence.
8130 % The format of the MagickOptimizeImageTransparency method is:
8131 %
8132 % MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8133 %
8134 % A description of each parameter follows:
8135 %
8136 % o wand: the magick wand.
8137 %
8138 */
8139 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8140 {
8141  assert(wand != (MagickWand *) NULL);
8142  assert(wand->signature == MagickWandSignature);
8143  if (wand->debug != MagickFalse)
8144  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8145  if (wand->images == (Image *) NULL)
8146  return(MagickFalse);
8147  OptimizeImageTransparency(wand->images,wand->exception);
8148  return(MagickTrue);
8149 }
8150 ␌
8151 /*
8152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8153 % %
8154 % %
8155 % %
8156 % M a g i c k O r d e r e d D i t h e r I m a g e %
8157 % %
8158 % %
8159 % %
8160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8161 %
8162 % MagickOrderedDitherImage() performs an ordered dither based on a number
8163 % of pre-defined dithering threshold maps, but over multiple intensity levels,
8164 % which can be different for different channels, according to the input
8165 % arguments.
8166 %
8167 % The format of the MagickOrderedDitherImage method is:
8168 %
8169 % MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
8170 % const char *threshold_map)
8171 %
8172 % A description of each parameter follows:
8173 %
8174 % o image: the image.
8175 %
8176 % o threshold_map: A string containing the name of the threshold dither
8177 % map to use, followed by zero or more numbers representing the number of
8178 % color levels tho dither between.
8179 %
8180 % Any level number less than 2 is equivalent to 2, and means only binary
8181 % dithering will be applied to each color channel.
8182 %
8183 % No numbers also means a 2 level (bitmap) dither will be applied to all
8184 % channels, while a single number is the number of levels applied to each
8185 % channel in sequence. More numbers will be applied in turn to each of
8186 % the color channels.
8187 %
8188 % For example: "o3x3,6" generates a 6 level posterization of the image
8189 % with a ordered 3x3 diffused pixel dither being applied between each
8190 % level. While checker,8,8,4 will produce a 332 colormaped image with
8191 % only a single checkerboard hash pattern (50% grey) between each color
8192 % level, to basically double the number of color levels with a bare
8193 % minimum of dithering.
8194 %
8195 */
8196 WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
8197  const char *threshold_map)
8198 {
8199  MagickBooleanType
8200  status;
8201 
8202  assert(wand != (MagickWand *) NULL);
8203  assert(wand->signature == MagickWandSignature);
8204  if (wand->debug != MagickFalse)
8205  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8206  if (wand->images == (Image *) NULL)
8207  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8208  status=OrderedDitherImage(wand->images,threshold_map,wand->exception);
8209  return(status);
8210 }
8211 ␌
8212 /*
8213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8214 % %
8215 % %
8216 % %
8217 % M a g i c k P i n g I m a g e %
8218 % %
8219 % %
8220 % %
8221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8222 %
8223 % MagickPingImage() is the same as MagickReadImage() except the only valid
8224 % information returned is the image width, height, size, and format. It
8225 % is designed to efficiently obtain this information from a file without
8226 % reading the entire image sequence into memory.
8227 %
8228 % The format of the MagickPingImage method is:
8229 %
8230 % MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
8231 %
8232 % A description of each parameter follows:
8233 %
8234 % o wand: the magick wand.
8235 %
8236 % o filename: the image filename.
8237 %
8238 */
8239 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
8240  const char *filename)
8241 {
8242  Image
8243  *images;
8244 
8245  ImageInfo
8246  *ping_info;
8247 
8248  assert(wand != (MagickWand *) NULL);
8249  assert(wand->signature == MagickWandSignature);
8250  if (wand->debug != MagickFalse)
8251  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8252  ping_info=CloneImageInfo(wand->image_info);
8253  if (filename != (const char *) NULL)
8254  (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
8255  images=PingImage(ping_info,wand->exception);
8256  ping_info=DestroyImageInfo(ping_info);
8257  if (images == (Image *) NULL)
8258  return(MagickFalse);
8259  return(InsertImageInWand(wand,images));
8260 }
8261 ␌
8262 /*
8263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8264 % %
8265 % %
8266 % %
8267 % M a g i c k P i n g I m a g e B l o b %
8268 % %
8269 % %
8270 % %
8271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8272 %
8273 % MagickPingImageBlob() pings an image or image sequence from a blob.
8274 %
8275 % The format of the MagickPingImageBlob method is:
8276 %
8277 % MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8278 % const void *blob,const size_t length)
8279 %
8280 % A description of each parameter follows:
8281 %
8282 % o wand: the magick wand.
8283 %
8284 % o blob: the blob.
8285 %
8286 % o length: the blob length.
8287 %
8288 */
8289 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8290  const void *blob,const size_t length)
8291 {
8292  Image
8293  *images;
8294 
8295  assert(wand != (MagickWand *) NULL);
8296  assert(wand->signature == MagickWandSignature);
8297  if (wand->debug != MagickFalse)
8298  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8299  images=PingBlob(wand->image_info,blob,length,wand->exception);
8300  if (images == (Image *) NULL)
8301  return(MagickFalse);
8302  return(InsertImageInWand(wand,images));
8303 }
8304 ␌
8305 /*
8306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8307 % %
8308 % %
8309 % %
8310 % M a g i c k P i n g I m a g e F i l e %
8311 % %
8312 % %
8313 % %
8314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8315 %
8316 % MagickPingImageFile() pings an image or image sequence from an open file
8317 % descriptor.
8318 %
8319 % The format of the MagickPingImageFile method is:
8320 %
8321 % MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8322 %
8323 % A description of each parameter follows:
8324 %
8325 % o wand: the magick wand.
8326 %
8327 % o file: the file descriptor.
8328 %
8329 */
8330 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8331 {
8332  Image
8333  *images;
8334 
8335  ImageInfo
8336  *read_info;
8337 
8338  assert(wand != (MagickWand *) NULL);
8339  assert(wand->signature == MagickWandSignature);
8340  assert(file != (FILE *) NULL);
8341  if (wand->debug != MagickFalse)
8342  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8343  read_info=CloneImageInfo(wand->image_info);
8344  SetImageInfoFile(read_info,file);
8345  images=PingImage(read_info,wand->exception);
8346  read_info=DestroyImageInfo(read_info);
8347  if (images == (Image *) NULL)
8348  return(MagickFalse);
8349  return(InsertImageInWand(wand,images));
8350 }
8351 ␌
8352 /*
8353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8354 % %
8355 % %
8356 % %
8357 % M a g i c k P o l a r o i d I m a g e %
8358 % %
8359 % %
8360 % %
8361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8362 %
8363 % MagickPolaroidImage() simulates a Polaroid picture.
8364 %
8365 % The format of the MagickPolaroidImage method is:
8366 %
8367 % MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8368 % const DrawingWand *drawing_wand,const char *caption,const double angle,
8369 % const PixelInterpolateMethod method)
8370 %
8371 % A description of each parameter follows:
8372 %
8373 % o wand: the magick wand.
8374 %
8375 % o drawing_wand: the draw wand.
8376 %
8377 % o caption: the Polaroid caption.
8378 %
8379 % o angle: Apply the effect along this angle.
8380 %
8381 % o method: the pixel interpolation method.
8382 %
8383 */
8384 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8385  const DrawingWand *drawing_wand,const char *caption,const double angle,
8386  const PixelInterpolateMethod method)
8387 {
8388  DrawInfo
8389  *draw_info;
8390 
8391  Image
8392  *polaroid_image;
8393 
8394  assert(wand != (MagickWand *) NULL);
8395  assert(wand->signature == MagickWandSignature);
8396  if (wand->debug != MagickFalse)
8397  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8398  if (wand->images == (Image *) NULL)
8399  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8400  draw_info=PeekDrawingWand(drawing_wand);
8401  if (draw_info == (DrawInfo *) NULL)
8402  return(MagickFalse);
8403  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
8404  wand->exception);
8405  if (polaroid_image == (Image *) NULL)
8406  return(MagickFalse);
8407  ReplaceImageInList(&wand->images,polaroid_image);
8408  return(MagickTrue);
8409 }
8410 ␌
8411 /*
8412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8413 % %
8414 % %
8415 % %
8416 % M a g i c k P o l y n o m i a l I m a g e %
8417 % %
8418 % %
8419 % %
8420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8421 %
8422 % MagickPolynomialImage() returns an image where each pixel is the sum of the
8423 % pixels in the image sequence after applying its corresponding terms
8424 % (coefficient and degree pairs).
8425 %
8426 % The format of the MagickPolynomialImage method is:
8427 %
8428 % MagickBooleanType MagickPolynomialImage(MagickWand *wand,
8429 % const size_t number_terms,const double *terms)
8430 %
8431 % A description of each parameter follows:
8432 %
8433 % o wand: the magick wand.
8434 %
8435 % o number_terms: the number of terms in the list. The actual list length
8436 % is 2 x number_terms + 1 (the constant).
8437 %
8438 % o terms: the list of polynomial coefficients and degree pairs and a
8439 % constant.
8440 %
8441 */
8442 WandExport MagickBooleanType MagickPolynomialImage(MagickWand *wand,
8443  const size_t number_terms,const double *terms)
8444 {
8445  Image
8446  *polynomial_image;
8447 
8448  assert(wand != (MagickWand *) NULL);
8449  assert(wand->signature == MagickWandSignature);
8450  if (wand->debug != MagickFalse)
8451  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8452  if (wand->images == (Image *) NULL)
8453  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8454  polynomial_image=PolynomialImage(wand->images,number_terms,terms,
8455  wand->exception);
8456  if (polynomial_image == (Image *) NULL)
8457  return(MagickFalse);
8458  ReplaceImageInList(&wand->images,polynomial_image);
8459  return(MagickTrue);
8460 }
8461 ␌
8462 /*
8463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8464 % %
8465 % %
8466 % %
8467 % M a g i c k P o s t e r i z e I m a g e %
8468 % %
8469 % %
8470 % %
8471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8472 %
8473 % MagickPosterizeImage() reduces the image to a limited number of color level.
8474 %
8475 % The format of the MagickPosterizeImage method is:
8476 %
8477 % MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8478 % const size_t levels,const DitherMethod method)
8479 %
8480 % A description of each parameter follows:
8481 %
8482 % o wand: the magick wand.
8483 %
8484 % o levels: Number of color levels allowed in each channel. Very low values
8485 % (2, 3, or 4) have the most visible effect.
8486 %
8487 % o method: choose the dither method: UndefinedDitherMethod,
8488 % NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8489 %
8490 */
8491 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8492  const size_t levels,const DitherMethod dither)
8493 {
8494  MagickBooleanType
8495  status;
8496 
8497  assert(wand != (MagickWand *) NULL);
8498  assert(wand->signature == MagickWandSignature);
8499  if (wand->debug != MagickFalse)
8500  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8501  if (wand->images == (Image *) NULL)
8502  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8503  status=PosterizeImage(wand->images,levels,dither,wand->exception);
8504  return(status);
8505 }
8506 ␌
8507 /*
8508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8509 % %
8510 % %
8511 % %
8512 % M a g i c k P r e v i e w I m a g e s %
8513 % %
8514 % %
8515 % %
8516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8517 %
8518 % MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8519 % image processing operation applied at varying strengths. This helpful
8520 % to quickly pin-point an appropriate parameter for an image processing
8521 % operation.
8522 %
8523 % The format of the MagickPreviewImages method is:
8524 %
8525 % MagickWand *MagickPreviewImages(MagickWand *wand,
8526 % const PreviewType preview)
8527 %
8528 % A description of each parameter follows:
8529 %
8530 % o wand: the magick wand.
8531 %
8532 % o preview: the preview type.
8533 %
8534 */
8535 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8536  const PreviewType preview)
8537 {
8538  Image
8539  *preview_image;
8540 
8541  assert(wand != (MagickWand *) NULL);
8542  assert(wand->signature == MagickWandSignature);
8543  if (wand->debug != MagickFalse)
8544  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8545  if (wand->images == (Image *) NULL)
8546  return((MagickWand *) NULL);
8547  preview_image=PreviewImage(wand->images,preview,wand->exception);
8548  if (preview_image == (Image *) NULL)
8549  return((MagickWand *) NULL);
8550  return(CloneMagickWandFromImages(wand,preview_image));
8551 }
8552 ␌
8553 /*
8554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8555 % %
8556 % %
8557 % %
8558 % M a g i c k P r e v i o u s I m a g e %
8559 % %
8560 % %
8561 % %
8562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8563 %
8564 % MagickPreviousImage() sets the previous image in the wand as the current
8565 % image.
8566 %
8567 % It is typically used after MagickSetLastIterator(), after which its first
8568 % use will set the last image as the current image (unless the wand is empty).
8569 %
8570 % It will return MagickFalse when no more images are left to be returned
8571 % which happens when the wand is empty, or the current image is the first
8572 % image. At that point the iterator is than reset to again process images in
8573 % the forward direction, again starting with the first image in list. Images
8574 % added at this point are prepended.
8575 %
8576 % Also at that point any images added to the wand using MagickAddImages() or
8577 % MagickReadImages() will be prepended before the first image. In this sense
8578 % the condition is not quite exactly the same as MagickResetIterator().
8579 %
8580 % The format of the MagickPreviousImage method is:
8581 %
8582 % MagickBooleanType MagickPreviousImage(MagickWand *wand)
8583 %
8584 % A description of each parameter follows:
8585 %
8586 % o wand: the magick wand.
8587 %
8588 */
8589 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8590 {
8591  assert(wand != (MagickWand *) NULL);
8592  assert(wand->signature == MagickWandSignature);
8593  if (wand->debug != MagickFalse)
8594  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8595  if (wand->images == (Image *) NULL)
8596  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8597  if (wand->image_pending != MagickFalse)
8598  {
8599  wand->image_pending=MagickFalse; /* image returned no longer pending */
8600  return(MagickTrue);
8601  }
8602  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8603  {
8604  wand->image_pending=MagickTrue; /* Next now re-gets first image */
8605  wand->insert_before=MagickTrue; /* insert/add prepends new images */
8606  return(MagickFalse);
8607  }
8608  wand->images=GetPreviousImageInList(wand->images);
8609  return(MagickTrue);
8610 }
8611 ␌
8612 /*
8613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8614 % %
8615 % %
8616 % %
8617 % M a g i c k Q u a n t i z e I m a g e %
8618 % %
8619 % %
8620 % %
8621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8622 %
8623 % MagickQuantizeImage() analyzes the colors within a reference image and
8624 % chooses a fixed number of colors to represent the image. The goal of the
8625 % algorithm is to minimize the color difference between the input and output
8626 % image while minimizing the processing time.
8627 %
8628 % The format of the MagickQuantizeImage method is:
8629 %
8630 % MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8631 % const size_t number_colors,const ColorspaceType colorspace,
8632 % const size_t treedepth,const DitherMethod dither_method,
8633 % const MagickBooleanType measure_error)
8634 %
8635 % A description of each parameter follows:
8636 %
8637 % o wand: the magick wand.
8638 %
8639 % o number_colors: the number of colors.
8640 %
8641 % o colorspace: Perform color reduction in this colorspace, typically
8642 % RGBColorspace.
8643 %
8644 % o treedepth: Normally, this integer value is zero or one. A zero or
8645 % one tells Quantize to choose a optimal tree depth of Log4(number_colors).% A tree of this depth generally allows the best representation of the
8646 % reference image with the least amount of memory and the fastest
8647 % computational speed. In some cases, such as an image with low color
8648 % dispersion (a few number of colors), a value other than
8649 % Log4(number_colors) is required. To expand the color tree completely,
8650 % use a value of 8.
8651 %
8652 % o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
8653 % RiemersmaDitherMethod, FloydSteinbergDitherMethod.
8654 %
8655 % o measure_error: A value other than zero measures the difference between
8656 % the original and quantized images. This difference is the total
8657 % quantization error. The error is computed by summing over all pixels
8658 % in an image the distance squared in RGB space between each reference
8659 % pixel value and its quantized value.
8660 %
8661 */
8662 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8663  const size_t number_colors,const ColorspaceType colorspace,
8664  const size_t treedepth,const DitherMethod dither_method,
8665  const MagickBooleanType measure_error)
8666 {
8667  MagickBooleanType
8668  status;
8669 
8670  QuantizeInfo
8671  *quantize_info;
8672 
8673  assert(wand != (MagickWand *) NULL);
8674  assert(wand->signature == MagickWandSignature);
8675  if (wand->debug != MagickFalse)
8676  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8677  if (wand->images == (Image *) NULL)
8678  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8679  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8680  quantize_info->number_colors=number_colors;
8681  quantize_info->dither_method=dither_method;
8682  quantize_info->tree_depth=treedepth;
8683  quantize_info->colorspace=colorspace;
8684  quantize_info->measure_error=measure_error;
8685  status=QuantizeImage(quantize_info,wand->images,wand->exception);
8686  quantize_info=DestroyQuantizeInfo(quantize_info);
8687  return(status);
8688 }
8689 ␌
8690 /*
8691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8692 % %
8693 % %
8694 % %
8695 % M a g i c k Q u a n t i z e I m a g e s %
8696 % %
8697 % %
8698 % %
8699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8700 %
8701 % MagickQuantizeImages() analyzes the colors within a sequence of images and
8702 % chooses a fixed number of colors to represent the image. The goal of the
8703 % algorithm is to minimize the color difference between the input and output
8704 % image while minimizing the processing time.
8705 %
8706 % The format of the MagickQuantizeImages method is:
8707 %
8708 % MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8709 % const size_t number_colors,const ColorspaceType colorspace,
8710 % const size_t treedepth,const DitherMethod dither_method,
8711 % const MagickBooleanType measure_error)
8712 %
8713 % A description of each parameter follows:
8714 %
8715 % o wand: the magick wand.
8716 %
8717 % o number_colors: the number of colors.
8718 %
8719 % o colorspace: Perform color reduction in this colorspace, typically
8720 % RGBColorspace.
8721 %
8722 % o treedepth: Normally, this integer value is zero or one. A zero or
8723 % one tells Quantize to choose a optimal tree depth of Log4(number_colors).% A tree of this depth generally allows the best representation of the
8724 % reference image with the least amount of memory and the fastest
8725 % computational speed. In some cases, such as an image with low color
8726 % dispersion (a few number of colors), a value other than
8727 % Log4(number_colors) is required. To expand the color tree completely,
8728 % use a value of 8.
8729 %
8730 % o dither_method: choose from these dither methods: NoDitherMethod,
8731 % RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8732 %
8733 % o measure_error: A value other than zero measures the difference between
8734 % the original and quantized images. This difference is the total
8735 % quantization error. The error is computed by summing over all pixels
8736 % in an image the distance squared in RGB space between each reference
8737 % pixel value and its quantized value.
8738 %
8739 */
8740 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8741  const size_t number_colors,const ColorspaceType colorspace,
8742  const size_t treedepth,const DitherMethod dither_method,
8743  const MagickBooleanType measure_error)
8744 {
8745  MagickBooleanType
8746  status;
8747 
8748  QuantizeInfo
8749  *quantize_info;
8750 
8751  assert(wand != (MagickWand *) NULL);
8752  assert(wand->signature == MagickWandSignature);
8753  if (wand->debug != MagickFalse)
8754  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8755  if (wand->images == (Image *) NULL)
8756  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8757  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8758  quantize_info->number_colors=number_colors;
8759  quantize_info->dither_method=dither_method;
8760  quantize_info->tree_depth=treedepth;
8761  quantize_info->colorspace=colorspace;
8762  quantize_info->measure_error=measure_error;
8763  status=QuantizeImages(quantize_info,wand->images,wand->exception);
8764  quantize_info=DestroyQuantizeInfo(quantize_info);
8765  return(status);
8766 }
8767 ␌
8768 /*
8769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8770 % %
8771 % %
8772 % %
8773 % M a g i c k R a n g e T h r e s h o l d I m a g e %
8774 % %
8775 % %
8776 % %
8777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8778 %
8779 % MagickRangeThresholdImage() applies soft and hard thresholding.
8780 %
8781 % The format of the RangeThresholdImage method is:
8782 %
8783 % MagickBooleanType MagickRangeThresholdImage(MagickWand *wand,
8784 % const double low_black,const double low_white,const double high_white,
8785 % const double high_black)
8786 %
8787 % A description of each parameter follows:
8788 %
8789 % o wand: the magick wand.
8790 %
8791 % o low_black: Define the minimum threshold value.
8792 %
8793 % o low_white: Define the maximum threshold value.
8794 %
8795 % o high_white: Define the minimum threshold value.
8796 %
8797 % o low_white: Define the maximum threshold value.
8798 %
8799 */
8800 WandExport MagickBooleanType MagickRangeThresholdImage(MagickWand *wand,
8801  const double low_black,const double low_white,const double high_white,
8802  const double high_black)
8803 {
8804  MagickBooleanType
8805  status;
8806 
8807  assert(wand != (MagickWand *) NULL);
8808  assert(wand->signature == MagickWandSignature);
8809  if (wand->debug != MagickFalse)
8810  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8811  if (wand->images == (Image *) NULL)
8812  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8813  status=RangeThresholdImage(wand->images,low_black,low_white,
8814  high_white,high_black,wand->exception);
8815  return(status);
8816 }
8817 ␌
8818 /*
8819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8820 % %
8821 % %
8822 % %
8823 % M a g i c k R o t a t i o n a l B l u r I m a g e %
8824 % %
8825 % %
8826 % %
8827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8828 %
8829 % MagickRotationalBlurImage() rotational blurs an image.
8830 %
8831 % The format of the MagickRotationalBlurImage method is:
8832 %
8833 % MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8834 % const double angle)
8835 %
8836 % A description of each parameter follows:
8837 %
8838 % o wand: the magick wand.
8839 %
8840 % o angle: the angle of the blur in degrees.
8841 %
8842 */
8843 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8844  const double angle)
8845 {
8846  Image
8847  *blur_image;
8848 
8849  assert(wand != (MagickWand *) NULL);
8850  assert(wand->signature == MagickWandSignature);
8851  if (wand->debug != MagickFalse)
8852  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8853  if (wand->images == (Image *) NULL)
8854  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8855  blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
8856  if (blur_image == (Image *) NULL)
8857  return(MagickFalse);
8858  ReplaceImageInList(&wand->images,blur_image);
8859  return(MagickTrue);
8860 }
8861 ␌
8862 /*
8863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8864 % %
8865 % %
8866 % %
8867 % M a g i c k R a i s e I m a g e %
8868 % %
8869 % %
8870 % %
8871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8872 %
8873 % MagickRaiseImage() creates a simulated three-dimensional button-like effect
8874 % by lightening and darkening the edges of the image. Members width and
8875 % height of raise_info define the width of the vertical and horizontal
8876 % edge of the effect.
8877 %
8878 % The format of the MagickRaiseImage method is:
8879 %
8880 % MagickBooleanType MagickRaiseImage(MagickWand *wand,
8881 % const size_t width,const size_t height,const ssize_t x,
8882 % const ssize_t y,const MagickBooleanType raise)
8883 %
8884 % A description of each parameter follows:
8885 %
8886 % o wand: the magick wand.
8887 %
8888 % o width,height,x,y: Define the dimensions of the area to raise.
8889 %
8890 % o raise: A value other than zero creates a 3-D raise effect,
8891 % otherwise it has a lowered effect.
8892 %
8893 */
8894 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8895  const size_t width,const size_t height,const ssize_t x,
8896  const ssize_t y,const MagickBooleanType raise)
8897 {
8898  MagickBooleanType
8899  status;
8900 
8901  RectangleInfo
8902  raise_info;
8903 
8904  assert(wand != (MagickWand *) NULL);
8905  assert(wand->signature == MagickWandSignature);
8906  if (wand->debug != MagickFalse)
8907  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8908  if (wand->images == (Image *) NULL)
8909  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8910  raise_info.width=width;
8911  raise_info.height=height;
8912  raise_info.x=x;
8913  raise_info.y=y;
8914  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8915  return(status);
8916 }
8917 ␌
8918 /*
8919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8920 % %
8921 % %
8922 % %
8923 % M a g i c k R a n d o m T h r e s h o l d I m a g e %
8924 % %
8925 % %
8926 % %
8927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8928 %
8929 % MagickRandomThresholdImage() changes the value of individual pixels based on
8930 % the intensity of each pixel compared to threshold. The result is a
8931 % high-contrast, two color image.
8932 %
8933 % The format of the MagickRandomThresholdImage method is:
8934 %
8935 % MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8936 % const double low,const double high)
8937 %
8938 % A description of each parameter follows:
8939 %
8940 % o wand: the magick wand.
8941 %
8942 % o low,high: Specify the high and low thresholds. These values range from
8943 % 0 to QuantumRange.
8944 %
8945 */
8946 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8947  const double low,const double high)
8948 {
8949  assert(wand != (MagickWand *) NULL);
8950  assert(wand->signature == MagickWandSignature);
8951  if (wand->debug != MagickFalse)
8952  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8953  if (wand->images == (Image *) NULL)
8954  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8955  return(RandomThresholdImage(wand->images,low,high,wand->exception));
8956 }
8957 ␌
8958 /*
8959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8960 % %
8961 % %
8962 % %
8963 % M a g i c k R e a d I m a g e %
8964 % %
8965 % %
8966 % %
8967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8968 %
8969 % MagickReadImage() reads an image or image sequence. The images are inserted
8970 % just before the current image pointer position.
8971 %
8972 % Use MagickSetFirstIterator(), to insert new images before all the current
8973 % images in the wand, MagickSetLastIterator() to append add to the end,
8974 % MagickSetIteratorIndex() to place images just after the given index.
8975 %
8976 % The format of the MagickReadImage method is:
8977 %
8978 % MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8979 %
8980 % A description of each parameter follows:
8981 %
8982 % o wand: the magick wand.
8983 %
8984 % o filename: the image filename.
8985 %
8986 */
8987 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8988  const char *filename)
8989 {
8990  Image
8991  *images;
8992 
8993  ImageInfo
8994  *read_info;
8995 
8996  assert(wand != (MagickWand *) NULL);
8997  assert(wand->signature == MagickWandSignature);
8998  if (wand->debug != MagickFalse)
8999  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9000  read_info=CloneImageInfo(wand->image_info);
9001  if (filename != (const char *) NULL)
9002  (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
9003  images=ReadImage(read_info,wand->exception);
9004  read_info=DestroyImageInfo(read_info);
9005  if (images == (Image *) NULL)
9006  return(MagickFalse);
9007  return(InsertImageInWand(wand,images));
9008 }
9009 ␌
9010 /*
9011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9012 % %
9013 % %
9014 % %
9015 % M a g i c k R e a d I m a g e B l o b %
9016 % %
9017 % %
9018 % %
9019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9020 %
9021 % MagickReadImageBlob() reads an image or image sequence from a blob.
9022 % In all other respects it is like MagickReadImage().
9023 %
9024 % The format of the MagickReadImageBlob method is:
9025 %
9026 % MagickBooleanType MagickReadImageBlob(MagickWand *wand,
9027 % const void *blob,const size_t length)
9028 %
9029 % A description of each parameter follows:
9030 %
9031 % o wand: the magick wand.
9032 %
9033 % o blob: the blob.
9034 %
9035 % o length: the blob length.
9036 %
9037 */
9038 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
9039  const void *blob,const size_t length)
9040 {
9041  Image
9042  *images;
9043 
9044  assert(wand != (MagickWand *) NULL);
9045  assert(wand->signature == MagickWandSignature);
9046  if (wand->debug != MagickFalse)
9047  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9048  images=BlobToImage(wand->image_info,blob,length,wand->exception);
9049  if (images == (Image *) NULL)
9050  return(MagickFalse);
9051  return(InsertImageInWand(wand,images));
9052 }
9053 ␌
9054 /*
9055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9056 % %
9057 % %
9058 % %
9059 % M a g i c k R e a d I m a g e F i l e %
9060 % %
9061 % %
9062 % %
9063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9064 %
9065 % MagickReadImageFile() reads an image or image sequence from an already
9066 % opened file descriptor. Otherwise it is like MagickReadImage().
9067 %
9068 % The format of the MagickReadImageFile method is:
9069 %
9070 % MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
9071 %
9072 % A description of each parameter follows:
9073 %
9074 % o wand: the magick wand.
9075 %
9076 % o file: the file descriptor.
9077 %
9078 */
9079 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
9080 {
9081  Image
9082  *images;
9083 
9084  ImageInfo
9085  *read_info;
9086 
9087  assert(wand != (MagickWand *) NULL);
9088  assert(wand->signature == MagickWandSignature);
9089  assert(file != (FILE *) NULL);
9090  if (wand->debug != MagickFalse)
9091  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9092  read_info=CloneImageInfo(wand->image_info);
9093  SetImageInfoFile(read_info,file);
9094  images=ReadImage(read_info,wand->exception);
9095  read_info=DestroyImageInfo(read_info);
9096  if (images == (Image *) NULL)
9097  return(MagickFalse);
9098  return(InsertImageInWand(wand,images));
9099 }
9100 ␌
9101 /*
9102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9103 % %
9104 % %
9105 % %
9106 % M a g i c k R e m a p I m a g e %
9107 % %
9108 % %
9109 % %
9110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9111 %
9112 % MagickRemapImage() replaces the colors of an image with the closest color
9113 % from a reference image.
9114 %
9115 % The format of the MagickRemapImage method is:
9116 %
9117 % MagickBooleanType MagickRemapImage(MagickWand *wand,
9118 % const MagickWand *remap_wand,const DitherMethod method)
9119 %
9120 % A description of each parameter follows:
9121 %
9122 % o wand: the magick wand.
9123 %
9124 % o affinity: the affinity wand.
9125 %
9126 % o method: choose from these dither methods: NoDitherMethod,
9127 % RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
9128 %
9129 */
9130 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
9131  const MagickWand *remap_wand,const DitherMethod dither_method)
9132 {
9133  MagickBooleanType
9134  status;
9135 
9136  QuantizeInfo
9137  *quantize_info;
9138 
9139  assert(wand != (MagickWand *) NULL);
9140  assert(wand->signature == MagickWandSignature);
9141  if (wand->debug != MagickFalse)
9142  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9143  if ((wand->images == (Image *) NULL) ||
9144  (remap_wand->images == (Image *) NULL))
9145  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9146  quantize_info=AcquireQuantizeInfo(wand->image_info);
9147  quantize_info->dither_method=dither_method;
9148  status=RemapImage(quantize_info,wand->images,remap_wand->images,
9149  wand->exception);
9150  quantize_info=DestroyQuantizeInfo(quantize_info);
9151  return(status);
9152 }
9153 ␌
9154 /*
9155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9156 % %
9157 % %
9158 % %
9159 % M a g i c k R e m o v e I m a g e %
9160 % %
9161 % %
9162 % %
9163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9164 %
9165 % MagickRemoveImage() removes an image from the image list.
9166 %
9167 % The format of the MagickRemoveImage method is:
9168 %
9169 % MagickBooleanType MagickRemoveImage(MagickWand *wand)
9170 %
9171 % A description of each parameter follows:
9172 %
9173 % o wand: the magick wand.
9174 %
9175 % o insert: the splice wand.
9176 %
9177 */
9178 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
9179 {
9180  assert(wand != (MagickWand *) NULL);
9181  assert(wand->signature == MagickWandSignature);
9182  if (wand->debug != MagickFalse)
9183  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9184  if (wand->images == (Image *) NULL)
9185  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9186  DeleteImageFromList(&wand->images);
9187  return(MagickTrue);
9188 }
9189 ␌
9190 /*
9191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9192 % %
9193 % %
9194 % %
9195 % M a g i c k R e s a m p l e I m a g e %
9196 % %
9197 % %
9198 % %
9199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9200 %
9201 % MagickResampleImage() resample image to desired resolution.
9202 %
9203 % Bessel Blackman Box
9204 % Catrom Cubic Gaussian
9205 % Hanning Hermite Lanczos
9206 % Mitchell Point Quadratic
9207 % Sinc Triangle
9208 %
9209 % Most of the filters are FIR (finite impulse response), however, Bessel,
9210 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
9211 % are windowed (brought down to zero) with the Blackman filter.
9212 %
9213 % The format of the MagickResampleImage method is:
9214 %
9215 % MagickBooleanType MagickResampleImage(MagickWand *wand,
9216 % const double x_resolution,const double y_resolution,
9217 % const FilterType filter)
9218 %
9219 % A description of each parameter follows:
9220 %
9221 % o wand: the magick wand.
9222 %
9223 % o x_resolution: the new image x resolution.
9224 %
9225 % o y_resolution: the new image y resolution.
9226 %
9227 % o filter: Image filter to use.
9228 %
9229 */
9230 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
9231  const double x_resolution,const double y_resolution,const FilterType filter)
9232 {
9233  Image
9234  *resample_image;
9235 
9236  assert(wand != (MagickWand *) NULL);
9237  assert(wand->signature == MagickWandSignature);
9238  if (wand->debug != MagickFalse)
9239  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9240  if (wand->images == (Image *) NULL)
9241  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9242  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
9243  wand->exception);
9244  if (resample_image == (Image *) NULL)
9245  return(MagickFalse);
9246  ReplaceImageInList(&wand->images,resample_image);
9247  return(MagickTrue);
9248 }
9249 ␌
9250 /*
9251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9252 % %
9253 % %
9254 % %
9255 % M a g i c k R e s e t I m a g e P a g e %
9256 % %
9257 % %
9258 % %
9259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9260 %
9261 % MagickResetImagePage() resets the Wand page canvas and position.
9262 %
9263 % The format of the MagickResetImagePage method is:
9264 %
9265 % MagickBooleanType MagickResetImagePage(MagickWand *wand,
9266 % const char *page)
9267 %
9268 % A description of each parameter follows:
9269 %
9270 % o wand: the magick wand.
9271 %
9272 % o page: the relative page specification.
9273 %
9274 */
9275 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
9276  const char *page)
9277 {
9278  assert(wand != (MagickWand *) NULL);
9279  assert(wand->signature == MagickWandSignature);
9280  if (wand->debug != MagickFalse)
9281  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9282  if (wand->images == (Image *) NULL)
9283  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9284  if ((page == (char *) NULL) || (*page == '\0'))
9285  {
9286  (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
9287  return(MagickTrue);
9288  }
9289  return(ResetImagePage(wand->images,page));
9290 }
9291 ␌
9292 /*
9293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9294 % %
9295 % %
9296 % %
9297 % M a g i c k R e s i z e I m a g e %
9298 % %
9299 % %
9300 % %
9301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9302 %
9303 % MagickResizeImage() scales an image to the desired dimensions with one of
9304 % these filters:
9305 %
9306 % Bessel Blackman Box
9307 % Catrom Cubic Gaussian
9308 % Hanning Hermite Lanczos
9309 % Mitchell Point Quadratic
9310 % Sinc Triangle
9311 %
9312 % Most of the filters are FIR (finite impulse response), however, Bessel,
9313 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
9314 % are windowed (brought down to zero) with the Blackman filter.
9315 %
9316 % The format of the MagickResizeImage method is:
9317 %
9318 % MagickBooleanType MagickResizeImage(MagickWand *wand,
9319 % const size_t columns,const size_t rows,const FilterType filter)
9320 %
9321 % A description of each parameter follows:
9322 %
9323 % o wand: the magick wand.
9324 %
9325 % o columns: the number of columns in the scaled image.
9326 %
9327 % o rows: the number of rows in the scaled image.
9328 %
9329 % o filter: Image filter to use.
9330 %
9331 */
9332 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
9333  const size_t columns,const size_t rows,const FilterType filter)
9334 {
9335  Image
9336  *resize_image;
9337 
9338  assert(wand != (MagickWand *) NULL);
9339  assert(wand->signature == MagickWandSignature);
9340  if (wand->debug != MagickFalse)
9341  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9342  if (wand->images == (Image *) NULL)
9343  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9344  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
9345  if (resize_image == (Image *) NULL)
9346  return(MagickFalse);
9347  ReplaceImageInList(&wand->images,resize_image);
9348  return(MagickTrue);
9349 }
9350 ␌
9351 /*
9352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9353 % %
9354 % %
9355 % %
9356 % M a g i c k R o l l I m a g e %
9357 % %
9358 % %
9359 % %
9360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9361 %
9362 % MagickRollImage() offsets an image as defined by x and y.
9363 %
9364 % The format of the MagickRollImage method is:
9365 %
9366 % MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
9367 % const ssize_t y)
9368 %
9369 % A description of each parameter follows:
9370 %
9371 % o wand: the magick wand.
9372 %
9373 % o x: the x offset.
9374 %
9375 % o y: the y offset.
9376 %
9377 %
9378 */
9379 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
9380  const ssize_t x,const ssize_t y)
9381 {
9382  Image
9383  *roll_image;
9384 
9385  assert(wand != (MagickWand *) NULL);
9386  assert(wand->signature == MagickWandSignature);
9387  if (wand->debug != MagickFalse)
9388  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9389  if (wand->images == (Image *) NULL)
9390  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9391  roll_image=RollImage(wand->images,x,y,wand->exception);
9392  if (roll_image == (Image *) NULL)
9393  return(MagickFalse);
9394  ReplaceImageInList(&wand->images,roll_image);
9395  return(MagickTrue);
9396 }
9397 ␌
9398 /*
9399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9400 % %
9401 % %
9402 % %
9403 % M a g i c k R o t a t e I m a g e %
9404 % %
9405 % %
9406 % %
9407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9408 %
9409 % MagickRotateImage() rotates an image the specified number of degrees. Empty
9410 % triangles left over from rotating the image are filled with the
9411 % background color.
9412 %
9413 % The format of the MagickRotateImage method is:
9414 %
9415 % MagickBooleanType MagickRotateImage(MagickWand *wand,
9416 % const PixelWand *background,const double degrees)
9417 %
9418 % A description of each parameter follows:
9419 %
9420 % o wand: the magick wand.
9421 %
9422 % o background: the background pixel wand.
9423 %
9424 % o degrees: the number of degrees to rotate the image.
9425 %
9426 %
9427 */
9428 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
9429  const PixelWand *background,const double degrees)
9430 {
9431  Image
9432  *rotate_image;
9433 
9434  assert(wand != (MagickWand *) NULL);
9435  assert(wand->signature == MagickWandSignature);
9436  if (wand->debug != MagickFalse)
9437  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9438  if (wand->images == (Image *) NULL)
9439  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9440  PixelGetQuantumPacket(background,&wand->images->background_color);
9441  rotate_image=RotateImage(wand->images,degrees,wand->exception);
9442  if (rotate_image == (Image *) NULL)
9443  return(MagickFalse);
9444  ReplaceImageInList(&wand->images,rotate_image);
9445  return(MagickTrue);
9446 }
9447 ␌
9448 /*
9449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9450 % %
9451 % %
9452 % %
9453 % M a g i c k S a m p l e I m a g e %
9454 % %
9455 % %
9456 % %
9457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9458 %
9459 % MagickSampleImage() scales an image to the desired dimensions with pixel
9460 % sampling. Unlike other scaling methods, this method does not introduce
9461 % any additional color into the scaled image.
9462 %
9463 % The format of the MagickSampleImage method is:
9464 %
9465 % MagickBooleanType MagickSampleImage(MagickWand *wand,
9466 % const size_t columns,const size_t rows)
9467 %
9468 % A description of each parameter follows:
9469 %
9470 % o wand: the magick wand.
9471 %
9472 % o columns: the number of columns in the scaled image.
9473 %
9474 % o rows: the number of rows in the scaled image.
9475 %
9476 %
9477 */
9478 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9479  const size_t columns,const size_t rows)
9480 {
9481  Image
9482  *sample_image;
9483 
9484  assert(wand != (MagickWand *) NULL);
9485  assert(wand->signature == MagickWandSignature);
9486  if (wand->debug != MagickFalse)
9487  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9488  if (wand->images == (Image *) NULL)
9489  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9490  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9491  if (sample_image == (Image *) NULL)
9492  return(MagickFalse);
9493  ReplaceImageInList(&wand->images,sample_image);
9494  return(MagickTrue);
9495 }
9496 ␌
9497 /*
9498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9499 % %
9500 % %
9501 % %
9502 % M a g i c k S c a l e I m a g e %
9503 % %
9504 % %
9505 % %
9506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9507 %
9508 % MagickScaleImage() scales the size of an image to the given dimensions.
9509 %
9510 % The format of the MagickScaleImage method is:
9511 %
9512 % MagickBooleanType MagickScaleImage(MagickWand *wand,
9513 % const size_t columns,const size_t rows)
9514 %
9515 % A description of each parameter follows:
9516 %
9517 % o wand: the magick wand.
9518 %
9519 % o columns: the number of columns in the scaled image.
9520 %
9521 % o rows: the number of rows in the scaled image.
9522 %
9523 %
9524 */
9525 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9526  const size_t columns,const size_t rows)
9527 {
9528  Image
9529  *scale_image;
9530 
9531  assert(wand != (MagickWand *) NULL);
9532  assert(wand->signature == MagickWandSignature);
9533  if (wand->debug != MagickFalse)
9534  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9535  if (wand->images == (Image *) NULL)
9536  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9537  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9538  if (scale_image == (Image *) NULL)
9539  return(MagickFalse);
9540  ReplaceImageInList(&wand->images,scale_image);
9541  return(MagickTrue);
9542 }
9543 ␌
9544 /*
9545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9546 % %
9547 % %
9548 % %
9549 % M a g i c k S e g m e n t I m a g e %
9550 % %
9551 % %
9552 % %
9553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9554 %
9555 % MagickSegmentImage() segments an image by analyzing the histograms of the
9556 % color components and identifying units that are homogeneous with the fuzzy
9557 % C-means technique.
9558 %
9559 % The format of the SegmentImage method is:
9560 %
9561 % MagickBooleanType MagickSegmentImage(MagickWand *wand,
9562 % const ColorspaceType colorspace,const MagickBooleanType verbose,
9563 % const double cluster_threshold,const double smooth_threshold)
9564 %
9565 % A description of each parameter follows.
9566 %
9567 % o wand: the wand.
9568 %
9569 % o colorspace: the image colorspace.
9570 %
9571 % o verbose: Set to MagickTrue to print detailed information about the
9572 % identified classes.
9573 %
9574 % o cluster_threshold: This represents the minimum number of pixels
9575 % contained in a hexahedra before it can be considered valid (expressed as
9576 % a percentage).
9577 %
9578 % o smooth_threshold: the smoothing threshold eliminates noise in the second
9579 % derivative of the histogram. As the value is increased, you can expect a
9580 % smoother second derivative.
9581 %
9582 */
9583 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9584  const ColorspaceType colorspace,const MagickBooleanType verbose,
9585  const double cluster_threshold,const double smooth_threshold)
9586 {
9587  MagickBooleanType
9588  status;
9589 
9590  assert(wand != (MagickWand *) NULL);
9591  assert(wand->signature == MagickWandSignature);
9592  if (wand->debug != MagickFalse)
9593  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9594  if (wand->images == (Image *) NULL)
9595  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9596  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9597  smooth_threshold,wand->exception);
9598  return(status);
9599 }
9600 ␌
9601 /*
9602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9603 % %
9604 % %
9605 % %
9606 % M a g i c k S e l e c t i v e B l u r I m a g e %
9607 % %
9608 % %
9609 % %
9610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9611 %
9612 % MagickSelectiveBlurImage() selectively blur an image within a contrast
9613 % threshold. It is similar to the unsharpen mask that sharpens everything with
9614 % contrast above a certain threshold.
9615 %
9616 % The format of the MagickSelectiveBlurImage method is:
9617 %
9618 % MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9619 % const double radius,const double sigma,const double threshold)
9620 %
9621 % A description of each parameter follows:
9622 %
9623 % o wand: the magick wand.
9624 %
9625 % o radius: the radius of the gaussian, in pixels, not counting the center
9626 % pixel.
9627 %
9628 % o sigma: the standard deviation of the gaussian, in pixels.
9629 %
9630 % o threshold: only pixels within this contrast threshold are included
9631 % in the blur operation.
9632 %
9633 */
9634 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9635  const double radius,const double sigma,const double threshold)
9636 {
9637  Image
9638  *blur_image;
9639 
9640  assert(wand != (MagickWand *) NULL);
9641  assert(wand->signature == MagickWandSignature);
9642  if (wand->debug != MagickFalse)
9643  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9644  if (wand->images == (Image *) NULL)
9645  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9646  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
9647  wand->exception);
9648  if (blur_image == (Image *) NULL)
9649  return(MagickFalse);
9650  ReplaceImageInList(&wand->images,blur_image);
9651  return(MagickTrue);
9652 }
9653 ␌
9654 /*
9655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9656 % %
9657 % %
9658 % %
9659 % M a g i c k S e p a r a t e I m a g e C h a n n e l %
9660 % %
9661 % %
9662 % %
9663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9664 %
9665 % MagickSeparateImage() separates a channel from the image and returns a
9666 % grayscale image. A channel is a particular color component of each pixel
9667 % in the image.
9668 %
9669 % The format of the MagickSeparateImage method is:
9670 %
9671 % MagickBooleanType MagickSeparateImage(MagickWand *wand,
9672 % const ChannelType channel)
9673 %
9674 % A description of each parameter follows:
9675 %
9676 % o wand: the magick wand.
9677 %
9678 % o channel: the channel.
9679 %
9680 */
9681 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
9682  const ChannelType channel)
9683 {
9684  Image
9685  *separate_image;
9686 
9687  assert(wand != (MagickWand *) NULL);
9688  assert(wand->signature == MagickWandSignature);
9689  if (wand->debug != MagickFalse)
9690  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9691  if (wand->images == (Image *) NULL)
9692  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9693  separate_image=SeparateImage(wand->images,channel,wand->exception);
9694  if (separate_image == (Image *) NULL)
9695  return(MagickFalse);
9696  ReplaceImageInList(&wand->images,separate_image);
9697  return(MagickTrue);
9698 }
9699 ␌
9700 /*
9701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9702 % %
9703 % %
9704 % %
9705 % M a g i c k S e p i a T o n e I m a g e %
9706 % %
9707 % %
9708 % %
9709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9710 %
9711 % MagickSepiaToneImage() applies a special effect to the image, similar to the
9712 % effect achieved in a photo darkroom by sepia toning. Threshold ranges from
9713 % 0 to QuantumRange and is a measure of the extent of the sepia toning. A
9714 % threshold of 80% is a good starting point for a reasonable tone.
9715 %
9716 % The format of the MagickSepiaToneImage method is:
9717 %
9718 % MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9719 % const double threshold)
9720 %
9721 % A description of each parameter follows:
9722 %
9723 % o wand: the magick wand.
9724 %
9725 % o threshold: Define the extent of the sepia toning.
9726 %
9727 */
9728 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9729  const double threshold)
9730 {
9731  Image
9732  *sepia_image;
9733 
9734  assert(wand != (MagickWand *) NULL);
9735  assert(wand->signature == MagickWandSignature);
9736  if (wand->debug != MagickFalse)
9737  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9738  if (wand->images == (Image *) NULL)
9739  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9740  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9741  if (sepia_image == (Image *) NULL)
9742  return(MagickFalse);
9743  ReplaceImageInList(&wand->images,sepia_image);
9744  return(MagickTrue);
9745 }
9746 ␌
9747 /*
9748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9749 % %
9750 % %
9751 % %
9752 % M a g i c k S e t I m a g e %
9753 % %
9754 % %
9755 % %
9756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9757 %
9758 % MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
9759 % MagickNextImage(), MagickPreviousImage() with the images from the specified
9760 % wand.
9761 %
9762 % The format of the MagickSetImage method is:
9763 %
9764 % MagickBooleanType MagickSetImage(MagickWand *wand,
9765 % const MagickWand *set_wand)
9766 %
9767 % A description of each parameter follows:
9768 %
9769 % o wand: the magick wand.
9770 %
9771 % o set_wand: the set_wand wand.
9772 %
9773 */
9774 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9775  const MagickWand *set_wand)
9776 {
9777  Image
9778  *images;
9779 
9780  assert(wand != (MagickWand *) NULL);
9781  assert(wand->signature == MagickWandSignature);
9782  if (wand->debug != MagickFalse)
9783  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9784  assert(set_wand != (MagickWand *) NULL);
9785  assert(set_wand->signature == MagickWandSignature);
9786  if (wand->debug != MagickFalse)
9787  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9788  if (set_wand->images == (Image *) NULL)
9789  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9790  images=CloneImageList(set_wand->images,wand->exception);
9791  if (images == (Image *) NULL)
9792  return(MagickFalse);
9793  ReplaceImageInList(&wand->images,images);
9794  return(MagickTrue);
9795 }
9796 ␌
9797 /*
9798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9799 % %
9800 % %
9801 % %
9802 % M a g i c k S e t I m a g e A l p h a C h a n n e l %
9803 % %
9804 % %
9805 % %
9806 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9807 %
9808 % MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9809 % alpha channel.
9810 %
9811 % The format of the MagickSetImageAlphaChannel method is:
9812 %
9813 % MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9814 % const AlphaChannelOption alpha_type)
9815 %
9816 % A description of each parameter follows:
9817 %
9818 % o wand: the magick wand.
9819 %
9820 % o alpha_type: the alpha channel type: ActivateAlphaChannel,
9821 % DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9822 %
9823 */
9824 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9825  const AlphaChannelOption alpha_type)
9826 {
9827  assert(wand != (MagickWand *) NULL);
9828  assert(wand->signature == MagickWandSignature);
9829  if (wand->debug != MagickFalse)
9830  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9831  if (wand->images == (Image *) NULL)
9832  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9833  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9834 }
9835 ␌
9836 /*
9837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9838 % %
9839 % %
9840 % %
9841 % M a g i c k S e t I m a g e B a c k g r o u n d C o l o r %
9842 % %
9843 % %
9844 % %
9845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9846 %
9847 % MagickSetImageBackgroundColor() sets the image background color.
9848 %
9849 % The format of the MagickSetImageBackgroundColor method is:
9850 %
9851 % MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9852 % const PixelWand *background)
9853 %
9854 % A description of each parameter follows:
9855 %
9856 % o wand: the magick wand.
9857 %
9858 % o background: the background pixel wand.
9859 %
9860 */
9861 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9862  const PixelWand *background)
9863 {
9864  assert(wand != (MagickWand *) NULL);
9865  assert(wand->signature == MagickWandSignature);
9866  if (wand->debug != MagickFalse)
9867  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9868  if (wand->images == (Image *) NULL)
9869  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9870  PixelGetQuantumPacket(background,&wand->images->background_color);
9871  return(MagickTrue);
9872 }
9873 ␌
9874 /*
9875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9876 % %
9877 % %
9878 % %
9879 % M a g i c k S e t I m a g e B l u e P r i m a r y %
9880 % %
9881 % %
9882 % %
9883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9884 %
9885 % MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9886 %
9887 % The format of the MagickSetImageBluePrimary method is:
9888 %
9889 % MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9890 % const double x,const double y,const double z)
9891 %
9892 % A description of each parameter follows:
9893 %
9894 % o wand: the magick wand.
9895 %
9896 % o x: the blue primary x-point.
9897 %
9898 % o y: the blue primary y-point.
9899 %
9900 % o z: the blue primary z-point.
9901 %
9902 */
9903 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9904  const double x,const double y,const double z)
9905 {
9906  assert(wand != (MagickWand *) NULL);
9907  assert(wand->signature == MagickWandSignature);
9908  if (wand->debug != MagickFalse)
9909  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9910  if (wand->images == (Image *) NULL)
9911  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9912  wand->images->chromaticity.blue_primary.x=x;
9913  wand->images->chromaticity.blue_primary.y=y;
9914  wand->images->chromaticity.blue_primary.z=z;
9915  return(MagickTrue);
9916 }
9917 ␌
9918 /*
9919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9920 % %
9921 % %
9922 % %
9923 % M a g i c k S e t I m a g e B o r d e r C o l o r %
9924 % %
9925 % %
9926 % %
9927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9928 %
9929 % MagickSetImageBorderColor() sets the image border color.
9930 %
9931 % The format of the MagickSetImageBorderColor method is:
9932 %
9933 % MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9934 % const PixelWand *border)
9935 %
9936 % A description of each parameter follows:
9937 %
9938 % o wand: the magick wand.
9939 %
9940 % o border: the border pixel wand.
9941 %
9942 */
9943 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9944  const PixelWand *border)
9945 {
9946  assert(wand != (MagickWand *) NULL);
9947  assert(wand->signature == MagickWandSignature);
9948  if (wand->debug != MagickFalse)
9949  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9950  if (wand->images == (Image *) NULL)
9951  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9952  PixelGetQuantumPacket(border,&wand->images->border_color);
9953  return(MagickTrue);
9954 }
9955 ␌
9956 /*
9957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9958 % %
9959 % %
9960 % %
9961 % M a g i c k S e t I m a g e C h a n n e l M a s k %
9962 % %
9963 % %
9964 % %
9965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9966 %
9967 % MagickSetImageChannelMask() sets image channel mask.
9968 %
9969 % The format of the MagickSetImageChannelMask method is:
9970 %
9971 % ChannelType MagickSetImageChannelMask(MagickWand *wand,
9972 % const ChannelType channel_mask)
9973 %
9974 % A description of each parameter follows:
9975 %
9976 % o wand: the magick wand.
9977 %
9978 % o channel_mask: the channel_mask wand.
9979 %
9980 */
9981 WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9982  const ChannelType channel_mask)
9983 {
9984  assert(wand != (MagickWand *) NULL);
9985  assert(wand->signature == MagickWandSignature);
9986  if (wand->debug != MagickFalse)
9987  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9988  return(SetImageChannelMask(wand->images,channel_mask));
9989 }
9990 ␌
9991 /*
9992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9993 % %
9994 % %
9995 % %
9996 % M a g i c k S e t I m a g e M a s k %
9997 % %
9998 % %
9999 % %
10000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10001 %
10002 % MagickSetImageMask() sets image clip mask.
10003 %
10004 % The format of the MagickSetImageMask method is:
10005 %
10006 % MagickBooleanType MagickSetImageMask(MagickWand *wand,
10007 % const PixelMask type,const MagickWand *clip_mask)
10008 %
10009 % A description of each parameter follows:
10010 %
10011 % o wand: the magick wand.
10012 %
10013 % o type: type of mask, ReadPixelMask or WritePixelMask.
10014 %
10015 % o clip_mask: the clip_mask wand.
10016 %
10017 */
10018 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
10019  const PixelMask type,const MagickWand *clip_mask)
10020 {
10021  assert(wand != (MagickWand *) NULL);
10022  assert(wand->signature == MagickWandSignature);
10023  if (wand->debug != MagickFalse)
10024  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10025  assert(clip_mask != (MagickWand *) NULL);
10026  assert(clip_mask->signature == MagickWandSignature);
10027  if (clip_mask->debug != MagickFalse)
10028  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
10029  if (clip_mask->images == (Image *) NULL)
10030  ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
10031  return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
10032 }
10033 ␌
10034 /*
10035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10036 % %
10037 % %
10038 % %
10039 % M a g i c k S e t I m a g e C o l o r %
10040 % %
10041 % %
10042 % %
10043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10044 %
10045 % MagickSetImageColor() set the entire wand canvas to the specified color.
10046 %
10047 % The format of the MagickSetImageColor method is:
10048 %
10049 % MagickBooleanType MagickSetImageColor(MagickWand *wand,
10050 % const PixelWand *color)
10051 %
10052 % A description of each parameter follows:
10053 %
10054 % o wand: the magick wand.
10055 %
10056 % o background: the image color.
10057 %
10058 */
10059 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
10060  const PixelWand *color)
10061 {
10062  PixelInfo
10063  pixel;
10064 
10065  assert(wand != (MagickWand *) NULL);
10066  assert(wand->signature == MagickWandSignature);
10067  if (wand->debug != MagickFalse)
10068  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10069  PixelGetMagickColor(color,&pixel);
10070  return(SetImageColor(wand->images,&pixel,wand->exception));
10071 }
10072 ␌
10073 /*
10074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10075 % %
10076 % %
10077 % %
10078 % M a g i c k S e t I m a g e C o l o r m a p C o l o r %
10079 % %
10080 % %
10081 % %
10082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10083 %
10084 % MagickSetImageColormapColor() sets the color of the specified colormap
10085 % index.
10086 %
10087 % The format of the MagickSetImageColormapColor method is:
10088 %
10089 % MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10090 % const size_t index,const PixelWand *color)
10091 %
10092 % A description of each parameter follows:
10093 %
10094 % o wand: the magick wand.
10095 %
10096 % o index: the offset into the image colormap.
10097 %
10098 % o color: Return the colormap color in this wand.
10099 %
10100 */
10101 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10102  const size_t index,const PixelWand *color)
10103 {
10104  assert(wand != (MagickWand *) NULL);
10105  assert(wand->signature == MagickWandSignature);
10106  if (wand->debug != MagickFalse)
10107  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10108  if (wand->images == (Image *) NULL)
10109  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10110  if ((wand->images->colormap == (PixelInfo *) NULL) ||
10111  (index >= wand->images->colors))
10112  ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
10113  PixelGetQuantumPacket(color,wand->images->colormap+index);
10114  return(SyncImage(wand->images,wand->exception));
10115 }
10116 ␌
10117 /*
10118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10119 % %
10120 % %
10121 % %
10122 % M a g i c k S e t I m a g e C o l o r s p a c e %
10123 % %
10124 % %
10125 % %
10126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10127 %
10128 % MagickSetImageColorspace() sets the image colorspace. But does not modify
10129 % the image data.
10130 %
10131 % The format of the MagickSetImageColorspace method is:
10132 %
10133 % MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10134 % const ColorspaceType colorspace)
10135 %
10136 % A description of each parameter follows:
10137 %
10138 % o wand: the magick wand.
10139 %
10140 % o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
10141 % GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
10142 % YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
10143 % YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
10144 % HSLColorspace, or HWBColorspace.
10145 %
10146 */
10147 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10148  const ColorspaceType colorspace)
10149 {
10150  assert(wand != (MagickWand *) NULL);
10151  assert(wand->signature == MagickWandSignature);
10152  if (wand->debug != MagickFalse)
10153  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10154  if (wand->images == (Image *) NULL)
10155  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10156  return(SetImageColorspace(wand->images,colorspace,wand->exception));
10157 }
10158 ␌
10159 /*
10160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10161 % %
10162 % %
10163 % %
10164 % M a g i c k S e t I m a g e C o m p o s e %
10165 % %
10166 % %
10167 % %
10168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10169 %
10170 % MagickSetImageCompose() sets the image composite operator, useful for
10171 % specifying how to composite the image thumbnail when using the
10172 % MagickMontageImage() method.
10173 %
10174 % The format of the MagickSetImageCompose method is:
10175 %
10176 % MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10177 % const CompositeOperator compose)
10178 %
10179 % A description of each parameter follows:
10180 %
10181 % o wand: the magick wand.
10182 %
10183 % o compose: the image composite operator.
10184 %
10185 */
10186 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10187  const CompositeOperator compose)
10188 {
10189  assert(wand != (MagickWand *) NULL);
10190  assert(wand->signature == MagickWandSignature);
10191  if (wand->debug != MagickFalse)
10192  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10193  if (wand->images == (Image *) NULL)
10194  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10195  wand->images->compose=compose;
10196  return(MagickTrue);
10197 }
10198 ␌
10199 /*
10200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10201 % %
10202 % %
10203 % %
10204 % M a g i c k S e t I m a g e C o m p r e s s i o n %
10205 % %
10206 % %
10207 % %
10208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10209 %
10210 % MagickSetImageCompression() sets the image compression.
10211 %
10212 % The format of the MagickSetImageCompression method is:
10213 %
10214 % MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10215 % const CompressionType compression)
10216 %
10217 % A description of each parameter follows:
10218 %
10219 % o wand: the magick wand.
10220 %
10221 % o compression: the image compression type.
10222 %
10223 */
10224 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10225  const CompressionType compression)
10226 {
10227  assert(wand != (MagickWand *) NULL);
10228  assert(wand->signature == MagickWandSignature);
10229  if (wand->debug != MagickFalse)
10230  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10231  if (wand->images == (Image *) NULL)
10232  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10233  wand->images->compression=compression;
10234  return(MagickTrue);
10235 }
10236 ␌
10237 /*
10238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10239 % %
10240 % %
10241 % %
10242 % M a g i c k S 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 %
10243 % %
10244 % %
10245 % %
10246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10247 %
10248 % MagickSetImageCompressionQuality() sets the image compression quality.
10249 %
10250 % The format of the MagickSetImageCompressionQuality method is:
10251 %
10252 % MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10253 % const size_t quality)
10254 %
10255 % A description of each parameter follows:
10256 %
10257 % o wand: the magick wand.
10258 %
10259 % o quality: the image compression tlityype.
10260 %
10261 */
10262 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10263  const size_t quality)
10264 {
10265  assert(wand != (MagickWand *) NULL);
10266  assert(wand->signature == MagickWandSignature);
10267  if (wand->debug != MagickFalse)
10268  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10269  if (wand->images == (Image *) NULL)
10270  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10271  wand->images->quality=quality;
10272  return(MagickTrue);
10273 }
10274 ␌
10275 /*
10276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10277 % %
10278 % %
10279 % %
10280 % M a g i c k S e t I m a g e D e l a y %
10281 % %
10282 % %
10283 % %
10284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10285 %
10286 % MagickSetImageDelay() sets the image delay.
10287 %
10288 % The format of the MagickSetImageDelay method is:
10289 %
10290 % MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10291 % const size_t delay)
10292 %
10293 % A description of each parameter follows:
10294 %
10295 % o wand: the magick wand.
10296 %
10297 % o delay: the image delay in ticks-per-second units.
10298 %
10299 */
10300 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10301  const size_t delay)
10302 {
10303  assert(wand != (MagickWand *) NULL);
10304  assert(wand->signature == MagickWandSignature);
10305  if (wand->debug != MagickFalse)
10306  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10307  if (wand->images == (Image *) NULL)
10308  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10309  wand->images->delay=delay;
10310  return(MagickTrue);
10311 }
10312 ␌
10313 /*
10314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10315 % %
10316 % %
10317 % %
10318 % M a g i c k S e t I m a g e D e p t h %
10319 % %
10320 % %
10321 % %
10322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10323 %
10324 % MagickSetImageDepth() sets the image depth.
10325 %
10326 % The format of the MagickSetImageDepth method is:
10327 %
10328 % MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10329 % const size_t depth)
10330 %
10331 % A description of each parameter follows:
10332 %
10333 % o wand: the magick wand.
10334 %
10335 % o depth: the image depth in bits: 8, 16, or 32.
10336 %
10337 */
10338 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10339  const size_t depth)
10340 {
10341  assert(wand != (MagickWand *) NULL);
10342  assert(wand->signature == MagickWandSignature);
10343  if (wand->debug != MagickFalse)
10344  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10345  if (wand->images == (Image *) NULL)
10346  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10347  return(SetImageDepth(wand->images,depth,wand->exception));
10348 }
10349 ␌
10350 /*
10351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10352 % %
10353 % %
10354 % %
10355 % M a g i c k S e t I m a g e D i s p o s e %
10356 % %
10357 % %
10358 % %
10359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10360 %
10361 % MagickSetImageDispose() sets the image disposal method.
10362 %
10363 % The format of the MagickSetImageDispose method is:
10364 %
10365 % MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10366 % const DisposeType dispose)
10367 %
10368 % A description of each parameter follows:
10369 %
10370 % o wand: the magick wand.
10371 %
10372 % o dispose: the image disposal type.
10373 %
10374 */
10375 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10376  const DisposeType dispose)
10377 {
10378  assert(wand != (MagickWand *) NULL);
10379  assert(wand->signature == MagickWandSignature);
10380  if (wand->debug != MagickFalse)
10381  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10382  if (wand->images == (Image *) NULL)
10383  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10384  wand->images->dispose=dispose;
10385  return(MagickTrue);
10386 }
10387 ␌
10388 /*
10389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10390 % %
10391 % %
10392 % %
10393 % M a g i c k S e t I m a g e E n d i a n %
10394 % %
10395 % %
10396 % %
10397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10398 %
10399 % MagickSetImageEndian() sets the image endian method.
10400 %
10401 % The format of the MagickSetImageEndian method is:
10402 %
10403 % MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10404 % const EndianType endian)
10405 %
10406 % A description of each parameter follows:
10407 %
10408 % o wand: the magick wand.
10409 %
10410 % o endian: the image endian type.
10411 %
10412 */
10413 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10414  const EndianType endian)
10415 {
10416  assert(wand != (MagickWand *) NULL);
10417  assert(wand->signature == MagickWandSignature);
10418  if (wand->debug != MagickFalse)
10419  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10420  if (wand->images == (Image *) NULL)
10421  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10422  wand->images->endian=endian;
10423  return(MagickTrue);
10424 }
10425 ␌
10426 /*
10427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10428 % %
10429 % %
10430 % %
10431 % M a g i c k S e t I m a g e E x t e n t %
10432 % %
10433 % %
10434 % %
10435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10436 %
10437 % MagickSetImageExtent() sets the image size (i.e. columns & rows).
10438 %
10439 % The format of the MagickSetImageExtent method is:
10440 %
10441 % MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10442 % const size_t columns,const size_t rows)
10443 %
10444 % A description of each parameter follows:
10445 %
10446 % o wand: the magick wand.
10447 %
10448 % o columns: The image width in pixels.
10449 %
10450 % o rows: The image height in pixels.
10451 %
10452 */
10453 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10454  const size_t columns,const size_t rows)
10455 {
10456  assert(wand != (MagickWand *) NULL);
10457  assert(wand->signature == MagickWandSignature);
10458  if (wand->debug != MagickFalse)
10459  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10460  if (wand->images == (Image *) NULL)
10461  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10462  return(SetImageExtent(wand->images,columns,rows,wand->exception));
10463 }
10464 ␌
10465 /*
10466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10467 % %
10468 % %
10469 % %
10470 % M a g i c k S e t I m a g e F i l e n a m e %
10471 % %
10472 % %
10473 % %
10474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10475 %
10476 % MagickSetImageFilename() sets the filename of a particular image in a
10477 % sequence.
10478 %
10479 % The format of the MagickSetImageFilename method is:
10480 %
10481 % MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10482 % const char *filename)
10483 %
10484 % A description of each parameter follows:
10485 %
10486 % o wand: the magick wand.
10487 %
10488 % o filename: the image filename.
10489 %
10490 */
10491 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10492  const char *filename)
10493 {
10494  assert(wand != (MagickWand *) NULL);
10495  assert(wand->signature == MagickWandSignature);
10496  if (wand->debug != MagickFalse)
10497  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10498  if (wand->images == (Image *) NULL)
10499  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10500  if (filename == (const char *) NULL)
10501  return(MagickFalse);
10502  (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
10503  return(MagickTrue);
10504 }
10505 ␌
10506 /*
10507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10508 % %
10509 % %
10510 % %
10511 % M a g i c k S e t I m a g e G r a v i t y %
10512 % %
10513 % %
10514 % %
10515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10516 %
10517 % MagickSetImageFilter() sets the image filter type.
10518 %
10519 % The format of the MagickSetImageFilter method is:
10520 %
10521 % MagickBooleanType MagickSetImageFilter(MagickWand *wand,
10522 % const FilterType filter)
10523 %
10524 % A description of each parameter follows:
10525 %
10526 % o wand: the magick wand.
10527 %
10528 % o filter: Bartlett, Blackman, Bohman, Box, Catrom, Cosine, Cubic,
10529 % CubicSpline, Gaussian, Hamming, Hann, Hermite, Jinc, Kaiser, Lagrange,
10530 % Lanczos, Lanczos2, Lanczos2Sharp, LanczosRadius, LanczosSharp, Mitchell,
10531 % Parzen, Point, Quadratic, Robidoux, RobidouxSharp, Sinc, SincFast,
10532 % Spline, Triangle, Undefined, Welch.
10533 %
10534 */
10535 WandExport MagickBooleanType MagickSetImageFilter(MagickWand *wand,
10536  const FilterType filter)
10537 {
10538  assert(wand != (MagickWand *) NULL);
10539  assert(wand->signature == MagickWandSignature);
10540  if (wand->debug != MagickFalse)
10541  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10542  if (wand->images == (Image *) NULL)
10543  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10544  wand->images->filter=filter;
10545  return(MagickTrue);
10546 }
10547 ␌
10548 /*
10549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10550 % %
10551 % %
10552 % %
10553 % M a g i c k S e t I m a g e F o r m a t %
10554 % %
10555 % %
10556 % %
10557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10558 %
10559 % MagickSetImageFormat() sets the format of a particular image in a
10560 % sequence.
10561 %
10562 % The format of the MagickSetImageFormat method is:
10563 %
10564 % MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10565 % const char *format)
10566 %
10567 % A description of each parameter follows:
10568 %
10569 % o wand: the magick wand.
10570 %
10571 % o format: the image format.
10572 %
10573 */
10574 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10575  const char *format)
10576 {
10577  const MagickInfo
10578  *magick_info;
10579 
10580  assert(wand != (MagickWand *) NULL);
10581  assert(wand->signature == MagickWandSignature);
10582  if (wand->debug != MagickFalse)
10583  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10584  if (wand->images == (Image *) NULL)
10585  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10586  if ((format == (char *) NULL) || (*format == '\0'))
10587  {
10588  *wand->images->magick='\0';
10589  return(MagickTrue);
10590  }
10591  magick_info=GetMagickInfo(format,wand->exception);
10592  if (magick_info == (const MagickInfo *) NULL)
10593  return(MagickFalse);
10594  ClearMagickException(wand->exception);
10595  (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
10596  LocaleUpper(wand->images->magick);
10597  return(MagickTrue);
10598 }
10599 ␌
10600 /*
10601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10602 % %
10603 % %
10604 % %
10605 % M a g i c k S e t I m a g e F u z z %
10606 % %
10607 % %
10608 % %
10609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10610 %
10611 % MagickSetImageFuzz() sets the image fuzz.
10612 %
10613 % The format of the MagickSetImageFuzz method is:
10614 %
10615 % MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10616 % const double fuzz)
10617 %
10618 % A description of each parameter follows:
10619 %
10620 % o wand: the magick wand.
10621 %
10622 % o fuzz: the image fuzz.
10623 %
10624 */
10625 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10626  const double fuzz)
10627 {
10628  assert(wand != (MagickWand *) NULL);
10629  assert(wand->signature == MagickWandSignature);
10630  if (wand->debug != MagickFalse)
10631  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10632  if (wand->images == (Image *) NULL)
10633  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10634  wand->images->fuzz=fuzz;
10635  return(MagickTrue);
10636 }
10637 ␌
10638 /*
10639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10640 % %
10641 % %
10642 % %
10643 % M a g i c k S e t I m a g e G a m m a %
10644 % %
10645 % %
10646 % %
10647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10648 %
10649 % MagickSetImageGamma() sets the image gamma.
10650 %
10651 % The format of the MagickSetImageGamma method is:
10652 %
10653 % MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10654 % const double gamma)
10655 %
10656 % A description of each parameter follows:
10657 %
10658 % o wand: the magick wand.
10659 %
10660 % o gamma: the image gamma.
10661 %
10662 */
10663 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10664  const double gamma)
10665 {
10666  assert(wand != (MagickWand *) NULL);
10667  assert(wand->signature == MagickWandSignature);
10668  if (wand->debug != MagickFalse)
10669  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10670  if (wand->images == (Image *) NULL)
10671  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10672  wand->images->gamma=gamma;
10673  return(MagickTrue);
10674 }
10675 ␌
10676 /*
10677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10678 % %
10679 % %
10680 % %
10681 % M a g i c k S e t I m a g e G r a v i t y %
10682 % %
10683 % %
10684 % %
10685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10686 %
10687 % MagickSetImageGravity() sets the image gravity type.
10688 %
10689 % The format of the MagickSetImageGravity method is:
10690 %
10691 % MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10692 % const GravityType gravity)
10693 %
10694 % A description of each parameter follows:
10695 %
10696 % o wand: the magick wand.
10697 %
10698 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
10699 % NorthEastGravity, WestGravity, CenterGravity,
10700 % EastGravity, SouthWestGravity, SouthGravity,
10701 % SouthEastGravity)
10702 %
10703 */
10704 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10705  const GravityType gravity)
10706 {
10707  assert(wand != (MagickWand *) NULL);
10708  assert(wand->signature == MagickWandSignature);
10709  if (wand->debug != MagickFalse)
10710  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10711  if (wand->images == (Image *) NULL)
10712  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10713  wand->images->gravity=gravity;
10714  return(MagickTrue);
10715 }
10716 ␌
10717 /*
10718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10719 % %
10720 % %
10721 % %
10722 % M a g i c k S e t I m a g e G r e e n P r i m a r y %
10723 % %
10724 % %
10725 % %
10726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10727 %
10728 % MagickSetImageGreenPrimary() sets the image chromaticity green primary
10729 % point.
10730 %
10731 % The format of the MagickSetImageGreenPrimary method is:
10732 %
10733 % MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10734 % const double x,const double y,const double z)
10735 %
10736 % A description of each parameter follows:
10737 %
10738 % o wand: the magick wand.
10739 %
10740 % o x: the green primary x-point.
10741 %
10742 % o y: the green primary y-point.
10743 %
10744 % o z: the green primary z-point.
10745 %
10746 */
10747 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10748  const double x,const double y,const double z)
10749 {
10750  assert(wand != (MagickWand *) NULL);
10751  assert(wand->signature == MagickWandSignature);
10752  if (wand->debug != MagickFalse)
10753  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10754  if (wand->images == (Image *) NULL)
10755  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10756  wand->images->chromaticity.green_primary.x=x;
10757  wand->images->chromaticity.green_primary.y=y;
10758  wand->images->chromaticity.green_primary.z=z;
10759  return(MagickTrue);
10760 }
10761 ␌
10762 /*
10763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10764 % %
10765 % %
10766 % %
10767 % M a g i c k S e t I m a g e I n t e r l a c e S c h e m e %
10768 % %
10769 % %
10770 % %
10771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10772 %
10773 % MagickSetImageInterlaceScheme() sets the image interlace scheme.
10774 %
10775 % The format of the MagickSetImageInterlaceScheme method is:
10776 %
10777 % MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10778 % const InterlaceType interlace)
10779 %
10780 % A description of each parameter follows:
10781 %
10782 % o wand: the magick wand.
10783 %
10784 % o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10785 % PlaneInterlace, PartitionInterlace.
10786 %
10787 */
10788 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10789  const InterlaceType interlace)
10790 {
10791  assert(wand != (MagickWand *) NULL);
10792  assert(wand->signature == MagickWandSignature);
10793  if (wand->debug != MagickFalse)
10794  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10795  if (wand->images == (Image *) NULL)
10796  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10797  wand->images->interlace=interlace;
10798  return(MagickTrue);
10799 }
10800 ␌
10801 /*
10802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10803 % %
10804 % %
10805 % %
10806 % M a g i c k S e t I m a g e I n t e r p o l a t e M e t h o d %
10807 % %
10808 % %
10809 % %
10810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10811 %
10812 % MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10813 %
10814 % The format of the MagickSetImageInterpolateMethod method is:
10815 %
10816 % MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10817 % const PixelInterpolateMethod method)
10818 %
10819 % A description of each parameter follows:
10820 %
10821 % o wand: the magick wand.
10822 %
10823 % o method: the image interpole pixel methods: choose from Undefined,
10824 % Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10825 %
10826 */
10827 
10828 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
10829  MagickWand *wand,const PixelInterpolateMethod method)
10830 {
10831  return(MagickSetImageInterpolateMethod(wand,method));
10832 }
10833 
10834 WandExport MagickBooleanType MagickSetImageInterpolateMethod(
10835  MagickWand *wand,const PixelInterpolateMethod method)
10836 {
10837  assert(wand != (MagickWand *) NULL);
10838  assert(wand->signature == MagickWandSignature);
10839  if (wand->debug != MagickFalse)
10840  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10841  if (wand->images == (Image *) NULL)
10842  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10843  wand->images->interpolate=method;
10844  return(MagickTrue);
10845 }
10846 ␌
10847 /*
10848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10849 % %
10850 % %
10851 % %
10852 % M a g i c k S e t I m a g e I t e r a t i o n s %
10853 % %
10854 % %
10855 % %
10856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10857 %
10858 % MagickSetImageIterations() sets the image iterations.
10859 %
10860 % The format of the MagickSetImageIterations method is:
10861 %
10862 % MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10863 % const size_t iterations)
10864 %
10865 % A description of each parameter follows:
10866 %
10867 % o wand: the magick wand.
10868 %
10869 % o delay: the image delay in 1/100th of a second.
10870 %
10871 */
10872 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10873  const size_t iterations)
10874 {
10875  assert(wand != (MagickWand *) NULL);
10876  assert(wand->signature == MagickWandSignature);
10877  if (wand->debug != MagickFalse)
10878  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10879  if (wand->images == (Image *) NULL)
10880  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10881  wand->images->iterations=iterations;
10882  return(MagickTrue);
10883 }
10884 ␌
10885 /*
10886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10887 % %
10888 % %
10889 % %
10890 % M a g i c k S e t I m a g e M a t t e %
10891 % %
10892 % %
10893 % %
10894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10895 %
10896 % MagickSetImageMatte() sets the image matte channel.
10897 %
10898 % The format of the MagickSetImageMatte method is:
10899 %
10900 % MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10901 % const MagickBooleanType matte)
10902 %
10903 % A description of each parameter follows:
10904 %
10905 % o wand: the magick wand.
10906 %
10907 % o matte: Set to MagickTrue to enable the image matte channel otherwise
10908 % MagickFalse.
10909 %
10910 */
10911 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10912  const MagickBooleanType matte)
10913 {
10914  assert(wand != (MagickWand *) NULL);
10915  assert(wand->signature == MagickWandSignature);
10916  if (wand->debug != MagickFalse)
10917  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10918  if (wand->images == (Image *) NULL)
10919  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10920  if (matte == MagickFalse)
10921  wand->images->alpha_trait=UndefinedPixelTrait;
10922  else
10923  {
10924  if (wand->images->alpha_trait == UndefinedPixelTrait)
10925  (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10926  wand->images->alpha_trait=BlendPixelTrait;
10927  }
10928  return(MagickTrue);
10929 }
10930 ␌
10931 /*
10932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10933 % %
10934 % %
10935 % %
10936 % M a g i c k S e t I m a g e M a t t e C o l o r %
10937 % %
10938 % %
10939 % %
10940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10941 %
10942 % MagickSetImageMatteColor() sets the image alpha color.
10943 %
10944 % The format of the MagickSetImageMatteColor method is:
10945 %
10946 % MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10947 % const PixelWand *matte)
10948 %
10949 % A description of each parameter follows:
10950 %
10951 % o wand: the magick wand.
10952 %
10953 % o matte: the alpha pixel wand.
10954 %
10955 */
10956 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10957  const PixelWand *alpha)
10958 {
10959  assert(wand != (MagickWand *)NULL);
10960  assert(wand->signature == MagickWandSignature);
10961  if (wand->debug != MagickFalse)
10962  (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
10963  if (wand->images == (Image *)NULL)
10964  ThrowWandException(WandError, "ContainsNoImages", wand->name);
10965  PixelGetQuantumPacket(alpha,&wand->images->matte_color);
10966  return(MagickTrue);
10967 }
10968 ␌
10969 /*
10970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10971 % %
10972 % %
10973 % %
10974 % M a g i c k S e t I m a g e O p a c i t y %
10975 % %
10976 % %
10977 % %
10978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10979 %
10980 % MagickSetImageAlpha() sets the image to the specified alpha level.
10981 %
10982 % The format of the MagickSetImageAlpha method is:
10983 %
10984 % MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10985 % const double alpha)
10986 %
10987 % A description of each parameter follows:
10988 %
10989 % o wand: the magick wand.
10990 %
10991 % o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10992 % transparent.
10993 %
10994 */
10995 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10996  const double alpha)
10997 {
10998  MagickBooleanType
10999  status;
11000 
11001  assert(wand != (MagickWand *) NULL);
11002  assert(wand->signature == MagickWandSignature);
11003  if (wand->debug != MagickFalse)
11004  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11005  if (wand->images == (Image *) NULL)
11006  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11007  status=SetImageAlpha(wand->images,ClampToQuantum((double) QuantumRange*alpha),
11008  wand->exception);
11009  return(status);
11010 }
11011 ␌
11012 /*
11013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11014 % %
11015 % %
11016 % %
11017 % M a g i c k S e t I m a g e O r i e n t a t i o n %
11018 % %
11019 % %
11020 % %
11021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11022 %
11023 % MagickSetImageOrientation() sets the image orientation.
11024 %
11025 % The format of the MagickSetImageOrientation method is:
11026 %
11027 % MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
11028 % const OrientationType orientation)
11029 %
11030 % A description of each parameter follows:
11031 %
11032 % o wand: the magick wand.
11033 %
11034 % o orientation: the image orientation type.
11035 %
11036 */
11037 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
11038  const OrientationType orientation)
11039 {
11040  assert(wand != (MagickWand *) NULL);
11041  assert(wand->signature == MagickWandSignature);
11042  if (wand->debug != MagickFalse)
11043  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11044  if (wand->images == (Image *) NULL)
11045  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11046  wand->images->orientation=orientation;
11047  return(MagickTrue);
11048 }
11049 ␌
11050 /*
11051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11052 % %
11053 % %
11054 % %
11055 % M a g i c k S e t I m a g e P a g e %
11056 % %
11057 % %
11058 % %
11059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11060 %
11061 % MagickSetImagePage() sets the page geometry of the image.
11062 %
11063 % The format of the MagickSetImagePage method is:
11064 %
11065 % MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,% const size_t height,const ssize_t x,const ssize_t y)
11066 %
11067 % A description of each parameter follows:
11068 %
11069 % o wand: the magick wand.
11070 %
11071 % o width: the page width.
11072 %
11073 % o height: the page height.
11074 %
11075 % o x: the page x-offset.
11076 %
11077 % o y: the page y-offset.
11078 %
11079 */
11080 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
11081  const size_t width,const size_t height,const ssize_t x,
11082  const ssize_t y)
11083 {
11084  assert(wand != (MagickWand *) NULL);
11085  assert(wand->signature == MagickWandSignature);
11086  if (wand->debug != MagickFalse)
11087  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11088  if (wand->images == (Image *) NULL)
11089  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11090  wand->images->page.width=width;
11091  wand->images->page.height=height;
11092  wand->images->page.x=x;
11093  wand->images->page.y=y;
11094  return(MagickTrue);
11095 }
11096 ␌
11097 /*
11098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11099 % %
11100 % %
11101 % %
11102 % M a g i c k S e t I m a g e P i x e l C o l o r %
11103 % %
11104 % %
11105 % %
11106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11107 %
11108 % MagickSetImagePixelColor() sets the color of the specified pixel.
11109 %
11110 % The format of the MagickSetImagePixelColor method is:
11111 %
11112 % MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11113 % const ssize_t x,const ssize_t y,const PixelWand *color)
11114 %
11115 % A description of each parameter follows:
11116 %
11117 % o wand: the magick wand.
11118 %
11119 % o x,y: the pixel offset into the image.
11120 %
11121 % o color: Return the colormap color in this wand.
11122 %
11123 */
11124 WandExport MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11125  const ssize_t x,const ssize_t y,const PixelWand *color)
11126 {
11127  Quantum
11128  *q;
11129 
11130  CacheView
11131  *image_view;
11132 
11133  assert(wand != (MagickWand *) NULL);
11134  assert(wand->signature == MagickWandSignature);
11135  if (wand->debug != MagickFalse)
11136  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11137  if (wand->images == (Image *) NULL)
11138  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11139  image_view=AcquireAuthenticCacheView(wand->images,wand->exception);
11140  q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,wand->exception);
11141  if (q == (Quantum *) NULL)
11142  {
11143  image_view=DestroyCacheView(image_view);
11144  return(MagickFalse);
11145  }
11146  PixelGetQuantumPixel(wand->images,color,q);
11147  image_view=DestroyCacheView(image_view);
11148  return(MagickTrue);
11149 }
11150 ␌
11151 /*
11152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11153 % %
11154 % %
11155 % %
11156 % M a g i c k S e t I m a g e P r o g r e s s M o n i t o r %
11157 % %
11158 % %
11159 % %
11160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11161 %
11162 % MagickSetImageProgressMonitor() sets the wand image progress monitor to the
11163 % specified method and returns the previous progress monitor if any. The
11164 % progress monitor method looks like this:
11165 %
11166 % MagickBooleanType MagickProgressMonitor(const char *text,
11167 % const MagickOffsetType offset,const MagickSizeType span,
11168 % void *client_data)
11169 %
11170 % If the progress monitor returns MagickFalse, the current operation is
11171 % interrupted.
11172 %
11173 % The format of the MagickSetImageProgressMonitor method is:
11174 %
11175 % MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
11176 % const MagickProgressMonitor progress_monitor,void *client_data)
11177 %
11178 % A description of each parameter follows:
11179 %
11180 % o wand: the magick wand.
11181 %
11182 % o progress_monitor: Specifies a pointer to a method to monitor progress
11183 % of an image operation.
11184 %
11185 % o client_data: Specifies a pointer to any client data.
11186 %
11187 */
11188 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
11189  const MagickProgressMonitor progress_monitor,void *client_data)
11190 {
11191  MagickProgressMonitor
11192  previous_monitor;
11193 
11194  assert(wand != (MagickWand *) NULL);
11195  assert(wand->signature == MagickWandSignature);
11196  if (wand->debug != MagickFalse)
11197  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11198  if (wand->images == (Image *) NULL)
11199  {
11200  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11201  "ContainsNoImages","`%s'",wand->name);
11202  return((MagickProgressMonitor) NULL);
11203  }
11204  previous_monitor=SetImageProgressMonitor(wand->images,
11205  progress_monitor,client_data);
11206  return(previous_monitor);
11207 }
11208 ␌
11209 /*
11210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11211 % %
11212 % %
11213 % %
11214 % M a g i c k S e t I m a g e R e d P r i m a r y %
11215 % %
11216 % %
11217 % %
11218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11219 %
11220 % MagickSetImageRedPrimary() sets the image chromaticity red primary point.
11221 %
11222 % The format of the MagickSetImageRedPrimary method is:
11223 %
11224 % MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11225 % const double x,const double y,const double z)
11226 %
11227 % A description of each parameter follows:
11228 %
11229 % o wand: the magick wand.
11230 %
11231 % o x: the red primary x-point.
11232 %
11233 % o y: the red primary y-point.
11234 %
11235 % o z: the red primary z-point.
11236 %
11237 */
11238 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11239  const double x,const double y,const double z)
11240 {
11241  assert(wand != (MagickWand *) NULL);
11242  assert(wand->signature == MagickWandSignature);
11243  if (wand->debug != MagickFalse)
11244  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11245  if (wand->images == (Image *) NULL)
11246  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11247  wand->images->chromaticity.red_primary.x=x;
11248  wand->images->chromaticity.red_primary.y=y;
11249  wand->images->chromaticity.red_primary.z=z;
11250  return(MagickTrue);
11251 }
11252 ␌
11253 /*
11254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11255 % %
11256 % %
11257 % %
11258 % M a g i c k S e t I m a g e R e n d e r i n g I n t e n t %
11259 % %
11260 % %
11261 % %
11262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11263 %
11264 % MagickSetImageRenderingIntent() sets the image rendering intent.
11265 %
11266 % The format of the MagickSetImageRenderingIntent method is:
11267 %
11268 % MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11269 % const RenderingIntent rendering_intent)
11270 %
11271 % A description of each parameter follows:
11272 %
11273 % o wand: the magick wand.
11274 %
11275 % o rendering_intent: the image rendering intent: UndefinedIntent,
11276 % SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
11277 %
11278 */
11279 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11280  const RenderingIntent rendering_intent)
11281 {
11282  assert(wand != (MagickWand *) NULL);
11283  assert(wand->signature == MagickWandSignature);
11284  if (wand->debug != MagickFalse)
11285  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11286  if (wand->images == (Image *) NULL)
11287  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11288  wand->images->rendering_intent=rendering_intent;
11289  return(MagickTrue);
11290 }
11291 ␌
11292 /*
11293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11294 % %
11295 % %
11296 % %
11297 % M a g i c k S e t I m a g e R e s o l u t i o n %
11298 % %
11299 % %
11300 % %
11301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11302 %
11303 % MagickSetImageResolution() sets the image resolution.
11304 %
11305 % The format of the MagickSetImageResolution method is:
11306 %
11307 % MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11308 % const double x_resolution,const double y_resolution)
11309 %
11310 % A description of each parameter follows:
11311 %
11312 % o wand: the magick wand.
11313 %
11314 % o x_resolution: the image x resolution.
11315 %
11316 % o y_resolution: the image y resolution.
11317 %
11318 */
11319 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11320  const double x_resolution,const double y_resolution)
11321 {
11322  assert(wand != (MagickWand *) NULL);
11323  assert(wand->signature == MagickWandSignature);
11324  if (wand->debug != MagickFalse)
11325  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11326  if (wand->images == (Image *) NULL)
11327  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11328  wand->images->resolution.x=x_resolution;
11329  wand->images->resolution.y=y_resolution;
11330  return(MagickTrue);
11331 }
11332 ␌
11333 /*
11334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11335 % %
11336 % %
11337 % %
11338 % M a g i c k S e t I m a g e S c e n e %
11339 % %
11340 % %
11341 % %
11342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11343 %
11344 % MagickSetImageScene() sets the image scene.
11345 %
11346 % The format of the MagickSetImageScene method is:
11347 %
11348 % MagickBooleanType MagickSetImageScene(MagickWand *wand,
11349 % const size_t scene)
11350 %
11351 % A description of each parameter follows:
11352 %
11353 % o wand: the magick wand.
11354 %
11355 % o delay: the image scene number.
11356 %
11357 */
11358 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
11359  const size_t scene)
11360 {
11361  assert(wand != (MagickWand *) NULL);
11362  assert(wand->signature == MagickWandSignature);
11363  if (wand->debug != MagickFalse)
11364  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11365  if (wand->images == (Image *) NULL)
11366  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11367  wand->images->scene=scene;
11368  return(MagickTrue);
11369 }
11370 ␌
11371 /*
11372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11373 % %
11374 % %
11375 % %
11376 % M a g i c k S e t I m a g e T i c k s P e r S e c o n d %
11377 % %
11378 % %
11379 % %
11380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11381 %
11382 % MagickSetImageTicksPerSecond() sets the image ticks-per-second.
11383 %
11384 % The format of the MagickSetImageTicksPerSecond method is:
11385 %
11386 % MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11387 % const ssize_t ticks_per_second)
11388 %
11389 % A description of each parameter follows:
11390 %
11391 % o wand: the magick wand.
11392 %
11393 % o ticks_per_second: the units to use for the image delay.
11394 %
11395 */
11396 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11397  const ssize_t ticks_per_second)
11398 {
11399  assert(wand != (MagickWand *) NULL);
11400  assert(wand->signature == MagickWandSignature);
11401  if (wand->debug != MagickFalse)
11402  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11403  if (wand->images == (Image *) NULL)
11404  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11405  wand->images->ticks_per_second=ticks_per_second;
11406  return(MagickTrue);
11407 }
11408 ␌
11409 /*
11410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11411 % %
11412 % %
11413 % %
11414 % M a g i c k S e t I m a g e T y p e %
11415 % %
11416 % %
11417 % %
11418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11419 %
11420 % MagickSetImageType() sets the image type.
11421 %
11422 % The format of the MagickSetImageType method is:
11423 %
11424 % MagickBooleanType MagickSetImageType(MagickWand *wand,
11425 % const ImageType image_type)
11426 %
11427 % A description of each parameter follows:
11428 %
11429 % o wand: the magick wand.
11430 %
11431 % o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
11432 % GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
11433 % TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
11434 % or OptimizeType.
11435 %
11436 */
11437 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
11438  const ImageType image_type)
11439 {
11440  assert(wand != (MagickWand *) NULL);
11441  assert(wand->signature == MagickWandSignature);
11442  if (wand->debug != MagickFalse)
11443  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11444  if (wand->images == (Image *) NULL)
11445  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11446  return(SetImageType(wand->images,image_type,wand->exception));
11447 }
11448 ␌
11449 /*
11450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11451 % %
11452 % %
11453 % %
11454 % M a g i c k S e t I m a g e U n i t s %
11455 % %
11456 % %
11457 % %
11458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11459 %
11460 % MagickSetImageUnits() sets the image units of resolution.
11461 %
11462 % The format of the MagickSetImageUnits method is:
11463 %
11464 % MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11465 % const ResolutionType units)
11466 %
11467 % A description of each parameter follows:
11468 %
11469 % o wand: the magick wand.
11470 %
11471 % o units: the image units of resolution : UndefinedResolution,
11472 % PixelsPerInchResolution, or PixelsPerCentimeterResolution.
11473 %
11474 */
11475 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11476  const ResolutionType units)
11477 {
11478  assert(wand != (MagickWand *) NULL);
11479  assert(wand->signature == MagickWandSignature);
11480  if (wand->debug != MagickFalse)
11481  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11482  if (wand->images == (Image *) NULL)
11483  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11484  wand->images->units=units;
11485  return(MagickTrue);
11486 }
11487 ␌
11488 /*
11489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11490 % %
11491 % %
11492 % %
11493 % M a g i c k S 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 %
11494 % %
11495 % %
11496 % %
11497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11498 %
11499 % MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
11500 %
11501 % The format of the MagickSetImageVirtualPixelMethod method is:
11502 %
11503 % VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11504 % const VirtualPixelMethod method)
11505 %
11506 % A description of each parameter follows:
11507 %
11508 % o wand: the magick wand.
11509 %
11510 % o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
11511 % ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
11512 % MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
11513 %
11514 */
11515 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11516  const VirtualPixelMethod method)
11517 {
11518  assert(wand != (MagickWand *) NULL);
11519  assert(wand->signature == MagickWandSignature);
11520  if (wand->debug != MagickFalse)
11521  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11522  if (wand->images == (Image *) NULL)
11523  return(UndefinedVirtualPixelMethod);
11524  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
11525 }
11526 ␌
11527 /*
11528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11529 % %
11530 % %
11531 % %
11532 % M a g i c k S e t I m a g e W h i t e P o i n t %
11533 % %
11534 % %
11535 % %
11536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11537 %
11538 % MagickSetImageWhitePoint() sets the image chromaticity white point.
11539 %
11540 % The format of the MagickSetImageWhitePoint method is:
11541 %
11542 % MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11543 % const double x,const double y,const double z)
11544 %
11545 % A description of each parameter follows:
11546 %
11547 % o wand: the magick wand.
11548 %
11549 % o x: the white x-point.
11550 %
11551 % o y: the white y-point.
11552 %
11553 % o z: the white z-point.
11554 %
11555 */
11556 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11557  const double x,const double y,const double z)
11558 {
11559  assert(wand != (MagickWand *) NULL);
11560  assert(wand->signature == MagickWandSignature);
11561  if (wand->debug != MagickFalse)
11562  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11563  if (wand->images == (Image *) NULL)
11564  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11565  wand->images->chromaticity.white_point.x=x;
11566  wand->images->chromaticity.white_point.y=y;
11567  wand->images->chromaticity.white_point.z=z;
11568  return(MagickTrue);
11569 }
11570 ␌
11571 /*
11572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11573 % %
11574 % %
11575 % %
11576 % M a g i c k S h a d e I m a g e C h a n n e l %
11577 % %
11578 % %
11579 % %
11580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11581 %
11582 % MagickShadeImage() shines a distant light on an image to create a
11583 % three-dimensional effect. You control the positioning of the light with
11584 % azimuth and elevation; azimuth is measured in degrees off the x axis
11585 % and elevation is measured in pixels above the Z axis.
11586 %
11587 % The format of the MagickShadeImage method is:
11588 %
11589 % MagickBooleanType MagickShadeImage(MagickWand *wand,
11590 % const MagickBooleanType gray,const double azimuth,
11591 % const double elevation)
11592 %
11593 % A description of each parameter follows:
11594 %
11595 % o wand: the magick wand.
11596 %
11597 % o gray: A value other than zero shades the intensity of each pixel.
11598 %
11599 % o azimuth, elevation: Define the light source direction.
11600 %
11601 */
11602 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11603  const MagickBooleanType gray,const double azimuth,const double elevation)
11604 {
11605  Image
11606  *shade_image;
11607 
11608  assert(wand != (MagickWand *) NULL);
11609  assert(wand->signature == MagickWandSignature);
11610  if (wand->debug != MagickFalse)
11611  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11612  if (wand->images == (Image *) NULL)
11613  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11614  shade_image=ShadeImage(wand->images,gray,azimuth,elevation,wand->exception);
11615  if (shade_image == (Image *) NULL)
11616  return(MagickFalse);
11617  ReplaceImageInList(&wand->images,shade_image);
11618  return(MagickTrue);
11619 }
11620 ␌
11621 /*
11622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11623 % %
11624 % %
11625 % %
11626 % M a g i c k S h a d o w I m a g e %
11627 % %
11628 % %
11629 % %
11630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11631 %
11632 % MagickShadowImage() simulates an image shadow.
11633 %
11634 % The format of the MagickShadowImage method is:
11635 %
11636 % MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
11637 % const double sigma,const ssize_t x,const ssize_t y)
11638 %
11639 % A description of each parameter follows:
11640 %
11641 % o wand: the magick wand.
11642 %
11643 % o alpha: percentage transparency.
11644 %
11645 % o sigma: the standard deviation of the Gaussian, in pixels.
11646 %
11647 % o x: the shadow x-offset.
11648 %
11649 % o y: the shadow y-offset.
11650 %
11651 */
11652 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11653  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
11654 {
11655  Image
11656  *shadow_image;
11657 
11658  assert(wand != (MagickWand *) NULL);
11659  assert(wand->signature == MagickWandSignature);
11660  if (wand->debug != MagickFalse)
11661  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11662  if (wand->images == (Image *) NULL)
11663  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11664  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
11665  if (shadow_image == (Image *) NULL)
11666  return(MagickFalse);
11667  ReplaceImageInList(&wand->images,shadow_image);
11668  return(MagickTrue);
11669 }
11670 ␌
11671 /*
11672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11673 % %
11674 % %
11675 % %
11676 % M a g i c k S h a r p e n I m a g e %
11677 % %
11678 % %
11679 % %
11680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11681 %
11682 % MagickSharpenImage() sharpens an image. We convolve the image with a
11683 % Gaussian operator of the given radius and standard deviation (sigma).
11684 % For reasonable results, the radius should be larger than sigma. Use a
11685 % radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11686 %
11687 % The format of the MagickSharpenImage method is:
11688 %
11689 % MagickBooleanType MagickSharpenImage(MagickWand *wand,
11690 % const double radius,const double sigma)
11691 %
11692 % A description of each parameter follows:
11693 %
11694 % o wand: the magick wand.
11695 %
11696 % o radius: the radius of the Gaussian, in pixels, not counting the center
11697 % pixel.
11698 %
11699 % o sigma: the standard deviation of the Gaussian, in pixels.
11700 %
11701 */
11702 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11703  const double radius,const double sigma)
11704 {
11705  Image
11706  *sharp_image;
11707 
11708  assert(wand != (MagickWand *) NULL);
11709  assert(wand->signature == MagickWandSignature);
11710  if (wand->debug != MagickFalse)
11711  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11712  if (wand->images == (Image *) NULL)
11713  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11714  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
11715  if (sharp_image == (Image *) NULL)
11716  return(MagickFalse);
11717  ReplaceImageInList(&wand->images,sharp_image);
11718  return(MagickTrue);
11719 }
11720 ␌
11721 /*
11722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11723 % %
11724 % %
11725 % %
11726 % M a g i c k S h a v e I m a g e %
11727 % %
11728 % %
11729 % %
11730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11731 %
11732 % MagickShaveImage() shaves pixels from the image edges. It allocates the
11733 % memory necessary for the new Image structure and returns a pointer to the
11734 % new image.
11735 %
11736 % The format of the MagickShaveImage method is:
11737 %
11738 % MagickBooleanType MagickShaveImage(MagickWand *wand,
11739 % const size_t columns,const size_t rows)
11740 %
11741 % A description of each parameter follows:
11742 %
11743 % o wand: the magick wand.
11744 %
11745 % o columns: the number of columns in the scaled image.
11746 %
11747 % o rows: the number of rows in the scaled image.
11748 %
11749 %
11750 */
11751 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11752  const size_t columns,const size_t rows)
11753 {
11754  Image
11755  *shave_image;
11756 
11757  RectangleInfo
11758  shave_info;
11759 
11760  assert(wand != (MagickWand *) NULL);
11761  assert(wand->signature == MagickWandSignature);
11762  if (wand->debug != MagickFalse)
11763  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11764  if (wand->images == (Image *) NULL)
11765  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11766  shave_info.width=columns;
11767  shave_info.height=rows;
11768  shave_info.x=0;
11769  shave_info.y=0;
11770  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11771  if (shave_image == (Image *) NULL)
11772  return(MagickFalse);
11773  ReplaceImageInList(&wand->images,shave_image);
11774  return(MagickTrue);
11775 }
11776 ␌
11777 /*
11778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11779 % %
11780 % %
11781 % %
11782 % M a g i c k S h e a r I m a g e %
11783 % %
11784 % %
11785 % %
11786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11787 %
11788 % MagickShearImage() slides one edge of an image along the X or Y axis,
11789 % creating a parallelogram. An X direction shear slides an edge along the X
11790 % axis, while a Y direction shear slides an edge along the Y axis. The amount
11791 % of the shear is controlled by a shear angle. For X direction shears, x_shear
11792 % is measured relative to the Y axis, and similarly, for Y direction shears
11793 % y_shear is measured relative to the X axis. Empty triangles left over from
11794 % shearing the image are filled with the background color.
11795 %
11796 % The format of the MagickShearImage method is:
11797 %
11798 % MagickBooleanType MagickShearImage(MagickWand *wand,
11799 % const PixelWand *background,const double x_shear,const double y_shear)
11800 %
11801 % A description of each parameter follows:
11802 %
11803 % o wand: the magick wand.
11804 %
11805 % o background: the background pixel wand.
11806 %
11807 % o x_shear: the number of degrees to shear the image.
11808 %
11809 % o y_shear: the number of degrees to shear the image.
11810 %
11811 */
11812 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11813  const PixelWand *background,const double x_shear,const double y_shear)
11814 {
11815  Image
11816  *shear_image;
11817 
11818  assert(wand != (MagickWand *) NULL);
11819  assert(wand->signature == MagickWandSignature);
11820  if (wand->debug != MagickFalse)
11821  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11822  if (wand->images == (Image *) NULL)
11823  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11824  PixelGetQuantumPacket(background,&wand->images->background_color);
11825  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11826  if (shear_image == (Image *) NULL)
11827  return(MagickFalse);
11828  ReplaceImageInList(&wand->images,shear_image);
11829  return(MagickTrue);
11830 }
11831 ␌
11832 /*
11833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11834 % %
11835 % %
11836 % %
11837 % M a g i c k S i g m o i d a l C o n t r a s t I m a g e %
11838 % %
11839 % %
11840 % %
11841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11842 %
11843 % MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11844 % non-linear sigmoidal contrast algorithm. Increase the contrast of the
11845 % image using a sigmoidal transfer function without saturating highlights or
11846 % shadows. Contrast indicates how much to increase the contrast (0 is none;
11847 % 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11848 % the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
11849 % sharpen to MagickTrue to increase the image contrast otherwise the contrast
11850 % is reduced.
11851 %
11852 % The format of the MagickSigmoidalContrastImage method is:
11853 %
11854 % MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11855 % const MagickBooleanType sharpen,const double alpha,const double beta)
11856 %
11857 % A description of each parameter follows:
11858 %
11859 % o wand: the magick wand.
11860 %
11861 % o sharpen: Increase or decrease image contrast.
11862 %
11863 % o alpha: strength of the contrast, the larger the number the more
11864 % 'threshold-like' it becomes.
11865 %
11866 % o beta: midpoint of the function as a color value 0 to QuantumRange.
11867 %
11868 */
11869 WandExport MagickBooleanType MagickSigmoidalContrastImage(
11870  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
11871  const double beta)
11872 {
11873  MagickBooleanType
11874  status;
11875 
11876  assert(wand != (MagickWand *) NULL);
11877  assert(wand->signature == MagickWandSignature);
11878  if (wand->debug != MagickFalse)
11879  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11880  if (wand->images == (Image *) NULL)
11881  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11882  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
11883  wand->exception);
11884  return(status);
11885 }
11886 ␌
11887 /*
11888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11889 % %
11890 % %
11891 % %
11892 % M a g i c k S i m i l a r i t y I m a g e %
11893 % %
11894 % %
11895 % %
11896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11897 %
11898 % MagickSimilarityImage() compares the reference image of the image and
11899 % returns the best match offset. In addition, it returns a similarity image
11900 % such that an exact match location is completely white and if none of the
11901 % pixels match, black, otherwise some gray level in-between.
11902 %
11903 % The format of the MagickSimilarityImage method is:
11904 %
11905 % MagickWand *MagickSimilarityImage(MagickWand *wand,
11906 % const MagickWand *reference,const MetricType metric,
11907 % const double similarity_threshold,RectangleInfo *offset,
11908 % double *similarity)
11909 %
11910 % A description of each parameter follows:
11911 %
11912 % o wand: the magick wand.
11913 %
11914 % o reference: the reference wand.
11915 %
11916 % o metric: the metric.
11917 %
11918 % o similarity_threshold: minimum distortion for (sub)image match.
11919 %
11920 % o offset: the best match offset of the reference image within the image.
11921 %
11922 % o similarity: the computed similarity between the images.
11923 %
11924 */
11925 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11926  const MagickWand *reference,const MetricType metric,
11927  const double similarity_threshold,RectangleInfo *offset,double *similarity)
11928 {
11929  Image
11930  *similarity_image;
11931 
11932  assert(wand != (MagickWand *) NULL);
11933  assert(wand->signature == MagickWandSignature);
11934  if (wand->debug != MagickFalse)
11935  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11936  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11937  {
11938  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11939  "ContainsNoImages","`%s'",wand->name);
11940  return((MagickWand *) NULL);
11941  }
11942  similarity_image=SimilarityImage(wand->images,reference->images,metric,
11943  similarity_threshold,offset,similarity,wand->exception);
11944  if (similarity_image == (Image *) NULL)
11945  return((MagickWand *) NULL);
11946  return(CloneMagickWandFromImages(wand,similarity_image));
11947 }
11948 ␌
11949 /*
11950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11951 % %
11952 % %
11953 % %
11954 % M a g i c k S k e t c h I m a g e %
11955 % %
11956 % %
11957 % %
11958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11959 %
11960 % MagickSketchImage() simulates a pencil sketch. We convolve the image with
11961 % a Gaussian operator of the given radius and standard deviation (sigma).
11962 % For reasonable results, radius should be larger than sigma. Use a
11963 % radius of 0 and SketchImage() selects a suitable radius for you.
11964 % Angle gives the angle of the blurring motion.
11965 %
11966 % The format of the MagickSketchImage method is:
11967 %
11968 % MagickBooleanType MagickSketchImage(MagickWand *wand,
11969 % const double radius,const double sigma,const double angle)
11970 %
11971 % A description of each parameter follows:
11972 %
11973 % o wand: the magick wand.
11974 %
11975 % o radius: the radius of the Gaussian, in pixels, not counting
11976 % the center pixel.
11977 %
11978 % o sigma: the standard deviation of the Gaussian, in pixels.
11979 %
11980 % o angle: apply the effect along this angle.
11981 %
11982 */
11983 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11984  const double radius,const double sigma,const double angle)
11985 {
11986  Image
11987  *sketch_image;
11988 
11989  assert(wand != (MagickWand *) NULL);
11990  assert(wand->signature == MagickWandSignature);
11991  if (wand->debug != MagickFalse)
11992  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11993  if (wand->images == (Image *) NULL)
11994  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11995  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11996  if (sketch_image == (Image *) NULL)
11997  return(MagickFalse);
11998  ReplaceImageInList(&wand->images,sketch_image);
11999  return(MagickTrue);
12000 }
12001 ␌
12002 /*
12003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12004 % %
12005 % %
12006 % %
12007 % M a g i c k S m u s h I m a g e s %
12008 % %
12009 % %
12010 % %
12011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12012 %
12013 % MagickSmushImages() takes all images from the current image pointer to the
12014 % end of the image list and smushes them to each other top-to-bottom if the
12015 % stack parameter is true, otherwise left-to-right.
12016 %
12017 % The format of the MagickSmushImages method is:
12018 %
12019 % MagickWand *MagickSmushImages(MagickWand *wand,
12020 % const MagickBooleanType stack,const ssize_t offset)
12021 %
12022 % A description of each parameter follows:
12023 %
12024 % o wand: the magick wand.
12025 %
12026 % o stack: By default, images are stacked left-to-right. Set stack to
12027 % MagickTrue to stack them top-to-bottom.
12028 %
12029 % o offset: minimum distance in pixels between images.
12030 %
12031 */
12032 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
12033  const MagickBooleanType stack,const ssize_t offset)
12034 {
12035  Image
12036  *smush_image;
12037 
12038  assert(wand != (MagickWand *) NULL);
12039  assert(wand->signature == MagickWandSignature);
12040  if (wand->debug != MagickFalse)
12041  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12042  if (wand->images == (Image *) NULL)
12043  return((MagickWand *) NULL);
12044  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
12045  if (smush_image == (Image *) NULL)
12046  return((MagickWand *) NULL);
12047  return(CloneMagickWandFromImages(wand,smush_image));
12048 }
12049 ␌
12050 /*
12051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12052 % %
12053 % %
12054 % %
12055 % M a g i c k S o l a r i z e I m a g e %
12056 % %
12057 % %
12058 % %
12059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12060 %
12061 % MagickSolarizeImage() applies a special effect to the image, similar to the
12062 % effect achieved in a photo darkroom by selectively exposing areas of photo
12063 % sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
12064 % measure of the extent of the solarization.
12065 %
12066 % The format of the MagickSolarizeImage method is:
12067 %
12068 % MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12069 % const double threshold)
12070 %
12071 % A description of each parameter follows:
12072 %
12073 % o wand: the magick wand.
12074 %
12075 % o threshold: Define the extent of the solarization.
12076 %
12077 */
12078 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12079  const double threshold)
12080 {
12081  MagickBooleanType
12082  status;
12083 
12084  assert(wand != (MagickWand *) NULL);
12085  assert(wand->signature == MagickWandSignature);
12086  if (wand->debug != MagickFalse)
12087  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12088  if (wand->images == (Image *) NULL)
12089  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12090  status=SolarizeImage(wand->images,threshold,wand->exception);
12091  return(status);
12092 }
12093 ␌
12094 /*
12095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12096 % %
12097 % %
12098 % %
12099 % M a g i c k S p a r s e C o l o r I m a g e %
12100 % %
12101 % %
12102 % %
12103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12104 %
12105 % MagickSparseColorImage(), given a set of coordinates, interpolates the
12106 % colors found at those coordinates, across the whole image, using various
12107 % methods.
12108 %
12109 % The format of the MagickSparseColorImage method is:
12110 %
12111 % MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12112 % const SparseColorMethod method,const size_t number_arguments,
12113 % const double *arguments)
12114 %
12115 % A description of each parameter follows:
12116 %
12117 % o image: the image to be sparseed.
12118 %
12119 % o method: the method of image sparseion.
12120 %
12121 % ArcSparseColorion will always ignore source image offset, and always
12122 % 'bestfit' the destination image with the top left corner offset
12123 % relative to the polar mapping center.
12124 %
12125 % Bilinear has no simple inverse mapping so will not allow 'bestfit'
12126 % style of image sparseion.
12127 %
12128 % Affine, Perspective, and Bilinear, will do least squares fitting of
12129 % the distortion when more than the minimum number of control point
12130 % pairs are provided.
12131 %
12132 % Perspective, and Bilinear, will fall back to a Affine sparseion when
12133 % less than 4 control point pairs are provided. While Affine sparseions
12134 % will let you use any number of control point pairs, that is Zero pairs
12135 % is a No-Op (viewport only) distortion, one pair is a translation and
12136 % two pairs of control points will do a scale-rotate-translate, without
12137 % any shearing.
12138 %
12139 % o number_arguments: the number of arguments given for this sparseion
12140 % method.
12141 %
12142 % o arguments: the arguments for this sparseion method.
12143 %
12144 */
12145 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12146  const SparseColorMethod method,const size_t number_arguments,
12147  const double *arguments)
12148 {
12149  Image
12150  *sparse_image;
12151 
12152  assert(wand != (MagickWand *) NULL);
12153  assert(wand->signature == MagickWandSignature);
12154  if (wand->debug != MagickFalse)
12155  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12156  if (wand->images == (Image *) NULL)
12157  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12158  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
12159  wand->exception);
12160  if (sparse_image == (Image *) NULL)
12161  return(MagickFalse);
12162  ReplaceImageInList(&wand->images,sparse_image);
12163  return(MagickTrue);
12164 }
12165 ␌
12166 /*
12167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12168 % %
12169 % %
12170 % %
12171 % M a g i c k S p l i c e I m a g e %
12172 % %
12173 % %
12174 % %
12175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12176 %
12177 % MagickSpliceImage() splices a solid color into the image.
12178 %
12179 % The format of the MagickSpliceImage method is:
12180 %
12181 % MagickBooleanType MagickSpliceImage(MagickWand *wand,
12182 % const size_t width,const size_t height,const ssize_t x,
12183 % const ssize_t y)
12184 %
12185 % A description of each parameter follows:
12186 %
12187 % o wand: the magick wand.
12188 %
12189 % o width: the region width.
12190 %
12191 % o height: the region height.
12192 %
12193 % o x: the region x offset.
12194 %
12195 % o y: the region y offset.
12196 %
12197 */
12198 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
12199  const size_t width,const size_t height,const ssize_t x,
12200  const ssize_t y)
12201 {
12202  Image
12203  *splice_image;
12204 
12205  RectangleInfo
12206  splice;
12207 
12208  assert(wand != (MagickWand *) NULL);
12209  assert(wand->signature == MagickWandSignature);
12210  if (wand->debug != MagickFalse)
12211  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12212  if (wand->images == (Image *) NULL)
12213  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12214  splice.width=width;
12215  splice.height=height;
12216  splice.x=x;
12217  splice.y=y;
12218  splice_image=SpliceImage(wand->images,&splice,wand->exception);
12219  if (splice_image == (Image *) NULL)
12220  return(MagickFalse);
12221  ReplaceImageInList(&wand->images,splice_image);
12222  return(MagickTrue);
12223 }
12224 ␌
12225 /*
12226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12227 % %
12228 % %
12229 % %
12230 % M a g i c k S p r e a d I m a g e %
12231 % %
12232 % %
12233 % %
12234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12235 %
12236 % MagickSpreadImage() is a special effects method that randomly displaces each
12237 % pixel in a block defined by the radius parameter.
12238 %
12239 % The format of the MagickSpreadImage method is:
12240 %
12241 % MagickBooleanType MagickSpreadImage(MagickWand *wand,
12242 % const PixelInterpolateMethod method,const double radius)
12243 %
12244 % A description of each parameter follows:
12245 %
12246 % o wand: the magick wand.
12247 %
12248 % o method: interpolation method.
12249 %
12250 % o radius: Choose a random pixel in a neighborhood of this extent.
12251 %
12252 */
12253 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
12254  const PixelInterpolateMethod method,const double radius)
12255 {
12256  Image
12257  *spread_image;
12258 
12259  assert(wand != (MagickWand *) NULL);
12260  assert(wand->signature == MagickWandSignature);
12261  if (wand->debug != MagickFalse)
12262  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12263  if (wand->images == (Image *) NULL)
12264  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12265  spread_image=SpreadImage(wand->images,method,radius,wand->exception);
12266  if (spread_image == (Image *) NULL)
12267  return(MagickFalse);
12268  ReplaceImageInList(&wand->images,spread_image);
12269  return(MagickTrue);
12270 }
12271 ␌
12272 /*
12273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12274 % %
12275 % %
12276 % %
12277 % M a g i c k S t a t i s t i c I m a g e %
12278 % %
12279 % %
12280 % %
12281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12282 %
12283 % MagickStatisticImage() replace each pixel with corresponding statistic from
12284 % the neighborhood of the specified width and height.
12285 %
12286 % The format of the MagickStatisticImage method is:
12287 %
12288 % MagickBooleanType MagickStatisticImage(MagickWand *wand,
12289 % const StatisticType type,const size_t width,const size_t height)
12290 %
12291 % A description of each parameter follows:
12292 %
12293 % o wand: the magick wand.
12294 %
12295 % o type: the statistic type (e.g. median, mode, etc.).
12296 %
12297 % o width: the width of the pixel neighborhood.
12298 %
12299 % o height: the height of the pixel neighborhood.
12300 %
12301 */
12302 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
12303  const StatisticType type,const size_t width,const size_t height)
12304 {
12305  Image
12306  *statistic_image;
12307 
12308  assert(wand != (MagickWand *) NULL);
12309  assert(wand->signature == MagickWandSignature);
12310  if (wand->debug != MagickFalse)
12311  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12312  if (wand->images == (Image *) NULL)
12313  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12314  statistic_image=StatisticImage(wand->images,type,width,height,
12315  wand->exception);
12316  if (statistic_image == (Image *) NULL)
12317  return(MagickFalse);
12318  ReplaceImageInList(&wand->images,statistic_image);
12319  return(MagickTrue);
12320 }
12321 ␌
12322 /*
12323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12324 % %
12325 % %
12326 % %
12327 % M a g i c k S t e g a n o I m a g e %
12328 % %
12329 % %
12330 % %
12331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12332 %
12333 % MagickSteganoImage() hides a digital watermark within the image.
12334 % Recover the hidden watermark later to prove that the authenticity of
12335 % an image. Offset defines the start position within the image to hide
12336 % the watermark.
12337 %
12338 % The format of the MagickSteganoImage method is:
12339 %
12340 % MagickWand *MagickSteganoImage(MagickWand *wand,
12341 % const MagickWand *watermark_wand,const ssize_t offset)
12342 %
12343 % A description of each parameter follows:
12344 %
12345 % o wand: the magick wand.
12346 %
12347 % o watermark_wand: the watermark wand.
12348 %
12349 % o offset: Start hiding at this offset into the image.
12350 %
12351 */
12352 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
12353  const MagickWand *watermark_wand,const ssize_t offset)
12354 {
12355  Image
12356  *stegano_image;
12357 
12358  assert(wand != (MagickWand *) NULL);
12359  assert(wand->signature == MagickWandSignature);
12360  if (wand->debug != MagickFalse)
12361  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12362  if ((wand->images == (Image *) NULL) ||
12363  (watermark_wand->images == (Image *) NULL))
12364  {
12365  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12366  "ContainsNoImages","`%s'",wand->name);
12367  return((MagickWand *) NULL);
12368  }
12369  wand->images->offset=offset;
12370  stegano_image=SteganoImage(wand->images,watermark_wand->images,
12371  wand->exception);
12372  if (stegano_image == (Image *) NULL)
12373  return((MagickWand *) NULL);
12374  return(CloneMagickWandFromImages(wand,stegano_image));
12375 }
12376 ␌
12377 /*
12378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12379 % %
12380 % %
12381 % %
12382 % M a g i c k S t e r e o I m a g e %
12383 % %
12384 % %
12385 % %
12386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12387 %
12388 % MagickStereoImage() composites two images and produces a single image that
12389 % is the composite of a left and right image of a stereo pair
12390 %
12391 % The format of the MagickStereoImage method is:
12392 %
12393 % MagickWand *MagickStereoImage(MagickWand *wand,
12394 % const MagickWand *offset_wand)
12395 %
12396 % A description of each parameter follows:
12397 %
12398 % o wand: the magick wand.
12399 %
12400 % o offset_wand: Another image wand.
12401 %
12402 */
12403 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
12404  const MagickWand *offset_wand)
12405 {
12406  Image
12407  *stereo_image;
12408 
12409  assert(wand != (MagickWand *) NULL);
12410  assert(wand->signature == MagickWandSignature);
12411  if (wand->debug != MagickFalse)
12412  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12413  if ((wand->images == (Image *) NULL) ||
12414  (offset_wand->images == (Image *) NULL))
12415  {
12416  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12417  "ContainsNoImages","`%s'",wand->name);
12418  return((MagickWand *) NULL);
12419  }
12420  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
12421  if (stereo_image == (Image *) NULL)
12422  return((MagickWand *) NULL);
12423  return(CloneMagickWandFromImages(wand,stereo_image));
12424 }
12425 ␌
12426 /*
12427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12428 % %
12429 % %
12430 % %
12431 % M a g i c k S t r i p I m a g e %
12432 % %
12433 % %
12434 % %
12435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12436 %
12437 % MagickStripImage() strips an image of all profiles and comments.
12438 %
12439 % The format of the MagickStripImage method is:
12440 %
12441 % MagickBooleanType MagickStripImage(MagickWand *wand)
12442 %
12443 % A description of each parameter follows:
12444 %
12445 % o wand: the magick wand.
12446 %
12447 */
12448 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
12449 {
12450  assert(wand != (MagickWand *) NULL);
12451  assert(wand->signature == MagickWandSignature);
12452  if (wand->debug != MagickFalse)
12453  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12454  if (wand->images == (Image *) NULL)
12455  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12456  return(StripImage(wand->images,wand->exception));
12457 }
12458 ␌
12459 /*
12460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12461 % %
12462 % %
12463 % %
12464 % M a g i c k S w i r l I m a g e %
12465 % %
12466 % %
12467 % %
12468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12469 %
12470 % MagickSwirlImage() swirls the pixels about the center of the image, where
12471 % degrees indicates the sweep of the arc through which each pixel is moved.
12472 % You get a more dramatic effect as the degrees move from 1 to 360.
12473 %
12474 % The format of the MagickSwirlImage method is:
12475 %
12476 % MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
12477 % const PixelInterpolateMethod method)
12478 %
12479 % A description of each parameter follows:
12480 %
12481 % o wand: the magick wand.
12482 %
12483 % o degrees: Define the tightness of the swirling effect.
12484 %
12485 % o method: the pixel interpolation method.
12486 %
12487 */
12488 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
12489  const double degrees,const PixelInterpolateMethod method)
12490 {
12491  Image
12492  *swirl_image;
12493 
12494  assert(wand != (MagickWand *) NULL);
12495  assert(wand->signature == MagickWandSignature);
12496  if (wand->debug != MagickFalse)
12497  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12498  if (wand->images == (Image *) NULL)
12499  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12500  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
12501  if (swirl_image == (Image *) NULL)
12502  return(MagickFalse);
12503  ReplaceImageInList(&wand->images,swirl_image);
12504  return(MagickTrue);
12505 }
12506 ␌
12507 /*
12508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12509 % %
12510 % %
12511 % %
12512 % M a g i c k T e x t u r e I m a g e %
12513 % %
12514 % %
12515 % %
12516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12517 %
12518 % MagickTextureImage() repeatedly tiles the texture image across and down the
12519 % image canvas.
12520 %
12521 % The format of the MagickTextureImage method is:
12522 %
12523 % MagickWand *MagickTextureImage(MagickWand *wand,
12524 % const MagickWand *texture_wand)
12525 %
12526 % A description of each parameter follows:
12527 %
12528 % o wand: the magick wand.
12529 %
12530 % o texture_wand: the texture wand
12531 %
12532 */
12533 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
12534  const MagickWand *texture_wand)
12535 {
12536  Image
12537  *texture_image;
12538 
12539  MagickBooleanType
12540  status;
12541 
12542  assert(wand != (MagickWand *) NULL);
12543  assert(wand->signature == MagickWandSignature);
12544  if (wand->debug != MagickFalse)
12545  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12546  if ((wand->images == (Image *) NULL) ||
12547  (texture_wand->images == (Image *) NULL))
12548  {
12549  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12550  "ContainsNoImages","`%s'",wand->name);
12551  return((MagickWand *) NULL);
12552  }
12553  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12554  if (texture_image == (Image *) NULL)
12555  return((MagickWand *) NULL);
12556  status=TextureImage(texture_image,texture_wand->images,wand->exception);
12557  if (status == MagickFalse)
12558  {
12559  texture_image=DestroyImage(texture_image);
12560  return((MagickWand *) NULL);
12561  }
12562  return(CloneMagickWandFromImages(wand,texture_image));
12563 }
12564 ␌
12565 /*
12566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12567 % %
12568 % %
12569 % %
12570 % M a g i c k T h r e s h o l d I m a g e %
12571 % %
12572 % %
12573 % %
12574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12575 %
12576 % MagickThresholdImage() changes the value of individual pixels based on
12577 % the intensity of each pixel compared to threshold. The result is a
12578 % high-contrast, two color image.
12579 %
12580 % The format of the MagickThresholdImage method is:
12581 %
12582 % MagickBooleanType MagickThresholdImage(MagickWand *wand,
12583 % const double threshold)
12584 % MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12585 % const ChannelType channel,const double threshold)
12586 %
12587 % A description of each parameter follows:
12588 %
12589 % o wand: the magick wand.
12590 %
12591 % o channel: the image channel(s).
12592 %
12593 % o threshold: Define the threshold value.
12594 %
12595 */
12596 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12597  const double threshold)
12598 {
12599  MagickBooleanType
12600  status;
12601 
12602  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12603  return(status);
12604 }
12605 
12606 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12607  const ChannelType channel,const double threshold)
12608 {
12609  MagickBooleanType
12610  status;
12611 
12612  ChannelType
12613  channel_mask;
12614 
12615  assert(wand != (MagickWand *) NULL);
12616  assert(wand->signature == MagickWandSignature);
12617  if (wand->debug != MagickFalse)
12618  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12619  if (wand->images == (Image *) NULL)
12620  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12621  channel_mask=SetImageChannelMask(wand->images,channel);
12622  status=BilevelImage(wand->images,threshold,wand->exception);
12623  (void) SetImageChannelMask(wand->images,channel_mask);
12624  return(status);
12625 }
12626 ␌
12627 /*
12628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12629 % %
12630 % %
12631 % %
12632 % M a g i c k T h u m b n a i l I m a g e %
12633 % %
12634 % %
12635 % %
12636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12637 %
12638 % MagickThumbnailImage() changes the size of an image to the given dimensions
12639 % and removes any associated profiles. The goal is to produce small low cost
12640 % thumbnail images suited for display on the Web.
12641 %
12642 % The format of the MagickThumbnailImage method is:
12643 %
12644 % MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12645 % const size_t columns,const size_t rows)
12646 %
12647 % A description of each parameter follows:
12648 %
12649 % o wand: the magick wand.
12650 %
12651 % o columns: the number of columns in the scaled image.
12652 %
12653 % o rows: the number of rows in the scaled image.
12654 %
12655 */
12656 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12657  const size_t columns,const size_t rows)
12658 {
12659  Image
12660  *thumbnail_image;
12661 
12662  assert(wand != (MagickWand *) NULL);
12663  assert(wand->signature == MagickWandSignature);
12664  if (wand->debug != MagickFalse)
12665  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12666  if (wand->images == (Image *) NULL)
12667  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12668  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12669  if (thumbnail_image == (Image *) NULL)
12670  return(MagickFalse);
12671  ReplaceImageInList(&wand->images,thumbnail_image);
12672  return(MagickTrue);
12673 }
12674 ␌
12675 /*
12676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12677 % %
12678 % %
12679 % %
12680 % M a g i c k T i n t I m a g e %
12681 % %
12682 % %
12683 % %
12684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12685 %
12686 % MagickTintImage() applies a color vector to each pixel in the image. The
12687 % length of the vector is 0 for black and white and at its maximum for the
12688 % midtones. The vector weighting function is
12689 % f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12690 %
12691 % The format of the MagickTintImage method is:
12692 %
12693 % MagickBooleanType MagickTintImage(MagickWand *wand,
12694 % const PixelWand *tint,const PixelWand *blend)
12695 %
12696 % A description of each parameter follows:
12697 %
12698 % o wand: the magick wand.
12699 %
12700 % o tint: the tint pixel wand.
12701 %
12702 % o alpha: the alpha pixel wand.
12703 %
12704 */
12705 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12706  const PixelWand *tint,const PixelWand *blend)
12707 {
12708  char
12709  percent_blend[MagickPathExtent];
12710 
12711  Image
12712  *tint_image;
12713 
12714  PixelInfo
12715  target;
12716 
12717  assert(wand != (MagickWand *) NULL);
12718  assert(wand->signature == MagickWandSignature);
12719  if (wand->debug != MagickFalse)
12720  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12721  if (wand->images == (Image *) NULL)
12722  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12723  if (wand->images->colorspace != CMYKColorspace)
12724  (void) FormatLocaleString(percent_blend,MagickPathExtent,
12725  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12726  (double) PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
12727  (double) PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
12728  (double) PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
12729  (double) PixelGetAlphaQuantum(blend)));
12730  else
12731  (void) FormatLocaleString(percent_blend,MagickPathExtent,
12732  "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
12733  (double) PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
12734  (double) PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
12735  (double) PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
12736  (double) PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
12737  (double) PixelGetAlphaQuantum(blend)));
12738  target=PixelGetPixel(tint);
12739  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
12740  if (tint_image == (Image *) NULL)
12741  return(MagickFalse);
12742  ReplaceImageInList(&wand->images,tint_image);
12743  return(MagickTrue);
12744 }
12745 ␌
12746 /*
12747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12748 % %
12749 % %
12750 % %
12751 % M a g i c k T r a n s f o r m I m a g e C o l o r s p a c e %
12752 % %
12753 % %
12754 % %
12755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12756 %
12757 % MagickTransformImageColorspace() transform the image colorspace, setting
12758 % the images colorspace while transforming the images data to that
12759 % colorspace.
12760 %
12761 % The format of the MagickTransformImageColorspace method is:
12762 %
12763 % MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12764 % const ColorspaceType colorspace)
12765 %
12766 % A description of each parameter follows:
12767 %
12768 % o wand: the magick wand.
12769 %
12770 % o colorspace: the image colorspace: UndefinedColorspace,
12771 % sRGBColorspace, RGBColorspace, GRAYColorspace,
12772 % OHTAColorspace, XYZColorspace, YCbCrColorspace,
12773 % YCCColorspace, YIQColorspace, YPbPrColorspace,
12774 % YPbPrColorspace, YUVColorspace, CMYKColorspace,
12775 % HSLColorspace, HWBColorspace.
12776 %
12777 */
12778 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12779  const ColorspaceType colorspace)
12780 {
12781  assert(wand != (MagickWand *) NULL);
12782  assert(wand->signature == MagickWandSignature);
12783  if (wand->debug != MagickFalse)
12784  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12785  if (wand->images == (Image *) NULL)
12786  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12787  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
12788 }
12789 ␌
12790 /*
12791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12792 % %
12793 % %
12794 % %
12795 % M a g i c k T r a n s p a r e n t P a i n t I m a g e %
12796 % %
12797 % %
12798 % %
12799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12800 %
12801 % MagickTransparentPaintImage() changes any pixel that matches color with the
12802 % color defined by fill.
12803 %
12804 % The format of the MagickTransparentPaintImage method is:
12805 %
12806 % MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12807 % const PixelWand *target,const double alpha,const double fuzz,
12808 % const MagickBooleanType invert)
12809 %
12810 % A description of each parameter follows:
12811 %
12812 % o wand: the magick wand.
12813 %
12814 % o target: Change this target color to specified alpha value within
12815 % the image.
12816 %
12817 % o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12818 % transparent.
12819 %
12820 % o fuzz: By default target must match a particular pixel color
12821 % exactly. However, in many cases two colors may differ by a small amount.
12822 % The fuzz member of image defines how much tolerance is acceptable to
12823 % consider two colors as the same. For example, set fuzz to 10 and the
12824 % color red at intensities of 100 and 102 respectively are now interpreted
12825 % as the same color for the purposes of the floodfill.
12826 %
12827 % o invert: paint any pixel that does not match the target color.
12828 %
12829 */
12830 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12831  const PixelWand *target,const double alpha,const double fuzz,
12832  const MagickBooleanType invert)
12833 {
12834  MagickBooleanType
12835  status;
12836 
12837  PixelInfo
12838  target_pixel;
12839 
12840  assert(wand != (MagickWand *) NULL);
12841  assert(wand->signature == MagickWandSignature);
12842  if (wand->debug != MagickFalse)
12843  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12844  if (wand->images == (Image *) NULL)
12845  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12846  PixelGetMagickColor(target,&target_pixel);
12847  wand->images->fuzz=fuzz;
12848  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12849  (double) QuantumRange*alpha),invert,wand->exception);
12850  return(status);
12851 }
12852 ␌
12853 /*
12854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12855 % %
12856 % %
12857 % %
12858 % M a g i c k T r a n s p o s e I m a g e %
12859 % %
12860 % %
12861 % %
12862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12863 %
12864 % MagickTransposeImage() creates a vertical mirror image by reflecting the
12865 % pixels around the central x-axis while rotating them 90-degrees.
12866 %
12867 % The format of the MagickTransposeImage method is:
12868 %
12869 % MagickBooleanType MagickTransposeImage(MagickWand *wand)
12870 %
12871 % A description of each parameter follows:
12872 %
12873 % o wand: the magick wand.
12874 %
12875 */
12876 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12877 {
12878  Image
12879  *transpose_image;
12880 
12881  assert(wand != (MagickWand *) NULL);
12882  assert(wand->signature == MagickWandSignature);
12883  if (wand->debug != MagickFalse)
12884  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12885  if (wand->images == (Image *) NULL)
12886  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12887  transpose_image=TransposeImage(wand->images,wand->exception);
12888  if (transpose_image == (Image *) NULL)
12889  return(MagickFalse);
12890  ReplaceImageInList(&wand->images,transpose_image);
12891  return(MagickTrue);
12892 }
12893 ␌
12894 /*
12895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12896 % %
12897 % %
12898 % %
12899 % M a g i c k T r a n s v e r s e I m a g e %
12900 % %
12901 % %
12902 % %
12903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12904 %
12905 % MagickTransverseImage() creates a horizontal mirror image by reflecting the
12906 % pixels around the central y-axis while rotating them 270-degrees.
12907 %
12908 % The format of the MagickTransverseImage method is:
12909 %
12910 % MagickBooleanType MagickTransverseImage(MagickWand *wand)
12911 %
12912 % A description of each parameter follows:
12913 %
12914 % o wand: the magick wand.
12915 %
12916 */
12917 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12918 {
12919  Image
12920  *transverse_image;
12921 
12922  assert(wand != (MagickWand *) NULL);
12923  assert(wand->signature == MagickWandSignature);
12924  if (wand->debug != MagickFalse)
12925  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12926  if (wand->images == (Image *) NULL)
12927  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12928  transverse_image=TransverseImage(wand->images,wand->exception);
12929  if (transverse_image == (Image *) NULL)
12930  return(MagickFalse);
12931  ReplaceImageInList(&wand->images,transverse_image);
12932  return(MagickTrue);
12933 }
12934 ␌
12935 /*
12936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12937 % %
12938 % %
12939 % %
12940 % M a g i c k T r i m I m a g e %
12941 % %
12942 % %
12943 % %
12944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12945 %
12946 % MagickTrimImage() remove edges that are the background color from the image.
12947 %
12948 % The format of the MagickTrimImage method is:
12949 %
12950 % MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12951 %
12952 % A description of each parameter follows:
12953 %
12954 % o wand: the magick wand.
12955 %
12956 % o fuzz: By default target must match a particular pixel color
12957 % exactly. However, in many cases two colors may differ by a small amount.
12958 % The fuzz member of image defines how much tolerance is acceptable to
12959 % consider two colors as the same. For example, set fuzz to 10 and the
12960 % color red at intensities of 100 and 102 respectively are now interpreted
12961 % as the same color for the purposes of the floodfill.
12962 %
12963 */
12964 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12965 {
12966  Image
12967  *trim_image;
12968 
12969  assert(wand != (MagickWand *) NULL);
12970  assert(wand->signature == MagickWandSignature);
12971  if (wand->debug != MagickFalse)
12972  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12973  if (wand->images == (Image *) NULL)
12974  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12975  wand->images->fuzz=fuzz;
12976  trim_image=TrimImage(wand->images,wand->exception);
12977  if (trim_image == (Image *) NULL)
12978  return(MagickFalse);
12979  ReplaceImageInList(&wand->images,trim_image);
12980  return(MagickTrue);
12981 }
12982 ␌
12983 /*
12984 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12985 % %
12986 % %
12987 % %
12988 % M a g i c k U n i q u e I m a g e C o l o r s %
12989 % %
12990 % %
12991 % %
12992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12993 %
12994 % MagickUniqueImageColors() discards all but one of any pixel color.
12995 %
12996 % The format of the MagickUniqueImageColors method is:
12997 %
12998 % MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12999 %
13000 % A description of each parameter follows:
13001 %
13002 % o wand: the magick wand.
13003 %
13004 */
13005 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
13006 {
13007  Image
13008  *unique_image;
13009 
13010  assert(wand != (MagickWand *) NULL);
13011  assert(wand->signature == MagickWandSignature);
13012  if (wand->debug != MagickFalse)
13013  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13014  if (wand->images == (Image *) NULL)
13015  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13016  unique_image=UniqueImageColors(wand->images,wand->exception);
13017  if (unique_image == (Image *) NULL)
13018  return(MagickFalse);
13019  ReplaceImageInList(&wand->images,unique_image);
13020  return(MagickTrue);
13021 }
13022 ␌
13023 /*
13024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13025 % %
13026 % %
13027 % %
13028 % M a g i c k U n s h a r p M a s k I m a g e %
13029 % %
13030 % %
13031 % %
13032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13033 %
13034 % MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
13035 % Gaussian operator of the given radius and standard deviation (sigma).
13036 % For reasonable results, radius should be larger than sigma. Use a radius
13037 % of 0 and UnsharpMaskImage() selects a suitable radius for you.
13038 %
13039 % The format of the MagickUnsharpMaskImage method is:
13040 %
13041 % MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13042 % const double radius,const double sigma,const double gain,
13043 % const double threshold)
13044 %
13045 % A description of each parameter follows:
13046 %
13047 % o wand: the magick wand.
13048 %
13049 % o radius: the radius of the Gaussian, in pixels, not counting the center
13050 % pixel.
13051 %
13052 % o sigma: the standard deviation of the Gaussian, in pixels.
13053 %
13054 % o gain: the percentage of the difference between the original and the
13055 % blur image that is added back into the original.
13056 %
13057 % o threshold: the threshold in pixels needed to apply the difference gain.
13058 %
13059 */
13060 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13061  const double radius,const double sigma,const double gain,
13062  const double threshold)
13063 {
13064  Image
13065  *unsharp_image;
13066 
13067  assert(wand != (MagickWand *) NULL);
13068  assert(wand->signature == MagickWandSignature);
13069  if (wand->debug != MagickFalse)
13070  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13071  if (wand->images == (Image *) NULL)
13072  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13073  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
13074  wand->exception);
13075  if (unsharp_image == (Image *) NULL)
13076  return(MagickFalse);
13077  ReplaceImageInList(&wand->images,unsharp_image);
13078  return(MagickTrue);
13079 }
13080 ␌
13081 /*
13082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13083 % %
13084 % %
13085 % %
13086 % M a g i c k V i g n e t t e I m a g e %
13087 % %
13088 % %
13089 % %
13090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13091 %
13092 % MagickVignetteImage() softens the edges of the image in vignette style.
13093 %
13094 % The format of the MagickVignetteImage method is:
13095 %
13096 % MagickBooleanType MagickVignetteImage(MagickWand *wand,
13097 % const double radius,const double sigma,const ssize_t x,
13098 % const ssize_t y)
13099 %
13100 % A description of each parameter follows:
13101 %
13102 % o wand: the magick wand.
13103 %
13104 % o radius: the radius.
13105 %
13106 % o sigma: the sigma.
13107 %
13108 % o x, y: Define the x and y ellipse offset.
13109 %
13110 */
13111 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
13112  const double radius,const double sigma,const ssize_t x,const ssize_t y)
13113 {
13114  Image
13115  *vignette_image;
13116 
13117  assert(wand != (MagickWand *) NULL);
13118  assert(wand->signature == MagickWandSignature);
13119  if (wand->debug != MagickFalse)
13120  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13121  if (wand->images == (Image *) NULL)
13122  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13123  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
13124  if (vignette_image == (Image *) NULL)
13125  return(MagickFalse);
13126  ReplaceImageInList(&wand->images,vignette_image);
13127  return(MagickTrue);
13128 }
13129 ␌
13130 /*
13131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13132 % %
13133 % %
13134 % %
13135 % M a g i c k W a v e I m a g e %
13136 % %
13137 % %
13138 % %
13139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13140 %
13141 % MagickWaveImage() creates a "ripple" effect in the image by shifting
13142 % the pixels vertically along a sine wave whose amplitude and wavelength
13143 % is specified by the given parameters.
13144 %
13145 % The format of the MagickWaveImage method is:
13146 %
13147 % MagickBooleanType MagickWaveImage(MagickWand *wand,
13148 % const double amplitude,const double wave_length,
13149 % const PixelInterpolateMethod method)
13150 %
13151 % A description of each parameter follows:
13152 %
13153 % o wand: the magick wand.
13154 %
13155 % o amplitude, wave_length: Define the amplitude and wave length of the
13156 % sine wave.
13157 %
13158 % o method: the pixel interpolation method.
13159 %
13160 */
13161 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
13162  const double amplitude,const double wave_length,
13163  const PixelInterpolateMethod method)
13164 {
13165  Image
13166  *wave_image;
13167 
13168  assert(wand != (MagickWand *) NULL);
13169  assert(wand->signature == MagickWandSignature);
13170  if (wand->debug != MagickFalse)
13171  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13172  if (wand->images == (Image *) NULL)
13173  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13174  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
13175  wand->exception);
13176  if (wave_image == (Image *) NULL)
13177  return(MagickFalse);
13178  ReplaceImageInList(&wand->images,wave_image);
13179  return(MagickTrue);
13180 }
13181 ␌
13182 /*
13183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13184 % %
13185 % %
13186 % %
13187 % M a g i c k W a v e l e t D e n o i s e I m a g e %
13188 % %
13189 % %
13190 % %
13191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13192 %
13193 % MagickWaveletDenoiseImage() removes noise from the image using a wavelet
13194 % transform. The wavelet transform is a fast hierarchical scheme for
13195 % processing an image using a set of consecutive lowpass and high_pass filters,
13196 % followed by a decimation. This results in a decomposition into different
13197 % scales which can be regarded as different “frequency bands”, determined by
13198 % the mother wavelet.
13199 %
13200 % The format of the MagickWaveletDenoiseImage method is:
13201 %
13202 % MagickBooleanType MagickWaveletDenoiseImage(MagickWand *wand,
13203 % const double threshold,const double softness)
13204 %
13205 % A description of each parameter follows:
13206 %
13207 % o wand: the magick wand.
13208 %
13209 % o threshold: set the threshold for smoothing.
13210 %
13211 % o softness: attenuate the smoothing threshold.
13212 %
13213 */
13214 WandExport MagickBooleanType MagickWaveletDenoiseImage(MagickWand *wand,
13215  const double threshold,const double softness)
13216 {
13217  Image
13218  *noise_image;
13219 
13220  assert(wand != (MagickWand *) NULL);
13221  assert(wand->signature == MagickWandSignature);
13222  if (wand->debug != MagickFalse)
13223  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13224  if (wand->images == (Image *) NULL)
13225  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13226  noise_image=WaveletDenoiseImage(wand->images,threshold,softness,
13227  wand->exception);
13228  if (noise_image == (Image *) NULL)
13229  return(MagickFalse);
13230  ReplaceImageInList(&wand->images,noise_image);
13231  return(MagickTrue);
13232 }
13233 ␌
13234 /*
13235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13236 % %
13237 % %
13238 % %
13239 % M a g i c k W h i t e B a l a n c e I m a g e %
13240 % %
13241 % %
13242 % %
13243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13244 %
13245 % MagickWhiteBalanceImage() applies white balancing to an image according to
13246 % a grayworld assumption in the LAB colorspace.
13247 %
13248 % The format of the WhiteBalanceImage method is:
13249 %
13250 % MagickBooleanType MagickWhiteBalanceImage(MagickWand *wand)
13251 %
13252 % A description of each parameter follows:
13253 %
13254 % o wand: the magick wand.
13255 %
13256 */
13257 WandExport MagickBooleanType MagickWhiteBalanceImage(MagickWand *wand)
13258 {
13259  MagickBooleanType
13260  status;
13261 
13262  assert(wand != (MagickWand *) NULL);
13263  assert(wand->signature == MagickWandSignature);
13264  if (wand->debug != MagickFalse)
13265  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13266  if (wand->images == (Image *) NULL)
13267  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13268  status=WhiteBalanceImage(wand->images, wand->exception);
13269  return(status);
13270 }
13271 ␌
13272 /*
13273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13274 % %
13275 % %
13276 % %
13277 % M a g i c k W h i t e T h r e s h o l d I m a g e %
13278 % %
13279 % %
13280 % %
13281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13282 %
13283 % MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
13284 % above the threshold into white while leaving all pixels below the threshold
13285 % unchanged.
13286 %
13287 % The format of the MagickWhiteThresholdImage method is:
13288 %
13289 % MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13290 % const PixelWand *threshold)
13291 %
13292 % A description of each parameter follows:
13293 %
13294 % o wand: the magick wand.
13295 %
13296 % o threshold: the pixel wand.
13297 %
13298 */
13299 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13300  const PixelWand *threshold)
13301 {
13302  char
13303  thresholds[MagickPathExtent];
13304 
13305  assert(wand != (MagickWand *) NULL);
13306  assert(wand->signature == MagickWandSignature);
13307  if (wand->debug != MagickFalse)
13308  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13309  if (wand->images == (Image *) NULL)
13310  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13311  (void) FormatLocaleString(thresholds,MagickPathExtent,
13312  "%g" "," "%g" "," "%g" "," "%g",
13313  (double) PixelGetRedQuantum(threshold),
13314  (double) PixelGetGreenQuantum(threshold),
13315  (double) PixelGetBlueQuantum(threshold),
13316  (double) PixelGetAlphaQuantum(threshold));
13317  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
13318 }
13319 ␌
13320 /*
13321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13322 % %
13323 % %
13324 % %
13325 % M a g i c k W r i t e I m a g e %
13326 % %
13327 % %
13328 % %
13329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13330 %
13331 % MagickWriteImage() writes an image to the specified filename. If the
13332 % filename parameter is NULL, the image is written to the filename set
13333 % by MagickReadImage() or MagickSetImageFilename().
13334 %
13335 % The format of the MagickWriteImage method is:
13336 %
13337 % MagickBooleanType MagickWriteImage(MagickWand *wand,
13338 % const char *filename)
13339 %
13340 % A description of each parameter follows:
13341 %
13342 % o wand: the magick wand.
13343 %
13344 % o filename: the image filename.
13345 %
13346 %
13347 */
13348 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
13349  const char *filename)
13350 {
13351  Image
13352  *image;
13353 
13354  ImageInfo
13355  *write_info;
13356 
13357  MagickBooleanType
13358  status;
13359 
13360  assert(wand != (MagickWand *) NULL);
13361  assert(wand->signature == MagickWandSignature);
13362  if (wand->debug != MagickFalse)
13363  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13364  if (wand->images == (Image *) NULL)
13365  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13366  if (filename != (const char *) NULL)
13367  (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
13368  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13369  if (image == (Image *) NULL)
13370  return(MagickFalse);
13371  write_info=CloneImageInfo(wand->image_info);
13372  write_info->adjoin=MagickTrue;
13373  status=WriteImage(write_info,image,wand->exception);
13374  image=DestroyImage(image);
13375  write_info=DestroyImageInfo(write_info);
13376  return(status);
13377 }
13378 ␌
13379 /*
13380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13381 % %
13382 % %
13383 % %
13384 % M a g i c k W r i t e I m a g e F i l e %
13385 % %
13386 % %
13387 % %
13388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13389 %
13390 % MagickWriteImageFile() writes an image to an open file descriptor.
13391 %
13392 % The format of the MagickWriteImageFile method is:
13393 %
13394 % MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13395 %
13396 % A description of each parameter follows:
13397 %
13398 % o wand: the magick wand.
13399 %
13400 % o file: the file descriptor.
13401 %
13402 */
13403 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13404 {
13405  Image
13406  *image;
13407 
13408  ImageInfo
13409  *write_info;
13410 
13411  MagickBooleanType
13412  status;
13413 
13414  assert(wand != (MagickWand *) NULL);
13415  assert(wand->signature == MagickWandSignature);
13416  assert(file != (FILE *) NULL);
13417  if (wand->debug != MagickFalse)
13418  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13419  if (wand->images == (Image *) NULL)
13420  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13421  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13422  if (image == (Image *) NULL)
13423  return(MagickFalse);
13424  write_info=CloneImageInfo(wand->image_info);
13425  SetImageInfoFile(write_info,file);
13426  write_info->adjoin=MagickTrue;
13427  status=WriteImage(write_info,image,wand->exception);
13428  write_info=DestroyImageInfo(write_info);
13429  image=DestroyImage(image);
13430  return(status);
13431 }
13432 ␌
13433 /*
13434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13435 % %
13436 % %
13437 % %
13438 % M a g i c k W r i t e I m a g e s %
13439 % %
13440 % %
13441 % %
13442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13443 %
13444 % MagickWriteImages() writes an image or image sequence.
13445 %
13446 % The format of the MagickWriteImages method is:
13447 %
13448 % MagickBooleanType MagickWriteImages(MagickWand *wand,
13449 % const char *filename,const MagickBooleanType adjoin)
13450 %
13451 % A description of each parameter follows:
13452 %
13453 % o wand: the magick wand.
13454 %
13455 % o filename: the image filename.
13456 %
13457 % o adjoin: join images into a single multi-image file.
13458 %
13459 */
13460 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
13461  const char *filename,const MagickBooleanType adjoin)
13462 {
13463  ImageInfo
13464  *write_info;
13465 
13466  MagickBooleanType
13467  status;
13468 
13469  assert(wand != (MagickWand *) NULL);
13470  assert(wand->signature == MagickWandSignature);
13471  if (wand->debug != MagickFalse)
13472  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13473  if (wand->images == (Image *) NULL)
13474  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13475  write_info=CloneImageInfo(wand->image_info);
13476  write_info->adjoin=adjoin;
13477  status=WriteImages(write_info,wand->images,filename,wand->exception);
13478  write_info=DestroyImageInfo(write_info);
13479  return(status);
13480 }
13481 ␌
13482 /*
13483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13484 % %
13485 % %
13486 % %
13487 % M a g i c k W r i t e I m a g e s F i l e %
13488 % %
13489 % %
13490 % %
13491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13492 %
13493 % MagickWriteImagesFile() writes an image sequence to an open file descriptor.
13494 %
13495 % The format of the MagickWriteImagesFile method is:
13496 %
13497 % MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13498 %
13499 % A description of each parameter follows:
13500 %
13501 % o wand: the magick wand.
13502 %
13503 % o file: the file descriptor.
13504 %
13505 */
13506 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13507 {
13508  ImageInfo
13509  *write_info;
13510 
13511  MagickBooleanType
13512  status;
13513 
13514  assert(wand != (MagickWand *) NULL);
13515  assert(wand->signature == MagickWandSignature);
13516  if (wand->debug != MagickFalse)
13517  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13518  if (wand->images == (Image *) NULL)
13519  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13520  write_info=CloneImageInfo(wand->image_info);
13521  SetImageInfoFile(write_info,file);
13522  write_info->adjoin=MagickTrue;
13523  status=WriteImages(write_info,wand->images,(const char *) NULL,
13524  wand->exception);
13525  write_info=DestroyImageInfo(write_info);
13526  return(status);
13527 }