MagickWand  7.1.1-43
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/script/license.php %
33 % %
34 % Unless required by applicable law or agreed to in writing, software %
35 % distributed under the License is distributed on an "AS IS" BASIS, %
36 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
37 % See the License for the specific language governing permissions and %
38 % limitations under the License. %
39 % %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 
46 /*
47  Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.h"
54 #include "MagickCore/image-private.h"
55 
56 /*
57  Define declarations.
58 */
59 #define MagickWandId "MagickWand"
60 
61 /*
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 % %
64 % %
65 % %
66 + C l o n e M a g i c k W a n d F r o m I m a g e s %
67 % %
68 % %
69 % %
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %
72 % CloneMagickWandFromImages() clones the magick wand and inserts a new image
73 % list.
74 %
75 % The format of the CloneMagickWandFromImages method is:
76 %
77 % MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
78 % Image *images)
79 %
80 % A description of each parameter follows:
81 %
82 % o wand: the magick wand.
83 %
84 % o images: replace the image list with these image(s).
85 %
86 */
87 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88  Image *images)
89 {
91  *clone_wand;
92 
93  assert(wand != (MagickWand *) NULL);
94  assert(wand->signature == MagickWandSignature);
95  if (wand->debug != MagickFalse)
96  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
97  clone_wand=(MagickWand *) AcquireCriticalMemory(sizeof(*clone_wand));
98  (void) memset(clone_wand,0,sizeof(*clone_wand));
99  clone_wand->id=AcquireWandId();
100  (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
101  MagickWandId,(double) clone_wand->id);
102  clone_wand->exception=AcquireExceptionInfo();
103  InheritException(clone_wand->exception,wand->exception);
104  clone_wand->image_info=CloneImageInfo(wand->image_info);
105  clone_wand->images=images;
106  clone_wand->debug=IsEventLogging();
107  clone_wand->signature=MagickWandSignature;
108  if (clone_wand->debug != MagickFalse)
109  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
110  return(clone_wand);
111 }
112 
113 /*
114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115 % %
116 % %
117 % %
118 % G e t I m a g e F r o m M a g i c k W a n d %
119 % %
120 % %
121 % %
122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 %
124 % GetImageFromMagickWand() returns the current image from the magick wand.
125 %
126 % The format of the GetImageFromMagickWand method is:
127 %
128 % Image *GetImageFromMagickWand(const MagickWand *wand)
129 %
130 % A description of each parameter follows:
131 %
132 % o wand: the magick wand.
133 %
134 */
135 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
136 {
137  assert(wand != (MagickWand *) NULL);
138  assert(wand->signature == MagickWandSignature);
139  if (wand->debug != MagickFalse)
140  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
141  if (wand->images == (Image *) NULL)
142  {
143  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
144  "ContainsNoImages","`%s'",wand->name);
145  return((Image *) NULL);
146  }
147  return(wand->images);
148 }
149 
150 /*
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 % %
153 % %
154 % %
155 % M a g i c k A d a p t i v e B l u r I m a g e %
156 % %
157 % %
158 % %
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160 %
161 % MagickAdaptiveBlurImage() adaptively blurs the image by blurring
162 % less intensely near image edges and more intensely far from edges. We
163 % blur the image with a Gaussian operator of the given radius and standard
164 % deviation (sigma). For reasonable results, radius should be larger than
165 % sigma. Use a radius of 0 and MagickAdaptiveBlurImage() selects a
166 % suitable radius for you.
167 %
168 % The format of the MagickAdaptiveBlurImage method is:
169 %
170 % MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
171 % const double radius,const double sigma)
172 %
173 % A description of each parameter follows:
174 %
175 % o wand: the magick wand.
176 %
177 % o radius: the radius of the Gaussian, in pixels, not counting the center
178 % pixel.
179 %
180 % o sigma: the standard deviation of the Gaussian, in pixels.
181 %
182 */
183 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
184  const double radius,const double sigma)
185 {
186  Image
187  *sharp_image;
188 
189  assert(wand != (MagickWand *) NULL);
190  assert(wand->signature == MagickWandSignature);
191  if (wand->debug != MagickFalse)
192  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
193  if (wand->images == (Image *) NULL)
194  ThrowWandException(WandError,"ContainsNoImages",wand->name);
195  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
196  if (sharp_image == (Image *) NULL)
197  return(MagickFalse);
198  ReplaceImageInList(&wand->images,sharp_image);
199  return(MagickTrue);
200 }
201 
202 /*
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204 % %
205 % %
206 % %
207 % M a g i c k A d a p t i v e R e s i z e I m a g e %
208 % %
209 % %
210 % %
211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
212 %
213 % MagickAdaptiveResizeImage() adaptively resize image with data dependent
214 % triangulation.
215 %
216 % MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
217 % const size_t columns,const size_t rows)
218 %
219 % A description of each parameter follows:
220 %
221 % o wand: the magick wand.
222 %
223 % o columns: the number of columns in the scaled image.
224 %
225 % o rows: the number of rows in the scaled image.
226 %
227 */
228 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
229  const size_t columns,const size_t rows)
230 {
231  Image
232  *resize_image;
233 
234  assert(wand != (MagickWand *) NULL);
235  assert(wand->signature == MagickWandSignature);
236  if (wand->debug != MagickFalse)
237  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
238  if (wand->images == (Image *) NULL)
239  ThrowWandException(WandError,"ContainsNoImages",wand->name);
240  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
241  if (resize_image == (Image *) NULL)
242  return(MagickFalse);
243  ReplaceImageInList(&wand->images,resize_image);
244  return(MagickTrue);
245 }
246 
247 /*
248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
249 % %
250 % %
251 % %
252 % M a g i c k A d a p t i v e S h a r p e n I m a g e %
253 % %
254 % %
255 % %
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257 %
258 % MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
259 % more intensely near image edges and less intensely far from edges. We
260 % sharpen the image with a Gaussian operator of the given radius and standard
261 % deviation (sigma). For reasonable results, radius should be larger than
262 % sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
263 % suitable radius for you.
264 %
265 % The format of the MagickAdaptiveSharpenImage method is:
266 %
267 % MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
268 % const double radius,const double sigma)
269 %
270 % A description of each parameter follows:
271 %
272 % o wand: the magick wand.
273 %
274 % o radius: the radius of the Gaussian, in pixels, not counting the center
275 % pixel.
276 %
277 % o sigma: the standard deviation of the Gaussian, in pixels.
278 %
279 */
280 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
281  const double radius,const double sigma)
282 {
283  Image
284  *sharp_image;
285 
286  assert(wand != (MagickWand *) NULL);
287  assert(wand->signature == MagickWandSignature);
288  if (wand->debug != MagickFalse)
289  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
290  if (wand->images == (Image *) NULL)
291  ThrowWandException(WandError,"ContainsNoImages",wand->name);
292  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
293  if (sharp_image == (Image *) NULL)
294  return(MagickFalse);
295  ReplaceImageInList(&wand->images,sharp_image);
296  return(MagickTrue);
297 }
298 
299 /*
300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
301 % %
302 % %
303 % %
304 % M a g i c k A d a p t i v e T h r e s h o l d I m a g e %
305 % %
306 % %
307 % %
308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309 %
310 % MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
311 % based on the range of intensity values in its local neighborhood. This
312 % allows for thresholding of an image whose global intensity histogram
313 % doesn't contain distinctive peaks.
314 %
315 % The format of the AdaptiveThresholdImage method is:
316 %
317 % MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
318 % const size_t width,const size_t height,const double bias)
319 %
320 % A description of each parameter follows:
321 %
322 % o wand: the magick wand.
323 %
324 % o width: the width of the local neighborhood.
325 %
326 % o height: the height of the local neighborhood.
327 %
328 % o offset: the mean bias.
329 %
330 */
331 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
332  const size_t width,const size_t height,const double bias)
333 {
334  Image
335  *threshold_image;
336 
337  assert(wand != (MagickWand *) NULL);
338  assert(wand->signature == MagickWandSignature);
339  if (wand->debug != MagickFalse)
340  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
341  if (wand->images == (Image *) NULL)
342  ThrowWandException(WandError,"ContainsNoImages",wand->name);
343  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
344  wand->exception);
345  if (threshold_image == (Image *) NULL)
346  return(MagickFalse);
347  ReplaceImageInList(&wand->images,threshold_image);
348  return(MagickTrue);
349 }
350 
351 /*
352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
353 % %
354 % %
355 % %
356 % M a g i c k A d d I m a g e %
357 % %
358 % %
359 % %
360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361 %
362 % MagickAddImage() adds a clone of the images from the second wand and
363 % inserts them into the first wand.
364 %
365 % Use MagickSetLastIterator(), to append new images into an existing wand,
366 % current image will be set to last image so later adds with also be
367 % appended to end of wand.
368 %
369 % Use MagickSetFirstIterator() to prepend new images into wand, any more
370 % images added will also be prepended before other images in the wand.
371 % However the order of a list of new images will not change.
372 %
373 % Otherwise the new images will be inserted just after the current image,
374 % and any later image will also be added after this current image but
375 % before the previously added images. Caution is advised when multiple
376 % image adds are inserted into the middle of the wand image list.
377 %
378 % The format of the MagickAddImage method is:
379 %
380 % MagickBooleanType MagickAddImage(MagickWand *wand,
381 % const MagickWand *add_wand)
382 %
383 % A description of each parameter follows:
384 %
385 % o wand: the magick wand.
386 %
387 % o add_wand: A wand that contains the image list to be added
388 %
389 */
390 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
391  Image *images)
392 {
393  if (wand->images == (Image *) NULL)
394  {
395  /*
396  No images in wand, just add them, set current as appropriate.
397  */
398  if (wand->insert_before != MagickFalse)
399  wand->images=GetFirstImageInList(images);
400  else
401  wand->images=GetLastImageInList(images);
402  return(MagickTrue);
403  }
404  if ((wand->insert_before != MagickFalse) &&
405  (wand->images->previous == (Image *) NULL))
406  {
407  /*
408  User jumped to first image, so prepend new images - remain active.
409  */
410  PrependImageToList(&wand->images,images);
411  wand->images=GetFirstImageInList(images);
412  return(MagickTrue);
413  }
414  /*
415  Note you should never have 'insert_before' true when current image is not
416  the first image in the wand! That is no insert before current image, only
417  after current image.
418  */
419  if (wand->images->next == (Image *) NULL)
420  {
421  /*
422  At last image, append new images.
423  */
424  InsertImageInList(&wand->images,images);
425  wand->images=GetLastImageInList(images);
426  return(MagickTrue);
427  }
428  /*
429  Insert new images, just after the current image.
430  */
431  InsertImageInList(&wand->images,images);
432  return(MagickTrue);
433 }
434 
435 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
436  const MagickWand *add_wand)
437 {
438  Image
439  *images;
440 
441  assert(wand != (MagickWand *) NULL);
442  assert(wand->signature == MagickWandSignature);
443  if (wand->debug != MagickFalse)
444  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
445  assert(add_wand != (MagickWand *) NULL);
446  assert(add_wand->signature == MagickWandSignature);
447  if (add_wand->images == (Image *) NULL)
448  ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
449  /*
450  Clone images in second wand, and insert into first.
451  */
452  images=CloneImageList(add_wand->images,wand->exception);
453  if (images == (Image *) NULL)
454  return(MagickFalse);
455  return(InsertImageInWand(wand,images));
456 }
457 
458 /*
459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
460 % %
461 % %
462 % %
463 % M a g i c k A d d N o i s e I m a g e %
464 % %
465 % %
466 % %
467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
468 %
469 % MagickAddNoiseImage() adds random noise to the image.
470 %
471 % The format of the MagickAddNoiseImage method is:
472 %
473 % MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
474 % const NoiseType noise_type,const double attenuate)
475 %
476 % A description of each parameter follows:
477 %
478 % o wand: the magick wand.
479 %
480 % o noise_type: The type of noise: Uniform, Gaussian, Multiplicative,
481 % Impulse, Laplacian, or Poisson.
482 %
483 % o attenuate: attenuate the random distribution.
484 %
485 */
486 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
487  const NoiseType noise_type,const double attenuate)
488 {
489  Image
490  *noise_image;
491 
492  assert(wand != (MagickWand *) NULL);
493  assert(wand->signature == MagickWandSignature);
494  if (wand->debug != MagickFalse)
495  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
496  if (wand->images == (Image *) NULL)
497  ThrowWandException(WandError,"ContainsNoImages",wand->name);
498  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
499  if (noise_image == (Image *) NULL)
500  return(MagickFalse);
501  ReplaceImageInList(&wand->images,noise_image);
502  return(MagickTrue);
503 }
504 
505 /*
506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507 % %
508 % %
509 % %
510 % 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 %
511 % %
512 % %
513 % %
514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
515 %
516 % MagickAffineTransformImage() transforms an image as dictated by the affine
517 % matrix of the drawing wand.
518 %
519 % The format of the MagickAffineTransformImage method is:
520 %
521 % MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
522 % const DrawingWand *drawing_wand)
523 %
524 % A description of each parameter follows:
525 %
526 % o wand: the magick wand.
527 %
528 % o drawing_wand: the draw wand.
529 %
530 */
531 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
532  const DrawingWand *drawing_wand)
533 {
534  DrawInfo
535  *draw_info;
536 
537  Image
538  *affine_image;
539 
540  assert(wand != (MagickWand *) NULL);
541  assert(wand->signature == MagickWandSignature);
542  if (wand->debug != MagickFalse)
543  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
544  if (wand->images == (Image *) NULL)
545  ThrowWandException(WandError,"ContainsNoImages",wand->name);
546  draw_info=PeekDrawingWand(drawing_wand);
547  if (draw_info == (DrawInfo *) NULL)
548  return(MagickFalse);
549  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
550  wand->exception);
551  draw_info=DestroyDrawInfo(draw_info);
552  if (affine_image == (Image *) NULL)
553  return(MagickFalse);
554  ReplaceImageInList(&wand->images,affine_image);
555  return(MagickTrue);
556 }
557 
558 /*
559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
560 % %
561 % %
562 % %
563 % M a g i c k A n n o t a t e I m a g e %
564 % %
565 % %
566 % %
567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
568 %
569 % MagickAnnotateImage() annotates an image with text.
570 %
571 % The format of the MagickAnnotateImage method is:
572 %
573 % MagickBooleanType MagickAnnotateImage(MagickWand *wand,
574 % const DrawingWand *drawing_wand,const double x,const double y,
575 % const double angle,const char *text)
576 %
577 % A description of each parameter follows:
578 %
579 % o wand: the magick wand.
580 %
581 % o drawing_wand: the draw wand.
582 %
583 % o x: x ordinate to left of text
584 %
585 % o y: y ordinate to text baseline
586 %
587 % o angle: rotate text relative to this angle.
588 %
589 % o text: text to draw
590 %
591 */
592 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
593  const DrawingWand *drawing_wand,const double x,const double y,
594  const double angle,const char *text)
595 {
596  char
597  geometry[MagickPathExtent];
598 
599  DrawInfo
600  *draw_info;
601 
602  MagickBooleanType
603  status;
604 
605  assert(wand != (MagickWand *) NULL);
606  assert(wand->signature == MagickWandSignature);
607  if (wand->debug != MagickFalse)
608  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
609  if (wand->images == (Image *) NULL)
610  ThrowWandException(WandError,"ContainsNoImages",wand->name);
611  draw_info=PeekDrawingWand(drawing_wand);
612  if (draw_info == (DrawInfo *) NULL)
613  return(MagickFalse);
614  (void) CloneString(&draw_info->text,text);
615  (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
616  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
617  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
618  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
619  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
620  (void) CloneString(&draw_info->geometry,geometry);
621  status=AnnotateImage(wand->images,draw_info,wand->exception);
622  draw_info=DestroyDrawInfo(draw_info);
623  return(status);
624 }
625 
626 /*
627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
628 % %
629 % %
630 % %
631 % M a g i c k A n i m a t e I m a g e s %
632 % %
633 % %
634 % %
635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
636 %
637 % MagickAnimateImages() animates an image or image sequence.
638 %
639 % The format of the MagickAnimateImages method is:
640 %
641 % MagickBooleanType MagickAnimateImages(MagickWand *wand,
642 % const char *server_name)
643 %
644 % A description of each parameter follows:
645 %
646 % o wand: the magick wand.
647 %
648 % o server_name: the X server name.
649 %
650 */
651 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
652  const char *server_name)
653 {
654  MagickBooleanType
655  status;
656 
657  assert(wand != (MagickWand *) NULL);
658  assert(wand->signature == MagickWandSignature);
659  if (wand->debug != MagickFalse)
660  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
661  (void) CloneString(&wand->image_info->server_name,server_name);
662  status=AnimateImages(wand->image_info,wand->images,wand->exception);
663  return(status);
664 }
665 
666 /*
667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
668 % %
669 % %
670 % %
671 % M a g i c k A p p e n d I m a g e s %
672 % %
673 % %
674 % %
675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
676 %
677 % MagickAppendImages() append the images in a wand from the current image
678 % onwards, creating a new wand with the single image result. This is
679 % affected by the gravity and background settings of the first image.
680 %
681 % Typically you would call either MagickResetIterator() or
682 % MagickSetFirstImage() before calling this function to ensure that all
683 % the images in the wand's image list will be appended together.
684 %
685 % The format of the MagickAppendImages method is:
686 %
687 % MagickWand *MagickAppendImages(MagickWand *wand,
688 % const MagickBooleanType stack)
689 %
690 % A description of each parameter follows:
691 %
692 % o wand: the magick wand.
693 %
694 % o stack: By default, images are stacked left-to-right. Set stack to
695 % MagickTrue to stack them top-to-bottom.
696 %
697 */
698 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
699  const MagickBooleanType stack)
700 {
701  Image
702  *append_image;
703 
704  assert(wand != (MagickWand *) NULL);
705  assert(wand->signature == MagickWandSignature);
706  if (wand->debug != MagickFalse)
707  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
708  if (wand->images == (Image *) NULL)
709  return((MagickWand *) NULL);
710  append_image=AppendImages(wand->images,stack,wand->exception);
711  if (append_image == (Image *) NULL)
712  return((MagickWand *) NULL);
713  return(CloneMagickWandFromImages(wand,append_image));
714 }
715 
716 /*
717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
718 % %
719 % %
720 % %
721 % M a g i c k A u t o G a m m a I m a g e %
722 % %
723 % %
724 % %
725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
726 %
727 % MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
728 % image to try make set its gamma appropriately.
729 %
730 % The format of the MagickAutoGammaImage method is:
731 %
732 % MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
733 %
734 % A description of each parameter follows:
735 %
736 % o wand: the magick wand.
737 %
738 */
739 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
740 {
741  MagickBooleanType
742  status;
743 
744  assert(wand != (MagickWand *) NULL);
745  assert(wand->signature == MagickWandSignature);
746  if (wand->debug != MagickFalse)
747  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
748  if (wand->images == (Image *) NULL)
749  ThrowWandException(WandError,"ContainsNoImages",wand->name);
750  status=AutoGammaImage(wand->images,wand->exception);
751  return(status);
752 }
753 
754 /*
755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
756 % %
757 % %
758 % %
759 % M a g i c k A u t o L e v e l I m a g e %
760 % %
761 % %
762 % %
763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
764 %
765 % MagickAutoLevelImage() adjusts the levels of a particular image channel by
766 % scaling the minimum and maximum values to the full quantum range.
767 %
768 % The format of the MagickAutoLevelImage method is:
769 %
770 % MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
771 %
772 % A description of each parameter follows:
773 %
774 % o wand: the magick wand.
775 %
776 */
777 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
778 {
779  MagickBooleanType
780  status;
781 
782  assert(wand != (MagickWand *) NULL);
783  assert(wand->signature == MagickWandSignature);
784  if (wand->debug != MagickFalse)
785  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
786  if (wand->images == (Image *) NULL)
787  ThrowWandException(WandError,"ContainsNoImages",wand->name);
788  status=AutoLevelImage(wand->images,wand->exception);
789  return(status);
790 }
791 
792 /*
793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
794 % %
795 % %
796 % %
797 % M a g i c k A u t o O r i e n t I m a g e %
798 % %
799 % %
800 % %
801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
802 %
803 % MagickAutoOrientImage() adjusts an image so that its orientation is suitable
804 $ for viewing (i.e. top-left orientation).
805 %
806 % The format of the MagickAutoOrientImage method is:
807 %
808 % MagickBooleanType MagickAutoOrientImage(MagickWand *image)
809 %
810 % A description of each parameter follows:
811 %
812 % o wand: the magick wand.
813 %
814 */
815 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
816 {
817 
818  Image
819  *orient_image;
820 
821  assert(wand != (MagickWand *) NULL);
822  assert(wand->signature == MagickWandSignature);
823  if (wand->debug != MagickFalse)
824  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
825  if (wand->images == (Image *) NULL)
826  ThrowWandException(WandError,"ContainsNoImages",wand->name);
827  orient_image=AutoOrientImage(wand->images,wand->images->orientation,
828  wand->exception);
829  if (orient_image == (Image *) NULL)
830  return(MagickFalse);
831  ReplaceImageInList(&wand->images,orient_image);
832  return(MagickTrue);
833 }
834 
835 /*
836 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
837 % %
838 % %
839 % %
840 % M a g i c k A u t o T h r e s h o l d I m a g e %
841 % %
842 % %
843 % %
844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
845 %
846 % MagickAutoThresholdImage() automatically performs image thresholding
847 % dependent on which method you specify.
848 %
849 % The format of the AutoThresholdImage method is:
850 %
851 % MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
852 % const AutoThresholdMethod method)
853 %
854 % A description of each parameter follows:
855 %
856 % o wand: the magick wand.
857 %
858 % o method: choose from KapurThresholdMethod, OTSUThresholdMethod, or
859 % TriangleThresholdMethod.
860 %
861 */
862 WandExport MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
863  const AutoThresholdMethod method)
864 {
865  assert(wand != (MagickWand *) NULL);
866  assert(wand->signature == MagickWandSignature);
867  if (wand->debug != MagickFalse)
868  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
869  if (wand->images == (Image *) NULL)
870  ThrowWandException(WandError,"ContainsNoImages",wand->name);
871  return(AutoThresholdImage(wand->images,method,wand->exception));
872 }
873 
874 /*
875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
876 % %
877 % %
878 % %
879 % M a g i c k B i l a t e r a l B l u r I m a g e %
880 % %
881 % %
882 % %
883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
884 %
885 % MagickBilateralBlurImage() is a non-linear, edge-preserving, and
886 % noise-reducing smoothing filter for images. It replaces the intensity of
887 % each pixel with a weighted average of intensity values from nearby pixels.
888 % This weight is based on a Gaussian distribution. The weights depend not
889 % only on Euclidean distance of pixels, but also on the radiometric
890 % differences (e.g., range differences, such as color intensity, depth
891 % distance, etc.). This preserves sharp edges.
892 %
893 % The format of the MagickBilateralBlurImage method is:
894 %
895 % MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
896 % const double radius,const double sigma,const double intensity_sigma,
897 % const double spatial_sigma)
898 %
899 % A description of each parameter follows:
900 %
901 % o wand: the magick wand.
902 %
903 % o radius: the radius of the Gaussian, in pixels, not counting the center
904 % pixel.
905 %
906 % o sigma: the standard deviation of the , in pixels.
907 %
908 % o intensity_sigma: sigma in the intensity space. A larger value means
909 % that farther colors within the pixel neighborhood (see spatial_sigma)
910 % will be mixed together, resulting in larger areas of semi-equal color.
911 %
912 % o spatial_sigma: sigma in the coordinate space. A larger value means that
913 % farther pixels influence each other as long as their colors are close
914 % enough (see intensity_sigma ). When the neighborhood diameter is greater
915 % than zero, it specifies the neighborhood size regardless of
916 % spatial_sigma. Otherwise, the neighborhood diameter is proportional to
917 % spatial_sigma.
918 %
919 */
920 WandExport MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
921  const double radius,const double sigma,const double intensity_sigma,
922  const double spatial_sigma)
923 {
924  Image
925  *blur_image;
926 
927  assert(wand != (MagickWand *) NULL);
928  assert(wand->signature == MagickWandSignature);
929  if (wand->debug != MagickFalse)
930  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
931  if (wand->images == (Image *) NULL)
932  ThrowWandException(WandError,"ContainsNoImages",wand->name);
933  blur_image=BilateralBlurImage(wand->images,radius,sigma,intensity_sigma,
934  spatial_sigma,wand->exception);
935  if (blur_image == (Image *) NULL)
936  return(MagickFalse);
937  ReplaceImageInList(&wand->images,blur_image);
938  return(MagickTrue);
939 }
940 
941 /*
942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
943 % %
944 % %
945 % %
946 % 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 %
947 % %
948 % %
949 % %
950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
951 %
952 % MagickBlackThresholdImage() is like MagickThresholdImage() but forces all
953 % pixels below the threshold into black while leaving all pixels above the
954 % threshold unchanged.
955 %
956 % The format of the MagickBlackThresholdImage method is:
957 %
958 % MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
959 % const PixelWand *threshold)
960 %
961 % A description of each parameter follows:
962 %
963 % o wand: the magick wand.
964 %
965 % o threshold: the pixel wand.
966 %
967 */
968 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
969  const PixelWand *threshold)
970 {
971  char
972  thresholds[MagickPathExtent];
973 
974  assert(wand != (MagickWand *) NULL);
975  assert(wand->signature == MagickWandSignature);
976  if (wand->debug != MagickFalse)
977  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
978  if (wand->images == (Image *) NULL)
979  ThrowWandException(WandError,"ContainsNoImages",wand->name);
980  (void) FormatLocaleString(thresholds,MagickPathExtent,
981  "%g" "," "%g" "," "%g" "," "%g",
982  (double) PixelGetRedQuantum(threshold),
983  (double) PixelGetGreenQuantum(threshold),
984  (double) PixelGetBlueQuantum(threshold),
985  (double) PixelGetAlphaQuantum(threshold));
986  return(BlackThresholdImage(wand->images,thresholds,wand->exception));
987 }
988 
989 /*
990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991 % %
992 % %
993 % %
994 % M a g i c k B l u e S h i f t I m a g e %
995 % %
996 % %
997 % %
998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
999 %
1000 % MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
1001 % nighttime in the moonlight.
1002 %
1003 % The format of the MagickBlueShiftImage method is:
1004 %
1005 % MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
1006 % const double factor)
1007 %
1008 % A description of each parameter follows:
1009 %
1010 % o wand: the magick wand.
1011 %
1012 % o factor: the blue shift factor (default 1.5)
1013 %
1014 */
1015 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
1016  const double factor)
1017 {
1018  Image
1019  *shift_image;
1020 
1021  assert(wand != (MagickWand *) NULL);
1022  assert(wand->signature == MagickWandSignature);
1023  if (wand->debug != MagickFalse)
1024  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1025  if (wand->images == (Image *) NULL)
1026  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1027  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
1028  if (shift_image == (Image *) NULL)
1029  return(MagickFalse);
1030  ReplaceImageInList(&wand->images,shift_image);
1031  return(MagickTrue);
1032 }
1033 
1034 /*
1035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1036 % %
1037 % %
1038 % %
1039 % M a g i c k B l u r I m a g e %
1040 % %
1041 % %
1042 % %
1043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044 %
1045 % MagickBlurImage() blurs an image. We convolve the image with a
1046 % gaussian operator of the given radius and standard deviation (sigma).
1047 % For reasonable results, the radius should be larger than sigma. Use a
1048 % radius of 0 and BlurImage() selects a suitable radius for you.
1049 %
1050 % The format of the MagickBlurImage method is:
1051 %
1052 % MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
1053 % const double sigma)
1054 %
1055 % A description of each parameter follows:
1056 %
1057 % o wand: the magick wand.
1058 %
1059 % o radius: the radius of the Gaussian, in pixels, not counting the center
1060 % pixel.
1061 %
1062 % o sigma: the standard deviation of the , in pixels.
1063 %
1064 */
1065 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
1066  const double radius,const double sigma)
1067 {
1068  Image
1069  *blur_image;
1070 
1071  assert(wand != (MagickWand *) NULL);
1072  assert(wand->signature == MagickWandSignature);
1073  if (wand->debug != MagickFalse)
1074  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1075  if (wand->images == (Image *) NULL)
1076  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1077  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
1078  if (blur_image == (Image *) NULL)
1079  return(MagickFalse);
1080  ReplaceImageInList(&wand->images,blur_image);
1081  return(MagickTrue);
1082 }
1083 
1084 /*
1085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1086 % %
1087 % %
1088 % %
1089 % M a g i c k B o r d e r I m a g e %
1090 % %
1091 % %
1092 % %
1093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1094 %
1095 % MagickBorderImage() surrounds the image with a border of the color defined
1096 % by the bordercolor pixel wand.
1097 %
1098 % The format of the MagickBorderImage method is:
1099 %
1100 % MagickBooleanType MagickBorderImage(MagickWand *wand,
1101 % const PixelWand *bordercolor,const size_t width,
1102 % const size_t height,const CompositeOperator compose)
1103 %
1104 % A description of each parameter follows:
1105 %
1106 % o wand: the magick wand.
1107 %
1108 % o bordercolor: the border color pixel wand.
1109 %
1110 % o width: the border width.
1111 %
1112 % o height: the border height.
1113 %
1114 % o compose: the composite operator.
1115 %
1116 */
1117 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1118  const PixelWand *bordercolor,const size_t width,const size_t height,
1119  const CompositeOperator compose)
1120 {
1121  Image
1122  *border_image;
1123 
1124  RectangleInfo
1125  border_info;
1126 
1127  assert(wand != (MagickWand *) NULL);
1128  assert(wand->signature == MagickWandSignature);
1129  if (wand->debug != MagickFalse)
1130  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1131  if (wand->images == (Image *) NULL)
1132  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1133  border_info.width=width;
1134  border_info.height=height;
1135  border_info.x=0;
1136  border_info.y=0;
1137  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1138  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1139  if (border_image == (Image *) NULL)
1140  return(MagickFalse);
1141  ReplaceImageInList(&wand->images,border_image);
1142  return(MagickTrue);
1143 }
1144 
1145 /*
1146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1147 % %
1148 % %
1149 % %
1150 % 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 %
1151 % %
1152 % %
1153 % %
1154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1155 %
1156 % Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1157 % of an image. It converts the brightness and contrast parameters into slope
1158 % and intercept and calls a polynomial function to apply to the image.
1159 
1160 %
1161 % The format of the MagickBrightnessContrastImage method is:
1162 %
1163 % MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1164 % const double brightness,const double contrast)
1165 %
1166 % A description of each parameter follows:
1167 %
1168 % o wand: the magick wand.
1169 %
1170 % o brightness: the brightness percent (-100 .. 100).
1171 %
1172 % o contrast: the contrast percent (-100 .. 100).
1173 %
1174 */
1175 WandExport MagickBooleanType MagickBrightnessContrastImage(
1176  MagickWand *wand,const double brightness,const double contrast)
1177 {
1178  MagickBooleanType
1179  status;
1180 
1181  assert(wand != (MagickWand *) NULL);
1182  assert(wand->signature == MagickWandSignature);
1183  if (wand->debug != MagickFalse)
1184  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1185  if (wand->images == (Image *) NULL)
1186  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1187  status=BrightnessContrastImage(wand->images,brightness,contrast,
1188  wand->exception);
1189  return(status);
1190 }
1191 
1192 /*
1193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1194 % %
1195 % %
1196 % %
1197 % M a g i c k C a n n y E d g e I m a g e %
1198 % %
1199 % %
1200 % %
1201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1202 %
1203 % MagickCannyEdgeImage() uses a multi-stage algorithm to detect a wide range of
1204 % edges in images.
1205 %
1206 % The format of the MagickCannyEdgeImage method is:
1207 %
1208 % MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
1209 % const double radius,const double sigma,const double lower_percent,
1210 % const double upper_percent)
1211 %
1212 % A description of each parameter follows:
1213 %
1214 % o wand: the magick wand.
1215 %
1216 % o radius: the radius of the gaussian smoothing filter.
1217 %
1218 % o sigma: the sigma of the gaussian smoothing filter.
1219 %
1220 % o lower_percent: percentage of edge pixels in the lower threshold.
1221 %
1222 % o upper_percent: percentage of edge pixels in the upper threshold.
1223 %
1224 */
1225 WandExport MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
1226  const double radius,const double sigma,const double lower_percent,
1227  const double upper_percent)
1228 {
1229  Image
1230  *edge_image;
1231 
1232  assert(wand != (MagickWand *) NULL);
1233  assert(wand->signature == MagickWandSignature);
1234  if (wand->debug != MagickFalse)
1235  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1236  if (wand->images == (Image *) NULL)
1237  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1238  edge_image=CannyEdgeImage(wand->images,radius,sigma,lower_percent,
1239  upper_percent,wand->exception);
1240  if (edge_image == (Image *) NULL)
1241  return(MagickFalse);
1242  ReplaceImageInList(&wand->images,edge_image);
1243  return(MagickTrue);
1244 }
1245 
1246 /*
1247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1248 % %
1249 % %
1250 % %
1251 % M a g i c k C h a n n e l F x I m a g e %
1252 % %
1253 % %
1254 % %
1255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1256 %
1257 % MagickChannelFxImage() applies a channel expression to the specified image.
1258 % The expression consists of one or more channels, either mnemonic or numeric
1259 % (e.g. red, 1), separated by actions as follows:
1260 %
1261 % <=> exchange two channels (e.g. red<=>blue)
1262 % => transfer a channel to another (e.g. red=>green)
1263 % , separate channel operations (e.g. red, green)
1264 % | read channels from next input image (e.g. red | green)
1265 % ; write channels to next output image (e.g. red; green; blue)
1266 %
1267 % A channel without a operation symbol implies extract. For example, to create
1268 % 3 grayscale images from the red, green, and blue channels of an image, use:
1269 %
1270 % -channel-fx "red; green; blue"
1271 %
1272 % The format of the MagickChannelFxImage method is:
1273 %
1274 % MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1275 %
1276 % A description of each parameter follows:
1277 %
1278 % o wand: the magick wand.
1279 %
1280 % o expression: the expression.
1281 %
1282 */
1283 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1284  const char *expression)
1285 {
1286  Image
1287  *fx_image;
1288 
1289  assert(wand != (MagickWand *) NULL);
1290  assert(wand->signature == MagickWandSignature);
1291  if (wand->debug != MagickFalse)
1292  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1293  if (wand->images == (Image *) NULL)
1294  return((MagickWand *) NULL);
1295  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1296  if (fx_image == (Image *) NULL)
1297  return((MagickWand *) NULL);
1298  return(CloneMagickWandFromImages(wand,fx_image));
1299 }
1300 
1301 /*
1302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1303 % %
1304 % %
1305 % %
1306 % M a g i c k C h a r c o a l I m a g e %
1307 % %
1308 % %
1309 % %
1310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1311 %
1312 % MagickCharcoalImage() simulates a charcoal drawing.
1313 %
1314 % The format of the MagickCharcoalImage method is:
1315 %
1316 % MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1317 % const double radius,const double sigma)
1318 %
1319 % A description of each parameter follows:
1320 %
1321 % o wand: the magick wand.
1322 %
1323 % o radius: the radius of the Gaussian, in pixels, not counting the center
1324 % pixel.
1325 %
1326 % o sigma: the standard deviation of the Gaussian, in pixels.
1327 %
1328 */
1329 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1330  const double radius,const double sigma)
1331 {
1332  Image
1333  *charcoal_image;
1334 
1335  assert(wand != (MagickWand *) NULL);
1336  assert(wand->signature == MagickWandSignature);
1337  if (wand->debug != MagickFalse)
1338  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1339  if (wand->images == (Image *) NULL)
1340  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1341  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1342  if (charcoal_image == (Image *) NULL)
1343  return(MagickFalse);
1344  ReplaceImageInList(&wand->images,charcoal_image);
1345  return(MagickTrue);
1346 }
1347 
1348 /*
1349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1350 % %
1351 % %
1352 % %
1353 % M a g i c k C h o p I m a g e %
1354 % %
1355 % %
1356 % %
1357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1358 %
1359 % MagickChopImage() removes a region of an image and collapses the image to
1360 % occupy the removed portion
1361 %
1362 % The format of the MagickChopImage method is:
1363 %
1364 % MagickBooleanType MagickChopImage(MagickWand *wand,
1365 % const size_t width,const size_t height,const ssize_t x,
1366 % const ssize_t y)
1367 %
1368 % A description of each parameter follows:
1369 %
1370 % o wand: the magick wand.
1371 %
1372 % o width: the region width.
1373 %
1374 % o height: the region height.
1375 %
1376 % o x: the region x offset.
1377 %
1378 % o y: the region y offset.
1379 %
1380 %
1381 */
1382 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1383  const size_t width,const size_t height,const ssize_t x,
1384  const ssize_t y)
1385 {
1386  Image
1387  *chop_image;
1388 
1389  RectangleInfo
1390  chop;
1391 
1392  assert(wand != (MagickWand *) NULL);
1393  assert(wand->signature == MagickWandSignature);
1394  if (wand->debug != MagickFalse)
1395  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1396  if (wand->images == (Image *) NULL)
1397  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1398  chop.width=width;
1399  chop.height=height;
1400  chop.x=x;
1401  chop.y=y;
1402  chop_image=ChopImage(wand->images,&chop,wand->exception);
1403  if (chop_image == (Image *) NULL)
1404  return(MagickFalse);
1405  ReplaceImageInList(&wand->images,chop_image);
1406  return(MagickTrue);
1407 }
1408 
1409 /*
1410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1411 % %
1412 % %
1413 % %
1414 % M a g i c k C L A H E I m a g e %
1415 % %
1416 % %
1417 % %
1418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1419 %
1420 % MagickCLAHEImage() is a variant of adaptive histogram equalization in which
1421 % the contrast amplification is limited, so as to reduce this problem of noise
1422 % amplification.
1423 %
1424 % The format of the CLAHEImage method is:
1425 %
1426 % MagickBooleanType MagickCLAHEImage(MagickWand *wand,const size_t width,
1427 % const size_t height,const double number_bins,const double clip_limit)
1428 %
1429 % A description of each parameter follows:
1430 %
1431 % o wand: the magick wand.
1432 %
1433 % o width: the width of the tile divisions to use in horizontal direction.
1434 %
1435 % o height: the height of the tile divisions to use in vertical direction.
1436 %
1437 % o number_bins: number of bins for histogram ("dynamic range"). Although
1438 % parameter is currently a double, it is cast to size_t internally.
1439 %
1440 % o clip_limit: contrast limit for localised changes in contrast. A limit
1441 % less than 1 results in standard non-contrast limited AHE.
1442 %
1443 */
1444 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand,
1445  const size_t width,const size_t height,const double number_bins,
1446  const double clip_limit)
1447 {
1448  MagickBooleanType
1449  status;
1450 
1451  assert(wand != (MagickWand *) NULL);
1452  assert(wand->signature == MagickWandSignature);
1453  if (wand->debug != MagickFalse)
1454  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1455  if (wand->images == (Image *) NULL)
1456  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1457  status=CLAHEImage(wand->images,width,height,(size_t) number_bins,clip_limit,
1458  wand->exception);
1459  return(status);
1460 }
1461 
1462 /*
1463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1464 % %
1465 % %
1466 % %
1467 % M a g i c k C l a m p I m a g e %
1468 % %
1469 % %
1470 % %
1471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1472 %
1473 % MagickClampImage() restricts the color range from 0 to the quantum depth.
1474 %
1475 % The format of the MagickClampImage method is:
1476 %
1477 % MagickBooleanType MagickClampImage(MagickWand *wand)
1478 %
1479 % A description of each parameter follows:
1480 %
1481 % o wand: the magick wand.
1482 %
1483 % o channel: the channel.
1484 %
1485 */
1486 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1487 {
1488  assert(wand != (MagickWand *) NULL);
1489  assert(wand->signature == MagickWandSignature);
1490  if (wand->debug != MagickFalse)
1491  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1492  if (wand->images == (Image *) NULL)
1493  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1494  return(ClampImage(wand->images,wand->exception));
1495 }
1496 
1497 /*
1498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1499 % %
1500 % %
1501 % %
1502 % M a g i c k C l i p I m a g e %
1503 % %
1504 % %
1505 % %
1506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1507 %
1508 % MagickClipImage() clips along the first path from the 8BIM profile, if
1509 % present.
1510 %
1511 % The format of the MagickClipImage method is:
1512 %
1513 % MagickBooleanType MagickClipImage(MagickWand *wand)
1514 %
1515 % A description of each parameter follows:
1516 %
1517 % o wand: the magick wand.
1518 %
1519 */
1520 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1521 {
1522  MagickBooleanType
1523  status;
1524 
1525  assert(wand != (MagickWand *) NULL);
1526  assert(wand->signature == MagickWandSignature);
1527  if (wand->debug != MagickFalse)
1528  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1529  if (wand->images == (Image *) NULL)
1530  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1531  status=ClipImage(wand->images,wand->exception);
1532  return(status);
1533 }
1534 
1535 /*
1536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1537 % %
1538 % %
1539 % %
1540 % M a g i c k C l i p I m a g e P a t h %
1541 % %
1542 % %
1543 % %
1544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1545 %
1546 % MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1547 % present. Later operations take effect inside the path. Id may be a number
1548 % if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1549 % path.
1550 %
1551 % The format of the MagickClipImagePath method is:
1552 %
1553 % MagickBooleanType MagickClipImagePath(MagickWand *wand,
1554 % const char *pathname,const MagickBooleanType inside)
1555 %
1556 % A description of each parameter follows:
1557 %
1558 % o wand: the magick wand.
1559 %
1560 % o pathname: name of clipping path resource. If name is preceded by #, use
1561 % clipping path numbered by name.
1562 %
1563 % o inside: if non-zero, later operations take effect inside clipping path.
1564 % Otherwise later operations take effect outside clipping path.
1565 %
1566 */
1567 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1568  const char *pathname,const MagickBooleanType inside)
1569 {
1570  MagickBooleanType
1571  status;
1572 
1573  assert(wand != (MagickWand *) NULL);
1574  assert(wand->signature == MagickWandSignature);
1575  if (wand->debug != MagickFalse)
1576  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1577  if (wand->images == (Image *) NULL)
1578  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1579  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1580  return(status);
1581 }
1582 
1583 /*
1584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1585 % %
1586 % %
1587 % %
1588 % M a g i c k C l u t I m a g e %
1589 % %
1590 % %
1591 % %
1592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1593 %
1594 % MagickClutImage() replaces colors in the image from a color lookup table.
1595 %
1596 % The format of the MagickClutImage method is:
1597 %
1598 % MagickBooleanType MagickClutImage(MagickWand *wand,
1599 % const MagickWand *clut_wand,const PixelInterpolateMethod method)
1600 %
1601 % A description of each parameter follows:
1602 %
1603 % o wand: the magick wand.
1604 %
1605 % o clut_image: the clut image.
1606 %
1607 % o method: the pixel interpolation method.
1608 %
1609 */
1610 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1611  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1612 {
1613  MagickBooleanType
1614  status;
1615 
1616  assert(wand != (MagickWand *) NULL);
1617  assert(wand->signature == MagickWandSignature);
1618  if (wand->debug != MagickFalse)
1619  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1620  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1621  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1622  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1623  return(status);
1624 }
1625 
1626 /*
1627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1628 % %
1629 % %
1630 % %
1631 % M a g i c k C o a l e s c e I m a g e s %
1632 % %
1633 % %
1634 % %
1635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1636 %
1637 % MagickCoalesceImages() composites a set of images while respecting any page
1638 % offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1639 % typically start with an image background and each subsequent image
1640 % varies in size and offset. MagickCoalesceImages() returns a new sequence
1641 % where each image in the sequence is the same size as the first and
1642 % composited with the next image in the sequence.
1643 %
1644 % The format of the MagickCoalesceImages method is:
1645 %
1646 % MagickWand *MagickCoalesceImages(MagickWand *wand)
1647 %
1648 % A description of each parameter follows:
1649 %
1650 % o wand: the magick wand.
1651 %
1652 */
1653 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1654 {
1655  Image
1656  *coalesce_image;
1657 
1658  assert(wand != (MagickWand *) NULL);
1659  assert(wand->signature == MagickWandSignature);
1660  if (wand->debug != MagickFalse)
1661  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1662  if (wand->images == (Image *) NULL)
1663  return((MagickWand *) NULL);
1664  coalesce_image=CoalesceImages(wand->images,wand->exception);
1665  if (coalesce_image == (Image *) NULL)
1666  return((MagickWand *) NULL);
1667  return(CloneMagickWandFromImages(wand,coalesce_image));
1668 }
1669 
1670 /*
1671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1672 % %
1673 % %
1674 % %
1675 % M a g i c k C o l o r D e c i s i o n I m a g e %
1676 % %
1677 % %
1678 % %
1679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1680 %
1681 % MagickColorDecisionListImage() accepts a lightweight Color Correction
1682 % Collection (CCC) file which solely contains one or more color corrections
1683 % and applies the color correction to the image. Here is a sample CCC file:
1684 %
1685 % <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1686 % <ColorCorrection id="cc03345">
1687 % <SOPNode>
1688 % <Slope> 0.9 1.2 0.5 </Slope>
1689 % <Offset> 0.4 -0.5 0.6 </Offset>
1690 % <Power> 1.0 0.8 1.5 </Power>
1691 % </SOPNode>
1692 % <SATNode>
1693 % <Saturation> 0.85 </Saturation>
1694 % </SATNode>
1695 % </ColorCorrection>
1696 % </ColorCorrectionCollection>
1697 %
1698 % which includes the offset, slope, and power for each of the RGB channels
1699 % as well as the saturation.
1700 %
1701 % The format of the MagickColorDecisionListImage method is:
1702 %
1703 % MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1704 % const char *color_correction_collection)
1705 %
1706 % A description of each parameter follows:
1707 %
1708 % o wand: the magick wand.
1709 %
1710 % o color_correction_collection: the color correction collection in XML.
1711 %
1712 */
1713 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1714  const char *color_correction_collection)
1715 {
1716  MagickBooleanType
1717  status;
1718 
1719  assert(wand != (MagickWand *) NULL);
1720  assert(wand->signature == MagickWandSignature);
1721  if (wand->debug != MagickFalse)
1722  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1723  if (wand->images == (Image *) NULL)
1724  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1725  status=ColorDecisionListImage(wand->images,color_correction_collection,
1726  wand->exception);
1727  return(status);
1728 }
1729 
1730 /*
1731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1732 % %
1733 % %
1734 % %
1735 % M a g i c k C o l o r i z e I m a g e %
1736 % %
1737 % %
1738 % %
1739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1740 %
1741 % MagickColorizeImage() blends the fill color with each pixel in the image.
1742 %
1743 % The format of the MagickColorizeImage method is:
1744 %
1745 % MagickBooleanType MagickColorizeImage(MagickWand *wand,
1746 % const PixelWand *colorize,const PixelWand *blend)
1747 %
1748 % A description of each parameter follows:
1749 %
1750 % o wand: the magick wand.
1751 %
1752 % o colorize: the colorize pixel wand.
1753 %
1754 % o alpha: the alpha pixel wand.
1755 %
1756 */
1757 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1758  const PixelWand *colorize,const PixelWand *blend)
1759 {
1760  char
1761  percent_blend[MagickPathExtent];
1762 
1763  Image
1764  *colorize_image;
1765 
1766  PixelInfo
1767  target;
1768 
1769  assert(wand != (MagickWand *) NULL);
1770  assert(wand->signature == MagickWandSignature);
1771  if (wand->debug != MagickFalse)
1772  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1773  if (wand->images == (Image *) NULL)
1774  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1775  GetPixelInfo(wand->images,&target);
1776  if (target.colorspace != CMYKColorspace)
1777  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1778  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1779  (double) PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1780  (double) PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1781  (double) PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1782  (double) PixelGetAlphaQuantum(blend)));
1783  else
1784  (void) FormatLocaleString(percent_blend,MagickPathExtent,
1785  "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1786  (double) PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1787  (double) PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1788  (double) PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1789  (double) PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1790  (double) PixelGetAlphaQuantum(blend)));
1791  target=PixelGetPixel(colorize);
1792  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1793  wand->exception);
1794  if (colorize_image == (Image *) NULL)
1795  return(MagickFalse);
1796  ReplaceImageInList(&wand->images,colorize_image);
1797  return(MagickTrue);
1798 }
1799 
1800 /*
1801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1802 % %
1803 % %
1804 % %
1805 % M a g i c k C o l o r M a t r i x I m a g e %
1806 % %
1807 % %
1808 % %
1809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1810 %
1811 % MagickColorMatrixImage() apply color transformation to an image. The method
1812 % permits saturation changes, hue rotation, luminance to alpha, and various
1813 % other effects. Although variable-sized transformation matrices can be used,
1814 % typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1815 % (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1816 % except offsets are in column 6 rather than 5 (in support of CMYKA images)
1817 % and offsets are normalized (divide Flash offset by 255).
1818 %
1819 % The format of the MagickColorMatrixImage method is:
1820 %
1821 % MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1822 % const KernelInfo *color_matrix)
1823 %
1824 % A description of each parameter follows:
1825 %
1826 % o wand: the magick wand.
1827 %
1828 % o color_matrix: the color matrix.
1829 %
1830 */
1831 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1832  const KernelInfo *color_matrix)
1833 {
1834  Image
1835  *color_image;
1836 
1837  assert(wand != (MagickWand *) NULL);
1838  assert(wand->signature == MagickWandSignature);
1839  if (wand->debug != MagickFalse)
1840  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1841  if (color_matrix == (const KernelInfo *) NULL)
1842  return(MagickFalse);
1843  if (wand->images == (Image *) NULL)
1844  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1845  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1846  if (color_image == (Image *) NULL)
1847  return(MagickFalse);
1848  ReplaceImageInList(&wand->images,color_image);
1849  return(MagickTrue);
1850 }
1851 
1852 /*
1853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1854 % %
1855 % %
1856 % %
1857 % 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 %
1858 % %
1859 % %
1860 % %
1861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1862 %
1863 % MagickColorThresholdImage() forces all pixels in the color range to white
1864 % otherwise black.
1865 %
1866 % The format of the MagickColorThresholdImage method is:
1867 %
1868 % MagickBooleanType MagickColorThresholdImage(MagickWand *wand,
1869 % const PixelWand *start_color,const PixelWand *stop_color)
1870 %
1871 % A description of each parameter follows:
1872 %
1873 % o wand: the magick wand.
1874 %
1875 % o start_color: the start color pixel wand.
1876 %
1877 % o stop_color: the stop color pixel wand.
1878 %
1879 */
1880 WandExport MagickBooleanType MagickColorThresholdImage(MagickWand *wand,
1881  const PixelWand *start_color,const PixelWand *stop_color)
1882 {
1883  PixelInfo
1884  start,
1885  stop;
1886 
1887  assert(wand != (MagickWand *) NULL);
1888  assert(wand->signature == MagickWandSignature);
1889  if (wand->debug != MagickFalse)
1890  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1891  if (wand->images == (Image *) NULL)
1892  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1893  PixelGetMagickColor(start_color,&start);
1894  PixelGetMagickColor(stop_color,&stop);
1895  return(ColorThresholdImage(wand->images,&start,&stop,wand->exception));
1896 }
1897 
1898 /*
1899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1900 % %
1901 % %
1902 % %
1903 % M a g i c k C o m b i n e I m a g e s %
1904 % %
1905 % %
1906 % %
1907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1908 %
1909 % MagickCombineImages() combines one or more images into a single image. The
1910 % grayscale value of the pixels of each image in the sequence is assigned in
1911 % order to the specified channels of the combined image. The typical
1912 % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1913 %
1914 % The format of the MagickCombineImages method is:
1915 %
1916 % MagickWand *MagickCombineImages(MagickWand *wand,
1917 % const ColorspaceType colorspace)
1918 %
1919 % A description of each parameter follows:
1920 %
1921 % o wand: the magick wand.
1922 %
1923 % o colorspace: the colorspace.
1924 %
1925 */
1926 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1927  const ColorspaceType colorspace)
1928 {
1929  Image
1930  *combine_image;
1931 
1932  assert(wand != (MagickWand *) NULL);
1933  assert(wand->signature == MagickWandSignature);
1934  if (wand->debug != MagickFalse)
1935  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1936  if (wand->images == (Image *) NULL)
1937  return((MagickWand *) NULL);
1938  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1939  if (combine_image == (Image *) NULL)
1940  return((MagickWand *) NULL);
1941  return(CloneMagickWandFromImages(wand,combine_image));
1942 }
1943 
1944 /*
1945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1946 % %
1947 % %
1948 % %
1949 % M a g i c k C o m m e n t I m a g e %
1950 % %
1951 % %
1952 % %
1953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1954 %
1955 % MagickCommentImage() adds a comment to your image.
1956 %
1957 % The format of the MagickCommentImage method is:
1958 %
1959 % MagickBooleanType MagickCommentImage(MagickWand *wand,
1960 % const char *comment)
1961 %
1962 % A description of each parameter follows:
1963 %
1964 % o wand: the magick wand.
1965 %
1966 % o comment: the image comment.
1967 %
1968 */
1969 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1970  const char *comment)
1971 {
1972  MagickBooleanType
1973  status;
1974 
1975  assert(wand != (MagickWand *) NULL);
1976  assert(wand->signature == MagickWandSignature);
1977  if (wand->debug != MagickFalse)
1978  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1979  if (wand->images == (Image *) NULL)
1980  ThrowWandException(WandError,"ContainsNoImages",wand->name);
1981  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1982  return(status);
1983 }
1984 
1985 /*
1986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1987 % %
1988 % %
1989 % %
1990 % M a g i c k C o m p a r e I m a g e L a y e r s %
1991 % %
1992 % %
1993 % %
1994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1995 %
1996 % MagickCompareImagesLayers() compares each image with the next in a sequence
1997 % and returns the maximum bounding region of any pixel differences it
1998 % discovers.
1999 %
2000 % The format of the MagickCompareImagesLayers method is:
2001 %
2002 % MagickWand *MagickCompareImagesLayers(MagickWand *wand,
2003 % const LayerMethod method)
2004 %
2005 % A description of each parameter follows:
2006 %
2007 % o wand: the magick wand.
2008 %
2009 % o method: the compare method.
2010 %
2011 */
2012 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
2013  const LayerMethod method)
2014 {
2015  Image
2016  *layers_image;
2017 
2018  assert(wand != (MagickWand *) NULL);
2019  assert(wand->signature == MagickWandSignature);
2020  if (wand->debug != MagickFalse)
2021  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2022  if (wand->images == (Image *) NULL)
2023  return((MagickWand *) NULL);
2024  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
2025  if (layers_image == (Image *) NULL)
2026  return((MagickWand *) NULL);
2027  return(CloneMagickWandFromImages(wand,layers_image));
2028 }
2029 
2030 /*
2031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2032 % %
2033 % %
2034 % %
2035 % M a g i c k C o m p a r e I m a g e s %
2036 % %
2037 % %
2038 % %
2039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040 %
2041 % MagickCompareImages() compares an image to a reconstructed image and returns
2042 % the specified difference image.
2043 %
2044 % The format of the MagickCompareImages method is:
2045 %
2046 % MagickWand *MagickCompareImages(MagickWand *wand,
2047 % const MagickWand *reference,const MetricType metric,
2048 % double *distortion)
2049 %
2050 % A description of each parameter follows:
2051 %
2052 % o wand: the magick wand.
2053 %
2054 % o reference: the reference wand.
2055 %
2056 % o metric: the metric.
2057 %
2058 % o distortion: the computed distortion between the images.
2059 %
2060 */
2061 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
2062  const MagickWand *reference,const MetricType metric,double *distortion)
2063 {
2064  Image
2065  *compare_image;
2066 
2067 
2068  assert(wand != (MagickWand *) NULL);
2069  assert(wand->signature == MagickWandSignature);
2070  if (wand->debug != MagickFalse)
2071  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2072  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
2073  {
2074  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
2075  "ContainsNoImages","`%s'",wand->name);
2076  return((MagickWand *) NULL);
2077  }
2078  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
2079  wand->exception);
2080  if (compare_image == (Image *) NULL)
2081  return((MagickWand *) NULL);
2082  return(CloneMagickWandFromImages(wand,compare_image));
2083 }
2084 
2085 /*
2086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2087 % %
2088 % %
2089 % %
2090 % M a g i c k C o m p l e x I m a g e s %
2091 % %
2092 % %
2093 % %
2094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2095 %
2096 % MagickComplexImages() performs complex mathematics on an image sequence.
2097 %
2098 % The format of the MagickComplexImages method is:
2099 %
2100 % MagickWand *MagickComplexImages(MagickWand *wand,
2101 % const ComplexOperator op)
2102 %
2103 % A description of each parameter follows:
2104 %
2105 % o wand: the magick wand.
2106 %
2107 % o op: A complex operator. Choose from AddComplexOperator,
2108 % ConjugateComplexOperator,DivideComplexOperator,
2109 % MagnitudePhaseComplexOperator,MultiplyComplexOperator,
2110 % RealImaginaryComplexOperator, SubtractComplexOperator.
2111 %
2112 */
2113 WandExport MagickWand *MagickComplexImages(MagickWand *wand,
2114  const ComplexOperator op)
2115 {
2116  Image
2117  *complex_image;
2118 
2119  assert(wand != (MagickWand *) NULL);
2120  assert(wand->signature == MagickWandSignature);
2121  if (wand->debug != MagickFalse)
2122  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2123  if (wand->images == (Image *) NULL)
2124  return((MagickWand *) NULL);
2125  complex_image=ComplexImages(wand->images,op,wand->exception);
2126  if (complex_image == (Image *) NULL)
2127  return((MagickWand *) NULL);
2128  return(CloneMagickWandFromImages(wand,complex_image));
2129 }
2130 
2131 /*
2132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2133 % %
2134 % %
2135 % %
2136 % M a g i c k C o m p o s i t e I m a g e %
2137 % %
2138 % %
2139 % %
2140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2141 %
2142 % MagickCompositeImage() composite one image onto another at the specified
2143 % offset.
2144 %
2145 % The format of the MagickCompositeImage method is:
2146 %
2147 % MagickBooleanType MagickCompositeImage(MagickWand *wand,
2148 % const MagickWand *source_wand,const CompositeOperator compose,
2149 % const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2150 %
2151 % A description of each parameter follows:
2152 %
2153 % o wand: the magick wand holding the destination images
2154 %
2155 % o source_image: the magick wand holding source image.
2156 %
2157 % o compose: This operator affects how the composite is applied to the
2158 % image. The default is Over. These are some of the compose methods
2159 % available.
2160 %
2161 % OverCompositeOp InCompositeOp OutCompositeOp
2162 % AtopCompositeOp XorCompositeOp PlusCompositeOp
2163 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
2164 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
2165 % DisplaceCompositeOp
2166 %
2167 % o clip_to_self: set to MagickTrue to limit composition to area composed.
2168 %
2169 % o x: the column offset of the composited image.
2170 %
2171 % o y: the row offset of the composited image.
2172 %
2173 */
2174 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
2175  const MagickWand *source_wand,const CompositeOperator compose,
2176  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2177 {
2178  MagickBooleanType
2179  status;
2180 
2181  assert(wand != (MagickWand *) NULL);
2182  assert(wand->signature == MagickWandSignature);
2183  if (wand->debug != MagickFalse)
2184  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2185  if ((wand->images == (Image *) NULL) ||
2186  (source_wand->images == (Image *) NULL))
2187  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2188  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
2189  x,y,wand->exception);
2190  return(status);
2191 }
2192 
2193 /*
2194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2195 % %
2196 % %
2197 % %
2198 % 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 %
2199 % %
2200 % %
2201 % %
2202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2203 %
2204 % MagickCompositeImageGravity() composite one image onto another using the
2205 % specified gravity.
2206 %
2207 % The format of the MagickCompositeImageGravity method is:
2208 %
2209 % MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2210 % const MagickWand *source_wand,const CompositeOperator compose,
2211 % const GravityType gravity)
2212 %
2213 % A description of each parameter follows:
2214 %
2215 % o wand: the magick wand holding the destination images
2216 %
2217 % o source_image: the magick wand holding source image.
2218 %
2219 % o compose: This operator affects how the composite is applied to the
2220 % image. The default is Over. These are some of the compose methods
2221 % available.
2222 %
2223 % OverCompositeOp InCompositeOp OutCompositeOp
2224 % AtopCompositeOp XorCompositeOp PlusCompositeOp
2225 % MinusCompositeOp AddCompositeOp SubtractCompositeOp
2226 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
2227 % DisplaceCompositeOp
2228 %
2229 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
2230 % NorthEastGravity, WestGravity, CenterGravity,
2231 % EastGravity, SouthWestGravity, SouthGravity,
2232 % SouthEastGravity)
2233 %
2234 */
2235 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2236  const MagickWand *source_wand,const CompositeOperator compose,
2237  const GravityType gravity)
2238 {
2239  MagickBooleanType
2240  status;
2241 
2242  RectangleInfo
2243  geometry;
2244 
2245  assert(wand != (MagickWand *) NULL);
2246  assert(wand->signature == MagickWandSignature);
2247  if (wand->debug != MagickFalse)
2248  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2249  if ((wand->images == (Image *) NULL) ||
2250  (source_wand->images == (Image *) NULL))
2251  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2252  SetGeometry(source_wand->images,&geometry);
2253  GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
2254  &geometry);
2255  status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
2256  geometry.x,geometry.y,wand->exception);
2257  return(status);
2258 }
2259 
2260 /*
2261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2262 % %
2263 % %
2264 % %
2265 % M a g i c k C o m p o s i t e L a y e r s %
2266 % %
2267 % %
2268 % %
2269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2270 %
2271 % MagickCompositeLayers() composite the images in the source wand over the
2272 % images in the destination wand in sequence, starting with the current
2273 % image in both lists.
2274 %
2275 % Each layer from the two image lists are composted together until the end of
2276 % one of the image lists is reached. The offset of each composition is also
2277 % adjusted to match the virtual canvas offsets of each layer. As such the
2278 % given offset is relative to the virtual canvas, and not the actual image.
2279 %
2280 % Composition uses given x and y offsets, as the 'origin' location of the
2281 % source images virtual canvas (not the real image) allowing you to compose a
2282 % list of 'layer images' into the destination images. This makes it well
2283 % suitable for directly composing 'Clears Frame Animations' or 'Coalesced
2284 % Animations' onto a static or other 'Coalesced Animation' destination image
2285 % list. GIF disposal handling is not looked at.
2286 %
2287 % Special case:- If one of the image sequences is the last image (just a
2288 % single image remaining), that image is repeatedly composed with all the
2289 % images in the other image list. Either the source or destination lists may
2290 % be the single image, for this situation.
2291 %
2292 % In the case of a single destination image (or last image given), that image
2293 % will ve cloned to match the number of images remaining in the source image
2294 % list.
2295 %
2296 % This is equivalent to the "-layer Composite" Shell API operator.
2297 %
2298 % The format of the MagickCompositeLayers method is:
2299 %
2300 % MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2301 % const MagickWand *source_wand, const CompositeOperator compose,
2302 % const ssize_t x,const ssize_t y)
2303 %
2304 % A description of each parameter follows:
2305 %
2306 % o wand: the magick wand holding destination images
2307 %
2308 % o source_wand: the wand holding the source images
2309 %
2310 % o compose, x, y: composition arguments
2311 %
2312 */
2313 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2314  const MagickWand *source_wand,const CompositeOperator compose,
2315  const ssize_t x,const ssize_t y)
2316 {
2317  MagickBooleanType
2318  status;
2319 
2320  assert(wand != (MagickWand *) NULL);
2321  assert(wand->signature == MagickWandSignature);
2322  if (wand->debug != MagickFalse)
2323  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2324  if ((wand->images == (Image *) NULL) ||
2325  (source_wand->images == (Image *) NULL))
2326  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2327  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2328  status=MagickTrue; /* FUTURE: determine status from exceptions */
2329  return(status);
2330 }
2331 
2332 /*
2333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2334 % %
2335 % %
2336 % %
2337 % 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 %
2338 % %
2339 % %
2340 % %
2341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2342 %
2343 % MagickConnectedComponentsImage() returns the connected-components of the
2344 % image uniquely labeled. The returned connected components image colors
2345 % member defines the number of unique objects. Choose from 4 or 8-way
2346 % connectivity.
2347 %
2348 % The format of the MagickConnectedComponentsImage method is:
2349 %
2350 % MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2351 % const size_t connectivity,CCObjectInfo **objects)
2352 %
2353 % A description of each parameter follows:
2354 %
2355 % o wand: the magick wand.
2356 %
2357 % o connectivity: how many neighbors to visit, choose from 4 or 8.
2358 %
2359 % o objects: return the attributes of each unique object.
2360 %
2361 */
2362 WandExport MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2363  const size_t connectivity,CCObjectInfo **objects)
2364 {
2365  Image
2366  *connected_components_image;
2367 
2368  assert(wand != (MagickWand *) NULL);
2369  assert(wand->signature == MagickWandSignature);
2370  if (wand->debug != MagickFalse)
2371  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2372  if (wand->images == (Image *) NULL)
2373  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2374  connected_components_image=ConnectedComponentsImage(wand->images,connectivity,
2375  objects,wand->exception);
2376  if (connected_components_image == (Image *) NULL)
2377  return(MagickFalse);
2378  ReplaceImageInList(&wand->images,connected_components_image);
2379  return(MagickTrue);
2380 }
2381 
2382 /*
2383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2384 % %
2385 % %
2386 % %
2387 % M a g i c k C o n t r a s t I m a g e %
2388 % %
2389 % %
2390 % %
2391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2392 %
2393 % MagickContrastImage() enhances the intensity differences between the lighter
2394 % and darker elements of the image. Set sharpen to a value other than 0 to
2395 % increase the image contrast otherwise the contrast is reduced.
2396 %
2397 % The format of the MagickContrastImage method is:
2398 %
2399 % MagickBooleanType MagickContrastImage(MagickWand *wand,
2400 % const MagickBooleanType sharpen)
2401 %
2402 % A description of each parameter follows:
2403 %
2404 % o wand: the magick wand.
2405 %
2406 % o sharpen: Increase or decrease image contrast.
2407 %
2408 %
2409 */
2410 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2411  const MagickBooleanType sharpen)
2412 {
2413  MagickBooleanType
2414  status;
2415 
2416  assert(wand != (MagickWand *) NULL);
2417  assert(wand->signature == MagickWandSignature);
2418  if (wand->debug != MagickFalse)
2419  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2420  if (wand->images == (Image *) NULL)
2421  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2422  status=ContrastImage(wand->images,sharpen,wand->exception);
2423  return(status);
2424 }
2425 
2426 /*
2427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2428 % %
2429 % %
2430 % %
2431 % 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 %
2432 % %
2433 % %
2434 % %
2435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2436 %
2437 % MagickContrastStretchImage() enhances the contrast of a color image by
2438 % adjusting the pixels color to span the entire range of colors available.
2439 % You can also reduce the influence of a particular channel with a gamma
2440 % value of 0.
2441 %
2442 % The format of the MagickContrastStretchImage method is:
2443 %
2444 % MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2445 % const double black_point,const double white_point)
2446 %
2447 % A description of each parameter follows:
2448 %
2449 % o wand: the magick wand.
2450 %
2451 % o black_point: the black point.
2452 %
2453 % o white_point: the white point.
2454 %
2455 */
2456 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2457  const double black_point,const double white_point)
2458 {
2459  MagickBooleanType
2460  status;
2461 
2462  assert(wand != (MagickWand *) NULL);
2463  assert(wand->signature == MagickWandSignature);
2464  if (wand->debug != MagickFalse)
2465  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2466  if (wand->images == (Image *) NULL)
2467  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2468  status=ContrastStretchImage(wand->images,black_point,white_point,
2469  wand->exception);
2470  return(status);
2471 }
2472 
2473 /*
2474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2475 % %
2476 % %
2477 % %
2478 % M a g i c k C o n v o l v e I m a g e %
2479 % %
2480 % %
2481 % %
2482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2483 %
2484 % MagickConvolveImage() applies a custom convolution kernel to the image.
2485 %
2486 % The format of the MagickConvolveImage method is:
2487 %
2488 % MagickBooleanType MagickConvolveImage(MagickWand *wand,
2489 % const KernelInfo *kernel)
2490 %
2491 % A description of each parameter follows:
2492 %
2493 % o wand: the magick wand.
2494 %
2495 % o kernel: An array of doubles representing the convolution kernel.
2496 %
2497 */
2498 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2499  const KernelInfo *kernel)
2500 {
2501  Image
2502  *filter_image;
2503 
2504  assert(wand != (MagickWand *) NULL);
2505  assert(wand->signature == MagickWandSignature);
2506  if (wand->debug != MagickFalse)
2507  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2508  if (kernel == (const KernelInfo *) NULL)
2509  return(MagickFalse);
2510  if (wand->images == (Image *) NULL)
2511  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2512  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2513  if (filter_image == (Image *) NULL)
2514  return(MagickFalse);
2515  ReplaceImageInList(&wand->images,filter_image);
2516  return(MagickTrue);
2517 }
2518 
2519 /*
2520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2521 % %
2522 % %
2523 % %
2524 % M a g i c k C r o p I m a g e %
2525 % %
2526 % %
2527 % %
2528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2529 %
2530 % MagickCropImage() extracts a region of the image.
2531 %
2532 % The format of the MagickCropImage method is:
2533 %
2534 % MagickBooleanType MagickCropImage(MagickWand *wand,
2535 % const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2536 %
2537 % A description of each parameter follows:
2538 %
2539 % o wand: the magick wand.
2540 %
2541 % o width: the region width.
2542 %
2543 % o height: the region height.
2544 %
2545 % o x: the region x-offset.
2546 %
2547 % o y: the region y-offset.
2548 %
2549 */
2550 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2551  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2552 {
2553  Image
2554  *crop_image;
2555 
2556  RectangleInfo
2557  crop;
2558 
2559  assert(wand != (MagickWand *) NULL);
2560  assert(wand->signature == MagickWandSignature);
2561  if (wand->debug != MagickFalse)
2562  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2563  if (wand->images == (Image *) NULL)
2564  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2565  crop.width=width;
2566  crop.height=height;
2567  crop.x=x;
2568  crop.y=y;
2569  crop_image=CropImage(wand->images,&crop,wand->exception);
2570  if (crop_image == (Image *) NULL)
2571  return(MagickFalse);
2572  ReplaceImageInList(&wand->images,crop_image);
2573  return(MagickTrue);
2574 }
2575 
2576 /*
2577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2578 % %
2579 % %
2580 % %
2581 % M a g i c k C y c l e C o l o r m a p I m a g e %
2582 % %
2583 % %
2584 % %
2585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2586 %
2587 % MagickCycleColormapImage() displaces an image's colormap by a given number
2588 % of positions. If you cycle the colormap a number of times you can produce
2589 % a psychodelic effect.
2590 %
2591 % The format of the MagickCycleColormapImage method is:
2592 %
2593 % MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2594 % const ssize_t displace)
2595 %
2596 % A description of each parameter follows:
2597 %
2598 % o wand: the magick wand.
2599 %
2600 % o pixel_wand: the pixel wand.
2601 %
2602 */
2603 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2604  const ssize_t displace)
2605 {
2606  MagickBooleanType
2607  status;
2608 
2609  assert(wand != (MagickWand *) NULL);
2610  assert(wand->signature == MagickWandSignature);
2611  if (wand->debug != MagickFalse)
2612  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2613  if (wand->images == (Image *) NULL)
2614  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2615  status=CycleColormapImage(wand->images,displace,wand->exception);
2616  return(status);
2617 }
2618 
2619 /*
2620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2621 % %
2622 % %
2623 % %
2624 % M a g i c k C o n s t i t u t e I m a g e %
2625 % %
2626 % %
2627 % %
2628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2629 %
2630 % MagickConstituteImage() adds an image to the wand comprised of the pixel
2631 % data you supply. The pixel data must be in scanline order top-to-bottom.
2632 % The data can be char, short int, int, float, or double. Float and double
2633 % require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2634 % is the maximum value the type can accomodate (e.g. 255 for char). For
2635 % example, to create a 640x480 image from unsigned red-green-blue character
2636 % data, use
2637 %
2638 % MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2639 %
2640 % The format of the MagickConstituteImage method is:
2641 %
2642 % MagickBooleanType MagickConstituteImage(MagickWand *wand,
2643 % const size_t columns,const size_t rows,const char *map,
2644 % const StorageType storage,void *pixels)
2645 %
2646 % A description of each parameter follows:
2647 %
2648 % o wand: the magick wand.
2649 %
2650 % o columns: width in pixels of the image.
2651 %
2652 % o rows: height in pixels of the image.
2653 %
2654 % o map: This string reflects the expected ordering of the pixel array.
2655 % It can be any combination or order of R = red, G = green, B = blue,
2656 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2657 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2658 % P = pad.
2659 %
2660 % o storage: Define the data type of the pixels. Float and double types are
2661 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2662 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2663 % LongPixel, QuantumPixel, or ShortPixel.
2664 %
2665 % o pixels: This array of values contain the pixel components as defined by
2666 % map and type. You must preallocate this array where the expected
2667 % length varies depending on the values of width, height, map, and type.
2668 %
2669 %
2670 */
2671 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2672  const size_t columns,const size_t rows,const char *map,
2673  const StorageType storage,const void *pixels)
2674 {
2675  Image
2676  *images;
2677 
2678  assert(wand != (MagickWand *) NULL);
2679  assert(wand->signature == MagickWandSignature);
2680  if (wand->debug != MagickFalse)
2681  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2682  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2683  if (images == (Image *) NULL)
2684  return(MagickFalse);
2685  return(InsertImageInWand(wand,images));
2686 }
2687 
2688 /*
2689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2690 % %
2691 % %
2692 % %
2693 % M a g i c k D e c i p h e r I m a g e %
2694 % %
2695 % %
2696 % %
2697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2698 %
2699 % MagickDecipherImage() converts cipher pixels to plain pixels.
2700 %
2701 % The format of the MagickDecipherImage method is:
2702 %
2703 % MagickBooleanType MagickDecipherImage(MagickWand *wand,
2704 % const char *passphrase)
2705 %
2706 % A description of each parameter follows:
2707 %
2708 % o wand: the magick wand.
2709 %
2710 % o passphrase: the passphrase.
2711 %
2712 */
2713 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2714  const char *passphrase)
2715 {
2716  assert(wand != (MagickWand *) NULL);
2717  assert(wand->signature == MagickWandSignature);
2718  if (wand->debug != MagickFalse)
2719  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2720  if (wand->images == (Image *) NULL)
2721  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2722  return(DecipherImage(wand->images,passphrase,wand->exception));
2723 }
2724 
2725 /*
2726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2727 % %
2728 % %
2729 % %
2730 % M a g i c k D e c o n s t r u c t I m a g e s %
2731 % %
2732 % %
2733 % %
2734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2735 %
2736 % MagickDeconstructImages() compares each image with the next in a sequence
2737 % and returns the maximum bounding region of any pixel differences it
2738 % discovers.
2739 %
2740 % The format of the MagickDeconstructImages method is:
2741 %
2742 % MagickWand *MagickDeconstructImages(MagickWand *wand)
2743 %
2744 % A description of each parameter follows:
2745 %
2746 % o wand: the magick wand.
2747 %
2748 */
2749 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2750 {
2751  Image
2752  *deconstruct_image;
2753 
2754  assert(wand != (MagickWand *) NULL);
2755  assert(wand->signature == MagickWandSignature);
2756  if (wand->debug != MagickFalse)
2757  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2758  if (wand->images == (Image *) NULL)
2759  return((MagickWand *) NULL);
2760  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2761  wand->exception);
2762  if (deconstruct_image == (Image *) NULL)
2763  return((MagickWand *) NULL);
2764  return(CloneMagickWandFromImages(wand,deconstruct_image));
2765 }
2766 
2767 /*
2768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2769 % %
2770 % %
2771 % %
2772 % M a g i c k D e s k e w I m a g e %
2773 % %
2774 % %
2775 % %
2776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2777 %
2778 % MagickDeskewImage() removes skew from the image. Skew is an artifact that
2779 % occurs in scanned images because of the camera being misaligned,
2780 % imperfections in the scanning or surface, or simply because the paper was
2781 % not placed completely flat when scanned.
2782 %
2783 % The format of the MagickDeskewImage method is:
2784 %
2785 % MagickBooleanType MagickDeskewImage(MagickWand *wand,
2786 % const double threshold)
2787 %
2788 % A description of each parameter follows:
2789 %
2790 % o wand: the magick wand.
2791 %
2792 % o threshold: separate background from foreground.
2793 %
2794 */
2795 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2796  const double threshold)
2797 {
2798  Image
2799  *sepia_image;
2800 
2801  assert(wand != (MagickWand *) NULL);
2802  assert(wand->signature == MagickWandSignature);
2803  if (wand->debug != MagickFalse)
2804  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2805  if (wand->images == (Image *) NULL)
2806  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2807  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2808  if (sepia_image == (Image *) NULL)
2809  return(MagickFalse);
2810  ReplaceImageInList(&wand->images,sepia_image);
2811  return(MagickTrue);
2812 }
2813 
2814 /*
2815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2816 % %
2817 % %
2818 % %
2819 % M a g i c k D e s p e c k l e I m a g e %
2820 % %
2821 % %
2822 % %
2823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2824 %
2825 % MagickDespeckleImage() reduces the speckle noise in an image while
2826 % preserving the edges of the original image.
2827 %
2828 % The format of the MagickDespeckleImage method is:
2829 %
2830 % MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2831 %
2832 % A description of each parameter follows:
2833 %
2834 % o wand: the magick wand.
2835 %
2836 */
2837 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2838 {
2839  Image
2840  *despeckle_image;
2841 
2842  assert(wand != (MagickWand *) NULL);
2843  assert(wand->signature == MagickWandSignature);
2844  if (wand->debug != MagickFalse)
2845  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2846  if (wand->images == (Image *) NULL)
2847  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2848  despeckle_image=DespeckleImage(wand->images,wand->exception);
2849  if (despeckle_image == (Image *) NULL)
2850  return(MagickFalse);
2851  ReplaceImageInList(&wand->images,despeckle_image);
2852  return(MagickTrue);
2853 }
2854 
2855 /*
2856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2857 % %
2858 % %
2859 % %
2860 % M a g i c k D e s t r o y I m a g e %
2861 % %
2862 % %
2863 % %
2864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2865 %
2866 % MagickDestroyImage() dereferences an image, deallocating memory associated
2867 % with the image if the reference count becomes zero.
2868 %
2869 % The format of the MagickDestroyImage method is:
2870 %
2871 % Image *MagickDestroyImage(Image *image)
2872 %
2873 % A description of each parameter follows:
2874 %
2875 % o image: the image.
2876 %
2877 */
2878 WandExport Image *MagickDestroyImage(Image *image)
2879 {
2880  return(DestroyImage(image));
2881 }
2882 
2883 /*
2884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2885 % %
2886 % %
2887 % %
2888 % M a g i c k D i s p l a y I m a g e %
2889 % %
2890 % %
2891 % %
2892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2893 %
2894 % MagickDisplayImage() displays an image.
2895 %
2896 % The format of the MagickDisplayImage method is:
2897 %
2898 % MagickBooleanType MagickDisplayImage(MagickWand *wand,
2899 % const char *server_name)
2900 %
2901 % A description of each parameter follows:
2902 %
2903 % o wand: the magick wand.
2904 %
2905 % o server_name: the X server name.
2906 %
2907 */
2908 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2909  const char *server_name)
2910 {
2911  Image
2912  *image;
2913 
2914  MagickBooleanType
2915  status;
2916 
2917  assert(wand != (MagickWand *) NULL);
2918  assert(wand->signature == MagickWandSignature);
2919  if (wand->debug != MagickFalse)
2920  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2921  if (wand->images == (Image *) NULL)
2922  ThrowWandException(WandError,"ContainsNoImages",wand->name);
2923  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2924  if (image == (Image *) NULL)
2925  return(MagickFalse);
2926  (void) CloneString(&wand->image_info->server_name,server_name);
2927  status=DisplayImages(wand->image_info,image,wand->exception);
2928  image=DestroyImage(image);
2929  return(status);
2930 }
2931 
2932 /*
2933 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2934 % %
2935 % %
2936 % %
2937 % M a g i c k D i s p l a y I m a g e s %
2938 % %
2939 % %
2940 % %
2941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2942 %
2943 % MagickDisplayImages() displays an image or image sequence.
2944 %
2945 % The format of the MagickDisplayImages method is:
2946 %
2947 % MagickBooleanType MagickDisplayImages(MagickWand *wand,
2948 % const char *server_name)
2949 %
2950 % A description of each parameter follows:
2951 %
2952 % o wand: the magick wand.
2953 %
2954 % o server_name: the X server name.
2955 %
2956 */
2957 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2958  const char *server_name)
2959 {
2960  MagickBooleanType
2961  status;
2962 
2963  assert(wand != (MagickWand *) NULL);
2964  assert(wand->signature == MagickWandSignature);
2965  if (wand->debug != MagickFalse)
2966  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2967  (void) CloneString(&wand->image_info->server_name,server_name);
2968  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2969  return(status);
2970 }
2971 
2972 /*
2973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2974 % %
2975 % %
2976 % %
2977 % M a g i c k D i s t o r t I m a g e %
2978 % %
2979 % %
2980 % %
2981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2982 %
2983 % MagickDistortImage() distorts an image using various distortion methods, by
2984 % mapping color lookups of the source image to a new destination image
2985 % usually of the same size as the source image, unless 'bestfit' is set to
2986 % true.
2987 %
2988 % If 'bestfit' is enabled, and distortion allows it, the destination image is
2989 % adjusted to ensure the whole source 'image' will just fit within the final
2990 % destination image, which will be sized and offset accordingly. Also in
2991 % many cases the virtual offset of the source image will be taken into
2992 % account in the mapping.
2993 %
2994 % The format of the MagickDistortImage method is:
2995 %
2996 % MagickBooleanType MagickDistortImage(MagickWand *wand,
2997 % const DistortMethod method,const size_t number_arguments,
2998 % const double *arguments,const MagickBooleanType bestfit)
2999 %
3000 % A description of each parameter follows:
3001 %
3002 % o image: the image to be distorted.
3003 %
3004 % o method: the method of image distortion.
3005 %
3006 % ArcDistortion always ignores the source image offset, and always
3007 % 'bestfit' the destination image with the top left corner offset
3008 % relative to the polar mapping center.
3009 %
3010 % Bilinear has no simple inverse mapping so it does not allow 'bestfit'
3011 % style of image distortion.
3012 %
3013 % Affine, Perspective, and Bilinear, do least squares fitting of the
3014 % distortion when more than the minimum number of control point pairs
3015 % are provided.
3016 %
3017 % Perspective, and Bilinear, falls back to a Affine distortion when less
3018 % that 4 control point pairs are provided. While Affine distortions let
3019 % you use any number of control point pairs, that is Zero pairs is a
3020 % no-Op (viewport only) distortion, one pair is a translation and two
3021 % pairs of control points do a scale-rotate-translate, without any
3022 % shearing.
3023 %
3024 % o number_arguments: the number of arguments given for this distortion
3025 % method.
3026 %
3027 % o arguments: the arguments for this distortion method.
3028 %
3029 % o bestfit: Attempt to resize destination to fit distorted source.
3030 %
3031 */
3032 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
3033  const DistortMethod method,const size_t number_arguments,
3034  const double *arguments,const MagickBooleanType bestfit)
3035 {
3036  Image
3037  *distort_image;
3038 
3039  assert(wand != (MagickWand *) NULL);
3040  assert(wand->signature == MagickWandSignature);
3041  if (wand->debug != MagickFalse)
3042  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3043  if (wand->images == (Image *) NULL)
3044  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3045  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
3046  bestfit,wand->exception);
3047  if (distort_image == (Image *) NULL)
3048  return(MagickFalse);
3049  ReplaceImageInList(&wand->images,distort_image);
3050  return(MagickTrue);
3051 }
3052 
3053 /*
3054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3055 % %
3056 % %
3057 % %
3058 % M a g i c k D r a w I m a g e %
3059 % %
3060 % %
3061 % %
3062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3063 %
3064 % MagickDrawImage() renders the drawing wand on the current image.
3065 %
3066 % The format of the MagickDrawImage method is:
3067 %
3068 % MagickBooleanType MagickDrawImage(MagickWand *wand,
3069 % const DrawingWand *drawing_wand)
3070 %
3071 % A description of each parameter follows:
3072 %
3073 % o wand: the magick wand.
3074 %
3075 % o drawing_wand: the draw wand.
3076 %
3077 */
3078 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
3079  const DrawingWand *drawing_wand)
3080 {
3081  char
3082  *primitive;
3083 
3084  DrawInfo
3085  *draw_info;
3086 
3087  MagickBooleanType
3088  status;
3089 
3090  assert(wand != (MagickWand *) NULL);
3091  assert(wand->signature == MagickWandSignature);
3092  if (wand->debug != MagickFalse)
3093  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3094  if (wand->images == (Image *) NULL)
3095  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3096  draw_info=PeekDrawingWand(drawing_wand);
3097  if ((draw_info == (DrawInfo *) NULL) ||
3098  (draw_info->primitive == (char *) NULL))
3099  return(MagickFalse);
3100  primitive=AcquireString(draw_info->primitive);
3101  draw_info=DestroyDrawInfo(draw_info);
3102  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3103  draw_info->primitive=primitive;
3104  status=DrawImage(wand->images,draw_info,wand->exception);
3105  draw_info=DestroyDrawInfo(draw_info);
3106  return(status);
3107 }
3108 
3109 /*
3110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3111 % %
3112 % %
3113 % %
3114 % M a g i c k E d g e I m a g e %
3115 % %
3116 % %
3117 % %
3118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3119 %
3120 % MagickEdgeImage() enhance edges within the image with a convolution filter
3121 % of the given radius. Use a radius of 0 and Edge() selects a suitable
3122 % radius for you.
3123 %
3124 % The format of the MagickEdgeImage method is:
3125 %
3126 % MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
3127 %
3128 % A description of each parameter follows:
3129 %
3130 % o wand: the magick wand.
3131 %
3132 % o radius: the radius of the pixel neighborhood.
3133 %
3134 */
3135 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
3136  const double radius)
3137 {
3138  Image
3139  *edge_image;
3140 
3141  assert(wand != (MagickWand *) NULL);
3142  assert(wand->signature == MagickWandSignature);
3143  if (wand->debug != MagickFalse)
3144  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3145  if (wand->images == (Image *) NULL)
3146  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3147  edge_image=EdgeImage(wand->images,radius,wand->exception);
3148  if (edge_image == (Image *) NULL)
3149  return(MagickFalse);
3150  ReplaceImageInList(&wand->images,edge_image);
3151  return(MagickTrue);
3152 }
3153 
3154 /*
3155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3156 % %
3157 % %
3158 % %
3159 % M a g i c k E m b o s s I m a g e %
3160 % %
3161 % %
3162 % %
3163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3164 %
3165 % MagickEmbossImage() returns a grayscale image with a three-dimensional
3166 % effect. We convolve the image with a Gaussian operator of the given radius
3167 % and standard deviation (sigma). For reasonable results, radius should be
3168 % larger than sigma. Use a radius of 0 and Emboss() selects a suitable
3169 % radius for you.
3170 %
3171 % The format of the MagickEmbossImage method is:
3172 %
3173 % MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
3174 % const double sigma)
3175 %
3176 % A description of each parameter follows:
3177 %
3178 % o wand: the magick wand.
3179 %
3180 % o radius: the radius of the Gaussian, in pixels, not counting the center
3181 % pixel.
3182 %
3183 % o sigma: the standard deviation of the Gaussian, in pixels.
3184 %
3185 */
3186 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
3187  const double radius,const double sigma)
3188 {
3189  Image
3190  *emboss_image;
3191 
3192  assert(wand != (MagickWand *) NULL);
3193  assert(wand->signature == MagickWandSignature);
3194  if (wand->debug != MagickFalse)
3195  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3196  if (wand->images == (Image *) NULL)
3197  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3198  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
3199  if (emboss_image == (Image *) NULL)
3200  return(MagickFalse);
3201  ReplaceImageInList(&wand->images,emboss_image);
3202  return(MagickTrue);
3203 }
3204 
3205 /*
3206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3207 % %
3208 % %
3209 % %
3210 % M a g i c k E n c i p h e r I m a g e %
3211 % %
3212 % %
3213 % %
3214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3215 %
3216 % MagickEncipherImage() converts plaint pixels to cipher pixels.
3217 %
3218 % The format of the MagickEncipherImage method is:
3219 %
3220 % MagickBooleanType MagickEncipherImage(MagickWand *wand,
3221 % const char *passphrase)
3222 %
3223 % A description of each parameter follows:
3224 %
3225 % o wand: the magick wand.
3226 %
3227 % o passphrase: the passphrase.
3228 %
3229 */
3230 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
3231  const char *passphrase)
3232 {
3233  assert(wand != (MagickWand *) NULL);
3234  assert(wand->signature == MagickWandSignature);
3235  if (wand->debug != MagickFalse)
3236  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3237  if (wand->images == (Image *) NULL)
3238  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3239  return(EncipherImage(wand->images,passphrase,wand->exception));
3240 }
3241 
3242 /*
3243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3244 % %
3245 % %
3246 % %
3247 % M a g i c k E n h a n c e I m a g e %
3248 % %
3249 % %
3250 % %
3251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3252 %
3253 % MagickEnhanceImage() applies a digital filter that improves the quality of a
3254 % noisy image.
3255 %
3256 % The format of the MagickEnhanceImage method is:
3257 %
3258 % MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3259 %
3260 % A description of each parameter follows:
3261 %
3262 % o wand: the magick wand.
3263 %
3264 */
3265 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3266 {
3267  Image
3268  *enhance_image;
3269 
3270  assert(wand != (MagickWand *) NULL);
3271  assert(wand->signature == MagickWandSignature);
3272  if (wand->debug != MagickFalse)
3273  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3274  if (wand->images == (Image *) NULL)
3275  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3276  enhance_image=EnhanceImage(wand->images,wand->exception);
3277  if (enhance_image == (Image *) NULL)
3278  return(MagickFalse);
3279  ReplaceImageInList(&wand->images,enhance_image);
3280  return(MagickTrue);
3281 }
3282 
3283 /*
3284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3285 % %
3286 % %
3287 % %
3288 % M a g i c k E q u a l i z e I m a g e %
3289 % %
3290 % %
3291 % %
3292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3293 %
3294 % MagickEqualizeImage() equalizes the image histogram.
3295 %
3296 % The format of the MagickEqualizeImage method is:
3297 %
3298 % MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3299 %
3300 % A description of each parameter follows:
3301 %
3302 % o wand: the magick wand.
3303 %
3304 % o channel: the image channel(s).
3305 %
3306 */
3307 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3308 {
3309  MagickBooleanType
3310  status;
3311 
3312  assert(wand != (MagickWand *) NULL);
3313  assert(wand->signature == MagickWandSignature);
3314  if (wand->debug != MagickFalse)
3315  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3316  if (wand->images == (Image *) NULL)
3317  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3318  status=EqualizeImage(wand->images,wand->exception);
3319  return(status);
3320 }
3321 
3322 /*
3323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3324 % %
3325 % %
3326 % %
3327 % M a g i c k E v a l u a t e I m a g e %
3328 % %
3329 % %
3330 % %
3331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3332 %
3333 % MagickEvaluateImage() applies an arithmetic, relational, or logical
3334 % expression to an image. Use these operators to lighten or darken an image,
3335 % to increase or decrease contrast in an image, or to produce the "negative"
3336 % of an image.
3337 %
3338 % The format of the MagickEvaluateImage method is:
3339 %
3340 % MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3341 % const MagickEvaluateOperator operator,const double value)
3342 % MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3343 % const MagickEvaluateOperator operator)
3344 %
3345 % A description of each parameter follows:
3346 %
3347 % o wand: the magick wand.
3348 %
3349 % o op: A channel operator.
3350 %
3351 % o value: A value value.
3352 %
3353 */
3354 
3355 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3356  const MagickEvaluateOperator op)
3357 {
3358  Image
3359  *evaluate_image;
3360 
3361  assert(wand != (MagickWand *) NULL);
3362  assert(wand->signature == MagickWandSignature);
3363  if (wand->debug != MagickFalse)
3364  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3365  if (wand->images == (Image *) NULL)
3366  return((MagickWand *) NULL);
3367  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3368  if (evaluate_image == (Image *) NULL)
3369  return((MagickWand *) NULL);
3370  return(CloneMagickWandFromImages(wand,evaluate_image));
3371 }
3372 
3373 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3374  const MagickEvaluateOperator op,const double value)
3375 {
3376  MagickBooleanType
3377  status;
3378 
3379  assert(wand != (MagickWand *) NULL);
3380  assert(wand->signature == MagickWandSignature);
3381  if (wand->debug != MagickFalse)
3382  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3383  if (wand->images == (Image *) NULL)
3384  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3385  status=EvaluateImage(wand->images,op,value,wand->exception);
3386  return(status);
3387 }
3388 
3389 /*
3390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3391 % %
3392 % %
3393 % %
3394 % M a g i c k E x p o r t I m a g e P i x e l s %
3395 % %
3396 % %
3397 % %
3398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3399 %
3400 % MagickExportImagePixels() extracts pixel data from an image and returns it
3401 % to you. The method returns MagickTrue on success otherwise MagickFalse if
3402 % an error is encountered. The data is returned as char, short int, int,
3403 % ssize_t, float, or double in the order specified by map.
3404 %
3405 % Suppose you want to extract the first scanline of a 640x480 image as
3406 % character data in red-green-blue order:
3407 %
3408 % MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3409 %
3410 % The format of the MagickExportImagePixels method is:
3411 %
3412 % MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3413 % const ssize_t x,const ssize_t y,const size_t columns,
3414 % const size_t rows,const char *map,const StorageType storage,
3415 % void *pixels)
3416 %
3417 % A description of each parameter follows:
3418 %
3419 % o wand: the magick wand.
3420 %
3421 % o x, y, columns, rows: These values define the perimeter
3422 % of a region of pixels you want to extract.
3423 %
3424 % o map: This string reflects the expected ordering of the pixel array.
3425 % It can be any combination or order of R = red, G = green, B = blue,
3426 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3427 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3428 % P = pad.
3429 %
3430 % o storage: Define the data type of the pixels. Float and double types are
3431 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3432 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3433 % LongPixel, QuantumPixel, or ShortPixel.
3434 %
3435 % o pixels: This array of values contain the pixel components as defined by
3436 % map and type. You must preallocate this array where the expected
3437 % length varies depending on the values of width, height, map, and type.
3438 %
3439 */
3440 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3441  const ssize_t x,const ssize_t y,const size_t columns,
3442  const size_t rows,const char *map,const StorageType storage,
3443  void *pixels)
3444 {
3445  MagickBooleanType
3446  status;
3447 
3448  assert(wand != (MagickWand *) NULL);
3449  assert(wand->signature == MagickWandSignature);
3450  if (wand->debug != MagickFalse)
3451  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3452  if (wand->images == (Image *) NULL)
3453  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3454  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3455  storage,pixels,wand->exception);
3456  return(status);
3457 }
3458 
3459 /*
3460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3461 % %
3462 % %
3463 % %
3464 % M a g i c k E x t e n t I m a g e %
3465 % %
3466 % %
3467 % %
3468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3469 %
3470 % MagickExtentImage() extends the image as defined by the geometry, gravity,
3471 % and wand background color. Set the (x,y) offset of the geometry to move
3472 % the original wand relative to the extended wand.
3473 %
3474 % The format of the MagickExtentImage method is:
3475 %
3476 % MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3477 % const size_t height,const ssize_t x,const ssize_t y)
3478 %
3479 % A description of each parameter follows:
3480 %
3481 % o wand: the magick wand.
3482 %
3483 % o width: the region width.
3484 %
3485 % o height: the region height.
3486 %
3487 % o x: the region x offset.
3488 %
3489 % o y: the region y offset.
3490 %
3491 */
3492 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3493  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3494 {
3495  Image
3496  *extent_image;
3497 
3498  RectangleInfo
3499  extent;
3500 
3501  assert(wand != (MagickWand *) NULL);
3502  assert(wand->signature == MagickWandSignature);
3503  if (wand->debug != MagickFalse)
3504  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3505  if (wand->images == (Image *) NULL)
3506  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3507  extent.width=width;
3508  extent.height=height;
3509  extent.x=x;
3510  extent.y=y;
3511  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3512  if (extent_image == (Image *) NULL)
3513  return(MagickFalse);
3514  ReplaceImageInList(&wand->images,extent_image);
3515  return(MagickTrue);
3516 }
3517 
3518 /*
3519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3520 % %
3521 % %
3522 % %
3523 % M a g i c k F l i p I m a g e %
3524 % %
3525 % %
3526 % %
3527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3528 %
3529 % MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3530 % around the central x-axis.
3531 %
3532 % The format of the MagickFlipImage method is:
3533 %
3534 % MagickBooleanType MagickFlipImage(MagickWand *wand)
3535 %
3536 % A description of each parameter follows:
3537 %
3538 % o wand: the magick wand.
3539 %
3540 */
3541 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3542 {
3543  Image
3544  *flip_image;
3545 
3546  assert(wand != (MagickWand *) NULL);
3547  assert(wand->signature == MagickWandSignature);
3548  if (wand->debug != MagickFalse)
3549  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3550  if (wand->images == (Image *) NULL)
3551  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3552  flip_image=FlipImage(wand->images,wand->exception);
3553  if (flip_image == (Image *) NULL)
3554  return(MagickFalse);
3555  ReplaceImageInList(&wand->images,flip_image);
3556  return(MagickTrue);
3557 }
3558 
3559 /*
3560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3561 % %
3562 % %
3563 % %
3564 % 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 %
3565 % %
3566 % %
3567 % %
3568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3569 %
3570 % MagickFloodfillPaintImage() changes the color value of any pixel that matches
3571 % target and is an immediate neighbor. If the method FillToBorderMethod is
3572 % specified, the color value is changed for any neighbor pixel that does not
3573 % match the bordercolor member of image.
3574 %
3575 % The format of the MagickFloodfillPaintImage method is:
3576 %
3577 % MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3578 % const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3579 % const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3580 %
3581 % A description of each parameter follows:
3582 %
3583 % o wand: the magick wand.
3584 %
3585 % o fill: the floodfill color pixel wand.
3586 %
3587 % o fuzz: By default target must match a particular pixel color
3588 % exactly. However, in many cases two colors may differ by a small amount.
3589 % The fuzz member of image defines how much tolerance is acceptable to
3590 % consider two colors as the same. For example, set fuzz to 10 and the
3591 % color red at intensities of 100 and 102 respectively are now interpreted
3592 % as the same color for the purposes of the floodfill.
3593 %
3594 % o bordercolor: the border color pixel wand.
3595 %
3596 % o x,y: the starting location of the operation.
3597 %
3598 % o invert: paint any pixel that does not match the target color.
3599 %
3600 */
3601 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3602  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3603  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3604 {
3605  DrawInfo
3606  *draw_info;
3607 
3608  MagickBooleanType
3609  status;
3610 
3611  PixelInfo
3612  target;
3613 
3614  assert(wand != (MagickWand *) NULL);
3615  assert(wand->signature == MagickWandSignature);
3616  if (wand->debug != MagickFalse)
3617  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3618  if (wand->images == (Image *) NULL)
3619  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3620  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3621  PixelGetQuantumPacket(fill,&draw_info->fill);
3622  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3623  (ssize_t) wand->images->columns,y % (ssize_t) wand->images->rows,&target,
3624  wand->exception);
3625  if (bordercolor != (PixelWand *) NULL)
3626  PixelGetMagickColor(bordercolor,&target);
3627  wand->images->fuzz=fuzz;
3628  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3629  wand->exception);
3630  draw_info=DestroyDrawInfo(draw_info);
3631  return(status);
3632 }
3633 
3634 /*
3635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3636 % %
3637 % %
3638 % %
3639 % M a g i c k F l o p I m a g e %
3640 % %
3641 % %
3642 % %
3643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3644 %
3645 % MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3646 % around the central y-axis.
3647 %
3648 % The format of the MagickFlopImage method is:
3649 %
3650 % MagickBooleanType MagickFlopImage(MagickWand *wand)
3651 %
3652 % A description of each parameter follows:
3653 %
3654 % o wand: the magick wand.
3655 %
3656 */
3657 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3658 {
3659  Image
3660  *flop_image;
3661 
3662  assert(wand != (MagickWand *) NULL);
3663  assert(wand->signature == MagickWandSignature);
3664  if (wand->debug != MagickFalse)
3665  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3666  if (wand->images == (Image *) NULL)
3667  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3668  flop_image=FlopImage(wand->images,wand->exception);
3669  if (flop_image == (Image *) NULL)
3670  return(MagickFalse);
3671  ReplaceImageInList(&wand->images,flop_image);
3672  return(MagickTrue);
3673 }
3674 
3675 /*
3676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3677 % %
3678 % %
3679 % %
3680 % 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 %
3681 % %
3682 % %
3683 % %
3684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3685 %
3686 % MagickForwardFourierTransformImage() implements the discrete Fourier
3687 % transform (DFT) of the image either as a magnitude / phase or real /
3688 % imaginary image pair.
3689 %
3690 % The format of the MagickForwardFourierTransformImage method is:
3691 %
3692 % MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3693 % const MagickBooleanType magnitude)
3694 %
3695 % A description of each parameter follows:
3696 %
3697 % o wand: the magick wand.
3698 %
3699 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
3700 % imaginary image pair.
3701 %
3702 */
3703 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3704  MagickWand *wand,const MagickBooleanType magnitude)
3705 {
3706  Image
3707  *forward_image;
3708 
3709  assert(wand != (MagickWand *) NULL);
3710  assert(wand->signature == MagickWandSignature);
3711  if (wand->debug != MagickFalse)
3712  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3713  if (wand->images == (Image *) NULL)
3714  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3715  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3716  wand->exception);
3717  if (forward_image == (Image *) NULL)
3718  return(MagickFalse);
3719  ReplaceImageInList(&wand->images,forward_image);
3720  return(MagickTrue);
3721 }
3722 
3723 /*
3724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3725 % %
3726 % %
3727 % %
3728 % M a g i c k F r a m e I m a g e %
3729 % %
3730 % %
3731 % %
3732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3733 %
3734 % MagickFrameImage() adds a simulated three-dimensional border around the
3735 % image. The width and height specify the border width of the vertical and
3736 % horizontal sides of the frame. The inner and outer bevels indicate the
3737 % width of the inner and outer shadows of the frame.
3738 %
3739 % The format of the MagickFrameImage method is:
3740 %
3741 % MagickBooleanType MagickFrameImage(MagickWand *wand,
3742 % const PixelWand *matte_color,const size_t width,
3743 % const size_t height,const ssize_t inner_bevel,
3744 % const ssize_t outer_bevel,const CompositeOperator compose)
3745 %
3746 % A description of each parameter follows:
3747 %
3748 % o wand: the magick wand.
3749 %
3750 % o matte_color: the frame color pixel wand.
3751 %
3752 % o width: the border width.
3753 %
3754 % o height: the border height.
3755 %
3756 % o inner_bevel: the inner bevel width.
3757 %
3758 % o outer_bevel: the outer bevel width.
3759 %
3760 % o compose: the composite operator.
3761 %
3762 */
3763 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3764  const PixelWand *matte_color,const size_t width,const size_t height,
3765  const ssize_t inner_bevel,const ssize_t outer_bevel,
3766  const CompositeOperator compose)
3767 {
3768  Image
3769  *frame_image;
3770 
3771  FrameInfo
3772  frame_info;
3773 
3774  assert(wand != (MagickWand *) NULL);
3775  assert(wand->signature == MagickWandSignature);
3776  if (wand->debug != MagickFalse)
3777  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3778  if (wand->images == (Image *) NULL)
3779  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3780  (void) memset(&frame_info,0,sizeof(frame_info));
3781  frame_info.width=wand->images->columns+2*width;
3782  frame_info.height=wand->images->rows+2*height;
3783  frame_info.x=(ssize_t) width;
3784  frame_info.y=(ssize_t) height;
3785  frame_info.inner_bevel=inner_bevel;
3786  frame_info.outer_bevel=outer_bevel;
3787  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3788  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3789  if (frame_image == (Image *) NULL)
3790  return(MagickFalse);
3791  ReplaceImageInList(&wand->images,frame_image);
3792  return(MagickTrue);
3793 }
3794 
3795 /*
3796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3797 % %
3798 % %
3799 % %
3800 % M a g i c k F u n c t i o n I m a g e %
3801 % %
3802 % %
3803 % %
3804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3805 %
3806 % MagickFunctionImage() applies an arithmetic, relational, or logical
3807 % expression to an image. Use these operators to lighten or darken an image,
3808 % to increase or decrease contrast in an image, or to produce the "negative"
3809 % of an image.
3810 %
3811 % The format of the MagickFunctionImage method is:
3812 %
3813 % MagickBooleanType MagickFunctionImage(MagickWand *wand,
3814 % const MagickFunction function,const size_t number_arguments,
3815 % const double *arguments)
3816 %
3817 % A description of each parameter follows:
3818 %
3819 % o wand: the magick wand.
3820 %
3821 % o function: the image function.
3822 %
3823 % o number_arguments: the number of function arguments.
3824 %
3825 % o arguments: the function arguments.
3826 %
3827 */
3828 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3829  const MagickFunction function,const size_t number_arguments,
3830  const double *arguments)
3831 {
3832  MagickBooleanType
3833  status;
3834 
3835  assert(wand != (MagickWand *) NULL);
3836  assert(wand->signature == MagickWandSignature);
3837  if (wand->debug != MagickFalse)
3838  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3839  if (wand->images == (Image *) NULL)
3840  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3841  status=FunctionImage(wand->images,function,number_arguments,arguments,
3842  wand->exception);
3843  return(status);
3844 }
3845 
3846 /*
3847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3848 % %
3849 % %
3850 % %
3851 % M a g i c k F x I m a g e %
3852 % %
3853 % %
3854 % %
3855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3856 %
3857 % MagickFxImage() evaluate expression for each pixel in the image.
3858 %
3859 % The format of the MagickFxImage method is:
3860 %
3861 % MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3862 %
3863 % A description of each parameter follows:
3864 %
3865 % o wand: the magick wand.
3866 %
3867 % o expression: the expression.
3868 %
3869 */
3870 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3871 {
3872  Image
3873  *fx_image;
3874 
3875  assert(wand != (MagickWand *) NULL);
3876  assert(wand->signature == MagickWandSignature);
3877  if (wand->debug != MagickFalse)
3878  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3879  if (wand->images == (Image *) NULL)
3880  return((MagickWand *) NULL);
3881  fx_image=FxImage(wand->images,expression,wand->exception);
3882  if (fx_image == (Image *) NULL)
3883  return((MagickWand *) NULL);
3884  return(CloneMagickWandFromImages(wand,fx_image));
3885 }
3886 
3887 /*
3888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3889 % %
3890 % %
3891 % %
3892 % M a g i c k G a m m a I m a g e %
3893 % %
3894 % %
3895 % %
3896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3897 %
3898 % MagickGammaImage() gamma-corrects an image. The same image viewed on
3899 % different devices will have perceptual differences in the way the image's
3900 % intensities are represented on the screen. Specify individual gamma levels
3901 % for the red, green, and blue channels, or adjust all three with the gamma
3902 % parameter. Values typically range from 0.8 to 2.3.
3903 %
3904 % You can also reduce the influence of a particular channel with a gamma
3905 % value of 0.
3906 %
3907 % The format of the MagickGammaImage method is:
3908 %
3909 % MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3910 %
3911 % A description of each parameter follows:
3912 %
3913 % o wand: the magick wand.
3914 %
3915 % o level: Define the level of gamma correction.
3916 %
3917 */
3918 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3919  const double gamma)
3920 {
3921  MagickBooleanType
3922  status;
3923 
3924  assert(wand != (MagickWand *) NULL);
3925  assert(wand->signature == MagickWandSignature);
3926  if (wand->debug != MagickFalse)
3927  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3928  if (wand->images == (Image *) NULL)
3929  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3930  status=GammaImage(wand->images,gamma,wand->exception);
3931  return(status);
3932 }
3933 
3934 /*
3935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3936 % %
3937 % %
3938 % %
3939 % M a g i c k G a u s s i a n B l u r I m a g e %
3940 % %
3941 % %
3942 % %
3943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3944 %
3945 % MagickGaussianBlurImage() blurs an image. We convolve the image with a
3946 % Gaussian operator of the given radius and standard deviation (sigma).
3947 % For reasonable results, the radius should be larger than sigma. Use a
3948 % radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3949 %
3950 % The format of the MagickGaussianBlurImage method is:
3951 %
3952 % MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3953 % const double radius,const double sigma)
3954 %
3955 % A description of each parameter follows:
3956 %
3957 % o wand: the magick wand.
3958 %
3959 % o radius: the radius of the Gaussian, in pixels, not counting the center
3960 % pixel.
3961 %
3962 % o sigma: the standard deviation of the Gaussian, in pixels.
3963 %
3964 */
3965 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3966  const double radius,const double sigma)
3967 {
3968  Image
3969  *blur_image;
3970 
3971  assert(wand != (MagickWand *) NULL);
3972  assert(wand->signature == MagickWandSignature);
3973  if (wand->debug != MagickFalse)
3974  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3975  if (wand->images == (Image *) NULL)
3976  ThrowWandException(WandError,"ContainsNoImages",wand->name);
3977  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3978  if (blur_image == (Image *) NULL)
3979  return(MagickFalse);
3980  ReplaceImageInList(&wand->images,blur_image);
3981  return(MagickTrue);
3982 }
3983 
3984 /*
3985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3986 % %
3987 % %
3988 % %
3989 % M a g i c k G e t I m a g e %
3990 % %
3991 % %
3992 % %
3993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3994 %
3995 % MagickGetImage() gets the image at the current image index.
3996 %
3997 % The format of the MagickGetImage method is:
3998 %
3999 % MagickWand *MagickGetImage(MagickWand *wand)
4000 %
4001 % A description of each parameter follows:
4002 %
4003 % o wand: the magick wand.
4004 %
4005 */
4006 WandExport MagickWand *MagickGetImage(MagickWand *wand)
4007 {
4008  Image
4009  *image;
4010 
4011  assert(wand != (MagickWand *) NULL);
4012  assert(wand->signature == MagickWandSignature);
4013  if (wand->debug != MagickFalse)
4014  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4015  if (wand->images == (Image *) NULL)
4016  {
4017  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4018  "ContainsNoImages","`%s'",wand->name);
4019  return((MagickWand *) NULL);
4020  }
4021  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
4022  if (image == (Image *) NULL)
4023  return((MagickWand *) NULL);
4024  return(CloneMagickWandFromImages(wand,image));
4025 }
4026 
4027 /*
4028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4029 % %
4030 % %
4031 % %
4032 % 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 %
4033 % %
4034 % %
4035 % %
4036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4037 %
4038 % MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
4039 % is not activated. That is, the image is RGB rather than RGBA or CMYK rather
4040 % than CMYKA.
4041 %
4042 % The format of the MagickGetImageAlphaChannel method is:
4043 %
4044 % MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4045 %
4046 % A description of each parameter follows:
4047 %
4048 % o wand: the magick wand.
4049 %
4050 */
4051 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4052 {
4053  assert(wand != (MagickWand *) NULL);
4054  assert(wand->signature == MagickWandSignature);
4055  if (wand->debug != MagickFalse)
4056  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4057  if (wand->images == (Image *) NULL)
4058  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4059  return(GetImageAlphaChannel(wand->images));
4060 }
4061 
4062 /*
4063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4064 % %
4065 % %
4066 % %
4067 % M a g i c k G e t I m a g e C l i p M a s k %
4068 % %
4069 % %
4070 % %
4071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4072 %
4073 % MagickGetImageMask() gets the image clip mask at the current image index.
4074 %
4075 % The format of the MagickGetImageMask method is:
4076 %
4077 % MagickWand *MagickGetImageMask(MagickWand *wand)
4078 %
4079 % A description of each parameter follows:
4080 %
4081 % o wand: the magick wand.
4082 %
4083 % o type: type of mask, ReadPixelMask or WritePixelMask.
4084 %
4085 */
4086 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
4087  const PixelMask type)
4088 {
4089  Image
4090  *image;
4091 
4092  assert(wand != (MagickWand *) NULL);
4093  assert(wand->signature == MagickWandSignature);
4094  if (wand->debug != MagickFalse)
4095  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4096  if (wand->images == (Image *) NULL)
4097  {
4098  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4099  "ContainsNoImages","`%s'",wand->name);
4100  return((MagickWand *) NULL);
4101  }
4102  image=GetImageMask(wand->images,type,wand->exception);
4103  if (image == (Image *) NULL)
4104  return((MagickWand *) NULL);
4105  return(CloneMagickWandFromImages(wand,image));
4106 }
4107 
4108 /*
4109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4110 % %
4111 % %
4112 % %
4113 % 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 %
4114 % %
4115 % %
4116 % %
4117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4118 %
4119 % MagickGetImageBackgroundColor() returns the image background color.
4120 %
4121 % The format of the MagickGetImageBackgroundColor method is:
4122 %
4123 % MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4124 % PixelWand *background_color)
4125 %
4126 % A description of each parameter follows:
4127 %
4128 % o wand: the magick wand.
4129 %
4130 % o background_color: Return the background color.
4131 %
4132 */
4133 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4134  PixelWand *background_color)
4135 {
4136  assert(wand != (MagickWand *) NULL);
4137  assert(wand->signature == MagickWandSignature);
4138  if (wand->debug != MagickFalse)
4139  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4140  if (wand->images == (Image *) NULL)
4141  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4142  PixelSetPixelColor(background_color,&wand->images->background_color);
4143  return(MagickTrue);
4144 }
4145 
4146 /*
4147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4148 % %
4149 % %
4150 % %
4151 % M a g i c k G e t I m a g e B l o b %
4152 % %
4153 % %
4154 % %
4155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4156 %
4157 % MagickGetImageBlob() implements direct to memory image formats. It returns
4158 % the image as a blob (a formatted "file" in memory) and its length, starting
4159 % from the current position in the image sequence. Use MagickSetImageFormat()
4160 % to set the format to write to the blob (GIF, JPEG, PNG, etc.).
4161 %
4162 % Utilize MagickResetIterator() to ensure the write is from the beginning of
4163 % the image sequence.
4164 %
4165 % Use MagickRelinquishMemory() to free the blob when you are done with it.
4166 %
4167 % The format of the MagickGetImageBlob method is:
4168 %
4169 % unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4170 %
4171 % A description of each parameter follows:
4172 %
4173 % o wand: the magick wand.
4174 %
4175 % o length: the length of the blob.
4176 %
4177 */
4178 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4179 {
4180  unsigned char
4181  *blob;
4182 
4183  assert(wand != (MagickWand *) NULL);
4184  assert(wand->signature == MagickWandSignature);
4185  if (wand->debug != MagickFalse)
4186  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4187  if (wand->images == (Image *) NULL)
4188  {
4189  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4190  "ContainsNoImages","`%s'",wand->name);
4191  return((unsigned char *) NULL);
4192  }
4193  blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
4194  wand->exception);
4195  return(blob);
4196 }
4197 
4198 /*
4199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4200 % %
4201 % %
4202 % %
4203 % M a g i c k G e t I m a g e s B l o b %
4204 % %
4205 % %
4206 % %
4207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4208 %
4209 % MagickGetImagesBlob() implements direct to memory image formats. It
4210 % returns the image sequence as a blob and its length. The format of the image
4211 % determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
4212 % return a different image format, use MagickSetImageFormat().
4213 %
4214 % Note, some image formats do not permit multiple images to the same image
4215 % stream (e.g. JPEG). in this instance, just the first image of the
4216 % sequence is returned as a blob.
4217 %
4218 % The format of the MagickGetImagesBlob method is:
4219 %
4220 % unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4221 %
4222 % A description of each parameter follows:
4223 %
4224 % o wand: the magick wand.
4225 %
4226 % o length: the length of the blob.
4227 %
4228 */
4229 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4230 {
4231  unsigned char
4232  *blob;
4233 
4234  assert(wand != (MagickWand *) NULL);
4235  assert(wand->signature == MagickWandSignature);
4236  if (wand->debug != MagickFalse)
4237  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4238  if (wand->images == (Image *) NULL)
4239  {
4240  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4241  "ContainsNoImages","`%s'",wand->name);
4242  return((unsigned char *) NULL);
4243  }
4244  blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
4245  wand->images),length,wand->exception);
4246  return(blob);
4247 }
4248 
4249 /*
4250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4251 % %
4252 % %
4253 % %
4254 % 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 %
4255 % %
4256 % %
4257 % %
4258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4259 %
4260 % MagickGetImageBluePrimary() returns the chromaticity blue primary point for the
4261 % image.
4262 %
4263 % The format of the MagickGetImageBluePrimary method is:
4264 %
4265 % MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4266 % double *y,double *z)
4267 %
4268 % A description of each parameter follows:
4269 %
4270 % o wand: the magick wand.
4271 %
4272 % o x: the chromaticity blue primary x-point.
4273 %
4274 % o y: the chromaticity blue primary y-point.
4275 %
4276 % o z: the chromaticity blue primary z-point.
4277 %
4278 */
4279 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4280  double *x,double *y,double *z)
4281 {
4282  assert(wand != (MagickWand *) NULL);
4283  assert(wand->signature == MagickWandSignature);
4284  if (wand->debug != MagickFalse)
4285  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4286  if (wand->images == (Image *) NULL)
4287  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4288  *x=wand->images->chromaticity.blue_primary.x;
4289  *y=wand->images->chromaticity.blue_primary.y;
4290  *z=wand->images->chromaticity.blue_primary.z;
4291  return(MagickTrue);
4292 }
4293 
4294 /*
4295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4296 % %
4297 % %
4298 % %
4299 % 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 %
4300 % %
4301 % %
4302 % %
4303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4304 %
4305 % MagickGetImageBorderColor() returns the image border color.
4306 %
4307 % The format of the MagickGetImageBorderColor method is:
4308 %
4309 % MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4310 % PixelWand *border_color)
4311 %
4312 % A description of each parameter follows:
4313 %
4314 % o wand: the magick wand.
4315 %
4316 % o border_color: Return the border color.
4317 %
4318 */
4319 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4320  PixelWand *border_color)
4321 {
4322  assert(wand != (MagickWand *) NULL);
4323  assert(wand->signature == MagickWandSignature);
4324  if (wand->debug != MagickFalse)
4325  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4326  if (wand->images == (Image *) NULL)
4327  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4328  PixelSetPixelColor(border_color,&wand->images->border_color);
4329  return(MagickTrue);
4330 }
4331 
4332 /*
4333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4334 % %
4335 % %
4336 % %
4337 % M a g i c k G e t I m a g e F e a t u r e s %
4338 % %
4339 % %
4340 % %
4341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4342 %
4343 % MagickGetImageFeatures() returns features for each channel in the
4344 % image in each of four directions (horizontal, vertical, left and right
4345 % diagonals) for the specified distance. The features include the angular
4346 % second moment, contrast, correlation, sum of squares: variance, inverse
4347 % difference moment, sum average, sum variance, sum entropy, entropy,
4348 % difference variance, difference entropy, information measures of
4349 % correlation 1, information measures of correlation 2, and maximum
4350 % correlation coefficient. You can access the red channel contrast, for
4351 % example, like this:
4352 %
4353 % channel_features=MagickGetImageFeatures(wand,1);
4354 % contrast=channel_features[RedPixelChannel].contrast[0];
4355 %
4356 % Use MagickRelinquishMemory() to free the statistics buffer.
4357 %
4358 % The format of the MagickGetImageFeatures method is:
4359 %
4360 % ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4361 % const size_t distance)
4362 %
4363 % A description of each parameter follows:
4364 %
4365 % o wand: the magick wand.
4366 %
4367 % o distance: the distance.
4368 %
4369 */
4370 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4371  const size_t distance)
4372 {
4373  assert(wand != (MagickWand *) NULL);
4374  assert(wand->signature == MagickWandSignature);
4375  if (wand->debug != MagickFalse)
4376  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4377  if (wand->images == (Image *) NULL)
4378  {
4379  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4380  "ContainsNoImages","`%s'",wand->name);
4381  return((ChannelFeatures *) NULL);
4382  }
4383  return(GetImageFeatures(wand->images,distance,wand->exception));
4384 }
4385 
4386 /*
4387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4388 % %
4389 % %
4390 % %
4391 % M a g i c k G e t I m a g e K u r t o s i s %
4392 % %
4393 % %
4394 % %
4395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4396 %
4397 % MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4398 % more image channels.
4399 %
4400 % The format of the MagickGetImageKurtosis method is:
4401 %
4402 % MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4403 % double *kurtosis,double *skewness)
4404 %
4405 % A description of each parameter follows:
4406 %
4407 % o wand: the magick wand.
4408 %
4409 % o kurtosis: The kurtosis for the specified channel(s).
4410 %
4411 % o skewness: The skewness for the specified channel(s).
4412 %
4413 */
4414 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4415  double *kurtosis,double *skewness)
4416 {
4417  MagickBooleanType
4418  status;
4419 
4420  assert(wand != (MagickWand *) NULL);
4421  assert(wand->signature == MagickWandSignature);
4422  if (wand->debug != MagickFalse)
4423  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4424  if (wand->images == (Image *) NULL)
4425  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4426  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4427  return(status);
4428 }
4429 
4430 /*
4431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4432 % %
4433 % %
4434 % %
4435 % M a g i c k G e t I m a g e M e a n %
4436 % %
4437 % %
4438 % %
4439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4440 %
4441 % MagickGetImageMean() gets the mean and standard deviation of one or more
4442 % image channels.
4443 %
4444 % The format of the MagickGetImageMean method is:
4445 %
4446 % MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4447 % double *standard_deviation)
4448 %
4449 % A description of each parameter follows:
4450 %
4451 % o wand: the magick wand.
4452 %
4453 % o channel: the image channel(s).
4454 %
4455 % o mean: The mean pixel value for the specified channel(s).
4456 %
4457 % o standard_deviation: The standard deviation for the specified channel(s).
4458 %
4459 */
4460 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4461  double *standard_deviation)
4462 {
4463  MagickBooleanType
4464  status;
4465 
4466  assert(wand != (MagickWand *) NULL);
4467  assert(wand->signature == MagickWandSignature);
4468  if (wand->debug != MagickFalse)
4469  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4470  if (wand->images == (Image *) NULL)
4471  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4472  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4473  return(status);
4474 }
4475 
4476 /*
4477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4478 % %
4479 % %
4480 % %
4481 % M a g i c k G e t I m a g e R a n g e %
4482 % %
4483 % %
4484 % %
4485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4486 %
4487 % MagickGetImageRange() gets the range for one or more image channels.
4488 %
4489 % The format of the MagickGetImageRange method is:
4490 %
4491 % MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4492 % double *maxima)
4493 %
4494 % A description of each parameter follows:
4495 %
4496 % o wand: the magick wand.
4497 %
4498 % o minima: The minimum pixel value for the specified channel(s).
4499 %
4500 % o maxima: The maximum pixel value for the specified channel(s).
4501 %
4502 */
4503 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4504  double *minima,double *maxima)
4505 {
4506  MagickBooleanType
4507  status;
4508 
4509  assert(wand != (MagickWand *) NULL);
4510  assert(wand->signature == MagickWandSignature);
4511  if (wand->debug != MagickFalse)
4512  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4513  if (wand->images == (Image *) NULL)
4514  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4515  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4516  return(status);
4517 }
4518 
4519 /*
4520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4521 % %
4522 % %
4523 % %
4524 % M a g i c k G e t I m a g e S t a t i s t i c s %
4525 % %
4526 % %
4527 % %
4528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4529 %
4530 % MagickGetImageStatistics() returns statistics for each channel in the
4531 % image. The statistics include the channel depth, its minima and
4532 % maxima, the mean, the standard deviation, the kurtosis and the skewness.
4533 % You can access the red channel mean, for example, like this:
4534 %
4535 % channel_statistics=MagickGetImageStatistics(wand);
4536 % red_mean=channel_statistics[RedPixelChannel].mean;
4537 %
4538 % Use MagickRelinquishMemory() to free the statistics buffer.
4539 %
4540 % The format of the MagickGetImageStatistics method is:
4541 %
4542 % ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4543 %
4544 % A description of each parameter follows:
4545 %
4546 % o wand: the magick wand.
4547 %
4548 */
4549 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4550 {
4551  assert(wand != (MagickWand *) NULL);
4552  assert(wand->signature == MagickWandSignature);
4553  if (wand->debug != MagickFalse)
4554  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4555  if (wand->images == (Image *) NULL)
4556  {
4557  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4558  "ContainsNoImages","`%s'",wand->name);
4559  return((ChannelStatistics *) NULL);
4560  }
4561  return(GetImageStatistics(wand->images,wand->exception));
4562 }
4563 
4564 /*
4565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4566 % %
4567 % %
4568 % %
4569 % 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 %
4570 % %
4571 % %
4572 % %
4573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4574 %
4575 % MagickGetImageColormapColor() returns the color of the specified colormap
4576 % index.
4577 %
4578 % The format of the MagickGetImageColormapColor method is:
4579 %
4580 % MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4581 % const size_t index,PixelWand *color)
4582 %
4583 % A description of each parameter follows:
4584 %
4585 % o wand: the magick wand.
4586 %
4587 % o index: the offset into the image colormap.
4588 %
4589 % o color: Return the colormap color in this wand.
4590 %
4591 */
4592 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4593  const size_t index,PixelWand *color)
4594 {
4595  assert(wand != (MagickWand *) NULL);
4596  assert(wand->signature == MagickWandSignature);
4597  if (wand->debug != MagickFalse)
4598  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4599  if (wand->images == (Image *) NULL)
4600  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4601  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4602  (index >= wand->images->colors))
4603  {
4604  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4605  "InvalidColormapIndex","`%s'",wand->name);
4606  return(MagickFalse);
4607  }
4608  PixelSetPixelColor(color,wand->images->colormap+index);
4609  return(MagickTrue);
4610 }
4611 
4612 /*
4613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4614 % %
4615 % %
4616 % %
4617 % M a g i c k G e t I m a g e C o l o r s %
4618 % %
4619 % %
4620 % %
4621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4622 %
4623 % MagickGetImageColors() gets the number of unique colors in the image.
4624 %
4625 % The format of the MagickGetImageColors method is:
4626 %
4627 % size_t MagickGetImageColors(MagickWand *wand)
4628 %
4629 % A description of each parameter follows:
4630 %
4631 % o wand: the magick wand.
4632 %
4633 */
4634 WandExport size_t MagickGetImageColors(MagickWand *wand)
4635 {
4636  assert(wand != (MagickWand *) NULL);
4637  assert(wand->signature == MagickWandSignature);
4638  if (wand->debug != MagickFalse)
4639  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4640  if (wand->images == (Image *) NULL)
4641  {
4642  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4643  "ContainsNoImages","`%s'",wand->name);
4644  return(0);
4645  }
4646  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4647 }
4648 
4649 /*
4650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4651 % %
4652 % %
4653 % %
4654 % M a g i c k G e t I m a g e C o l o r s p a c e %
4655 % %
4656 % %
4657 % %
4658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4659 %
4660 % MagickGetImageColorspace() gets the image colorspace.
4661 %
4662 % The format of the MagickGetImageColorspace method is:
4663 %
4664 % ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4665 %
4666 % A description of each parameter follows:
4667 %
4668 % o wand: the magick wand.
4669 %
4670 */
4671 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4672 {
4673  assert(wand != (MagickWand *) NULL);
4674  assert(wand->signature == MagickWandSignature);
4675  if (wand->debug != MagickFalse)
4676  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4677  if (wand->images == (Image *) NULL)
4678  {
4679  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4680  "ContainsNoImages","`%s'",wand->name);
4681  return(UndefinedColorspace);
4682  }
4683  return(wand->images->colorspace);
4684 }
4685 
4686 /*
4687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4688 % %
4689 % %
4690 % %
4691 % M a g i c k G e t I m a g e C o m p o s e %
4692 % %
4693 % %
4694 % %
4695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4696 %
4697 % MagickGetImageCompose() returns the composite operator associated with the
4698 % image.
4699 %
4700 % The format of the MagickGetImageCompose method is:
4701 %
4702 % CompositeOperator MagickGetImageCompose(MagickWand *wand)
4703 %
4704 % A description of each parameter follows:
4705 %
4706 % o wand: the magick wand.
4707 %
4708 */
4709 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4710 {
4711  assert(wand != (MagickWand *) NULL);
4712  assert(wand->signature == MagickWandSignature);
4713  if (wand->debug != MagickFalse)
4714  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4715  if (wand->images == (Image *) NULL)
4716  {
4717  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4718  "ContainsNoImages","`%s'",wand->name);
4719  return(UndefinedCompositeOp);
4720  }
4721  return(wand->images->compose);
4722 }
4723 
4724 /*
4725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4726 % %
4727 % %
4728 % %
4729 % 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 %
4730 % %
4731 % %
4732 % %
4733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4734 %
4735 % MagickGetImageCompression() gets the image compression.
4736 %
4737 % The format of the MagickGetImageCompression method is:
4738 %
4739 % CompressionType MagickGetImageCompression(MagickWand *wand)
4740 %
4741 % A description of each parameter follows:
4742 %
4743 % o wand: the magick wand.
4744 %
4745 */
4746 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4747 {
4748  assert(wand != (MagickWand *) NULL);
4749  assert(wand->signature == MagickWandSignature);
4750  if (wand->debug != MagickFalse)
4751  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4752  if (wand->images == (Image *) NULL)
4753  {
4754  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4755  "ContainsNoImages","`%s'",wand->name);
4756  return(UndefinedCompression);
4757  }
4758  return(wand->images->compression);
4759 }
4760 
4761 /*
4762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4763 % %
4764 % %
4765 % %
4766 % 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 %
4767 % %
4768 % %
4769 % %
4770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4771 %
4772 % MagickGetImageCompressionQuality() gets the image compression quality.
4773 %
4774 % The format of the MagickGetImageCompressionQuality method is:
4775 %
4776 % size_t MagickGetImageCompressionQuality(MagickWand *wand)
4777 %
4778 % A description of each parameter follows:
4779 %
4780 % o wand: the magick wand.
4781 %
4782 */
4783 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4784 {
4785  assert(wand != (MagickWand *) NULL);
4786  assert(wand->signature == MagickWandSignature);
4787  if (wand->debug != MagickFalse)
4788  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4789  if (wand->images == (Image *) NULL)
4790  {
4791  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4792  "ContainsNoImages","`%s'",wand->name);
4793  return(0UL);
4794  }
4795  return(wand->images->quality);
4796 }
4797 
4798 /*
4799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4800 % %
4801 % %
4802 % %
4803 % M a g i c k G e t I m a g e D e l a y %
4804 % %
4805 % %
4806 % %
4807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4808 %
4809 % MagickGetImageDelay() gets the image delay.
4810 %
4811 % The format of the MagickGetImageDelay method is:
4812 %
4813 % size_t MagickGetImageDelay(MagickWand *wand)
4814 %
4815 % A description of each parameter follows:
4816 %
4817 % o wand: the magick wand.
4818 %
4819 */
4820 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4821 {
4822  assert(wand != (MagickWand *) NULL);
4823  assert(wand->signature == MagickWandSignature);
4824  if (wand->debug != MagickFalse)
4825  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4826  if (wand->images == (Image *) NULL)
4827  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4828  return(wand->images->delay);
4829 }
4830 
4831 /*
4832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4833 % %
4834 % %
4835 % %
4836 % M a g i c k G e t I m a g e D e p t h %
4837 % %
4838 % %
4839 % %
4840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4841 %
4842 % MagickGetImageDepth() gets the image depth.
4843 %
4844 % The format of the MagickGetImageDepth method is:
4845 %
4846 % size_t MagickGetImageDepth(MagickWand *wand)
4847 %
4848 % A description of each parameter follows:
4849 %
4850 % o wand: the magick wand.
4851 %
4852 */
4853 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4854 {
4855  assert(wand != (MagickWand *) NULL);
4856  assert(wand->signature == MagickWandSignature);
4857  if (wand->debug != MagickFalse)
4858  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4859  if (wand->images == (Image *) NULL)
4860  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4861  return(wand->images->depth);
4862 }
4863 
4864 /*
4865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4866 % %
4867 % %
4868 % %
4869 % M a g i c k G e t I m a g e D i s p o s e %
4870 % %
4871 % %
4872 % %
4873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4874 %
4875 % MagickGetImageDispose() gets the image disposal method.
4876 %
4877 % The format of the MagickGetImageDispose method is:
4878 %
4879 % DisposeType MagickGetImageDispose(MagickWand *wand)
4880 %
4881 % A description of each parameter follows:
4882 %
4883 % o wand: the magick wand.
4884 %
4885 */
4886 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4887 {
4888  assert(wand != (MagickWand *) NULL);
4889  assert(wand->signature == MagickWandSignature);
4890  if (wand->debug != MagickFalse)
4891  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4892  if (wand->images == (Image *) NULL)
4893  {
4894  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4895  "ContainsNoImages","`%s'",wand->name);
4896  return(UndefinedDispose);
4897  }
4898  return((DisposeType) wand->images->dispose);
4899 }
4900 
4901 /*
4902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4903 % %
4904 % %
4905 % %
4906 % M a g i c k G e t I m a g e D i s t o r t i o n %
4907 % %
4908 % %
4909 % %
4910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4911 %
4912 % MagickGetImageDistortion() compares an image to a reconstructed image and
4913 % returns the specified distortion metric.
4914 %
4915 % The format of the MagickGetImageDistortion method is:
4916 %
4917 % MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4918 % const MagickWand *reference,const MetricType metric,
4919 % double *distortion)
4920 %
4921 % A description of each parameter follows:
4922 %
4923 % o wand: the magick wand.
4924 %
4925 % o reference: the reference wand.
4926 %
4927 % o metric: the metric.
4928 %
4929 % o distortion: the computed distortion between the images.
4930 %
4931 */
4932 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4933  const MagickWand *reference,const MetricType metric,double *distortion)
4934 {
4935  MagickBooleanType
4936  status;
4937 
4938  assert(wand != (MagickWand *) NULL);
4939  assert(wand->signature == MagickWandSignature);
4940  if (wand->debug != MagickFalse)
4941  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4942  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4943  ThrowWandException(WandError,"ContainsNoImages",wand->name);
4944  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4945  wand->exception);
4946  return(status);
4947 }
4948 
4949 /*
4950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4951 % %
4952 % %
4953 % %
4954 % 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 %
4955 % %
4956 % %
4957 % %
4958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4959 %
4960 % MagickGetImageDistortions() compares one or more pixel channels of an
4961 % image to a reconstructed image and returns the specified distortion metrics.
4962 %
4963 % Use MagickRelinquishMemory() to free the metrics when you are done with them.
4964 %
4965 % The format of the MagickGetImageDistortion method is:
4966 %
4967 % double *MagickGetImageDistortion(MagickWand *wand,
4968 % const MagickWand *reference,const MetricType metric)
4969 %
4970 % A description of each parameter follows:
4971 %
4972 % o wand: the magick wand.
4973 %
4974 % o reference: the reference wand.
4975 %
4976 % o metric: the metric.
4977 %
4978 */
4979 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4980  const MagickWand *reference,const MetricType metric)
4981 {
4982  double
4983  *channel_distortion;
4984 
4985  assert(wand != (MagickWand *) NULL);
4986  assert(wand->signature == MagickWandSignature);
4987  if (wand->debug != MagickFalse)
4988  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4989  assert(reference != (MagickWand *) NULL);
4990  assert(reference->signature == MagickWandSignature);
4991  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4992  {
4993  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4994  "ContainsNoImages","`%s'",wand->name);
4995  return((double *) NULL);
4996  }
4997  channel_distortion=GetImageDistortions(wand->images,reference->images,
4998  metric,wand->exception);
4999  return(channel_distortion);
5000 }
5001 
5002 /*
5003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5004 % %
5005 % %
5006 % %
5007 % M a g i c k G e t I m a g e E n d i a n %
5008 % %
5009 % %
5010 % %
5011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5012 %
5013 % MagickGetImageEndian() gets the image endian.
5014 %
5015 % The format of the MagickGetImageEndian method is:
5016 %
5017 % EndianType MagickGetImageEndian(MagickWand *wand)
5018 %
5019 % A description of each parameter follows:
5020 %
5021 % o wand: the magick wand.
5022 %
5023 */
5024 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
5025 {
5026  assert(wand != (MagickWand *) NULL);
5027  assert(wand->signature == MagickWandSignature);
5028  if (wand->debug != MagickFalse)
5029  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5030  if (wand->images == (Image *) NULL)
5031  {
5032  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5033  "ContainsNoImages","`%s'",wand->name);
5034  return(UndefinedEndian);
5035  }
5036  return(wand->images->endian);
5037 }
5038 
5039 /*
5040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5041 % %
5042 % %
5043 % %
5044 % M a g i c k G e t I m a g e F i l e n a m e %
5045 % %
5046 % %
5047 % %
5048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5049 %
5050 % MagickGetImageFilename() returns the filename of a particular image in a
5051 % sequence.
5052 %
5053 % The format of the MagickGetImageFilename method is:
5054 %
5055 % char *MagickGetImageFilename(MagickWand *wand)
5056 %
5057 % A description of each parameter follows:
5058 %
5059 % o wand: the magick wand.
5060 %
5061 */
5062 WandExport char *MagickGetImageFilename(MagickWand *wand)
5063 {
5064  assert(wand != (MagickWand *) NULL);
5065  assert(wand->signature == MagickWandSignature);
5066  if (wand->debug != MagickFalse)
5067  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5068  if (wand->images == (Image *) NULL)
5069  {
5070  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5071  "ContainsNoImages","`%s'",wand->name);
5072  return((char *) NULL);
5073  }
5074  return(AcquireString(wand->images->filename));
5075 }
5076 
5077 /*
5078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5079 % %
5080 % %
5081 % %
5082 % M a g i c k G e t I m a g e F i l t e r %
5083 % %
5084 % %
5085 % %
5086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5087 %
5088 % MagickGetImageFilter() gets the image filter.
5089 %
5090 % The format of the MagickGetImageFilter method is:
5091 %
5092 % FilterType MagickGetImageFilter(MagickWand *wand)
5093 %
5094 % A description of each parameter follows:
5095 %
5096 % o wand: the magick wand.
5097 %
5098 */
5099 WandExport FilterType MagickGetImageFilter(MagickWand *wand)
5100 {
5101  assert(wand != (MagickWand *) NULL);
5102  assert(wand->signature == MagickWandSignature);
5103  if (wand->debug != MagickFalse)
5104  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5105  if (wand->images == (Image *) NULL)
5106  {
5107  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5108  "ContainsNoImages","`%s'",wand->name);
5109  return(UndefinedFilter);
5110  }
5111  return(wand->images->filter);
5112 }
5113 
5114 /*
5115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5116 % %
5117 % %
5118 % %
5119 % M a g i c k G e t I m a g e F o r m a t %
5120 % %
5121 % %
5122 % %
5123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5124 %
5125 % MagickGetImageFormat() returns the format of a particular image in a
5126 % sequence.
5127 %
5128 % The format of the MagickGetImageFormat method is:
5129 %
5130 % char *MagickGetImageFormat(MagickWand *wand)
5131 %
5132 % A description of each parameter follows:
5133 %
5134 % o wand: the magick wand.
5135 %
5136 */
5137 WandExport char *MagickGetImageFormat(MagickWand *wand)
5138 {
5139  assert(wand != (MagickWand *) NULL);
5140  assert(wand->signature == MagickWandSignature);
5141  if (wand->debug != MagickFalse)
5142  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5143  if (wand->images == (Image *) NULL)
5144  {
5145  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5146  "ContainsNoImages","`%s'",wand->name);
5147  return((char *) NULL);
5148  }
5149  return(AcquireString(wand->images->magick));
5150 }
5151 
5152 /*
5153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5154 % %
5155 % %
5156 % %
5157 % M a g i c k G e t I m a g e F u z z %
5158 % %
5159 % %
5160 % %
5161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5162 %
5163 % MagickGetImageFuzz() gets the image fuzz.
5164 %
5165 % The format of the MagickGetImageFuzz method is:
5166 %
5167 % double MagickGetImageFuzz(MagickWand *wand)
5168 %
5169 % A description of each parameter follows:
5170 %
5171 % o wand: the magick wand.
5172 %
5173 */
5174 WandExport double MagickGetImageFuzz(MagickWand *wand)
5175 {
5176  assert(wand != (MagickWand *) NULL);
5177  assert(wand->signature == MagickWandSignature);
5178  if (wand->debug != MagickFalse)
5179  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5180  if (wand->images == (Image *) NULL)
5181  {
5182  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5183  "ContainsNoImages","`%s'",wand->name);
5184  return(0.0);
5185  }
5186  return(wand->images->fuzz);
5187 }
5188 
5189 /*
5190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5191 % %
5192 % %
5193 % %
5194 % M a g i c k G e t I m a g e G a m m a %
5195 % %
5196 % %
5197 % %
5198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5199 %
5200 % MagickGetImageGamma() gets the image gamma.
5201 %
5202 % The format of the MagickGetImageGamma method is:
5203 %
5204 % double MagickGetImageGamma(MagickWand *wand)
5205 %
5206 % A description of each parameter follows:
5207 %
5208 % o wand: the magick wand.
5209 %
5210 */
5211 WandExport double MagickGetImageGamma(MagickWand *wand)
5212 {
5213  assert(wand != (MagickWand *) NULL);
5214  assert(wand->signature == MagickWandSignature);
5215  if (wand->debug != MagickFalse)
5216  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5217  if (wand->images == (Image *) NULL)
5218  {
5219  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5220  "ContainsNoImages","`%s'",wand->name);
5221  return(0.0);
5222  }
5223  return(wand->images->gamma);
5224 }
5225 
5226 /*
5227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5228 % %
5229 % %
5230 % %
5231 % M a g i c k G e t I m a g e G r a v i t y %
5232 % %
5233 % %
5234 % %
5235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5236 %
5237 % MagickGetImageGravity() gets the image gravity.
5238 %
5239 % The format of the MagickGetImageGravity method is:
5240 %
5241 % GravityType MagickGetImageGravity(MagickWand *wand)
5242 %
5243 % A description of each parameter follows:
5244 %
5245 % o wand: the magick wand.
5246 %
5247 */
5248 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5249 {
5250  assert(wand != (MagickWand *) NULL);
5251  assert(wand->signature == MagickWandSignature);
5252  if (wand->debug != MagickFalse)
5253  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5254  if (wand->images == (Image *) NULL)
5255  {
5256  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5257  "ContainsNoImages","`%s'",wand->name);
5258  return(UndefinedGravity);
5259  }
5260  return(wand->images->gravity);
5261 }
5262 
5263 /*
5264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5265 % %
5266 % %
5267 % %
5268 % 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 %
5269 % %
5270 % %
5271 % %
5272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5273 %
5274 % MagickGetImageGreenPrimary() returns the chromaticity green primary point.
5275 %
5276 % The format of the MagickGetImageGreenPrimary method is:
5277 %
5278 % MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5279 % double *y,double *z)
5280 %
5281 % A description of each parameter follows:
5282 %
5283 % o wand: the magick wand.
5284 %
5285 % o x: the chromaticity green primary x-point.
5286 %
5287 % o y: the chromaticity green primary y-point.
5288 %
5289 % o z: the chromaticity green primary z-point.
5290 %
5291 */
5292 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5293  double *x,double *y,double *z)
5294 {
5295  assert(wand != (MagickWand *) NULL);
5296  assert(wand->signature == MagickWandSignature);
5297  if (wand->debug != MagickFalse)
5298  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5299  if (wand->images == (Image *) NULL)
5300  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5301  *x=wand->images->chromaticity.green_primary.x;
5302  *y=wand->images->chromaticity.green_primary.y;
5303  *z=wand->images->chromaticity.green_primary.z;
5304  return(MagickTrue);
5305 }
5306 
5307 /*
5308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5309 % %
5310 % %
5311 % %
5312 % M a g i c k G e t I m a g e H e i g h t %
5313 % %
5314 % %
5315 % %
5316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5317 %
5318 % MagickGetImageHeight() returns the image height.
5319 %
5320 % The format of the MagickGetImageHeight method is:
5321 %
5322 % size_t MagickGetImageHeight(MagickWand *wand)
5323 %
5324 % A description of each parameter follows:
5325 %
5326 % o wand: the magick wand.
5327 %
5328 */
5329 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5330 {
5331  assert(wand != (MagickWand *) NULL);
5332  assert(wand->signature == MagickWandSignature);
5333  if (wand->debug != MagickFalse)
5334  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5335  if (wand->images == (Image *) NULL)
5336  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5337  return(wand->images->rows);
5338 }
5339 
5340 /*
5341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5342 % %
5343 % %
5344 % %
5345 % M a g i c k G e t I m a g e H i s t o g r a m %
5346 % %
5347 % %
5348 % %
5349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5350 %
5351 % MagickGetImageHistogram() returns the image histogram as an array of
5352 % PixelWand wands.
5353 %
5354 % The format of the MagickGetImageHistogram method is:
5355 %
5356 % PixelWand **MagickGetImageHistogram(MagickWand *wand,
5357 % size_t *number_colors)
5358 %
5359 % A description of each parameter follows:
5360 %
5361 % o wand: the magick wand.
5362 %
5363 % o number_colors: the number of unique colors in the image and the number
5364 % of pixel wands returned.
5365 %
5366 */
5367 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5368  size_t *number_colors)
5369 {
5370  PixelInfo
5371  *histogram;
5372 
5373  PixelWand
5374  **pixel_wands;
5375 
5376  ssize_t
5377  i;
5378 
5379  assert(wand != (MagickWand *) NULL);
5380  assert(wand->signature == MagickWandSignature);
5381  if (wand->debug != MagickFalse)
5382  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5383  if (wand->images == (Image *) NULL)
5384  {
5385  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5386  "ContainsNoImages","`%s'",wand->name);
5387  return((PixelWand **) NULL);
5388  }
5389  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5390  if (histogram == (PixelInfo *) NULL)
5391  return((PixelWand **) NULL);
5392  pixel_wands=NewPixelWands(*number_colors);
5393  for (i=0; i < (ssize_t) *number_colors; i++)
5394  {
5395  PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5396  PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5397  }
5398  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5399  return(pixel_wands);
5400 }
5401 
5402 /*
5403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5404 % %
5405 % %
5406 % %
5407 % 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 %
5408 % %
5409 % %
5410 % %
5411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5412 %
5413 % MagickGetImageInterlaceScheme() gets the image interlace scheme.
5414 %
5415 % The format of the MagickGetImageInterlaceScheme method is:
5416 %
5417 % InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5418 %
5419 % A description of each parameter follows:
5420 %
5421 % o wand: the magick wand.
5422 %
5423 */
5424 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5425 {
5426  assert(wand != (MagickWand *) NULL);
5427  assert(wand->signature == MagickWandSignature);
5428  if (wand->debug != MagickFalse)
5429  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5430  if (wand->images == (Image *) NULL)
5431  {
5432  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5433  "ContainsNoImages","`%s'",wand->name);
5434  return(UndefinedInterlace);
5435  }
5436  return(wand->images->interlace);
5437 }
5438 
5439 /*
5440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5441 % %
5442 % %
5443 % %
5444 % 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 %
5445 % %
5446 % %
5447 % %
5448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5449 %
5450 % MagickGetImageInterpolateMethod() returns the interpolation method for the
5451 % specified image.
5452 %
5453 % The format of the MagickGetImageInterpolateMethod method is:
5454 %
5455 % PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5456 %
5457 % A description of each parameter follows:
5458 %
5459 % o wand: the magick wand.
5460 %
5461 */
5462 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5463  MagickWand *wand)
5464 {
5465  assert(wand != (MagickWand *) NULL);
5466  assert(wand->signature == MagickWandSignature);
5467  if (wand->debug != MagickFalse)
5468  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5469  if (wand->images == (Image *) NULL)
5470  {
5471  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5472  "ContainsNoImages","`%s'",wand->name);
5473  return(UndefinedInterpolatePixel);
5474  }
5475  return(wand->images->interpolate);
5476 }
5477 
5478 /*
5479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5480 % %
5481 % %
5482 % %
5483 % M a g i c k G e t I m a g e I t e r a t i o n s %
5484 % %
5485 % %
5486 % %
5487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5488 %
5489 % MagickGetImageIterations() gets the image iterations.
5490 %
5491 % The format of the MagickGetImageIterations method is:
5492 %
5493 % size_t MagickGetImageIterations(MagickWand *wand)
5494 %
5495 % A description of each parameter follows:
5496 %
5497 % o wand: the magick wand.
5498 %
5499 */
5500 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5501 {
5502  assert(wand != (MagickWand *) NULL);
5503  assert(wand->signature == MagickWandSignature);
5504  if (wand->debug != MagickFalse)
5505  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5506  if (wand->images == (Image *) NULL)
5507  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5508  return(wand->images->iterations);
5509 }
5510 
5511 /*
5512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5513 % %
5514 % %
5515 % %
5516 % M a g i c k G e t I m a g e L e n g t h %
5517 % %
5518 % %
5519 % %
5520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5521 %
5522 % MagickGetImageLength() returns the image length in bytes.
5523 %
5524 % The format of the MagickGetImageLength method is:
5525 %
5526 % MagickBooleanType MagickGetImageLength(MagickWand *wand,
5527 % MagickSizeType *length)
5528 %
5529 % A description of each parameter follows:
5530 %
5531 % o wand: the magick wand.
5532 %
5533 % o length: the image length in bytes.
5534 %
5535 */
5536 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5537  MagickSizeType *length)
5538 {
5539  assert(wand != (MagickWand *) NULL);
5540  assert(wand->signature == MagickWandSignature);
5541  if (wand->debug != MagickFalse)
5542  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5543  if (wand->images == (Image *) NULL)
5544  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5545  *length=GetBlobSize(wand->images);
5546  return(MagickTrue);
5547 }
5548 
5549 /*
5550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5551 % %
5552 % %
5553 % %
5554 % M a g i c k G e t I m a g e M a t t e C o l o r %
5555 % %
5556 % %
5557 % %
5558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5559 %
5560 % MagickGetImageMatteColor() returns the image matte color.
5561 %
5562 % The format of the MagickGetImageMatteColor method is:
5563 %
5564 % MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5565 % PixelWand *matte_color)
5566 %
5567 % A description of each parameter follows:
5568 %
5569 % o wand: the magick wand.
5570 %
5571 % o matte_color: return the alpha color.
5572 %
5573 */
5574 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5575  PixelWand *matte_color)
5576 {
5577  assert(wand != (MagickWand *)NULL);
5578  assert(wand->signature == MagickWandSignature);
5579  if (wand->debug != MagickFalse)
5580  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5581  if (wand->images == (Image *)NULL)
5582  ThrowWandException(WandError, "ContainsNoImages", wand->name);
5583  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5584  return(MagickTrue);
5585 }
5586 
5587 /*
5588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5589 % %
5590 % %
5591 % %
5592 % 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 %
5593 % %
5594 % %
5595 % %
5596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5597 %
5598 % MagickGetImageOrientation() returns the image orientation.
5599 %
5600 % The format of the MagickGetImageOrientation method is:
5601 %
5602 % OrientationType MagickGetImageOrientation(MagickWand *wand)
5603 %
5604 % A description of each parameter follows:
5605 %
5606 % o wand: the magick wand.
5607 %
5608 */
5609 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5610 {
5611  assert(wand != (MagickWand *) NULL);
5612  assert(wand->signature == MagickWandSignature);
5613  if (wand->debug != MagickFalse)
5614  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5615  if (wand->images == (Image *) NULL)
5616  {
5617  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5618  "ContainsNoImages","`%s'",wand->name);
5619  return(UndefinedOrientation);
5620  }
5621  return(wand->images->orientation);
5622 }
5623 
5624 /*
5625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5626 % %
5627 % %
5628 % %
5629 % M a g i c k G e t I m a g e P a g e %
5630 % %
5631 % %
5632 % %
5633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634 %
5635 % MagickGetImagePage() returns the page geometry associated with the image.
5636 %
5637 % The format of the MagickGetImagePage method is:
5638 %
5639 % MagickBooleanType MagickGetImagePage(MagickWand *wand,
5640 % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5641 %
5642 % A description of each parameter follows:
5643 %
5644 % o wand: the magick wand.
5645 %
5646 % o width: the page width.
5647 %
5648 % o height: the page height.
5649 %
5650 % o x: the page x-offset.
5651 %
5652 % o y: the page y-offset.
5653 %
5654 */
5655 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5656  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5657 {
5658  assert(wand != (const MagickWand *) NULL);
5659  assert(wand->signature == MagickWandSignature);
5660  if (wand->debug != MagickFalse)
5661  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5662  if (wand->images == (Image *) NULL)
5663  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5664  *width=wand->images->page.width;
5665  *height=wand->images->page.height;
5666  *x=wand->images->page.x;
5667  *y=wand->images->page.y;
5668  return(MagickTrue);
5669 }
5670 
5671 /*
5672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5673 % %
5674 % %
5675 % %
5676 % M a g i c k G e t I m a g e P i x e l C o l o r %
5677 % %
5678 % %
5679 % %
5680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5681 %
5682 % MagickGetImagePixelColor() gets the color of the specified pixel.
5683 %
5684 % The format of the MagickGetImagePixelColor method is:
5685 %
5686 % MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5687 % const ssize_t x,const ssize_t y,PixelWand *color)
5688 %
5689 % A description of each parameter follows:
5690 %
5691 % o wand: the magick wand.
5692 %
5693 % o x,y: the pixel offset into the image.
5694 %
5695 % o color: Return the colormap color in this wand.
5696 %
5697 */
5698 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5699  const ssize_t x,const ssize_t y,PixelWand *color)
5700 {
5701  const Quantum
5702  *p;
5703 
5704  CacheView
5705  *image_view;
5706 
5707  assert(wand != (MagickWand *) NULL);
5708  assert(wand->signature == MagickWandSignature);
5709  if (wand->debug != MagickFalse)
5710  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5711  if (wand->images == (Image *) NULL)
5712  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5713  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5714  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5715  if (p == (const Quantum *) NULL)
5716  {
5717  image_view=DestroyCacheView(image_view);
5718  return(MagickFalse);
5719  }
5720  PixelSetQuantumPixel(wand->images,p,color);
5721  image_view=DestroyCacheView(image_view);
5722  return(MagickTrue);
5723 }
5724 
5725 /*
5726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5727 % %
5728 % %
5729 % %
5730 % M a g i c k G e t I m a g e R e d P r i m a r y %
5731 % %
5732 % %
5733 % %
5734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5735 %
5736 % MagickGetImageRedPrimary() returns the chromaticity red primary point.
5737 %
5738 % The format of the MagickGetImageRedPrimary method is:
5739 %
5740 % MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5741 % double *y, double *z)
5742 %
5743 % A description of each parameter follows:
5744 %
5745 % o wand: the magick wand.
5746 %
5747 % o x: the chromaticity red primary x-point.
5748 %
5749 % o y: the chromaticity red primary y-point.
5750 %
5751 % o z: the chromaticity red primary z-point.
5752 %
5753 */
5754 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5755  double *x,double *y,double *z)
5756 {
5757  assert(wand != (MagickWand *) NULL);
5758  assert(wand->signature == MagickWandSignature);
5759  if (wand->debug != MagickFalse)
5760  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5761  if (wand->images == (Image *) NULL)
5762  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5763  *x=wand->images->chromaticity.red_primary.x;
5764  *y=wand->images->chromaticity.red_primary.y;
5765  *z=wand->images->chromaticity.red_primary.z;
5766  return(MagickTrue);
5767 }
5768 
5769 /*
5770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5771 % %
5772 % %
5773 % %
5774 % M a g i c k G e t I m a g e R e g i o n %
5775 % %
5776 % %
5777 % %
5778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5779 %
5780 % MagickGetImageRegion() extracts a region of the image and returns it as a
5781 % a new wand.
5782 %
5783 % The format of the MagickGetImageRegion method is:
5784 %
5785 % MagickWand *MagickGetImageRegion(MagickWand *wand,
5786 % const size_t width,const size_t height,const ssize_t x,
5787 % const ssize_t y)
5788 %
5789 % A description of each parameter follows:
5790 %
5791 % o wand: the magick wand.
5792 %
5793 % o width: the region width.
5794 %
5795 % o height: the region height.
5796 %
5797 % o x: the region x offset.
5798 %
5799 % o y: the region y offset.
5800 %
5801 */
5802 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5803  const size_t width,const size_t height,const ssize_t x,
5804  const ssize_t y)
5805 {
5806  Image
5807  *region_image;
5808 
5809  RectangleInfo
5810  region;
5811 
5812  assert(wand != (MagickWand *) NULL);
5813  assert(wand->signature == MagickWandSignature);
5814  if (wand->debug != MagickFalse)
5815  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5816  if (wand->images == (Image *) NULL)
5817  return((MagickWand *) NULL);
5818  region.width=width;
5819  region.height=height;
5820  region.x=x;
5821  region.y=y;
5822  region_image=CropImage(wand->images,&region,wand->exception);
5823  if (region_image == (Image *) NULL)
5824  return((MagickWand *) NULL);
5825  return(CloneMagickWandFromImages(wand,region_image));
5826 }
5827 
5828 /*
5829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5830 % %
5831 % %
5832 % %
5833 % 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 %
5834 % %
5835 % %
5836 % %
5837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5838 %
5839 % MagickGetImageRenderingIntent() gets the image rendering intent.
5840 %
5841 % The format of the MagickGetImageRenderingIntent method is:
5842 %
5843 % RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5844 %
5845 % A description of each parameter follows:
5846 %
5847 % o wand: the magick wand.
5848 %
5849 */
5850 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5851 {
5852  assert(wand != (MagickWand *) NULL);
5853  assert(wand->signature == MagickWandSignature);
5854  if (wand->debug != MagickFalse)
5855  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5856  if (wand->images == (Image *) NULL)
5857  {
5858  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5859  "ContainsNoImages","`%s'",wand->name);
5860  return(UndefinedIntent);
5861  }
5862  return((RenderingIntent) wand->images->rendering_intent);
5863 }
5864 
5865 /*
5866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5867 % %
5868 % %
5869 % %
5870 % M a g i c k G e t I m a g e R e s o l u t i o n %
5871 % %
5872 % %
5873 % %
5874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5875 %
5876 % MagickGetImageResolution() gets the image X and Y resolution.
5877 %
5878 % The format of the MagickGetImageResolution method is:
5879 %
5880 % MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5881 % double *y)
5882 %
5883 % A description of each parameter follows:
5884 %
5885 % o wand: the magick wand.
5886 %
5887 % o x: the image x-resolution.
5888 %
5889 % o y: the image y-resolution.
5890 %
5891 */
5892 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5893  double *x,double *y)
5894 {
5895  assert(wand != (MagickWand *) NULL);
5896  assert(wand->signature == MagickWandSignature);
5897  if (wand->debug != MagickFalse)
5898  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5899  if (wand->images == (Image *) NULL)
5900  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5901  *x=wand->images->resolution.x;
5902  *y=wand->images->resolution.y;
5903  return(MagickTrue);
5904 }
5905 
5906 /*
5907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5908 % %
5909 % %
5910 % %
5911 % M a g i c k G e t I m a g e S c e n e %
5912 % %
5913 % %
5914 % %
5915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5916 %
5917 % MagickGetImageScene() gets the image scene.
5918 %
5919 % The format of the MagickGetImageScene method is:
5920 %
5921 % size_t MagickGetImageScene(MagickWand *wand)
5922 %
5923 % A description of each parameter follows:
5924 %
5925 % o wand: the magick wand.
5926 %
5927 */
5928 WandExport size_t MagickGetImageScene(MagickWand *wand)
5929 {
5930  assert(wand != (MagickWand *) NULL);
5931  assert(wand->signature == MagickWandSignature);
5932  if (wand->debug != MagickFalse)
5933  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5934  if (wand->images == (Image *) NULL)
5935  ThrowWandException(WandError,"ContainsNoImages",wand->name);
5936  return(wand->images->scene);
5937 }
5938 
5939 /*
5940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5941 % %
5942 % %
5943 % %
5944 % M a g i c k G e t I m a g e S i g n a t u r e %
5945 % %
5946 % %
5947 % %
5948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5949 %
5950 % MagickGetImageSignature() generates an SHA-256 message digest for the image
5951 % pixel stream.
5952 %
5953 % The format of the MagickGetImageSignature method is:
5954 %
5955 % char *MagickGetImageSignature(MagickWand *wand)
5956 %
5957 % A description of each parameter follows:
5958 %
5959 % o wand: the magick wand.
5960 %
5961 */
5962 WandExport char *MagickGetImageSignature(MagickWand *wand)
5963 {
5964  const char
5965  *value;
5966 
5967  MagickBooleanType
5968  status;
5969 
5970  assert(wand != (MagickWand *) NULL);
5971  assert(wand->signature == MagickWandSignature);
5972  if (wand->debug != MagickFalse)
5973  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5974  if (wand->images == (Image *) NULL)
5975  {
5976  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5977  "ContainsNoImages","`%s'",wand->name);
5978  return((char *) NULL);
5979  }
5980  status=SignatureImage(wand->images,wand->exception);
5981  if (status == MagickFalse)
5982  return((char *) NULL);
5983  value=GetImageProperty(wand->images,"signature",wand->exception);
5984  if (value == (const char *) NULL)
5985  return((char *) NULL);
5986  return(AcquireString(value));
5987 }
5988 
5989 /*
5990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5991 % %
5992 % %
5993 % %
5994 % 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 %
5995 % %
5996 % %
5997 % %
5998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5999 %
6000 % MagickGetImageTicksPerSecond() gets the image ticks-per-second.
6001 %
6002 % The format of the MagickGetImageTicksPerSecond method is:
6003 %
6004 % size_t MagickGetImageTicksPerSecond(MagickWand *wand)
6005 %
6006 % A description of each parameter follows:
6007 %
6008 % o wand: the magick wand.
6009 %
6010 */
6011 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
6012 {
6013  assert(wand != (MagickWand *) NULL);
6014  assert(wand->signature == MagickWandSignature);
6015  if (wand->debug != MagickFalse)
6016  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6017  if (wand->images == (Image *) NULL)
6018  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6019  return((size_t) wand->images->ticks_per_second);
6020 }
6021 
6022 /*
6023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6024 % %
6025 % %
6026 % %
6027 % M a g i c k G e t I m a g e T y p e %
6028 % %
6029 % %
6030 % %
6031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6032 %
6033 % MagickGetImageType() gets the potential image type:
6034 %
6035 % Bilevel Grayscale GrayscaleMatte
6036 % Palette PaletteMatte TrueColor
6037 % TrueColorMatte ColorSeparation ColorSeparationMatte
6038 %
6039 % The format of the MagickGetImageType method is:
6040 %
6041 % ImageType MagickGetImageType(MagickWand *wand)
6042 %
6043 % A description of each parameter follows:
6044 %
6045 % o wand: the magick wand.
6046 %
6047 */
6048 WandExport ImageType MagickGetImageType(MagickWand *wand)
6049 {
6050  assert(wand != (MagickWand *) NULL);
6051  assert(wand->signature == MagickWandSignature);
6052  if (wand->debug != MagickFalse)
6053  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6054  if (wand->images == (Image *) NULL)
6055  {
6056  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6057  "ContainsNoImages","`%s'",wand->name);
6058  return(UndefinedType);
6059  }
6060  return(GetImageType(wand->images));
6061 }
6062 
6063 /*
6064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6065 % %
6066 % %
6067 % %
6068 % M a g i c k G e t I m a g e U n i t s %
6069 % %
6070 % %
6071 % %
6072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6073 %
6074 % MagickGetImageUnits() gets the image units of resolution.
6075 %
6076 % The format of the MagickGetImageUnits method is:
6077 %
6078 % ResolutionType MagickGetImageUnits(MagickWand *wand)
6079 %
6080 % A description of each parameter follows:
6081 %
6082 % o wand: the magick wand.
6083 %
6084 */
6085 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
6086 {
6087  assert(wand != (MagickWand *) NULL);
6088  assert(wand->signature == MagickWandSignature);
6089  if (wand->debug != MagickFalse)
6090  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6091  if (wand->images == (Image *) NULL)
6092  {
6093  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6094  "ContainsNoImages","`%s'",wand->name);
6095  return(UndefinedResolution);
6096  }
6097  return(wand->images->units);
6098 }
6099 
6100 /*
6101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6102 % %
6103 % %
6104 % %
6105 % 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 %
6106 % %
6107 % %
6108 % %
6109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6110 %
6111 % MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6112 % specified image.
6113 %
6114 % The format of the MagickGetImageVirtualPixelMethod method is:
6115 %
6116 % VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6117 %
6118 % A description of each parameter follows:
6119 %
6120 % o wand: the magick wand.
6121 %
6122 */
6123 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6124 {
6125  assert(wand != (MagickWand *) NULL);
6126  assert(wand->signature == MagickWandSignature);
6127  if (wand->debug != MagickFalse)
6128  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6129  if (wand->images == (Image *) NULL)
6130  {
6131  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6132  "ContainsNoImages","`%s'",wand->name);
6133  return(UndefinedVirtualPixelMethod);
6134  }
6135  return(GetImageVirtualPixelMethod(wand->images));
6136 }
6137 
6138 /*
6139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6140 % %
6141 % %
6142 % %
6143 % M a g i c k G e t I m a g e W h i t e P o i n t %
6144 % %
6145 % %
6146 % %
6147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6148 %
6149 % MagickGetImageWhitePoint() returns the chromaticity white point.
6150 %
6151 % The format of the MagickGetImageWhitePoint method is:
6152 %
6153 % MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6154 % double *y,double *z)
6155 %
6156 % A description of each parameter follows:
6157 %
6158 % o wand: the magick wand.
6159 %
6160 % o x: the chromaticity white x-point.
6161 %
6162 % o y: the chromaticity white y-point.
6163 %
6164 % o z: the chromaticity white z-point.
6165 %
6166 */
6167 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6168  double *x,double *y,double *z)
6169 {
6170  assert(wand != (MagickWand *) NULL);
6171  assert(wand->signature == MagickWandSignature);
6172  if (wand->debug != MagickFalse)
6173  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6174  if (wand->images == (Image *) NULL)
6175  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6176  *x=wand->images->chromaticity.white_point.x;
6177  *y=wand->images->chromaticity.white_point.y;
6178  *z=wand->images->chromaticity.white_point.z;
6179  return(MagickTrue);
6180 }
6181 
6182 /*
6183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6184 % %
6185 % %
6186 % %
6187 % M a g i c k G e t I m a g e W i d t h %
6188 % %
6189 % %
6190 % %
6191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6192 %
6193 % MagickGetImageWidth() returns the image width.
6194 %
6195 % The format of the MagickGetImageWidth method is:
6196 %
6197 % size_t MagickGetImageWidth(MagickWand *wand)
6198 %
6199 % A description of each parameter follows:
6200 %
6201 % o wand: the magick wand.
6202 %
6203 */
6204 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6205 {
6206  assert(wand != (MagickWand *) NULL);
6207  assert(wand->signature == MagickWandSignature);
6208  if (wand->debug != MagickFalse)
6209  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6210  if (wand->images == (Image *) NULL)
6211  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6212  return(wand->images->columns);
6213 }
6214 
6215 /*
6216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6217 % %
6218 % %
6219 % %
6220 % M a g i c k G e t N u m b e r I m a g e s %
6221 % %
6222 % %
6223 % %
6224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6225 %
6226 % MagickGetNumberImages() returns the number of images associated with a
6227 % magick wand.
6228 %
6229 % The format of the MagickGetNumberImages method is:
6230 %
6231 % size_t MagickGetNumberImages(MagickWand *wand)
6232 %
6233 % A description of each parameter follows:
6234 %
6235 % o wand: the magick wand.
6236 %
6237 */
6238 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6239 {
6240  assert(wand != (MagickWand *) NULL);
6241  assert(wand->signature == MagickWandSignature);
6242  if (wand->debug != MagickFalse)
6243  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6244  return(GetImageListLength(wand->images));
6245 }
6246 
6247 /*
6248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6249 % %
6250 % %
6251 % %
6252 % 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 %
6253 % %
6254 % %
6255 % %
6256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6257 %
6258 % MagickGetImageTotalInkDensity() gets the image total ink density.
6259 %
6260 % The format of the MagickGetImageTotalInkDensity method is:
6261 %
6262 % double MagickGetImageTotalInkDensity(MagickWand *wand)
6263 %
6264 % A description of each parameter follows:
6265 %
6266 % o wand: the magick wand.
6267 %
6268 */
6269 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6270 {
6271  assert(wand != (MagickWand *) NULL);
6272  assert(wand->signature == MagickWandSignature);
6273  if (wand->debug != MagickFalse)
6274  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6275  if (wand->images == (Image *) NULL)
6276  {
6277  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6278  "ContainsNoImages","`%s'",wand->name);
6279  return(0.0);
6280  }
6281  return(GetImageTotalInkDensity(wand->images,wand->exception));
6282 }
6283 
6284 /*
6285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6286 % %
6287 % %
6288 % %
6289 % M a g i c k H a l d C l u t I m a g e %
6290 % %
6291 % %
6292 % %
6293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6294 %
6295 % MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6296 % table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
6297 % dimensions. Create it with the HALD coder. You can apply any color
6298 % transformation to the Hald image and then use this method to apply the
6299 % transform to the image.
6300 %
6301 % The format of the MagickHaldClutImage method is:
6302 %
6303 % MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6304 % const MagickWand *hald_wand)
6305 %
6306 % A description of each parameter follows:
6307 %
6308 % o wand: the magick wand.
6309 %
6310 % o hald_image: the hald CLUT image.
6311 %
6312 */
6313 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6314  const MagickWand *hald_wand)
6315 {
6316  MagickBooleanType
6317  status;
6318 
6319  assert(wand != (MagickWand *) NULL);
6320  assert(wand->signature == MagickWandSignature);
6321  if (wand->debug != MagickFalse)
6322  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6323  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6324  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6325  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
6326  return(status);
6327 }
6328 
6329 /*
6330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6331 % %
6332 % %
6333 % %
6334 % M a g i c k H a s N e x t I m a g e %
6335 % %
6336 % %
6337 % %
6338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6339 %
6340 % MagickHasNextImage() returns MagickTrue if the wand has more images when
6341 % traversing the list in the forward direction
6342 %
6343 % The format of the MagickHasNextImage method is:
6344 %
6345 % MagickBooleanType MagickHasNextImage(MagickWand *wand)
6346 %
6347 % A description of each parameter follows:
6348 %
6349 % o wand: the magick wand.
6350 %
6351 */
6352 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6353 {
6354  assert(wand != (MagickWand *) NULL);
6355  assert(wand->signature == MagickWandSignature);
6356  if (wand->debug != MagickFalse)
6357  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6358  if (wand->images == (Image *) NULL)
6359  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6360  if (GetNextImageInList(wand->images) == (Image *) NULL)
6361  return(MagickFalse);
6362  return(MagickTrue);
6363 }
6364 
6365 /*
6366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6367 % %
6368 % %
6369 % %
6370 % M a g i c k H a s P r e v i o u s I m a g e %
6371 % %
6372 % %
6373 % %
6374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6375 %
6376 % MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6377 % traversing the list in the reverse direction
6378 %
6379 % The format of the MagickHasPreviousImage method is:
6380 %
6381 % MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6382 %
6383 % A description of each parameter follows:
6384 %
6385 % o wand: the magick wand.
6386 %
6387 */
6388 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6389 {
6390  assert(wand != (MagickWand *) NULL);
6391  assert(wand->signature == MagickWandSignature);
6392  if (wand->debug != MagickFalse)
6393  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6394  if (wand->images == (Image *) NULL)
6395  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6396  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6397  return(MagickFalse);
6398  return(MagickTrue);
6399 }
6400 
6401 /*
6402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6403 % %
6404 % %
6405 % %
6406 % M a g i c k H o u g h L i n e I m a g e %
6407 % %
6408 % %
6409 % %
6410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6411 %
6412 % MagickHoughLineImage() can be used in conjunction with any binary edge
6413 % extracted image (we recommend Canny) to identify lines in the image. The
6414 % algorithm accumulates counts for every white pixel for every possible
6415 % orientation (for angles from 0 to 179 in 1 degree increments) and distance
6416 % from the center of the image to the corner (in 1 px increments) and stores
6417 % the counts in an accumulator matrix of angle vs distance. The size of the
6418 % accumulator is 180x(diagonal/2). Next it searches this space for peaks in
6419 % counts and converts the locations of the peaks to slope and intercept in the
6420 % normal x,y input image space. Use the slope/intercepts to find the endpoints
6421 % clipped to the bounds of the image. The lines are then drawn. The counts are
6422 % a measure of the length of the lines.
6423 %
6424 % The format of the MagickHoughLineImage method is:
6425 %
6426 % MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6427 % const size_t width,const size_t height,const size_t threshold)
6428 %
6429 % A description of each parameter follows:
6430 %
6431 % o wand: the magick wand.
6432 %
6433 % o width, height: find line pairs as local maxima in this neighborhood.
6434 %
6435 % o threshold: the line count threshold.
6436 %
6437 */
6438 WandExport MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6439  const size_t width,const size_t height,const size_t threshold)
6440 {
6441  Image
6442  *lines_image;
6443 
6444  assert(wand != (MagickWand *) NULL);
6445  assert(wand->signature == MagickWandSignature);
6446  if (wand->debug != MagickFalse)
6447  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6448  if (wand->images == (Image *) NULL)
6449  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6450  lines_image=HoughLineImage(wand->images,width,height,threshold,
6451  wand->exception);
6452  if (lines_image == (Image *) NULL)
6453  return(MagickFalse);
6454  ReplaceImageInList(&wand->images,lines_image);
6455  return(MagickTrue);
6456 }
6457 
6458 /*
6459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6460 % %
6461 % %
6462 % %
6463 % M a g i c k I d e n t i f y I m a g e %
6464 % %
6465 % %
6466 % %
6467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6468 %
6469 % MagickIdentifyImage() identifies an image by printing its attributes to the
6470 % file. Attributes include the image width, height, size, and others.
6471 %
6472 % The format of the MagickIdentifyImage method is:
6473 %
6474 % const char *MagickIdentifyImage(MagickWand *wand)
6475 %
6476 % A description of each parameter follows:
6477 %
6478 % o wand: the magick wand.
6479 %
6480 */
6481 WandExport char *MagickIdentifyImage(MagickWand *wand)
6482 {
6483  char
6484  *description,
6485  filename[MagickPathExtent];
6486 
6487  FILE
6488  *file;
6489 
6490  int
6491  unique_file;
6492 
6493  assert(wand != (MagickWand *) NULL);
6494  assert(wand->signature == MagickWandSignature);
6495  if (wand->debug != MagickFalse)
6496  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6497  if (wand->images == (Image *) NULL)
6498  {
6499  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6500  "ContainsNoImages","`%s'",wand->name);
6501  return((char *) NULL);
6502  }
6503  description=(char *) NULL;
6504  unique_file=AcquireUniqueFileResource(filename);
6505  file=(FILE *) NULL;
6506  if (unique_file != -1)
6507  file=fdopen(unique_file,"wb");
6508  if ((unique_file == -1) || (file == (FILE *) NULL))
6509  {
6510  (void) RelinquishUniqueFileResource(filename);
6511  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6512  "UnableToCreateTemporaryFile","`%s'",wand->name);
6513  return((char *) NULL);
6514  }
6515  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6516  (void) fclose(file);
6517  description=FileToString(filename,~0UL,wand->exception);
6518  (void) RelinquishUniqueFileResource(filename);
6519  return(description);
6520 }
6521 
6522 /*
6523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6524 % %
6525 % %
6526 % %
6527 % M a g i c k I d e n t i f y I m a g e T y p e %
6528 % %
6529 % %
6530 % %
6531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6532 %
6533 % MagickIdentifyImageType() gets the potential image type:
6534 %
6535 % Bilevel Grayscale GrayscaleMatte
6536 % Palette PaletteMatte TrueColor
6537 % TrueColorMatte ColorSeparation ColorSeparationMatte
6538 %
6539 % To ensure the image type matches its potential, use MagickSetImageType():
6540 %
6541 % (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6542 %
6543 % The format of the MagickIdentifyImageType method is:
6544 %
6545 % ImageType MagickIdentifyImageType(MagickWand *wand)
6546 %
6547 % A description of each parameter follows:
6548 %
6549 % o wand: the magick wand.
6550 %
6551 */
6552 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6553 {
6554  assert(wand != (MagickWand *) NULL);
6555  assert(wand->signature == MagickWandSignature);
6556  if (wand->debug != MagickFalse)
6557  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6558  if (wand->images == (Image *) NULL)
6559  {
6560  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6561  "ContainsNoImages","`%s'",wand->name);
6562  return(UndefinedType);
6563  }
6564  return(IdentifyImageType(wand->images,wand->exception));
6565 }
6566 
6567 /*
6568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6569 % %
6570 % %
6571 % %
6572 % M a g i c k I m p l o d e I m a g e %
6573 % %
6574 % %
6575 % %
6576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6577 %
6578 % MagickImplodeImage() creates a new image that is a copy of an existing
6579 % one with the image pixels "implode" by the specified percentage. It
6580 % allocates the memory necessary for the new Image structure and returns a
6581 % pointer to the new image.
6582 %
6583 % The format of the MagickImplodeImage method is:
6584 %
6585 % MagickBooleanType MagickImplodeImage(MagickWand *wand,
6586 % const double radius,const PixelInterpolateMethod method)
6587 %
6588 % A description of each parameter follows:
6589 %
6590 % o wand: the magick wand.
6591 %
6592 % o amount: Define the extent of the implosion.
6593 %
6594 % o method: the pixel interpolation method.
6595 %
6596 */
6597 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6598  const double amount,const PixelInterpolateMethod method)
6599 {
6600  Image
6601  *implode_image;
6602 
6603  assert(wand != (MagickWand *) NULL);
6604  assert(wand->signature == MagickWandSignature);
6605  if (wand->debug != MagickFalse)
6606  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6607  if (wand->images == (Image *) NULL)
6608  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6609  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6610  if (implode_image == (Image *) NULL)
6611  return(MagickFalse);
6612  ReplaceImageInList(&wand->images,implode_image);
6613  return(MagickTrue);
6614 }
6615 
6616 /*
6617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6618 % %
6619 % %
6620 % %
6621 % M a g i c k I m p o r t I m a g e P i x e l s %
6622 % %
6623 % %
6624 % %
6625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6626 %
6627 % MagickImportImagePixels() accepts pixel datand stores it in the image at the
6628 % location you specify. The method returns MagickTrue on success otherwise
6629 % MagickFalse if an error is encountered. The pixel data can be either char,
6630 % short int, int, ssize_t, float, or double in the order specified by map.
6631 %
6632 % Suppose your want to upload the first scanline of a 640x480 image from
6633 % character data in red-green-blue order:
6634 %
6635 % MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6636 %
6637 % The format of the MagickImportImagePixels method is:
6638 %
6639 % MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6640 % const ssize_t x,const ssize_t y,const size_t columns,
6641 % const size_t rows,const char *map,const StorageType storage,
6642 % const void *pixels)
6643 %
6644 % A description of each parameter follows:
6645 %
6646 % o wand: the magick wand.
6647 %
6648 % o x, y, columns, rows: These values define the perimeter of a region
6649 % of pixels you want to define.
6650 %
6651 % o map: This string reflects the expected ordering of the pixel array.
6652 % It can be any combination or order of R = red, G = green, B = blue,
6653 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6654 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6655 % P = pad.
6656 %
6657 % o storage: Define the data type of the pixels. Float and double types are
6658 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
6659 % these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6660 % or DoublePixel.
6661 %
6662 % o pixels: This array of values contain the pixel components as defined by
6663 % map and type. You must preallocate this array where the expected
6664 % length varies depending on the values of width, height, map, and type.
6665 %
6666 */
6667 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6668  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6669  const char *map,const StorageType storage,const void *pixels)
6670 {
6671  MagickBooleanType
6672  status;
6673 
6674  assert(wand != (MagickWand *) NULL);
6675  assert(wand->signature == MagickWandSignature);
6676  if (wand->debug != MagickFalse)
6677  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6678  if (wand->images == (Image *) NULL)
6679  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6680  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6681  wand->exception);
6682  return(status);
6683 }
6684 
6685 /*
6686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6687 % %
6688 % %
6689 % %
6690 % 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 %
6691 % %
6692 % %
6693 % %
6694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6695 %
6696 % MagickInterpolativeResizeImage() resize image using a interpolative
6697 % method.
6698 %
6699 % MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6700 % const size_t columns,const size_t rows,
6701 % const PixelInterpolateMethod method)
6702 %
6703 % A description of each parameter follows:
6704 %
6705 % o wand: the magick wand.
6706 %
6707 % o columns: the number of columns in the scaled image.
6708 %
6709 % o rows: the number of rows in the scaled image.
6710 %
6711 % o interpolate: the pixel interpolation method.
6712 %
6713 */
6714 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6715  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6716 {
6717  Image
6718  *resize_image;
6719 
6720  assert(wand != (MagickWand *) NULL);
6721  assert(wand->signature == MagickWandSignature);
6722  if (wand->debug != MagickFalse)
6723  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6724  if (wand->images == (Image *) NULL)
6725  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6726  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6727  wand->exception);
6728  if (resize_image == (Image *) NULL)
6729  return(MagickFalse);
6730  ReplaceImageInList(&wand->images,resize_image);
6731  return(MagickTrue);
6732 }
6733 
6734 /*
6735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6736 % %
6737 % %
6738 % %
6739 % 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 %
6740 % %
6741 % %
6742 % %
6743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6744 %
6745 % MagickInverseFourierTransformImage() implements the inverse discrete
6746 % Fourier transform (DFT) of the image either as a magnitude / phase or real /
6747 % imaginary image pair.
6748 %
6749 % The format of the MagickInverseFourierTransformImage method is:
6750 %
6751 % MagickBooleanType MagickInverseFourierTransformImage(
6752 % MagickWand *magnitude_wand,MagickWand *phase_wand,
6753 % const MagickBooleanType magnitude)
6754 %
6755 % A description of each parameter follows:
6756 %
6757 % o magnitude_wand: the magnitude or real wand.
6758 %
6759 % o phase_wand: the phase or imaginary wand.
6760 %
6761 % o magnitude: if true, return as magnitude / phase pair otherwise a real /
6762 % imaginary image pair.
6763 %
6764 */
6765 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6766  MagickWand *magnitude_wand,MagickWand *phase_wand,
6767  const MagickBooleanType magnitude)
6768 {
6769  Image
6770  *inverse_image;
6771 
6772  MagickWand
6773  *wand;
6774 
6775  assert(magnitude_wand != (MagickWand *) NULL);
6776  assert(magnitude_wand->signature == MagickWandSignature);
6777  if (magnitude_wand->debug != MagickFalse)
6778  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6779  magnitude_wand->name);
6780  wand=magnitude_wand;
6781  if (magnitude_wand->images == (Image *) NULL)
6782  ThrowWandException(WandError,"ContainsNoImages",
6783  magnitude_wand->name);
6784  assert(phase_wand != (MagickWand *) NULL);
6785  assert(phase_wand->signature == MagickWandSignature);
6786  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6787  phase_wand->images,magnitude,wand->exception);
6788  if (inverse_image == (Image *) NULL)
6789  return(MagickFalse);
6790  ReplaceImageInList(&wand->images,inverse_image);
6791  return(MagickTrue);
6792 }
6793 
6794 /*
6795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6796 % %
6797 % %
6798 % %
6799 % M a g i c k K m e a n s I m a g e %
6800 % %
6801 % %
6802 % %
6803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6804 %
6805 % MagickKmeansImage() applies k-means color reduction to an image. This is a
6806 % colorspace clustering or segmentation technique.
6807 %
6808 % The format of the MagickKmeansImage method is:
6809 %
6810 % MagickBooleanType MagickKmeansImage(MagickWand *wand,
6811 % const size_t number_colors, const size_t max_iterations,
6812 % const double tolerance)
6813 %
6814 % A description of each parameter follows:
6815 %
6816 % o wand: the magick wand.
6817 %
6818 % o number_colors: number of colors to use as seeds.
6819 %
6820 % o max_iterations: maximum number of iterations while converging.
6821 %
6822 % o tolerance: the maximum tolerance.
6823 %
6824 */
6825 WandExport MagickBooleanType MagickKmeansImage(MagickWand *wand,
6826  const size_t number_colors,const size_t max_iterations,
6827  const double tolerance)
6828 {
6829  MagickBooleanType
6830  status;
6831 
6832  assert(wand != (MagickWand *) NULL);
6833  assert(wand->signature == MagickWandSignature);
6834  if (wand->debug != MagickFalse)
6835  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6836  if (wand->images == (Image *) NULL)
6837  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6838  status=KmeansImage(wand->images,number_colors,max_iterations,tolerance,
6839  wand->exception);
6840  return(status);
6841 }
6842 
6843 /*
6844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6845 % %
6846 % %
6847 % %
6848 % M a g i c k K u w a h a r a I m a g e %
6849 % %
6850 % %
6851 % %
6852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6853 %
6854 % Use MagickKuwaharaImage() is an edge preserving noise reduction filter.
6855 %
6856 % The format of the MagickKuwaharaImage method is:
6857 %
6858 % MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6859 % const double radius,const double sigma)
6860 %
6861 % A description of each parameter follows:
6862 %
6863 % o wand: the magick wand.
6864 %
6865 % o radius: the square window radius.
6866 %
6867 % o sigma: the standard deviation of the Gaussian, in pixels.
6868 %
6869 */
6870 WandExport MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6871  const double radius,const double sigma)
6872 {
6873  Image
6874  *kuwahara_image;
6875 
6876  assert(wand != (MagickWand *) NULL);
6877  assert(wand->signature == MagickWandSignature);
6878  if (wand->debug != MagickFalse)
6879  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6880  if (wand->images == (Image *) NULL)
6881  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6882  kuwahara_image=KuwaharaImage(wand->images,radius,sigma,wand->exception);
6883  if (kuwahara_image == (Image *) NULL)
6884  return(MagickFalse);
6885  ReplaceImageInList(&wand->images,kuwahara_image);
6886  return(MagickTrue);
6887 }
6888 
6889 /*
6890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6891 % %
6892 % %
6893 % %
6894 % M a g i c k L a b e l I m a g e %
6895 % %
6896 % %
6897 % %
6898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6899 %
6900 % MagickLabelImage() adds a label to your image.
6901 %
6902 % The format of the MagickLabelImage method is:
6903 %
6904 % MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6905 %
6906 % A description of each parameter follows:
6907 %
6908 % o wand: the magick wand.
6909 %
6910 % o label: the image label.
6911 %
6912 */
6913 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6914  const char *label)
6915 {
6916  MagickBooleanType
6917  status;
6918 
6919  assert(wand != (MagickWand *) NULL);
6920  assert(wand->signature == MagickWandSignature);
6921  if (wand->debug != MagickFalse)
6922  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6923  if (wand->images == (Image *) NULL)
6924  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6925  status=SetImageProperty(wand->images,"label",label,wand->exception);
6926  return(status);
6927 }
6928 
6929 /*
6930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6931 % %
6932 % %
6933 % %
6934 % M a g i c k L e v e l I m a g e %
6935 % %
6936 % %
6937 % %
6938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6939 %
6940 % MagickLevelImage() adjusts the levels of an image by scaling the colors
6941 % falling between specified white and black points to the full available
6942 % quantum range. The parameters provided represent the black, mid, and white
6943 % points. The black point specifies the darkest color in the image. Colors
6944 % darker than the black point are set to zero. Mid point specifies a gamma
6945 % correction to apply to the image. White point specifies the lightest color
6946 % in the image. Colors brighter than the white point are set to the maximum
6947 % quantum value.
6948 %
6949 % The format of the MagickLevelImage method is:
6950 %
6951 % MagickBooleanType MagickLevelImage(MagickWand *wand,
6952 % const double black_point,const double gamma,const double white_point)
6953 %
6954 % A description of each parameter follows:
6955 %
6956 % o wand: the magick wand.
6957 %
6958 % o channel: Identify which channel to level: RedPixelChannel,
6959 % GreenPixelChannel, etc.
6960 %
6961 % o black_point: the black point.
6962 %
6963 % o gamma: the gamma.
6964 %
6965 % o white_point: the white point.
6966 %
6967 */
6968 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6969  const double black_point,const double gamma,const double white_point)
6970 {
6971  MagickBooleanType
6972  status;
6973 
6974  assert(wand != (MagickWand *) NULL);
6975  assert(wand->signature == MagickWandSignature);
6976  if (wand->debug != MagickFalse)
6977  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6978  if (wand->images == (Image *) NULL)
6979  ThrowWandException(WandError,"ContainsNoImages",wand->name);
6980  status=LevelImage(wand->images,black_point,white_point,gamma,
6981  wand->exception);
6982  return(status);
6983 }
6984 
6985 /*
6986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6987 % %
6988 % %
6989 % %
6990 % M a g i c k L e v e l I m a g e C o l o r s %
6991 % %
6992 % %
6993 % %
6994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6995 %
6996 % MagickLevelImageColors() maps the given color to "black" and "white" values,
6997 % linearly spreading out the colors, and level values on a channel by channel
6998 % bases, as per LevelImage(). The given colors allows you to specify
6999 % different level ranges for each of the color channels separately.
7000 %
7001 % The format of the MagickLevelImageColors method is:
7002 %
7003 % MagickBooleanType MagickLevelImageColors(MagickWand *wand,
7004 % const PixelWand *black_color,const PixelWand *white_color,
7005 % const MagickBooleanType invert)
7006 %
7007 % A description of each parameter follows:
7008 %
7009 % o wand: the magick wand.
7010 %
7011 % o black_color: the black color.
7012 %
7013 % o white_color: the white color.
7014 %
7015 % o invert: if true map the colors (levelize), rather than from (level)
7016 %
7017 */
7018 WandExport MagickBooleanType MagickLevelImageColors(MagickWand *wand,
7019  const PixelWand *black_color,const PixelWand *white_color,
7020  const MagickBooleanType invert)
7021 {
7022  MagickBooleanType
7023  status;
7024 
7025  PixelInfo
7026  black,
7027  white;
7028 
7029  assert(wand != (MagickWand *) NULL);
7030  assert(wand->signature == MagickWandSignature);
7031  if (wand->debug != MagickFalse)
7032  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7033  if (wand->images == (Image *) NULL)
7034  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7035  PixelGetMagickColor(black_color,&black);
7036  PixelGetMagickColor(white_color,&white);
7037  status=LevelImageColors(wand->images,&black,&white,invert,wand->exception);
7038  return(status);
7039 }
7040 
7041 /*
7042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7043 % %
7044 % %
7045 % %
7046 % M a g i c k L e v e l i z e I m a g e %
7047 % %
7048 % %
7049 % %
7050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7051 %
7052 % MagickLevelizeImage() applies the reversed MagickLevelImage(). It compresses
7053 % the full range of color values, so that they lie between the given black and
7054 % white points. Gamma is applied before the values are mapped. It can be
7055 % used to de-contrast a greyscale image to the exact levels specified.
7056 %
7057 % The format of the MagickLevelizeImage method is:
7058 %
7059 % MagickBooleanType MagickLevelizeImage(MagickWand *wand,
7060 % const double black_point, const double white_point,const double gamma)
7061 %
7062 % A description of each parameter follows:
7063 %
7064 % o wand: the magick wand.
7065 %
7066 % o black_point: The level to map zero (black) to.
7067 %
7068 % o white_point: The level to map QuantumRange (white) to.
7069 %
7070 % o gamma: adjust gamma by this factor before mapping values.
7071 %
7072 */
7073 WandExport MagickBooleanType MagickLevelizeImage(MagickWand *wand,
7074  const double black_point,const double gamma,const double white_point)
7075 {
7076  MagickBooleanType
7077  status;
7078 
7079  assert(wand != (MagickWand *) NULL);
7080  assert(wand->signature == MagickWandSignature);
7081  if (wand->debug != MagickFalse)
7082  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7083  if (wand->images == (Image *) NULL)
7084  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7085  status=LevelizeImage(wand->images,black_point,white_point,gamma,
7086  wand->exception);
7087  return(status);
7088 }
7089 
7090 /*
7091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7092 % %
7093 % %
7094 % %
7095 % M a g i c k L i n e a r S t r e t c h I m a g e %
7096 % %
7097 % %
7098 % %
7099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7100 %
7101 % MagickLinearStretchImage() stretches with saturation the image intensity.
7102 %
7103 % You can also reduce the influence of a particular channel with a gamma
7104 % value of 0.
7105 %
7106 % The format of the MagickLinearStretchImage method is:
7107 %
7108 % MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7109 % const double black_point,const double white_point)
7110 %
7111 % A description of each parameter follows:
7112 %
7113 % o wand: the magick wand.
7114 %
7115 % o black_point: the black point.
7116 %
7117 % o white_point: the white point.
7118 %
7119 */
7120 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7121  const double black_point,const double white_point)
7122 {
7123  MagickBooleanType
7124  status;
7125 
7126  assert(wand != (MagickWand *) NULL);
7127  assert(wand->signature == MagickWandSignature);
7128  if (wand->debug != MagickFalse)
7129  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7130  if (wand->images == (Image *) NULL)
7131  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7132  status=LinearStretchImage(wand->images,black_point,white_point,
7133  wand->exception);
7134  return(status);
7135 }
7136 
7137 /*
7138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7139 % %
7140 % %
7141 % %
7142 % M a g i c k L i q u i d R e s c a l e I m a g e %
7143 % %
7144 % %
7145 % %
7146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7147 %
7148 % MagickLiquidRescaleImage() rescales image with seam carving.
7149 %
7150 % MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7151 % const size_t columns,const size_t rows,
7152 % const double delta_x,const double rigidity)
7153 %
7154 % A description of each parameter follows:
7155 %
7156 % o wand: the magick wand.
7157 %
7158 % o columns: the number of columns in the scaled image.
7159 %
7160 % o rows: the number of rows in the scaled image.
7161 %
7162 % o delta_x: maximum seam transversal step (0 means straight seams).
7163 %
7164 % o rigidity: introduce a bias for non-straight seams (typically 0).
7165 %
7166 */
7167 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7168  const size_t columns,const size_t rows,const double delta_x,
7169  const double rigidity)
7170 {
7171  Image
7172  *rescale_image;
7173 
7174  assert(wand != (MagickWand *) NULL);
7175  assert(wand->signature == MagickWandSignature);
7176  if (wand->debug != MagickFalse)
7177  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7178  if (wand->images == (Image *) NULL)
7179  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7180  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
7181  rigidity,wand->exception);
7182  if (rescale_image == (Image *) NULL)
7183  return(MagickFalse);
7184  ReplaceImageInList(&wand->images,rescale_image);
7185  return(MagickTrue);
7186 }
7187 
7188 /*
7189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7190 % %
7191 % %
7192 % %
7193 % M a g i c k L o c a l C o n t r a s t I m a g e %
7194 % %
7195 % %
7196 % %
7197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7198 %
7199 % MagickLocalContrastImage() attempts to increase the appearance of
7200 % large-scale light-dark transitions. Local contrast enhancement works
7201 % similarly to sharpening with an unsharp mask, however the mask is instead
7202 % created using an image with a greater blur distance.
7203 %
7204 % MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7205 % const double radius,const double strength)
7206 %
7207 % A description of each parameter follows:
7208 %
7209 % o image: the image.
7210 %
7211 % o radius: the radius of the Gaussian, in pixels, not counting
7212 % the center pixel.
7213 %
7214 % o strength: the strength of the blur mask in percentage.
7215 %
7216 */
7217 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7218  const double radius, const double strength)
7219 {
7220  Image
7221  *contrast_image;
7222 
7223  assert(wand != (MagickWand *)NULL);
7224  assert(wand->signature == MagickWandSignature);
7225  if (wand->debug != MagickFalse)
7226  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
7227  if (wand->images == (Image *)NULL)
7228  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7229  contrast_image=LocalContrastImage(wand->images,radius,strength,
7230  wand->exception);
7231  if (contrast_image == (Image *)NULL)
7232  return(MagickFalse);
7233  ReplaceImageInList(&wand->images,contrast_image);
7234  return(MagickTrue);
7235 }
7236 
7237 /*
7238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7239 % %
7240 % %
7241 % %
7242 % M a g i c k M a g n i f y I m a g e %
7243 % %
7244 % %
7245 % %
7246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7247 %
7248 % MagickMagnifyImage() is a convenience method that scales an image
7249 % proportionally to twice its original size.
7250 %
7251 % The format of the MagickMagnifyImage method is:
7252 %
7253 % MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7254 %
7255 % A description of each parameter follows:
7256 %
7257 % o wand: the magick wand.
7258 %
7259 */
7260 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7261 {
7262  Image
7263  *magnify_image;
7264 
7265  assert(wand != (MagickWand *) NULL);
7266  assert(wand->signature == MagickWandSignature);
7267  if (wand->debug != MagickFalse)
7268  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7269  if (wand->images == (Image *) NULL)
7270  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7271  magnify_image=MagnifyImage(wand->images,wand->exception);
7272  if (magnify_image == (Image *) NULL)
7273  return(MagickFalse);
7274  ReplaceImageInList(&wand->images,magnify_image);
7275  return(MagickTrue);
7276 }
7277 
7278 /*
7279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7280 % %
7281 % %
7282 % %
7283 % M a g i c k M e a n S h i f t I m a g e %
7284 % %
7285 % %
7286 % %
7287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7288 %
7289 % MagickMeanShiftImage() delineate arbitrarily shaped clusters in the image. For
7290 % each pixel, it visits all the pixels in the neighborhood specified by
7291 % the window centered at the pixel and excludes those that are outside the
7292 % radius=(window-1)/2 surrounding the pixel. From those pixels, it finds those
7293 % that are within the specified color distance from the current mean, and
7294 % computes a new x,y centroid from those coordinates and a new mean. This new
7295 % x,y centroid is used as the center for a new window. This process iterates
7296 % until it converges and the final mean is replaces the (original window
7297 % center) pixel value. It repeats this process for the next pixel, etc.,
7298 % until it processes all pixels in the image. Results are typically better with
7299 % colorspaces other than sRGB. We recommend YIQ, YUV or YCbCr.
7300 %
7301 % The format of the MagickMeanShiftImage method is:
7302 %
7303 % MagickBooleanType MagickMeanShiftImage(MagickWand *wand,
7304 % const size_t number_terms,const double *terms)
7305 %
7306 % A description of each parameter follows:
7307 %
7308 % o wand: the magick wand.
7309 %
7310 % o width, height: find pixels in this neighborhood.
7311 %
7312 % o color_distance: the color distance.
7313 %
7314 */
7315 WandExport MagickBooleanType MagickMeanShiftImage(MagickWand *wand,
7316  const size_t width,const size_t height,const double color_distance)
7317 {
7318  Image
7319  *mean_image;
7320 
7321  assert(wand != (MagickWand *) NULL);
7322  assert(wand->signature == MagickWandSignature);
7323  if (wand->debug != MagickFalse)
7324  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7325  if (wand->images == (Image *) NULL)
7326  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7327  mean_image=MeanShiftImage(wand->images,width,height,color_distance,
7328  wand->exception);
7329  if (mean_image == (Image *) NULL)
7330  return(MagickFalse);
7331  ReplaceImageInList(&wand->images,mean_image);
7332  return(MagickTrue);
7333 }
7334 
7335 /*
7336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7337 % %
7338 % %
7339 % %
7340 % M a g i c k M e r g e I m a g e L a y e r s %
7341 % %
7342 % %
7343 % %
7344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7345 %
7346 % MagickMergeImageLayers() composes all the image layers from the current
7347 % given image onward to produce a single image of the merged layers.
7348 %
7349 % The inital canvas's size depends on the given LayerMethod, and is
7350 % initialized using the first images background color. The images
7351 % are then composited onto that image in sequence using the given
7352 % composition that has been assigned to each individual image.
7353 %
7354 % The format of the MagickMergeImageLayers method is:
7355 %
7356 % MagickWand *MagickMergeImageLayers(MagickWand *wand,
7357 % const LayerMethod method)
7358 %
7359 % A description of each parameter follows:
7360 %
7361 % o wand: the magick wand.
7362 %
7363 % o method: the method of selecting the size of the initial canvas.
7364 %
7365 % MergeLayer: Merge all layers onto a canvas just large enough
7366 % to hold all the actual images. The virtual canvas of the
7367 % first image is preserved but otherwise ignored.
7368 %
7369 % FlattenLayer: Use the virtual canvas size of first image.
7370 % Images which fall outside this canvas is clipped.
7371 % This can be used to 'fill out' a given virtual canvas.
7372 %
7373 % MosaicLayer: Start with the virtual canvas of the first image,
7374 % enlarging left and right edges to contain all images.
7375 % Images with negative offsets will be clipped.
7376 %
7377 */
7378 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
7379  const LayerMethod method)
7380 {
7381  Image
7382  *mosaic_image;
7383 
7384  assert(wand != (MagickWand *) NULL);
7385  assert(wand->signature == MagickWandSignature);
7386  if (wand->debug != MagickFalse)
7387  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7388  if (wand->images == (Image *) NULL)
7389  return((MagickWand *) NULL);
7390  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
7391  if (mosaic_image == (Image *) NULL)
7392  return((MagickWand *) NULL);
7393  return(CloneMagickWandFromImages(wand,mosaic_image));
7394 }
7395 
7396 /*
7397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7398 % %
7399 % %
7400 % %
7401 % M a g i c k M i n i f y I m a g e %
7402 % %
7403 % %
7404 % %
7405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7406 %
7407 % MagickMinifyImage() is a convenience method that scales an image
7408 % proportionally to one-half its original size
7409 %
7410 % The format of the MagickMinifyImage method is:
7411 %
7412 % MagickBooleanType MagickMinifyImage(MagickWand *wand)
7413 %
7414 % A description of each parameter follows:
7415 %
7416 % o wand: the magick wand.
7417 %
7418 */
7419 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
7420 {
7421  Image
7422  *minify_image;
7423 
7424  assert(wand != (MagickWand *) NULL);
7425  assert(wand->signature == MagickWandSignature);
7426  if (wand->debug != MagickFalse)
7427  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7428  if (wand->images == (Image *) NULL)
7429  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7430  minify_image=MinifyImage(wand->images,wand->exception);
7431  if (minify_image == (Image *) NULL)
7432  return(MagickFalse);
7433  ReplaceImageInList(&wand->images,minify_image);
7434  return(MagickTrue);
7435 }
7436 
7437 /*
7438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7439 % %
7440 % %
7441 % %
7442 % M a g i c k M o d u l a t e I m a g e %
7443 % %
7444 % %
7445 % %
7446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7447 %
7448 % MagickModulateImage() lets you control the brightness, saturation, and hue
7449 % of an image. Hue is the percentage of absolute rotation from the current
7450 % position. For example 50 results in a counter-clockwise rotation of 90
7451 % degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
7452 % both resulting in a rotation of 180 degrees.
7453 %
7454 % To increase the color brightness by 20% and decrease the color saturation by
7455 % 10% and leave the hue unchanged, use: 120,90,100.
7456 %
7457 % The format of the MagickModulateImage method is:
7458 %
7459 % MagickBooleanType MagickModulateImage(MagickWand *wand,
7460 % const double brightness,const double saturation,const double hue)
7461 %
7462 % A description of each parameter follows:
7463 %
7464 % o wand: the magick wand.
7465 %
7466 % o brightness: the percent change in brightness.
7467 %
7468 % o saturation: the percent change in saturation.
7469 %
7470 % o hue: the percent change in hue.
7471 %
7472 */
7473 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
7474  const double brightness,const double saturation,const double hue)
7475 {
7476  char
7477  modulate[MagickPathExtent];
7478 
7479  MagickBooleanType
7480  status;
7481 
7482  assert(wand != (MagickWand *) NULL);
7483  assert(wand->signature == MagickWandSignature);
7484  if (wand->debug != MagickFalse)
7485  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7486  if (wand->images == (Image *) NULL)
7487  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7488  (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
7489  brightness,saturation,hue);
7490  status=ModulateImage(wand->images,modulate,wand->exception);
7491  return(status);
7492 }
7493 
7494 /*
7495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7496 % %
7497 % %
7498 % %
7499 % M a g i c k M o n t a g e I m a g e %
7500 % %
7501 % %
7502 % %
7503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7504 %
7505 % MagickMontageImage() creates a composite image by combining several
7506 % separate images. The images are tiled on the composite image with the name
7507 % of the image optionally appearing just below the individual tile.
7508 %
7509 % The format of the MagickMontageImage method is:
7510 %
7511 % MagickWand *MagickMontageImage(MagickWand *wand,
7512 % const DrawingWand drawing_wand,const char *tile_geometry,
7513 % const char *thumbnail_geometry,const MontageMode mode,
7514 % const char *frame)
7515 %
7516 % A description of each parameter follows:
7517 %
7518 % o wand: the magick wand.
7519 %
7520 % o drawing_wand: the drawing wand. The font name, size, and color are
7521 % obtained from this wand.
7522 %
7523 % o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7524 %
7525 % o thumbnail_geometry: Preferred image size and border size of each
7526 % thumbnail (e.g. 120x120+4+3>).
7527 %
7528 % o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7529 %
7530 % o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7531 % The frame color is that of the thumbnail's matte color.
7532 %
7533 */
7534 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7535  const DrawingWand *drawing_wand,const char *tile_geometry,
7536  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7537 {
7538  char
7539  *font;
7540 
7541  Image
7542  *montage_image;
7543 
7544  MontageInfo
7545  *montage_info;
7546 
7547  PixelWand
7548  *pixel_wand;
7549 
7550  assert(wand != (MagickWand *) NULL);
7551  assert(wand->signature == MagickWandSignature);
7552  if (wand->debug != MagickFalse)
7553  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7554  if (wand->images == (Image *) NULL)
7555  return((MagickWand *) NULL);
7556  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7557  switch (mode)
7558  {
7559  case FrameMode:
7560  {
7561  (void) CloneString(&montage_info->frame,"15x15+3+3");
7562  montage_info->shadow=MagickTrue;
7563  break;
7564  }
7565  case UnframeMode:
7566  {
7567  montage_info->frame=(char *) NULL;
7568  montage_info->shadow=MagickFalse;
7569  montage_info->border_width=0;
7570  break;
7571  }
7572  case ConcatenateMode:
7573  {
7574  montage_info->frame=(char *) NULL;
7575  montage_info->shadow=MagickFalse;
7576  (void) CloneString(&montage_info->geometry,"+0+0");
7577  montage_info->border_width=0;
7578  break;
7579  }
7580  default:
7581  break;
7582  }
7583  font=DrawGetFont(drawing_wand);
7584  if (font != (char *) NULL)
7585  (void) CloneString(&montage_info->font,font);
7586  if (frame != (char *) NULL)
7587  (void) CloneString(&montage_info->frame,frame);
7588  montage_info->pointsize=DrawGetFontSize(drawing_wand);
7589  pixel_wand=NewPixelWand();
7590  DrawGetFillColor(drawing_wand,pixel_wand);
7591  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
7592  DrawGetStrokeColor(drawing_wand,pixel_wand);
7593  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
7594  pixel_wand=DestroyPixelWand(pixel_wand);
7595  if (thumbnail_geometry != (char *) NULL)
7596  (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7597  if (tile_geometry != (char *) NULL)
7598  (void) CloneString(&montage_info->tile,tile_geometry);
7599  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7600  wand->exception);
7601  montage_info=DestroyMontageInfo(montage_info);
7602  if (montage_image == (Image *) NULL)
7603  return((MagickWand *) NULL);
7604  return(CloneMagickWandFromImages(wand,montage_image));
7605 }
7606 
7607 /*
7608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7609 % %
7610 % %
7611 % %
7612 % M a g i c k M o r p h I m a g e s %
7613 % %
7614 % %
7615 % %
7616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7617 %
7618 % MagickMorphImages() method morphs a set of images. Both the image pixels
7619 % and size are linearly interpolated to give the appearance of a
7620 % meta-morphosis from one image to the next.
7621 %
7622 % The format of the MagickMorphImages method is:
7623 %
7624 % MagickWand *MagickMorphImages(MagickWand *wand,
7625 % const size_t number_frames)
7626 %
7627 % A description of each parameter follows:
7628 %
7629 % o wand: the magick wand.
7630 %
7631 % o number_frames: the number of in-between images to generate.
7632 %
7633 */
7634 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7635  const size_t number_frames)
7636 {
7637  Image
7638  *morph_image;
7639 
7640  assert(wand != (MagickWand *) NULL);
7641  assert(wand->signature == MagickWandSignature);
7642  if (wand->debug != MagickFalse)
7643  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7644  if (wand->images == (Image *) NULL)
7645  return((MagickWand *) NULL);
7646  morph_image=MorphImages(wand->images,number_frames,wand->exception);
7647  if (morph_image == (Image *) NULL)
7648  return((MagickWand *) NULL);
7649  return(CloneMagickWandFromImages(wand,morph_image));
7650 }
7651 
7652 /*
7653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7654 % %
7655 % %
7656 % %
7657 % M a g i c k M o r p h o l o g y I m a g e %
7658 % %
7659 % %
7660 % %
7661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7662 %
7663 % MagickMorphologyImage() applies a user supplied kernel to the image
7664 % according to the given morphology method.
7665 %
7666 % The format of the MagickMorphologyImage method is:
7667 %
7668 % MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7669 % const MorphologyMethod method,const ssize_t iterations,
7670 % const KernelInfo *kernel)
7671 %
7672 % A description of each parameter follows:
7673 %
7674 % o wand: the magick wand.
7675 %
7676 % o method: the morphology method to be applied.
7677 %
7678 % o iterations: apply the operation this many times (or no change).
7679 % A value of -1 means loop until no change found. How this is applied
7680 % may depend on the morphology method. Typically this is a value of 1.
7681 %
7682 % o kernel: An array of doubles representing the morphology kernel.
7683 %
7684 */
7685 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7686  const MorphologyMethod method,const ssize_t iterations,
7687  const KernelInfo *kernel)
7688 {
7689  Image
7690  *morphology_image;
7691 
7692  assert(wand != (MagickWand *) NULL);
7693  assert(wand->signature == MagickWandSignature);
7694  if (wand->debug != MagickFalse)
7695  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7696  if (kernel == (const KernelInfo *) NULL)
7697  return(MagickFalse);
7698  if (wand->images == (Image *) NULL)
7699  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7700  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
7701  wand->exception);
7702  if (morphology_image == (Image *) NULL)
7703  return(MagickFalse);
7704  ReplaceImageInList(&wand->images,morphology_image);
7705  return(MagickTrue);
7706 }
7707 
7708 /*
7709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7710 % %
7711 % %
7712 % %
7713 % M a g i c k M o t i o n B l u r I m a g e %
7714 % %
7715 % %
7716 % %
7717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7718 %
7719 % MagickMotionBlurImage() simulates motion blur. We convolve the image with a
7720 % Gaussian operator of the given radius and standard deviation (sigma).
7721 % For reasonable results, radius should be larger than sigma. Use a
7722 % radius of 0 and MotionBlurImage() selects a suitable radius for you.
7723 % Angle gives the angle of the blurring motion.
7724 %
7725 % The format of the MagickMotionBlurImage method is:
7726 %
7727 % MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7728 % const double radius,const double sigma,const double angle)
7729 %
7730 % A description of each parameter follows:
7731 %
7732 % o wand: the magick wand.
7733 %
7734 % o radius: the radius of the Gaussian, in pixels, not counting
7735 % the center pixel.
7736 %
7737 % o sigma: the standard deviation of the Gaussian, in pixels.
7738 %
7739 % o angle: Apply the effect along this angle.
7740 %
7741 */
7742 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7743  const double radius,const double sigma,const double angle)
7744 {
7745  Image
7746  *blur_image;
7747 
7748  assert(wand != (MagickWand *) NULL);
7749  assert(wand->signature == MagickWandSignature);
7750  if (wand->debug != MagickFalse)
7751  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7752  if (wand->images == (Image *) NULL)
7753  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7754  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
7755  if (blur_image == (Image *) NULL)
7756  return(MagickFalse);
7757  ReplaceImageInList(&wand->images,blur_image);
7758  return(MagickTrue);
7759 }
7760 
7761 /*
7762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7763 % %
7764 % %
7765 % %
7766 % M a g i c k N e g a t e I m a g e %
7767 % %
7768 % %
7769 % %
7770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7771 %
7772 % MagickNegateImage() negates the colors in the reference image. The
7773 % Grayscale option means that only grayscale values within the image are
7774 % negated.
7775 %
7776 % You can also reduce the influence of a particular channel with a gamma
7777 % value of 0.
7778 %
7779 % The format of the MagickNegateImage method is:
7780 %
7781 % MagickBooleanType MagickNegateImage(MagickWand *wand,
7782 % const MagickBooleanType gray)
7783 %
7784 % A description of each parameter follows:
7785 %
7786 % o wand: the magick wand.
7787 %
7788 % o gray: If MagickTrue, only negate grayscale pixels within the image.
7789 %
7790 */
7791 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7792  const MagickBooleanType gray)
7793 {
7794  MagickBooleanType
7795  status;
7796 
7797  assert(wand != (MagickWand *) NULL);
7798  assert(wand->signature == MagickWandSignature);
7799  if (wand->debug != MagickFalse)
7800  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7801  if (wand->images == (Image *) NULL)
7802  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7803  status=NegateImage(wand->images,gray,wand->exception);
7804  return(status);
7805 }
7806 
7807 /*
7808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7809 % %
7810 % %
7811 % %
7812 % M a g i c k N e w I m a g e %
7813 % %
7814 % %
7815 % %
7816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7817 %
7818 % MagickNewImage() adds a blank image canvas of the specified size and
7819 % background color to the wand.
7820 %
7821 % The format of the MagickNewImage method is:
7822 %
7823 % MagickBooleanType MagickNewImage(MagickWand *wand,
7824 % const size_t columns,const size_t rows,
7825 % const PixelWand *background)
7826 %
7827 % A description of each parameter follows:
7828 %
7829 % o wand: the magick wand.
7830 %
7831 % o width: the image width.
7832 %
7833 % o height: the image height.
7834 %
7835 % o background: the image color.
7836 %
7837 */
7838 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7839  const size_t height,const PixelWand *background)
7840 {
7841  Image
7842  *images;
7843 
7844  PixelInfo
7845  pixel;
7846 
7847  assert(wand != (MagickWand *) NULL);
7848  assert(wand->signature == MagickWandSignature);
7849  if (wand->debug != MagickFalse)
7850  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7851  PixelGetMagickColor(background,&pixel);
7852  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7853  if (images == (Image *) NULL)
7854  return(MagickFalse);
7855  return(InsertImageInWand(wand,images));
7856 }
7857 
7858 /*
7859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7860 % %
7861 % %
7862 % %
7863 % M a g i c k N e x t I m a g e %
7864 % %
7865 % %
7866 % %
7867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7868 %
7869 % MagickNextImage() sets the next image in the wand as the current image.
7870 %
7871 % It is typically used after MagickResetIterator(), after which its first use
7872 % will set the first image as the current image (unless the wand is empty).
7873 %
7874 % It will return MagickFalse when no more images are left to be returned
7875 % which happens when the wand is empty, or the current image is the last
7876 % image.
7877 %
7878 % When the above condition (end of image list) is reached, the iterator is
7879 % automatically set so that you can start using MagickPreviousImage() to
7880 % again iterate over the images in the reverse direction, starting with the
7881 % last image (again). You can jump to this condition immediately using
7882 % MagickSetLastIterator().
7883 %
7884 % The format of the MagickNextImage method is:
7885 %
7886 % MagickBooleanType MagickNextImage(MagickWand *wand)
7887 %
7888 % A description of each parameter follows:
7889 %
7890 % o wand: the magick wand.
7891 %
7892 */
7893 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7894 {
7895  assert(wand != (MagickWand *) NULL);
7896  assert(wand->signature == MagickWandSignature);
7897  if (wand->debug != MagickFalse)
7898  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7899  if (wand->images == (Image *) NULL)
7900  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7901  wand->insert_before=MagickFalse; /* Inserts is now appended */
7902  if (wand->image_pending != MagickFalse)
7903  {
7904  wand->image_pending=MagickFalse;
7905  return(MagickTrue);
7906  }
7907  if (GetNextImageInList(wand->images) == (Image *) NULL)
7908  {
7909  wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7910  return(MagickFalse);
7911  }
7912  wand->images=GetNextImageInList(wand->images);
7913  return(MagickTrue);
7914 }
7915 
7916 /*
7917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7918 % %
7919 % %
7920 % %
7921 % M a g i c k N o r m a l i z e I m a g e %
7922 % %
7923 % %
7924 % %
7925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7926 %
7927 % MagickNormalizeImage() enhances the contrast of a color image by adjusting
7928 % the pixels color to span the entire range of colors available
7929 %
7930 % You can also reduce the influence of a particular channel with a gamma
7931 % value of 0.
7932 %
7933 % The format of the MagickNormalizeImage method is:
7934 %
7935 % MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7936 %
7937 % A description of each parameter follows:
7938 %
7939 % o wand: the magick wand.
7940 %
7941 */
7942 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7943 {
7944  MagickBooleanType
7945  status;
7946 
7947  assert(wand != (MagickWand *) NULL);
7948  assert(wand->signature == MagickWandSignature);
7949  if (wand->debug != MagickFalse)
7950  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7951  if (wand->images == (Image *) NULL)
7952  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7953  status=NormalizeImage(wand->images,wand->exception);
7954  return(status);
7955 }
7956 
7957 /*
7958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7959 % %
7960 % %
7961 % %
7962 % M a g i c k O i l P a i n t I m a g e %
7963 % %
7964 % %
7965 % %
7966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7967 %
7968 % MagickOilPaintImage() applies a special effect filter that simulates an oil
7969 % painting. Each pixel is replaced by the most frequent color occurring
7970 % in a circular region defined by radius.
7971 %
7972 % The format of the MagickOilPaintImage method is:
7973 %
7974 % MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7975 % const double radius,const double sigma)
7976 %
7977 % A description of each parameter follows:
7978 %
7979 % o wand: the magick wand.
7980 %
7981 % o radius: the radius of the circular neighborhood.
7982 %
7983 % o sigma: the standard deviation of the Gaussian, in pixels.
7984 %
7985 */
7986 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7987  const double radius,const double sigma)
7988 {
7989  Image
7990  *paint_image;
7991 
7992  assert(wand != (MagickWand *) NULL);
7993  assert(wand->signature == MagickWandSignature);
7994  if (wand->debug != MagickFalse)
7995  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7996  if (wand->images == (Image *) NULL)
7997  ThrowWandException(WandError,"ContainsNoImages",wand->name);
7998  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7999  if (paint_image == (Image *) NULL)
8000  return(MagickFalse);
8001  ReplaceImageInList(&wand->images,paint_image);
8002  return(MagickTrue);
8003 }
8004 
8005 /*
8006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8007 % %
8008 % %
8009 % %
8010 % M a g i c k O p a q u e P a i n t I m a g e %
8011 % %
8012 % %
8013 % %
8014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8015 %
8016 % MagickOpaquePaintImage() changes any pixel that matches color with the color
8017 % defined by fill.
8018 %
8019 % The format of the MagickOpaquePaintImage method is:
8020 %
8021 % MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
8022 % const PixelWand *target,const PixelWand *fill,const double fuzz,
8023 % const MagickBooleanType invert)
8024 %
8025 % A description of each parameter follows:
8026 %
8027 % o wand: the magick wand.
8028 %
8029 % o target: Change this target color to the fill color within the image.
8030 %
8031 % o fill: the fill pixel wand.
8032 %
8033 % o fuzz: By default target must match a particular pixel color
8034 % exactly. However, in many cases two colors may differ by a small amount.
8035 % The fuzz member of image defines how much tolerance is acceptable to
8036 % consider two colors as the same. For example, set fuzz to 10 and the
8037 % color red at intensities of 100 and 102 respectively are now interpreted
8038 % as the same color for the purposes of the floodfill.
8039 %
8040 % o invert: paint any pixel that does not match the target color.
8041 %
8042 */
8043 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
8044  const PixelWand *target,const PixelWand *fill,const double fuzz,
8045  const MagickBooleanType invert)
8046 {
8047  MagickBooleanType
8048  status;
8049 
8050  PixelInfo
8051  fill_pixel,
8052  target_pixel;
8053 
8054  assert(wand != (MagickWand *) NULL);
8055  assert(wand->signature == MagickWandSignature);
8056  if (wand->debug != MagickFalse)
8057  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8058  if (wand->images == (Image *) NULL)
8059  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8060  PixelGetMagickColor(target,&target_pixel);
8061  PixelGetMagickColor(fill,&fill_pixel);
8062  wand->images->fuzz=fuzz;
8063  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
8064  wand->exception);
8065  return(status);
8066 }
8067 
8068 /*
8069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8070 % %
8071 % %
8072 % %
8073 % 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 %
8074 % %
8075 % %
8076 % %
8077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8078 %
8079 % MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
8080 % previous image in the sequence. From this it attempts to select the
8081 % smallest cropped image to replace each frame, while preserving the results
8082 % of the animation.
8083 %
8084 % The format of the MagickOptimizeImageLayers method is:
8085 %
8086 % MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8087 %
8088 % A description of each parameter follows:
8089 %
8090 % o wand: the magick wand.
8091 %
8092 */
8093 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8094 {
8095  Image
8096  *optimize_image;
8097 
8098  assert(wand != (MagickWand *) NULL);
8099  assert(wand->signature == MagickWandSignature);
8100  if (wand->debug != MagickFalse)
8101  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8102  if (wand->images == (Image *) NULL)
8103  return((MagickWand *) NULL);
8104  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
8105  if (optimize_image == (Image *) NULL)
8106  return((MagickWand *) NULL);
8107  return(CloneMagickWandFromImages(wand,optimize_image));
8108 }
8109 
8110 /*
8111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8112 % %
8113 % %
8114 % %
8115 % 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 %
8116 % %
8117 % %
8118 % %
8119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8120 %
8121 % MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
8122 % compares the overlayed pixels against the disposal image resulting from all
8123 % the previous frames in the animation. Any pixel that does not change the
8124 % disposal image (and thus does not effect the outcome of an overlay) is made
8125 % transparent.
8126 %
8127 % WARNING: This modifies the current images directly, rather than generate
8128 % a new image sequence.
8129 % The format of the MagickOptimizeImageTransparency method is:
8130 %
8131 % MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8132 %
8133 % A description of each parameter follows:
8134 %
8135 % o wand: the magick wand.
8136 %
8137 */
8138 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8139 {
8140  assert(wand != (MagickWand *) NULL);
8141  assert(wand->signature == MagickWandSignature);
8142  if (wand->debug != MagickFalse)
8143  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8144  if (wand->images == (Image *) NULL)
8145  return(MagickFalse);
8146  OptimizeImageTransparency(wand->images,wand->exception);
8147  return(MagickTrue);
8148 }
8149 
8150 /*
8151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8152 % %
8153 % %
8154 % %
8155 % M a g i c k O r d e r e d D i t h e r I m a g e %
8156 % %
8157 % %
8158 % %
8159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8160 %
8161 % MagickOrderedDitherImage() performs an ordered dither based on a number
8162 % of pre-defined dithering threshold maps, but over multiple intensity levels,
8163 % which can be different for different channels, according to the input
8164 % arguments.
8165 %
8166 % The format of the MagickOrderedDitherImage method is:
8167 %
8168 % MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
8169 % const char *threshold_map)
8170 %
8171 % A description of each parameter follows:
8172 %
8173 % o image: the image.
8174 %
8175 % o threshold_map: A string containing the name of the threshold dither
8176 % map to use, followed by zero or more numbers representing the number of
8177 % color levels tho dither between.
8178 %
8179 % Any level number less than 2 is equivalent to 2, and means only binary
8180 % dithering will be applied to each color channel.
8181 %
8182 % No numbers also means a 2 level (bitmap) dither will be applied to all
8183 % channels, while a single number is the number of levels applied to each
8184 % channel in sequence. More numbers will be applied in turn to each of
8185 % the color channels.
8186 %
8187 % For example: "o3x3,6" generates a 6 level posterization of the image
8188 % with a ordered 3x3 diffused pixel dither being applied between each
8189 % level. While checker,8,8,4 will produce a 332 colormaped image with
8190 % only a single checkerboard hash pattern (50% grey) between each color
8191 % level, to basically double the number of color levels with a bare
8192 % minimum of dithering.
8193 %
8194 */
8195 WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
8196  const char *threshold_map)
8197 {
8198  MagickBooleanType
8199  status;
8200 
8201  assert(wand != (MagickWand *) NULL);
8202  assert(wand->signature == MagickWandSignature);
8203  if (wand->debug != MagickFalse)
8204  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8205  if (wand->images == (Image *) NULL)
8206  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8207  status=OrderedDitherImage(wand->images,threshold_map,wand->exception);
8208  return(status);
8209 }
8210 
8211 /*
8212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8213 % %
8214 % %
8215 % %
8216 % M a g i c k P i n g I m a g e %
8217 % %
8218 % %
8219 % %
8220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8221 %
8222 % MagickPingImage() is the same as MagickReadImage() except the only valid
8223 % information returned is the image width, height, size, and format. It
8224 % is designed to efficiently obtain this information from a file without
8225 % reading the entire image sequence into memory.
8226 %
8227 % The format of the MagickPingImage method is:
8228 %
8229 % MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
8230 %
8231 % A description of each parameter follows:
8232 %
8233 % o wand: the magick wand.
8234 %
8235 % o filename: the image filename.
8236 %
8237 */
8238 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
8239  const char *filename)
8240 {
8241  Image
8242  *images;
8243 
8244  ImageInfo
8245  *ping_info;
8246 
8247  assert(wand != (MagickWand *) NULL);
8248  assert(wand->signature == MagickWandSignature);
8249  if (wand->debug != MagickFalse)
8250  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8251  ping_info=CloneImageInfo(wand->image_info);
8252  if (filename != (const char *) NULL)
8253  (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
8254  images=PingImage(ping_info,wand->exception);
8255  ping_info=DestroyImageInfo(ping_info);
8256  if (images == (Image *) NULL)
8257  return(MagickFalse);
8258  return(InsertImageInWand(wand,images));
8259 }
8260 
8261 /*
8262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8263 % %
8264 % %
8265 % %
8266 % M a g i c k P i n g I m a g e B l o b %
8267 % %
8268 % %
8269 % %
8270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8271 %
8272 % MagickPingImageBlob() pings an image or image sequence from a blob.
8273 %
8274 % The format of the MagickPingImageBlob method is:
8275 %
8276 % MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8277 % const void *blob,const size_t length)
8278 %
8279 % A description of each parameter follows:
8280 %
8281 % o wand: the magick wand.
8282 %
8283 % o blob: the blob.
8284 %
8285 % o length: the blob length.
8286 %
8287 */
8288 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8289  const void *blob,const size_t length)
8290 {
8291  Image
8292  *images;
8293 
8294  assert(wand != (MagickWand *) NULL);
8295  assert(wand->signature == MagickWandSignature);
8296  if (wand->debug != MagickFalse)
8297  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8298  images=PingBlob(wand->image_info,blob,length,wand->exception);
8299  if (images == (Image *) NULL)
8300  return(MagickFalse);
8301  return(InsertImageInWand(wand,images));
8302 }
8303 
8304 /*
8305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8306 % %
8307 % %
8308 % %
8309 % M a g i c k P i n g I m a g e F i l e %
8310 % %
8311 % %
8312 % %
8313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8314 %
8315 % MagickPingImageFile() pings an image or image sequence from an open file
8316 % descriptor.
8317 %
8318 % The format of the MagickPingImageFile method is:
8319 %
8320 % MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8321 %
8322 % A description of each parameter follows:
8323 %
8324 % o wand: the magick wand.
8325 %
8326 % o file: the file descriptor.
8327 %
8328 */
8329 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8330 {
8331  Image
8332  *images;
8333 
8334  ImageInfo
8335  *read_info;
8336 
8337  assert(wand != (MagickWand *) NULL);
8338  assert(wand->signature == MagickWandSignature);
8339  assert(file != (FILE *) NULL);
8340  if (wand->debug != MagickFalse)
8341  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8342  read_info=CloneImageInfo(wand->image_info);
8343  SetImageInfoFile(read_info,file);
8344  images=PingImage(read_info,wand->exception);
8345  read_info=DestroyImageInfo(read_info);
8346  if (images == (Image *) NULL)
8347  return(MagickFalse);
8348  return(InsertImageInWand(wand,images));
8349 }
8350 
8351 /*
8352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8353 % %
8354 % %
8355 % %
8356 % M a g i c k P o l a r o i d I m a g e %
8357 % %
8358 % %
8359 % %
8360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8361 %
8362 % MagickPolaroidImage() simulates a Polaroid picture.
8363 %
8364 % The format of the MagickPolaroidImage method is:
8365 %
8366 % MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8367 % const DrawingWand *drawing_wand,const char *caption,const double angle,
8368 % const PixelInterpolateMethod method)
8369 %
8370 % A description of each parameter follows:
8371 %
8372 % o wand: the magick wand.
8373 %
8374 % o drawing_wand: the draw wand.
8375 %
8376 % o caption: the Polaroid caption.
8377 %
8378 % o angle: Apply the effect along this angle.
8379 %
8380 % o method: the pixel interpolation method.
8381 %
8382 */
8383 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8384  const DrawingWand *drawing_wand,const char *caption,const double angle,
8385  const PixelInterpolateMethod method)
8386 {
8387  DrawInfo
8388  *draw_info;
8389 
8390  Image
8391  *polaroid_image;
8392 
8393  assert(wand != (MagickWand *) NULL);
8394  assert(wand->signature == MagickWandSignature);
8395  if (wand->debug != MagickFalse)
8396  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8397  if (wand->images == (Image *) NULL)
8398  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8399  draw_info=PeekDrawingWand(drawing_wand);
8400  if (draw_info == (DrawInfo *) NULL)
8401  return(MagickFalse);
8402  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
8403  wand->exception);
8404  if (polaroid_image == (Image *) NULL)
8405  return(MagickFalse);
8406  ReplaceImageInList(&wand->images,polaroid_image);
8407  return(MagickTrue);
8408 }
8409 
8410 /*
8411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8412 % %
8413 % %
8414 % %
8415 % M a g i c k P o l y n o m i a l I m a g e %
8416 % %
8417 % %
8418 % %
8419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8420 %
8421 % MagickPolynomialImage() returns an image where each pixel is the sum of the
8422 % pixels in the image sequence after applying its corresponding terms
8423 % (coefficient and degree pairs).
8424 %
8425 % The format of the MagickPolynomialImage method is:
8426 %
8427 % MagickBooleanType MagickPolynomialImage(MagickWand *wand,
8428 % const size_t number_terms,const double *terms)
8429 %
8430 % A description of each parameter follows:
8431 %
8432 % o wand: the magick wand.
8433 %
8434 % o number_terms: the number of terms in the list. The actual list length
8435 % is 2 x number_terms + 1 (the constant).
8436 %
8437 % o terms: the list of polynomial coefficients and degree pairs and a
8438 % constant.
8439 %
8440 */
8441 WandExport MagickBooleanType MagickPolynomialImage(MagickWand *wand,
8442  const size_t number_terms,const double *terms)
8443 {
8444  Image
8445  *polynomial_image;
8446 
8447  assert(wand != (MagickWand *) NULL);
8448  assert(wand->signature == MagickWandSignature);
8449  if (wand->debug != MagickFalse)
8450  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8451  if (wand->images == (Image *) NULL)
8452  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8453  polynomial_image=PolynomialImage(wand->images,number_terms,terms,
8454  wand->exception);
8455  if (polynomial_image == (Image *) NULL)
8456  return(MagickFalse);
8457  ReplaceImageInList(&wand->images,polynomial_image);
8458  return(MagickTrue);
8459 }
8460 
8461 /*
8462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8463 % %
8464 % %
8465 % %
8466 % M a g i c k P o s t e r i z e I m a g e %
8467 % %
8468 % %
8469 % %
8470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8471 %
8472 % MagickPosterizeImage() reduces the image to a limited number of color level.
8473 %
8474 % The format of the MagickPosterizeImage method is:
8475 %
8476 % MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8477 % const size_t levels,const DitherMethod method)
8478 %
8479 % A description of each parameter follows:
8480 %
8481 % o wand: the magick wand.
8482 %
8483 % o levels: Number of color levels allowed in each channel. Very low values
8484 % (2, 3, or 4) have the most visible effect.
8485 %
8486 % o method: choose the dither method: UndefinedDitherMethod,
8487 % NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8488 %
8489 */
8490 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8491  const size_t levels,const DitherMethod dither)
8492 {
8493  MagickBooleanType
8494  status;
8495 
8496  assert(wand != (MagickWand *) NULL);
8497  assert(wand->signature == MagickWandSignature);
8498  if (wand->debug != MagickFalse)
8499  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8500  if (wand->images == (Image *) NULL)
8501  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8502  status=PosterizeImage(wand->images,levels,dither,wand->exception);
8503  return(status);
8504 }
8505 
8506 /*
8507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8508 % %
8509 % %
8510 % %
8511 % M a g i c k P r e v i e w I m a g e s %
8512 % %
8513 % %
8514 % %
8515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8516 %
8517 % MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8518 % image processing operation applied at varying strengths. This helpful
8519 % to quickly pin-point an appropriate parameter for an image processing
8520 % operation.
8521 %
8522 % The format of the MagickPreviewImages method is:
8523 %
8524 % MagickWand *MagickPreviewImages(MagickWand *wand,
8525 % const PreviewType preview)
8526 %
8527 % A description of each parameter follows:
8528 %
8529 % o wand: the magick wand.
8530 %
8531 % o preview: the preview type.
8532 %
8533 */
8534 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8535  const PreviewType preview)
8536 {
8537  Image
8538  *preview_image;
8539 
8540  assert(wand != (MagickWand *) NULL);
8541  assert(wand->signature == MagickWandSignature);
8542  if (wand->debug != MagickFalse)
8543  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8544  if (wand->images == (Image *) NULL)
8545  return((MagickWand *) NULL);
8546  preview_image=PreviewImage(wand->images,preview,wand->exception);
8547  if (preview_image == (Image *) NULL)
8548  return((MagickWand *) NULL);
8549  return(CloneMagickWandFromImages(wand,preview_image));
8550 }
8551 
8552 /*
8553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8554 % %
8555 % %
8556 % %
8557 % M a g i c k P r e v i o u s I m a g e %
8558 % %
8559 % %
8560 % %
8561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8562 %
8563 % MagickPreviousImage() sets the previous image in the wand as the current
8564 % image.
8565 %
8566 % It is typically used after MagickSetLastIterator(), after which its first
8567 % use will set the last image as the current image (unless the wand is empty).
8568 %
8569 % It will return MagickFalse when no more images are left to be returned
8570 % which happens when the wand is empty, or the current image is the first
8571 % image. At that point the iterator is than reset to again process images in
8572 % the forward direction, again starting with the first image in list. Images
8573 % added at this point are prepended.
8574 %
8575 % Also at that point any images added to the wand using MagickAddImages() or
8576 % MagickReadImages() will be prepended before the first image. In this sense
8577 % the condition is not quite exactly the same as MagickResetIterator().
8578 %
8579 % The format of the MagickPreviousImage method is:
8580 %
8581 % MagickBooleanType MagickPreviousImage(MagickWand *wand)
8582 %
8583 % A description of each parameter follows:
8584 %
8585 % o wand: the magick wand.
8586 %
8587 */
8588 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8589 {
8590  assert(wand != (MagickWand *) NULL);
8591  assert(wand->signature == MagickWandSignature);
8592  if (wand->debug != MagickFalse)
8593  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8594  if (wand->images == (Image *) NULL)
8595  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8596  if (wand->image_pending != MagickFalse)
8597  {
8598  wand->image_pending=MagickFalse; /* image returned no longer pending */
8599  return(MagickTrue);
8600  }
8601  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8602  {
8603  wand->image_pending=MagickTrue; /* Next now re-gets first image */
8604  wand->insert_before=MagickTrue; /* insert/add prepends new images */
8605  return(MagickFalse);
8606  }
8607  wand->images=GetPreviousImageInList(wand->images);
8608  return(MagickTrue);
8609 }
8610 
8611 /*
8612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8613 % %
8614 % %
8615 % %
8616 % M a g i c k Q u a n t i z e I m a g e %
8617 % %
8618 % %
8619 % %
8620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8621 %
8622 % MagickQuantizeImage() analyzes the colors within a reference image and
8623 % chooses a fixed number of colors to represent the image. The goal of the
8624 % algorithm is to minimize the color difference between the input and output
8625 % image while minimizing the processing time.
8626 %
8627 % The format of the MagickQuantizeImage method is:
8628 %
8629 % MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8630 % const size_t number_colors,const ColorspaceType colorspace,
8631 % const size_t treedepth,const DitherMethod dither_method,
8632 % const MagickBooleanType measure_error)
8633 %
8634 % A description of each parameter follows:
8635 %
8636 % o wand: the magick wand.
8637 %
8638 % o number_colors: the number of colors.
8639 %
8640 % o colorspace: Perform color reduction in this colorspace, typically
8641 % RGBColorspace.
8642 %
8643 % o treedepth: Normally, this integer value is zero or one. A zero or
8644 % 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
8645 % reference image with the least amount of memory and the fastest
8646 % computational speed. In some cases, such as an image with low color
8647 % dispersion (a few number of colors), a value other than
8648 % Log4(number_colors) is required. To expand the color tree completely,
8649 % use a value of 8.
8650 %
8651 % o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
8652 % RiemersmaDitherMethod, FloydSteinbergDitherMethod.
8653 %
8654 % o measure_error: A value other than zero measures the difference between
8655 % the original and quantized images. This difference is the total
8656 % quantization error. The error is computed by summing over all pixels
8657 % in an image the distance squared in RGB space between each reference
8658 % pixel value and its quantized value.
8659 %
8660 */
8661 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8662  const size_t number_colors,const ColorspaceType colorspace,
8663  const size_t treedepth,const DitherMethod dither_method,
8664  const MagickBooleanType measure_error)
8665 {
8666  MagickBooleanType
8667  status;
8668 
8669  QuantizeInfo
8670  *quantize_info;
8671 
8672  assert(wand != (MagickWand *) NULL);
8673  assert(wand->signature == MagickWandSignature);
8674  if (wand->debug != MagickFalse)
8675  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8676  if (wand->images == (Image *) NULL)
8677  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8678  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8679  quantize_info->number_colors=number_colors;
8680  quantize_info->dither_method=dither_method;
8681  quantize_info->tree_depth=treedepth;
8682  quantize_info->colorspace=colorspace;
8683  quantize_info->measure_error=measure_error;
8684  status=QuantizeImage(quantize_info,wand->images,wand->exception);
8685  quantize_info=DestroyQuantizeInfo(quantize_info);
8686  return(status);
8687 }
8688 
8689 /*
8690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8691 % %
8692 % %
8693 % %
8694 % M a g i c k Q u a n t i z e I m a g e s %
8695 % %
8696 % %
8697 % %
8698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8699 %
8700 % MagickQuantizeImages() analyzes the colors within a sequence of images and
8701 % chooses a fixed number of colors to represent the image. The goal of the
8702 % algorithm is to minimize the color difference between the input and output
8703 % image while minimizing the processing time.
8704 %
8705 % The format of the MagickQuantizeImages method is:
8706 %
8707 % MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8708 % const size_t number_colors,const ColorspaceType colorspace,
8709 % const size_t treedepth,const DitherMethod dither_method,
8710 % const MagickBooleanType measure_error)
8711 %
8712 % A description of each parameter follows:
8713 %
8714 % o wand: the magick wand.
8715 %
8716 % o number_colors: the number of colors.
8717 %
8718 % o colorspace: Perform color reduction in this colorspace, typically
8719 % RGBColorspace.
8720 %
8721 % o treedepth: Normally, this integer value is zero or one. A zero or
8722 % 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
8723 % reference image with the least amount of memory and the fastest
8724 % computational speed. In some cases, such as an image with low color
8725 % dispersion (a few number of colors), a value other than
8726 % Log4(number_colors) is required. To expand the color tree completely,
8727 % use a value of 8.
8728 %
8729 % o dither_method: choose from these dither methods: NoDitherMethod,
8730 % RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8731 %
8732 % o measure_error: A value other than zero measures the difference between
8733 % the original and quantized images. This difference is the total
8734 % quantization error. The error is computed by summing over all pixels
8735 % in an image the distance squared in RGB space between each reference
8736 % pixel value and its quantized value.
8737 %
8738 */
8739 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8740  const size_t number_colors,const ColorspaceType colorspace,
8741  const size_t treedepth,const DitherMethod dither_method,
8742  const MagickBooleanType measure_error)
8743 {
8744  MagickBooleanType
8745  status;
8746 
8747  QuantizeInfo
8748  *quantize_info;
8749 
8750  assert(wand != (MagickWand *) NULL);
8751  assert(wand->signature == MagickWandSignature);
8752  if (wand->debug != MagickFalse)
8753  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8754  if (wand->images == (Image *) NULL)
8755  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8756  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8757  quantize_info->number_colors=number_colors;
8758  quantize_info->dither_method=dither_method;
8759  quantize_info->tree_depth=treedepth;
8760  quantize_info->colorspace=colorspace;
8761  quantize_info->measure_error=measure_error;
8762  status=QuantizeImages(quantize_info,wand->images,wand->exception);
8763  quantize_info=DestroyQuantizeInfo(quantize_info);
8764  return(status);
8765 }
8766 
8767 /*
8768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8769 % %
8770 % %
8771 % %
8772 % 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 %
8773 % %
8774 % %
8775 % %
8776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8777 %
8778 % MagickRangeThresholdImage() applies soft and hard thresholding.
8779 %
8780 % The format of the RangeThresholdImage method is:
8781 %
8782 % MagickBooleanType MagickRangeThresholdImage(MagickWand *wand,
8783 % const double low_black,const double low_white,const double high_white,
8784 % const double high_black)
8785 %
8786 % A description of each parameter follows:
8787 %
8788 % o wand: the magick wand.
8789 %
8790 % o low_black: Define the minimum threshold value.
8791 %
8792 % o low_white: Define the maximum threshold value.
8793 %
8794 % o high_white: Define the minimum threshold value.
8795 %
8796 % o low_white: Define the maximum threshold value.
8797 %
8798 */
8799 WandExport MagickBooleanType MagickRangeThresholdImage(MagickWand *wand,
8800  const double low_black,const double low_white,const double high_white,
8801  const double high_black)
8802 {
8803  MagickBooleanType
8804  status;
8805 
8806  assert(wand != (MagickWand *) NULL);
8807  assert(wand->signature == MagickWandSignature);
8808  if (wand->debug != MagickFalse)
8809  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8810  if (wand->images == (Image *) NULL)
8811  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8812  status=RangeThresholdImage(wand->images,low_black,low_white,
8813  high_white,high_black,wand->exception);
8814  return(status);
8815 }
8816 
8817 /*
8818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8819 % %
8820 % %
8821 % %
8822 % 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 %
8823 % %
8824 % %
8825 % %
8826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8827 %
8828 % MagickRotationalBlurImage() rotational blurs an image.
8829 %
8830 % The format of the MagickRotationalBlurImage method is:
8831 %
8832 % MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8833 % const double angle)
8834 %
8835 % A description of each parameter follows:
8836 %
8837 % o wand: the magick wand.
8838 %
8839 % o angle: the angle of the blur in degrees.
8840 %
8841 */
8842 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8843  const double angle)
8844 {
8845  Image
8846  *blur_image;
8847 
8848  assert(wand != (MagickWand *) NULL);
8849  assert(wand->signature == MagickWandSignature);
8850  if (wand->debug != MagickFalse)
8851  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8852  if (wand->images == (Image *) NULL)
8853  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8854  blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
8855  if (blur_image == (Image *) NULL)
8856  return(MagickFalse);
8857  ReplaceImageInList(&wand->images,blur_image);
8858  return(MagickTrue);
8859 }
8860 
8861 /*
8862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8863 % %
8864 % %
8865 % %
8866 % M a g i c k R a i s e I m a g e %
8867 % %
8868 % %
8869 % %
8870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8871 %
8872 % MagickRaiseImage() creates a simulated three-dimensional button-like effect
8873 % by lightening and darkening the edges of the image. Members width and
8874 % height of raise_info define the width of the vertical and horizontal
8875 % edge of the effect.
8876 %
8877 % The format of the MagickRaiseImage method is:
8878 %
8879 % MagickBooleanType MagickRaiseImage(MagickWand *wand,
8880 % const size_t width,const size_t height,const ssize_t x,
8881 % const ssize_t y,const MagickBooleanType raise)
8882 %
8883 % A description of each parameter follows:
8884 %
8885 % o wand: the magick wand.
8886 %
8887 % o width,height,x,y: Define the dimensions of the area to raise.
8888 %
8889 % o raise: A value other than zero creates a 3-D raise effect,
8890 % otherwise it has a lowered effect.
8891 %
8892 */
8893 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8894  const size_t width,const size_t height,const ssize_t x,
8895  const ssize_t y,const MagickBooleanType raise)
8896 {
8897  MagickBooleanType
8898  status;
8899 
8900  RectangleInfo
8901  raise_info;
8902 
8903  assert(wand != (MagickWand *) NULL);
8904  assert(wand->signature == MagickWandSignature);
8905  if (wand->debug != MagickFalse)
8906  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8907  if (wand->images == (Image *) NULL)
8908  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8909  raise_info.width=width;
8910  raise_info.height=height;
8911  raise_info.x=x;
8912  raise_info.y=y;
8913  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8914  return(status);
8915 }
8916 
8917 /*
8918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8919 % %
8920 % %
8921 % %
8922 % 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 %
8923 % %
8924 % %
8925 % %
8926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8927 %
8928 % MagickRandomThresholdImage() changes the value of individual pixels based on
8929 % the intensity of each pixel compared to threshold. The result is a
8930 % high-contrast, two color image.
8931 %
8932 % The format of the MagickRandomThresholdImage method is:
8933 %
8934 % MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8935 % const double low,const double high)
8936 %
8937 % A description of each parameter follows:
8938 %
8939 % o wand: the magick wand.
8940 %
8941 % o low,high: Specify the high and low thresholds. These values range from
8942 % 0 to QuantumRange.
8943 %
8944 */
8945 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8946  const double low,const double high)
8947 {
8948  assert(wand != (MagickWand *) NULL);
8949  assert(wand->signature == MagickWandSignature);
8950  if (wand->debug != MagickFalse)
8951  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8952  if (wand->images == (Image *) NULL)
8953  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8954  return(RandomThresholdImage(wand->images,low,high,wand->exception));
8955 }
8956 
8957 /*
8958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8959 % %
8960 % %
8961 % %
8962 % M a g i c k R e a d I m a g e %
8963 % %
8964 % %
8965 % %
8966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8967 %
8968 % MagickReadImage() reads an image or image sequence. The images are inserted
8969 % just before the current image pointer position.
8970 %
8971 % Use MagickSetFirstIterator(), to insert new images before all the current
8972 % images in the wand, MagickSetLastIterator() to append add to the end,
8973 % MagickSetIteratorIndex() to place images just after the given index.
8974 %
8975 % The format of the MagickReadImage method is:
8976 %
8977 % MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8978 %
8979 % A description of each parameter follows:
8980 %
8981 % o wand: the magick wand.
8982 %
8983 % o filename: the image filename.
8984 %
8985 */
8986 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8987  const char *filename)
8988 {
8989  Image
8990  *images;
8991 
8992  ImageInfo
8993  *read_info;
8994 
8995  assert(wand != (MagickWand *) NULL);
8996  assert(wand->signature == MagickWandSignature);
8997  if (wand->debug != MagickFalse)
8998  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8999  read_info=CloneImageInfo(wand->image_info);
9000  if (filename != (const char *) NULL)
9001  (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
9002  images=ReadImage(read_info,wand->exception);
9003  read_info=DestroyImageInfo(read_info);
9004  if (images == (Image *) NULL)
9005  return(MagickFalse);
9006  return(InsertImageInWand(wand,images));
9007 }
9008 
9009 /*
9010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9011 % %
9012 % %
9013 % %
9014 % M a g i c k R e a d I m a g e B l o b %
9015 % %
9016 % %
9017 % %
9018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9019 %
9020 % MagickReadImageBlob() reads an image or image sequence from a blob.
9021 % In all other respects it is like MagickReadImage().
9022 %
9023 % The format of the MagickReadImageBlob method is:
9024 %
9025 % MagickBooleanType MagickReadImageBlob(MagickWand *wand,
9026 % const void *blob,const size_t length)
9027 %
9028 % A description of each parameter follows:
9029 %
9030 % o wand: the magick wand.
9031 %
9032 % o blob: the blob.
9033 %
9034 % o length: the blob length.
9035 %
9036 */
9037 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
9038  const void *blob,const size_t length)
9039 {
9040  Image
9041  *images;
9042 
9043  assert(wand != (MagickWand *) NULL);
9044  assert(wand->signature == MagickWandSignature);
9045  if (wand->debug != MagickFalse)
9046  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9047  images=BlobToImage(wand->image_info,blob,length,wand->exception);
9048  if (images == (Image *) NULL)
9049  return(MagickFalse);
9050  return(InsertImageInWand(wand,images));
9051 }
9052 
9053 /*
9054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9055 % %
9056 % %
9057 % %
9058 % M a g i c k R e a d I m a g e F i l e %
9059 % %
9060 % %
9061 % %
9062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9063 %
9064 % MagickReadImageFile() reads an image or image sequence from an already
9065 % opened file descriptor. Otherwise it is like MagickReadImage().
9066 %
9067 % The format of the MagickReadImageFile method is:
9068 %
9069 % MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
9070 %
9071 % A description of each parameter follows:
9072 %
9073 % o wand: the magick wand.
9074 %
9075 % o file: the file descriptor.
9076 %
9077 */
9078 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
9079 {
9080  Image
9081  *images;
9082 
9083  ImageInfo
9084  *read_info;
9085 
9086  assert(wand != (MagickWand *) NULL);
9087  assert(wand->signature == MagickWandSignature);
9088  assert(file != (FILE *) NULL);
9089  if (wand->debug != MagickFalse)
9090  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9091  read_info=CloneImageInfo(wand->image_info);
9092  SetImageInfoFile(read_info,file);
9093  images=ReadImage(read_info,wand->exception);
9094  read_info=DestroyImageInfo(read_info);
9095  if (images == (Image *) NULL)
9096  return(MagickFalse);
9097  return(InsertImageInWand(wand,images));
9098 }
9099 
9100 /*
9101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9102 % %
9103 % %
9104 % %
9105 % M a g i c k R e m a p I m a g e %
9106 % %
9107 % %
9108 % %
9109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9110 %
9111 % MagickRemapImage() replaces the colors of an image with the closest color
9112 % from a reference image.
9113 %
9114 % The format of the MagickRemapImage method is:
9115 %
9116 % MagickBooleanType MagickRemapImage(MagickWand *wand,
9117 % const MagickWand *remap_wand,const DitherMethod method)
9118 %
9119 % A description of each parameter follows:
9120 %
9121 % o wand: the magick wand.
9122 %
9123 % o affinity: the affinity wand.
9124 %
9125 % o method: choose from these dither methods: NoDitherMethod,
9126 % RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
9127 %
9128 */
9129 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
9130  const MagickWand *remap_wand,const DitherMethod dither_method)
9131 {
9132  MagickBooleanType
9133  status;
9134 
9135  QuantizeInfo
9136  *quantize_info;
9137 
9138  assert(wand != (MagickWand *) NULL);
9139  assert(wand->signature == MagickWandSignature);
9140  if (wand->debug != MagickFalse)
9141  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9142  if ((wand->images == (Image *) NULL) ||
9143  (remap_wand->images == (Image *) NULL))
9144  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9145  quantize_info=AcquireQuantizeInfo(wand->image_info);
9146  quantize_info->dither_method=dither_method;
9147  status=RemapImage(quantize_info,wand->images,remap_wand->images,
9148  wand->exception);
9149  quantize_info=DestroyQuantizeInfo(quantize_info);
9150  return(status);
9151 }
9152 
9153 /*
9154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9155 % %
9156 % %
9157 % %
9158 % M a g i c k R e m o v e I m a g e %
9159 % %
9160 % %
9161 % %
9162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9163 %
9164 % MagickRemoveImage() removes an image from the image list.
9165 %
9166 % The format of the MagickRemoveImage method is:
9167 %
9168 % MagickBooleanType MagickRemoveImage(MagickWand *wand)
9169 %
9170 % A description of each parameter follows:
9171 %
9172 % o wand: the magick wand.
9173 %
9174 % o insert: the splice wand.
9175 %
9176 */
9177 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
9178 {
9179  assert(wand != (MagickWand *) NULL);
9180  assert(wand->signature == MagickWandSignature);
9181  if (wand->debug != MagickFalse)
9182  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9183  if (wand->images == (Image *) NULL)
9184  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9185  DeleteImageFromList(&wand->images);
9186  return(MagickTrue);
9187 }
9188 
9189 /*
9190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9191 % %
9192 % %
9193 % %
9194 % M a g i c k R e s a m p l e I m a g e %
9195 % %
9196 % %
9197 % %
9198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9199 %
9200 % MagickResampleImage() resample image to desired resolution.
9201 %
9202 % Bessel Blackman Box
9203 % Catrom Cubic Gaussian
9204 % Hanning Hermite Lanczos
9205 % Mitchell Point Quadratic
9206 % Sinc Triangle
9207 %
9208 % Most of the filters are FIR (finite impulse response), however, Bessel,
9209 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
9210 % are windowed (brought down to zero) with the Blackman filter.
9211 %
9212 % The format of the MagickResampleImage method is:
9213 %
9214 % MagickBooleanType MagickResampleImage(MagickWand *wand,
9215 % const double x_resolution,const double y_resolution,
9216 % const FilterType filter)
9217 %
9218 % A description of each parameter follows:
9219 %
9220 % o wand: the magick wand.
9221 %
9222 % o x_resolution: the new image x resolution.
9223 %
9224 % o y_resolution: the new image y resolution.
9225 %
9226 % o filter: Image filter to use.
9227 %
9228 */
9229 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
9230  const double x_resolution,const double y_resolution,const FilterType filter)
9231 {
9232  Image
9233  *resample_image;
9234 
9235  assert(wand != (MagickWand *) NULL);
9236  assert(wand->signature == MagickWandSignature);
9237  if (wand->debug != MagickFalse)
9238  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9239  if (wand->images == (Image *) NULL)
9240  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9241  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
9242  wand->exception);
9243  if (resample_image == (Image *) NULL)
9244  return(MagickFalse);
9245  ReplaceImageInList(&wand->images,resample_image);
9246  return(MagickTrue);
9247 }
9248 
9249 /*
9250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9251 % %
9252 % %
9253 % %
9254 % M a g i c k R e s e t I m a g e P a g e %
9255 % %
9256 % %
9257 % %
9258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9259 %
9260 % MagickResetImagePage() resets the Wand page canvas and position.
9261 %
9262 % The format of the MagickResetImagePage method is:
9263 %
9264 % MagickBooleanType MagickResetImagePage(MagickWand *wand,
9265 % const char *page)
9266 %
9267 % A description of each parameter follows:
9268 %
9269 % o wand: the magick wand.
9270 %
9271 % o page: the relative page specification.
9272 %
9273 */
9274 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
9275  const char *page)
9276 {
9277  assert(wand != (MagickWand *) NULL);
9278  assert(wand->signature == MagickWandSignature);
9279  if (wand->debug != MagickFalse)
9280  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9281  if (wand->images == (Image *) NULL)
9282  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9283  if ((page == (char *) NULL) || (*page == '\0'))
9284  {
9285  (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
9286  return(MagickTrue);
9287  }
9288  return(ResetImagePage(wand->images,page));
9289 }
9290 
9291 /*
9292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9293 % %
9294 % %
9295 % %
9296 % M a g i c k R e s i z e I m a g e %
9297 % %
9298 % %
9299 % %
9300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9301 %
9302 % MagickResizeImage() scales an image to the desired dimensions with one of
9303 % these filters:
9304 %
9305 % Bessel Blackman Box
9306 % Catrom Cubic Gaussian
9307 % Hanning Hermite Lanczos
9308 % Mitchell Point Quadratic
9309 % Sinc Triangle
9310 %
9311 % Most of the filters are FIR (finite impulse response), however, Bessel,
9312 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
9313 % are windowed (brought down to zero) with the Blackman filter.
9314 %
9315 % The format of the MagickResizeImage method is:
9316 %
9317 % MagickBooleanType MagickResizeImage(MagickWand *wand,
9318 % const size_t columns,const size_t rows,const FilterType filter)
9319 %
9320 % A description of each parameter follows:
9321 %
9322 % o wand: the magick wand.
9323 %
9324 % o columns: the number of columns in the scaled image.
9325 %
9326 % o rows: the number of rows in the scaled image.
9327 %
9328 % o filter: Image filter to use.
9329 %
9330 */
9331 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
9332  const size_t columns,const size_t rows,const FilterType filter)
9333 {
9334  Image
9335  *resize_image;
9336 
9337  assert(wand != (MagickWand *) NULL);
9338  assert(wand->signature == MagickWandSignature);
9339  if (wand->debug != MagickFalse)
9340  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9341  if (wand->images == (Image *) NULL)
9342  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9343  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
9344  if (resize_image == (Image *) NULL)
9345  return(MagickFalse);
9346  ReplaceImageInList(&wand->images,resize_image);
9347  return(MagickTrue);
9348 }
9349 
9350 /*
9351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9352 % %
9353 % %
9354 % %
9355 % M a g i c k R o l l I m a g e %
9356 % %
9357 % %
9358 % %
9359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9360 %
9361 % MagickRollImage() offsets an image as defined by x and y.
9362 %
9363 % The format of the MagickRollImage method is:
9364 %
9365 % MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
9366 % const size_t y)
9367 %
9368 % A description of each parameter follows:
9369 %
9370 % o wand: the magick wand.
9371 %
9372 % o x: the x offset.
9373 %
9374 % o y: the y offset.
9375 %
9376 %
9377 */
9378 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
9379  const ssize_t x,const ssize_t y)
9380 {
9381  Image
9382  *roll_image;
9383 
9384  assert(wand != (MagickWand *) NULL);
9385  assert(wand->signature == MagickWandSignature);
9386  if (wand->debug != MagickFalse)
9387  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9388  if (wand->images == (Image *) NULL)
9389  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9390  roll_image=RollImage(wand->images,x,y,wand->exception);
9391  if (roll_image == (Image *) NULL)
9392  return(MagickFalse);
9393  ReplaceImageInList(&wand->images,roll_image);
9394  return(MagickTrue);
9395 }
9396 
9397 /*
9398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9399 % %
9400 % %
9401 % %
9402 % M a g i c k R o t a t e I m a g e %
9403 % %
9404 % %
9405 % %
9406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9407 %
9408 % MagickRotateImage() rotates an image the specified number of degrees. Empty
9409 % triangles left over from rotating the image are filled with the
9410 % background color.
9411 %
9412 % The format of the MagickRotateImage method is:
9413 %
9414 % MagickBooleanType MagickRotateImage(MagickWand *wand,
9415 % const PixelWand *background,const double degrees)
9416 %
9417 % A description of each parameter follows:
9418 %
9419 % o wand: the magick wand.
9420 %
9421 % o background: the background pixel wand.
9422 %
9423 % o degrees: the number of degrees to rotate the image.
9424 %
9425 %
9426 */
9427 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
9428  const PixelWand *background,const double degrees)
9429 {
9430  Image
9431  *rotate_image;
9432 
9433  assert(wand != (MagickWand *) NULL);
9434  assert(wand->signature == MagickWandSignature);
9435  if (wand->debug != MagickFalse)
9436  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9437  if (wand->images == (Image *) NULL)
9438  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9439  PixelGetQuantumPacket(background,&wand->images->background_color);
9440  rotate_image=RotateImage(wand->images,degrees,wand->exception);
9441  if (rotate_image == (Image *) NULL)
9442  return(MagickFalse);
9443  ReplaceImageInList(&wand->images,rotate_image);
9444  return(MagickTrue);
9445 }
9446 
9447 /*
9448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9449 % %
9450 % %
9451 % %
9452 % M a g i c k S a m p l e I m a g e %
9453 % %
9454 % %
9455 % %
9456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9457 %
9458 % MagickSampleImage() scales an image to the desired dimensions with pixel
9459 % sampling. Unlike other scaling methods, this method does not introduce
9460 % any additional color into the scaled image.
9461 %
9462 % The format of the MagickSampleImage method is:
9463 %
9464 % MagickBooleanType MagickSampleImage(MagickWand *wand,
9465 % const size_t columns,const size_t rows)
9466 %
9467 % A description of each parameter follows:
9468 %
9469 % o wand: the magick wand.
9470 %
9471 % o columns: the number of columns in the scaled image.
9472 %
9473 % o rows: the number of rows in the scaled image.
9474 %
9475 %
9476 */
9477 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9478  const size_t columns,const size_t rows)
9479 {
9480  Image
9481  *sample_image;
9482 
9483  assert(wand != (MagickWand *) NULL);
9484  assert(wand->signature == MagickWandSignature);
9485  if (wand->debug != MagickFalse)
9486  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9487  if (wand->images == (Image *) NULL)
9488  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9489  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9490  if (sample_image == (Image *) NULL)
9491  return(MagickFalse);
9492  ReplaceImageInList(&wand->images,sample_image);
9493  return(MagickTrue);
9494 }
9495 
9496 /*
9497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9498 % %
9499 % %
9500 % %
9501 % M a g i c k S c a l e I m a g e %
9502 % %
9503 % %
9504 % %
9505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9506 %
9507 % MagickScaleImage() scales the size of an image to the given dimensions.
9508 %
9509 % The format of the MagickScaleImage method is:
9510 %
9511 % MagickBooleanType MagickScaleImage(MagickWand *wand,
9512 % const size_t columns,const size_t rows)
9513 %
9514 % A description of each parameter follows:
9515 %
9516 % o wand: the magick wand.
9517 %
9518 % o columns: the number of columns in the scaled image.
9519 %
9520 % o rows: the number of rows in the scaled image.
9521 %
9522 %
9523 */
9524 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9525  const size_t columns,const size_t rows)
9526 {
9527  Image
9528  *scale_image;
9529 
9530  assert(wand != (MagickWand *) NULL);
9531  assert(wand->signature == MagickWandSignature);
9532  if (wand->debug != MagickFalse)
9533  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9534  if (wand->images == (Image *) NULL)
9535  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9536  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9537  if (scale_image == (Image *) NULL)
9538  return(MagickFalse);
9539  ReplaceImageInList(&wand->images,scale_image);
9540  return(MagickTrue);
9541 }
9542 
9543 /*
9544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9545 % %
9546 % %
9547 % %
9548 % M a g i c k S e g m e n t I m a g e %
9549 % %
9550 % %
9551 % %
9552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9553 %
9554 % MagickSegmentImage() segments an image by analyzing the histograms of the
9555 % color components and identifying units that are homogeneous with the fuzzy
9556 % C-means technique.
9557 %
9558 % The format of the SegmentImage method is:
9559 %
9560 % MagickBooleanType MagickSegmentImage(MagickWand *wand,
9561 % const ColorspaceType colorspace,const MagickBooleanType verbose,
9562 % const double cluster_threshold,const double smooth_threshold)
9563 %
9564 % A description of each parameter follows.
9565 %
9566 % o wand: the wand.
9567 %
9568 % o colorspace: the image colorspace.
9569 %
9570 % o verbose: Set to MagickTrue to print detailed information about the
9571 % identified classes.
9572 %
9573 % o cluster_threshold: This represents the minimum number of pixels
9574 % contained in a hexahedra before it can be considered valid (expressed as
9575 % a percentage).
9576 %
9577 % o smooth_threshold: the smoothing threshold eliminates noise in the second
9578 % derivative of the histogram. As the value is increased, you can expect a
9579 % smoother second derivative.
9580 %
9581 */
9582 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9583  const ColorspaceType colorspace,const MagickBooleanType verbose,
9584  const double cluster_threshold,const double smooth_threshold)
9585 {
9586  MagickBooleanType
9587  status;
9588 
9589  assert(wand != (MagickWand *) NULL);
9590  assert(wand->signature == MagickWandSignature);
9591  if (wand->debug != MagickFalse)
9592  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9593  if (wand->images == (Image *) NULL)
9594  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9595  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9596  smooth_threshold,wand->exception);
9597  return(status);
9598 }
9599 
9600 /*
9601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9602 % %
9603 % %
9604 % %
9605 % M a g i c k S e l e c t i v e B l u r I m a g e %
9606 % %
9607 % %
9608 % %
9609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9610 %
9611 % MagickSelectiveBlurImage() selectively blur an image within a contrast
9612 % threshold. It is similar to the unsharpen mask that sharpens everything with
9613 % contrast above a certain threshold.
9614 %
9615 % The format of the MagickSelectiveBlurImage method is:
9616 %
9617 % MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9618 % const double radius,const double sigma,const double threshold)
9619 %
9620 % A description of each parameter follows:
9621 %
9622 % o wand: the magick wand.
9623 %
9624 % o radius: the radius of the gaussian, in pixels, not counting the center
9625 % pixel.
9626 %
9627 % o sigma: the standard deviation of the gaussian, in pixels.
9628 %
9629 % o threshold: only pixels within this contrast threshold are included
9630 % in the blur operation.
9631 %
9632 */
9633 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9634  const double radius,const double sigma,const double threshold)
9635 {
9636  Image
9637  *blur_image;
9638 
9639  assert(wand != (MagickWand *) NULL);
9640  assert(wand->signature == MagickWandSignature);
9641  if (wand->debug != MagickFalse)
9642  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9643  if (wand->images == (Image *) NULL)
9644  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9645  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
9646  wand->exception);
9647  if (blur_image == (Image *) NULL)
9648  return(MagickFalse);
9649  ReplaceImageInList(&wand->images,blur_image);
9650  return(MagickTrue);
9651 }
9652 
9653 /*
9654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9655 % %
9656 % %
9657 % %
9658 % 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 %
9659 % %
9660 % %
9661 % %
9662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9663 %
9664 % MagickSeparateImage() separates a channel from the image and returns a
9665 % grayscale image. A channel is a particular color component of each pixel
9666 % in the image.
9667 %
9668 % The format of the MagickSeparateImage method is:
9669 %
9670 % MagickBooleanType MagickSeparateImage(MagickWand *wand,
9671 % const ChannelType channel)
9672 %
9673 % A description of each parameter follows:
9674 %
9675 % o wand: the magick wand.
9676 %
9677 % o channel: the channel.
9678 %
9679 */
9680 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
9681  const ChannelType channel)
9682 {
9683  Image
9684  *separate_image;
9685 
9686  assert(wand != (MagickWand *) NULL);
9687  assert(wand->signature == MagickWandSignature);
9688  if (wand->debug != MagickFalse)
9689  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9690  if (wand->images == (Image *) NULL)
9691  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9692  separate_image=SeparateImage(wand->images,channel,wand->exception);
9693  if (separate_image == (Image *) NULL)
9694  return(MagickFalse);
9695  ReplaceImageInList(&wand->images,separate_image);
9696  return(MagickTrue);
9697 }
9698 
9699 /*
9700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9701 % %
9702 % %
9703 % %
9704 % M a g i c k S e p i a T o n e I m a g e %
9705 % %
9706 % %
9707 % %
9708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9709 %
9710 % MagickSepiaToneImage() applies a special effect to the image, similar to the
9711 % effect achieved in a photo darkroom by sepia toning. Threshold ranges from
9712 % 0 to QuantumRange and is a measure of the extent of the sepia toning. A
9713 % threshold of 80% is a good starting point for a reasonable tone.
9714 %
9715 % The format of the MagickSepiaToneImage method is:
9716 %
9717 % MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9718 % const double threshold)
9719 %
9720 % A description of each parameter follows:
9721 %
9722 % o wand: the magick wand.
9723 %
9724 % o threshold: Define the extent of the sepia toning.
9725 %
9726 */
9727 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9728  const double threshold)
9729 {
9730  Image
9731  *sepia_image;
9732 
9733  assert(wand != (MagickWand *) NULL);
9734  assert(wand->signature == MagickWandSignature);
9735  if (wand->debug != MagickFalse)
9736  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9737  if (wand->images == (Image *) NULL)
9738  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9739  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9740  if (sepia_image == (Image *) NULL)
9741  return(MagickFalse);
9742  ReplaceImageInList(&wand->images,sepia_image);
9743  return(MagickTrue);
9744 }
9745 
9746 /*
9747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9748 % %
9749 % %
9750 % %
9751 % M a g i c k S e t I m a g e %
9752 % %
9753 % %
9754 % %
9755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9756 %
9757 % MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
9758 % MagickNextImage(), MagickPreviousImage() with the images from the specified
9759 % wand.
9760 %
9761 % The format of the MagickSetImage method is:
9762 %
9763 % MagickBooleanType MagickSetImage(MagickWand *wand,
9764 % const MagickWand *set_wand)
9765 %
9766 % A description of each parameter follows:
9767 %
9768 % o wand: the magick wand.
9769 %
9770 % o set_wand: the set_wand wand.
9771 %
9772 */
9773 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9774  const MagickWand *set_wand)
9775 {
9776  Image
9777  *images;
9778 
9779  assert(wand != (MagickWand *) NULL);
9780  assert(wand->signature == MagickWandSignature);
9781  if (wand->debug != MagickFalse)
9782  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9783  assert(set_wand != (MagickWand *) NULL);
9784  assert(set_wand->signature == MagickWandSignature);
9785  if (wand->debug != MagickFalse)
9786  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9787  if (set_wand->images == (Image *) NULL)
9788  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9789  images=CloneImageList(set_wand->images,wand->exception);
9790  if (images == (Image *) NULL)
9791  return(MagickFalse);
9792  ReplaceImageInList(&wand->images,images);
9793  return(MagickTrue);
9794 }
9795 
9796 /*
9797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9798 % %
9799 % %
9800 % %
9801 % 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 %
9802 % %
9803 % %
9804 % %
9805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9806 %
9807 % MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9808 % alpha channel.
9809 %
9810 % The format of the MagickSetImageAlphaChannel method is:
9811 %
9812 % MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9813 % const AlphaChannelOption alpha_type)
9814 %
9815 % A description of each parameter follows:
9816 %
9817 % o wand: the magick wand.
9818 %
9819 % o alpha_type: the alpha channel type: ActivateAlphaChannel,
9820 % DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9821 %
9822 */
9823 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9824  const AlphaChannelOption alpha_type)
9825 {
9826  assert(wand != (MagickWand *) NULL);
9827  assert(wand->signature == MagickWandSignature);
9828  if (wand->debug != MagickFalse)
9829  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9830  if (wand->images == (Image *) NULL)
9831  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9832  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9833 }
9834 
9835 /*
9836 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9837 % %
9838 % %
9839 % %
9840 % 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 %
9841 % %
9842 % %
9843 % %
9844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9845 %
9846 % MagickSetImageBackgroundColor() sets the image background color.
9847 %
9848 % The format of the MagickSetImageBackgroundColor method is:
9849 %
9850 % MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9851 % const PixelWand *background)
9852 %
9853 % A description of each parameter follows:
9854 %
9855 % o wand: the magick wand.
9856 %
9857 % o background: the background pixel wand.
9858 %
9859 */
9860 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9861  const PixelWand *background)
9862 {
9863  assert(wand != (MagickWand *) NULL);
9864  assert(wand->signature == MagickWandSignature);
9865  if (wand->debug != MagickFalse)
9866  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9867  if (wand->images == (Image *) NULL)
9868  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9869  PixelGetQuantumPacket(background,&wand->images->background_color);
9870  return(MagickTrue);
9871 }
9872 
9873 /*
9874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9875 % %
9876 % %
9877 % %
9878 % 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 %
9879 % %
9880 % %
9881 % %
9882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9883 %
9884 % MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9885 %
9886 % The format of the MagickSetImageBluePrimary method is:
9887 %
9888 % MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9889 % const double x,const double y,const double z)
9890 %
9891 % A description of each parameter follows:
9892 %
9893 % o wand: the magick wand.
9894 %
9895 % o x: the blue primary x-point.
9896 %
9897 % o y: the blue primary y-point.
9898 %
9899 % o z: the blue primary z-point.
9900 %
9901 */
9902 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9903  const double x,const double y,const double z)
9904 {
9905  assert(wand != (MagickWand *) NULL);
9906  assert(wand->signature == MagickWandSignature);
9907  if (wand->debug != MagickFalse)
9908  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9909  if (wand->images == (Image *) NULL)
9910  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9911  wand->images->chromaticity.blue_primary.x=x;
9912  wand->images->chromaticity.blue_primary.y=y;
9913  wand->images->chromaticity.blue_primary.z=z;
9914  return(MagickTrue);
9915 }
9916 
9917 /*
9918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9919 % %
9920 % %
9921 % %
9922 % 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 %
9923 % %
9924 % %
9925 % %
9926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9927 %
9928 % MagickSetImageBorderColor() sets the image border color.
9929 %
9930 % The format of the MagickSetImageBorderColor method is:
9931 %
9932 % MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9933 % const PixelWand *border)
9934 %
9935 % A description of each parameter follows:
9936 %
9937 % o wand: the magick wand.
9938 %
9939 % o border: the border pixel wand.
9940 %
9941 */
9942 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9943  const PixelWand *border)
9944 {
9945  assert(wand != (MagickWand *) NULL);
9946  assert(wand->signature == MagickWandSignature);
9947  if (wand->debug != MagickFalse)
9948  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9949  if (wand->images == (Image *) NULL)
9950  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9951  PixelGetQuantumPacket(border,&wand->images->border_color);
9952  return(MagickTrue);
9953 }
9954 
9955 /*
9956 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9957 % %
9958 % %
9959 % %
9960 % 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 %
9961 % %
9962 % %
9963 % %
9964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9965 %
9966 % MagickSetImageChannelMask() sets image channel mask.
9967 %
9968 % The format of the MagickSetImageChannelMask method is:
9969 %
9970 % ChannelType MagickSetImageChannelMask(MagickWand *wand,
9971 % const ChannelType channel_mask)
9972 %
9973 % A description of each parameter follows:
9974 %
9975 % o wand: the magick wand.
9976 %
9977 % o channel_mask: the channel_mask wand.
9978 %
9979 */
9980 WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9981  const ChannelType channel_mask)
9982 {
9983  assert(wand != (MagickWand *) NULL);
9984  assert(wand->signature == MagickWandSignature);
9985  if (wand->debug != MagickFalse)
9986  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9987  return(SetImageChannelMask(wand->images,channel_mask));
9988 }
9989 
9990 /*
9991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9992 % %
9993 % %
9994 % %
9995 % M a g i c k S e t I m a g e M a s k %
9996 % %
9997 % %
9998 % %
9999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10000 %
10001 % MagickSetImageMask() sets image clip mask.
10002 %
10003 % The format of the MagickSetImageMask method is:
10004 %
10005 % MagickBooleanType MagickSetImageMask(MagickWand *wand,
10006 % const PixelMask type,const MagickWand *clip_mask)
10007 %
10008 % A description of each parameter follows:
10009 %
10010 % o wand: the magick wand.
10011 %
10012 % o type: type of mask, ReadPixelMask or WritePixelMask.
10013 %
10014 % o clip_mask: the clip_mask wand.
10015 %
10016 */
10017 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
10018  const PixelMask type,const MagickWand *clip_mask)
10019 {
10020  assert(wand != (MagickWand *) NULL);
10021  assert(wand->signature == MagickWandSignature);
10022  if (wand->debug != MagickFalse)
10023  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10024  assert(clip_mask != (MagickWand *) NULL);
10025  assert(clip_mask->signature == MagickWandSignature);
10026  if (clip_mask->debug != MagickFalse)
10027  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
10028  if (clip_mask->images == (Image *) NULL)
10029  ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
10030  return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
10031 }
10032 
10033 /*
10034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10035 % %
10036 % %
10037 % %
10038 % M a g i c k S e t I m a g e C o l o r %
10039 % %
10040 % %
10041 % %
10042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10043 %
10044 % MagickSetImageColor() set the entire wand canvas to the specified color.
10045 %
10046 % The format of the MagickSetImageColor method is:
10047 %
10048 % MagickBooleanType MagickSetImageColor(MagickWand *wand,
10049 % const PixelWand *color)
10050 %
10051 % A description of each parameter follows:
10052 %
10053 % o wand: the magick wand.
10054 %
10055 % o background: the image color.
10056 %
10057 */
10058 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
10059  const PixelWand *color)
10060 {
10061  PixelInfo
10062  pixel;
10063 
10064  assert(wand != (MagickWand *) NULL);
10065  assert(wand->signature == MagickWandSignature);
10066  if (wand->debug != MagickFalse)
10067  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10068  PixelGetMagickColor(color,&pixel);
10069  return(SetImageColor(wand->images,&pixel,wand->exception));
10070 }
10071 
10072 /*
10073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10074 % %
10075 % %
10076 % %
10077 % 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 %
10078 % %
10079 % %
10080 % %
10081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10082 %
10083 % MagickSetImageColormapColor() sets the color of the specified colormap
10084 % index.
10085 %
10086 % The format of the MagickSetImageColormapColor method is:
10087 %
10088 % MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10089 % const size_t index,const PixelWand *color)
10090 %
10091 % A description of each parameter follows:
10092 %
10093 % o wand: the magick wand.
10094 %
10095 % o index: the offset into the image colormap.
10096 %
10097 % o color: Return the colormap color in this wand.
10098 %
10099 */
10100 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10101  const size_t index,const PixelWand *color)
10102 {
10103  assert(wand != (MagickWand *) NULL);
10104  assert(wand->signature == MagickWandSignature);
10105  if (wand->debug != MagickFalse)
10106  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10107  if (wand->images == (Image *) NULL)
10108  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10109  if ((wand->images->colormap == (PixelInfo *) NULL) ||
10110  (index >= wand->images->colors))
10111  ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
10112  PixelGetQuantumPacket(color,wand->images->colormap+index);
10113  return(SyncImage(wand->images,wand->exception));
10114 }
10115 
10116 /*
10117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10118 % %
10119 % %
10120 % %
10121 % M a g i c k S e t I m a g e C o l o r s p a c e %
10122 % %
10123 % %
10124 % %
10125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10126 %
10127 % MagickSetImageColorspace() sets the image colorspace. But does not modify
10128 % the image data.
10129 %
10130 % The format of the MagickSetImageColorspace method is:
10131 %
10132 % MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10133 % const ColorspaceType colorspace)
10134 %
10135 % A description of each parameter follows:
10136 %
10137 % o wand: the magick wand.
10138 %
10139 % o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
10140 % GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
10141 % YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
10142 % YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
10143 % HSLColorspace, or HWBColorspace.
10144 %
10145 */
10146 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10147  const ColorspaceType colorspace)
10148 {
10149  assert(wand != (MagickWand *) NULL);
10150  assert(wand->signature == MagickWandSignature);
10151  if (wand->debug != MagickFalse)
10152  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10153  if (wand->images == (Image *) NULL)
10154  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10155  return(SetImageColorspace(wand->images,colorspace,wand->exception));
10156 }
10157 
10158 /*
10159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10160 % %
10161 % %
10162 % %
10163 % M a g i c k S e t I m a g e C o m p o s e %
10164 % %
10165 % %
10166 % %
10167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10168 %
10169 % MagickSetImageCompose() sets the image composite operator, useful for
10170 % specifying how to composite the image thumbnail when using the
10171 % MagickMontageImage() method.
10172 %
10173 % The format of the MagickSetImageCompose method is:
10174 %
10175 % MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10176 % const CompositeOperator compose)
10177 %
10178 % A description of each parameter follows:
10179 %
10180 % o wand: the magick wand.
10181 %
10182 % o compose: the image composite operator.
10183 %
10184 */
10185 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10186  const CompositeOperator compose)
10187 {
10188  assert(wand != (MagickWand *) NULL);
10189  assert(wand->signature == MagickWandSignature);
10190  if (wand->debug != MagickFalse)
10191  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10192  if (wand->images == (Image *) NULL)
10193  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10194  wand->images->compose=compose;
10195  return(MagickTrue);
10196 }
10197 
10198 /*
10199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10200 % %
10201 % %
10202 % %
10203 % 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 %
10204 % %
10205 % %
10206 % %
10207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10208 %
10209 % MagickSetImageCompression() sets the image compression.
10210 %
10211 % The format of the MagickSetImageCompression method is:
10212 %
10213 % MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10214 % const CompressionType compression)
10215 %
10216 % A description of each parameter follows:
10217 %
10218 % o wand: the magick wand.
10219 %
10220 % o compression: the image compression type.
10221 %
10222 */
10223 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10224  const CompressionType compression)
10225 {
10226  assert(wand != (MagickWand *) NULL);
10227  assert(wand->signature == MagickWandSignature);
10228  if (wand->debug != MagickFalse)
10229  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10230  if (wand->images == (Image *) NULL)
10231  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10232  wand->images->compression=compression;
10233  return(MagickTrue);
10234 }
10235 
10236 /*
10237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10238 % %
10239 % %
10240 % %
10241 % 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 %
10242 % %
10243 % %
10244 % %
10245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10246 %
10247 % MagickSetImageCompressionQuality() sets the image compression quality.
10248 %
10249 % The format of the MagickSetImageCompressionQuality method is:
10250 %
10251 % MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10252 % const size_t quality)
10253 %
10254 % A description of each parameter follows:
10255 %
10256 % o wand: the magick wand.
10257 %
10258 % o quality: the image compression tlityype.
10259 %
10260 */
10261 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10262  const size_t quality)
10263 {
10264  assert(wand != (MagickWand *) NULL);
10265  assert(wand->signature == MagickWandSignature);
10266  if (wand->debug != MagickFalse)
10267  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10268  if (wand->images == (Image *) NULL)
10269  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10270  wand->images->quality=quality;
10271  return(MagickTrue);
10272 }
10273 
10274 /*
10275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10276 % %
10277 % %
10278 % %
10279 % M a g i c k S e t I m a g e D e l a y %
10280 % %
10281 % %
10282 % %
10283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10284 %
10285 % MagickSetImageDelay() sets the image delay.
10286 %
10287 % The format of the MagickSetImageDelay method is:
10288 %
10289 % MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10290 % const size_t delay)
10291 %
10292 % A description of each parameter follows:
10293 %
10294 % o wand: the magick wand.
10295 %
10296 % o delay: the image delay in ticks-per-second units.
10297 %
10298 */
10299 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10300  const size_t delay)
10301 {
10302  assert(wand != (MagickWand *) NULL);
10303  assert(wand->signature == MagickWandSignature);
10304  if (wand->debug != MagickFalse)
10305  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10306  if (wand->images == (Image *) NULL)
10307  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10308  wand->images->delay=delay;
10309  return(MagickTrue);
10310 }
10311 
10312 /*
10313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10314 % %
10315 % %
10316 % %
10317 % M a g i c k S e t I m a g e D e p t h %
10318 % %
10319 % %
10320 % %
10321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10322 %
10323 % MagickSetImageDepth() sets the image depth.
10324 %
10325 % The format of the MagickSetImageDepth method is:
10326 %
10327 % MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10328 % const size_t depth)
10329 %
10330 % A description of each parameter follows:
10331 %
10332 % o wand: the magick wand.
10333 %
10334 % o depth: the image depth in bits: 8, 16, or 32.
10335 %
10336 */
10337 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10338  const size_t depth)
10339 {
10340  assert(wand != (MagickWand *) NULL);
10341  assert(wand->signature == MagickWandSignature);
10342  if (wand->debug != MagickFalse)
10343  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10344  if (wand->images == (Image *) NULL)
10345  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10346  return(SetImageDepth(wand->images,depth,wand->exception));
10347 }
10348 
10349 /*
10350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10351 % %
10352 % %
10353 % %
10354 % M a g i c k S e t I m a g e D i s p o s e %
10355 % %
10356 % %
10357 % %
10358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10359 %
10360 % MagickSetImageDispose() sets the image disposal method.
10361 %
10362 % The format of the MagickSetImageDispose method is:
10363 %
10364 % MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10365 % const DisposeType dispose)
10366 %
10367 % A description of each parameter follows:
10368 %
10369 % o wand: the magick wand.
10370 %
10371 % o dispose: the image disposal type.
10372 %
10373 */
10374 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10375  const DisposeType dispose)
10376 {
10377  assert(wand != (MagickWand *) NULL);
10378  assert(wand->signature == MagickWandSignature);
10379  if (wand->debug != MagickFalse)
10380  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10381  if (wand->images == (Image *) NULL)
10382  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10383  wand->images->dispose=dispose;
10384  return(MagickTrue);
10385 }
10386 
10387 /*
10388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10389 % %
10390 % %
10391 % %
10392 % M a g i c k S e t I m a g e E n d i a n %
10393 % %
10394 % %
10395 % %
10396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10397 %
10398 % MagickSetImageEndian() sets the image endian method.
10399 %
10400 % The format of the MagickSetImageEndian method is:
10401 %
10402 % MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10403 % const EndianType endian)
10404 %
10405 % A description of each parameter follows:
10406 %
10407 % o wand: the magick wand.
10408 %
10409 % o endian: the image endian type.
10410 %
10411 */
10412 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10413  const EndianType endian)
10414 {
10415  assert(wand != (MagickWand *) NULL);
10416  assert(wand->signature == MagickWandSignature);
10417  if (wand->debug != MagickFalse)
10418  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10419  if (wand->images == (Image *) NULL)
10420  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10421  wand->images->endian=endian;
10422  return(MagickTrue);
10423 }
10424 
10425 /*
10426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10427 % %
10428 % %
10429 % %
10430 % M a g i c k S e t I m a g e E x t e n t %
10431 % %
10432 % %
10433 % %
10434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10435 %
10436 % MagickSetImageExtent() sets the image size (i.e. columns & rows).
10437 %
10438 % The format of the MagickSetImageExtent method is:
10439 %
10440 % MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10441 % const size_t columns,const unsigned rows)
10442 %
10443 % A description of each parameter follows:
10444 %
10445 % o wand: the magick wand.
10446 %
10447 % o columns: The image width in pixels.
10448 %
10449 % o rows: The image height in pixels.
10450 %
10451 */
10452 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10453  const size_t columns,const size_t rows)
10454 {
10455  assert(wand != (MagickWand *) NULL);
10456  assert(wand->signature == MagickWandSignature);
10457  if (wand->debug != MagickFalse)
10458  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10459  if (wand->images == (Image *) NULL)
10460  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10461  return(SetImageExtent(wand->images,columns,rows,wand->exception));
10462 }
10463 
10464 /*
10465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10466 % %
10467 % %
10468 % %
10469 % M a g i c k S e t I m a g e F i l e n a m e %
10470 % %
10471 % %
10472 % %
10473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10474 %
10475 % MagickSetImageFilename() sets the filename of a particular image in a
10476 % sequence.
10477 %
10478 % The format of the MagickSetImageFilename method is:
10479 %
10480 % MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10481 % const char *filename)
10482 %
10483 % A description of each parameter follows:
10484 %
10485 % o wand: the magick wand.
10486 %
10487 % o filename: the image filename.
10488 %
10489 */
10490 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10491  const char *filename)
10492 {
10493  assert(wand != (MagickWand *) NULL);
10494  assert(wand->signature == MagickWandSignature);
10495  if (wand->debug != MagickFalse)
10496  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10497  if (wand->images == (Image *) NULL)
10498  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10499  if (filename == (const char *) NULL)
10500  return(MagickFalse);
10501  (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
10502  return(MagickTrue);
10503 }
10504 
10505 /*
10506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10507 % %
10508 % %
10509 % %
10510 % M a g i c k S e t I m a g e G r a v i t y %
10511 % %
10512 % %
10513 % %
10514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10515 %
10516 % MagickSetImageFilter() sets the image filter type.
10517 %
10518 % The format of the MagickSetImageFilter method is:
10519 %
10520 % MagickBooleanType MagickSetImageFilter(MagickWand *wand,
10521 % const FilterType filter)
10522 %
10523 % A description of each parameter follows:
10524 %
10525 % o wand: the magick wand.
10526 %
10527 % o filter: Bartlett, Blackman, Bohman, Box, Catrom, Cosine, Cubic,
10528 % CubicSpline, Gaussian, Hamming, Hann, Hermite, Jinc, Kaiser, Lagrange,
10529 % Lanczos, Lanczos2, Lanczos2Sharp, LanczosRadius, LanczosSharp, Mitchell,
10530 % Parzen, Point, Quadratic, Robidoux, RobidouxSharp, Sinc, SincFast,
10531 % Spline, Triangle, Undefined, Welch.
10532 %
10533 */
10534 WandExport MagickBooleanType MagickSetImageFilter(MagickWand *wand,
10535  const FilterType filter)
10536 {
10537  assert(wand != (MagickWand *) NULL);
10538  assert(wand->signature == MagickWandSignature);
10539  if (wand->debug != MagickFalse)
10540  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10541  if (wand->images == (Image *) NULL)
10542  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10543  wand->images->filter=filter;
10544  return(MagickTrue);
10545 }
10546 
10547 /*
10548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10549 % %
10550 % %
10551 % %
10552 % M a g i c k S e t I m a g e F o r m a t %
10553 % %
10554 % %
10555 % %
10556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10557 %
10558 % MagickSetImageFormat() sets the format of a particular image in a
10559 % sequence.
10560 %
10561 % The format of the MagickSetImageFormat method is:
10562 %
10563 % MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10564 % const char *format)
10565 %
10566 % A description of each parameter follows:
10567 %
10568 % o wand: the magick wand.
10569 %
10570 % o format: the image format.
10571 %
10572 */
10573 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10574  const char *format)
10575 {
10576  const MagickInfo
10577  *magick_info;
10578 
10579  assert(wand != (MagickWand *) NULL);
10580  assert(wand->signature == MagickWandSignature);
10581  if (wand->debug != MagickFalse)
10582  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10583  if (wand->images == (Image *) NULL)
10584  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10585  if ((format == (char *) NULL) || (*format == '\0'))
10586  {
10587  *wand->images->magick='\0';
10588  return(MagickTrue);
10589  }
10590  magick_info=GetMagickInfo(format,wand->exception);
10591  if (magick_info == (const MagickInfo *) NULL)
10592  return(MagickFalse);
10593  ClearMagickException(wand->exception);
10594  (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
10595  LocaleUpper(wand->images->magick);
10596  return(MagickTrue);
10597 }
10598 
10599 /*
10600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10601 % %
10602 % %
10603 % %
10604 % M a g i c k S e t I m a g e F u z z %
10605 % %
10606 % %
10607 % %
10608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10609 %
10610 % MagickSetImageFuzz() sets the image fuzz.
10611 %
10612 % The format of the MagickSetImageFuzz method is:
10613 %
10614 % MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10615 % const double fuzz)
10616 %
10617 % A description of each parameter follows:
10618 %
10619 % o wand: the magick wand.
10620 %
10621 % o fuzz: the image fuzz.
10622 %
10623 */
10624 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10625  const double fuzz)
10626 {
10627  assert(wand != (MagickWand *) NULL);
10628  assert(wand->signature == MagickWandSignature);
10629  if (wand->debug != MagickFalse)
10630  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10631  if (wand->images == (Image *) NULL)
10632  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10633  wand->images->fuzz=fuzz;
10634  return(MagickTrue);
10635 }
10636 
10637 /*
10638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10639 % %
10640 % %
10641 % %
10642 % M a g i c k S e t I m a g e G a m m a %
10643 % %
10644 % %
10645 % %
10646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10647 %
10648 % MagickSetImageGamma() sets the image gamma.
10649 %
10650 % The format of the MagickSetImageGamma method is:
10651 %
10652 % MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10653 % const double gamma)
10654 %
10655 % A description of each parameter follows:
10656 %
10657 % o wand: the magick wand.
10658 %
10659 % o gamma: the image gamma.
10660 %
10661 */
10662 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10663  const double gamma)
10664 {
10665  assert(wand != (MagickWand *) NULL);
10666  assert(wand->signature == MagickWandSignature);
10667  if (wand->debug != MagickFalse)
10668  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10669  if (wand->images == (Image *) NULL)
10670  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10671  wand->images->gamma=gamma;
10672  return(MagickTrue);
10673 }
10674 
10675 /*
10676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10677 % %
10678 % %
10679 % %
10680 % M a g i c k S e t I m a g e G r a v i t y %
10681 % %
10682 % %
10683 % %
10684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10685 %
10686 % MagickSetImageGravity() sets the image gravity type.
10687 %
10688 % The format of the MagickSetImageGravity method is:
10689 %
10690 % MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10691 % const GravityType gravity)
10692 %
10693 % A description of each parameter follows:
10694 %
10695 % o wand: the magick wand.
10696 %
10697 % o gravity: positioning gravity (NorthWestGravity, NorthGravity,
10698 % NorthEastGravity, WestGravity, CenterGravity,
10699 % EastGravity, SouthWestGravity, SouthGravity,
10700 % SouthEastGravity)
10701 %
10702 */
10703 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10704  const GravityType gravity)
10705 {
10706  assert(wand != (MagickWand *) NULL);
10707  assert(wand->signature == MagickWandSignature);
10708  if (wand->debug != MagickFalse)
10709  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10710  if (wand->images == (Image *) NULL)
10711  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10712  wand->images->gravity=gravity;
10713  return(MagickTrue);
10714 }
10715 
10716 /*
10717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10718 % %
10719 % %
10720 % %
10721 % 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 %
10722 % %
10723 % %
10724 % %
10725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10726 %
10727 % MagickSetImageGreenPrimary() sets the image chromaticity green primary
10728 % point.
10729 %
10730 % The format of the MagickSetImageGreenPrimary method is:
10731 %
10732 % MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10733 % const double x,const double y,const double z)
10734 %
10735 % A description of each parameter follows:
10736 %
10737 % o wand: the magick wand.
10738 %
10739 % o x: the green primary x-point.
10740 %
10741 % o y: the green primary y-point.
10742 %
10743 % o z: the green primary z-point.
10744 %
10745 */
10746 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10747  const double x,const double y,const double z)
10748 {
10749  assert(wand != (MagickWand *) NULL);
10750  assert(wand->signature == MagickWandSignature);
10751  if (wand->debug != MagickFalse)
10752  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10753  if (wand->images == (Image *) NULL)
10754  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10755  wand->images->chromaticity.green_primary.x=x;
10756  wand->images->chromaticity.green_primary.y=y;
10757  wand->images->chromaticity.green_primary.z=z;
10758  return(MagickTrue);
10759 }
10760 
10761 /*
10762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10763 % %
10764 % %
10765 % %
10766 % 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 %
10767 % %
10768 % %
10769 % %
10770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10771 %
10772 % MagickSetImageInterlaceScheme() sets the image interlace scheme.
10773 %
10774 % The format of the MagickSetImageInterlaceScheme method is:
10775 %
10776 % MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10777 % const InterlaceType interlace)
10778 %
10779 % A description of each parameter follows:
10780 %
10781 % o wand: the magick wand.
10782 %
10783 % o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10784 % PlaneInterlace, PartitionInterlace.
10785 %
10786 */
10787 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10788  const InterlaceType interlace)
10789 {
10790  assert(wand != (MagickWand *) NULL);
10791  assert(wand->signature == MagickWandSignature);
10792  if (wand->debug != MagickFalse)
10793  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10794  if (wand->images == (Image *) NULL)
10795  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10796  wand->images->interlace=interlace;
10797  return(MagickTrue);
10798 }
10799 
10800 /*
10801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10802 % %
10803 % %
10804 % %
10805 % 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 %
10806 % %
10807 % %
10808 % %
10809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10810 %
10811 % MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10812 %
10813 % The format of the MagickSetImageInterpolateMethod method is:
10814 %
10815 % MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10816 % const PixelInterpolateMethod method)
10817 %
10818 % A description of each parameter follows:
10819 %
10820 % o wand: the magick wand.
10821 %
10822 % o method: the image interpole pixel methods: choose from Undefined,
10823 % Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10824 %
10825 */
10826 
10827 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
10828  MagickWand *wand,const PixelInterpolateMethod method)
10829 {
10830  return(MagickSetImageInterpolateMethod(wand,method));
10831 }
10832 
10833 WandExport MagickBooleanType MagickSetImageInterpolateMethod(
10834  MagickWand *wand,const PixelInterpolateMethod method)
10835 {
10836  assert(wand != (MagickWand *) NULL);
10837  assert(wand->signature == MagickWandSignature);
10838  if (wand->debug != MagickFalse)
10839  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10840  if (wand->images == (Image *) NULL)
10841  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10842  wand->images->interpolate=method;
10843  return(MagickTrue);
10844 }
10845 
10846 /*
10847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10848 % %
10849 % %
10850 % %
10851 % M a g i c k S e t I m a g e I t e r a t i o n s %
10852 % %
10853 % %
10854 % %
10855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10856 %
10857 % MagickSetImageIterations() sets the image iterations.
10858 %
10859 % The format of the MagickSetImageIterations method is:
10860 %
10861 % MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10862 % const size_t iterations)
10863 %
10864 % A description of each parameter follows:
10865 %
10866 % o wand: the magick wand.
10867 %
10868 % o delay: the image delay in 1/100th of a second.
10869 %
10870 */
10871 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10872  const size_t iterations)
10873 {
10874  assert(wand != (MagickWand *) NULL);
10875  assert(wand->signature == MagickWandSignature);
10876  if (wand->debug != MagickFalse)
10877  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10878  if (wand->images == (Image *) NULL)
10879  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10880  wand->images->iterations=iterations;
10881  return(MagickTrue);
10882 }
10883 
10884 /*
10885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10886 % %
10887 % %
10888 % %
10889 % M a g i c k S e t I m a g e M a t t e %
10890 % %
10891 % %
10892 % %
10893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10894 %
10895 % MagickSetImageMatte() sets the image matte channel.
10896 %
10897 % The format of the MagickSetImageMatte method is:
10898 %
10899 % MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10900 % const MagickBooleanType *matte)
10901 %
10902 % A description of each parameter follows:
10903 %
10904 % o wand: the magick wand.
10905 %
10906 % o matte: Set to MagickTrue to enable the image matte channel otherwise
10907 % MagickFalse.
10908 %
10909 */
10910 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10911  const MagickBooleanType matte)
10912 {
10913  assert(wand != (MagickWand *) NULL);
10914  assert(wand->signature == MagickWandSignature);
10915  if (wand->debug != MagickFalse)
10916  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10917  if (wand->images == (Image *) NULL)
10918  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10919  if (matte == MagickFalse)
10920  wand->images->alpha_trait=UndefinedPixelTrait;
10921  else
10922  {
10923  if (wand->images->alpha_trait == UndefinedPixelTrait)
10924  (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10925  wand->images->alpha_trait=BlendPixelTrait;
10926  }
10927  return(MagickTrue);
10928 }
10929 
10930 /*
10931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10932 % %
10933 % %
10934 % %
10935 % M a g i c k S e t I m a g e M a t t e C o l o r %
10936 % %
10937 % %
10938 % %
10939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10940 %
10941 % MagickSetImageMatteColor() sets the image alpha color.
10942 %
10943 % The format of the MagickSetImageMatteColor method is:
10944 %
10945 % MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10946 % const PixelWand *matte)
10947 %
10948 % A description of each parameter follows:
10949 %
10950 % o wand: the magick wand.
10951 %
10952 % o matte: the alpha pixel wand.
10953 %
10954 */
10955 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10956  const PixelWand *alpha)
10957 {
10958  assert(wand != (MagickWand *)NULL);
10959  assert(wand->signature == MagickWandSignature);
10960  if (wand->debug != MagickFalse)
10961  (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
10962  if (wand->images == (Image *)NULL)
10963  ThrowWandException(WandError, "ContainsNoImages", wand->name);
10964  PixelGetQuantumPacket(alpha,&wand->images->matte_color);
10965  return(MagickTrue);
10966 }
10967 
10968 /*
10969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10970 % %
10971 % %
10972 % %
10973 % M a g i c k S e t I m a g e O p a c i t y %
10974 % %
10975 % %
10976 % %
10977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10978 %
10979 % MagickSetImageAlpha() sets the image to the specified alpha level.
10980 %
10981 % The format of the MagickSetImageAlpha method is:
10982 %
10983 % MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10984 % const double alpha)
10985 %
10986 % A description of each parameter follows:
10987 %
10988 % o wand: the magick wand.
10989 %
10990 % o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10991 % transparent.
10992 %
10993 */
10994 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10995  const double alpha)
10996 {
10997  MagickBooleanType
10998  status;
10999 
11000  assert(wand != (MagickWand *) NULL);
11001  assert(wand->signature == MagickWandSignature);
11002  if (wand->debug != MagickFalse)
11003  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11004  if (wand->images == (Image *) NULL)
11005  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11006  status=SetImageAlpha(wand->images,ClampToQuantum((double) QuantumRange*alpha),
11007  wand->exception);
11008  return(status);
11009 }
11010 
11011 /*
11012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11013 % %
11014 % %
11015 % %
11016 % 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 %
11017 % %
11018 % %
11019 % %
11020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11021 %
11022 % MagickSetImageOrientation() sets the image orientation.
11023 %
11024 % The format of the MagickSetImageOrientation method is:
11025 %
11026 % MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
11027 % const OrientationType orientation)
11028 %
11029 % A description of each parameter follows:
11030 %
11031 % o wand: the magick wand.
11032 %
11033 % o orientation: the image orientation type.
11034 %
11035 */
11036 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
11037  const OrientationType orientation)
11038 {
11039  assert(wand != (MagickWand *) NULL);
11040  assert(wand->signature == MagickWandSignature);
11041  if (wand->debug != MagickFalse)
11042  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11043  if (wand->images == (Image *) NULL)
11044  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11045  wand->images->orientation=orientation;
11046  return(MagickTrue);
11047 }
11048 
11049 /*
11050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11051 % %
11052 % %
11053 % %
11054 % M a g i c k S e t I m a g e P a g e %
11055 % %
11056 % %
11057 % %
11058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11059 %
11060 % MagickSetImagePage() sets the page geometry of the image.
11061 %
11062 % The format of the MagickSetImagePage method is:
11063 %
11064 % MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,% const size_t height,const ssize_t x,const ssize_t y)
11065 %
11066 % A description of each parameter follows:
11067 %
11068 % o wand: the magick wand.
11069 %
11070 % o width: the page width.
11071 %
11072 % o height: the page height.
11073 %
11074 % o x: the page x-offset.
11075 %
11076 % o y: the page y-offset.
11077 %
11078 */
11079 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
11080  const size_t width,const size_t height,const ssize_t x,
11081  const ssize_t y)
11082 {
11083  assert(wand != (MagickWand *) NULL);
11084  assert(wand->signature == MagickWandSignature);
11085  if (wand->debug != MagickFalse)
11086  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11087  if (wand->images == (Image *) NULL)
11088  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11089  wand->images->page.width=width;
11090  wand->images->page.height=height;
11091  wand->images->page.x=x;
11092  wand->images->page.y=y;
11093  return(MagickTrue);
11094 }
11095 
11096 /*
11097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11098 % %
11099 % %
11100 % %
11101 % M a g i c k S e t I m a g e P i x e l C o l o r %
11102 % %
11103 % %
11104 % %
11105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11106 %
11107 % MagickSetImagePixelColor() sets the color of the specified pixel.
11108 %
11109 % The format of the MagickSetImagePixelColor method is:
11110 %
11111 % MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11112 % const ssize_t x,const ssize_t y,const PixelWand *color)
11113 %
11114 % A description of each parameter follows:
11115 %
11116 % o wand: the magick wand.
11117 %
11118 % o x,y: the pixel offset into the image.
11119 %
11120 % o color: Return the colormap color in this wand.
11121 %
11122 */
11123 WandExport MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11124  const ssize_t x,const ssize_t y,const PixelWand *color)
11125 {
11126  Quantum
11127  *q;
11128 
11129  CacheView
11130  *image_view;
11131 
11132  assert(wand != (MagickWand *) NULL);
11133  assert(wand->signature == MagickWandSignature);
11134  if (wand->debug != MagickFalse)
11135  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11136  if (wand->images == (Image *) NULL)
11137  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11138  image_view=AcquireAuthenticCacheView(wand->images,wand->exception);
11139  q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,wand->exception);
11140  if (q == (Quantum *) NULL)
11141  {
11142  image_view=DestroyCacheView(image_view);
11143  return(MagickFalse);
11144  }
11145  PixelGetQuantumPixel(wand->images,color,q);
11146  image_view=DestroyCacheView(image_view);
11147  return(MagickTrue);
11148 }
11149 
11150 /*
11151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11152 % %
11153 % %
11154 % %
11155 % 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 %
11156 % %
11157 % %
11158 % %
11159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11160 %
11161 % MagickSetImageProgressMonitor() sets the wand image progress monitor to the
11162 % specified method and returns the previous progress monitor if any. The
11163 % progress monitor method looks like this:
11164 %
11165 % MagickBooleanType MagickProgressMonitor(const char *text,
11166 % const MagickOffsetType offset,const MagickSizeType span,
11167 % void *client_data)
11168 %
11169 % If the progress monitor returns MagickFalse, the current operation is
11170 % interrupted.
11171 %
11172 % The format of the MagickSetImageProgressMonitor method is:
11173 %
11174 % MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
11175 % const MagickProgressMonitor progress_monitor,void *client_data)
11176 %
11177 % A description of each parameter follows:
11178 %
11179 % o wand: the magick wand.
11180 %
11181 % o progress_monitor: Specifies a pointer to a method to monitor progress
11182 % of an image operation.
11183 %
11184 % o client_data: Specifies a pointer to any client data.
11185 %
11186 */
11187 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
11188  const MagickProgressMonitor progress_monitor,void *client_data)
11189 {
11190  MagickProgressMonitor
11191  previous_monitor;
11192 
11193  assert(wand != (MagickWand *) NULL);
11194  assert(wand->signature == MagickWandSignature);
11195  if (wand->debug != MagickFalse)
11196  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11197  if (wand->images == (Image *) NULL)
11198  {
11199  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11200  "ContainsNoImages","`%s'",wand->name);
11201  return((MagickProgressMonitor) NULL);
11202  }
11203  previous_monitor=SetImageProgressMonitor(wand->images,
11204  progress_monitor,client_data);
11205  return(previous_monitor);
11206 }
11207 
11208 /*
11209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11210 % %
11211 % %
11212 % %
11213 % M a g i c k S e t I m a g e R e d P r i m a r y %
11214 % %
11215 % %
11216 % %
11217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11218 %
11219 % MagickSetImageRedPrimary() sets the image chromaticity red primary point.
11220 %
11221 % The format of the MagickSetImageRedPrimary method is:
11222 %
11223 % MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11224 % const double x,const double y,const double z)
11225 %
11226 % A description of each parameter follows:
11227 %
11228 % o wand: the magick wand.
11229 %
11230 % o x: the red primary x-point.
11231 %
11232 % o y: the red primary y-point.
11233 %
11234 % o z: the red primary z-point.
11235 %
11236 */
11237 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11238  const double x,const double y,const double z)
11239 {
11240  assert(wand != (MagickWand *) NULL);
11241  assert(wand->signature == MagickWandSignature);
11242  if (wand->debug != MagickFalse)
11243  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11244  if (wand->images == (Image *) NULL)
11245  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11246  wand->images->chromaticity.red_primary.x=x;
11247  wand->images->chromaticity.red_primary.y=y;
11248  wand->images->chromaticity.red_primary.z=z;
11249  return(MagickTrue);
11250 }
11251 
11252 /*
11253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11254 % %
11255 % %
11256 % %
11257 % 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 %
11258 % %
11259 % %
11260 % %
11261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11262 %
11263 % MagickSetImageRenderingIntent() sets the image rendering intent.
11264 %
11265 % The format of the MagickSetImageRenderingIntent method is:
11266 %
11267 % MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11268 % const RenderingIntent rendering_intent)
11269 %
11270 % A description of each parameter follows:
11271 %
11272 % o wand: the magick wand.
11273 %
11274 % o rendering_intent: the image rendering intent: UndefinedIntent,
11275 % SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
11276 %
11277 */
11278 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11279  const RenderingIntent rendering_intent)
11280 {
11281  assert(wand != (MagickWand *) NULL);
11282  assert(wand->signature == MagickWandSignature);
11283  if (wand->debug != MagickFalse)
11284  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11285  if (wand->images == (Image *) NULL)
11286  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11287  wand->images->rendering_intent=rendering_intent;
11288  return(MagickTrue);
11289 }
11290 
11291 /*
11292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11293 % %
11294 % %
11295 % %
11296 % M a g i c k S e t I m a g e R e s o l u t i o n %
11297 % %
11298 % %
11299 % %
11300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11301 %
11302 % MagickSetImageResolution() sets the image resolution.
11303 %
11304 % The format of the MagickSetImageResolution method is:
11305 %
11306 % MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11307 % const double x_resolution,const double y_resolution)
11308 %
11309 % A description of each parameter follows:
11310 %
11311 % o wand: the magick wand.
11312 %
11313 % o x_resolution: the image x resolution.
11314 %
11315 % o y_resolution: the image y resolution.
11316 %
11317 */
11318 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11319  const double x_resolution,const double y_resolution)
11320 {
11321  assert(wand != (MagickWand *) NULL);
11322  assert(wand->signature == MagickWandSignature);
11323  if (wand->debug != MagickFalse)
11324  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11325  if (wand->images == (Image *) NULL)
11326  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11327  wand->images->resolution.x=x_resolution;
11328  wand->images->resolution.y=y_resolution;
11329  return(MagickTrue);
11330 }
11331 
11332 /*
11333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11334 % %
11335 % %
11336 % %
11337 % M a g i c k S e t I m a g e S c e n e %
11338 % %
11339 % %
11340 % %
11341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11342 %
11343 % MagickSetImageScene() sets the image scene.
11344 %
11345 % The format of the MagickSetImageScene method is:
11346 %
11347 % MagickBooleanType MagickSetImageScene(MagickWand *wand,
11348 % const size_t scene)
11349 %
11350 % A description of each parameter follows:
11351 %
11352 % o wand: the magick wand.
11353 %
11354 % o delay: the image scene number.
11355 %
11356 */
11357 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
11358  const size_t scene)
11359 {
11360  assert(wand != (MagickWand *) NULL);
11361  assert(wand->signature == MagickWandSignature);
11362  if (wand->debug != MagickFalse)
11363  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11364  if (wand->images == (Image *) NULL)
11365  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11366  wand->images->scene=scene;
11367  return(MagickTrue);
11368 }
11369 
11370 /*
11371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11372 % %
11373 % %
11374 % %
11375 % 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 %
11376 % %
11377 % %
11378 % %
11379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11380 %
11381 % MagickSetImageTicksPerSecond() sets the image ticks-per-second.
11382 %
11383 % The format of the MagickSetImageTicksPerSecond method is:
11384 %
11385 % MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11386 % const ssize_t ticks_per-second)
11387 %
11388 % A description of each parameter follows:
11389 %
11390 % o wand: the magick wand.
11391 %
11392 % o ticks_per_second: the units to use for the image delay.
11393 %
11394 */
11395 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11396  const ssize_t ticks_per_second)
11397 {
11398  assert(wand != (MagickWand *) NULL);
11399  assert(wand->signature == MagickWandSignature);
11400  if (wand->debug != MagickFalse)
11401  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11402  if (wand->images == (Image *) NULL)
11403  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11404  wand->images->ticks_per_second=ticks_per_second;
11405  return(MagickTrue);
11406 }
11407 
11408 /*
11409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11410 % %
11411 % %
11412 % %
11413 % M a g i c k S e t I m a g e T y p e %
11414 % %
11415 % %
11416 % %
11417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11418 %
11419 % MagickSetImageType() sets the image type.
11420 %
11421 % The format of the MagickSetImageType method is:
11422 %
11423 % MagickBooleanType MagickSetImageType(MagickWand *wand,
11424 % const ImageType image_type)
11425 %
11426 % A description of each parameter follows:
11427 %
11428 % o wand: the magick wand.
11429 %
11430 % o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
11431 % GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
11432 % TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
11433 % or OptimizeType.
11434 %
11435 */
11436 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
11437  const ImageType image_type)
11438 {
11439  assert(wand != (MagickWand *) NULL);
11440  assert(wand->signature == MagickWandSignature);
11441  if (wand->debug != MagickFalse)
11442  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11443  if (wand->images == (Image *) NULL)
11444  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11445  return(SetImageType(wand->images,image_type,wand->exception));
11446 }
11447 
11448 /*
11449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11450 % %
11451 % %
11452 % %
11453 % M a g i c k S e t I m a g e U n i t s %
11454 % %
11455 % %
11456 % %
11457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11458 %
11459 % MagickSetImageUnits() sets the image units of resolution.
11460 %
11461 % The format of the MagickSetImageUnits method is:
11462 %
11463 % MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11464 % const ResolutionType units)
11465 %
11466 % A description of each parameter follows:
11467 %
11468 % o wand: the magick wand.
11469 %
11470 % o units: the image units of resolution : UndefinedResolution,
11471 % PixelsPerInchResolution, or PixelsPerCentimeterResolution.
11472 %
11473 */
11474 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11475  const ResolutionType units)
11476 {
11477  assert(wand != (MagickWand *) NULL);
11478  assert(wand->signature == MagickWandSignature);
11479  if (wand->debug != MagickFalse)
11480  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11481  if (wand->images == (Image *) NULL)
11482  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11483  wand->images->units=units;
11484  return(MagickTrue);
11485 }
11486 
11487 /*
11488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11489 % %
11490 % %
11491 % %
11492 % 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 %
11493 % %
11494 % %
11495 % %
11496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11497 %
11498 % MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
11499 %
11500 % The format of the MagickSetImageVirtualPixelMethod method is:
11501 %
11502 % VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11503 % const VirtualPixelMethod method)
11504 %
11505 % A description of each parameter follows:
11506 %
11507 % o wand: the magick wand.
11508 %
11509 % o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
11510 % ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
11511 % MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
11512 %
11513 */
11514 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11515  const VirtualPixelMethod method)
11516 {
11517  assert(wand != (MagickWand *) NULL);
11518  assert(wand->signature == MagickWandSignature);
11519  if (wand->debug != MagickFalse)
11520  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11521  if (wand->images == (Image *) NULL)
11522  return(UndefinedVirtualPixelMethod);
11523  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
11524 }
11525 
11526 /*
11527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11528 % %
11529 % %
11530 % %
11531 % M a g i c k S e t I m a g e W h i t e P o i n t %
11532 % %
11533 % %
11534 % %
11535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11536 %
11537 % MagickSetImageWhitePoint() sets the image chromaticity white point.
11538 %
11539 % The format of the MagickSetImageWhitePoint method is:
11540 %
11541 % MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11542 % const double x,const double y,const double z)
11543 %
11544 % A description of each parameter follows:
11545 %
11546 % o wand: the magick wand.
11547 %
11548 % o x: the white x-point.
11549 %
11550 % o y: the white y-point.
11551 %
11552 % o z: the white z-point.
11553 %
11554 */
11555 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11556  const double x,const double y,const double z)
11557 {
11558  assert(wand != (MagickWand *) NULL);
11559  assert(wand->signature == MagickWandSignature);
11560  if (wand->debug != MagickFalse)
11561  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11562  if (wand->images == (Image *) NULL)
11563  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11564  wand->images->chromaticity.white_point.x=x;
11565  wand->images->chromaticity.white_point.y=y;
11566  wand->images->chromaticity.white_point.z=z;
11567  return(MagickTrue);
11568 }
11569 
11570 /*
11571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11572 % %
11573 % %
11574 % %
11575 % M a g i c k S h a d e I m a g e C h a n n e l %
11576 % %
11577 % %
11578 % %
11579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11580 %
11581 % MagickShadeImage() shines a distant light on an image to create a
11582 % three-dimensional effect. You control the positioning of the light with
11583 % azimuth and elevation; azimuth is measured in degrees off the x axis
11584 % and elevation is measured in pixels above the Z axis.
11585 %
11586 % The format of the MagickShadeImage method is:
11587 %
11588 % MagickBooleanType MagickShadeImage(MagickWand *wand,
11589 % const MagickBooleanType gray,const double azimuth,
11590 % const double elevation)
11591 %
11592 % A description of each parameter follows:
11593 %
11594 % o wand: the magick wand.
11595 %
11596 % o gray: A value other than zero shades the intensity of each pixel.
11597 %
11598 % o azimuth, elevation: Define the light source direction.
11599 %
11600 */
11601 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11602  const MagickBooleanType gray,const double azimuth,const double elevation)
11603 {
11604  Image
11605  *shade_image;
11606 
11607  assert(wand != (MagickWand *) NULL);
11608  assert(wand->signature == MagickWandSignature);
11609  if (wand->debug != MagickFalse)
11610  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11611  if (wand->images == (Image *) NULL)
11612  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11613  shade_image=ShadeImage(wand->images,gray,azimuth,elevation,wand->exception);
11614  if (shade_image == (Image *) NULL)
11615  return(MagickFalse);
11616  ReplaceImageInList(&wand->images,shade_image);
11617  return(MagickTrue);
11618 }
11619 
11620 /*
11621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11622 % %
11623 % %
11624 % %
11625 % M a g i c k S h a d o w I m a g e %
11626 % %
11627 % %
11628 % %
11629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11630 %
11631 % MagickShadowImage() simulates an image shadow.
11632 %
11633 % The format of the MagickShadowImage method is:
11634 %
11635 % MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
11636 % const double sigma,const ssize_t x,const ssize_t y)
11637 %
11638 % A description of each parameter follows:
11639 %
11640 % o wand: the magick wand.
11641 %
11642 % o alpha: percentage transparency.
11643 %
11644 % o sigma: the standard deviation of the Gaussian, in pixels.
11645 %
11646 % o x: the shadow x-offset.
11647 %
11648 % o y: the shadow y-offset.
11649 %
11650 */
11651 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11652  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
11653 {
11654  Image
11655  *shadow_image;
11656 
11657  assert(wand != (MagickWand *) NULL);
11658  assert(wand->signature == MagickWandSignature);
11659  if (wand->debug != MagickFalse)
11660  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11661  if (wand->images == (Image *) NULL)
11662  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11663  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
11664  if (shadow_image == (Image *) NULL)
11665  return(MagickFalse);
11666  ReplaceImageInList(&wand->images,shadow_image);
11667  return(MagickTrue);
11668 }
11669 
11670 /*
11671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672 % %
11673 % %
11674 % %
11675 % M a g i c k S h a r p e n I m a g e %
11676 % %
11677 % %
11678 % %
11679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11680 %
11681 % MagickSharpenImage() sharpens an image. We convolve the image with a
11682 % Gaussian operator of the given radius and standard deviation (sigma).
11683 % For reasonable results, the radius should be larger than sigma. Use a
11684 % radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11685 %
11686 % The format of the MagickSharpenImage method is:
11687 %
11688 % MagickBooleanType MagickSharpenImage(MagickWand *wand,
11689 % const double radius,const double sigma)
11690 %
11691 % A description of each parameter follows:
11692 %
11693 % o wand: the magick wand.
11694 %
11695 % o radius: the radius of the Gaussian, in pixels, not counting the center
11696 % pixel.
11697 %
11698 % o sigma: the standard deviation of the Gaussian, in pixels.
11699 %
11700 */
11701 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11702  const double radius,const double sigma)
11703 {
11704  Image
11705  *sharp_image;
11706 
11707  assert(wand != (MagickWand *) NULL);
11708  assert(wand->signature == MagickWandSignature);
11709  if (wand->debug != MagickFalse)
11710  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11711  if (wand->images == (Image *) NULL)
11712  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11713  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
11714  if (sharp_image == (Image *) NULL)
11715  return(MagickFalse);
11716  ReplaceImageInList(&wand->images,sharp_image);
11717  return(MagickTrue);
11718 }
11719 
11720 /*
11721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11722 % %
11723 % %
11724 % %
11725 % M a g i c k S h a v e I m a g e %
11726 % %
11727 % %
11728 % %
11729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11730 %
11731 % MagickShaveImage() shaves pixels from the image edges. It allocates the
11732 % memory necessary for the new Image structure and returns a pointer to the
11733 % new image.
11734 %
11735 % The format of the MagickShaveImage method is:
11736 %
11737 % MagickBooleanType MagickShaveImage(MagickWand *wand,
11738 % const size_t columns,const size_t rows)
11739 %
11740 % A description of each parameter follows:
11741 %
11742 % o wand: the magick wand.
11743 %
11744 % o columns: the number of columns in the scaled image.
11745 %
11746 % o rows: the number of rows in the scaled image.
11747 %
11748 %
11749 */
11750 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11751  const size_t columns,const size_t rows)
11752 {
11753  Image
11754  *shave_image;
11755 
11756  RectangleInfo
11757  shave_info;
11758 
11759  assert(wand != (MagickWand *) NULL);
11760  assert(wand->signature == MagickWandSignature);
11761  if (wand->debug != MagickFalse)
11762  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11763  if (wand->images == (Image *) NULL)
11764  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11765  shave_info.width=columns;
11766  shave_info.height=rows;
11767  shave_info.x=0;
11768  shave_info.y=0;
11769  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11770  if (shave_image == (Image *) NULL)
11771  return(MagickFalse);
11772  ReplaceImageInList(&wand->images,shave_image);
11773  return(MagickTrue);
11774 }
11775 
11776 /*
11777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11778 % %
11779 % %
11780 % %
11781 % M a g i c k S h e a r I m a g e %
11782 % %
11783 % %
11784 % %
11785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11786 %
11787 % MagickShearImage() slides one edge of an image along the X or Y axis,
11788 % creating a parallelogram. An X direction shear slides an edge along the X
11789 % axis, while a Y direction shear slides an edge along the Y axis. The amount
11790 % of the shear is controlled by a shear angle. For X direction shears, x_shear
11791 % is measured relative to the Y axis, and similarly, for Y direction shears
11792 % y_shear is measured relative to the X axis. Empty triangles left over from
11793 % shearing the image are filled with the background color.
11794 %
11795 % The format of the MagickShearImage method is:
11796 %
11797 % MagickBooleanType MagickShearImage(MagickWand *wand,
11798 % const PixelWand *background,const double x_shear,const double y_shear)
11799 %
11800 % A description of each parameter follows:
11801 %
11802 % o wand: the magick wand.
11803 %
11804 % o background: the background pixel wand.
11805 %
11806 % o x_shear: the number of degrees to shear the image.
11807 %
11808 % o y_shear: the number of degrees to shear the image.
11809 %
11810 */
11811 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11812  const PixelWand *background,const double x_shear,const double y_shear)
11813 {
11814  Image
11815  *shear_image;
11816 
11817  assert(wand != (MagickWand *) NULL);
11818  assert(wand->signature == MagickWandSignature);
11819  if (wand->debug != MagickFalse)
11820  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11821  if (wand->images == (Image *) NULL)
11822  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11823  PixelGetQuantumPacket(background,&wand->images->background_color);
11824  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11825  if (shear_image == (Image *) NULL)
11826  return(MagickFalse);
11827  ReplaceImageInList(&wand->images,shear_image);
11828  return(MagickTrue);
11829 }
11830 
11831 /*
11832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11833 % %
11834 % %
11835 % %
11836 % 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 %
11837 % %
11838 % %
11839 % %
11840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11841 %
11842 % MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11843 % non-linear sigmoidal contrast algorithm. Increase the contrast of the
11844 % image using a sigmoidal transfer function without saturating highlights or
11845 % shadows. Contrast indicates how much to increase the contrast (0 is none;
11846 % 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11847 % the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
11848 % sharpen to MagickTrue to increase the image contrast otherwise the contrast
11849 % is reduced.
11850 %
11851 % The format of the MagickSigmoidalContrastImage method is:
11852 %
11853 % MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11854 % const MagickBooleanType sharpen,const double alpha,const double beta)
11855 %
11856 % A description of each parameter follows:
11857 %
11858 % o wand: the magick wand.
11859 %
11860 % o sharpen: Increase or decrease image contrast.
11861 %
11862 % o alpha: strength of the contrast, the larger the number the more
11863 % 'threshold-like' it becomes.
11864 %
11865 % o beta: midpoint of the function as a color value 0 to QuantumRange.
11866 %
11867 */
11868 WandExport MagickBooleanType MagickSigmoidalContrastImage(
11869  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
11870  const double beta)
11871 {
11872  MagickBooleanType
11873  status;
11874 
11875  assert(wand != (MagickWand *) NULL);
11876  assert(wand->signature == MagickWandSignature);
11877  if (wand->debug != MagickFalse)
11878  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11879  if (wand->images == (Image *) NULL)
11880  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11881  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
11882  wand->exception);
11883  return(status);
11884 }
11885 
11886 /*
11887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11888 % %
11889 % %
11890 % %
11891 % M a g i c k S i m i l a r i t y I m a g e %
11892 % %
11893 % %
11894 % %
11895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11896 %
11897 % MagickSimilarityImage() compares the reference image of the image and
11898 % returns the best match offset. In addition, it returns a similarity image
11899 % such that an exact match location is completely white and if none of the
11900 % pixels match, black, otherwise some gray level in-between.
11901 %
11902 % The format of the MagickSimilarityImage method is:
11903 %
11904 % MagickWand *MagickSimilarityImage(MagickWand *wand,
11905 % const MagickWand *reference,const MetricType metric,
11906 % const double similarity_threshold,RectangleInfo *offset,
11907 % double *similarity)
11908 %
11909 % A description of each parameter follows:
11910 %
11911 % o wand: the magick wand.
11912 %
11913 % o reference: the reference wand.
11914 %
11915 % o metric: the metric.
11916 %
11917 % o similarity_threshold: minimum distortion for (sub)image match.
11918 %
11919 % o offset: the best match offset of the reference image within the image.
11920 %
11921 % o similarity: the computed similarity between the images.
11922 %
11923 */
11924 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11925  const MagickWand *reference,const MetricType metric,
11926  const double similarity_threshold,RectangleInfo *offset,double *similarity)
11927 {
11928  Image
11929  *similarity_image;
11930 
11931  assert(wand != (MagickWand *) NULL);
11932  assert(wand->signature == MagickWandSignature);
11933  if (wand->debug != MagickFalse)
11934  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11935  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11936  {
11937  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11938  "ContainsNoImages","`%s'",wand->name);
11939  return((MagickWand *) NULL);
11940  }
11941  similarity_image=SimilarityImage(wand->images,reference->images,metric,
11942  similarity_threshold,offset,similarity,wand->exception);
11943  if (similarity_image == (Image *) NULL)
11944  return((MagickWand *) NULL);
11945  return(CloneMagickWandFromImages(wand,similarity_image));
11946 }
11947 
11948 /*
11949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11950 % %
11951 % %
11952 % %
11953 % M a g i c k S k e t c h I m a g e %
11954 % %
11955 % %
11956 % %
11957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11958 %
11959 % MagickSketchImage() simulates a pencil sketch. We convolve the image with
11960 % a Gaussian operator of the given radius and standard deviation (sigma).
11961 % For reasonable results, radius should be larger than sigma. Use a
11962 % radius of 0 and SketchImage() selects a suitable radius for you.
11963 % Angle gives the angle of the blurring motion.
11964 %
11965 % The format of the MagickSketchImage method is:
11966 %
11967 % MagickBooleanType MagickSketchImage(MagickWand *wand,
11968 % const double radius,const double sigma,const double angle)
11969 %
11970 % A description of each parameter follows:
11971 %
11972 % o wand: the magick wand.
11973 %
11974 % o radius: the radius of the Gaussian, in pixels, not counting
11975 % the center pixel.
11976 %
11977 % o sigma: the standard deviation of the Gaussian, in pixels.
11978 %
11979 % o angle: apply the effect along this angle.
11980 %
11981 */
11982 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11983  const double radius,const double sigma,const double angle)
11984 {
11985  Image
11986  *sketch_image;
11987 
11988  assert(wand != (MagickWand *) NULL);
11989  assert(wand->signature == MagickWandSignature);
11990  if (wand->debug != MagickFalse)
11991  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11992  if (wand->images == (Image *) NULL)
11993  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11994  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11995  if (sketch_image == (Image *) NULL)
11996  return(MagickFalse);
11997  ReplaceImageInList(&wand->images,sketch_image);
11998  return(MagickTrue);
11999 }
12000 
12001 /*
12002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12003 % %
12004 % %
12005 % %
12006 % M a g i c k S m u s h I m a g e s %
12007 % %
12008 % %
12009 % %
12010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12011 %
12012 % MagickSmushImages() takes all images from the current image pointer to the
12013 % end of the image list and smushes them to each other top-to-bottom if the
12014 % stack parameter is true, otherwise left-to-right.
12015 %
12016 % The format of the MagickSmushImages method is:
12017 %
12018 % MagickWand *MagickSmushImages(MagickWand *wand,
12019 % const MagickBooleanType stack,const ssize_t offset)
12020 %
12021 % A description of each parameter follows:
12022 %
12023 % o wand: the magick wand.
12024 %
12025 % o stack: By default, images are stacked left-to-right. Set stack to
12026 % MagickTrue to stack them top-to-bottom.
12027 %
12028 % o offset: minimum distance in pixels between images.
12029 %
12030 */
12031 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
12032  const MagickBooleanType stack,const ssize_t offset)
12033 {
12034  Image
12035  *smush_image;
12036 
12037  assert(wand != (MagickWand *) NULL);
12038  assert(wand->signature == MagickWandSignature);
12039  if (wand->debug != MagickFalse)
12040  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12041  if (wand->images == (Image *) NULL)
12042  return((MagickWand *) NULL);
12043  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
12044  if (smush_image == (Image *) NULL)
12045  return((MagickWand *) NULL);
12046  return(CloneMagickWandFromImages(wand,smush_image));
12047 }
12048 
12049 /*
12050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12051 % %
12052 % %
12053 % %
12054 % M a g i c k S o l a r i z e I m a g e %
12055 % %
12056 % %
12057 % %
12058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12059 %
12060 % MagickSolarizeImage() applies a special effect to the image, similar to the
12061 % effect achieved in a photo darkroom by selectively exposing areas of photo
12062 % sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
12063 % measure of the extent of the solarization.
12064 %
12065 % The format of the MagickSolarizeImage method is:
12066 %
12067 % MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12068 % const double threshold)
12069 %
12070 % A description of each parameter follows:
12071 %
12072 % o wand: the magick wand.
12073 %
12074 % o threshold: Define the extent of the solarization.
12075 %
12076 */
12077 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12078  const double threshold)
12079 {
12080  MagickBooleanType
12081  status;
12082 
12083  assert(wand != (MagickWand *) NULL);
12084  assert(wand->signature == MagickWandSignature);
12085  if (wand->debug != MagickFalse)
12086  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12087  if (wand->images == (Image *) NULL)
12088  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12089  status=SolarizeImage(wand->images,threshold,wand->exception);
12090  return(status);
12091 }
12092 
12093 /*
12094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12095 % %
12096 % %
12097 % %
12098 % M a g i c k S p a r s e C o l o r I m a g e %
12099 % %
12100 % %
12101 % %
12102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12103 %
12104 % MagickSparseColorImage(), given a set of coordinates, interpolates the
12105 % colors found at those coordinates, across the whole image, using various
12106 % methods.
12107 %
12108 % The format of the MagickSparseColorImage method is:
12109 %
12110 % MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12111 % const SparseColorMethod method,const size_t number_arguments,
12112 % const double *arguments)
12113 %
12114 % A description of each parameter follows:
12115 %
12116 % o image: the image to be sparseed.
12117 %
12118 % o method: the method of image sparseion.
12119 %
12120 % ArcSparseColorion will always ignore source image offset, and always
12121 % 'bestfit' the destination image with the top left corner offset
12122 % relative to the polar mapping center.
12123 %
12124 % Bilinear has no simple inverse mapping so will not allow 'bestfit'
12125 % style of image sparseion.
12126 %
12127 % Affine, Perspective, and Bilinear, will do least squares fitting of
12128 % the distortion when more than the minimum number of control point
12129 % pairs are provided.
12130 %
12131 % Perspective, and Bilinear, will fall back to a Affine sparseion when
12132 % less than 4 control point pairs are provided. While Affine sparseions
12133 % will let you use any number of control point pairs, that is Zero pairs
12134 % is a No-Op (viewport only) distortion, one pair is a translation and
12135 % two pairs of control points will do a scale-rotate-translate, without
12136 % any shearing.
12137 %
12138 % o number_arguments: the number of arguments given for this sparseion
12139 % method.
12140 %
12141 % o arguments: the arguments for this sparseion method.
12142 %
12143 */
12144 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12145  const SparseColorMethod method,const size_t number_arguments,
12146  const double *arguments)
12147 {
12148  Image
12149  *sparse_image;
12150 
12151  assert(wand != (MagickWand *) NULL);
12152  assert(wand->signature == MagickWandSignature);
12153  if (wand->debug != MagickFalse)
12154  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12155  if (wand->images == (Image *) NULL)
12156  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12157  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
12158  wand->exception);
12159  if (sparse_image == (Image *) NULL)
12160  return(MagickFalse);
12161  ReplaceImageInList(&wand->images,sparse_image);
12162  return(MagickTrue);
12163 }
12164 
12165 /*
12166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12167 % %
12168 % %
12169 % %
12170 % M a g i c k S p l i c e I m a g e %
12171 % %
12172 % %
12173 % %
12174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12175 %
12176 % MagickSpliceImage() splices a solid color into the image.
12177 %
12178 % The format of the MagickSpliceImage method is:
12179 %
12180 % MagickBooleanType MagickSpliceImage(MagickWand *wand,
12181 % const size_t width,const size_t height,const ssize_t x,
12182 % const ssize_t y)
12183 %
12184 % A description of each parameter follows:
12185 %
12186 % o wand: the magick wand.
12187 %
12188 % o width: the region width.
12189 %
12190 % o height: the region height.
12191 %
12192 % o x: the region x offset.
12193 %
12194 % o y: the region y offset.
12195 %
12196 */
12197 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
12198  const size_t width,const size_t height,const ssize_t x,
12199  const ssize_t y)
12200 {
12201  Image
12202  *splice_image;
12203 
12204  RectangleInfo
12205  splice;
12206 
12207  assert(wand != (MagickWand *) NULL);
12208  assert(wand->signature == MagickWandSignature);
12209  if (wand->debug != MagickFalse)
12210  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12211  if (wand->images == (Image *) NULL)
12212  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12213  splice.width=width;
12214  splice.height=height;
12215  splice.x=x;
12216  splice.y=y;
12217  splice_image=SpliceImage(wand->images,&splice,wand->exception);
12218  if (splice_image == (Image *) NULL)
12219  return(MagickFalse);
12220  ReplaceImageInList(&wand->images,splice_image);
12221  return(MagickTrue);
12222 }
12223 
12224 /*
12225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12226 % %
12227 % %
12228 % %
12229 % M a g i c k S p r e a d I m a g e %
12230 % %
12231 % %
12232 % %
12233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12234 %
12235 % MagickSpreadImage() is a special effects method that randomly displaces each
12236 % pixel in a block defined by the radius parameter.
12237 %
12238 % The format of the MagickSpreadImage method is:
12239 %
12240 % MagickBooleanType MagickSpreadImage(MagickWand *wand,
12241 % const PixelInterpolateMethod method,const double radius)
12242 %
12243 % A description of each parameter follows:
12244 %
12245 % o wand: the magick wand.
12246 %
12247 % o method: interpolation method.
12248 %
12249 % o radius: Choose a random pixel in a neighborhood of this extent.
12250 %
12251 */
12252 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
12253  const PixelInterpolateMethod method,const double radius)
12254 {
12255  Image
12256  *spread_image;
12257 
12258  assert(wand != (MagickWand *) NULL);
12259  assert(wand->signature == MagickWandSignature);
12260  if (wand->debug != MagickFalse)
12261  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12262  if (wand->images == (Image *) NULL)
12263  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12264  spread_image=SpreadImage(wand->images,method,radius,wand->exception);
12265  if (spread_image == (Image *) NULL)
12266  return(MagickFalse);
12267  ReplaceImageInList(&wand->images,spread_image);
12268  return(MagickTrue);
12269 }
12270 
12271 /*
12272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12273 % %
12274 % %
12275 % %
12276 % M a g i c k S t a t i s t i c I m a g e %
12277 % %
12278 % %
12279 % %
12280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12281 %
12282 % MagickStatisticImage() replace each pixel with corresponding statistic from
12283 % the neighborhood of the specified width and height.
12284 %
12285 % The format of the MagickStatisticImage method is:
12286 %
12287 % MagickBooleanType MagickStatisticImage(MagickWand *wand,
12288 % const StatisticType type,const double width,const size_t height)
12289 %
12290 % A description of each parameter follows:
12291 %
12292 % o wand: the magick wand.
12293 %
12294 % o type: the statistic type (e.g. median, mode, etc.).
12295 %
12296 % o width: the width of the pixel neighborhood.
12297 %
12298 % o height: the height of the pixel neighborhood.
12299 %
12300 */
12301 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
12302  const StatisticType type,const size_t width,const size_t height)
12303 {
12304  Image
12305  *statistic_image;
12306 
12307  assert(wand != (MagickWand *) NULL);
12308  assert(wand->signature == MagickWandSignature);
12309  if (wand->debug != MagickFalse)
12310  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12311  if (wand->images == (Image *) NULL)
12312  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12313  statistic_image=StatisticImage(wand->images,type,width,height,
12314  wand->exception);
12315  if (statistic_image == (Image *) NULL)
12316  return(MagickFalse);
12317  ReplaceImageInList(&wand->images,statistic_image);
12318  return(MagickTrue);
12319 }
12320 
12321 /*
12322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12323 % %
12324 % %
12325 % %
12326 % M a g i c k S t e g a n o I m a g e %
12327 % %
12328 % %
12329 % %
12330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12331 %
12332 % MagickSteganoImage() hides a digital watermark within the image.
12333 % Recover the hidden watermark later to prove that the authenticity of
12334 % an image. Offset defines the start position within the image to hide
12335 % the watermark.
12336 %
12337 % The format of the MagickSteganoImage method is:
12338 %
12339 % MagickWand *MagickSteganoImage(MagickWand *wand,
12340 % const MagickWand *watermark_wand,const ssize_t offset)
12341 %
12342 % A description of each parameter follows:
12343 %
12344 % o wand: the magick wand.
12345 %
12346 % o watermark_wand: the watermark wand.
12347 %
12348 % o offset: Start hiding at this offset into the image.
12349 %
12350 */
12351 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
12352  const MagickWand *watermark_wand,const ssize_t offset)
12353 {
12354  Image
12355  *stegano_image;
12356 
12357  assert(wand != (MagickWand *) NULL);
12358  assert(wand->signature == MagickWandSignature);
12359  if (wand->debug != MagickFalse)
12360  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12361  if ((wand->images == (Image *) NULL) ||
12362  (watermark_wand->images == (Image *) NULL))
12363  {
12364  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12365  "ContainsNoImages","`%s'",wand->name);
12366  return((MagickWand *) NULL);
12367  }
12368  wand->images->offset=offset;
12369  stegano_image=SteganoImage(wand->images,watermark_wand->images,
12370  wand->exception);
12371  if (stegano_image == (Image *) NULL)
12372  return((MagickWand *) NULL);
12373  return(CloneMagickWandFromImages(wand,stegano_image));
12374 }
12375 
12376 /*
12377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12378 % %
12379 % %
12380 % %
12381 % M a g i c k S t e r e o I m a g e %
12382 % %
12383 % %
12384 % %
12385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12386 %
12387 % MagickStereoImage() composites two images and produces a single image that
12388 % is the composite of a left and right image of a stereo pair
12389 %
12390 % The format of the MagickStereoImage method is:
12391 %
12392 % MagickWand *MagickStereoImage(MagickWand *wand,
12393 % const MagickWand *offset_wand)
12394 %
12395 % A description of each parameter follows:
12396 %
12397 % o wand: the magick wand.
12398 %
12399 % o offset_wand: Another image wand.
12400 %
12401 */
12402 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
12403  const MagickWand *offset_wand)
12404 {
12405  Image
12406  *stereo_image;
12407 
12408  assert(wand != (MagickWand *) NULL);
12409  assert(wand->signature == MagickWandSignature);
12410  if (wand->debug != MagickFalse)
12411  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12412  if ((wand->images == (Image *) NULL) ||
12413  (offset_wand->images == (Image *) NULL))
12414  {
12415  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12416  "ContainsNoImages","`%s'",wand->name);
12417  return((MagickWand *) NULL);
12418  }
12419  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
12420  if (stereo_image == (Image *) NULL)
12421  return((MagickWand *) NULL);
12422  return(CloneMagickWandFromImages(wand,stereo_image));
12423 }
12424 
12425 /*
12426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12427 % %
12428 % %
12429 % %
12430 % M a g i c k S t r i p I m a g e %
12431 % %
12432 % %
12433 % %
12434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12435 %
12436 % MagickStripImage() strips an image of all profiles and comments.
12437 %
12438 % The format of the MagickStripImage method is:
12439 %
12440 % MagickBooleanType MagickStripImage(MagickWand *wand)
12441 %
12442 % A description of each parameter follows:
12443 %
12444 % o wand: the magick wand.
12445 %
12446 */
12447 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
12448 {
12449  assert(wand != (MagickWand *) NULL);
12450  assert(wand->signature == MagickWandSignature);
12451  if (wand->debug != MagickFalse)
12452  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12453  if (wand->images == (Image *) NULL)
12454  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12455  return(StripImage(wand->images,wand->exception));
12456 }
12457 
12458 /*
12459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12460 % %
12461 % %
12462 % %
12463 % M a g i c k S w i r l I m a g e %
12464 % %
12465 % %
12466 % %
12467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12468 %
12469 % MagickSwirlImage() swirls the pixels about the center of the image, where
12470 % degrees indicates the sweep of the arc through which each pixel is moved.
12471 % You get a more dramatic effect as the degrees move from 1 to 360.
12472 %
12473 % The format of the MagickSwirlImage method is:
12474 %
12475 % MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
12476 % const PixelInterpolateMethod method)
12477 %
12478 % A description of each parameter follows:
12479 %
12480 % o wand: the magick wand.
12481 %
12482 % o degrees: Define the tightness of the swirling effect.
12483 %
12484 % o method: the pixel interpolation method.
12485 %
12486 */
12487 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
12488  const double degrees,const PixelInterpolateMethod method)
12489 {
12490  Image
12491  *swirl_image;
12492 
12493  assert(wand != (MagickWand *) NULL);
12494  assert(wand->signature == MagickWandSignature);
12495  if (wand->debug != MagickFalse)
12496  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12497  if (wand->images == (Image *) NULL)
12498  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12499  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
12500  if (swirl_image == (Image *) NULL)
12501  return(MagickFalse);
12502  ReplaceImageInList(&wand->images,swirl_image);
12503  return(MagickTrue);
12504 }
12505 
12506 /*
12507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12508 % %
12509 % %
12510 % %
12511 % M a g i c k T e x t u r e I m a g e %
12512 % %
12513 % %
12514 % %
12515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12516 %
12517 % MagickTextureImage() repeatedly tiles the texture image across and down the
12518 % image canvas.
12519 %
12520 % The format of the MagickTextureImage method is:
12521 %
12522 % MagickWand *MagickTextureImage(MagickWand *wand,
12523 % const MagickWand *texture_wand)
12524 %
12525 % A description of each parameter follows:
12526 %
12527 % o wand: the magick wand.
12528 %
12529 % o texture_wand: the texture wand
12530 %
12531 */
12532 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
12533  const MagickWand *texture_wand)
12534 {
12535  Image
12536  *texture_image;
12537 
12538  MagickBooleanType
12539  status;
12540 
12541  assert(wand != (MagickWand *) NULL);
12542  assert(wand->signature == MagickWandSignature);
12543  if (wand->debug != MagickFalse)
12544  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12545  if ((wand->images == (Image *) NULL) ||
12546  (texture_wand->images == (Image *) NULL))
12547  {
12548  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12549  "ContainsNoImages","`%s'",wand->name);
12550  return((MagickWand *) NULL);
12551  }
12552  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12553  if (texture_image == (Image *) NULL)
12554  return((MagickWand *) NULL);
12555  status=TextureImage(texture_image,texture_wand->images,wand->exception);
12556  if (status == MagickFalse)
12557  {
12558  texture_image=DestroyImage(texture_image);
12559  return((MagickWand *) NULL);
12560  }
12561  return(CloneMagickWandFromImages(wand,texture_image));
12562 }
12563 
12564 /*
12565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12566 % %
12567 % %
12568 % %
12569 % M a g i c k T h r e s h o l d I m a g e %
12570 % %
12571 % %
12572 % %
12573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12574 %
12575 % MagickThresholdImage() changes the value of individual pixels based on
12576 % the intensity of each pixel compared to threshold. The result is a
12577 % high-contrast, two color image.
12578 %
12579 % The format of the MagickThresholdImage method is:
12580 %
12581 % MagickBooleanType MagickThresholdImage(MagickWand *wand,
12582 % const double threshold)
12583 % MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12584 % const ChannelType channel,const double threshold)
12585 %
12586 % A description of each parameter follows:
12587 %
12588 % o wand: the magick wand.
12589 %
12590 % o channel: the image channel(s).
12591 %
12592 % o threshold: Define the threshold value.
12593 %
12594 */
12595 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12596  const double threshold)
12597 {
12598  MagickBooleanType
12599  status;
12600 
12601  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12602  return(status);
12603 }
12604 
12605 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12606  const ChannelType channel,const double threshold)
12607 {
12608  MagickBooleanType
12609  status;
12610 
12611  ChannelType
12612  channel_mask;
12613 
12614  assert(wand != (MagickWand *) NULL);
12615  assert(wand->signature == MagickWandSignature);
12616  if (wand->debug != MagickFalse)
12617  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12618  if (wand->images == (Image *) NULL)
12619  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12620  channel_mask=SetImageChannelMask(wand->images,channel);
12621  status=BilevelImage(wand->images,threshold,wand->exception);
12622  (void) SetImageChannelMask(wand->images,channel_mask);
12623  return(status);
12624 }
12625 
12626 /*
12627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12628 % %
12629 % %
12630 % %
12631 % M a g i c k T h u m b n a i l I m a g e %
12632 % %
12633 % %
12634 % %
12635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12636 %
12637 % MagickThumbnailImage() changes the size of an image to the given dimensions
12638 % and removes any associated profiles. The goal is to produce small low cost
12639 % thumbnail images suited for display on the Web.
12640 %
12641 % The format of the MagickThumbnailImage method is:
12642 %
12643 % MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12644 % const size_t columns,const size_t rows)
12645 %
12646 % A description of each parameter follows:
12647 %
12648 % o wand: the magick wand.
12649 %
12650 % o columns: the number of columns in the scaled image.
12651 %
12652 % o rows: the number of rows in the scaled image.
12653 %
12654 */
12655 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12656  const size_t columns,const size_t rows)
12657 {
12658  Image
12659  *thumbnail_image;
12660 
12661  assert(wand != (MagickWand *) NULL);
12662  assert(wand->signature == MagickWandSignature);
12663  if (wand->debug != MagickFalse)
12664  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12665  if (wand->images == (Image *) NULL)
12666  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12667  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12668  if (thumbnail_image == (Image *) NULL)
12669  return(MagickFalse);
12670  ReplaceImageInList(&wand->images,thumbnail_image);
12671  return(MagickTrue);
12672 }
12673 
12674 /*
12675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12676 % %
12677 % %
12678 % %
12679 % M a g i c k T i n t I m a g e %
12680 % %
12681 % %
12682 % %
12683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12684 %
12685 % MagickTintImage() applies a color vector to each pixel in the image. The
12686 % length of the vector is 0 for black and white and at its maximum for the
12687 % midtones. The vector weighting function is
12688 % f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12689 %
12690 % The format of the MagickTintImage method is:
12691 %
12692 % MagickBooleanType MagickTintImage(MagickWand *wand,
12693 % const PixelWand *tint,const PixelWand *blend)
12694 %
12695 % A description of each parameter follows:
12696 %
12697 % o wand: the magick wand.
12698 %
12699 % o tint: the tint pixel wand.
12700 %
12701 % o alpha: the alpha pixel wand.
12702 %
12703 */
12704 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12705  const PixelWand *tint,const PixelWand *blend)
12706 {
12707  char
12708  percent_blend[MagickPathExtent];
12709 
12710  Image
12711  *tint_image;
12712 
12713  PixelInfo
12714  target;
12715 
12716  assert(wand != (MagickWand *) NULL);
12717  assert(wand->signature == MagickWandSignature);
12718  if (wand->debug != MagickFalse)
12719  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12720  if (wand->images == (Image *) NULL)
12721  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12722  if (wand->images->colorspace != CMYKColorspace)
12723  (void) FormatLocaleString(percent_blend,MagickPathExtent,
12724  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12725  (double) PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
12726  (double) PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
12727  (double) PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
12728  (double) PixelGetAlphaQuantum(blend)));
12729  else
12730  (void) FormatLocaleString(percent_blend,MagickPathExtent,
12731  "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
12732  (double) PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
12733  (double) PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
12734  (double) PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
12735  (double) PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
12736  (double) PixelGetAlphaQuantum(blend)));
12737  target=PixelGetPixel(tint);
12738  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
12739  if (tint_image == (Image *) NULL)
12740  return(MagickFalse);
12741  ReplaceImageInList(&wand->images,tint_image);
12742  return(MagickTrue);
12743 }
12744 
12745 /*
12746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12747 % %
12748 % %
12749 % %
12750 % 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 %
12751 % %
12752 % %
12753 % %
12754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12755 %
12756 % MagickTransformImageColorspace() transform the image colorspace, setting
12757 % the images colorspace while transforming the images data to that
12758 % colorspace.
12759 %
12760 % The format of the MagickTransformImageColorspace method is:
12761 %
12762 % MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12763 % const ColorspaceType colorspace)
12764 %
12765 % A description of each parameter follows:
12766 %
12767 % o wand: the magick wand.
12768 %
12769 % o colorspace: the image colorspace: UndefinedColorspace,
12770 % sRGBColorspace, RGBColorspace, GRAYColorspace,
12771 % OHTAColorspace, XYZColorspace, YCbCrColorspace,
12772 % YCCColorspace, YIQColorspace, YPbPrColorspace,
12773 % YPbPrColorspace, YUVColorspace, CMYKColorspace,
12774 % HSLColorspace, HWBColorspace.
12775 %
12776 */
12777 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12778  const ColorspaceType colorspace)
12779 {
12780  assert(wand != (MagickWand *) NULL);
12781  assert(wand->signature == MagickWandSignature);
12782  if (wand->debug != MagickFalse)
12783  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12784  if (wand->images == (Image *) NULL)
12785  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12786  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
12787 }
12788 
12789 /*
12790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12791 % %
12792 % %
12793 % %
12794 % 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 %
12795 % %
12796 % %
12797 % %
12798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12799 %
12800 % MagickTransparentPaintImage() changes any pixel that matches color with the
12801 % color defined by fill.
12802 %
12803 % The format of the MagickTransparentPaintImage method is:
12804 %
12805 % MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12806 % const PixelWand *target,const double alpha,const double fuzz,
12807 % const MagickBooleanType invert)
12808 %
12809 % A description of each parameter follows:
12810 %
12811 % o wand: the magick wand.
12812 %
12813 % o target: Change this target color to specified alpha value within
12814 % the image.
12815 %
12816 % o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12817 % transparent.
12818 %
12819 % o fuzz: By default target must match a particular pixel color
12820 % exactly. However, in many cases two colors may differ by a small amount.
12821 % The fuzz member of image defines how much tolerance is acceptable to
12822 % consider two colors as the same. For example, set fuzz to 10 and the
12823 % color red at intensities of 100 and 102 respectively are now interpreted
12824 % as the same color for the purposes of the floodfill.
12825 %
12826 % o invert: paint any pixel that does not match the target color.
12827 %
12828 */
12829 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12830  const PixelWand *target,const double alpha,const double fuzz,
12831  const MagickBooleanType invert)
12832 {
12833  MagickBooleanType
12834  status;
12835 
12836  PixelInfo
12837  target_pixel;
12838 
12839  assert(wand != (MagickWand *) NULL);
12840  assert(wand->signature == MagickWandSignature);
12841  if (wand->debug != MagickFalse)
12842  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12843  if (wand->images == (Image *) NULL)
12844  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12845  PixelGetMagickColor(target,&target_pixel);
12846  wand->images->fuzz=fuzz;
12847  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12848  (double) QuantumRange*alpha),invert,wand->exception);
12849  return(status);
12850 }
12851 
12852 /*
12853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12854 % %
12855 % %
12856 % %
12857 % M a g i c k T r a n s p o s e I m a g e %
12858 % %
12859 % %
12860 % %
12861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12862 %
12863 % MagickTransposeImage() creates a vertical mirror image by reflecting the
12864 % pixels around the central x-axis while rotating them 90-degrees.
12865 %
12866 % The format of the MagickTransposeImage method is:
12867 %
12868 % MagickBooleanType MagickTransposeImage(MagickWand *wand)
12869 %
12870 % A description of each parameter follows:
12871 %
12872 % o wand: the magick wand.
12873 %
12874 */
12875 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12876 {
12877  Image
12878  *transpose_image;
12879 
12880  assert(wand != (MagickWand *) NULL);
12881  assert(wand->signature == MagickWandSignature);
12882  if (wand->debug != MagickFalse)
12883  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12884  if (wand->images == (Image *) NULL)
12885  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12886  transpose_image=TransposeImage(wand->images,wand->exception);
12887  if (transpose_image == (Image *) NULL)
12888  return(MagickFalse);
12889  ReplaceImageInList(&wand->images,transpose_image);
12890  return(MagickTrue);
12891 }
12892 
12893 /*
12894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12895 % %
12896 % %
12897 % %
12898 % M a g i c k T r a n s v e r s e I m a g e %
12899 % %
12900 % %
12901 % %
12902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12903 %
12904 % MagickTransverseImage() creates a horizontal mirror image by reflecting the
12905 % pixels around the central y-axis while rotating them 270-degrees.
12906 %
12907 % The format of the MagickTransverseImage method is:
12908 %
12909 % MagickBooleanType MagickTransverseImage(MagickWand *wand)
12910 %
12911 % A description of each parameter follows:
12912 %
12913 % o wand: the magick wand.
12914 %
12915 */
12916 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12917 {
12918  Image
12919  *transverse_image;
12920 
12921  assert(wand != (MagickWand *) NULL);
12922  assert(wand->signature == MagickWandSignature);
12923  if (wand->debug != MagickFalse)
12924  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12925  if (wand->images == (Image *) NULL)
12926  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12927  transverse_image=TransverseImage(wand->images,wand->exception);
12928  if (transverse_image == (Image *) NULL)
12929  return(MagickFalse);
12930  ReplaceImageInList(&wand->images,transverse_image);
12931  return(MagickTrue);
12932 }
12933 
12934 /*
12935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12936 % %
12937 % %
12938 % %
12939 % M a g i c k T r i m I m a g e %
12940 % %
12941 % %
12942 % %
12943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12944 %
12945 % MagickTrimImage() remove edges that are the background color from the image.
12946 %
12947 % The format of the MagickTrimImage method is:
12948 %
12949 % MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12950 %
12951 % A description of each parameter follows:
12952 %
12953 % o wand: the magick wand.
12954 %
12955 % o fuzz: By default target must match a particular pixel color
12956 % exactly. However, in many cases two colors may differ by a small amount.
12957 % The fuzz member of image defines how much tolerance is acceptable to
12958 % consider two colors as the same. For example, set fuzz to 10 and the
12959 % color red at intensities of 100 and 102 respectively are now interpreted
12960 % as the same color for the purposes of the floodfill.
12961 %
12962 */
12963 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12964 {
12965  Image
12966  *trim_image;
12967 
12968  assert(wand != (MagickWand *) NULL);
12969  assert(wand->signature == MagickWandSignature);
12970  if (wand->debug != MagickFalse)
12971  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12972  if (wand->images == (Image *) NULL)
12973  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12974  wand->images->fuzz=fuzz;
12975  trim_image=TrimImage(wand->images,wand->exception);
12976  if (trim_image == (Image *) NULL)
12977  return(MagickFalse);
12978  ReplaceImageInList(&wand->images,trim_image);
12979  return(MagickTrue);
12980 }
12981 
12982 /*
12983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12984 % %
12985 % %
12986 % %
12987 % M a g i c k U n i q u e I m a g e C o l o r s %
12988 % %
12989 % %
12990 % %
12991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12992 %
12993 % MagickUniqueImageColors() discards all but one of any pixel color.
12994 %
12995 % The format of the MagickUniqueImageColors method is:
12996 %
12997 % MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12998 %
12999 % A description of each parameter follows:
13000 %
13001 % o wand: the magick wand.
13002 %
13003 */
13004 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
13005 {
13006  Image
13007  *unique_image;
13008 
13009  assert(wand != (MagickWand *) NULL);
13010  assert(wand->signature == MagickWandSignature);
13011  if (wand->debug != MagickFalse)
13012  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13013  if (wand->images == (Image *) NULL)
13014  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13015  unique_image=UniqueImageColors(wand->images,wand->exception);
13016  if (unique_image == (Image *) NULL)
13017  return(MagickFalse);
13018  ReplaceImageInList(&wand->images,unique_image);
13019  return(MagickTrue);
13020 }
13021 
13022 /*
13023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13024 % %
13025 % %
13026 % %
13027 % M a g i c k U n s h a r p M a s k I m a g e %
13028 % %
13029 % %
13030 % %
13031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13032 %
13033 % MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
13034 % Gaussian operator of the given radius and standard deviation (sigma).
13035 % For reasonable results, radius should be larger than sigma. Use a radius
13036 % of 0 and UnsharpMaskImage() selects a suitable radius for you.
13037 %
13038 % The format of the MagickUnsharpMaskImage method is:
13039 %
13040 % MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13041 % const double radius,const double sigma,const double gain,
13042 % const double threshold)
13043 %
13044 % A description of each parameter follows:
13045 %
13046 % o wand: the magick wand.
13047 %
13048 % o radius: the radius of the Gaussian, in pixels, not counting the center
13049 % pixel.
13050 %
13051 % o sigma: the standard deviation of the Gaussian, in pixels.
13052 %
13053 % o gain: the percentage of the difference between the original and the
13054 % blur image that is added back into the original.
13055 %
13056 % o threshold: the threshold in pixels needed to apply the difference gain.
13057 %
13058 */
13059 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13060  const double radius,const double sigma,const double gain,
13061  const double threshold)
13062 {
13063  Image
13064  *unsharp_image;
13065 
13066  assert(wand != (MagickWand *) NULL);
13067  assert(wand->signature == MagickWandSignature);
13068  if (wand->debug != MagickFalse)
13069  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13070  if (wand->images == (Image *) NULL)
13071  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13072  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
13073  wand->exception);
13074  if (unsharp_image == (Image *) NULL)
13075  return(MagickFalse);
13076  ReplaceImageInList(&wand->images,unsharp_image);
13077  return(MagickTrue);
13078 }
13079 
13080 /*
13081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13082 % %
13083 % %
13084 % %
13085 % M a g i c k V i g n e t t e I m a g e %
13086 % %
13087 % %
13088 % %
13089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13090 %
13091 % MagickVignetteImage() softens the edges of the image in vignette style.
13092 %
13093 % The format of the MagickVignetteImage method is:
13094 %
13095 % MagickBooleanType MagickVignetteImage(MagickWand *wand,
13096 % const double radius,const double sigma,const ssize_t x,
13097 % const ssize_t y)
13098 %
13099 % A description of each parameter follows:
13100 %
13101 % o wand: the magick wand.
13102 %
13103 % o radius: the radius.
13104 %
13105 % o sigma: the sigma.
13106 %
13107 % o x, y: Define the x and y ellipse offset.
13108 %
13109 */
13110 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
13111  const double radius,const double sigma,const ssize_t x,const ssize_t y)
13112 {
13113  Image
13114  *vignette_image;
13115 
13116  assert(wand != (MagickWand *) NULL);
13117  assert(wand->signature == MagickWandSignature);
13118  if (wand->debug != MagickFalse)
13119  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13120  if (wand->images == (Image *) NULL)
13121  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13122  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
13123  if (vignette_image == (Image *) NULL)
13124  return(MagickFalse);
13125  ReplaceImageInList(&wand->images,vignette_image);
13126  return(MagickTrue);
13127 }
13128 
13129 /*
13130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13131 % %
13132 % %
13133 % %
13134 % M a g i c k W a v e I m a g e %
13135 % %
13136 % %
13137 % %
13138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13139 %
13140 % MagickWaveImage() creates a "ripple" effect in the image by shifting
13141 % the pixels vertically along a sine wave whose amplitude and wavelength
13142 % is specified by the given parameters.
13143 %
13144 % The format of the MagickWaveImage method is:
13145 %
13146 % MagickBooleanType MagickWaveImage(MagickWand *wand,
13147 % const double amplitude,const double wave_length,
13148 % const PixelInterpolateMethod method)
13149 %
13150 % A description of each parameter follows:
13151 %
13152 % o wand: the magick wand.
13153 %
13154 % o amplitude, wave_length: Define the amplitude and wave length of the
13155 % sine wave.
13156 %
13157 % o method: the pixel interpolation method.
13158 %
13159 */
13160 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
13161  const double amplitude,const double wave_length,
13162  const PixelInterpolateMethod method)
13163 {
13164  Image
13165  *wave_image;
13166 
13167  assert(wand != (MagickWand *) NULL);
13168  assert(wand->signature == MagickWandSignature);
13169  if (wand->debug != MagickFalse)
13170  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13171  if (wand->images == (Image *) NULL)
13172  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13173  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
13174  wand->exception);
13175  if (wave_image == (Image *) NULL)
13176  return(MagickFalse);
13177  ReplaceImageInList(&wand->images,wave_image);
13178  return(MagickTrue);
13179 }
13180 
13181 /*
13182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13183 % %
13184 % %
13185 % %
13186 % 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 %
13187 % %
13188 % %
13189 % %
13190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13191 %
13192 % MagickWaveletDenoiseImage() removes noise from the image using a wavelet
13193 % transform. The wavelet transform is a fast hierarchical scheme for
13194 % processing an image using a set of consecutive lowpass and high_pass filters,
13195 % followed by a decimation. This results in a decomposition into different
13196 % scales which can be regarded as different “frequency bands”, determined by
13197 % the mother wavelet.
13198 %
13199 % The format of the MagickWaveletDenoiseImage method is:
13200 %
13201 % MagickBooleanType MagickWaveletDenoiseImage(MagickWand *wand,
13202 % const double threshold,const double softness)
13203 %
13204 % A description of each parameter follows:
13205 %
13206 % o wand: the magick wand.
13207 %
13208 % o threshold: set the threshold for smoothing.
13209 %
13210 % o softness: attenuate the smoothing threshold.
13211 %
13212 */
13213 WandExport MagickBooleanType MagickWaveletDenoiseImage(MagickWand *wand,
13214  const double threshold,const double softness)
13215 {
13216  Image
13217  *noise_image;
13218 
13219  assert(wand != (MagickWand *) NULL);
13220  assert(wand->signature == MagickWandSignature);
13221  if (wand->debug != MagickFalse)
13222  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13223  if (wand->images == (Image *) NULL)
13224  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13225  noise_image=WaveletDenoiseImage(wand->images,threshold,softness,
13226  wand->exception);
13227  if (noise_image == (Image *) NULL)
13228  return(MagickFalse);
13229  ReplaceImageInList(&wand->images,noise_image);
13230  return(MagickTrue);
13231 }
13232 
13233 /*
13234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13235 % %
13236 % %
13237 % %
13238 % M a g i c k W h i t e B a l a n c e I m a g e %
13239 % %
13240 % %
13241 % %
13242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13243 %
13244 % MagickWhiteBalanceImage() applies white balancing to an image according to
13245 % a grayworld assumption in the LAB colorspace.
13246 %
13247 % The format of the WhiteBalanceImage method is:
13248 %
13249 % MagickBooleanType WhiteBalanceImage(MagickWand *wand)
13250 %
13251 % A description of each parameter follows:
13252 %
13253 % o wand: the magick wand.
13254 %
13255 */
13256 WandExport MagickBooleanType MagickWhiteBalanceImage(MagickWand *wand)
13257 {
13258  MagickBooleanType
13259  status;
13260 
13261  assert(wand != (MagickWand *) NULL);
13262  assert(wand->signature == MagickWandSignature);
13263  if (wand->debug != MagickFalse)
13264  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13265  if (wand->images == (Image *) NULL)
13266  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13267  status=WhiteBalanceImage(wand->images, wand->exception);
13268  return(status);
13269 }
13270 
13271 /*
13272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13273 % %
13274 % %
13275 % %
13276 % 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 %
13277 % %
13278 % %
13279 % %
13280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13281 %
13282 % MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
13283 % above the threshold into white while leaving all pixels below the threshold
13284 % unchanged.
13285 %
13286 % The format of the MagickWhiteThresholdImage method is:
13287 %
13288 % MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13289 % const PixelWand *threshold)
13290 %
13291 % A description of each parameter follows:
13292 %
13293 % o wand: the magick wand.
13294 %
13295 % o threshold: the pixel wand.
13296 %
13297 */
13298 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13299  const PixelWand *threshold)
13300 {
13301  char
13302  thresholds[MagickPathExtent];
13303 
13304  assert(wand != (MagickWand *) NULL);
13305  assert(wand->signature == MagickWandSignature);
13306  if (wand->debug != MagickFalse)
13307  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13308  if (wand->images == (Image *) NULL)
13309  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13310  (void) FormatLocaleString(thresholds,MagickPathExtent,
13311  "%g" "," "%g" "," "%g" "," "%g",
13312  (double) PixelGetRedQuantum(threshold),
13313  (double) PixelGetGreenQuantum(threshold),
13314  (double) PixelGetBlueQuantum(threshold),
13315  (double) PixelGetAlphaQuantum(threshold));
13316  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
13317 }
13318 
13319 /*
13320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13321 % %
13322 % %
13323 % %
13324 % M a g i c k W r i t e I m a g e %
13325 % %
13326 % %
13327 % %
13328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13329 %
13330 % MagickWriteImage() writes an image to the specified filename. If the
13331 % filename parameter is NULL, the image is written to the filename set
13332 % by MagickReadImage() or MagickSetImageFilename().
13333 %
13334 % The format of the MagickWriteImage method is:
13335 %
13336 % MagickBooleanType MagickWriteImage(MagickWand *wand,
13337 % const char *filename)
13338 %
13339 % A description of each parameter follows:
13340 %
13341 % o wand: the magick wand.
13342 %
13343 % o filename: the image filename.
13344 %
13345 %
13346 */
13347 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
13348  const char *filename)
13349 {
13350  Image
13351  *image;
13352 
13353  ImageInfo
13354  *write_info;
13355 
13356  MagickBooleanType
13357  status;
13358 
13359  assert(wand != (MagickWand *) NULL);
13360  assert(wand->signature == MagickWandSignature);
13361  if (wand->debug != MagickFalse)
13362  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13363  if (wand->images == (Image *) NULL)
13364  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13365  if (filename != (const char *) NULL)
13366  (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
13367  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13368  if (image == (Image *) NULL)
13369  return(MagickFalse);
13370  write_info=CloneImageInfo(wand->image_info);
13371  write_info->adjoin=MagickTrue;
13372  status=WriteImage(write_info,image,wand->exception);
13373  image=DestroyImage(image);
13374  write_info=DestroyImageInfo(write_info);
13375  return(status);
13376 }
13377 
13378 /*
13379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13380 % %
13381 % %
13382 % %
13383 % M a g i c k W r i t e I m a g e F i l e %
13384 % %
13385 % %
13386 % %
13387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13388 %
13389 % MagickWriteImageFile() writes an image to an open file descriptor.
13390 %
13391 % The format of the MagickWriteImageFile method is:
13392 %
13393 % MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13394 %
13395 % A description of each parameter follows:
13396 %
13397 % o wand: the magick wand.
13398 %
13399 % o file: the file descriptor.
13400 %
13401 */
13402 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13403 {
13404  Image
13405  *image;
13406 
13407  ImageInfo
13408  *write_info;
13409 
13410  MagickBooleanType
13411  status;
13412 
13413  assert(wand != (MagickWand *) NULL);
13414  assert(wand->signature == MagickWandSignature);
13415  assert(file != (FILE *) NULL);
13416  if (wand->debug != MagickFalse)
13417  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13418  if (wand->images == (Image *) NULL)
13419  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13420  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13421  if (image == (Image *) NULL)
13422  return(MagickFalse);
13423  write_info=CloneImageInfo(wand->image_info);
13424  SetImageInfoFile(write_info,file);
13425  write_info->adjoin=MagickTrue;
13426  status=WriteImage(write_info,image,wand->exception);
13427  write_info=DestroyImageInfo(write_info);
13428  image=DestroyImage(image);
13429  return(status);
13430 }
13431 
13432 /*
13433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13434 % %
13435 % %
13436 % %
13437 % M a g i c k W r i t e I m a g e s %
13438 % %
13439 % %
13440 % %
13441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13442 %
13443 % MagickWriteImages() writes an image or image sequence.
13444 %
13445 % The format of the MagickWriteImages method is:
13446 %
13447 % MagickBooleanType MagickWriteImages(MagickWand *wand,
13448 % const char *filename,const MagickBooleanType adjoin)
13449 %
13450 % A description of each parameter follows:
13451 %
13452 % o wand: the magick wand.
13453 %
13454 % o filename: the image filename.
13455 %
13456 % o adjoin: join images into a single multi-image file.
13457 %
13458 */
13459 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
13460  const char *filename,const MagickBooleanType adjoin)
13461 {
13462  ImageInfo
13463  *write_info;
13464 
13465  MagickBooleanType
13466  status;
13467 
13468  assert(wand != (MagickWand *) NULL);
13469  assert(wand->signature == MagickWandSignature);
13470  if (wand->debug != MagickFalse)
13471  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13472  if (wand->images == (Image *) NULL)
13473  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13474  write_info=CloneImageInfo(wand->image_info);
13475  write_info->adjoin=adjoin;
13476  status=WriteImages(write_info,wand->images,filename,wand->exception);
13477  write_info=DestroyImageInfo(write_info);
13478  return(status);
13479 }
13480 
13481 /*
13482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13483 % %
13484 % %
13485 % %
13486 % M a g i c k W r i t e I m a g e s F i l e %
13487 % %
13488 % %
13489 % %
13490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13491 %
13492 % MagickWriteImagesFile() writes an image sequence to an open file descriptor.
13493 %
13494 % The format of the MagickWriteImagesFile method is:
13495 %
13496 % MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13497 %
13498 % A description of each parameter follows:
13499 %
13500 % o wand: the magick wand.
13501 %
13502 % o file: the file descriptor.
13503 %
13504 */
13505 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13506 {
13507  ImageInfo
13508  *write_info;
13509 
13510  MagickBooleanType
13511  status;
13512 
13513  assert(wand != (MagickWand *) NULL);
13514  assert(wand->signature == MagickWandSignature);
13515  if (wand->debug != MagickFalse)
13516  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13517  if (wand->images == (Image *) NULL)
13518  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13519  write_info=CloneImageInfo(wand->image_info);
13520  SetImageInfoFile(write_info,file);
13521  write_info->adjoin=MagickTrue;
13522  status=WriteImages(write_info,wand->images,(const char *) NULL,
13523  wand->exception);
13524  write_info=DestroyImageInfo(write_info);
13525  return(status);
13526 }
_PixelWand
Definition: pixel-wand.c:63
_DrawingWand
Definition: drawing-wand.c:91
_MagickWand
Definition: magick-wand-private.h:62