blob: 3151dba1c38c388fe2a3abb2f5b12744f3e9e71b [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
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% John Cristy %
23% August 2003 %
24% %
25% %
cristy16af1cb2009-12-11 21:38:29 +000026% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000027% 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% http://www.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 "wand/studio.h"
50#include "wand/MagickWand.h"
51#include "wand/magick-wand-private.h"
52#include "wand/wand.h"
53#include "wand/pixel-wand-private.h"
54
55/*
56 Define declarations.
57*/
58#define ThrowWandException(severity,tag,context) \
59{ \
60 (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61 tag,"`%s'",context); \
62 return(MagickFalse); \
63}
64#define MagickWandId "MagickWand"
65
66/*
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68% %
69% %
70% %
71+ 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 %
72% %
73% %
74% %
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77% CloneMagickWandFromImages() clones the magick wand and inserts a new image
78% list.
79%
80% The format of the CloneMagickWandFromImages method is:
81%
82% MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83% Image *images)
84%
85% A description of each parameter follows:
86%
87% o wand: the magick wand.
88%
89% o images: replace the image list with these image(s).
90%
91*/
92static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93 Image *images)
94{
95 MagickWand
96 *clone_wand;
97
98 assert(wand != (MagickWand *) NULL);
99 assert(wand->signature == WandSignature);
100 if (wand->debug != MagickFalse)
101 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy90823212009-12-12 20:48:33 +0000102 clone_wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*clone_wand));
cristy3ed852e2009-09-05 21:47:34 +0000103 if (clone_wand == (MagickWand *) NULL)
104 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105 images->filename);
106 (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107 clone_wand->id=AcquireWandId();
cristye8c25f92010-06-03 00:53:06 +0000108 (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109 MagickWandId,(double) clone_wand->id);
cristy3ed852e2009-09-05 21:47:34 +0000110 clone_wand->exception=AcquireExceptionInfo();
111 InheritException(clone_wand->exception,wand->exception);
112 clone_wand->image_info=CloneImageInfo(wand->image_info);
113 clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114 clone_wand->images=images;
115 clone_wand->debug=IsEventLogging();
116 if (clone_wand->debug != MagickFalse)
117 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118 clone_wand->signature=WandSignature;
119 return(clone_wand);
120}
121
122/*
123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124% %
125% %
126% %
127% G e t I m a g e F r o m M a g i c k W a n d %
128% %
129% %
130% %
131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132%
133% GetImageFromMagickWand() returns the current image from the magick wand.
134%
135% The format of the GetImageFromMagickWand method is:
136%
137% Image *GetImageFromMagickWand(const MagickWand *wand)
138%
139% A description of each parameter follows:
140%
141% o wand: the magick wand.
142%
143*/
144WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145{
146 assert(wand != (MagickWand *) NULL);
147 assert(wand->signature == WandSignature);
148 if (wand->debug != MagickFalse)
149 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150 if (wand->images == (Image *) NULL)
151 {
152 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153 "ContainsNoImages","`%s'",wand->name);
154 return((Image *) NULL);
155 }
156 return(wand->images);
157}
158
159/*
160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161% %
162% %
163% %
164% 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 %
165% %
166% %
167% %
168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169%
170% MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171% less intensely near image edges and more intensely far from edges. We
172% blur the image with a Gaussian operator of the given radius and standard
173% deviation (sigma). For reasonable results, radius should be larger than
174% sigma. Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175% suitable radius for you.
176%
177% The format of the MagickAdaptiveBlurImage method is:
178%
179% MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180% const double radius,const double sigma)
181% MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
182% const ChannelType channel,const double radius,const double sigma)
183%
184% A description of each parameter follows:
185%
186% o wand: the magick wand.
187%
188% o channel: the image channel(s).
189%
190% o radius: the radius of the Gaussian, in pixels, not counting the center
191% pixel.
192%
193% o sigma: the standard deviation of the Gaussian, in pixels.
194%
195*/
196
197WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
198 const double radius,const double sigma)
199{
200 MagickBooleanType
201 status;
202
203 status=MagickAdaptiveBlurImageChannel(wand,DefaultChannels,radius,sigma);
204 return(status);
205}
206
207WandExport MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
208 const ChannelType channel,const double radius,const double sigma)
209{
210 Image
211 *sharp_image;
212
213 assert(wand != (MagickWand *) NULL);
214 assert(wand->signature == WandSignature);
215 if (wand->debug != MagickFalse)
216 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
217 if (wand->images == (Image *) NULL)
218 ThrowWandException(WandError,"ContainsNoImages",wand->name);
219 sharp_image=AdaptiveBlurImageChannel(wand->images,channel,radius,sigma,
220 wand->exception);
221 if (sharp_image == (Image *) NULL)
222 return(MagickFalse);
223 ReplaceImageInList(&wand->images,sharp_image);
224 return(MagickTrue);
225}
226
227/*
228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229% %
230% %
231% %
232% 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 %
233% %
234% %
235% %
236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
237%
238% MagickAdaptiveResizeImage() adaptively resize image with data dependent
239% triangulation.
240%
241% MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000242% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +0000243%
244% A description of each parameter follows:
245%
246% o wand: the magick wand.
247%
248% o columns: the number of columns in the scaled image.
249%
250% o rows: the number of rows in the scaled image.
251%
252*/
253WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000254 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +0000255{
256 Image
257 *resize_image;
258
259 assert(wand != (MagickWand *) NULL);
260 assert(wand->signature == WandSignature);
261 if (wand->debug != MagickFalse)
262 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
263 if (wand->images == (Image *) NULL)
264 ThrowWandException(WandError,"ContainsNoImages",wand->name);
265 resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
266 if (resize_image == (Image *) NULL)
267 return(MagickFalse);
268 ReplaceImageInList(&wand->images,resize_image);
269 return(MagickTrue);
270}
271
272/*
273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274% %
275% %
276% %
277% 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 %
278% %
279% %
280% %
281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282%
283% MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
284% more intensely near image edges and less intensely far from edges. We
285% sharpen the image with a Gaussian operator of the given radius and standard
286% deviation (sigma). For reasonable results, radius should be larger than
287% sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
288% suitable radius for you.
289%
290% The format of the MagickAdaptiveSharpenImage method is:
291%
292% MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
293% const double radius,const double sigma)
294% MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
295% const ChannelType channel,const double radius,const double sigma)
296%
297% A description of each parameter follows:
298%
299% o wand: the magick wand.
300%
301% o channel: the image channel(s).
302%
303% o radius: the radius of the Gaussian, in pixels, not counting the center
304% pixel.
305%
306% o sigma: the standard deviation of the Gaussian, in pixels.
307%
308*/
309
310WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
311 const double radius,const double sigma)
312{
313 MagickBooleanType
314 status;
315
316 status=MagickAdaptiveSharpenImageChannel(wand,DefaultChannels,radius,sigma);
317 return(status);
318}
319
320WandExport MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
321 const ChannelType channel,const double radius,const double sigma)
322{
323 Image
324 *sharp_image;
325
326 assert(wand != (MagickWand *) NULL);
327 assert(wand->signature == WandSignature);
328 if (wand->debug != MagickFalse)
329 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
330 if (wand->images == (Image *) NULL)
331 ThrowWandException(WandError,"ContainsNoImages",wand->name);
332 sharp_image=AdaptiveSharpenImageChannel(wand->images,channel,radius,sigma,
333 wand->exception);
334 if (sharp_image == (Image *) NULL)
335 return(MagickFalse);
336 ReplaceImageInList(&wand->images,sharp_image);
337 return(MagickTrue);
338}
339
340/*
341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342% %
343% %
344% %
345% 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 %
346% %
347% %
348% %
349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350%
351% MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
352% based on the range of intensity values in its local neighborhood. This
353% allows for thresholding of an image whose global intensity histogram
354% doesn't contain distinctive peaks.
355%
356% The format of the AdaptiveThresholdImage method is:
357%
358% MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000359% const size_t width,const size_t height,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +0000360%
361% A description of each parameter follows:
362%
363% o wand: the magick wand.
364%
365% o width: the width of the local neighborhood.
366%
367% o height: the height of the local neighborhood.
368%
369% o offset: the mean offset.
370%
371*/
372WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000373 const size_t width,const size_t height,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +0000374{
375 Image
376 *threshold_image;
377
378 assert(wand != (MagickWand *) NULL);
379 assert(wand->signature == WandSignature);
380 if (wand->debug != MagickFalse)
381 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
382 if (wand->images == (Image *) NULL)
383 ThrowWandException(WandError,"ContainsNoImages",wand->name);
384 threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
385 wand->exception);
386 if (threshold_image == (Image *) NULL)
387 return(MagickFalse);
388 ReplaceImageInList(&wand->images,threshold_image);
389 return(MagickTrue);
390}
391
392/*
393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394% %
395% %
396% %
397% M a g i c k A d d I m a g e %
398% %
399% %
400% %
401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402%
403% MagickAddImage() adds the specified images at the current image location.
404%
405% The format of the MagickAddImage method is:
406%
407% MagickBooleanType MagickAddImage(MagickWand *wand,
408% const MagickWand *add_wand)
409%
410% A description of each parameter follows:
411%
412% o wand: the magick wand.
413%
414% o add_wand: A wand that contains images to add at the current image
415% location.
416%
417*/
418
419static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
420 Image *images)
421{
422 Image
423 *sentinel;
424
425 sentinel=wand->images;
426 if (sentinel == (Image *) NULL)
427 {
428 wand->images=GetFirstImageInList(images);
429 return(MagickTrue);
430 }
431 if (wand->active == MagickFalse)
432 {
433 if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
434 {
435 AppendImageToList(&sentinel,images);
436 wand->images=GetLastImageInList(images);
437 return(MagickTrue);
438 }
439 if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
440 {
441 PrependImageToList(&sentinel,images);
442 wand->images=GetFirstImageInList(images);
443 return(MagickTrue);
444 }
445 }
446 InsertImageInList(&sentinel,images);
447 wand->images=GetFirstImageInList(images);
448 return(MagickTrue);
449}
450
451WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
452 const MagickWand *add_wand)
453{
454 Image
455 *images;
456
457 assert(wand != (MagickWand *) NULL);
458 assert(wand->signature == WandSignature);
459 if (wand->debug != MagickFalse)
460 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
461 assert(add_wand != (MagickWand *) NULL);
462 assert(add_wand->signature == WandSignature);
463 if (add_wand->images == (Image *) NULL)
464 ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
465 images=CloneImageList(add_wand->images,wand->exception);
466 if (images == (Image *) NULL)
467 return(MagickFalse);
468 return(InsertImageInWand(wand,images));
469}
470
471/*
472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
473% %
474% %
475% %
476% M a g i c k A d d N o i s e I m a g e %
477% %
478% %
479% %
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481%
482% MagickAddNoiseImage() adds random noise to the image.
483%
484% The format of the MagickAddNoiseImage method is:
485%
486% MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
487% const NoiseType noise_type)
488% MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
489% const ChannelType channel,const NoiseType noise_type)
490%
491% A description of each parameter follows:
492%
493% o wand: the magick wand.
494%
495% o channel: the image channel(s).
496%
497% o noise_type: The type of noise: Uniform, Gaussian, Multiplicative,
498% Impulse, Laplacian, or Poisson.
499%
500*/
501
502WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
503 const NoiseType noise_type)
504{
505 MagickBooleanType
506 status;
507
508 status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
509 return(status);
510}
511
512WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
513 const ChannelType channel,const NoiseType noise_type)
514{
515 Image
516 *noise_image;
517
518 assert(wand != (MagickWand *) NULL);
519 assert(wand->signature == WandSignature);
520 if (wand->debug != MagickFalse)
521 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
522 if (wand->images == (Image *) NULL)
523 ThrowWandException(WandError,"ContainsNoImages",wand->name);
524 noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
525 wand->exception);
526 if (noise_image == (Image *) NULL)
527 return(MagickFalse);
528 ReplaceImageInList(&wand->images,noise_image);
529 return(MagickTrue);
530}
531
532/*
533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
534% %
535% %
536% %
537% 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 %
538% %
539% %
540% %
541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542%
543% MagickAffineTransformImage() transforms an image as dictated by the affine
544% matrix of the drawing wand.
545%
546% The format of the MagickAffineTransformImage method is:
547%
548% MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
549% const DrawingWand *drawing_wand)
550%
551% A description of each parameter follows:
552%
553% o wand: the magick wand.
554%
555% o drawing_wand: the draw wand.
556%
557*/
558WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
559 const DrawingWand *drawing_wand)
560{
561 DrawInfo
562 *draw_info;
563
564 Image
565 *affine_image;
566
567 assert(wand != (MagickWand *) NULL);
568 assert(wand->signature == WandSignature);
569 if (wand->debug != MagickFalse)
570 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
571 if (wand->images == (Image *) NULL)
572 ThrowWandException(WandError,"ContainsNoImages",wand->name);
573 draw_info=PeekDrawingWand(drawing_wand);
574 if (draw_info == (DrawInfo *) NULL)
575 return(MagickFalse);
576 affine_image=AffineTransformImage(wand->images,&draw_info->affine,
577 wand->exception);
578 draw_info=DestroyDrawInfo(draw_info);
579 if (affine_image == (Image *) NULL)
580 return(MagickFalse);
581 ReplaceImageInList(&wand->images,affine_image);
582 return(MagickTrue);
583}
584
585/*
586%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
587% %
588% %
589% %
590% M a g i c k A n n o t a t e I m a g e %
591% %
592% %
593% %
594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
595%
596% MagickAnnotateImage() annotates an image with text.
597%
598% The format of the MagickAnnotateImage method is:
599%
600% MagickBooleanType MagickAnnotateImage(MagickWand *wand,
601% const DrawingWand *drawing_wand,const double x,const double y,
602% const double angle,const char *text)
603%
604% A description of each parameter follows:
605%
606% o wand: the magick wand.
607%
608% o drawing_wand: the draw wand.
609%
610% o x: x ordinate to left of text
611%
612% o y: y ordinate to text baseline
613%
614% o angle: rotate text relative to this angle.
615%
616% o text: text to draw
617%
618*/
619WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
620 const DrawingWand *drawing_wand,const double x,const double y,
621 const double angle,const char *text)
622{
623 char
624 geometry[MaxTextExtent];
625
626 DrawInfo
627 *draw_info;
628
629 MagickBooleanType
630 status;
631
632 assert(wand != (MagickWand *) NULL);
633 assert(wand->signature == WandSignature);
634 if (wand->debug != MagickFalse)
635 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
636 if (wand->images == (Image *) NULL)
637 ThrowWandException(WandError,"ContainsNoImages",wand->name);
638 draw_info=PeekDrawingWand(drawing_wand);
639 if (draw_info == (DrawInfo *) NULL)
640 return(MagickFalse);
641 (void) CloneString(&draw_info->text,text);
642 (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g",x,y);
643 draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
644 draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
645 draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
646 draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
647 (void) CloneString(&draw_info->geometry,geometry);
648 status=AnnotateImage(wand->images,draw_info);
649 draw_info=DestroyDrawInfo(draw_info);
650 if (status == MagickFalse)
651 InheritException(wand->exception,&wand->images->exception);
652 return(status);
653}
654
655/*
656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657% %
658% %
659% %
660% M a g i c k A n i m a t e I m a g e s %
661% %
662% %
663% %
664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
665%
666% MagickAnimateImages() animates an image or image sequence.
667%
668% The format of the MagickAnimateImages method is:
669%
670% MagickBooleanType MagickAnimateImages(MagickWand *wand,
671% const char *server_name)
672%
673% A description of each parameter follows:
674%
675% o wand: the magick wand.
676%
677% o server_name: the X server name.
678%
679*/
680WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
681 const char *server_name)
682{
683 MagickBooleanType
684 status;
685
686 assert(wand != (MagickWand *) NULL);
687 assert(wand->signature == WandSignature);
688 if (wand->debug != MagickFalse)
689 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
690 (void) CloneString(&wand->image_info->server_name,server_name);
691 status=AnimateImages(wand->image_info,wand->images);
692 if (status == MagickFalse)
693 InheritException(wand->exception,&wand->images->exception);
694 return(status);
695}
696
697/*
698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
699% %
700% %
701% %
702% M a g i c k A p p e n d I m a g e s %
703% %
704% %
705% %
706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
707%
708% MagickAppendImages() append a set of images.
709%
710% The format of the MagickAppendImages method is:
711%
712% MagickWand *MagickAppendImages(MagickWand *wand,
713% const MagickBooleanType stack)
714%
715% A description of each parameter follows:
716%
717% o wand: the magick wand.
718%
719% o stack: By default, images are stacked left-to-right. Set stack to
720% MagickTrue to stack them top-to-bottom.
721%
722*/
723WandExport MagickWand *MagickAppendImages(MagickWand *wand,
724 const MagickBooleanType stack)
725{
726 Image
727 *append_image;
728
729 assert(wand != (MagickWand *) NULL);
730 assert(wand->signature == WandSignature);
731 if (wand->debug != MagickFalse)
732 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
733 if (wand->images == (Image *) NULL)
734 return((MagickWand *) NULL);
735 append_image=AppendImages(wand->images,stack,wand->exception);
736 if (append_image == (Image *) NULL)
737 return((MagickWand *) NULL);
738 return(CloneMagickWandFromImages(wand,append_image));
739}
740
741/*
742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
743% %
744% %
745% %
746% M a g i c k A u t o G a m m a I m a g e %
747% %
748% %
749% %
750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
751%
752% MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
753% image to try make set its gamma appropriatally.
754%
755% The format of the MagickAutoGammaImage method is:
756%
757% MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
758% MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
759% const ChannelType channel)
760%
761% A description of each parameter follows:
762%
763% o wand: the magick wand.
764%
765% o channel: the image channel(s).
766%
767*/
768WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
769{
770 MagickBooleanType
771 status;
772
773 status=MagickAutoGammaImageChannel(wand,DefaultChannels);
774 return(status);
775}
776
777WandExport MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
778 const ChannelType channel)
779{
780 MagickBooleanType
781 status;
782
783 assert(wand != (MagickWand *) NULL);
784 assert(wand->signature == WandSignature);
785 if (wand->debug != MagickFalse)
786 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787 if (wand->images == (Image *) NULL)
788 ThrowWandException(WandError,"ContainsNoImages",wand->name);
789 status=AutoGammaImageChannel(wand->images,channel);
790 if (status == MagickFalse)
791 InheritException(wand->exception,&wand->images->exception);
792 return(status);
793}
794
795/*
796%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
797% %
798% %
799% %
800% M a g i c k A u t o L e v e l I m a g e %
801% %
802% %
803% %
804%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805%
806% MagickAutoLevelImage() adjusts the levels of a particular image channel by
807% scaling the minimum and maximum values to the full quantum range.
808%
809% The format of the MagickAutoLevelImage method is:
810%
811% MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
812% MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
813% const ChannelType channel)
814%
815% A description of each parameter follows:
816%
817% o wand: the magick wand.
818%
819% o channel: the image channel(s).
820%
821*/
822WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
823{
824 MagickBooleanType
825 status;
826
827 status=MagickAutoLevelImageChannel(wand,DefaultChannels);
828 return(status);
829}
830
831WandExport MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
832 const ChannelType channel)
833{
834 MagickBooleanType
835 status;
836
837 assert(wand != (MagickWand *) NULL);
838 assert(wand->signature == WandSignature);
839 if (wand->debug != MagickFalse)
840 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
841 if (wand->images == (Image *) NULL)
842 ThrowWandException(WandError,"ContainsNoImages",wand->name);
843 status=AutoLevelImageChannel(wand->images,channel);
844 if (status == MagickFalse)
845 InheritException(wand->exception,&wand->images->exception);
846 return(status);
847}
848
849/*
850%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
851% %
852% %
853% %
cristy3ed852e2009-09-05 21:47:34 +0000854% 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 %
855% %
856% %
857% %
858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859%
860% MagickBlackThresholdImage() is like MagickThresholdImage() but forces all
861% pixels below the threshold into black while leaving all pixels above the
862% threshold unchanged.
863%
864% The format of the MagickBlackThresholdImage method is:
865%
866% MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
867% const PixelWand *threshold)
868%
869% A description of each parameter follows:
870%
871% o wand: the magick wand.
872%
873% o threshold: the pixel wand.
874%
875*/
876WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
877 const PixelWand *threshold)
878{
879 char
880 thresholds[MaxTextExtent];
881
882 MagickBooleanType
883 status;
884
885 assert(wand != (MagickWand *) NULL);
886 assert(wand->signature == WandSignature);
887 if (wand->debug != MagickFalse)
888 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
889 if (wand->images == (Image *) NULL)
890 ThrowWandException(WandError,"ContainsNoImages",wand->name);
891 (void) FormatMagickString(thresholds,MaxTextExtent,
892 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
893 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
894 PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
895 status=BlackThresholdImage(wand->images,thresholds);
896 if (status == MagickFalse)
897 InheritException(wand->exception,&wand->images->exception);
898 return(status);
899}
900
901/*
902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
903% %
904% %
905% %
906% M a g i c k B l u e S h i f t I m a g e %
907% %
908% %
909% %
910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
911%
912% MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
913% nighttime in the moonlight.
914%
915% The format of the MagickBlueShiftImage method is:
916%
917% MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
918% const double factor)
919%
920% A description of each parameter follows:
921%
922% o wand: the magick wand.
923%
924% o factor: the blue shift factor (default 1.5)
925%
926*/
927WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
928 const double factor)
929{
930 Image
931 *shift_image;
932
933 assert(wand != (MagickWand *) NULL);
934 assert(wand->signature == WandSignature);
935 if (wand->debug != MagickFalse)
936 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
937 if (wand->images == (Image *) NULL)
938 ThrowWandException(WandError,"ContainsNoImages",wand->name);
939 shift_image=BlueShiftImage(wand->images,factor,wand->exception);
940 if (shift_image == (Image *) NULL)
941 return(MagickFalse);
942 ReplaceImageInList(&wand->images,shift_image);
943 return(MagickTrue);
944}
945
946/*
947%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
948% %
949% %
950% %
951% M a g i c k B l u r I m a g e %
952% %
953% %
954% %
955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
956%
957% MagickBlurImage() blurs an image. We convolve the image with a
958% gaussian operator of the given radius and standard deviation (sigma).
959% For reasonable results, the radius should be larger than sigma. Use a
960% radius of 0 and BlurImage() selects a suitable radius for you.
961%
962% The format of the MagickBlurImage method is:
963%
964% MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
965% const double sigma)
966% MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
967% const ChannelType channel,const double radius,const double sigma)
968%
969% A description of each parameter follows:
970%
971% o wand: the magick wand.
972%
973% o channel: the image channel(s).
974%
975% o radius: the radius of the , in pixels, not counting the center
976% pixel.
977%
978% o sigma: the standard deviation of the , in pixels.
979%
980*/
981
982WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
983 const double radius,const double sigma)
984{
985 MagickBooleanType
986 status;
987
988 status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
989 return(status);
990}
991
992WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
993 const ChannelType channel,const double radius,const double sigma)
994{
995 Image
996 *blur_image;
997
998 assert(wand != (MagickWand *) NULL);
999 assert(wand->signature == WandSignature);
1000 if (wand->debug != MagickFalse)
1001 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1002 if (wand->images == (Image *) NULL)
1003 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1004 blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
1005 wand->exception);
1006 if (blur_image == (Image *) NULL)
1007 return(MagickFalse);
1008 ReplaceImageInList(&wand->images,blur_image);
1009 return(MagickTrue);
1010}
1011
1012/*
1013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1014% %
1015% %
1016% %
1017% M a g i c k B o r d e r I m a g e %
1018% %
1019% %
1020% %
1021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1022%
1023% MagickBorderImage() surrounds the image with a border of the color defined
1024% by the bordercolor pixel wand.
1025%
1026% The format of the MagickBorderImage method is:
1027%
1028% MagickBooleanType MagickBorderImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001029% const PixelWand *bordercolor,const size_t width,
1030% const size_t height)
cristy3ed852e2009-09-05 21:47:34 +00001031%
1032% A description of each parameter follows:
1033%
1034% o wand: the magick wand.
1035%
1036% o bordercolor: the border color pixel wand.
1037%
1038% o width: the border width.
1039%
1040% o height: the border height.
1041%
1042*/
1043WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001044 const PixelWand *bordercolor,const size_t width,
1045 const size_t height)
cristy3ed852e2009-09-05 21:47:34 +00001046{
1047 Image
1048 *border_image;
1049
1050 RectangleInfo
1051 border_info;
1052
1053 assert(wand != (MagickWand *) NULL);
1054 assert(wand->signature == WandSignature);
1055 if (wand->debug != MagickFalse)
1056 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1057 if (wand->images == (Image *) NULL)
1058 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1059 border_info.width=width;
1060 border_info.height=height;
1061 border_info.x=0;
1062 border_info.y=0;
1063 PixelGetQuantumColor(bordercolor,&wand->images->border_color);
1064 border_image=BorderImage(wand->images,&border_info,wand->exception);
1065 if (border_image == (Image *) NULL)
1066 return(MagickFalse);
1067 ReplaceImageInList(&wand->images,border_image);
1068 return(MagickTrue);
1069}
1070
1071/*
1072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073% %
1074% %
1075% %
cristya28d6b82010-01-11 20:03:47 +00001076% 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 %
1077% %
1078% %
1079% %
1080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1081%
1082% Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1083% of an image. It converts the brightness and contrast parameters into slope
1084% and intercept and calls a polynomical function to apply to the image.
1085
1086%
1087% The format of the MagickBrightnessContrastImage method is:
1088%
1089% MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1090% const double brightness,const double contrast)
1091% MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand,
1092% const ChannelType channel,const double brightness,
1093% const double contrast)
1094%
1095% A description of each parameter follows:
1096%
1097% o wand: the magick wand.
1098%
1099% o channel: the image channel(s).
1100%
1101% o brightness: the brightness percent (-100 .. 100).
1102%
1103% o contrast: the contrast percent (-100 .. 100).
1104%
1105*/
1106
1107WandExport MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1108 const double brightness,const double contrast)
1109{
1110 MagickBooleanType
1111 status;
1112
1113 status=MagickBrightnessContrastImageChannel(wand,DefaultChannels,brightness,
1114 contrast);
1115 return(status);
1116}
1117
1118WandExport MagickBooleanType MagickBrightnessContrastImageChannel(
1119 MagickWand *wand,const ChannelType channel,const double brightness,
1120 const double contrast)
1121{
1122 MagickBooleanType
1123 status;
1124
1125 assert(wand != (MagickWand *) NULL);
1126 assert(wand->signature == WandSignature);
1127 if (wand->debug != MagickFalse)
1128 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1129 if (wand->images == (Image *) NULL)
1130 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1131 status=BrightnessContrastImageChannel(wand->images,channel,brightness,
1132 contrast);
1133 if (status == MagickFalse)
1134 InheritException(wand->exception,&wand->images->exception);
1135 return(status);
1136}
1137
1138/*
1139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1140% %
1141% %
1142% %
cristy3ed852e2009-09-05 21:47:34 +00001143% M a g i c k C h a r c o a l I m a g e %
1144% %
1145% %
1146% %
1147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1148%
1149% MagickCharcoalImage() simulates a charcoal drawing.
1150%
1151% The format of the MagickCharcoalImage method is:
1152%
1153% MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1154% const double radius,const double sigma)
1155%
1156% A description of each parameter follows:
1157%
1158% o wand: the magick wand.
1159%
1160% o radius: the radius of the Gaussian, in pixels, not counting the center
1161% pixel.
1162%
1163% o sigma: the standard deviation of the Gaussian, in pixels.
1164%
1165*/
1166WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1167 const double radius,const double sigma)
1168{
1169 Image
1170 *charcoal_image;
1171
1172 assert(wand != (MagickWand *) NULL);
1173 assert(wand->signature == WandSignature);
1174 if (wand->debug != MagickFalse)
1175 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1176 if (wand->images == (Image *) NULL)
1177 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1178 charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1179 if (charcoal_image == (Image *) NULL)
1180 return(MagickFalse);
1181 ReplaceImageInList(&wand->images,charcoal_image);
1182 return(MagickTrue);
1183}
1184
1185/*
1186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1187% %
1188% %
1189% %
1190% M a g i c k C h o p I m a g e %
1191% %
1192% %
1193% %
1194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1195%
1196% MagickChopImage() removes a region of an image and collapses the image to
1197% occupy the removed portion
1198%
1199% The format of the MagickChopImage method is:
1200%
1201% MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001202% const size_t width,const size_t height,const ssize_t x,
1203% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001204%
1205% A description of each parameter follows:
1206%
1207% o wand: the magick wand.
1208%
1209% o width: the region width.
1210%
1211% o height: the region height.
1212%
1213% o x: the region x offset.
1214%
1215% o y: the region y offset.
1216%
1217%
1218*/
1219WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001220 const size_t width,const size_t height,const ssize_t x,
1221 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001222{
1223 Image
1224 *chop_image;
1225
1226 RectangleInfo
1227 chop;
1228
1229 assert(wand != (MagickWand *) NULL);
1230 assert(wand->signature == WandSignature);
1231 if (wand->debug != MagickFalse)
1232 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1233 if (wand->images == (Image *) NULL)
1234 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1235 chop.width=width;
1236 chop.height=height;
1237 chop.x=x;
1238 chop.y=y;
1239 chop_image=ChopImage(wand->images,&chop,wand->exception);
1240 if (chop_image == (Image *) NULL)
1241 return(MagickFalse);
1242 ReplaceImageInList(&wand->images,chop_image);
1243 return(MagickTrue);
1244}
1245
1246/*
1247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1248% %
1249% %
1250% %
cristy1eb45dd2009-09-25 16:38:06 +00001251% M a g i c k C l a m p I m a g e %
1252% %
1253% %
1254% %
1255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1256%
cristyecb0c6d2009-09-25 16:50:09 +00001257% MagickClampImage() restricts the color range from 0 to the quantum depth.
cristy1eb45dd2009-09-25 16:38:06 +00001258%
1259% The format of the MagickClampImage method is:
1260%
1261% MagickBooleanType MagickClampImage(MagickWand *wand)
1262% MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1263% const ChannelType channel)
1264%
1265% A description of each parameter follows:
1266%
1267% o wand: the magick wand.
1268%
1269% o channel: the channel.
1270%
1271*/
1272
1273WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1274{
1275 MagickBooleanType
1276 status;
1277
1278 status=MagickClampImageChannel(wand,DefaultChannels);
1279 return(status);
1280}
1281
1282WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1283 const ChannelType channel)
1284{
1285 MagickBooleanType
1286 status;
1287
1288 assert(wand != (MagickWand *) NULL);
1289 assert(wand->signature == WandSignature);
1290 if (wand->debug != MagickFalse)
1291 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1292 if (wand->images == (Image *) NULL)
1293 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1294 status=ClampImageChannel(wand->images,channel);
1295 if (status == MagickFalse)
1296 InheritException(wand->exception,&wand->images->exception);
1297 return(status);
1298}
1299
1300/*
1301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1302% %
1303% %
1304% %
cristy3ed852e2009-09-05 21:47:34 +00001305% M a g i c k C l i p I m a g e %
1306% %
1307% %
1308% %
1309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1310%
cristycee97112010-05-28 00:44:52 +00001311% MagickClipImage() clips along the first path from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001312% present.
1313%
1314% The format of the MagickClipImage method is:
1315%
1316% MagickBooleanType MagickClipImage(MagickWand *wand)
1317%
1318% A description of each parameter follows:
1319%
1320% o wand: the magick wand.
1321%
1322*/
1323WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1324{
1325 MagickBooleanType
1326 status;
1327
1328 assert(wand != (MagickWand *) NULL);
1329 assert(wand->signature == WandSignature);
1330 if (wand->debug != MagickFalse)
1331 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1332 if (wand->images == (Image *) NULL)
1333 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1334 status=ClipImage(wand->images);
1335 if (status == MagickFalse)
1336 InheritException(wand->exception,&wand->images->exception);
1337 return(status);
1338}
1339
1340/*
1341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1342% %
1343% %
1344% %
1345% M a g i c k C l i p I m a g e P a t h %
1346% %
1347% %
1348% %
1349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1350%
cristycee97112010-05-28 00:44:52 +00001351% MagickClipImagePath() clips along the named paths from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001352% present. Later operations take effect inside the path. Id may be a number
1353% if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1354% path.
1355%
1356% The format of the MagickClipImagePath method is:
1357%
1358% MagickBooleanType MagickClipImagePath(MagickWand *wand,
1359% const char *pathname,const MagickBooleanType inside)
1360%
1361% A description of each parameter follows:
1362%
1363% o wand: the magick wand.
1364%
1365% o pathname: name of clipping path resource. If name is preceded by #, use
1366% clipping path numbered by name.
1367%
1368% o inside: if non-zero, later operations take effect inside clipping path.
1369% Otherwise later operations take effect outside clipping path.
1370%
1371*/
1372WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1373 const char *pathname,const MagickBooleanType inside)
1374{
1375 MagickBooleanType
1376 status;
1377
1378 assert(wand != (MagickWand *) NULL);
1379 assert(wand->signature == WandSignature);
1380 if (wand->debug != MagickFalse)
1381 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1382 if (wand->images == (Image *) NULL)
1383 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1384 status=ClipImagePath(wand->images,pathname,inside);
1385 if (status == MagickFalse)
1386 InheritException(wand->exception,&wand->images->exception);
1387 return(status);
1388}
1389
1390/*
1391%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1392% %
1393% %
1394% %
1395% M a g i c k C l u t I m a g e %
1396% %
1397% %
1398% %
1399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1400%
1401% MagickClutImage() replaces colors in the image from a color lookup table.
1402%
1403% The format of the MagickClutImage method is:
1404%
1405% MagickBooleanType MagickClutImage(MagickWand *wand,
1406% const MagickWand *clut_wand)
1407% MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1408% const ChannelType channel,const MagickWand *clut_wand)
1409%
1410% A description of each parameter follows:
1411%
1412% o wand: the magick wand.
1413%
1414% o clut_image: the clut image.
1415%
1416*/
1417
1418WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1419 const MagickWand *clut_wand)
1420{
1421 MagickBooleanType
1422 status;
1423
1424 status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
1425 return(status);
1426}
1427
1428WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1429 const ChannelType channel,const MagickWand *clut_wand)
1430{
1431 MagickBooleanType
1432 status;
1433
1434 assert(wand != (MagickWand *) NULL);
1435 assert(wand->signature == WandSignature);
1436 if (wand->debug != MagickFalse)
1437 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1438 if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1439 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1440 status=ClutImageChannel(wand->images,channel,clut_wand->images);
1441 if (status == MagickFalse)
1442 InheritException(wand->exception,&wand->images->exception);
1443 return(status);
1444}
1445
1446/*
1447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1448% %
1449% %
1450% %
1451% M a g i c k C o a l e s c e I m a g e s %
1452% %
1453% %
1454% %
1455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1456%
1457% MagickCoalesceImages() composites a set of images while respecting any page
1458% offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1459% typically start with an image background and each subsequent image
1460% varies in size and offset. MagickCoalesceImages() returns a new sequence
1461% where each image in the sequence is the same size as the first and
1462% composited with the next image in the sequence.
1463%
1464% The format of the MagickCoalesceImages method is:
1465%
1466% MagickWand *MagickCoalesceImages(MagickWand *wand)
1467%
1468% A description of each parameter follows:
1469%
1470% o wand: the magick wand.
1471%
1472*/
1473WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1474{
1475 Image
1476 *coalesce_image;
1477
1478 assert(wand != (MagickWand *) NULL);
1479 assert(wand->signature == WandSignature);
1480 if (wand->debug != MagickFalse)
1481 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1482 if (wand->images == (Image *) NULL)
1483 return((MagickWand *) NULL);
1484 coalesce_image=CoalesceImages(wand->images,wand->exception);
1485 if (coalesce_image == (Image *) NULL)
1486 return((MagickWand *) NULL);
1487 return(CloneMagickWandFromImages(wand,coalesce_image));
1488}
1489
1490/*
1491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1492% %
1493% %
1494% %
1495% M a g i c k C o l o r D e c i s i o n I m a g e %
1496% %
1497% %
1498% %
1499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1500%
1501% MagickColorDecisionListImage() accepts a lightweight Color Correction
1502% Collection (CCC) file which solely contains one or more color corrections
1503% and applies the color correction to the image. Here is a sample CCC file:
1504%
1505% <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1506% <ColorCorrection id="cc03345">
1507% <SOPNode>
1508% <Slope> 0.9 1.2 0.5 </Slope>
1509% <Offset> 0.4 -0.5 0.6 </Offset>
1510% <Power> 1.0 0.8 1.5 </Power>
1511% </SOPNode>
1512% <SATNode>
1513% <Saturation> 0.85 </Saturation>
1514% </SATNode>
1515% </ColorCorrection>
1516% </ColorCorrectionCollection>
1517%
1518% which includes the offset, slope, and power for each of the RGB channels
1519% as well as the saturation.
1520%
1521% The format of the MagickColorDecisionListImage method is:
1522%
1523% MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1524% const double gamma)
1525%
1526% A description of each parameter follows:
1527%
1528% o wand: the magick wand.
1529%
1530% o color_correction_collection: the color correction collection in XML.
1531%
1532*/
1533WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1534 const char *color_correction_collection)
1535{
1536 MagickBooleanType
1537 status;
1538
1539 assert(wand != (MagickWand *) NULL);
1540 assert(wand->signature == WandSignature);
1541 if (wand->debug != MagickFalse)
1542 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1543 if (wand->images == (Image *) NULL)
1544 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1545 status=ColorDecisionListImage(wand->images,color_correction_collection);
1546 if (status == MagickFalse)
1547 InheritException(wand->exception,&wand->images->exception);
1548 return(status);
1549}
1550
1551/*
1552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1553% %
1554% %
1555% %
1556% M a g i c k C o l o r i z e I m a g e %
1557% %
1558% %
1559% %
1560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1561%
1562% MagickColorizeImage() blends the fill color with each pixel in the image.
1563%
1564% The format of the MagickColorizeImage method is:
1565%
1566% MagickBooleanType MagickColorizeImage(MagickWand *wand,
1567% const PixelWand *colorize,const PixelWand *opacity)
1568%
1569% A description of each parameter follows:
1570%
1571% o wand: the magick wand.
1572%
1573% o colorize: the colorize pixel wand.
1574%
1575% o opacity: the opacity pixel wand.
1576%
1577*/
1578WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1579 const PixelWand *colorize,const PixelWand *opacity)
1580{
1581 char
1582 percent_opaque[MaxTextExtent];
1583
1584 Image
1585 *colorize_image;
1586
1587 PixelPacket
1588 target;
1589
1590 assert(wand != (MagickWand *) NULL);
1591 assert(wand->signature == WandSignature);
1592 if (wand->debug != MagickFalse)
1593 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1594 if (wand->images == (Image *) NULL)
1595 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy8cd5b312010-01-07 01:10:24 +00001596 (void) FormatMagickString(percent_opaque,MaxTextExtent,
cristye7f51092010-01-17 00:39:37 +00001597 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristy8cd5b312010-01-07 01:10:24 +00001598 PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1599 PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1600 PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1601 PixelGetOpacityQuantum(opacity)));
cristy3ed852e2009-09-05 21:47:34 +00001602 PixelGetQuantumColor(colorize,&target);
1603 colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1604 wand->exception);
1605 if (colorize_image == (Image *) NULL)
1606 return(MagickFalse);
1607 ReplaceImageInList(&wand->images,colorize_image);
1608 return(MagickTrue);
1609}
1610
1611/*
1612%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1613% %
1614% %
1615% %
cristye6365592010-04-02 17:31:23 +00001616% M a g i c k C o l o r M a t r i x I m a g e %
1617% %
1618% %
1619% %
1620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1621%
1622% MagickColorMatrixImage() apply color transformation to an image. The method
1623% permits saturation changes, hue rotation, luminance to alpha, and various
1624% other effects. Although variable-sized transformation matrices can be used,
1625% typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1626% (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1627% except offsets are in column 6 rather than 5 (in support of CMYKA images)
1628% and offsets are normalized (divide Flash offset by 255).
1629%
1630% The format of the MagickColorMatrixImage method is:
1631%
1632% MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1633% const KernelInfo *color_matrix)
1634%
1635% A description of each parameter follows:
1636%
1637% o wand: the magick wand.
1638%
1639% o color_matrix: the color matrix.
1640%
1641*/
1642WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1643 const KernelInfo *color_matrix)
1644{
1645 Image
1646 *color_image;
1647
1648 assert(wand != (MagickWand *) NULL);
1649 assert(wand->signature == WandSignature);
1650 if (wand->debug != MagickFalse)
1651 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1652 if (color_matrix == (const KernelInfo *) NULL)
1653 return(MagickFalse);
1654 if (wand->images == (Image *) NULL)
1655 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1656 color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1657 if (color_image == (Image *) NULL)
1658 return(MagickFalse);
1659 ReplaceImageInList(&wand->images,color_image);
1660 return(MagickTrue);
1661}
1662
1663/*
1664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1665% %
1666% %
1667% %
cristy3ed852e2009-09-05 21:47:34 +00001668% M a g i c k C o m b i n e I m a g e s %
1669% %
1670% %
1671% %
1672%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1673%
1674% MagickCombineImages() combines one or more images into a single image. The
1675% grayscale value of the pixels of each image in the sequence is assigned in
1676% order to the specified hannels of the combined image. The typical
1677% ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1678%
1679% The format of the MagickCombineImages method is:
1680%
1681% MagickWand *MagickCombineImages(MagickWand *wand,
1682% const ChannelType channel)
1683%
1684% A description of each parameter follows:
1685%
1686% o wand: the magick wand.
1687%
1688% o channel: the channel.
1689%
1690*/
1691WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1692 const ChannelType channel)
1693{
1694 Image
1695 *combine_image;
1696
1697 assert(wand != (MagickWand *) NULL);
1698 assert(wand->signature == WandSignature);
1699 if (wand->debug != MagickFalse)
1700 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1701 if (wand->images == (Image *) NULL)
1702 return((MagickWand *) NULL);
1703 combine_image=CombineImages(wand->images,channel,wand->exception);
1704 if (combine_image == (Image *) NULL)
1705 return((MagickWand *) NULL);
1706 return(CloneMagickWandFromImages(wand,combine_image));
1707}
1708
1709/*
1710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1711% %
1712% %
1713% %
1714% M a g i c k C o m m e n t I m a g e %
1715% %
1716% %
1717% %
1718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1719%
1720% MagickCommentImage() adds a comment to your image.
1721%
1722% The format of the MagickCommentImage method is:
1723%
1724% MagickBooleanType MagickCommentImage(MagickWand *wand,
1725% const char *comment)
1726%
1727% A description of each parameter follows:
1728%
1729% o wand: the magick wand.
1730%
1731% o comment: the image comment.
1732%
1733*/
1734WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1735 const char *comment)
1736{
1737 MagickBooleanType
1738 status;
1739
1740 assert(wand != (MagickWand *) NULL);
1741 assert(wand->signature == WandSignature);
1742 if (wand->debug != MagickFalse)
1743 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1744 if (wand->images == (Image *) NULL)
1745 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1746 status=SetImageProperty(wand->images,"comment",comment);
1747 if (status == MagickFalse)
1748 InheritException(wand->exception,&wand->images->exception);
1749 return(status);
1750}
1751
1752/*
1753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1754% %
1755% %
1756% %
1757% M a g i c k C o m p a r e I m a g e C h a n n e l s %
1758% %
1759% %
1760% %
1761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1762%
1763% MagickCompareImageChannels() compares one or more image channels of an image
1764% to a reconstructed image and returns the difference image.
1765%
1766% The format of the MagickCompareImageChannels method is:
1767%
1768% MagickWand *MagickCompareImageChannels(MagickWand *wand,
1769% const MagickWand *reference,const ChannelType channel,
1770% const MetricType metric,double *distortion)
1771%
1772% A description of each parameter follows:
1773%
1774% o wand: the magick wand.
1775%
1776% o reference: the reference wand.
1777%
1778% o channel: the channel.
1779%
1780% o metric: the metric.
1781%
1782% o distortion: the computed distortion between the images.
1783%
1784*/
1785WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
1786 const MagickWand *reference,const ChannelType channel,const MetricType metric,
1787 double *distortion)
1788{
1789 Image
1790 *compare_image;
1791
1792 assert(wand != (MagickWand *) NULL);
1793 assert(wand->signature == WandSignature);
1794 if (wand->debug != MagickFalse)
1795 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1796 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1797 {
1798 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1799 "ContainsNoImages","`%s'",wand->name);
1800 return((MagickWand *) NULL);
1801 }
1802 compare_image=CompareImageChannels(wand->images,reference->images,channel,
1803 metric,distortion,&wand->images->exception);
1804 if (compare_image == (Image *) NULL)
1805 return((MagickWand *) NULL);
1806 return(CloneMagickWandFromImages(wand,compare_image));
1807}
1808
1809/*
1810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1811% %
1812% %
1813% %
1814% M a g i c k C o m p a r e I m a g e L a y e r s %
1815% %
1816% %
1817% %
1818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1819%
1820% MagickCompareImageLayers() compares each image with the next in a sequence
1821% and returns the maximum bounding region of any pixel differences it
1822% discovers.
1823%
1824% The format of the MagickCompareImageLayers method is:
1825%
1826% MagickWand *MagickCompareImageLayers(MagickWand *wand,
1827% const ImageLayerMethod method)
1828%
1829% A description of each parameter follows:
1830%
1831% o wand: the magick wand.
1832%
1833% o method: the compare method.
1834%
1835*/
1836WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
1837 const ImageLayerMethod method)
1838{
1839 Image
1840 *layers_image;
1841
1842 assert(wand != (MagickWand *) NULL);
1843 assert(wand->signature == WandSignature);
1844 if (wand->debug != MagickFalse)
1845 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1846 if (wand->images == (Image *) NULL)
1847 return((MagickWand *) NULL);
1848 layers_image=CompareImageLayers(wand->images,method,wand->exception);
1849 if (layers_image == (Image *) NULL)
1850 return((MagickWand *) NULL);
1851 return(CloneMagickWandFromImages(wand,layers_image));
1852}
1853
1854/*
1855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1856% %
1857% %
1858% %
1859% M a g i c k C o m p a r e I m a g e s %
1860% %
1861% %
1862% %
1863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1864%
1865% MagickCompareImages() compares an image to a reconstructed image and returns
1866% the specified difference image.
1867%
1868% The format of the MagickCompareImages method is:
1869%
1870% MagickWand *MagickCompareImages(MagickWand *wand,
1871% const MagickWand *reference,const MetricType metric,
1872% double *distortion)
1873%
1874% A description of each parameter follows:
1875%
1876% o wand: the magick wand.
1877%
1878% o reference: the reference wand.
1879%
1880% o metric: the metric.
1881%
1882% o distortion: the computed distortion between the images.
1883%
1884*/
1885WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1886 const MagickWand *reference,const MetricType metric,double *distortion)
1887{
1888 Image
1889 *compare_image;
1890
1891
1892 assert(wand != (MagickWand *) NULL);
1893 assert(wand->signature == WandSignature);
1894 if (wand->debug != MagickFalse)
1895 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1896 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1897 {
1898 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1899 "ContainsNoImages","`%s'",wand->name);
1900 return((MagickWand *) NULL);
1901 }
1902 compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1903 &wand->images->exception);
1904 if (compare_image == (Image *) NULL)
1905 return((MagickWand *) NULL);
1906 return(CloneMagickWandFromImages(wand,compare_image));
1907}
1908
1909/*
1910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1911% %
1912% %
1913% %
1914% M a g i c k C o m p o s i t e I m a g e %
1915% %
1916% %
1917% %
1918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1919%
1920% MagickCompositeImage() composite one image onto another at the specified
1921% offset.
1922%
1923% The format of the MagickCompositeImage method is:
1924%
1925% MagickBooleanType MagickCompositeImage(MagickWand *wand,
1926% const MagickWand *composite_wand,const CompositeOperator compose,
cristybb503372010-05-27 20:51:26 +00001927% const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001928% MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1929% const ChannelType channel,const MagickWand *composite_wand,
cristybb503372010-05-27 20:51:26 +00001930% const CompositeOperator compose,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001931%
1932% A description of each parameter follows:
1933%
1934% o wand: the magick wand.
1935%
1936% o composite_image: the composite image.
1937%
1938% o compose: This operator affects how the composite is applied to the
1939% image. The default is Over. Choose from these operators:
1940%
1941% OverCompositeOp InCompositeOp OutCompositeOp
1942% AtopCompositeOp XorCompositeOp PlusCompositeOp
1943% MinusCompositeOp AddCompositeOp SubtractCompositeOp
1944% DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1945% DisplaceCompositeOp
1946%
1947% o x: the column offset of the composited image.
1948%
1949% o y: the row offset of the composited image.
1950%
1951*/
1952
1953WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001954 const MagickWand *composite_wand,const CompositeOperator compose,const ssize_t x,
1955 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001956{
1957 MagickBooleanType
1958 status;
1959
1960 status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
1961 compose,x,y);
1962 return(status);
1963}
1964
1965WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1966 const ChannelType channel,const MagickWand *composite_wand,
cristybb503372010-05-27 20:51:26 +00001967 const CompositeOperator compose,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001968{
1969 MagickBooleanType
1970 status;
1971
1972 assert(wand != (MagickWand *) NULL);
1973 assert(wand->signature == WandSignature);
1974 if (wand->debug != MagickFalse)
1975 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1976 if ((wand->images == (Image *) NULL) ||
1977 (composite_wand->images == (Image *) NULL))
1978 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1979 status=CompositeImageChannel(wand->images,channel,compose,
1980 composite_wand->images,x,y);
1981 if (status == MagickFalse)
1982 InheritException(wand->exception,&wand->images->exception);
1983 return(status);
1984}
1985
1986/*
1987%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1988% %
1989% %
1990% %
1991% M a g i c k C o n t r a s t I m a g e %
1992% %
1993% %
1994% %
1995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1996%
1997% MagickContrastImage() enhances the intensity differences between the lighter
1998% and darker elements of the image. Set sharpen to a value other than 0 to
1999% increase the image contrast otherwise the contrast is reduced.
2000%
2001% The format of the MagickContrastImage method is:
2002%
2003% MagickBooleanType MagickContrastImage(MagickWand *wand,
2004% const MagickBooleanType sharpen)
2005%
2006% A description of each parameter follows:
2007%
2008% o wand: the magick wand.
2009%
2010% o sharpen: Increase or decrease image contrast.
2011%
2012%
2013*/
2014WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2015 const MagickBooleanType sharpen)
2016{
2017 MagickBooleanType
2018 status;
2019
2020 assert(wand != (MagickWand *) NULL);
2021 assert(wand->signature == WandSignature);
2022 if (wand->debug != MagickFalse)
2023 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2024 if (wand->images == (Image *) NULL)
2025 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2026 status=ContrastImage(wand->images,sharpen);
2027 if (status == MagickFalse)
2028 InheritException(wand->exception,&wand->images->exception);
2029 return(status);
2030}
2031
2032/*
2033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2034% %
2035% %
2036% %
2037% 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 %
2038% %
2039% %
2040% %
2041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2042%
2043% MagickContrastStretchImage() enhances the contrast of a color image by
2044% adjusting the pixels color to span the entire range of colors available.
2045% You can also reduce the influence of a particular channel with a gamma
2046% value of 0.
2047%
2048% The format of the MagickContrastStretchImage method is:
2049%
2050% MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2051% const double black_point,const double white_point)
2052% MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2053% const ChannelType channel,const double black_point,
2054% const double white_point)
2055%
2056% A description of each parameter follows:
2057%
2058% o wand: the magick wand.
2059%
2060% o channel: the image channel(s).
2061%
2062% o black_point: the black point.
2063%
2064% o white_point: the white point.
2065%
2066*/
2067
2068WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2069 const double black_point,const double white_point)
2070{
2071 MagickBooleanType
2072 status;
2073
2074 status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
2075 white_point);
2076 return(status);
2077}
2078
2079WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2080 const ChannelType channel,const double black_point,const double white_point)
2081{
2082 MagickBooleanType
2083 status;
2084
2085 assert(wand != (MagickWand *) NULL);
2086 assert(wand->signature == WandSignature);
2087 if (wand->debug != MagickFalse)
2088 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2089 if (wand->images == (Image *) NULL)
2090 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2091 status=ContrastStretchImageChannel(wand->images,channel,black_point,
2092 white_point);
2093 if (status == MagickFalse)
2094 InheritException(wand->exception,&wand->images->exception);
2095 return(status);
2096}
2097
2098/*
2099%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2100% %
2101% %
2102% %
2103% M a g i c k C o n v o l v e I m a g e %
2104% %
2105% %
2106% %
2107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2108%
2109% MagickConvolveImage() applies a custom convolution kernel to the image.
2110%
2111% The format of the MagickConvolveImage method is:
2112%
2113% MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002114% const size_t order,const double *kernel)
cristy3ed852e2009-09-05 21:47:34 +00002115% MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002116% const ChannelType channel,const size_t order,
cristy3ed852e2009-09-05 21:47:34 +00002117% const double *kernel)
2118%
2119% A description of each parameter follows:
2120%
2121% o wand: the magick wand.
2122%
2123% o channel: the image channel(s).
2124%
2125% o order: the number of columns and rows in the filter kernel.
2126%
2127% o kernel: An array of doubles representing the convolution kernel.
2128%
2129*/
2130
2131WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002132 const size_t order,const double *kernel)
cristy3ed852e2009-09-05 21:47:34 +00002133{
2134 MagickBooleanType
2135 status;
2136
2137 status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2138 return(status);
2139}
2140
2141WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002142 const ChannelType channel,const size_t order,const double *kernel)
cristy3ed852e2009-09-05 21:47:34 +00002143{
2144 Image
2145 *convolve_image;
2146
2147 assert(wand != (MagickWand *) NULL);
2148 assert(wand->signature == WandSignature);
2149 if (wand->debug != MagickFalse)
2150 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2151 if (kernel == (const double *) NULL)
2152 return(MagickFalse);
2153 if (wand->images == (Image *) NULL)
2154 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2155 convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2156 wand->exception);
2157 if (convolve_image == (Image *) NULL)
2158 return(MagickFalse);
2159 ReplaceImageInList(&wand->images,convolve_image);
2160 return(MagickTrue);
2161}
2162
2163/*
2164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2165% %
2166% %
2167% %
2168% M a g i c k C r o p I m a g e %
2169% %
2170% %
2171% %
2172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2173%
2174% MagickCropImage() extracts a region of the image.
2175%
2176% The format of the MagickCropImage method is:
2177%
2178% MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00002179% const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002180%
2181% A description of each parameter follows:
2182%
2183% o wand: the magick wand.
2184%
2185% o width: the region width.
2186%
2187% o height: the region height.
2188%
2189% o x: the region x-offset.
2190%
2191% o y: the region y-offset.
2192%
2193*/
2194WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00002195 const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002196{
2197 Image
2198 *crop_image;
2199
2200 RectangleInfo
2201 crop;
2202
2203 assert(wand != (MagickWand *) NULL);
2204 assert(wand->signature == WandSignature);
2205 if (wand->debug != MagickFalse)
2206 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2207 if (wand->images == (Image *) NULL)
2208 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2209 crop.width=width;
2210 crop.height=height;
2211 crop.x=x;
2212 crop.y=y;
2213 crop_image=CropImage(wand->images,&crop,wand->exception);
2214 if (crop_image == (Image *) NULL)
2215 return(MagickFalse);
2216 ReplaceImageInList(&wand->images,crop_image);
2217 return(MagickTrue);
2218}
2219
2220/*
2221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2222% %
2223% %
2224% %
2225% M a g i c k C y c l e C o l o r m a p I m a g e %
2226% %
2227% %
2228% %
2229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2230%
2231% MagickCycleColormapImage() displaces an image's colormap by a given number
2232% of positions. If you cycle the colormap a number of times you can produce
2233% a psychodelic effect.
2234%
2235% The format of the MagickCycleColormapImage method is:
2236%
2237% MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002238% const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002239%
2240% A description of each parameter follows:
2241%
2242% o wand: the magick wand.
2243%
2244% o pixel_wand: the pixel wand.
2245%
2246*/
2247WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002248 const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002249{
2250 MagickBooleanType
2251 status;
2252
2253 assert(wand != (MagickWand *) NULL);
2254 assert(wand->signature == WandSignature);
2255 if (wand->debug != MagickFalse)
2256 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2257 if (wand->images == (Image *) NULL)
2258 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2259 status=CycleColormapImage(wand->images,displace);
2260 if (status == MagickFalse)
2261 InheritException(wand->exception,&wand->images->exception);
2262 return(status);
2263}
2264
2265/*
2266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2267% %
2268% %
2269% %
2270% M a g i c k C o n s t i t u t e I m a g e %
2271% %
2272% %
2273% %
2274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2275%
2276% MagickConstituteImage() adds an image to the wand comprised of the pixel
2277% data you supply. The pixel data must be in scanline order top-to-bottom.
2278% The data can be char, short int, int, float, or double. Float and double
2279% require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2280% is the maximum value the type can accomodate (e.g. 255 for char). For
2281% example, to create a 640x480 image from unsigned red-green-blue character
2282% data, use
2283%
2284% MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2285%
2286% The format of the MagickConstituteImage method is:
2287%
2288% MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002289% const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002290% const StorageType storage,void *pixels)
2291%
2292% A description of each parameter follows:
2293%
2294% o wand: the magick wand.
2295%
2296% o columns: width in pixels of the image.
2297%
2298% o rows: height in pixels of the image.
2299%
2300% o map: This string reflects the expected ordering of the pixel array.
2301% It can be any combination or order of R = red, G = green, B = blue,
2302% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2303% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2304% P = pad.
2305%
2306% o storage: Define the data type of the pixels. Float and double types are
2307% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2308% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2309% LongPixel, QuantumPixel, or ShortPixel.
2310%
2311% o pixels: This array of values contain the pixel components as defined by
2312% map and type. You must preallocate this array where the expected
2313% length varies depending on the values of width, height, map, and type.
2314%
2315%
2316*/
2317WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002318 const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002319 const StorageType storage,const void *pixels)
2320{
2321 Image
2322 *images;
2323
2324 assert(wand != (MagickWand *) NULL);
2325 assert(wand->signature == WandSignature);
2326 if (wand->debug != MagickFalse)
2327 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2328 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2329 if (images == (Image *) NULL)
2330 return(MagickFalse);
2331 return(InsertImageInWand(wand,images));
2332}
2333
2334/*
2335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2336% %
2337% %
2338% %
2339% M a g i c k D e c i p h e r I m a g e %
2340% %
2341% %
2342% %
2343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2344%
2345% MagickDecipherImage() converts cipher pixels to plain pixels.
2346%
2347% The format of the MagickDecipherImage method is:
2348%
2349% MagickBooleanType MagickDecipherImage(MagickWand *wand,
2350% const char *passphrase)
2351%
2352% A description of each parameter follows:
2353%
2354% o wand: the magick wand.
2355%
2356% o passphrase: the passphrase.
2357%
2358*/
2359WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2360 const char *passphrase)
2361{
2362 assert(wand != (MagickWand *) NULL);
2363 assert(wand->signature == WandSignature);
2364 if (wand->debug != MagickFalse)
2365 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2366 if (wand->images == (Image *) NULL)
2367 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2368 return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2369}
2370
2371/*
2372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2373% %
2374% %
2375% %
2376% M a g i c k D e c o n s t r u c t I m a g e s %
2377% %
2378% %
2379% %
2380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2381%
2382% MagickDeconstructImages() compares each image with the next in a sequence
2383% and returns the maximum bounding region of any pixel differences it
2384% discovers.
2385%
2386% The format of the MagickDeconstructImages method is:
2387%
2388% MagickWand *MagickDeconstructImages(MagickWand *wand)
2389%
2390% A description of each parameter follows:
2391%
2392% o wand: the magick wand.
2393%
2394*/
2395WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2396{
2397 Image
2398 *deconstruct_image;
2399
2400 assert(wand != (MagickWand *) NULL);
2401 assert(wand->signature == WandSignature);
2402 if (wand->debug != MagickFalse)
2403 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2404 if (wand->images == (Image *) NULL)
2405 return((MagickWand *) NULL);
2406 deconstruct_image=DeconstructImages(wand->images,wand->exception);
2407 if (deconstruct_image == (Image *) NULL)
2408 return((MagickWand *) NULL);
2409 return(CloneMagickWandFromImages(wand,deconstruct_image));
2410}
2411
2412/*
2413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2414% %
2415% %
2416% %
2417% M a g i c k D e s k e w I m a g e %
2418% %
2419% %
2420% %
2421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2422%
2423% MagickDeskewImage() removes skew from the image. Skew is an artifact that
2424% occurs in scanned images because of the camera being misaligned,
2425% imperfections in the scanning or surface, or simply because the paper was
2426% not placed completely flat when scanned.
2427%
2428% The format of the MagickDeskewImage method is:
2429%
2430% MagickBooleanType MagickDeskewImage(MagickWand *wand,
2431% const double threshold)
2432%
2433% A description of each parameter follows:
2434%
2435% o wand: the magick wand.
2436%
2437% o threshold: separate background from foreground.
2438%
2439*/
2440WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2441 const double threshold)
2442{
2443 Image
2444 *sepia_image;
2445
2446 assert(wand != (MagickWand *) NULL);
2447 assert(wand->signature == WandSignature);
2448 if (wand->debug != MagickFalse)
2449 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2450 if (wand->images == (Image *) NULL)
2451 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2452 sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2453 if (sepia_image == (Image *) NULL)
2454 return(MagickFalse);
2455 ReplaceImageInList(&wand->images,sepia_image);
2456 return(MagickTrue);
2457}
2458
2459/*
2460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2461% %
2462% %
2463% %
2464% M a g i c k D e s p e c k l e I m a g e %
2465% %
2466% %
2467% %
2468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2469%
2470% MagickDespeckleImage() reduces the speckle noise in an image while
2471% perserving the edges of the original image.
2472%
2473% The format of the MagickDespeckleImage method is:
2474%
2475% MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2476%
2477% A description of each parameter follows:
2478%
2479% o wand: the magick wand.
2480%
2481*/
2482WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2483{
2484 Image
2485 *despeckle_image;
2486
2487 assert(wand != (MagickWand *) NULL);
2488 assert(wand->signature == WandSignature);
2489 if (wand->debug != MagickFalse)
2490 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2491 if (wand->images == (Image *) NULL)
2492 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2493 despeckle_image=DespeckleImage(wand->images,wand->exception);
2494 if (despeckle_image == (Image *) NULL)
2495 return(MagickFalse);
2496 ReplaceImageInList(&wand->images,despeckle_image);
2497 return(MagickTrue);
2498}
2499
2500/*
2501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2502% %
2503% %
2504% %
2505% M a g i c k D e s t r o y I m a g e %
2506% %
2507% %
2508% %
2509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2510%
2511% MagickDestroyImage() dereferences an image, deallocating memory associated
2512% with the image if the reference count becomes zero.
2513%
2514% The format of the MagickDestroyImage method is:
2515%
2516% Image *MagickDestroyImage(Image *image)
2517%
2518% A description of each parameter follows:
2519%
2520% o image: the image.
2521%
2522*/
2523WandExport Image *MagickDestroyImage(Image *image)
2524{
2525 return(DestroyImage(image));
2526}
2527
2528/*
2529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2530% %
2531% %
2532% %
2533% M a g i c k D i s p l a y I m a g e %
2534% %
2535% %
2536% %
2537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2538%
2539% MagickDisplayImage() displays an image.
2540%
2541% The format of the MagickDisplayImage method is:
2542%
2543% MagickBooleanType MagickDisplayImage(MagickWand *wand,
2544% const char *server_name)
2545%
2546% A description of each parameter follows:
2547%
2548% o wand: the magick wand.
2549%
2550% o server_name: the X server name.
2551%
2552*/
2553WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2554 const char *server_name)
2555{
2556 Image
2557 *image;
2558
2559 MagickBooleanType
2560 status;
2561
2562 assert(wand != (MagickWand *) NULL);
2563 assert(wand->signature == WandSignature);
2564 if (wand->debug != MagickFalse)
2565 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2566 if (wand->images == (Image *) NULL)
2567 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2568 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2569 if (image == (Image *) NULL)
2570 return(MagickFalse);
2571 (void) CloneString(&wand->image_info->server_name,server_name);
2572 status=DisplayImages(wand->image_info,image);
2573 if (status == MagickFalse)
2574 InheritException(wand->exception,&image->exception);
2575 image=DestroyImage(image);
2576 return(status);
2577}
2578
2579/*
2580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2581% %
2582% %
2583% %
2584% M a g i c k D i s p l a y I m a g e s %
2585% %
2586% %
2587% %
2588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2589%
2590% MagickDisplayImages() displays an image or image sequence.
2591%
2592% The format of the MagickDisplayImages method is:
2593%
2594% MagickBooleanType MagickDisplayImages(MagickWand *wand,
2595% const char *server_name)
2596%
2597% A description of each parameter follows:
2598%
2599% o wand: the magick wand.
2600%
2601% o server_name: the X server name.
2602%
2603*/
2604WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2605 const char *server_name)
2606{
2607 MagickBooleanType
2608 status;
2609
2610 assert(wand != (MagickWand *) NULL);
2611 assert(wand->signature == WandSignature);
2612 if (wand->debug != MagickFalse)
2613 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2614 (void) CloneString(&wand->image_info->server_name,server_name);
2615 status=DisplayImages(wand->image_info,wand->images);
2616 if (status == MagickFalse)
2617 InheritException(wand->exception,&wand->images->exception);
2618 return(status);
2619}
2620
2621/*
2622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2623% %
2624% %
2625% %
2626% M a g i c k D i s t o r t I m a g e %
2627% %
2628% %
2629% %
2630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2631%
2632% MagickDistortImage() distorts an image using various distortion methods, by
2633% mapping color lookups of the source image to a new destination image
2634% usally of the same size as the source image, unless 'bestfit' is set to
2635% true.
2636%
2637% If 'bestfit' is enabled, and distortion allows it, the destination image is
2638% adjusted to ensure the whole source 'image' will just fit within the final
2639% destination image, which will be sized and offset accordingly. Also in
2640% many cases the virtual offset of the source image will be taken into
2641% account in the mapping.
2642%
2643% The format of the MagickDistortImage method is:
2644%
2645% MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002646% const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002647% const double *arguments,const MagickBooleanType bestfit)
2648%
2649% A description of each parameter follows:
2650%
2651% o image: the image to be distorted.
2652%
2653% o method: the method of image distortion.
2654%
2655% ArcDistortion always ignores the source image offset, and always
2656% 'bestfit' the destination image with the top left corner offset
2657% relative to the polar mapping center.
2658%
2659% Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2660% style of image distortion.
2661%
2662% Affine, Perspective, and Bilinear, do least squares fitting of the
2663% distortion when more than the minimum number of control point pairs
2664% are provided.
2665%
2666% Perspective, and Bilinear, falls back to a Affine distortion when less
2667% that 4 control point pairs are provided. While Affine distortions let
2668% you use any number of control point pairs, that is Zero pairs is a
2669% no-Op (viewport only) distrotion, one pair is a translation and two
2670% pairs of control points do a scale-rotate-translate, without any
2671% shearing.
2672%
2673% o number_arguments: the number of arguments given for this distortion
2674% method.
2675%
2676% o arguments: the arguments for this distortion method.
2677%
2678% o bestfit: Attempt to resize destination to fit distorted source.
2679%
2680*/
2681WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002682 const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002683 const double *arguments,const MagickBooleanType bestfit)
2684{
2685 Image
2686 *distort_image;
2687
2688 assert(wand != (MagickWand *) NULL);
2689 assert(wand->signature == WandSignature);
2690 if (wand->debug != MagickFalse)
2691 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2692 if (wand->images == (Image *) NULL)
2693 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2694 distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2695 bestfit,wand->exception);
2696 if (distort_image == (Image *) NULL)
2697 return(MagickFalse);
2698 ReplaceImageInList(&wand->images,distort_image);
2699 return(MagickTrue);
2700}
2701
2702/*
2703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2704% %
2705% %
2706% %
2707% M a g i c k D r a w I m a g e %
2708% %
2709% %
2710% %
2711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2712%
2713% MagickDrawImage() renders the drawing wand on the current image.
2714%
2715% The format of the MagickDrawImage method is:
2716%
2717% MagickBooleanType MagickDrawImage(MagickWand *wand,
2718% const DrawingWand *drawing_wand)
2719%
2720% A description of each parameter follows:
2721%
2722% o wand: the magick wand.
2723%
2724% o drawing_wand: the draw wand.
2725%
2726*/
2727WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2728 const DrawingWand *drawing_wand)
2729{
2730 char
2731 *primitive;
2732
2733 DrawInfo
2734 *draw_info;
2735
2736 MagickBooleanType
2737 status;
2738
2739 assert(wand != (MagickWand *) NULL);
2740 assert(wand->signature == WandSignature);
2741 if (wand->debug != MagickFalse)
2742 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2743 if (wand->images == (Image *) NULL)
2744 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2745 draw_info=PeekDrawingWand(drawing_wand);
2746 if ((draw_info == (DrawInfo *) NULL) ||
2747 (draw_info->primitive == (char *) NULL))
2748 return(MagickFalse);
2749 primitive=AcquireString(draw_info->primitive);
2750 draw_info=DestroyDrawInfo(draw_info);
2751 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2752 draw_info->primitive=primitive;
2753 status=DrawImage(wand->images,draw_info);
2754 if (status == MagickFalse)
2755 InheritException(wand->exception,&wand->images->exception);
2756 draw_info=DestroyDrawInfo(draw_info);
2757 return(status);
2758}
2759
2760/*
2761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2762% %
2763% %
2764% %
2765% M a g i c k E d g e I m a g e %
2766% %
2767% %
2768% %
2769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2770%
2771% MagickEdgeImage() enhance edges within the image with a convolution filter
2772% of the given radius. Use a radius of 0 and Edge() selects a suitable
2773% radius for you.
2774%
2775% The format of the MagickEdgeImage method is:
2776%
2777% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2778%
2779% A description of each parameter follows:
2780%
2781% o wand: the magick wand.
2782%
2783% o radius: the radius of the pixel neighborhood.
2784%
2785*/
2786WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2787 const double radius)
2788{
2789 Image
2790 *edge_image;
2791
2792 assert(wand != (MagickWand *) NULL);
2793 assert(wand->signature == WandSignature);
2794 if (wand->debug != MagickFalse)
2795 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2796 if (wand->images == (Image *) NULL)
2797 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2798 edge_image=EdgeImage(wand->images,radius,wand->exception);
2799 if (edge_image == (Image *) NULL)
2800 return(MagickFalse);
2801 ReplaceImageInList(&wand->images,edge_image);
2802 return(MagickTrue);
2803}
2804
2805/*
2806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2807% %
2808% %
2809% %
2810% M a g i c k E m b o s s I m a g e %
2811% %
2812% %
2813% %
2814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2815%
2816% MagickEmbossImage() returns a grayscale image with a three-dimensional
2817% effect. We convolve the image with a Gaussian operator of the given radius
2818% and standard deviation (sigma). For reasonable results, radius should be
2819% larger than sigma. Use a radius of 0 and Emboss() selects a suitable
2820% radius for you.
2821%
2822% The format of the MagickEmbossImage method is:
2823%
2824% MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2825% const double sigma)
2826%
2827% A description of each parameter follows:
2828%
2829% o wand: the magick wand.
2830%
2831% o radius: the radius of the Gaussian, in pixels, not counting the center
2832% pixel.
2833%
2834% o sigma: the standard deviation of the Gaussian, in pixels.
2835%
2836*/
2837WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2838 const double radius,const double sigma)
2839{
2840 Image
2841 *emboss_image;
2842
2843 assert(wand != (MagickWand *) NULL);
2844 assert(wand->signature == WandSignature);
2845 if (wand->debug != MagickFalse)
2846 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2847 if (wand->images == (Image *) NULL)
2848 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2849 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2850 if (emboss_image == (Image *) NULL)
2851 return(MagickFalse);
2852 ReplaceImageInList(&wand->images,emboss_image);
2853 return(MagickTrue);
2854}
2855
2856/*
2857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2858% %
2859% %
2860% %
2861% M a g i c k E n c i p h e r I m a g e %
2862% %
2863% %
2864% %
2865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2866%
2867% MagickEncipherImage() converts plaint pixels to cipher pixels.
2868%
2869% The format of the MagickEncipherImage method is:
2870%
2871% MagickBooleanType MagickEncipherImage(MagickWand *wand,
2872% const char *passphrase)
2873%
2874% A description of each parameter follows:
2875%
2876% o wand: the magick wand.
2877%
2878% o passphrase: the passphrase.
2879%
2880*/
2881WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2882 const char *passphrase)
2883{
2884 assert(wand != (MagickWand *) NULL);
2885 assert(wand->signature == WandSignature);
2886 if (wand->debug != MagickFalse)
2887 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2888 if (wand->images == (Image *) NULL)
2889 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2890 return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2891}
2892
2893/*
2894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2895% %
2896% %
2897% %
2898% M a g i c k E n h a n c e I m a g e %
2899% %
2900% %
2901% %
2902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2903%
2904% MagickEnhanceImage() applies a digital filter that improves the quality of a
2905% noisy image.
2906%
2907% The format of the MagickEnhanceImage method is:
2908%
2909% MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2910%
2911% A description of each parameter follows:
2912%
2913% o wand: the magick wand.
2914%
2915*/
2916WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2917{
2918 Image
2919 *enhance_image;
2920
2921 assert(wand != (MagickWand *) NULL);
2922 assert(wand->signature == WandSignature);
2923 if (wand->debug != MagickFalse)
2924 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2925 if (wand->images == (Image *) NULL)
2926 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2927 enhance_image=EnhanceImage(wand->images,wand->exception);
2928 if (enhance_image == (Image *) NULL)
2929 return(MagickFalse);
2930 ReplaceImageInList(&wand->images,enhance_image);
2931 return(MagickTrue);
2932}
2933
2934/*
2935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2936% %
2937% %
2938% %
2939% M a g i c k E q u a l i z e I m a g e %
2940% %
2941% %
2942% %
2943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2944%
2945% MagickEqualizeImage() equalizes the image histogram.
2946%
2947% The format of the MagickEqualizeImage method is:
2948%
2949% MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2950% MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2951% const ChannelType channel)
2952%
2953% A description of each parameter follows:
2954%
2955% o wand: the magick wand.
2956%
2957% o channel: the image channel(s).
2958%
2959*/
2960
2961WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2962{
2963 MagickBooleanType
2964 status;
2965
2966 status=MagickEqualizeImageChannel(wand,DefaultChannels);
2967 return(status);
2968}
2969
2970WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2971 const ChannelType channel)
2972{
2973 MagickBooleanType
2974 status;
2975
2976 assert(wand != (MagickWand *) NULL);
2977 assert(wand->signature == WandSignature);
2978 if (wand->debug != MagickFalse)
2979 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2980 if (wand->images == (Image *) NULL)
2981 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2982 status=EqualizeImageChannel(wand->images,channel);
2983 if (status == MagickFalse)
2984 InheritException(wand->exception,&wand->images->exception);
2985 return(status);
2986}
2987
2988/*
2989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2990% %
2991% %
2992% %
2993% M a g i c k E v a l u a t e I m a g e %
2994% %
2995% %
2996% %
2997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2998%
2999% MagickEvaluateImage() applys an arithmetic, relational, or logical
3000% expression to an image. Use these operators to lighten or darken an image,
3001% to increase or decrease contrast in an image, or to produce the "negative"
3002% of an image.
3003%
3004% The format of the MagickEvaluateImage method is:
3005%
3006% MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3007% const MagickEvaluateOperator operator,const double value)
cristyd18ae7c2010-03-07 17:39:52 +00003008% MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3009% const MagickEvaluateOperator operator)
cristy3ed852e2009-09-05 21:47:34 +00003010% MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3011% const ChannelType channel,const MagickEvaluateOperator op,
3012% const double value)
3013%
3014% A description of each parameter follows:
3015%
3016% o wand: the magick wand.
3017%
3018% o channel: the channel(s).
3019%
3020% o op: A channel operator.
3021%
3022% o value: A value value.
3023%
3024*/
3025
3026WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3027 const MagickEvaluateOperator op,const double value)
3028{
3029 MagickBooleanType
3030 status;
3031
3032 assert(wand != (MagickWand *) NULL);
3033 assert(wand->signature == WandSignature);
3034 if (wand->debug != MagickFalse)
3035 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3036 if (wand->images == (Image *) NULL)
3037 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3038 status=EvaluateImage(wand->images,op,value,&wand->images->exception);
3039 if (status == MagickFalse)
3040 InheritException(wand->exception,&wand->images->exception);
3041 return(status);
3042}
3043
cristyd18ae7c2010-03-07 17:39:52 +00003044WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3045 const MagickEvaluateOperator op)
3046{
3047 Image
3048 *evaluate_image;
3049
3050 assert(wand != (MagickWand *) NULL);
3051 assert(wand->signature == WandSignature);
3052 if (wand->debug != MagickFalse)
3053 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3054 if (wand->images == (Image *) NULL)
3055 return((MagickWand *) NULL);
3056 evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3057 if (evaluate_image == (Image *) NULL)
3058 return((MagickWand *) NULL);
3059 return(CloneMagickWandFromImages(wand,evaluate_image));
3060}
3061
cristy3ed852e2009-09-05 21:47:34 +00003062WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3063 const ChannelType channel,const MagickEvaluateOperator op,const double value)
3064{
3065 MagickBooleanType
3066 status;
3067
3068 assert(wand != (MagickWand *) NULL);
3069 assert(wand->signature == WandSignature);
3070 if (wand->debug != MagickFalse)
3071 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3072 if (wand->images == (Image *) NULL)
3073 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3074 status=EvaluateImageChannel(wand->images,channel,op,value,
3075 &wand->images->exception);
3076 return(status);
3077}
3078
3079/*
3080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3081% %
3082% %
3083% %
3084% M a g i c k E x p o r t I m a g e P i x e l s %
3085% %
3086% %
3087% %
3088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3089%
3090% MagickExportImagePixels() extracts pixel data from an image and returns it
3091% to you. The method returns MagickTrue on success otherwise MagickFalse if
3092% an error is encountered. The data is returned as char, short int, int,
cristybb503372010-05-27 20:51:26 +00003093% ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00003094%
3095% Suppose you want to extract the first scanline of a 640x480 image as
3096% character data in red-green-blue order:
3097%
3098% MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3099%
3100% The format of the MagickExportImagePixels method is:
3101%
3102% MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003103% const ssize_t x,const ssize_t y,const size_t columns,
3104% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00003105% void *pixels)
3106%
3107% A description of each parameter follows:
3108%
3109% o wand: the magick wand.
3110%
3111% o x, y, columns, rows: These values define the perimeter
3112% of a region of pixels you want to extract.
3113%
3114% o map: This string reflects the expected ordering of the pixel array.
3115% It can be any combination or order of R = red, G = green, B = blue,
3116% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3117% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3118% P = pad.
3119%
3120% o storage: Define the data type of the pixels. Float and double types are
3121% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3122% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3123% LongPixel, QuantumPixel, or ShortPixel.
3124%
3125% o pixels: This array of values contain the pixel components as defined by
3126% map and type. You must preallocate this array where the expected
3127% length varies depending on the values of width, height, map, and type.
3128%
3129*/
3130WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003131 const ssize_t x,const ssize_t y,const size_t columns,
3132 const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00003133 void *pixels)
3134{
3135 MagickBooleanType
3136 status;
3137
3138 assert(wand != (MagickWand *) NULL);
3139 assert(wand->signature == WandSignature);
3140 if (wand->debug != MagickFalse)
3141 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3142 if (wand->images == (Image *) NULL)
3143 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3144 status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3145 storage,pixels,wand->exception);
3146 if (status == MagickFalse)
3147 InheritException(wand->exception,&wand->images->exception);
3148 return(status);
3149}
3150
3151/*
3152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3153% %
3154% %
3155% %
3156% M a g i c k E x t e n t I m a g e %
3157% %
3158% %
3159% %
3160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3161%
3162% MagickExtentImage() extends the image as defined by the geometry, gravity,
3163% and wand background color. Set the (x,y) offset of the geometry to move
3164% the original wand relative to the extended wand.
3165%
3166% The format of the MagickExtentImage method is:
3167%
3168% MagickBooleanType MagickExtentImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003169% const size_t width,const size_t height,const ssize_t x,
3170% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00003171%
3172% A description of each parameter follows:
3173%
3174% o wand: the magick wand.
3175%
3176% o width: the region width.
3177%
3178% o height: the region height.
3179%
3180% o x: the region x offset.
3181%
3182% o y: the region y offset.
3183%
3184*/
3185WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003186 const size_t width,const size_t height,const ssize_t x,
3187 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00003188{
3189 Image
3190 *extent_image;
3191
3192 RectangleInfo
3193 extent;
3194
3195 assert(wand != (MagickWand *) NULL);
3196 assert(wand->signature == WandSignature);
3197 if (wand->debug != MagickFalse)
3198 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3199 if (wand->images == (Image *) NULL)
3200 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3201 extent.width=width;
3202 extent.height=height;
3203 extent.x=x;
3204 extent.y=y;
3205 extent_image=ExtentImage(wand->images,&extent,wand->exception);
3206 if (extent_image == (Image *) NULL)
3207 return(MagickFalse);
3208 ReplaceImageInList(&wand->images,extent_image);
3209 return(MagickTrue);
3210}
3211
3212/*
3213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3214% %
3215% %
3216% %
cristya7a3ef92010-01-06 18:50:42 +00003217% M a g i c k F i l t e r I m a g e %
3218% %
3219% %
3220% %
3221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3222%
3223% MagickFilterImage() applies a custom convolution kernel to the image.
3224%
3225% The format of the MagickFilterImage method is:
3226%
3227% MagickBooleanType MagickFilterImage(MagickWand *wand,
cristy2be15382010-01-21 02:38:03 +00003228% const KernelInfo *kernel)
cristya7a3ef92010-01-06 18:50:42 +00003229% MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
cristy2be15382010-01-21 02:38:03 +00003230% const ChannelType channel,const KernelInfo *kernel)
cristya7a3ef92010-01-06 18:50:42 +00003231%
3232% A description of each parameter follows:
3233%
3234% o wand: the magick wand.
3235%
3236% o channel: the image channel(s).
3237%
3238% o kernel: An array of doubles representing the convolution kernel.
3239%
3240*/
3241
3242WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
cristy2be15382010-01-21 02:38:03 +00003243 const KernelInfo *kernel)
cristya7a3ef92010-01-06 18:50:42 +00003244{
3245 MagickBooleanType
3246 status;
3247
3248 status=MagickFilterImageChannel(wand,DefaultChannels,kernel);
3249 return(status);
3250}
3251
3252WandExport MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
cristy2be15382010-01-21 02:38:03 +00003253 const ChannelType channel,const KernelInfo *kernel)
cristya7a3ef92010-01-06 18:50:42 +00003254{
3255 Image
3256 *filter_image;
3257
3258 assert(wand != (MagickWand *) NULL);
3259 assert(wand->signature == WandSignature);
3260 if (wand->debug != MagickFalse)
3261 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy2be15382010-01-21 02:38:03 +00003262 if (kernel == (const KernelInfo *) NULL)
cristya7a3ef92010-01-06 18:50:42 +00003263 return(MagickFalse);
3264 if (wand->images == (Image *) NULL)
3265 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3266 filter_image=FilterImageChannel(wand->images,channel,kernel,wand->exception);
3267 if (filter_image == (Image *) NULL)
3268 return(MagickFalse);
3269 ReplaceImageInList(&wand->images,filter_image);
3270 return(MagickTrue);
3271}
3272
3273/*
3274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3275% %
3276% %
3277% %
cristy3ed852e2009-09-05 21:47:34 +00003278% M a g i c k F l i p I m a g e %
3279% %
3280% %
3281% %
3282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3283%
3284% MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3285% around the central x-axis.
3286%
3287% The format of the MagickFlipImage method is:
3288%
3289% MagickBooleanType MagickFlipImage(MagickWand *wand)
3290%
3291% A description of each parameter follows:
3292%
3293% o wand: the magick wand.
3294%
3295*/
3296WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3297{
3298 Image
3299 *flip_image;
3300
3301 assert(wand != (MagickWand *) NULL);
3302 assert(wand->signature == WandSignature);
3303 if (wand->debug != MagickFalse)
3304 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3305 if (wand->images == (Image *) NULL)
3306 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3307 flip_image=FlipImage(wand->images,wand->exception);
3308 if (flip_image == (Image *) NULL)
3309 return(MagickFalse);
3310 ReplaceImageInList(&wand->images,flip_image);
3311 return(MagickTrue);
3312}
3313
3314/*
3315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3316% %
3317% %
3318% %
3319% 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 %
3320% %
3321% %
3322% %
3323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3324%
3325% MagickFloodfillPaintImage() changes the color value of any pixel that matches
3326% target and is an immediate neighbor. If the method FillToBorderMethod is
3327% specified, the color value is changed for any neighbor pixel that does not
3328% match the bordercolor member of image.
3329%
3330% The format of the MagickFloodfillPaintImage method is:
3331%
3332% MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3333% const ChannelType channel,const PixelWand *fill,const double fuzz,
cristybb503372010-05-27 20:51:26 +00003334% const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
cristy3ed852e2009-09-05 21:47:34 +00003335% const MagickBooleanType invert)
3336%
3337% A description of each parameter follows:
3338%
3339% o wand: the magick wand.
3340%
3341% o channel: the channel(s).
3342%
3343% o fill: the floodfill color pixel wand.
3344%
3345% o fuzz: By default target must match a particular pixel color
3346% exactly. However, in many cases two colors may differ by a small amount.
3347% The fuzz member of image defines how much tolerance is acceptable to
3348% consider two colors as the same. For example, set fuzz to 10 and the
3349% color red at intensities of 100 and 102 respectively are now interpreted
3350% as the same color for the purposes of the floodfill.
3351%
3352% o bordercolor: the border color pixel wand.
3353%
3354% o x,y: the starting location of the operation.
3355%
3356% o invert: paint any pixel that does not match the target color.
3357%
3358*/
3359WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3360 const ChannelType channel,const PixelWand *fill,const double fuzz,
cristybb503372010-05-27 20:51:26 +00003361 const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
cristy3ed852e2009-09-05 21:47:34 +00003362 const MagickBooleanType invert)
3363{
3364 DrawInfo
3365 *draw_info;
3366
3367 MagickBooleanType
3368 status;
3369
3370 MagickPixelPacket
3371 target;
3372
3373 assert(wand != (MagickWand *) NULL);
3374 assert(wand->signature == WandSignature);
3375 if (wand->debug != MagickFalse)
3376 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3377 if (wand->images == (Image *) NULL)
3378 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3379 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3380 PixelGetQuantumColor(fill,&draw_info->fill);
3381 (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3382 y % wand->images->rows,&target,wand->exception);
3383 if (bordercolor != (PixelWand *) NULL)
3384 PixelGetMagickColor(bordercolor,&target);
3385 wand->images->fuzz=fuzz;
3386 status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
3387 invert);
3388 if (status == MagickFalse)
3389 InheritException(wand->exception,&wand->images->exception);
3390 draw_info=DestroyDrawInfo(draw_info);
3391 return(status);
3392}
3393
3394/*
3395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3396% %
3397% %
3398% %
3399% M a g i c k F l o p I m a g e %
3400% %
3401% %
3402% %
3403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3404%
3405% MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3406% around the central y-axis.
3407%
3408% The format of the MagickFlopImage method is:
3409%
3410% MagickBooleanType MagickFlopImage(MagickWand *wand)
3411%
3412% A description of each parameter follows:
3413%
3414% o wand: the magick wand.
3415%
3416*/
3417WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3418{
3419 Image
3420 *flop_image;
3421
3422 assert(wand != (MagickWand *) NULL);
3423 assert(wand->signature == WandSignature);
3424 if (wand->debug != MagickFalse)
3425 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3426 if (wand->images == (Image *) NULL)
3427 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3428 flop_image=FlopImage(wand->images,wand->exception);
3429 if (flop_image == (Image *) NULL)
3430 return(MagickFalse);
3431 ReplaceImageInList(&wand->images,flop_image);
3432 return(MagickTrue);
3433}
3434
3435/*
3436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3437% %
3438% %
3439% %
3440% 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 %
3441% %
3442% %
3443% %
3444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3445%
3446% MagickForwardFourierTransformImage() implements the discrete Fourier
3447% transform (DFT) of the image either as a magnitude / phase or real /
3448% imaginary image pair.
3449%
3450% The format of the MagickForwardFourierTransformImage method is:
3451%
3452% MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3453% const MagickBooleanType magnitude)
3454%
3455% A description of each parameter follows:
3456%
3457% o wand: the magick wand.
3458%
3459% o magnitude: if true, return as magnitude / phase pair otherwise a real /
3460% imaginary image pair.
3461%
3462*/
3463WandExport MagickBooleanType MagickForwardFourierTransformImage(
3464 MagickWand *wand,const MagickBooleanType magnitude)
3465{
3466 Image
3467 *forward_image;
3468
3469 assert(wand != (MagickWand *) NULL);
3470 assert(wand->signature == WandSignature);
3471 if (wand->debug != MagickFalse)
3472 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3473 if (wand->images == (Image *) NULL)
3474 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3475 forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3476 wand->exception);
3477 if (forward_image == (Image *) NULL)
3478 return(MagickFalse);
3479 ReplaceImageInList(&wand->images,forward_image);
3480 return(MagickTrue);
3481}
3482
3483/*
3484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3485% %
3486% %
3487% %
3488% M a g i c k F r a m e I m a g e %
3489% %
3490% %
3491% %
3492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3493%
3494% MagickFrameImage() adds a simulated three-dimensional border around the
3495% image. The width and height specify the border width of the vertical and
3496% horizontal sides of the frame. The inner and outer bevels indicate the
3497% width of the inner and outer shadows of the frame.
3498%
3499% The format of the MagickFrameImage method is:
3500%
3501% MagickBooleanType MagickFrameImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003502% const PixelWand *matte_color,const size_t width,
3503% const size_t height,const ssize_t inner_bevel,
3504% const ssize_t outer_bevel)
cristy3ed852e2009-09-05 21:47:34 +00003505%
3506% A description of each parameter follows:
3507%
3508% o wand: the magick wand.
3509%
3510% o matte_color: the frame color pixel wand.
3511%
3512% o width: the border width.
3513%
3514% o height: the border height.
3515%
3516% o inner_bevel: the inner bevel width.
3517%
3518% o outer_bevel: the outer bevel width.
3519%
3520*/
3521WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003522 const PixelWand *matte_color,const size_t width,
3523 const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
cristy3ed852e2009-09-05 21:47:34 +00003524{
3525 Image
3526 *frame_image;
3527
3528 FrameInfo
3529 frame_info;
3530
3531 assert(wand != (MagickWand *) NULL);
3532 assert(wand->signature == WandSignature);
3533 if (wand->debug != MagickFalse)
3534 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3535 if (wand->images == (Image *) NULL)
3536 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3537 (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3538 frame_info.width=wand->images->columns+2*width;
3539 frame_info.height=wand->images->rows+2*height;
cristybb503372010-05-27 20:51:26 +00003540 frame_info.x=(ssize_t) width;
3541 frame_info.y=(ssize_t) height;
cristy3ed852e2009-09-05 21:47:34 +00003542 frame_info.inner_bevel=inner_bevel;
3543 frame_info.outer_bevel=outer_bevel;
3544 PixelGetQuantumColor(matte_color,&wand->images->matte_color);
3545 frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3546 if (frame_image == (Image *) NULL)
3547 return(MagickFalse);
3548 ReplaceImageInList(&wand->images,frame_image);
3549 return(MagickTrue);
3550}
3551
3552/*
3553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3554% %
3555% %
3556% %
3557% M a g i c k F u n c t i o n I m a g e %
3558% %
3559% %
3560% %
3561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3562%
3563% MagickFunctionImage() applys an arithmetic, relational, or logical
3564% expression to an image. Use these operators to lighten or darken an image,
3565% to increase or decrease contrast in an image, or to produce the "negative"
3566% of an image.
3567%
3568% The format of the MagickFunctionImage method is:
3569%
3570% MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003571% const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003572% const double *arguments)
3573% MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3574% const ChannelType channel,const MagickFunction function,
cristybb503372010-05-27 20:51:26 +00003575% const size_t number_arguments,const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +00003576%
3577% A description of each parameter follows:
3578%
3579% o wand: the magick wand.
3580%
3581% o channel: the channel(s).
3582%
3583% o function: the image function.
3584%
3585% o number_arguments: the number of function arguments.
3586%
3587% o arguments: the function arguments.
3588%
3589*/
3590
3591WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003592 const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003593 const double *arguments)
3594{
3595 MagickBooleanType
3596 status;
3597
3598 assert(wand != (MagickWand *) NULL);
3599 assert(wand->signature == WandSignature);
3600 if (wand->debug != MagickFalse)
3601 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3602 if (wand->images == (Image *) NULL)
3603 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3604 status=FunctionImage(wand->images,function,number_arguments,arguments,
3605 &wand->images->exception);
3606 if (status == MagickFalse)
3607 InheritException(wand->exception,&wand->images->exception);
3608 return(status);
3609}
3610
3611WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3612 const ChannelType channel,const MagickFunction function,
cristybb503372010-05-27 20:51:26 +00003613 const size_t number_arguments,const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +00003614{
3615 MagickBooleanType
3616 status;
3617
3618 assert(wand != (MagickWand *) NULL);
3619 assert(wand->signature == WandSignature);
3620 if (wand->debug != MagickFalse)
3621 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3622 if (wand->images == (Image *) NULL)
3623 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3624 status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3625 arguments,&wand->images->exception);
3626 return(status);
3627}
3628
3629/*
3630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3631% %
3632% %
3633% %
3634% M a g i c k F x I m a g e %
3635% %
3636% %
3637% %
3638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3639%
3640% MagickFxImage() evaluate expression for each pixel in the image.
3641%
3642% The format of the MagickFxImage method is:
3643%
3644% MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3645% MagickWand *MagickFxImageChannel(MagickWand *wand,
3646% const ChannelType channel,const char *expression)
3647%
3648% A description of each parameter follows:
3649%
3650% o wand: the magick wand.
3651%
3652% o channel: the image channel(s).
3653%
3654% o expression: the expression.
3655%
3656*/
3657
3658WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3659{
3660 MagickWand
3661 *fx_wand;
3662
3663 fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3664 return(fx_wand);
3665}
3666
3667WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3668 const ChannelType channel,const char *expression)
3669{
3670 Image
3671 *fx_image;
3672
3673 assert(wand != (MagickWand *) NULL);
3674 assert(wand->signature == WandSignature);
3675 if (wand->debug != MagickFalse)
3676 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3677 if (wand->images == (Image *) NULL)
3678 return((MagickWand *) NULL);
3679 fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3680 if (fx_image == (Image *) NULL)
3681 return((MagickWand *) NULL);
3682 return(CloneMagickWandFromImages(wand,fx_image));
3683}
3684
3685/*
3686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3687% %
3688% %
3689% %
3690% M a g i c k G a m m a I m a g e %
3691% %
3692% %
3693% %
3694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3695%
3696% MagickGammaImage() gamma-corrects an image. The same image viewed on
3697% different devices will have perceptual differences in the way the image's
3698% intensities are represented on the screen. Specify individual gamma levels
3699% for the red, green, and blue channels, or adjust all three with the gamma
3700% parameter. Values typically range from 0.8 to 2.3.
3701%
3702% You can also reduce the influence of a particular channel with a gamma
3703% value of 0.
3704%
3705% The format of the MagickGammaImage method is:
3706%
3707% MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3708% MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3709% const ChannelType channel,const double gamma)
3710%
3711% A description of each parameter follows:
3712%
3713% o wand: the magick wand.
3714%
3715% o channel: the channel.
3716%
3717% o level: Define the level of gamma correction.
3718%
3719*/
3720
3721WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3722 const double gamma)
3723{
3724 MagickBooleanType
3725 status;
3726
3727 status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3728 return(status);
3729}
3730
3731WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3732 const ChannelType channel,const double gamma)
3733{
3734 MagickBooleanType
3735 status;
3736
3737 assert(wand != (MagickWand *) NULL);
3738 assert(wand->signature == WandSignature);
3739 if (wand->debug != MagickFalse)
3740 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3741 if (wand->images == (Image *) NULL)
3742 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3743 status=GammaImageChannel(wand->images,channel,gamma);
3744 if (status == MagickFalse)
3745 InheritException(wand->exception,&wand->images->exception);
3746 return(status);
3747}
3748
3749/*
3750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3751% %
3752% %
3753% %
3754% M a g i c k G a u s s i a n B l u r I m a g e %
3755% %
3756% %
3757% %
3758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3759%
3760% MagickGaussianBlurImage() blurs an image. We convolve the image with a
3761% Gaussian operator of the given radius and standard deviation (sigma).
3762% For reasonable results, the radius should be larger than sigma. Use a
3763% radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3764%
3765% The format of the MagickGaussianBlurImage method is:
3766%
3767% MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3768% const double radius,const double sigma)
3769% MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3770% const ChannelType channel,const double radius,const double sigma)
3771%
3772% A description of each parameter follows:
3773%
3774% o wand: the magick wand.
3775%
3776% o channel: the image channel(s).
3777%
3778% o radius: the radius of the Gaussian, in pixels, not counting the center
3779% pixel.
3780%
3781% o sigma: the standard deviation of the Gaussian, in pixels.
3782%
3783*/
3784
3785WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3786 const double radius,const double sigma)
3787{
3788 MagickBooleanType
3789 status;
3790
3791 status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3792 return(status);
3793}
3794
3795WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3796 const ChannelType channel,const double radius,const double sigma)
3797{
3798 Image
3799 *blur_image;
3800
3801 assert(wand != (MagickWand *) NULL);
3802 assert(wand->signature == WandSignature);
3803 if (wand->debug != MagickFalse)
3804 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3805 if (wand->images == (Image *) NULL)
3806 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3807 blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
3808 wand->exception);
3809 if (blur_image == (Image *) NULL)
3810 return(MagickFalse);
3811 ReplaceImageInList(&wand->images,blur_image);
3812 return(MagickTrue);
3813}
3814
3815/*
3816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3817% %
3818% %
3819% %
3820% M a g i c k G e t I m a g e %
3821% %
3822% %
3823% %
3824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3825%
3826% MagickGetImage() gets the image at the current image index.
3827%
3828% The format of the MagickGetImage method is:
3829%
3830% MagickWand *MagickGetImage(MagickWand *wand)
3831%
3832% A description of each parameter follows:
3833%
3834% o wand: the magick wand.
3835%
3836*/
3837WandExport MagickWand *MagickGetImage(MagickWand *wand)
3838{
3839 Image
3840 *image;
3841
3842 assert(wand != (MagickWand *) NULL);
3843 assert(wand->signature == WandSignature);
3844 if (wand->debug != MagickFalse)
3845 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3846 if (wand->images == (Image *) NULL)
3847 {
3848 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3849 "ContainsNoImages","`%s'",wand->name);
3850 return((MagickWand *) NULL);
3851 }
3852 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3853 if (image == (Image *) NULL)
3854 return((MagickWand *) NULL);
3855 return(CloneMagickWandFromImages(wand,image));
3856}
3857
3858/*
3859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3860% %
3861% %
3862% %
3863% 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 %
3864% %
3865% %
3866% %
3867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3868%
3869% MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3870% is not activated. That is, the image is RGB rather than RGBA or CMYK rather
3871% than CMYKA.
3872%
3873% The format of the MagickGetImageAlphaChannel method is:
3874%
cristybb503372010-05-27 20:51:26 +00003875% size_t MagickGetImageAlphaChannel(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003876%
3877% A description of each parameter follows:
3878%
3879% o wand: the magick wand.
3880%
3881*/
3882WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3883{
3884 assert(wand != (MagickWand *) NULL);
3885 assert(wand->signature == WandSignature);
3886 if (wand->debug != MagickFalse)
3887 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3888 if (wand->images == (Image *) NULL)
3889 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3890 return(GetImageAlphaChannel(wand->images));
3891}
3892
3893/*
3894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3895% %
3896% %
3897% %
3898% M a g i c k G e t I m a g e C l i p M a s k %
3899% %
3900% %
3901% %
3902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903%
3904% MagickGetImageClipMask() gets the image clip mask at the current image index.
3905%
3906% The format of the MagickGetImageClipMask method is:
3907%
3908% MagickWand *MagickGetImageClipMask(MagickWand *wand)
3909%
3910% A description of each parameter follows:
3911%
3912% o wand: the magick wand.
3913%
3914*/
3915WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3916{
3917 Image
3918 *image;
3919
3920 assert(wand != (MagickWand *) NULL);
3921 assert(wand->signature == WandSignature);
3922 if (wand->debug != MagickFalse)
3923 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3924 if (wand->images == (Image *) NULL)
3925 {
3926 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3927 "ContainsNoImages","`%s'",wand->name);
3928 return((MagickWand *) NULL);
3929 }
3930 image=GetImageClipMask(wand->images,wand->exception);
3931 if (image == (Image *) NULL)
3932 return((MagickWand *) NULL);
3933 return(CloneMagickWandFromImages(wand,image));
3934}
3935
3936/*
3937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3938% %
3939% %
3940% %
3941% 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 %
3942% %
3943% %
3944% %
3945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3946%
3947% MagickGetImageBackgroundColor() returns the image background color.
3948%
3949% The format of the MagickGetImageBackgroundColor method is:
3950%
3951% MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3952% PixelWand *background_color)
3953%
3954% A description of each parameter follows:
3955%
3956% o wand: the magick wand.
3957%
3958% o background_color: Return the background color.
3959%
3960*/
3961WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3962 PixelWand *background_color)
3963{
3964 assert(wand != (MagickWand *) NULL);
3965 assert(wand->signature == WandSignature);
3966 if (wand->debug != MagickFalse)
3967 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3968 if (wand->images == (Image *) NULL)
3969 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3970 PixelSetQuantumColor(background_color,&wand->images->background_color);
3971 return(MagickTrue);
3972}
3973
3974/*
3975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3976% %
3977% %
3978% %
3979% M a g i c k G e t I m a g e B l o b %
3980% %
3981% %
3982% %
3983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3984%
3985% MagickGetImageBlob() implements direct to memory image formats. It
3986% returns the image as a blob and its length. Use MagickSetFormat() to
3987% set the format of the returned blob (GIF, JPEG, PNG, etc.).
3988%
3989% Use MagickRelinquishMemory() to free the blob when you are done with it.
3990%
3991% The format of the MagickGetImageBlob method is:
3992%
3993% unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3994%
3995% A description of each parameter follows:
3996%
3997% o wand: the magick wand.
3998%
3999% o length: the length of the blob.
4000%
4001*/
4002WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4003{
4004 assert(wand != (MagickWand *) NULL);
4005 assert(wand->signature == WandSignature);
4006 if (wand->debug != MagickFalse)
4007 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4008 if (wand->images == (Image *) NULL)
4009 {
4010 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4011 "ContainsNoImages","`%s'",wand->name);
4012 return((unsigned char *) NULL);
4013 }
4014 return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
4015}
4016
4017/*
4018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4019% %
4020% %
4021% %
4022% M a g i c k G e t I m a g e s B l o b %
4023% %
4024% %
4025% %
4026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4027%
4028% MagickGetImageBlob() implements direct to memory image formats. It
4029% returns the image sequence as a blob and its length. The format of the image
4030% determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
4031% return a different image format, use MagickSetImageFormat().
4032%
4033% Note, some image formats do not permit multiple images to the same image
4034% stream (e.g. JPEG). in this instance, just the first image of the
4035% sequence is returned as a blob.
4036%
4037% The format of the MagickGetImagesBlob method is:
4038%
4039% unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4040%
4041% A description of each parameter follows:
4042%
4043% o wand: the magick wand.
4044%
4045% o length: the length of the blob.
4046%
4047*/
4048WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4049{
4050 unsigned char
4051 *blob;
4052
4053 assert(wand != (MagickWand *) NULL);
4054 assert(wand->signature == WandSignature);
4055 if (wand->debug != MagickFalse)
4056 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4057 if (wand->images == (Image *) NULL)
4058 {
4059 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4060 "ContainsNoImages","`%s'",wand->name);
4061 return((unsigned char *) NULL);
4062 }
4063 blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
4064 wand->exception);
4065 return(blob);
4066}
4067
4068/*
4069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4070% %
4071% %
4072% %
4073% 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 %
4074% %
4075% %
4076% %
4077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4078%
4079% MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4080% image.
4081%
4082% The format of the MagickGetImageBluePrimary method is:
4083%
4084% MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4085% double *y)
4086%
4087% A description of each parameter follows:
4088%
4089% o wand: the magick wand.
4090%
4091% o x: the chromaticity blue primary x-point.
4092%
4093% o y: the chromaticity blue primary y-point.
4094%
4095*/
4096WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4097 double *x,double *y)
4098{
4099 assert(wand != (MagickWand *) NULL);
4100 assert(wand->signature == WandSignature);
4101 if (wand->debug != MagickFalse)
4102 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4103 if (wand->images == (Image *) NULL)
4104 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4105 *x=wand->images->chromaticity.blue_primary.x;
4106 *y=wand->images->chromaticity.blue_primary.y;
4107 return(MagickTrue);
4108}
4109
4110/*
4111%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4112% %
4113% %
4114% %
4115% 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 %
4116% %
4117% %
4118% %
4119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4120%
4121% MagickGetImageBorderColor() returns the image border color.
4122%
4123% The format of the MagickGetImageBorderColor method is:
4124%
4125% MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4126% PixelWand *border_color)
4127%
4128% A description of each parameter follows:
4129%
4130% o wand: the magick wand.
4131%
4132% o border_color: Return the border color.
4133%
4134*/
4135WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4136 PixelWand *border_color)
4137{
4138 assert(wand != (MagickWand *) NULL);
4139 assert(wand->signature == WandSignature);
4140 if (wand->debug != MagickFalse)
4141 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4142 if (wand->images == (Image *) NULL)
4143 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4144 PixelSetQuantumColor(border_color,&wand->images->border_color);
4145 return(MagickTrue);
4146}
4147
4148/*
4149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4150% %
4151% %
4152% %
4153% M a g i c k G e t I m a g e C h a n n e l D e p t h %
4154% %
4155% %
4156% %
4157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4158%
4159% MagickGetImageChannelDepth() gets the depth for one or more image channels.
4160%
4161% The format of the MagickGetImageChannelDepth method is:
4162%
cristybb503372010-05-27 20:51:26 +00004163% size_t MagickGetImageChannelDepth(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00004164% const ChannelType channel)
4165%
4166% A description of each parameter follows:
4167%
4168% o wand: the magick wand.
4169%
4170% o channel: the image channel(s).
4171%
4172*/
cristybb503372010-05-27 20:51:26 +00004173WandExport size_t MagickGetImageChannelDepth(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00004174 const ChannelType channel)
4175{
4176 assert(wand != (MagickWand *) NULL);
4177 assert(wand->signature == WandSignature);
4178 if (wand->debug != MagickFalse)
4179 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4180 if (wand->images == (Image *) NULL)
4181 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4182 return(GetImageChannelDepth(wand->images,channel,wand->exception));
4183}
4184
4185/*
4186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4187% %
4188% %
4189% %
4190% M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n %
4191% %
4192% %
4193% %
4194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4195%
4196% MagickGetImageChannelDistortion() compares one or more image channels of an
4197% image to a reconstructed image and returns the specified distortion metric.
4198%
4199% The format of the MagickGetImageChannelDistortion method is:
4200%
4201% MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4202% const MagickWand *reference,const ChannelType channel,
4203% const MetricType metric,double *distortion)
4204%
4205% A description of each parameter follows:
4206%
4207% o wand: the magick wand.
4208%
4209% o reference: the reference wand.
4210%
4211% o channel: the channel.
4212%
4213% o metric: the metric.
4214%
4215% o distortion: the computed distortion between the images.
4216%
4217*/
4218WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4219 const MagickWand *reference,const ChannelType channel,const MetricType metric,
4220 double *distortion)
4221{
4222 MagickBooleanType
4223 status;
4224
4225 assert(wand != (MagickWand *) NULL);
4226 assert(wand->signature == WandSignature);
4227 if (wand->debug != MagickFalse)
4228 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4229 assert(reference != (MagickWand *) NULL);
4230 assert(reference->signature == WandSignature);
4231 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4232 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4233 status=GetImageChannelDistortion(wand->images,reference->images,channel,
4234 metric,distortion,&wand->images->exception);
4235 return(status);
4236}
4237
4238/*
4239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4240% %
4241% %
4242% %
4243% M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n s %
4244% %
4245% %
4246% %
4247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4248%
4249% MagickGetImageChannelDistortions() compares one or more image channels of an
4250% image to a reconstructed image and returns the specified distortion metrics.
4251%
4252% Use MagickRelinquishMemory() to free the metrics when you are done with them.
4253%
4254% The format of the MagickGetImageChannelDistortion method is:
4255%
4256% double *MagickGetImageChannelDistortion(MagickWand *wand,
4257% const MagickWand *reference,const MetricType metric)
4258%
4259% A description of each parameter follows:
4260%
4261% o wand: the magick wand.
4262%
4263% o reference: the reference wand.
4264%
4265% o metric: the metric.
4266%
4267*/
4268WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4269 const MagickWand *reference,const MetricType metric)
4270{
4271 double
4272 *channel_distortion;
4273
4274 assert(wand != (MagickWand *) NULL);
4275 assert(wand->signature == WandSignature);
4276 if (wand->debug != MagickFalse)
4277 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4278 assert(reference != (MagickWand *) NULL);
4279 assert(reference->signature == WandSignature);
4280 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4281 {
4282 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4283 "ContainsNoImages","`%s'",wand->name);
4284 return((double *) NULL);
4285 }
4286 channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4287 metric,&wand->images->exception);
4288 return(channel_distortion);
4289}
4290
4291/*
4292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4293% %
4294% %
4295% %
cristy549a37e2010-01-26 15:24:15 +00004296% M a g i c k G e t I m a g e C h a n n e l F e a t u r e s %
cristy3ed852e2009-09-05 21:47:34 +00004297% %
4298% %
4299% %
4300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4301%
cristy549a37e2010-01-26 15:24:15 +00004302% MagickGetImageChannelFeatures() returns features for each channel in the
cristy7396d882010-01-27 02:37:56 +00004303% image in each of four directions (horizontal, vertical, left and right
4304% diagonals) for the specified distance. The features include the angular
4305% second moment, contrast, correlation, sum of squares: variance, inverse
4306% difference moment, sum average, sum varience, sum entropy, entropy,
4307% difference variance, difference entropy, information measures of
4308% correlation 1, information measures of correlation 2, and maximum
4309% correlation coefficient. You can access the red channel contrast, for
4310% example, like this:
cristy3ed852e2009-09-05 21:47:34 +00004311%
cristy549a37e2010-01-26 15:24:15 +00004312% channel_features=MagickGetImageChannelFeatures(wand,1);
4313% contrast=channel_features[RedChannel].contrast[0];
cristy3ed852e2009-09-05 21:47:34 +00004314%
cristy549a37e2010-01-26 15:24:15 +00004315% Use MagickRelinquishMemory() to free the statistics buffer.
4316%
4317% The format of the MagickGetImageChannelFeatures method is:
4318%
4319% ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004320% const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00004321%
4322% A description of each parameter follows:
4323%
4324% o wand: the magick wand.
4325%
cristy549a37e2010-01-26 15:24:15 +00004326% o distance: the distance.
cristy3ed852e2009-09-05 21:47:34 +00004327%
4328*/
cristy549a37e2010-01-26 15:24:15 +00004329WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004330 const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00004331{
cristy3ed852e2009-09-05 21:47:34 +00004332 assert(wand != (MagickWand *) NULL);
4333 assert(wand->signature == WandSignature);
4334 if (wand->debug != MagickFalse)
4335 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4336 if (wand->images == (Image *) NULL)
cristy549a37e2010-01-26 15:24:15 +00004337 {
4338 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4339 "ContainsNoImages","`%s'",wand->name);
4340 return((ChannelFeatures *) NULL);
4341 }
4342 return(GetImageChannelFeatures(wand->images,distance,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00004343}
4344
4345/*
4346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4347% %
4348% %
4349% %
4350% M a g i c k G e t I m a g e C h a n n e l K u r t o s i s %
4351% %
4352% %
4353% %
4354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4355%
4356% MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4357% more image channels.
4358%
4359% The format of the MagickGetImageChannelKurtosis method is:
4360%
4361% MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4362% const ChannelType channel,double *kurtosis,double *skewness)
4363%
4364% A description of each parameter follows:
4365%
4366% o wand: the magick wand.
4367%
4368% o channel: the image channel(s).
4369%
4370% o kurtosis: The kurtosis for the specified channel(s).
4371%
4372% o skewness: The skewness for the specified channel(s).
4373%
4374*/
4375WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4376 const ChannelType channel,double *kurtosis,double *skewness)
4377{
4378 MagickBooleanType
4379 status;
4380
4381 assert(wand != (MagickWand *) NULL);
4382 assert(wand->signature == WandSignature);
4383 if (wand->debug != MagickFalse)
4384 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4385 if (wand->images == (Image *) NULL)
4386 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4387 status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4388 wand->exception);
4389 return(status);
4390}
cristy549a37e2010-01-26 15:24:15 +00004391
4392/*
4393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4394% %
4395% %
4396% %
4397% M a g i c k G e t I m a g e C h a n n e l M e a n %
4398% %
4399% %
4400% %
4401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4402%
4403% MagickGetImageChannelMean() gets the mean and standard deviation of one or
4404% more image channels.
4405%
4406% The format of the MagickGetImageChannelMean method is:
4407%
4408% MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4409% const ChannelType channel,double *mean,double *standard_deviation)
4410%
4411% A description of each parameter follows:
4412%
4413% o wand: the magick wand.
4414%
4415% o channel: the image channel(s).
4416%
4417% o mean: The mean pixel value for the specified channel(s).
4418%
4419% o standard_deviation: The standard deviation for the specified channel(s).
4420%
4421*/
4422WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4423 const ChannelType channel,double *mean,double *standard_deviation)
4424{
4425 MagickBooleanType
4426 status;
cristy3ed852e2009-09-05 21:47:34 +00004427
cristy549a37e2010-01-26 15:24:15 +00004428 assert(wand != (MagickWand *) NULL);
4429 assert(wand->signature == WandSignature);
4430 if (wand->debug != MagickFalse)
4431 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4432 if (wand->images == (Image *) NULL)
4433 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4434 status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4435 wand->exception);
4436 return(status);
4437}
4438
cristy3ed852e2009-09-05 21:47:34 +00004439/*
4440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4441% %
4442% %
4443% %
4444% M a g i c k G e t I m a g e C h a n n e l R a n g e %
4445% %
4446% %
4447% %
4448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4449%
4450% MagickGetImageChannelRange() gets the range for one or more image channels.
4451%
4452% The format of the MagickGetImageChannelRange method is:
4453%
4454% MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4455% const ChannelType channel,double *minima,double *maxima)
4456%
4457% A description of each parameter follows:
4458%
4459% o wand: the magick wand.
4460%
4461% o channel: the image channel(s).
4462%
4463% o minima: The minimum pixel value for the specified channel(s).
4464%
4465% o maxima: The maximum pixel value for the specified channel(s).
4466%
4467*/
4468WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4469 const ChannelType channel,double *minima,double *maxima)
4470{
4471 MagickBooleanType
4472 status;
4473
4474 assert(wand != (MagickWand *) NULL);
4475 assert(wand->signature == WandSignature);
4476 if (wand->debug != MagickFalse)
4477 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4478 if (wand->images == (Image *) NULL)
4479 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4480 status=GetImageChannelRange(wand->images,channel,minima,maxima,
4481 wand->exception);
4482 return(status);
4483}
4484
4485/*
4486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4487% %
4488% %
4489% %
4490% M a g i c k G e t I m a g e C h a n n e l S t a t i s t i c s %
4491% %
4492% %
4493% %
4494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4495%
4496% MagickGetImageChannelStatistics() returns statistics for each channel in the
4497% image. The statistics include the channel depth, its minima and
4498% maxima, the mean, the standard deviation, the kurtosis and the skewness.
4499% You can access the red channel mean, for example, like this:
4500%
cristy549a37e2010-01-26 15:24:15 +00004501% channel_statistics=MagickGetImageChannelStatistics(wand);
cristy3ed852e2009-09-05 21:47:34 +00004502% red_mean=channel_statistics[RedChannel].mean;
4503%
4504% Use MagickRelinquishMemory() to free the statistics buffer.
4505%
4506% The format of the MagickGetImageChannelStatistics method is:
4507%
4508% ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4509%
4510% A description of each parameter follows:
4511%
4512% o wand: the magick wand.
4513%
4514*/
4515WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4516{
4517 assert(wand != (MagickWand *) NULL);
4518 assert(wand->signature == WandSignature);
4519 if (wand->debug != MagickFalse)
4520 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4521 if (wand->images == (Image *) NULL)
4522 {
4523 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4524 "ContainsNoImages","`%s'",wand->name);
4525 return((ChannelStatistics *) NULL);
4526 }
4527 return(GetImageChannelStatistics(wand->images,wand->exception));
4528}
4529
4530/*
4531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4532% %
4533% %
4534% %
4535% 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 %
4536% %
4537% %
4538% %
4539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4540%
4541% MagickGetImageColormapColor() returns the color of the specified colormap
4542% index.
4543%
4544% The format of the MagickGetImageColormapColor method is:
4545%
4546% MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004547% const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004548%
4549% A description of each parameter follows:
4550%
4551% o wand: the magick wand.
4552%
4553% o index: the offset into the image colormap.
4554%
4555% o color: Return the colormap color in this wand.
4556%
4557*/
4558WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004559 const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004560{
4561 assert(wand != (MagickWand *) NULL);
4562 assert(wand->signature == WandSignature);
4563 if (wand->debug != MagickFalse)
4564 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4565 if (wand->images == (Image *) NULL)
4566 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4567 if ((wand->images->colormap == (PixelPacket *) NULL) ||
4568 (index >= wand->images->colors))
4569 {
4570 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4571 "InvalidColormapIndex","`%s'",wand->name);
4572 return(MagickFalse);
4573 }
4574 PixelSetQuantumColor(color,wand->images->colormap+index);
4575 return(MagickTrue);
4576}
4577
4578/*
4579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4580% %
4581% %
4582% %
4583% M a g i c k G e t I m a g e C o l o r s %
4584% %
4585% %
4586% %
4587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4588%
4589% MagickGetImageColors() gets the number of unique colors in the image.
4590%
4591% The format of the MagickGetImageColors method is:
4592%
cristybb503372010-05-27 20:51:26 +00004593% size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004594%
4595% A description of each parameter follows:
4596%
4597% o wand: the magick wand.
4598%
4599*/
cristybb503372010-05-27 20:51:26 +00004600WandExport size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004601{
4602 assert(wand != (MagickWand *) NULL);
4603 assert(wand->signature == WandSignature);
4604 if (wand->debug != MagickFalse)
4605 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4606 if (wand->images == (Image *) NULL)
4607 {
4608 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4609 "ContainsNoImages","`%s'",wand->name);
4610 return(0);
4611 }
4612 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4613}
4614
4615/*
4616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4617% %
4618% %
4619% %
4620% M a g i c k G e t I m a g e C o l o r s p a c e %
4621% %
4622% %
4623% %
4624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4625%
4626% MagickGetImageColorspace() gets the image colorspace.
4627%
4628% The format of the MagickGetImageColorspace method is:
4629%
4630% ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4631%
4632% A description of each parameter follows:
4633%
4634% o wand: the magick wand.
4635%
4636*/
4637WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4638{
4639 assert(wand != (MagickWand *) NULL);
4640 assert(wand->signature == WandSignature);
4641 if (wand->debug != MagickFalse)
4642 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4643 if (wand->images == (Image *) NULL)
4644 {
4645 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4646 "ContainsNoImages","`%s'",wand->name);
4647 return(UndefinedColorspace);
4648 }
4649 return(wand->images->colorspace);
4650}
4651
4652/*
4653%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4654% %
4655% %
4656% %
4657% M a g i c k G e t I m a g e C o m p o s e %
4658% %
4659% %
4660% %
4661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4662%
4663% MagickGetImageCompose() returns the composite operator associated with the
4664% image.
4665%
4666% The format of the MagickGetImageCompose method is:
4667%
4668% CompositeOperator MagickGetImageCompose(MagickWand *wand)
4669%
4670% A description of each parameter follows:
4671%
4672% o wand: the magick wand.
4673%
4674*/
4675WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4676{
4677 assert(wand != (MagickWand *) NULL);
4678 assert(wand->signature == WandSignature);
4679 if (wand->debug != MagickFalse)
4680 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4681 if (wand->images == (Image *) NULL)
4682 {
4683 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4684 "ContainsNoImages","`%s'",wand->name);
4685 return(UndefinedCompositeOp);
4686 }
4687 return(wand->images->compose);
4688}
4689
4690/*
4691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4692% %
4693% %
4694% %
4695% 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 %
4696% %
4697% %
4698% %
4699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4700%
4701% MagickGetImageCompression() gets the image compression.
4702%
4703% The format of the MagickGetImageCompression method is:
4704%
4705% CompressionType MagickGetImageCompression(MagickWand *wand)
4706%
4707% A description of each parameter follows:
4708%
4709% o wand: the magick wand.
4710%
4711*/
4712WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4713{
4714 assert(wand != (MagickWand *) NULL);
4715 assert(wand->signature == WandSignature);
4716 if (wand->debug != MagickFalse)
4717 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4718 if (wand->images == (Image *) NULL)
4719 {
4720 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4721 "ContainsNoImages","`%s'",wand->name);
4722 return(UndefinedCompression);
4723 }
4724 return(wand->images->compression);
4725}
4726
4727/*
4728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4729% %
4730% %
4731% %
4732% 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 %
4733% %
4734% %
4735% %
4736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4737%
4738% MagickGetImageCompression() gets the image compression quality.
4739%
4740% The format of the MagickGetImageCompression method is:
4741%
cristybb503372010-05-27 20:51:26 +00004742% size_t MagickGetImageCompression(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004743%
4744% A description of each parameter follows:
4745%
4746% o wand: the magick wand.
4747%
4748*/
cristybb503372010-05-27 20:51:26 +00004749WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004750{
4751 assert(wand != (MagickWand *) NULL);
4752 assert(wand->signature == WandSignature);
4753 if (wand->debug != MagickFalse)
4754 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4755 if (wand->images == (Image *) NULL)
4756 {
4757 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4758 "ContainsNoImages","`%s'",wand->name);
4759 return(0UL);
4760 }
4761 return(wand->images->quality);
4762}
4763
4764/*
4765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4766% %
4767% %
4768% %
4769% M a g i c k G e t I m a g e D e l a y %
4770% %
4771% %
4772% %
4773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4774%
4775% MagickGetImageDelay() gets the image delay.
4776%
4777% The format of the MagickGetImageDelay method is:
4778%
cristybb503372010-05-27 20:51:26 +00004779% size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004780%
4781% A description of each parameter follows:
4782%
4783% o wand: the magick wand.
4784%
4785*/
cristybb503372010-05-27 20:51:26 +00004786WandExport size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004787{
4788 assert(wand != (MagickWand *) NULL);
4789 assert(wand->signature == WandSignature);
4790 if (wand->debug != MagickFalse)
4791 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4792 if (wand->images == (Image *) NULL)
4793 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4794 return(wand->images->delay);
4795}
4796
4797/*
4798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4799% %
4800% %
4801% %
4802% M a g i c k G e t I m a g e D e p t h %
4803% %
4804% %
4805% %
4806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4807%
4808% MagickGetImageDepth() gets the image depth.
4809%
4810% The format of the MagickGetImageDepth method is:
4811%
cristybb503372010-05-27 20:51:26 +00004812% size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004813%
4814% A description of each parameter follows:
4815%
4816% o wand: the magick wand.
4817%
4818*/
cristybb503372010-05-27 20:51:26 +00004819WandExport size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004820{
4821 assert(wand != (MagickWand *) NULL);
4822 assert(wand->signature == WandSignature);
4823 if (wand->debug != MagickFalse)
4824 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4825 if (wand->images == (Image *) NULL)
4826 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4827 return(wand->images->depth);
4828}
4829
4830/*
4831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4832% %
4833% %
4834% %
4835% M a g i c k G e t I m a g e D i s t o r t i o n %
4836% %
4837% %
4838% %
4839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4840%
4841% MagickGetImageDistortion() compares an image to a reconstructed image and
4842% returns the specified distortion metric.
4843%
4844% The format of the MagickGetImageDistortion method is:
4845%
4846% MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4847% const MagickWand *reference,const MetricType metric,
4848% double *distortion)
4849%
4850% A description of each parameter follows:
4851%
4852% o wand: the magick wand.
4853%
4854% o reference: the reference wand.
4855%
4856% o metric: the metric.
4857%
4858% o distortion: the computed distortion between the images.
4859%
4860*/
4861WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4862 const MagickWand *reference,const MetricType metric,double *distortion)
4863{
4864 MagickBooleanType
4865 status;
4866
4867
4868 assert(wand != (MagickWand *) NULL);
4869 assert(wand->signature == WandSignature);
4870 if (wand->debug != MagickFalse)
4871 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4872 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4873 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4874 status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4875 &wand->images->exception);
4876 return(status);
4877}
4878
4879/*
4880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4881% %
4882% %
4883% %
4884% M a g i c k G e t I m a g e D i s p o s e %
4885% %
4886% %
4887% %
4888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4889%
4890% MagickGetImageDispose() gets the image disposal method.
4891%
4892% The format of the MagickGetImageDispose method is:
4893%
4894% DisposeType MagickGetImageDispose(MagickWand *wand)
4895%
4896% A description of each parameter follows:
4897%
4898% o wand: the magick wand.
4899%
4900*/
4901WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4902{
4903 assert(wand != (MagickWand *) NULL);
4904 assert(wand->signature == WandSignature);
4905 if (wand->debug != MagickFalse)
4906 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4907 if (wand->images == (Image *) NULL)
4908 {
4909 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4910 "ContainsNoImages","`%s'",wand->name);
4911 return(UndefinedDispose);
4912 }
4913 return((DisposeType) wand->images->dispose);
4914}
4915
4916/*
4917%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4918% %
4919% %
4920% %
4921% M a g i c k G e t I m a g e F i l e n a m e %
4922% %
4923% %
4924% %
4925%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4926%
4927% MagickGetImageFilename() returns the filename of a particular image in a
4928% sequence.
4929%
4930% The format of the MagickGetImageFilename method is:
4931%
4932% char *MagickGetImageFilename(MagickWand *wand)
4933%
4934% A description of each parameter follows:
4935%
4936% o wand: the magick wand.
4937%
4938*/
4939WandExport char *MagickGetImageFilename(MagickWand *wand)
4940{
4941 assert(wand != (MagickWand *) NULL);
4942 assert(wand->signature == WandSignature);
4943 if (wand->debug != MagickFalse)
4944 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4945 if (wand->images == (Image *) NULL)
4946 {
4947 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4948 "ContainsNoImages","`%s'",wand->name);
4949 return((char *) NULL);
4950 }
4951 return(AcquireString(wand->images->filename));
4952}
4953
4954/*
4955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4956% %
4957% %
4958% %
4959% M a g i c k G e t I m a g e F o r m a t %
4960% %
4961% %
4962% %
4963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4964%
4965% MagickGetImageFormat() returns the format of a particular image in a
4966% sequence.
4967%
4968% The format of the MagickGetImageFormat method is:
4969%
4970% const char MagickGetImageFormat(MagickWand *wand)
4971%
4972% A description of each parameter follows:
4973%
4974% o wand: the magick wand.
4975%
4976*/
4977WandExport char *MagickGetImageFormat(MagickWand *wand)
4978{
4979 assert(wand != (MagickWand *) NULL);
4980 assert(wand->signature == WandSignature);
4981 if (wand->debug != MagickFalse)
4982 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4983 if (wand->images == (Image *) NULL)
4984 {
4985 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4986 "ContainsNoImages","`%s'",wand->name);
4987 return((char *) NULL);
4988 }
4989 return(AcquireString(wand->images->magick));
4990}
4991
4992/*
4993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4994% %
4995% %
4996% %
4997% M a g i c k G e t I m a g e F u z z %
4998% %
4999% %
5000% %
5001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5002%
5003% MagickGetImageFuzz() gets the image fuzz.
5004%
5005% The format of the MagickGetImageFuzz method is:
5006%
5007% double MagickGetImageFuzz(MagickWand *wand)
5008%
5009% A description of each parameter follows:
5010%
5011% o wand: the magick wand.
5012%
5013*/
5014WandExport double MagickGetImageFuzz(MagickWand *wand)
5015{
5016 assert(wand != (MagickWand *) NULL);
5017 assert(wand->signature == WandSignature);
5018 if (wand->debug != MagickFalse)
5019 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5020 if (wand->images == (Image *) NULL)
5021 {
5022 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5023 "ContainsNoImages","`%s'",wand->name);
5024 return(0.0);
5025 }
5026 return(wand->images->fuzz);
5027}
5028
5029/*
5030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5031% %
5032% %
5033% %
5034% M a g i c k G e t I m a g e G a m m a %
5035% %
5036% %
5037% %
5038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5039%
5040% MagickGetImageGamma() gets the image gamma.
5041%
5042% The format of the MagickGetImageGamma method is:
5043%
5044% double MagickGetImageGamma(MagickWand *wand)
5045%
5046% A description of each parameter follows:
5047%
5048% o wand: the magick wand.
5049%
5050*/
5051WandExport double MagickGetImageGamma(MagickWand *wand)
5052{
5053 assert(wand != (MagickWand *) NULL);
5054 assert(wand->signature == WandSignature);
5055 if (wand->debug != MagickFalse)
5056 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5057 if (wand->images == (Image *) NULL)
5058 {
5059 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5060 "ContainsNoImages","`%s'",wand->name);
5061 return(0.0);
5062 }
5063 return(wand->images->gamma);
5064}
5065
5066/*
5067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5068% %
5069% %
5070% %
5071% 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 %
5072% %
5073% %
5074% %
5075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5076%
5077% MagickGetImageGravity() gets the image gravity.
5078%
5079% The format of the MagickGetImageGravity method is:
5080%
5081% GravityType MagickGetImageGravity(MagickWand *wand)
5082%
5083% A description of each parameter follows:
5084%
5085% o wand: the magick wand.
5086%
5087*/
5088WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5089{
5090 assert(wand != (MagickWand *) NULL);
5091 assert(wand->signature == WandSignature);
5092 if (wand->debug != MagickFalse)
5093 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5094 if (wand->images == (Image *) NULL)
5095 {
5096 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5097 "ContainsNoImages","`%s'",wand->name);
5098 return(UndefinedGravity);
5099 }
5100 return(wand->images->gravity);
5101}
5102
5103/*
5104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5105% %
5106% %
5107% %
5108% 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 %
5109% %
5110% %
5111% %
5112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5113%
5114% MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5115%
5116% The format of the MagickGetImageGreenPrimary method is:
5117%
5118% MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5119% double *y)
5120%
5121% A description of each parameter follows:
5122%
5123% o wand: the magick wand.
5124%
5125% o x: the chromaticity green primary x-point.
5126%
5127% o y: the chromaticity green primary y-point.
5128%
5129*/
5130WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5131 double *x,double *y)
5132{
5133 assert(wand != (MagickWand *) NULL);
5134 assert(wand->signature == WandSignature);
5135 if (wand->debug != MagickFalse)
5136 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5137 if (wand->images == (Image *) NULL)
5138 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5139 *x=wand->images->chromaticity.green_primary.x;
5140 *y=wand->images->chromaticity.green_primary.y;
5141 return(MagickTrue);
5142}
5143
5144/*
5145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5146% %
5147% %
5148% %
5149% M a g i c k G e t I m a g e H e i g h t %
5150% %
5151% %
5152% %
5153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5154%
5155% MagickGetImageHeight() returns the image height.
5156%
5157% The format of the MagickGetImageHeight method is:
5158%
cristybb503372010-05-27 20:51:26 +00005159% size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005160%
5161% A description of each parameter follows:
5162%
5163% o wand: the magick wand.
5164%
5165*/
cristybb503372010-05-27 20:51:26 +00005166WandExport size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005167{
5168 assert(wand != (MagickWand *) NULL);
5169 assert(wand->signature == WandSignature);
5170 if (wand->debug != MagickFalse)
5171 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5172 if (wand->images == (Image *) NULL)
5173 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5174 return(wand->images->rows);
5175}
5176
5177/*
5178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5179% %
5180% %
5181% %
5182% M a g i c k G e t I m a g e H i s t o g r a m %
5183% %
5184% %
5185% %
5186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5187%
5188% MagickGetImageHistogram() returns the image histogram as an array of
5189% PixelWand wands.
5190%
5191% The format of the MagickGetImageHistogram method is:
5192%
5193% PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005194% size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00005195%
5196% A description of each parameter follows:
5197%
5198% o wand: the magick wand.
5199%
5200% o number_colors: the number of unique colors in the image and the number
5201% of pixel wands returned.
5202%
5203*/
5204WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005205 size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00005206{
5207 ColorPacket
5208 *histogram;
5209
5210 PixelWand
5211 **pixel_wands;
5212
cristybb503372010-05-27 20:51:26 +00005213 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +00005214 i;
5215
5216 assert(wand != (MagickWand *) NULL);
5217 assert(wand->signature == WandSignature);
5218 if (wand->debug != MagickFalse)
5219 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5220 if (wand->images == (Image *) NULL)
5221 {
5222 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5223 "ContainsNoImages","`%s'",wand->name);
5224 return((PixelWand **) NULL);
5225 }
5226 histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5227 if (histogram == (ColorPacket *) NULL)
5228 return((PixelWand **) NULL);
5229 pixel_wands=NewPixelWands(*number_colors);
cristybb503372010-05-27 20:51:26 +00005230 for (i=0; i < (ssize_t) *number_colors; i++)
cristy3ed852e2009-09-05 21:47:34 +00005231 {
5232 PixelSetQuantumColor(pixel_wands[i],&histogram[i].pixel);
5233 PixelSetIndex(pixel_wands[i],histogram[i].index);
cristybb503372010-05-27 20:51:26 +00005234 PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
cristy3ed852e2009-09-05 21:47:34 +00005235 }
5236 histogram=(ColorPacket *) RelinquishMagickMemory(histogram);
5237 return(pixel_wands);
5238}
5239
5240/*
5241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5242% %
5243% %
5244% %
5245% 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 %
5246% %
5247% %
5248% %
5249%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5250%
5251% MagickGetImageInterlaceScheme() gets the image interlace scheme.
5252%
5253% The format of the MagickGetImageInterlaceScheme method is:
5254%
5255% InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5256%
5257% A description of each parameter follows:
5258%
5259% o wand: the magick wand.
5260%
5261*/
5262WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5263{
5264 assert(wand != (MagickWand *) NULL);
5265 assert(wand->signature == WandSignature);
5266 if (wand->debug != MagickFalse)
5267 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5268 if (wand->images == (Image *) NULL)
5269 {
5270 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5271 "ContainsNoImages","`%s'",wand->name);
5272 return(UndefinedInterlace);
5273 }
5274 return(wand->images->interlace);
5275}
5276
5277/*
5278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5279% %
5280% %
5281% %
5282% 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 %
5283% %
5284% %
5285% %
5286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5287%
5288% MagickGetImageInterpolateMethod() returns the interpolation method for the
5289% sepcified image.
5290%
5291% The format of the MagickGetImageInterpolateMethod method is:
5292%
5293% InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5294%
5295% A description of each parameter follows:
5296%
5297% o wand: the magick wand.
5298%
5299*/
5300WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5301 MagickWand *wand)
5302{
5303 assert(wand != (MagickWand *) NULL);
5304 assert(wand->signature == WandSignature);
5305 if (wand->debug != MagickFalse)
5306 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5307 if (wand->images == (Image *) NULL)
5308 {
5309 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5310 "ContainsNoImages","`%s'",wand->name);
5311 return(UndefinedInterpolatePixel);
5312 }
5313 return(wand->images->interpolate);
5314}
5315
5316/*
5317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5318% %
5319% %
5320% %
5321% M a g i c k G e t I m a g e I t e r a t i o n s %
5322% %
5323% %
5324% %
5325%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5326%
5327% MagickGetImageIterations() gets the image iterations.
5328%
5329% The format of the MagickGetImageIterations method is:
5330%
cristybb503372010-05-27 20:51:26 +00005331% size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005332%
5333% A description of each parameter follows:
5334%
5335% o wand: the magick wand.
5336%
5337*/
cristybb503372010-05-27 20:51:26 +00005338WandExport size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005339{
5340 assert(wand != (MagickWand *) NULL);
5341 assert(wand->signature == WandSignature);
5342 if (wand->debug != MagickFalse)
5343 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5344 if (wand->images == (Image *) NULL)
5345 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5346 return(wand->images->iterations);
5347}
5348
5349/*
5350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5351% %
5352% %
5353% %
5354% M a g i c k G e t I m a g e L e n g t h %
5355% %
5356% %
5357% %
5358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5359%
5360% MagickGetImageLength() returns the image length in bytes.
5361%
5362% The format of the MagickGetImageLength method is:
5363%
5364% MagickBooleanType MagickGetImageLength(MagickWand *wand,
5365% MagickSizeType *length)
5366%
5367% A description of each parameter follows:
5368%
5369% o wand: the magick wand.
5370%
5371% o length: the image length in bytes.
5372%
5373*/
5374WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5375 MagickSizeType *length)
5376{
5377 assert(wand != (MagickWand *) NULL);
5378 assert(wand->signature == WandSignature);
5379 if (wand->debug != MagickFalse)
5380 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5381 if (wand->images == (Image *) NULL)
5382 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5383 *length=GetBlobSize(wand->images);
5384 return(MagickTrue);
5385}
5386
5387/*
5388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5389% %
5390% %
5391% %
5392% M a g i c k G e t I m a g e M a t t e C o l o r %
5393% %
5394% %
5395% %
5396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5397%
5398% MagickGetImageMatteColor() returns the image matte color.
5399%
5400% The format of the MagickGetImageMatteColor method is:
5401%
5402% MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5403% PixelWand *matte_color)
5404%
5405% A description of each parameter follows:
5406%
5407% o wand: the magick wand.
5408%
5409% o matte_color: Return the matte color.
5410%
5411*/
5412WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5413 PixelWand *matte_color)
5414{
5415 assert(wand != (MagickWand *) NULL);
5416 assert(wand->signature == WandSignature);
5417 if (wand->debug != MagickFalse)
5418 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5419 if (wand->images == (Image *) NULL)
5420 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5421 PixelSetQuantumColor(matte_color,&wand->images->matte_color);
5422 return(MagickTrue);
5423}
5424
5425/*
5426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5427% %
5428% %
5429% %
5430% 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 %
5431% %
5432% %
5433% %
5434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5435%
5436% MagickGetImageOrientation() returns the image orientation.
5437%
5438% The format of the MagickGetImageOrientation method is:
5439%
5440% OrientationType MagickGetImageOrientation(MagickWand *wand)
5441%
5442% A description of each parameter follows:
5443%
5444% o wand: the magick wand.
5445%
5446*/
5447WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5448{
5449 assert(wand != (MagickWand *) NULL);
5450 assert(wand->signature == WandSignature);
5451 if (wand->debug != MagickFalse)
5452 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5453 if (wand->images == (Image *) NULL)
5454 {
5455 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5456 "ContainsNoImages","`%s'",wand->name);
5457 return(UndefinedOrientation);
5458 }
5459 return(wand->images->orientation);
5460}
5461
5462/*
5463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5464% %
5465% %
5466% %
5467% M a g i c k G e t I m a g e P a g e %
5468% %
5469% %
5470% %
5471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5472%
5473% MagickGetImagePage() returns the page geometry associated with the image.
5474%
5475% The format of the MagickGetImagePage method is:
5476%
5477% MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005478% size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00005479%
5480% A description of each parameter follows:
5481%
5482% o wand: the magick wand.
5483%
5484% o width: the page width.
5485%
5486% o height: the page height.
5487%
5488% o x: the page x-offset.
5489%
5490% o y: the page y-offset.
5491%
5492*/
5493WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005494 size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00005495{
5496 assert(wand != (const MagickWand *) NULL);
5497 assert(wand->signature == WandSignature);
5498 if (wand->debug != MagickFalse)
5499 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5500 if (wand->images == (Image *) NULL)
5501 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5502 *width=wand->images->page.width;
5503 *height=wand->images->page.height;
5504 *x=wand->images->page.x;
5505 *y=wand->images->page.y;
5506 return(MagickTrue);
5507}
5508
5509/*
5510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5511% %
5512% %
5513% %
5514% M a g i c k G e t I m a g e P i x e l C o l o r %
5515% %
5516% %
5517% %
5518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5519%
5520% MagickGetImagePixelColor() returns the color of the specified pixel.
5521%
5522% The format of the MagickGetImagePixelColor method is:
5523%
5524% MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005525% const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005526%
5527% A description of each parameter follows:
5528%
5529% o wand: the magick wand.
5530%
5531% o x,y: the pixel offset into the image.
5532%
5533% o color: Return the colormap color in this wand.
5534%
5535*/
5536WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005537 const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005538{
5539 IndexPacket
5540 *indexes;
5541
5542 register const PixelPacket
5543 *p;
5544
5545 CacheView
5546 *image_view;
5547
5548 assert(wand != (MagickWand *) NULL);
5549 assert(wand->signature == WandSignature);
5550 if (wand->debug != MagickFalse)
5551 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5552 if (wand->images == (Image *) NULL)
5553 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5554 image_view=AcquireCacheView(wand->images);
5555 p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5556 if (p == (const PixelPacket *) NULL)
5557 {
5558 image_view=DestroyCacheView(image_view);
5559 return(MagickFalse);
5560 }
5561 indexes=GetCacheViewAuthenticIndexQueue(image_view);
5562 PixelSetQuantumColor(color,p);
5563 if (GetCacheViewColorspace(image_view) == CMYKColorspace)
5564 PixelSetBlackQuantum(color,*indexes);
5565 else
5566 if (GetCacheViewStorageClass(image_view) == PseudoClass)
5567 PixelSetIndex(color,*indexes);
5568 image_view=DestroyCacheView(image_view);
5569 return(MagickTrue);
5570}
5571
5572/*
5573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5574% %
5575% %
5576% %
5577+ M a g i c k G e t I m a g e R a n g e %
5578% %
5579% %
5580% %
5581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5582%
5583% MagickGetImageRange() gets the pixel range for the image.
5584%
5585% The format of the MagickGetImageRange method is:
5586%
5587% MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5588% double *maxima)
5589%
5590% A description of each parameter follows:
5591%
5592% o wand: the magick wand.
5593%
5594% o minima: The minimum pixel value for the specified channel(s).
5595%
5596% o maxima: The maximum pixel value for the specified channel(s).
5597%
5598*/
5599WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5600 double *minima,double *maxima)
5601{
5602 MagickBooleanType
5603 status;
5604
5605 assert(wand != (MagickWand *) NULL);
5606 assert(wand->signature == WandSignature);
5607 if (wand->debug != MagickFalse)
5608 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5609 if (wand->images == (Image *) NULL)
5610 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5611 status=GetImageRange(wand->images,minima,maxima,wand->exception);
5612 return(status);
5613}
5614
5615/*
5616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5617% %
5618% %
5619% %
5620% M a g i c k G e t I m a g e R e d P r i m a r y %
5621% %
5622% %
5623% %
5624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5625%
5626% MagickGetImageRedPrimary() returns the chromaticy red primary point.
5627%
5628% The format of the MagickGetImageRedPrimary method is:
5629%
5630% MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5631% double *y)
5632%
5633% A description of each parameter follows:
5634%
5635% o wand: the magick wand.
5636%
5637% o x: the chromaticity red primary x-point.
5638%
5639% o y: the chromaticity red primary y-point.
5640%
5641*/
5642WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5643 double *x,double *y)
5644{
5645 assert(wand != (MagickWand *) NULL);
5646 assert(wand->signature == WandSignature);
5647 if (wand->debug != MagickFalse)
5648 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5649 if (wand->images == (Image *) NULL)
5650 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5651 *x=wand->images->chromaticity.red_primary.x;
5652 *y=wand->images->chromaticity.red_primary.y;
5653 return(MagickTrue);
5654}
5655
5656/*
5657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5658% %
5659% %
5660% %
5661% M a g i c k G e t I m a g e R e g i o n %
5662% %
5663% %
5664% %
5665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5666%
5667% MagickGetImageRegion() extracts a region of the image and returns it as a
5668% a new wand.
5669%
5670% The format of the MagickGetImageRegion method is:
5671%
5672% MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005673% const size_t width,const size_t height,const ssize_t x,
5674% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005675%
5676% A description of each parameter follows:
5677%
5678% o wand: the magick wand.
5679%
5680% o width: the region width.
5681%
5682% o height: the region height.
5683%
5684% o x: the region x offset.
5685%
5686% o y: the region y offset.
5687%
5688*/
5689WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005690 const size_t width,const size_t height,const ssize_t x,
5691 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005692{
5693 Image
5694 *region_image;
5695
5696 RectangleInfo
5697 region;
5698
5699 assert(wand != (MagickWand *) NULL);
5700 assert(wand->signature == WandSignature);
5701 if (wand->debug != MagickFalse)
5702 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5703 if (wand->images == (Image *) NULL)
5704 return((MagickWand *) NULL);
5705 region.width=width;
5706 region.height=height;
5707 region.x=x;
5708 region.y=y;
5709 region_image=CropImage(wand->images,&region,wand->exception);
5710 if (region_image == (Image *) NULL)
5711 return((MagickWand *) NULL);
5712 return(CloneMagickWandFromImages(wand,region_image));
5713}
5714
5715/*
5716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5717% %
5718% %
5719% %
5720% 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 %
5721% %
5722% %
5723% %
5724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5725%
5726% MagickGetImageRenderingIntent() gets the image rendering intent.
5727%
5728% The format of the MagickGetImageRenderingIntent method is:
5729%
5730% RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5731%
5732% A description of each parameter follows:
5733%
5734% o wand: the magick wand.
5735%
5736*/
5737WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5738{
5739 assert(wand != (MagickWand *) NULL);
5740 assert(wand->signature == WandSignature);
5741 if (wand->debug != MagickFalse)
5742 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5743 if (wand->images == (Image *) NULL)
5744 {
5745 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5746 "ContainsNoImages","`%s'",wand->name);
5747 return(UndefinedIntent);
5748 }
5749 return((RenderingIntent) wand->images->rendering_intent);
5750}
5751
5752/*
5753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5754% %
5755% %
5756% %
5757% M a g i c k G e t I m a g e R e s o l u t i o n %
5758% %
5759% %
5760% %
5761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5762%
5763% MagickGetImageResolution() gets the image X and Y resolution.
5764%
5765% The format of the MagickGetImageResolution method is:
5766%
5767% MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5768% double *y)
5769%
5770% A description of each parameter follows:
5771%
5772% o wand: the magick wand.
5773%
5774% o x: the image x-resolution.
5775%
5776% o y: the image y-resolution.
5777%
5778*/
5779WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5780 double *x,double *y)
5781{
5782 assert(wand != (MagickWand *) NULL);
5783 assert(wand->signature == WandSignature);
5784 if (wand->debug != MagickFalse)
5785 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5786 if (wand->images == (Image *) NULL)
5787 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5788 *x=wand->images->x_resolution;
5789 *y=wand->images->y_resolution;
5790 return(MagickTrue);
5791}
5792
5793/*
5794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5795% %
5796% %
5797% %
5798% M a g i c k G e t I m a g e S c e n e %
5799% %
5800% %
5801% %
5802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5803%
5804% MagickGetImageScene() gets the image scene.
5805%
5806% The format of the MagickGetImageScene method is:
5807%
cristybb503372010-05-27 20:51:26 +00005808% size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005809%
5810% A description of each parameter follows:
5811%
5812% o wand: the magick wand.
5813%
5814*/
cristybb503372010-05-27 20:51:26 +00005815WandExport size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005816{
5817 assert(wand != (MagickWand *) NULL);
5818 assert(wand->signature == WandSignature);
5819 if (wand->debug != MagickFalse)
5820 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5821 if (wand->images == (Image *) NULL)
5822 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5823 return(wand->images->scene);
5824}
5825
5826/*
5827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5828% %
5829% %
5830% %
5831% M a g i c k G e t I m a g e S i g n a t u r e %
5832% %
5833% %
5834% %
5835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5836%
5837% MagickGetImageSignature() generates an SHA-256 message digest for the image
5838% pixel stream.
5839%
5840% The format of the MagickGetImageSignature method is:
5841%
5842% const char MagickGetImageSignature(MagickWand *wand)
5843%
5844% A description of each parameter follows:
5845%
5846% o wand: the magick wand.
5847%
5848*/
5849WandExport char *MagickGetImageSignature(MagickWand *wand)
5850{
5851 const char
5852 *value;
5853
5854 MagickBooleanType
5855 status;
5856
5857 assert(wand != (MagickWand *) NULL);
5858 assert(wand->signature == WandSignature);
5859 if (wand->debug != MagickFalse)
5860 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5861 if (wand->images == (Image *) NULL)
5862 {
5863 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5864 "ContainsNoImages","`%s'",wand->name);
5865 return((char *) NULL);
5866 }
5867 status=SignatureImage(wand->images);
5868 if (status == MagickFalse)
5869 InheritException(wand->exception,&wand->images->exception);
5870 value=GetImageProperty(wand->images,"signature");
5871 if (value != (const char *) NULL)
5872 return(AcquireString(value));
5873 InheritException(wand->exception,&wand->images->exception);
5874 return((char *) NULL);
5875}
5876
5877/*
5878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5879% %
5880% %
5881% %
5882% 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 %
5883% %
5884% %
5885% %
5886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5887%
5888% MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5889%
5890% The format of the MagickGetImageTicksPerSecond method is:
5891%
cristybb503372010-05-27 20:51:26 +00005892% size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005893%
5894% A description of each parameter follows:
5895%
5896% o wand: the magick wand.
5897%
5898*/
cristybb503372010-05-27 20:51:26 +00005899WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005900{
5901 assert(wand != (MagickWand *) NULL);
5902 assert(wand->signature == WandSignature);
5903 if (wand->debug != MagickFalse)
5904 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5905 if (wand->images == (Image *) NULL)
5906 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristybb503372010-05-27 20:51:26 +00005907 return((size_t) wand->images->ticks_per_second);
cristy3ed852e2009-09-05 21:47:34 +00005908}
5909
5910/*
5911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5912% %
5913% %
5914% %
5915% M a g i c k G e t I m a g e T y p e %
5916% %
5917% %
5918% %
5919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5920%
5921% MagickGetImageType() gets the potential image type:
5922%
5923% Bilevel Grayscale GrayscaleMatte
5924% Palette PaletteMatte TrueColor
5925% TrueColorMatte ColorSeparation ColorSeparationMatte
5926%
5927% To ensure the image type matches its potential, use MagickSetImageType():
5928%
5929% (void) MagickSetImageType(wand,MagickGetImageType(wand));
5930%
5931% The format of the MagickGetImageType method is:
5932%
5933% ImageType MagickGetImageType(MagickWand *wand)
5934%
5935% A description of each parameter follows:
5936%
5937% o wand: the magick wand.
5938%
5939*/
5940WandExport ImageType MagickGetImageType(MagickWand *wand)
5941{
5942 assert(wand != (MagickWand *) NULL);
5943 assert(wand->signature == WandSignature);
5944 if (wand->debug != MagickFalse)
5945 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5946 if (wand->images == (Image *) NULL)
5947 {
5948 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5949 "ContainsNoImages","`%s'",wand->name);
5950 return(UndefinedType);
5951 }
5952 return(GetImageType(wand->images,wand->exception));
5953}
5954
5955/*
5956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5957% %
5958% %
5959% %
5960% M a g i c k G e t I m a g e U n i t s %
5961% %
5962% %
5963% %
5964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5965%
5966% MagickGetImageUnits() gets the image units of resolution.
5967%
5968% The format of the MagickGetImageUnits method is:
5969%
5970% ResolutionType MagickGetImageUnits(MagickWand *wand)
5971%
5972% A description of each parameter follows:
5973%
5974% o wand: the magick wand.
5975%
5976*/
5977WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5978{
5979 assert(wand != (MagickWand *) NULL);
5980 assert(wand->signature == WandSignature);
5981 if (wand->debug != MagickFalse)
5982 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5983 if (wand->images == (Image *) NULL)
5984 {
5985 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5986 "ContainsNoImages","`%s'",wand->name);
5987 return(UndefinedResolution);
5988 }
5989 return(wand->images->units);
5990}
5991
5992/*
5993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5994% %
5995% %
5996% %
5997% 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 %
5998% %
5999% %
6000% %
6001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6002%
6003% MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6004% sepcified image.
6005%
6006% The format of the MagickGetImageVirtualPixelMethod method is:
6007%
6008% VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6009%
6010% A description of each parameter follows:
6011%
6012% o wand: the magick wand.
6013%
6014*/
6015WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6016{
6017 assert(wand != (MagickWand *) NULL);
6018 assert(wand->signature == WandSignature);
6019 if (wand->debug != MagickFalse)
6020 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6021 if (wand->images == (Image *) NULL)
6022 {
6023 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6024 "ContainsNoImages","`%s'",wand->name);
6025 return(UndefinedVirtualPixelMethod);
6026 }
6027 return(GetImageVirtualPixelMethod(wand->images));
6028}
6029
6030/*
6031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6032% %
6033% %
6034% %
6035% M a g i c k G e t I m a g e W h i t e P o i n t %
6036% %
6037% %
6038% %
6039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6040%
6041% MagickGetImageWhitePoint() returns the chromaticy white point.
6042%
6043% The format of the MagickGetImageWhitePoint method is:
6044%
6045% MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6046% double *y)
6047%
6048% A description of each parameter follows:
6049%
6050% o wand: the magick wand.
6051%
6052% o x: the chromaticity white x-point.
6053%
6054% o y: the chromaticity white y-point.
6055%
6056*/
6057WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6058 double *x,double *y)
6059{
6060 assert(wand != (MagickWand *) NULL);
6061 assert(wand->signature == WandSignature);
6062 if (wand->debug != MagickFalse)
6063 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6064 if (wand->images == (Image *) NULL)
6065 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6066 *x=wand->images->chromaticity.white_point.x;
6067 *y=wand->images->chromaticity.white_point.y;
6068 return(MagickTrue);
6069}
6070
6071/*
6072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6073% %
6074% %
6075% %
6076% M a g i c k G e t I m a g e W i d t h %
6077% %
6078% %
6079% %
6080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6081%
6082% MagickGetImageWidth() returns the image width.
6083%
6084% The format of the MagickGetImageWidth method is:
6085%
cristybb503372010-05-27 20:51:26 +00006086% size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00006087%
6088% A description of each parameter follows:
6089%
6090% o wand: the magick wand.
6091%
6092*/
cristybb503372010-05-27 20:51:26 +00006093WandExport size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00006094{
6095 assert(wand != (MagickWand *) NULL);
6096 assert(wand->signature == WandSignature);
6097 if (wand->debug != MagickFalse)
6098 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6099 if (wand->images == (Image *) NULL)
6100 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6101 return(wand->images->columns);
6102}
6103
6104/*
6105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6106% %
6107% %
6108% %
6109% M a g i c k G e t N u m b e r I m a g e s %
6110% %
6111% %
6112% %
6113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6114%
6115% MagickGetNumberImages() returns the number of images associated with a
6116% magick wand.
6117%
6118% The format of the MagickGetNumberImages method is:
6119%
cristybb503372010-05-27 20:51:26 +00006120% size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00006121%
6122% A description of each parameter follows:
6123%
6124% o wand: the magick wand.
6125%
6126*/
cristybb503372010-05-27 20:51:26 +00006127WandExport size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00006128{
6129 assert(wand != (MagickWand *) NULL);
6130 assert(wand->signature == WandSignature);
6131 if (wand->debug != MagickFalse)
6132 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6133 return(GetImageListLength(wand->images));
6134}
6135
6136/*
6137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6138% %
6139% %
6140% %
6141% 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 %
6142% %
6143% %
6144% %
6145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6146%
6147% MagickGetImageTotalInkDensity() gets the image total ink density.
6148%
6149% The format of the MagickGetImageTotalInkDensity method is:
6150%
6151% double MagickGetImageTotalInkDensity(MagickWand *wand)
6152%
6153% A description of each parameter follows:
6154%
6155% o wand: the magick wand.
6156%
6157*/
6158WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6159{
6160 assert(wand != (MagickWand *) NULL);
6161 assert(wand->signature == WandSignature);
6162 if (wand->debug != MagickFalse)
6163 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6164 if (wand->images == (Image *) NULL)
6165 {
6166 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6167 "ContainsNoImages","`%s'",wand->name);
6168 return(0.0);
6169 }
6170 return(GetImageTotalInkDensity(wand->images));
6171}
6172
6173/*
6174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6175% %
6176% %
6177% %
6178% M a g i c k H a l d C l u t I m a g e %
6179% %
6180% %
6181% %
6182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6183%
6184% MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6185% table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
6186% dimensions. Create it with the HALD coder. You can apply any color
6187% transformation to the Hald image and then use this method to apply the
6188% transform to the image.
6189%
6190% The format of the MagickHaldClutImage method is:
6191%
6192% MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6193% const MagickWand *hald_wand)
6194% MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6195% const ChannelType channel,const MagickWand *hald_wand)
6196%
6197% A description of each parameter follows:
6198%
6199% o wand: the magick wand.
6200%
6201% o hald_image: the hald CLUT image.
6202%
6203*/
6204
6205WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6206 const MagickWand *hald_wand)
6207{
6208 MagickBooleanType
6209 status;
6210
6211 status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6212 return(status);
6213}
6214
6215WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6216 const ChannelType channel,const MagickWand *hald_wand)
6217{
6218 MagickBooleanType
6219 status;
6220
6221 assert(wand != (MagickWand *) NULL);
6222 assert(wand->signature == WandSignature);
6223 if (wand->debug != MagickFalse)
6224 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6225 if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6226 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6227 status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6228 if (status == MagickFalse)
6229 InheritException(wand->exception,&wand->images->exception);
6230 return(status);
6231}
6232
6233/*
6234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6235% %
6236% %
6237% %
6238% M a g i c k H a s N e x t I m a g e %
6239% %
6240% %
6241% %
6242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6243%
6244% MagickHasNextImage() returns MagickTrue if the wand has more images when
6245% traversing the list in the forward direction
6246%
6247% The format of the MagickHasNextImage method is:
6248%
6249% MagickBooleanType MagickHasNextImage(MagickWand *wand)
6250%
6251% A description of each parameter follows:
6252%
6253% o wand: the magick wand.
6254%
6255*/
6256WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6257{
6258 assert(wand != (MagickWand *) NULL);
6259 assert(wand->signature == WandSignature);
6260 if (wand->debug != MagickFalse)
6261 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6262 if (wand->images == (Image *) NULL)
6263 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6264 if (GetNextImageInList(wand->images) == (Image *) NULL)
6265 return(MagickFalse);
6266 return(MagickTrue);
6267}
6268
6269/*
6270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6271% %
6272% %
6273% %
6274% M a g i c k H a s P r e v i o u s I m a g e %
6275% %
6276% %
6277% %
6278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6279%
6280% MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6281% traversing the list in the reverse direction
6282%
6283% The format of the MagickHasPreviousImage method is:
6284%
6285% MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6286%
6287% A description of each parameter follows:
6288%
6289% o wand: the magick wand.
6290%
6291*/
6292WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6293{
6294 assert(wand != (MagickWand *) NULL);
6295 assert(wand->signature == WandSignature);
6296 if (wand->debug != MagickFalse)
6297 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6298 if (wand->images == (Image *) NULL)
6299 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6300 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6301 return(MagickFalse);
6302 return(MagickTrue);
6303}
6304
6305/*
6306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6307% %
6308% %
6309% %
6310% M a g i c k I d e n t i f y I m a g e %
6311% %
6312% %
6313% %
6314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6315%
6316% MagickIdentifyImage() identifies an image by printing its attributes to the
6317% file. Attributes include the image width, height, size, and others.
6318%
6319% The format of the MagickIdentifyImage method is:
6320%
6321% const char *MagickIdentifyImage(MagickWand *wand)
6322%
6323% A description of each parameter follows:
6324%
6325% o wand: the magick wand.
6326%
6327*/
6328WandExport char *MagickIdentifyImage(MagickWand *wand)
6329{
6330 char
6331 *description,
6332 filename[MaxTextExtent];
6333
6334 FILE
6335 *file;
6336
6337 int
6338 unique_file;
6339
6340 assert(wand != (MagickWand *) NULL);
6341 assert(wand->signature == WandSignature);
6342 if (wand->debug != MagickFalse)
6343 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6344 if (wand->images == (Image *) NULL)
6345 {
6346 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6347 "ContainsNoImages","`%s'",wand->name);
6348 return((char *) NULL);
6349 }
6350 description=(char *) NULL;
6351 unique_file=AcquireUniqueFileResource(filename);
6352 file=(FILE *) NULL;
6353 if (unique_file != -1)
6354 file=fdopen(unique_file,"wb");
6355 if ((unique_file == -1) || (file == (FILE *) NULL))
6356 {
6357 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6358 "UnableToCreateTemporaryFile","`%s'",wand->name);
6359 return((char *) NULL);
6360 }
6361 (void) IdentifyImage(wand->images,file,MagickTrue);
6362 (void) fclose(file);
6363 description=FileToString(filename,~0,wand->exception);
6364 (void) RelinquishUniqueFileResource(filename);
6365 return(description);
6366}
6367
6368/*
6369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6370% %
6371% %
6372% %
6373% M a g i c k I m p l o d e I m a g e %
6374% %
6375% %
6376% %
6377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6378%
6379% MagickImplodeImage() creates a new image that is a copy of an existing
6380% one with the image pixels "implode" by the specified percentage. It
6381% allocates the memory necessary for the new Image structure and returns a
6382% pointer to the new image.
6383%
6384% The format of the MagickImplodeImage method is:
6385%
6386% MagickBooleanType MagickImplodeImage(MagickWand *wand,
6387% const double radius)
6388%
6389% A description of each parameter follows:
6390%
6391% o wand: the magick wand.
6392%
6393% o amount: Define the extent of the implosion.
6394%
6395*/
6396WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6397 const double amount)
6398{
6399 Image
6400 *implode_image;
6401
6402 assert(wand != (MagickWand *) NULL);
6403 assert(wand->signature == WandSignature);
6404 if (wand->debug != MagickFalse)
6405 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6406 if (wand->images == (Image *) NULL)
6407 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6408 implode_image=ImplodeImage(wand->images,amount,wand->exception);
6409 if (implode_image == (Image *) NULL)
6410 return(MagickFalse);
6411 ReplaceImageInList(&wand->images,implode_image);
6412 return(MagickTrue);
6413}
6414
6415/*
6416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6417% %
6418% %
6419% %
6420% M a g i c k I m p o r t I m a g e P i x e l s %
6421% %
6422% %
6423% %
6424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6425%
6426% MagickImportImagePixels() accepts pixel datand stores it in the image at the
6427% location you specify. The method returns MagickFalse on success otherwise
6428% MagickTrue if an error is encountered. The pixel data can be either char,
cristybb503372010-05-27 20:51:26 +00006429% short int, int, ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00006430%
6431% Suppose your want to upload the first scanline of a 640x480 image from
6432% character data in red-green-blue order:
6433%
6434% MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6435%
6436% The format of the MagickImportImagePixels method is:
6437%
6438% MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006439% const ssize_t x,const ssize_t y,const size_t columns,
6440% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00006441% const void *pixels)
6442%
6443% A description of each parameter follows:
6444%
6445% o wand: the magick wand.
6446%
6447% o x, y, columns, rows: These values define the perimeter of a region
6448% of pixels you want to define.
6449%
6450% o map: This string reflects the expected ordering of the pixel array.
6451% It can be any combination or order of R = red, G = green, B = blue,
6452% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6453% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6454% P = pad.
6455%
6456% o storage: Define the data type of the pixels. Float and double types are
6457% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
6458% these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6459% or DoublePixel.
6460%
6461% o pixels: This array of values contain the pixel components as defined by
6462% map and type. You must preallocate this array where the expected
6463% length varies depending on the values of width, height, map, and type.
6464%
6465*/
6466WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006467 const ssize_t x,const ssize_t y,const size_t columns,
6468 const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00006469 const void *pixels)
6470{
6471 MagickBooleanType
6472 status;
6473
6474 assert(wand != (MagickWand *) NULL);
6475 assert(wand->signature == WandSignature);
6476 if (wand->debug != MagickFalse)
6477 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6478 if (wand->images == (Image *) NULL)
6479 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6480 status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6481 if (status == MagickFalse)
6482 InheritException(wand->exception,&wand->images->exception);
6483 return(status);
6484}
6485
6486/*
6487%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6488% %
6489% %
6490% %
6491% 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 %
6492% %
6493% %
6494% %
6495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6496%
6497% MagickInverseFourierTransformImage() implements the inverse discrete
6498% Fourier transform (DFT) of the image either as a magnitude / phase or real /
6499% imaginary image pair.
6500%
6501% The format of the MagickInverseFourierTransformImage method is:
6502%
6503% MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00006504% MagickWand *magnitude_wand,MagickWand *phase_wand,
6505% const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00006506%
6507% A description of each parameter follows:
6508%
cristyc9550792009-11-13 20:05:42 +00006509% o magnitude_wand: the magnitude or real wand.
6510%
6511% o phase_wand: the phase or imaginary wand.
cristy3ed852e2009-09-05 21:47:34 +00006512%
6513% o magnitude: if true, return as magnitude / phase pair otherwise a real /
6514% imaginary image pair.
6515%
6516*/
6517WandExport MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00006518 MagickWand *magnitude_wand,MagickWand *phase_wand,
6519 const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00006520{
6521 Image
6522 *inverse_image;
6523
cristyc9550792009-11-13 20:05:42 +00006524 MagickWand
6525 *wand;
6526
6527 assert(magnitude_wand != (MagickWand *) NULL);
6528 assert(magnitude_wand->signature == WandSignature);
6529 if (magnitude_wand->debug != MagickFalse)
6530 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6531 magnitude_wand->name);
6532 wand=magnitude_wand;
6533 if (magnitude_wand->images == (Image *) NULL)
6534 ThrowWandException(WandError,"ContainsNoImages",
6535 magnitude_wand->name);
6536 assert(phase_wand != (MagickWand *) NULL);
6537 assert(phase_wand->signature == WandSignature);
6538 inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6539 phase_wand->images,magnitude,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006540 if (inverse_image == (Image *) NULL)
6541 return(MagickFalse);
6542 ReplaceImageInList(&wand->images,inverse_image);
6543 return(MagickTrue);
6544}
6545
6546/*
6547%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6548% %
6549% %
6550% %
6551% M a g i c k L a b e l I m a g e %
6552% %
6553% %
6554% %
6555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6556%
6557% MagickLabelImage() adds a label to your image.
6558%
6559% The format of the MagickLabelImage method is:
6560%
6561% MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6562%
6563% A description of each parameter follows:
6564%
6565% o wand: the magick wand.
6566%
6567% o label: the image label.
6568%
6569*/
6570WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6571 const char *label)
6572{
6573 MagickBooleanType
6574 status;
6575
6576 assert(wand != (MagickWand *) NULL);
6577 assert(wand->signature == WandSignature);
6578 if (wand->debug != MagickFalse)
6579 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6580 if (wand->images == (Image *) NULL)
6581 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6582 status=SetImageProperty(wand->images,"label",label);
6583 if (status == MagickFalse)
6584 InheritException(wand->exception,&wand->images->exception);
6585 return(status);
6586}
6587
6588/*
6589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6590% %
6591% %
6592% %
6593% M a g i c k L e v e l I m a g e %
6594% %
6595% %
6596% %
6597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6598%
6599% MagickLevelImage() adjusts the levels of an image by scaling the colors
6600% falling between specified white and black points to the full available
6601% quantum range. The parameters provided represent the black, mid, and white
6602% points. The black point specifies the darkest color in the image. Colors
6603% darker than the black point are set to zero. Mid point specifies a gamma
6604% correction to apply to the image. White point specifies the lightest color
6605% in the image. Colors brighter than the white point are set to the maximum
6606% quantum value.
6607%
6608% The format of the MagickLevelImage method is:
6609%
6610% MagickBooleanType MagickLevelImage(MagickWand *wand,
6611% const double black_point,const double gamma,const double white_point)
6612% MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6613% const ChannelType channel,const double black_point,const double gamma,
6614% const double white_point)
6615%
6616% A description of each parameter follows:
6617%
6618% o wand: the magick wand.
6619%
6620% o channel: Identify which channel to level: RedChannel, GreenChannel,
6621%
6622% o black_point: the black point.
6623%
6624% o gamma: the gamma.
6625%
6626% o white_point: the white point.
6627%
6628*/
6629
6630WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6631 const double black_point,const double gamma,const double white_point)
6632{
6633 MagickBooleanType
6634 status;
6635
6636 status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6637 white_point);
6638 return(status);
6639}
6640
6641WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6642 const ChannelType channel,const double black_point,const double gamma,
6643 const double white_point)
6644{
6645 MagickBooleanType
6646 status;
6647
6648 assert(wand != (MagickWand *) NULL);
6649 assert(wand->signature == WandSignature);
6650 if (wand->debug != MagickFalse)
6651 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6652 if (wand->images == (Image *) NULL)
6653 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6654 status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6655 if (status == MagickFalse)
6656 InheritException(wand->exception,&wand->images->exception);
6657 return(status);
6658}
6659
6660/*
6661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6662% %
6663% %
6664% %
6665% M a g i c k L i n e a r S t r e t c h I m a g e %
6666% %
6667% %
6668% %
6669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6670%
6671% MagickLinearStretchImage() stretches with saturation the image intensity.
6672%
6673% You can also reduce the influence of a particular channel with a gamma
6674% value of 0.
6675%
6676% The format of the MagickLinearStretchImage method is:
6677%
6678% MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6679% const double black_point,const double white_point)
6680%
6681% A description of each parameter follows:
6682%
6683% o wand: the magick wand.
6684%
6685% o black_point: the black point.
6686%
6687% o white_point: the white point.
6688%
6689*/
6690WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6691 const double black_point,const double white_point)
6692{
6693 MagickBooleanType
6694 status;
6695
6696 assert(wand != (MagickWand *) NULL);
6697 assert(wand->signature == WandSignature);
6698 if (wand->debug != MagickFalse)
6699 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6700 if (wand->images == (Image *) NULL)
6701 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6702 status=LinearStretchImage(wand->images,black_point,white_point);
6703 if (status == MagickFalse)
6704 InheritException(wand->exception,&wand->images->exception);
6705 return(status);
6706}
6707
6708/*
6709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6710% %
6711% %
6712% %
6713% M a g i c k L i q u i d R e s c a l e I m a g e %
6714% %
6715% %
6716% %
6717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6718%
6719% MagickLiquidRescaleImage() rescales image with seam carving.
6720%
6721% MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006722% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006723% const double delta_x,const double rigidity)
6724%
6725% A description of each parameter follows:
6726%
6727% o wand: the magick wand.
6728%
6729% o columns: the number of columns in the scaled image.
6730%
6731% o rows: the number of rows in the scaled image.
6732%
6733% o delta_x: maximum seam transversal step (0 means straight seams).
6734%
6735% o rigidity: introduce a bias for non-straight seams (typically 0).
6736%
6737*/
6738WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006739 const size_t columns,const size_t rows,const double delta_x,
cristy3ed852e2009-09-05 21:47:34 +00006740 const double rigidity)
6741{
6742 Image
6743 *rescale_image;
6744
6745 assert(wand != (MagickWand *) NULL);
6746 assert(wand->signature == WandSignature);
6747 if (wand->debug != MagickFalse)
6748 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6749 if (wand->images == (Image *) NULL)
6750 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6751 rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6752 rigidity,wand->exception);
6753 if (rescale_image == (Image *) NULL)
6754 return(MagickFalse);
6755 ReplaceImageInList(&wand->images,rescale_image);
6756 return(MagickTrue);
6757}
6758
6759/*
6760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6761% %
6762% %
6763% %
6764% M a g i c k M a g n i f y I m a g e %
6765% %
6766% %
6767% %
6768%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6769%
6770% MagickMagnifyImage() is a convenience method that scales an image
6771% proportionally to twice its original size.
6772%
6773% The format of the MagickMagnifyImage method is:
6774%
6775% MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6776%
6777% A description of each parameter follows:
6778%
6779% o wand: the magick wand.
6780%
6781*/
6782WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6783{
6784 Image
6785 *magnify_image;
6786
6787 assert(wand != (MagickWand *) NULL);
6788 assert(wand->signature == WandSignature);
6789 if (wand->debug != MagickFalse)
6790 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6791 if (wand->images == (Image *) NULL)
6792 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6793 magnify_image=MagnifyImage(wand->images,wand->exception);
6794 if (magnify_image == (Image *) NULL)
6795 return(MagickFalse);
6796 ReplaceImageInList(&wand->images,magnify_image);
6797 return(MagickTrue);
6798}
6799
6800/*
6801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6802% %
6803% %
6804% %
6805% M a g i c k M e d i a n F i l t e r I m a g e %
6806% %
6807% %
6808% %
6809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6810%
6811% MagickMedianFilterImage() applies a digital filter that improves the quality
6812% of a noisy image. Each pixel is replaced by the median in a set of
6813% neighboring pixels as defined by radius.
6814%
6815% The format of the MagickMedianFilterImage method is:
6816%
6817% MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6818% const double radius)
6819%
6820% A description of each parameter follows:
6821%
6822% o wand: the magick wand.
6823%
6824% o radius: the radius of the pixel neighborhood.
6825%
6826*/
6827WandExport MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6828 const double radius)
6829{
6830 Image
6831 *median_image;
6832
6833 assert(wand != (MagickWand *) NULL);
6834 assert(wand->signature == WandSignature);
6835 if (wand->debug != MagickFalse)
6836 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6837 if (wand->images == (Image *) NULL)
6838 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6839 median_image=MedianFilterImage(wand->images,radius,wand->exception);
6840 if (median_image == (Image *) NULL)
6841 return(MagickFalse);
6842 ReplaceImageInList(&wand->images,median_image);
6843 return(MagickTrue);
6844}
6845
6846/*
6847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6848% %
6849% %
6850% %
6851% M a g i c k M e r g e I m a g e L a y e r s %
6852% %
6853% %
6854% %
6855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6856%
6857% MagickMergeImageLayers() composes all the image layers from the current given
6858% image onward to produce a single image of the merged layers.
6859%
6860% The inital canvas's size depends on the given ImageLayerMethod, and is
6861% initialized using the first images background color. The images
6862% are then compositied onto that image in sequence using the given
6863% composition that has been assigned to each individual image.
6864%
6865% The format of the MagickMergeImageLayers method is:
6866%
6867% MagickWand *MagickMergeImageLayers(MagickWand *wand,
6868% const ImageLayerMethod method)
6869%
6870% A description of each parameter follows:
6871%
6872% o wand: the magick wand.
6873%
6874% o method: the method of selecting the size of the initial canvas.
6875%
6876% MergeLayer: Merge all layers onto a canvas just large enough
6877% to hold all the actual images. The virtual canvas of the
6878% first image is preserved but otherwise ignored.
6879%
6880% FlattenLayer: Use the virtual canvas size of first image.
6881% Images which fall outside this canvas is clipped.
6882% This can be used to 'fill out' a given virtual canvas.
6883%
6884% MosaicLayer: Start with the virtual canvas of the first image,
6885% enlarging left and right edges to contain all images.
6886% Images with negative offsets will be clipped.
6887%
6888*/
6889WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6890 const ImageLayerMethod method)
6891{
6892 Image
6893 *mosaic_image;
6894
6895 assert(wand != (MagickWand *) NULL);
6896 assert(wand->signature == WandSignature);
6897 if (wand->debug != MagickFalse)
6898 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6899 if (wand->images == (Image *) NULL)
6900 return((MagickWand *) NULL);
6901 mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6902 if (mosaic_image == (Image *) NULL)
6903 return((MagickWand *) NULL);
6904 return(CloneMagickWandFromImages(wand,mosaic_image));
6905}
6906
6907/*
6908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6909% %
6910% %
6911% %
6912% M a g i c k M i n i f y I m a g e %
6913% %
6914% %
6915% %
6916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6917%
6918% MagickMinifyImage() is a convenience method that scales an image
6919% proportionally to one-half its original size
6920%
6921% The format of the MagickMinifyImage method is:
6922%
6923% MagickBooleanType MagickMinifyImage(MagickWand *wand)
6924%
6925% A description of each parameter follows:
6926%
6927% o wand: the magick wand.
6928%
6929*/
6930WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6931{
6932 Image
6933 *minify_image;
6934
6935 assert(wand != (MagickWand *) NULL);
6936 assert(wand->signature == WandSignature);
6937 if (wand->debug != MagickFalse)
6938 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6939 if (wand->images == (Image *) NULL)
6940 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6941 minify_image=MinifyImage(wand->images,wand->exception);
6942 if (minify_image == (Image *) NULL)
6943 return(MagickFalse);
6944 ReplaceImageInList(&wand->images,minify_image);
6945 return(MagickTrue);
6946}
6947
6948/*
6949%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6950% %
6951% %
6952% %
6953% M a g i c k M o d u l a t e I m a g e %
6954% %
6955% %
6956% %
6957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6958%
6959% MagickModulateImage() lets you control the brightness, saturation, and hue
6960% of an image. Hue is the percentage of absolute rotation from the current
6961% position. For example 50 results in a counter-clockwise rotation of 90
6962% degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6963% both resulting in a rotation of 180 degrees.
6964%
6965% To increase the color brightness by 20% and decrease the color saturation by
6966% 10% and leave the hue unchanged, use: 120,90,100.
6967%
6968% The format of the MagickModulateImage method is:
6969%
6970% MagickBooleanType MagickModulateImage(MagickWand *wand,
6971% const double brightness,const double saturation,const double hue)
6972%
6973% A description of each parameter follows:
6974%
6975% o wand: the magick wand.
6976%
6977% o brightness: the percent change in brighness.
6978%
6979% o saturation: the percent change in saturation.
6980%
6981% o hue: the percent change in hue.
6982%
6983*/
6984WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6985 const double brightness,const double saturation,const double hue)
6986{
6987 char
6988 modulate[MaxTextExtent];
6989
6990 MagickBooleanType
6991 status;
6992
6993 assert(wand != (MagickWand *) NULL);
6994 assert(wand->signature == WandSignature);
6995 if (wand->debug != MagickFalse)
6996 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6997 if (wand->images == (Image *) NULL)
6998 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye7f51092010-01-17 00:39:37 +00006999 (void) FormatMagickString(modulate,MaxTextExtent,"%g,%g,%g",
cristy8cd5b312010-01-07 01:10:24 +00007000 brightness,saturation,hue);
cristy3ed852e2009-09-05 21:47:34 +00007001 status=ModulateImage(wand->images,modulate);
7002 if (status == MagickFalse)
7003 InheritException(wand->exception,&wand->images->exception);
7004 return(status);
7005}
7006
7007/*
7008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7009% %
7010% %
7011% %
7012% M a g i c k M o n t a g e I m a g e %
7013% %
7014% %
7015% %
7016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7017%
7018% MagickMontageImage() creates a composite image by combining several
7019% separate images. The images are tiled on the composite image with the name
7020% of the image optionally appearing just below the individual tile.
7021%
7022% The format of the MagickMontageImage method is:
7023%
7024% MagickWand *MagickMontageImage(MagickWand *wand,
7025% const DrawingWand drawing_wand,const char *tile_geometry,
7026% const char *thumbnail_geometry,const MontageMode mode,
7027% const char *frame)
7028%
7029% A description of each parameter follows:
7030%
7031% o wand: the magick wand.
7032%
7033% o drawing_wand: the drawing wand. The font name, size, and color are
7034% obtained from this wand.
7035%
7036% o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7037%
7038% o thumbnail_geometry: Preferred image size and border size of each
7039% thumbnail (e.g. 120x120+4+3>).
7040%
7041% o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7042%
7043% o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7044% The frame color is that of the thumbnail's matte color.
7045%
7046*/
7047WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7048 const DrawingWand *drawing_wand,const char *tile_geometry,
7049 const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7050{
7051 char
7052 *font;
7053
7054 Image
7055 *montage_image;
7056
7057 MontageInfo
7058 *montage_info;
7059
7060 PixelWand
7061 *pixel_wand;
7062
7063 assert(wand != (MagickWand *) NULL);
7064 assert(wand->signature == WandSignature);
7065 if (wand->debug != MagickFalse)
7066 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7067 if (wand->images == (Image *) NULL)
7068 return((MagickWand *) NULL);
7069 montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7070 switch (mode)
7071 {
7072 case FrameMode:
7073 {
7074 (void) CloneString(&montage_info->frame,"15x15+3+3");
7075 montage_info->shadow=MagickTrue;
7076 break;
7077 }
7078 case UnframeMode:
7079 {
7080 montage_info->frame=(char *) NULL;
7081 montage_info->shadow=MagickFalse;
7082 montage_info->border_width=0;
7083 break;
7084 }
7085 case ConcatenateMode:
7086 {
7087 montage_info->frame=(char *) NULL;
7088 montage_info->shadow=MagickFalse;
7089 (void) CloneString(&montage_info->geometry,"+0+0");
7090 montage_info->border_width=0;
7091 break;
7092 }
7093 default:
7094 break;
7095 }
7096 font=DrawGetFont(drawing_wand);
7097 if (font != (char *) NULL)
7098 (void) CloneString(&montage_info->font,font);
7099 if (frame != (char *) NULL)
7100 (void) CloneString(&montage_info->frame,frame);
7101 montage_info->pointsize=DrawGetFontSize(drawing_wand);
7102 pixel_wand=NewPixelWand();
7103 DrawGetFillColor(drawing_wand,pixel_wand);
7104 PixelGetQuantumColor(pixel_wand,&montage_info->fill);
7105 DrawGetStrokeColor(drawing_wand,pixel_wand);
7106 PixelGetQuantumColor(pixel_wand,&montage_info->stroke);
7107 pixel_wand=DestroyPixelWand(pixel_wand);
7108 if (thumbnail_geometry != (char *) NULL)
7109 (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7110 if (tile_geometry != (char *) NULL)
7111 (void) CloneString(&montage_info->tile,tile_geometry);
7112 montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7113 wand->exception);
7114 montage_info=DestroyMontageInfo(montage_info);
7115 if (montage_image == (Image *) NULL)
7116 return((MagickWand *) NULL);
7117 return(CloneMagickWandFromImages(wand,montage_image));
7118}
7119
7120/*
7121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7122% %
7123% %
7124% %
7125% M a g i c k M o r p h I m a g e s %
7126% %
7127% %
7128% %
7129%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7130%
7131% MagickMorphImages() method morphs a set of images. Both the image pixels
7132% and size are linearly interpolated to give the appearance of a
7133% meta-morphosis from one image to the next.
7134%
7135% The format of the MagickMorphImages method is:
7136%
7137% MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007138% const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00007139%
7140% A description of each parameter follows:
7141%
7142% o wand: the magick wand.
7143%
7144% o number_frames: the number of in-between images to generate.
7145%
7146*/
7147WandExport MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007148 const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00007149{
7150 Image
7151 *morph_image;
7152
7153 assert(wand != (MagickWand *) NULL);
7154 assert(wand->signature == WandSignature);
7155 if (wand->debug != MagickFalse)
7156 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7157 if (wand->images == (Image *) NULL)
7158 return((MagickWand *) NULL);
7159 morph_image=MorphImages(wand->images,number_frames,wand->exception);
7160 if (morph_image == (Image *) NULL)
7161 return((MagickWand *) NULL);
7162 return(CloneMagickWandFromImages(wand,morph_image));
7163}
7164
7165/*
7166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7167% %
7168% %
7169% %
cristya0b81c32010-01-22 02:54:33 +00007170% M a g i c k M o r p h o l o g y I m a g e %
7171% %
7172% %
7173% %
7174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7175%
7176% MagickMorphologyImage() applies a user supplied kernel to the image
7177% according to the given mophology method.
7178%
7179% The format of the MagickMorphologyImage method is:
7180%
7181% MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007182% MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00007183% MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007184% ChannelType channel,MorphologyMethod method,const ssize_t iterations,
cristya0b81c32010-01-22 02:54:33 +00007185% KernelInfo *kernel)
7186%
7187% A description of each parameter follows:
7188%
7189% o wand: the magick wand.
7190%
7191% o channel: the image channel(s).
7192%
7193% o method: the morphology method to be applied.
7194%
7195% o iterations: apply the operation this many times (or no change).
7196% A value of -1 means loop until no change found. How this is applied
7197% may depend on the morphology method. Typically this is a value of 1.
7198%
7199% o kernel: An array of doubles representing the morphology kernel.
7200%
7201*/
7202
7203WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007204 MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00007205{
7206 MagickBooleanType
7207 status;
7208
7209 status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7210 kernel);
7211 return(status);
7212}
7213
7214WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007215 const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
cristya0b81c32010-01-22 02:54:33 +00007216 KernelInfo *kernel)
7217{
7218 Image
7219 *morphology_image;
7220
7221 assert(wand != (MagickWand *) NULL);
7222 assert(wand->signature == WandSignature);
7223 if (wand->debug != MagickFalse)
7224 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7225 if (kernel == (const KernelInfo *) NULL)
7226 return(MagickFalse);
7227 if (wand->images == (Image *) NULL)
7228 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7229 morphology_image=MorphologyImageChannel(wand->images,channel,method,
7230 iterations,kernel,wand->exception);
7231 if (morphology_image == (Image *) NULL)
7232 return(MagickFalse);
7233 ReplaceImageInList(&wand->images,morphology_image);
7234 return(MagickTrue);
7235}
7236
7237/*
7238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7239% %
7240% %
7241% %
cristy3ed852e2009-09-05 21:47:34 +00007242% M a g i c k M o t i o n B l u r I m a g e %
7243% %
7244% %
7245% %
7246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7247%
7248% MagickMotionBlurImage() simulates motion blur. We convolve the image with a
7249% Gaussian operator of the given radius and standard deviation (sigma).
7250% For reasonable results, radius should be larger than sigma. Use a
7251% radius of 0 and MotionBlurImage() selects a suitable radius for you.
7252% Angle gives the angle of the blurring motion.
7253%
7254% The format of the MagickMotionBlurImage method is:
7255%
7256% MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7257% const double radius,const double sigma,const double angle)
7258% MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7259% const ChannelType channel,const double radius,const double sigma,
7260% const double angle)
7261%
7262% A description of each parameter follows:
7263%
7264% o wand: the magick wand.
7265%
7266% o channel: the image channel(s).
7267%
7268% o radius: the radius of the Gaussian, in pixels, not counting
7269% the center pixel.
7270%
7271% o sigma: the standard deviation of the Gaussian, in pixels.
7272%
cristycee97112010-05-28 00:44:52 +00007273% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00007274%
7275*/
7276
7277WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7278 const double radius,const double sigma,const double angle)
7279{
7280 MagickBooleanType
7281 status;
7282
7283 status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7284 return(status);
7285}
7286
7287WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7288 const ChannelType channel,const double radius,const double sigma,
7289 const double angle)
7290{
7291 Image
7292 *blur_image;
7293
7294 assert(wand != (MagickWand *) NULL);
7295 assert(wand->signature == WandSignature);
7296 if (wand->debug != MagickFalse)
7297 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7298 if (wand->images == (Image *) NULL)
7299 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7300 blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7301 wand->exception);
7302 if (blur_image == (Image *) NULL)
7303 return(MagickFalse);
7304 ReplaceImageInList(&wand->images,blur_image);
7305 return(MagickTrue);
7306}
7307
7308/*
7309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7310% %
7311% %
7312% %
7313% M a g i c k N e g a t e I m a g e %
7314% %
7315% %
7316% %
7317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7318%
7319% MagickNegateImage() negates the colors in the reference image. The
7320% Grayscale option means that only grayscale values within the image are
7321% negated.
7322%
7323% You can also reduce the influence of a particular channel with a gamma
7324% value of 0.
7325%
7326% The format of the MagickNegateImage method is:
7327%
7328% MagickBooleanType MagickNegateImage(MagickWand *wand,
7329% const MagickBooleanType gray)
7330% MagickBooleanType MagickNegateImage(MagickWand *wand,
7331% const ChannelType channel,const MagickBooleanType gray)
7332%
7333% A description of each parameter follows:
7334%
7335% o wand: the magick wand.
7336%
7337% o channel: the image channel(s).
7338%
7339% o gray: If MagickTrue, only negate grayscale pixels within the image.
7340%
7341*/
7342
7343WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7344 const MagickBooleanType gray)
7345{
7346 MagickBooleanType
7347 status;
7348
7349 status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7350 return(status);
7351}
7352
7353WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7354 const ChannelType channel,const MagickBooleanType gray)
7355{
7356 MagickBooleanType
7357 status;
7358
7359 assert(wand != (MagickWand *) NULL);
7360 assert(wand->signature == WandSignature);
7361 if (wand->debug != MagickFalse)
7362 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7363 if (wand->images == (Image *) NULL)
7364 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7365 status=NegateImageChannel(wand->images,channel,gray);
7366 if (status == MagickFalse)
7367 InheritException(wand->exception,&wand->images->exception);
7368 return(status);
7369}
7370
7371/*
7372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7373% %
7374% %
7375% %
7376% M a g i c k N e w I m a g e %
7377% %
7378% %
7379% %
7380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7381%
7382% MagickNewImage() adds a blank image canvas of the specified size and
7383% background color to the wand.
7384%
7385% The format of the MagickNewImage method is:
7386%
7387% MagickBooleanType MagickNewImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007388% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00007389% const PixelWand *background)
7390%
7391% A description of each parameter follows:
7392%
7393% o wand: the magick wand.
7394%
7395% o width: the image width.
7396%
7397% o height: the image height.
7398%
7399% o background: the image color.
7400%
7401*/
7402WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007403 const size_t width,const size_t height,
cristy3ed852e2009-09-05 21:47:34 +00007404 const PixelWand *background)
7405{
7406 Image
7407 *images;
7408
7409 MagickPixelPacket
7410 pixel;
7411
7412 assert(wand != (MagickWand *) NULL);
7413 assert(wand->signature == WandSignature);
7414 if (wand->debug != MagickFalse)
7415 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7416 PixelGetMagickColor(background,&pixel);
7417 images=NewMagickImage(wand->image_info,width,height,&pixel);
7418 if (images == (Image *) NULL)
7419 return(MagickFalse);
7420 if (images->exception.severity != UndefinedException)
7421 InheritException(wand->exception,&images->exception);
7422 return(InsertImageInWand(wand,images));
7423}
7424
7425/*
7426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7427% %
7428% %
7429% %
7430% M a g i c k N e x t I m a g e %
7431% %
7432% %
7433% %
7434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7435%
7436% MagickNextImage() associates the next image in the image list with a magick
7437% wand.
7438%
7439% The format of the MagickNextImage method is:
7440%
7441% MagickBooleanType MagickNextImage(MagickWand *wand)
7442%
7443% A description of each parameter follows:
7444%
7445% o wand: the magick wand.
7446%
7447*/
7448WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7449{
7450 assert(wand != (MagickWand *) NULL);
7451 assert(wand->signature == WandSignature);
7452 if (wand->debug != MagickFalse)
7453 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7454 if (wand->images == (Image *) NULL)
7455 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7456 if (wand->pend != MagickFalse)
7457 {
7458 wand->pend=MagickFalse;
7459 return(MagickTrue);
7460 }
7461 if (GetNextImageInList(wand->images) == (Image *) NULL)
7462 {
7463 wand->pend=MagickTrue;
7464 return(MagickFalse);
7465 }
7466 wand->images=GetNextImageInList(wand->images);
7467 return(MagickTrue);
7468}
7469
7470/*
7471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7472% %
7473% %
7474% %
7475% M a g i c k N o r m a l i z e I m a g e %
7476% %
7477% %
7478% %
7479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7480%
7481% MagickNormalizeImage() enhances the contrast of a color image by adjusting
7482% the pixels color to span the entire range of colors available
7483%
7484% You can also reduce the influence of a particular channel with a gamma
7485% value of 0.
7486%
7487% The format of the MagickNormalizeImage method is:
7488%
7489% MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7490% MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7491% const ChannelType channel)
7492%
7493% A description of each parameter follows:
7494%
7495% o wand: the magick wand.
7496%
7497% o channel: the image channel(s).
7498%
7499*/
7500
7501WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7502{
7503 MagickBooleanType
7504 status;
7505
7506 status=MagickNormalizeImageChannel(wand,DefaultChannels);
7507 return(status);
7508}
7509
7510WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7511 const ChannelType channel)
7512{
7513 MagickBooleanType
7514 status;
7515
7516 assert(wand != (MagickWand *) NULL);
7517 assert(wand->signature == WandSignature);
7518 if (wand->debug != MagickFalse)
7519 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7520 if (wand->images == (Image *) NULL)
7521 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7522 status=NormalizeImageChannel(wand->images,channel);
7523 if (status == MagickFalse)
7524 InheritException(wand->exception,&wand->images->exception);
7525 return(status);
7526}
7527
7528/*
7529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7530% %
7531% %
7532% %
7533% M a g i c k O i l P a i n t I m a g e %
7534% %
7535% %
7536% %
7537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7538%
7539% MagickOilPaintImage() applies a special effect filter that simulates an oil
7540% painting. Each pixel is replaced by the most frequent color occurring
7541% in a circular region defined by radius.
7542%
7543% The format of the MagickOilPaintImage method is:
7544%
7545% MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7546% const double radius)
7547%
7548% A description of each parameter follows:
7549%
7550% o wand: the magick wand.
7551%
7552% o radius: the radius of the circular neighborhood.
7553%
7554*/
7555WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7556 const double radius)
7557{
7558 Image
7559 *paint_image;
7560
7561 assert(wand != (MagickWand *) NULL);
7562 assert(wand->signature == WandSignature);
7563 if (wand->debug != MagickFalse)
7564 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7565 if (wand->images == (Image *) NULL)
7566 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7567 paint_image=OilPaintImage(wand->images,radius,wand->exception);
7568 if (paint_image == (Image *) NULL)
7569 return(MagickFalse);
7570 ReplaceImageInList(&wand->images,paint_image);
7571 return(MagickTrue);
7572}
7573
7574/*
7575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7576% %
7577% %
7578% %
7579% M a g i c k O p a q u e P a i n t I m a g e %
7580% %
7581% %
7582% %
7583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7584%
7585% MagickOpaquePaintImage() changes any pixel that matches color with the color
7586% defined by fill.
7587%
7588% The format of the MagickOpaquePaintImage method is:
7589%
7590% MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7591% const PixelWand *target,const PixelWand *fill,const double fuzz,
7592% const MagickBooleanType invert)
7593% MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7594% const ChannelType channel,const PixelWand *target,
7595% const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7596%
7597% A description of each parameter follows:
7598%
7599% o wand: the magick wand.
7600%
7601% o channel: the channel(s).
7602%
7603% o target: Change this target color to the fill color within the image.
7604%
7605% o fill: the fill pixel wand.
7606%
7607% o fuzz: By default target must match a particular pixel color
7608% exactly. However, in many cases two colors may differ by a small amount.
7609% The fuzz member of image defines how much tolerance is acceptable to
7610% consider two colors as the same. For example, set fuzz to 10 and the
7611% color red at intensities of 100 and 102 respectively are now interpreted
7612% as the same color for the purposes of the floodfill.
7613%
7614% o invert: paint any pixel that does not match the target color.
7615%
7616*/
7617
7618WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7619 const PixelWand *target,const PixelWand *fill,const double fuzz,
7620 const MagickBooleanType invert)
7621{
7622 MagickBooleanType
7623 status;
7624
7625 status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7626 invert);
7627 return(status);
7628}
7629
7630WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7631 const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7632 const double fuzz,const MagickBooleanType invert)
7633{
7634 MagickBooleanType
7635 status;
7636
7637 MagickPixelPacket
7638 fill_pixel,
7639 target_pixel;
7640
7641 assert(wand != (MagickWand *) NULL);
7642 assert(wand->signature == WandSignature);
7643 if (wand->debug != MagickFalse)
7644 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7645 if (wand->images == (Image *) NULL)
7646 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7647 PixelGetMagickColor(target,&target_pixel);
7648 PixelGetMagickColor(fill,&fill_pixel);
7649 wand->images->fuzz=fuzz;
7650 status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7651 &fill_pixel,invert);
7652 if (status == MagickFalse)
7653 InheritException(wand->exception,&wand->images->exception);
7654 return(status);
7655}
7656
7657/*
7658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7659% %
7660% %
7661% %
7662% 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 %
7663% %
7664% %
7665% %
7666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7667%
7668% MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7669% previous image in the sequence. From this it attempts to select the
7670% smallest cropped image to replace each frame, while preserving the results
7671% of the animation.
7672%
7673% The format of the MagickOptimizeImageLayers method is:
7674%
7675% MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7676%
7677% A description of each parameter follows:
7678%
7679% o wand: the magick wand.
7680%
7681*/
7682WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7683{
7684 Image
7685 *optimize_image;
7686
7687 assert(wand != (MagickWand *) NULL);
7688 assert(wand->signature == WandSignature);
7689 if (wand->debug != MagickFalse)
7690 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7691 if (wand->images == (Image *) NULL)
7692 return((MagickWand *) NULL);
7693 optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7694 if (optimize_image == (Image *) NULL)
7695 return((MagickWand *) NULL);
7696 return(CloneMagickWandFromImages(wand,optimize_image));
7697}
7698
7699/*
7700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7701% %
7702% %
7703% %
7704% M a g i c k O r d e r e d P o s t e r i z e I m a g e %
7705% %
7706% %
7707% %
7708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7709%
7710% MagickOrderedPosterizeImage() performs an ordered dither based on a number
7711% of pre-defined dithering threshold maps, but over multiple intensity levels,
7712% which can be different for different channels, according to the input
7713% arguments.
7714%
7715% The format of the MagickOrderedPosterizeImage method is:
7716%
7717% MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7718% const char *threshold_map)
7719% MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7720% const ChannelType channel,const char *threshold_map)
7721%
7722% A description of each parameter follows:
7723%
7724% o image: the image.
7725%
7726% o channel: the channel or channels to be thresholded.
7727%
7728% o threshold_map: A string containing the name of the threshold dither
7729% map to use, followed by zero or more numbers representing the number of
7730% color levels tho dither between.
7731%
7732% Any level number less than 2 is equivelent to 2, and means only binary
7733% dithering will be applied to each color channel.
7734%
7735% No numbers also means a 2 level (bitmap) dither will be applied to all
7736% channels, while a single number is the number of levels applied to each
7737% channel in sequence. More numbers will be applied in turn to each of
7738% the color channels.
7739%
7740% For example: "o3x3,6" generates a 6 level posterization of the image
7741% with a ordered 3x3 diffused pixel dither being applied between each
7742% level. While checker,8,8,4 will produce a 332 colormaped image with
7743% only a single checkerboard hash pattern (50% grey) between each color
7744% level, to basically double the number of color levels with a bare
7745% minimim of dithering.
7746%
7747*/
7748
7749WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7750 const char *threshold_map)
7751{
7752 MagickBooleanType
7753 status;
7754
7755 status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7756 return(status);
7757}
7758
7759WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7760 MagickWand *wand,const ChannelType channel,const char *threshold_map)
7761{
7762 MagickBooleanType
7763 status;
7764
7765 assert(wand != (MagickWand *) NULL);
7766 assert(wand->signature == WandSignature);
7767 if (wand->debug != MagickFalse)
7768 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7769 if (wand->images == (Image *) NULL)
7770 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7771 status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7772 wand->exception);
7773 return(status);
7774}
7775
7776/*
7777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7778% %
7779% %
7780% %
7781% M a g i c k P i n g I m a g e %
7782% %
7783% %
7784% %
7785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7786%
7787% MagickPingImage() is like MagickReadImage() except the only valid
7788% information returned is the image width, height, size, and format. It
7789% is designed to efficiently obtain this information from a file without
7790% reading the entire image sequence into memory.
7791%
7792% The format of the MagickPingImage method is:
7793%
7794% MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7795%
7796% A description of each parameter follows:
7797%
7798% o wand: the magick wand.
7799%
7800% o filename: the image filename.
7801%
7802*/
7803WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7804 const char *filename)
7805{
7806 Image
7807 *images;
7808
7809 ImageInfo
7810 *ping_info;
7811
7812 assert(wand != (MagickWand *) NULL);
7813 assert(wand->signature == WandSignature);
7814 if (wand->debug != MagickFalse)
7815 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7816 ping_info=CloneImageInfo(wand->image_info);
7817 if (filename != (const char *) NULL)
7818 (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7819 images=PingImage(ping_info,wand->exception);
7820 ping_info=DestroyImageInfo(ping_info);
7821 if (images == (Image *) NULL)
7822 return(MagickFalse);
7823 return(InsertImageInWand(wand,images));
7824}
7825
7826/*
7827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7828% %
7829% %
7830% %
7831% M a g i c k P i n g I m a g e B l o b %
7832% %
7833% %
7834% %
7835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7836%
7837% MagickPingImageBlob() pings an image or image sequence from a blob.
7838%
7839% The format of the MagickPingImageBlob method is:
7840%
7841% MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7842% const void *blob,const size_t length)
7843%
7844% A description of each parameter follows:
7845%
7846% o wand: the magick wand.
7847%
7848% o blob: the blob.
7849%
7850% o length: the blob length.
7851%
7852*/
7853WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7854 const void *blob,const size_t length)
7855{
7856 Image
7857 *images;
7858
7859 ImageInfo
7860 *read_info;
7861
7862 assert(wand != (MagickWand *) NULL);
7863 assert(wand->signature == WandSignature);
7864 if (wand->debug != MagickFalse)
7865 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7866 read_info=CloneImageInfo(wand->image_info);
7867 SetImageInfoBlob(read_info,blob,length);
7868 images=PingImage(read_info,wand->exception);
7869 read_info=DestroyImageInfo(read_info);
7870 if (images == (Image *) NULL)
7871 return(MagickFalse);
7872 return(InsertImageInWand(wand,images));
7873}
7874
7875/*
7876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7877% %
7878% %
7879% %
7880% M a g i c k P i n g I m a g e F i l e %
7881% %
7882% %
7883% %
7884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7885%
7886% MagickPingImageFile() pings an image or image sequence from an open file
7887% descriptor.
7888%
7889% The format of the MagickPingImageFile method is:
7890%
7891% MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7892%
7893% A description of each parameter follows:
7894%
7895% o wand: the magick wand.
7896%
7897% o file: the file descriptor.
7898%
7899*/
7900WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7901{
7902 Image
7903 *images;
7904
7905 ImageInfo
7906 *read_info;
7907
7908 assert(wand != (MagickWand *) NULL);
7909 assert(wand->signature == WandSignature);
7910 assert(file != (FILE *) NULL);
7911 if (wand->debug != MagickFalse)
7912 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7913 read_info=CloneImageInfo(wand->image_info);
7914 SetImageInfoFile(read_info,file);
7915 images=PingImage(read_info,wand->exception);
7916 read_info=DestroyImageInfo(read_info);
7917 if (images == (Image *) NULL)
7918 return(MagickFalse);
7919 return(InsertImageInWand(wand,images));
7920}
7921
7922/*
7923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7924% %
7925% %
7926% %
7927% M a g i c k P o l a r o i d I m a g e %
7928% %
7929% %
7930% %
7931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7932%
7933% MagickPolaroidImage() simulates a Polaroid picture.
7934%
7935% The format of the MagickPolaroidImage method is:
7936%
7937% MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7938% const DrawingWand *drawing_wand,const double angle)
7939%
7940% A description of each parameter follows:
7941%
7942% o wand: the magick wand.
7943%
7944% o drawing_wand: the draw wand.
7945%
cristycee97112010-05-28 00:44:52 +00007946% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00007947%
7948*/
7949WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7950 const DrawingWand *drawing_wand,const double angle)
7951{
7952 DrawInfo
7953 *draw_info;
7954
7955 Image
7956 *polaroid_image;
7957
7958 assert(wand != (MagickWand *) NULL);
7959 assert(wand->signature == WandSignature);
7960 if (wand->debug != MagickFalse)
7961 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7962 if (wand->images == (Image *) NULL)
7963 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7964 draw_info=PeekDrawingWand(drawing_wand);
7965 if (draw_info == (DrawInfo *) NULL)
7966 return(MagickFalse);
7967 polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7968 if (polaroid_image == (Image *) NULL)
7969 return(MagickFalse);
7970 ReplaceImageInList(&wand->images,polaroid_image);
7971 return(MagickTrue);
7972}
7973
7974/*
7975%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7976% %
7977% %
7978% %
7979% M a g i c k P o s t e r i z e I m a g e %
7980% %
7981% %
7982% %
7983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7984%
7985% MagickPosterizeImage() reduces the image to a limited number of color level.
7986%
7987% The format of the MagickPosterizeImage method is:
7988%
7989% MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7990% const unsigned levels,const MagickBooleanType dither)
7991%
7992% A description of each parameter follows:
7993%
7994% o wand: the magick wand.
7995%
7996% o levels: Number of color levels allowed in each channel. Very low values
7997% (2, 3, or 4) have the most visible effect.
7998%
7999% o dither: Set this integer value to something other than zero to dither
8000% the mapped image.
8001%
8002*/
8003WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008004 const size_t levels,const MagickBooleanType dither)
cristy3ed852e2009-09-05 21:47:34 +00008005{
8006 MagickBooleanType
8007 status;
8008
8009 assert(wand != (MagickWand *) NULL);
8010 assert(wand->signature == WandSignature);
8011 if (wand->debug != MagickFalse)
8012 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8013 if (wand->images == (Image *) NULL)
8014 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8015 status=PosterizeImage(wand->images,levels,dither);
8016 if (status == MagickFalse)
8017 InheritException(wand->exception,&wand->images->exception);
8018 return(status);
8019}
8020
8021/*
8022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8023% %
8024% %
8025% %
8026% M a g i c k P r e v i e w I m a g e s %
8027% %
8028% %
8029% %
8030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8031%
8032% MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8033% image processing operation applied at varying strengths. This helpful
8034% to quickly pin-point an appropriate parameter for an image processing
8035% operation.
8036%
8037% The format of the MagickPreviewImages method is:
8038%
8039% MagickWand *MagickPreviewImages(MagickWand *wand,
8040% const PreviewType preview)
8041%
8042% A description of each parameter follows:
8043%
8044% o wand: the magick wand.
8045%
8046% o preview: the preview type.
8047%
8048*/
8049WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8050 const PreviewType preview)
8051{
8052 Image
8053 *preview_image;
8054
8055 assert(wand != (MagickWand *) NULL);
8056 assert(wand->signature == WandSignature);
8057 if (wand->debug != MagickFalse)
8058 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8059 if (wand->images == (Image *) NULL)
8060 return((MagickWand *) NULL);
8061 preview_image=PreviewImage(wand->images,preview,wand->exception);
8062 if (preview_image == (Image *) NULL)
8063 return((MagickWand *) NULL);
8064 return(CloneMagickWandFromImages(wand,preview_image));
8065}
8066
8067/*
8068%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8069% %
8070% %
8071% %
8072% M a g i c k P r e v i o u s I m a g e %
8073% %
8074% %
8075% %
8076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8077%
8078% MagickPreviousImage() assocates the previous image in an image list with
8079% the magick wand.
8080%
8081% The format of the MagickPreviousImage method is:
8082%
8083% MagickBooleanType MagickPreviousImage(MagickWand *wand)
8084%
8085% A description of each parameter follows:
8086%
8087% o wand: the magick wand.
8088%
8089*/
8090WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8091{
8092 assert(wand != (MagickWand *) NULL);
8093 assert(wand->signature == WandSignature);
8094 if (wand->debug != MagickFalse)
8095 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8096 if (wand->images == (Image *) NULL)
8097 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8098 if (wand->pend != MagickFalse)
8099 {
8100 wand->pend=MagickFalse;
8101 return(MagickTrue);
8102 }
8103 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8104 {
8105 wand->pend=MagickTrue;
8106 return(MagickFalse);
8107 }
8108 wand->images=GetPreviousImageInList(wand->images);
8109 return(MagickTrue);
8110}
8111
8112/*
8113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8114% %
8115% %
8116% %
8117% M a g i c k Q u a n t i z e I m a g e %
8118% %
8119% %
8120% %
8121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8122%
8123% MagickQuantizeImage() analyzes the colors within a reference image and
8124% chooses a fixed number of colors to represent the image. The goal of the
8125% algorithm is to minimize the color difference between the input and output
8126% image while minimizing the processing time.
8127%
8128% The format of the MagickQuantizeImage method is:
8129%
8130% MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008131% const size_t number_colors,const ColorspaceType colorspace,
8132% const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00008133% const MagickBooleanType measure_error)
8134%
8135% A description of each parameter follows:
8136%
8137% o wand: the magick wand.
8138%
8139% o number_colors: the number of colors.
8140%
8141% o colorspace: Perform color reduction in this colorspace, typically
8142% RGBColorspace.
8143%
8144% o treedepth: Normally, this integer value is zero or one. A zero or
8145% 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
8146% reference image with the least amount of memory and the fastest
8147% computational speed. In some cases, such as an image with low color
8148% dispersion (a few number of colors), a value other than
8149% Log4(number_colors) is required. To expand the color tree completely,
8150% use a value of 8.
8151%
8152% o dither: A value other than zero distributes the difference between an
8153% original image and the corresponding color reduced image to
cristycee97112010-05-28 00:44:52 +00008154% neighboring pixels along a Hilbert curve.
cristy3ed852e2009-09-05 21:47:34 +00008155%
8156% o measure_error: A value other than zero measures the difference between
8157% the original and quantized images. This difference is the total
8158% quantization error. The error is computed by summing over all pixels
8159% in an image the distance squared in RGB space between each reference
8160% pixel value and its quantized value.
8161%
8162*/
8163WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008164 const size_t number_colors,const ColorspaceType colorspace,
8165 const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00008166 const MagickBooleanType measure_error)
8167{
8168 MagickBooleanType
8169 status;
8170
8171 QuantizeInfo
8172 *quantize_info;
8173
8174 assert(wand != (MagickWand *) NULL);
8175 assert(wand->signature == WandSignature);
8176 if (wand->debug != MagickFalse)
8177 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8178 if (wand->images == (Image *) NULL)
8179 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8180 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8181 quantize_info->number_colors=number_colors;
8182 quantize_info->dither=dither;
8183 quantize_info->tree_depth=treedepth;
8184 quantize_info->colorspace=colorspace;
8185 quantize_info->measure_error=measure_error;
8186 status=QuantizeImage(quantize_info,wand->images);
8187 if (status == MagickFalse)
8188 InheritException(wand->exception,&wand->images->exception);
8189 quantize_info=DestroyQuantizeInfo(quantize_info);
8190 return(status);
8191}
8192
8193/*
8194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8195% %
8196% %
8197% %
8198% M a g i c k Q u a n t i z e I m a g e s %
8199% %
8200% %
8201% %
8202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8203%
8204% MagickQuantizeImages() analyzes the colors within a sequence of images and
8205% chooses a fixed number of colors to represent the image. The goal of the
8206% algorithm is to minimize the color difference between the input and output
8207% image while minimizing the processing time.
8208%
8209% The format of the MagickQuantizeImages method is:
8210%
8211% MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008212% const size_t number_colors,const ColorspaceType colorspace,
8213% const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00008214% const MagickBooleanType measure_error)
8215%
8216% A description of each parameter follows:
8217%
8218% o wand: the magick wand.
8219%
8220% o number_colors: the number of colors.
8221%
8222% o colorspace: Perform color reduction in this colorspace, typically
8223% RGBColorspace.
8224%
8225% o treedepth: Normally, this integer value is zero or one. A zero or
8226% 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
8227% reference image with the least amount of memory and the fastest
8228% computational speed. In some cases, such as an image with low color
8229% dispersion (a few number of colors), a value other than
8230% Log4(number_colors) is required. To expand the color tree completely,
8231% use a value of 8.
8232%
8233% o dither: A value other than zero distributes the difference between an
8234% original image and the corresponding color reduced algorithm to
cristycee97112010-05-28 00:44:52 +00008235% neighboring pixels along a Hilbert curve.
cristy3ed852e2009-09-05 21:47:34 +00008236%
8237% o measure_error: A value other than zero measures the difference between
8238% the original and quantized images. This difference is the total
8239% quantization error. The error is computed by summing over all pixels
8240% in an image the distance squared in RGB space between each reference
8241% pixel value and its quantized value.
8242%
8243*/
8244WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008245 const size_t number_colors,const ColorspaceType colorspace,
8246 const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00008247 const MagickBooleanType measure_error)
8248{
8249 MagickBooleanType
8250 status;
8251
8252 QuantizeInfo
8253 *quantize_info;
8254
8255 assert(wand != (MagickWand *) NULL);
8256 assert(wand->signature == WandSignature);
8257 if (wand->debug != MagickFalse)
8258 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8259 if (wand->images == (Image *) NULL)
8260 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8261 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8262 quantize_info->number_colors=number_colors;
8263 quantize_info->dither=dither;
8264 quantize_info->tree_depth=treedepth;
8265 quantize_info->colorspace=colorspace;
8266 quantize_info->measure_error=measure_error;
8267 status=QuantizeImages(quantize_info,wand->images);
8268 if (status == MagickFalse)
8269 InheritException(wand->exception,&wand->images->exception);
8270 quantize_info=DestroyQuantizeInfo(quantize_info);
8271 return(status);
8272}
8273
8274/*
8275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8276% %
8277% %
8278% %
8279% M a g i c k R a d i a l B l u r I m a g e %
8280% %
8281% %
8282% %
8283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8284%
8285% MagickRadialBlurImage() radial blurs an image.
8286%
8287% The format of the MagickRadialBlurImage method is:
8288%
8289% MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8290% const double angle)
8291% MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8292% const ChannelType channel,const double angle)
8293%
8294% A description of each parameter follows:
8295%
8296% o wand: the magick wand.
8297%
8298% o channel: the image channel(s).
8299%
8300% o angle: the angle of the blur in degrees.
8301%
8302*/
8303WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8304 const double angle)
8305{
8306 MagickBooleanType
8307 status;
8308
8309 status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8310 return(status);
8311}
8312
8313WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8314 const ChannelType channel,const double angle)
8315{
8316 Image
8317 *blur_image;
8318
8319 assert(wand != (MagickWand *) NULL);
8320 assert(wand->signature == WandSignature);
8321 if (wand->debug != MagickFalse)
8322 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8323 if (wand->images == (Image *) NULL)
8324 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8325 blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8326 wand->exception);
8327 if (blur_image == (Image *) NULL)
8328 return(MagickFalse);
8329 ReplaceImageInList(&wand->images,blur_image);
8330 return(MagickTrue);
8331}
8332
8333/*
8334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8335% %
8336% %
8337% %
8338% M a g i c k R a i s e I m a g e %
8339% %
8340% %
8341% %
8342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8343%
8344% MagickRaiseImage() creates a simulated three-dimensional button-like effect
8345% by lightening and darkening the edges of the image. Members width and
8346% height of raise_info define the width of the vertical and horizontal
8347% edge of the effect.
8348%
8349% The format of the MagickRaiseImage method is:
8350%
8351% MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008352% const size_t width,const size_t height,const ssize_t x,
8353% const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00008354%
8355% A description of each parameter follows:
8356%
8357% o wand: the magick wand.
8358%
8359% o width,height,x,y: Define the dimensions of the area to raise.
8360%
8361% o raise: A value other than zero creates a 3-D raise effect,
8362% otherwise it has a lowered effect.
8363%
8364*/
8365WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008366 const size_t width,const size_t height,const ssize_t x,
8367 const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00008368{
8369 MagickBooleanType
8370 status;
8371
8372 RectangleInfo
8373 raise_info;
8374
8375 assert(wand != (MagickWand *) NULL);
8376 assert(wand->signature == WandSignature);
8377 if (wand->debug != MagickFalse)
8378 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8379 if (wand->images == (Image *) NULL)
8380 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8381 raise_info.width=width;
8382 raise_info.height=height;
8383 raise_info.x=x;
8384 raise_info.y=y;
8385 status=RaiseImage(wand->images,&raise_info,raise);
8386 if (status == MagickFalse)
8387 InheritException(wand->exception,&wand->images->exception);
8388 return(status);
8389}
8390
8391/*
8392%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8393% %
8394% %
8395% %
8396% 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 %
8397% %
8398% %
8399% %
8400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8401%
8402% MagickRandomThresholdImage() changes the value of individual pixels based on
8403% the intensity of each pixel compared to threshold. The result is a
8404% high-contrast, two color image.
8405%
8406% The format of the MagickRandomThresholdImage method is:
8407%
8408% MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8409% const double low,const double high)
8410% MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8411% const ChannelType channel,const double low,const double high)
8412%
8413% A description of each parameter follows:
8414%
8415% o wand: the magick wand.
8416%
8417% o channel: the image channel(s).
8418%
8419% o low,high: Specify the high and low thresholds. These values range from
8420% 0 to QuantumRange.
8421%
8422*/
8423
8424WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8425 const double low,const double high)
8426{
8427 MagickBooleanType
8428 status;
8429
8430 status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8431 return(status);
8432}
8433
8434WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8435 MagickWand *wand,const ChannelType channel,const double low,
8436 const double high)
8437{
8438 char
8439 threshold[MaxTextExtent];
8440
8441 MagickBooleanType
8442 status;
8443
8444 assert(wand != (MagickWand *) NULL);
8445 assert(wand->signature == WandSignature);
8446 if (wand->debug != MagickFalse)
8447 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8448 if (wand->images == (Image *) NULL)
8449 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye7f51092010-01-17 00:39:37 +00008450 (void) FormatMagickString(threshold,MaxTextExtent,"%gx%g",low,high);
cristy3ed852e2009-09-05 21:47:34 +00008451 status=RandomThresholdImageChannel(wand->images,channel,threshold,
8452 wand->exception);
8453 if (status == MagickFalse)
8454 InheritException(wand->exception,&wand->images->exception);
8455 return(status);
8456}
8457
8458/*
8459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8460% %
8461% %
8462% %
8463% M a g i c k R e a d I m a g e %
8464% %
8465% %
8466% %
8467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8468%
8469% MagickReadImage() reads an image or image sequence. The images are inserted
8470% at the current image pointer position. Use MagickSetFirstIterator(),
8471% MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8472% image pointer position at the beginning of the image list, the end, or
8473% anywhere in-between respectively.
8474%
8475% The format of the MagickReadImage method is:
8476%
8477% MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8478%
8479% A description of each parameter follows:
8480%
8481% o wand: the magick wand.
8482%
8483% o filename: the image filename.
8484%
8485*/
8486WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8487 const char *filename)
8488{
8489 Image
8490 *images;
8491
8492 ImageInfo
8493 *read_info;
8494
8495 assert(wand != (MagickWand *) NULL);
8496 assert(wand->signature == WandSignature);
8497 if (wand->debug != MagickFalse)
8498 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8499 read_info=CloneImageInfo(wand->image_info);
8500 if (filename != (const char *) NULL)
8501 (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8502 images=ReadImage(read_info,wand->exception);
8503 read_info=DestroyImageInfo(read_info);
8504 if (images == (Image *) NULL)
8505 return(MagickFalse);
8506 return(InsertImageInWand(wand,images));
8507}
8508
8509/*
8510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8511% %
8512% %
8513% %
8514% M a g i c k R e a d I m a g e B l o b %
8515% %
8516% %
8517% %
8518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8519%
8520% MagickReadImageBlob() reads an image or image sequence from a blob.
8521%
8522% The format of the MagickReadImageBlob method is:
8523%
8524% MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8525% const void *blob,const size_t length)
8526%
8527% A description of each parameter follows:
8528%
8529% o wand: the magick wand.
8530%
8531% o blob: the blob.
8532%
8533% o length: the blob length.
8534%
8535*/
8536WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8537 const void *blob,const size_t length)
8538{
8539 Image
8540 *images;
8541
8542 assert(wand != (MagickWand *) NULL);
8543 assert(wand->signature == WandSignature);
8544 if (wand->debug != MagickFalse)
8545 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8546 images=BlobToImage(wand->image_info,blob,length,wand->exception);
8547 if (images == (Image *) NULL)
8548 return(MagickFalse);
8549 return(InsertImageInWand(wand,images));
8550}
8551
8552/*
8553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8554% %
8555% %
8556% %
8557% M a g i c k R e a d I m a g e F i l e %
8558% %
8559% %
8560% %
8561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8562%
8563% MagickReadImageFile() reads an image or image sequence from an open file
8564% descriptor.
8565%
8566% The format of the MagickReadImageFile method is:
8567%
8568% MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8569%
8570% A description of each parameter follows:
8571%
8572% o wand: the magick wand.
8573%
8574% o file: the file descriptor.
8575%
8576*/
8577WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8578{
8579 Image
8580 *images;
8581
8582 ImageInfo
8583 *read_info;
8584
8585 assert(wand != (MagickWand *) NULL);
8586 assert(wand->signature == WandSignature);
8587 assert(file != (FILE *) NULL);
8588 if (wand->debug != MagickFalse)
8589 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8590 read_info=CloneImageInfo(wand->image_info);
8591 SetImageInfoFile(read_info,file);
8592 images=ReadImage(read_info,wand->exception);
8593 read_info=DestroyImageInfo(read_info);
8594 if (images == (Image *) NULL)
8595 return(MagickFalse);
8596 return(InsertImageInWand(wand,images));
8597}
8598
8599/*
8600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8601% %
8602% %
8603% %
cristy3ed852e2009-09-05 21:47:34 +00008604% M a g i c k R e d u c e N o i s e I m a g e %
8605% %
8606% %
8607% %
8608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8609%
8610% MagickReduceNoiseImage() smooths the contours of an image while still
8611% preserving edge information. The algorithm works by replacing each pixel
8612% with its neighbor closest in value. A neighbor is defined by radius. Use
8613% a radius of 0 and ReduceNoise() selects a suitable radius for you.
8614%
8615% The format of the MagickReduceNoiseImage method is:
8616%
8617% MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8618% const double radius)
8619%
8620% A description of each parameter follows:
8621%
8622% o wand: the magick wand.
8623%
8624% o radius: the radius of the pixel neighborhood.
8625%
8626*/
8627WandExport MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8628 const double radius)
8629{
8630 Image
8631 *noise_image;
8632
8633 assert(wand != (MagickWand *) NULL);
8634 assert(wand->signature == WandSignature);
8635 if (wand->debug != MagickFalse)
8636 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8637 if (wand->images == (Image *) NULL)
8638 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8639 noise_image=ReduceNoiseImage(wand->images,radius,wand->exception);
8640 if (noise_image == (Image *) NULL)
8641 return(MagickFalse);
8642 ReplaceImageInList(&wand->images,noise_image);
8643 return(MagickTrue);
8644}
8645
8646/*
8647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8648% %
8649% %
8650% %
8651% M a g i c k R e m a p I m a g e %
8652% %
8653% %
8654% %
8655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8656%
8657% MagickRemapImage() replaces the colors of an image with the closest color
8658% from a reference image.
8659%
8660% The format of the MagickRemapImage method is:
8661%
8662% MagickBooleanType MagickRemapImage(MagickWand *wand,
8663% const MagickWand *remap_wand,const DitherMethod method)
8664%
8665% A description of each parameter follows:
8666%
8667% o wand: the magick wand.
8668%
8669% o affinity: the affinity wand.
8670%
8671% o method: choose from these dither methods: NoDitherMethod,
8672% RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8673%
8674*/
8675WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8676 const MagickWand *remap_wand,const DitherMethod method)
8677{
8678 MagickBooleanType
8679 status;
8680
8681 QuantizeInfo
8682 *quantize_info;
8683
8684 assert(wand != (MagickWand *) NULL);
8685 assert(wand->signature == WandSignature);
8686 if (wand->debug != MagickFalse)
8687 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8688 if ((wand->images == (Image *) NULL) ||
8689 (remap_wand->images == (Image *) NULL))
8690 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8691 quantize_info=AcquireQuantizeInfo(wand->image_info);
8692 quantize_info->dither_method=method;
8693 if (method == NoDitherMethod)
8694 quantize_info->dither=MagickFalse;
8695 status=RemapImage(quantize_info,wand->images,remap_wand->images);
8696 quantize_info=DestroyQuantizeInfo(quantize_info);
8697 if (status == MagickFalse)
8698 InheritException(wand->exception,&wand->images->exception);
8699 return(status);
8700}
8701
8702/*
8703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8704% %
8705% %
8706% %
8707% M a g i c k R e m o v e I m a g e %
8708% %
8709% %
8710% %
8711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8712%
8713% MagickRemoveImage() removes an image from the image list.
8714%
8715% The format of the MagickRemoveImage method is:
8716%
8717% MagickBooleanType MagickRemoveImage(MagickWand *wand)
8718%
8719% A description of each parameter follows:
8720%
8721% o wand: the magick wand.
8722%
8723% o insert: the splice wand.
8724%
8725*/
8726WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8727{
8728 assert(wand != (MagickWand *) NULL);
8729 assert(wand->signature == WandSignature);
8730 if (wand->debug != MagickFalse)
8731 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8732 if (wand->images == (Image *) NULL)
8733 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8734 DeleteImageFromList(&wand->images);
8735 return(MagickTrue);
8736}
8737
8738/*
8739%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8740% %
8741% %
8742% %
8743% M a g i c k R e s a m p l e I m a g e %
8744% %
8745% %
8746% %
8747%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8748%
8749% MagickResampleImage() resample image to desired resolution.
8750%
8751% Bessel Blackman Box
8752% Catrom Cubic Gaussian
8753% Hanning Hermite Lanczos
8754% Mitchell Point Quandratic
8755% Sinc Triangle
8756%
8757% Most of the filters are FIR (finite impulse response), however, Bessel,
8758% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8759% are windowed (brought down to zero) with the Blackman filter.
8760%
8761% The format of the MagickResampleImage method is:
8762%
8763% MagickBooleanType MagickResampleImage(MagickWand *wand,
8764% const double x_resolution,const double y_resolution,
8765% const FilterTypes filter,const double blur)
8766%
8767% A description of each parameter follows:
8768%
8769% o wand: the magick wand.
8770%
8771% o x_resolution: the new image x resolution.
8772%
8773% o y_resolution: the new image y resolution.
8774%
8775% o filter: Image filter to use.
8776%
8777% o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8778%
8779*/
8780WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8781 const double x_resolution,const double y_resolution,const FilterTypes filter,
8782 const double blur)
8783{
8784 Image
8785 *resample_image;
8786
8787 assert(wand != (MagickWand *) NULL);
8788 assert(wand->signature == WandSignature);
8789 if (wand->debug != MagickFalse)
8790 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8791 if (wand->images == (Image *) NULL)
8792 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8793 resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8794 blur,wand->exception);
8795 if (resample_image == (Image *) NULL)
8796 return(MagickFalse);
8797 ReplaceImageInList(&wand->images,resample_image);
8798 return(MagickTrue);
8799}
8800
8801/*
8802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8803% %
8804% %
8805% %
8806% M a g i c k R e s e t I m a g e P a g e %
8807% %
8808% %
8809% %
8810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8811%
8812% MagickResetImagePage() resets the Wand page canvas and position.
8813%
8814% The format of the MagickResetImagePage method is:
8815%
8816% MagickBooleanType MagickResetImagePage(MagickWand *wand,
8817% const char *page)
8818%
8819% A description of each parameter follows:
8820%
8821% o wand: the magick wand.
8822%
8823% o page: the relative page specification.
8824%
8825*/
8826WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8827 const char *page)
8828{
8829 assert(wand != (MagickWand *) NULL);
8830 assert(wand->signature == WandSignature);
8831 if (wand->debug != MagickFalse)
8832 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8833 if (wand->images == (Image *) NULL)
8834 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8835 if ((page == (char *) NULL) || (*page == '\0'))
8836 {
8837 (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8838 return(MagickTrue);
8839 }
8840 return(ResetImagePage(wand->images,page));
8841}
8842
8843/*
8844%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8845% %
8846% %
8847% %
8848% M a g i c k R e s i z e I m a g e %
8849% %
8850% %
8851% %
8852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8853%
8854% MagickResizeImage() scales an image to the desired dimensions with one of
8855% these filters:
8856%
8857% Bessel Blackman Box
8858% Catrom Cubic Gaussian
8859% Hanning Hermite Lanczos
8860% Mitchell Point Quandratic
8861% Sinc Triangle
8862%
8863% Most of the filters are FIR (finite impulse response), however, Bessel,
8864% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8865% are windowed (brought down to zero) with the Blackman filter.
8866%
8867% The format of the MagickResizeImage method is:
8868%
8869% MagickBooleanType MagickResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008870% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00008871% const FilterTypes filter,const double blur)
8872%
8873% A description of each parameter follows:
8874%
8875% o wand: the magick wand.
8876%
8877% o columns: the number of columns in the scaled image.
8878%
8879% o rows: the number of rows in the scaled image.
8880%
8881% o filter: Image filter to use.
8882%
8883% o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8884%
8885*/
8886WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008887 const size_t columns,const size_t rows,const FilterTypes filter,
cristy3ed852e2009-09-05 21:47:34 +00008888 const double blur)
8889{
8890 Image
8891 *resize_image;
8892
8893 assert(wand != (MagickWand *) NULL);
8894 assert(wand->signature == WandSignature);
8895 if (wand->debug != MagickFalse)
8896 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8897 if (wand->images == (Image *) NULL)
8898 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8899 resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8900 wand->exception);
8901 if (resize_image == (Image *) NULL)
8902 return(MagickFalse);
8903 ReplaceImageInList(&wand->images,resize_image);
8904 return(MagickTrue);
8905}
8906
8907/*
8908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8909% %
8910% %
8911% %
8912% M a g i c k R o l l I m a g e %
8913% %
8914% %
8915% %
8916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8917%
8918% MagickRollImage() offsets an image as defined by x and y.
8919%
8920% The format of the MagickRollImage method is:
8921%
cristybb503372010-05-27 20:51:26 +00008922% MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8923% const size_t y)
cristy3ed852e2009-09-05 21:47:34 +00008924%
8925% A description of each parameter follows:
8926%
8927% o wand: the magick wand.
8928%
8929% o x: the x offset.
8930%
8931% o y: the y offset.
8932%
8933%
8934*/
8935WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008936 const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00008937{
8938 Image
8939 *roll_image;
8940
8941 assert(wand != (MagickWand *) NULL);
8942 assert(wand->signature == WandSignature);
8943 if (wand->debug != MagickFalse)
8944 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8945 if (wand->images == (Image *) NULL)
8946 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8947 roll_image=RollImage(wand->images,x,y,wand->exception);
8948 if (roll_image == (Image *) NULL)
8949 return(MagickFalse);
8950 ReplaceImageInList(&wand->images,roll_image);
8951 return(MagickTrue);
8952}
8953
8954/*
8955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8956% %
8957% %
8958% %
8959% M a g i c k R o t a t e I m a g e %
8960% %
8961% %
8962% %
8963%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8964%
8965% MagickRotateImage() rotates an image the specified number of degrees. Empty
8966% triangles left over from rotating the image are filled with the
8967% background color.
8968%
8969% The format of the MagickRotateImage method is:
8970%
8971% MagickBooleanType MagickRotateImage(MagickWand *wand,
8972% const PixelWand *background,const double degrees)
8973%
8974% A description of each parameter follows:
8975%
8976% o wand: the magick wand.
8977%
8978% o background: the background pixel wand.
8979%
8980% o degrees: the number of degrees to rotate the image.
8981%
8982%
8983*/
8984WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8985 const PixelWand *background,const double degrees)
8986{
8987 Image
8988 *rotate_image;
8989
8990 assert(wand != (MagickWand *) NULL);
8991 assert(wand->signature == WandSignature);
8992 if (wand->debug != MagickFalse)
8993 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8994 if (wand->images == (Image *) NULL)
8995 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8996 PixelGetQuantumColor(background,&wand->images->background_color);
8997 rotate_image=RotateImage(wand->images,degrees,wand->exception);
8998 if (rotate_image == (Image *) NULL)
8999 return(MagickFalse);
9000 ReplaceImageInList(&wand->images,rotate_image);
9001 return(MagickTrue);
9002}
9003
9004/*
9005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9006% %
9007% %
9008% %
9009% M a g i c k S a m p l e I m a g e %
9010% %
9011% %
9012% %
9013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9014%
9015% MagickSampleImage() scales an image to the desired dimensions with pixel
9016% sampling. Unlike other scaling methods, this method does not introduce
9017% any additional color into the scaled image.
9018%
9019% The format of the MagickSampleImage method is:
9020%
9021% MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009022% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009023%
9024% A description of each parameter follows:
9025%
9026% o wand: the magick wand.
9027%
9028% o columns: the number of columns in the scaled image.
9029%
9030% o rows: the number of rows in the scaled image.
9031%
9032%
9033*/
9034WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009035 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009036{
9037 Image
9038 *sample_image;
9039
9040 assert(wand != (MagickWand *) NULL);
9041 assert(wand->signature == WandSignature);
9042 if (wand->debug != MagickFalse)
9043 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9044 if (wand->images == (Image *) NULL)
9045 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9046 sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9047 if (sample_image == (Image *) NULL)
9048 return(MagickFalse);
9049 ReplaceImageInList(&wand->images,sample_image);
9050 return(MagickTrue);
9051}
9052
9053/*
9054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9055% %
9056% %
9057% %
9058% M a g i c k S c a l e I m a g e %
9059% %
9060% %
9061% %
9062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9063%
9064% MagickScaleImage() scales the size of an image to the given dimensions.
9065%
9066% The format of the MagickScaleImage method is:
9067%
9068% MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009069% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009070%
9071% A description of each parameter follows:
9072%
9073% o wand: the magick wand.
9074%
9075% o columns: the number of columns in the scaled image.
9076%
9077% o rows: the number of rows in the scaled image.
9078%
9079%
9080*/
9081WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009082 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009083{
9084 Image
9085 *scale_image;
9086
9087 assert(wand != (MagickWand *) NULL);
9088 assert(wand->signature == WandSignature);
9089 if (wand->debug != MagickFalse)
9090 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9091 if (wand->images == (Image *) NULL)
9092 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9093 scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9094 if (scale_image == (Image *) NULL)
9095 return(MagickFalse);
9096 ReplaceImageInList(&wand->images,scale_image);
9097 return(MagickTrue);
9098}
9099
9100/*
9101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9102% %
9103% %
9104% %
9105% M a g i c k S e g m e n t I m a g e %
9106% %
9107% %
9108% %
9109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9110%
9111% MagickSegmentImage() segments an image by analyzing the histograms of the
9112% color components and identifying units that are homogeneous with the fuzzy
9113% C-means technique.
9114%
9115% The format of the SegmentImage method is:
9116%
9117% MagickBooleanType MagickSegmentImage(MagickWand *wand,
9118% const ColorspaceType colorspace,const MagickBooleanType verbose,
9119% const double cluster_threshold,const double smooth_threshold)
9120%
9121% A description of each parameter follows.
9122%
9123% o wand: the wand.
9124%
9125% o colorspace: the image colorspace.
9126%
9127% o verbose: Set to MagickTrue to print detailed information about the
9128% identified classes.
9129%
9130% o cluster_threshold: This represents the minimum number of pixels
9131% contained in a hexahedra before it can be considered valid (expressed as
9132% a percentage).
9133%
9134% o smooth_threshold: the smoothing threshold eliminates noise in the second
9135% derivative of the histogram. As the value is increased, you can expect a
9136% smoother second derivative.
9137%
9138*/
9139MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9140 const ColorspaceType colorspace,const MagickBooleanType verbose,
9141 const double cluster_threshold,const double smooth_threshold)
9142{
9143 MagickBooleanType
9144 status;
9145
9146 assert(wand != (MagickWand *) NULL);
9147 assert(wand->signature == WandSignature);
9148 if (wand->debug != MagickFalse)
9149 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9150 if (wand->images == (Image *) NULL)
9151 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9152 status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9153 smooth_threshold);
9154 if (status == MagickFalse)
9155 InheritException(wand->exception,&wand->images->exception);
9156 return(status);
9157}
9158
9159/*
9160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9161% %
9162% %
9163% %
9164% M a g i c k S e l e c t i v e B l u r I m a g e %
9165% %
9166% %
9167% %
9168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9169%
9170% MagickSelectiveBlurImage() selectively blur an image within a contrast
9171% threshold. It is similar to the unsharpen mask that sharpens everything with
9172% contrast above a certain threshold.
9173%
9174% The format of the MagickSelectiveBlurImage method is:
9175%
9176% MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9177% const double radius,const double sigma,const double threshold)
9178% MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9179% const ChannelType channel,const double radius,const double sigma,
9180% const double threshold)
9181%
9182% A description of each parameter follows:
9183%
9184% o wand: the magick wand.
9185%
9186% o channel: the image channel(s).
9187%
9188% o radius: the radius of the gaussian, in pixels, not counting the center
9189% pixel.
9190%
9191% o sigma: the standard deviation of the gaussian, in pixels.
9192%
9193% o threshold: only pixels within this contrast threshold are included
cristy6a917d92009-10-06 19:23:54 +00009194% in the blur operation.
cristy3ed852e2009-09-05 21:47:34 +00009195%
9196*/
9197
9198WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9199 const double radius,const double sigma,const double threshold)
9200{
9201 MagickBooleanType
9202 status;
9203
9204 status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9205 threshold);
9206 return(status);
9207}
9208
9209WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9210 const ChannelType channel,const double radius,const double sigma,
9211 const double threshold)
9212{
9213 Image
9214 *blur_image;
9215
9216 assert(wand != (MagickWand *) NULL);
9217 assert(wand->signature == WandSignature);
9218 if (wand->debug != MagickFalse)
9219 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9220 if (wand->images == (Image *) NULL)
9221 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9222 blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9223 threshold,wand->exception);
9224 if (blur_image == (Image *) NULL)
9225 return(MagickFalse);
9226 ReplaceImageInList(&wand->images,blur_image);
9227 return(MagickTrue);
9228}
9229
9230/*
9231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9232% %
9233% %
9234% %
9235% 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 %
9236% %
9237% %
9238% %
9239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9240%
9241% MagickSeparateImageChannel() separates a channel from the image and returns a
9242% grayscale image. A channel is a particular color component of each pixel
9243% in the image.
9244%
9245% The format of the MagickSeparateImageChannel method is:
9246%
9247% MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9248% const ChannelType channel)
9249%
9250% A description of each parameter follows:
9251%
9252% o wand: the magick wand.
9253%
9254% o channel: the image channel(s).
9255%
9256*/
9257WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9258 const ChannelType channel)
9259{
9260 MagickBooleanType
9261 status;
9262
9263 assert(wand != (MagickWand *) NULL);
9264 assert(wand->signature == WandSignature);
9265 if (wand->debug != MagickFalse)
9266 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9267 if (wand->images == (Image *) NULL)
9268 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9269 status=SeparateImageChannel(wand->images,channel);
9270 if (status == MagickFalse)
9271 InheritException(wand->exception,&wand->images->exception);
9272 return(status);
9273}
9274
9275/*
9276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9277% %
9278% %
9279% %
9280% M a g i c k S e p i a T o n e I m a g e %
9281% %
9282% %
9283% %
9284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9285%
9286% MagickSepiaToneImage() applies a special effect to the image, similar to the
9287% effect achieved in a photo darkroom by sepia toning. Threshold ranges from
9288% 0 to QuantumRange and is a measure of the extent of the sepia toning. A
9289% threshold of 80% is a good starting point for a reasonable tone.
9290%
9291% The format of the MagickSepiaToneImage method is:
9292%
9293% MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9294% const double threshold)
9295%
9296% A description of each parameter follows:
9297%
9298% o wand: the magick wand.
9299%
9300% o threshold: Define the extent of the sepia toning.
9301%
9302*/
9303WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9304 const double threshold)
9305{
9306 Image
9307 *sepia_image;
9308
9309 assert(wand != (MagickWand *) NULL);
9310 assert(wand->signature == WandSignature);
9311 if (wand->debug != MagickFalse)
9312 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9313 if (wand->images == (Image *) NULL)
9314 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9315 sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9316 if (sepia_image == (Image *) NULL)
9317 return(MagickFalse);
9318 ReplaceImageInList(&wand->images,sepia_image);
9319 return(MagickTrue);
9320}
9321
9322/*
9323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9324% %
9325% %
9326% %
9327% M a g i c k S e t I m a g e %
9328% %
9329% %
9330% %
9331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9332%
9333% MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9334% MagickNextImage(), MagickPreviousImage() with the images from the specified
9335% wand.
9336%
9337% The format of the MagickSetImage method is:
9338%
9339% MagickBooleanType MagickSetImage(MagickWand *wand,
9340% const MagickWand *set_wand)
9341%
9342% A description of each parameter follows:
9343%
9344% o wand: the magick wand.
9345%
9346% o set_wand: the set_wand wand.
9347%
9348*/
9349WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9350 const MagickWand *set_wand)
9351{
9352 Image
9353 *images;
9354
9355 assert(wand != (MagickWand *) NULL);
9356 assert(wand->signature == WandSignature);
9357 if (wand->debug != MagickFalse)
9358 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9359 assert(set_wand != (MagickWand *) NULL);
9360 assert(set_wand->signature == WandSignature);
9361 if (wand->debug != MagickFalse)
9362 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9363 if (set_wand->images == (Image *) NULL)
9364 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9365 images=CloneImageList(set_wand->images,wand->exception);
9366 if (images == (Image *) NULL)
9367 return(MagickFalse);
9368 ReplaceImageInList(&wand->images,images);
9369 return(MagickTrue);
9370}
9371
9372/*
9373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9374% %
9375% %
9376% %
9377% 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 %
9378% %
9379% %
9380% %
9381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9382%
9383% MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9384% alpha channel.
9385%
9386% The format of the MagickSetImageAlphaChannel method is:
9387%
9388% MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9389% const AlphaChannelType alpha_type)
9390%
9391% A description of each parameter follows:
9392%
9393% o wand: the magick wand.
9394%
9395% o alpha_type: the alpha channel type: ActivateAlphaChannel,
9396% DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9397%
9398*/
9399WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9400 const AlphaChannelType alpha_type)
9401{
9402 assert(wand != (MagickWand *) NULL);
9403 assert(wand->signature == WandSignature);
9404 if (wand->debug != MagickFalse)
9405 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9406 if (wand->images == (Image *) NULL)
9407 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9408 return(SetImageAlphaChannel(wand->images,alpha_type));
9409}
9410
9411/*
9412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9413% %
9414% %
9415% %
9416% 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 %
9417% %
9418% %
9419% %
9420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9421%
9422% MagickSetImageBackgroundColor() sets the image background color.
9423%
9424% The format of the MagickSetImageBackgroundColor method is:
9425%
9426% MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9427% const PixelWand *background)
9428%
9429% A description of each parameter follows:
9430%
9431% o wand: the magick wand.
9432%
9433% o background: the background pixel wand.
9434%
9435*/
9436WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9437 const PixelWand *background)
9438{
9439 assert(wand != (MagickWand *) NULL);
9440 assert(wand->signature == WandSignature);
9441 if (wand->debug != MagickFalse)
9442 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9443 if (wand->images == (Image *) NULL)
9444 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9445 PixelGetQuantumColor(background,&wand->images->background_color);
9446 return(MagickTrue);
9447}
9448
9449/*
9450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9451% %
9452% %
9453% %
9454% M a g i c k S e t I m a g e B i a s %
9455% %
9456% %
9457% %
9458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9459%
9460% MagickSetImageBias() sets the image bias for any method that convolves an
9461% image (e.g. MagickConvolveImage()).
9462%
9463% The format of the MagickSetImageBias method is:
9464%
9465% MagickBooleanType MagickSetImageBias(MagickWand *wand,
9466% const double bias)
9467%
9468% A description of each parameter follows:
9469%
9470% o wand: the magick wand.
9471%
9472% o bias: the image bias.
9473%
9474*/
9475WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9476 const double bias)
9477{
9478 assert(wand != (MagickWand *) NULL);
9479 assert(wand->signature == WandSignature);
9480 if (wand->debug != MagickFalse)
9481 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9482 if (wand->images == (Image *) NULL)
9483 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9484 wand->images->bias=bias;
9485 return(MagickTrue);
9486}
9487
9488/*
9489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9490% %
9491% %
9492% %
9493% 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 %
9494% %
9495% %
9496% %
9497%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9498%
9499% MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9500%
9501% The format of the MagickSetImageBluePrimary method is:
9502%
9503% MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9504% const double x,const double y)
9505%
9506% A description of each parameter follows:
9507%
9508% o wand: the magick wand.
9509%
9510% o x: the blue primary x-point.
9511%
9512% o y: the blue primary y-point.
9513%
9514*/
9515WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9516 const double x,const double y)
9517{
9518 assert(wand != (MagickWand *) NULL);
9519 assert(wand->signature == WandSignature);
9520 if (wand->debug != MagickFalse)
9521 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9522 if (wand->images == (Image *) NULL)
9523 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9524 wand->images->chromaticity.blue_primary.x=x;
9525 wand->images->chromaticity.blue_primary.y=y;
9526 return(MagickTrue);
9527}
9528
9529/*
9530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9531% %
9532% %
9533% %
9534% 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 %
9535% %
9536% %
9537% %
9538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9539%
9540% MagickSetImageBorderColor() sets the image border color.
9541%
9542% The format of the MagickSetImageBorderColor method is:
9543%
9544% MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9545% const PixelWand *border)
9546%
9547% A description of each parameter follows:
9548%
9549% o wand: the magick wand.
9550%
9551% o border: the border pixel wand.
9552%
9553*/
9554WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9555 const PixelWand *border)
9556{
9557 assert(wand != (MagickWand *) NULL);
9558 assert(wand->signature == WandSignature);
9559 if (wand->debug != MagickFalse)
9560 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9561 if (wand->images == (Image *) NULL)
9562 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9563 PixelGetQuantumColor(border,&wand->images->border_color);
9564 return(MagickTrue);
9565}
9566
9567/*
9568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9569% %
9570% %
9571% %
9572% M a g i c k S e t I m a g e C h a n n e l D e p t h %
9573% %
9574% %
9575% %
9576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9577%
9578% MagickSetImageChannelDepth() sets the depth of a particular image channel.
9579%
9580% The format of the MagickSetImageChannelDepth method is:
9581%
9582% MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009583% const ChannelType channel,const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009584%
9585% A description of each parameter follows:
9586%
9587% o wand: the magick wand.
9588%
9589% o channel: the image channel(s).
9590%
9591% o depth: the image depth in bits.
9592%
9593*/
9594WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009595 const ChannelType channel,const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009596{
9597 assert(wand != (MagickWand *) NULL);
9598 assert(wand->signature == WandSignature);
9599 if (wand->debug != MagickFalse)
9600 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9601 if (wand->images == (Image *) NULL)
9602 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9603 return(SetImageChannelDepth(wand->images,channel,depth));
9604}
9605
9606/*
9607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9608% %
9609% %
9610% %
9611% M a g i c k S e t I m a g e C l i p M a s k %
9612% %
9613% %
9614% %
9615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9616%
9617% MagickSetImageClipMask() sets image clip mask.
9618%
9619% The format of the MagickSetImageClipMask method is:
9620%
9621% MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9622% const MagickWand *clip_mask)
9623%
9624% A description of each parameter follows:
9625%
9626% o wand: the magick wand.
9627%
9628% o clip_mask: the clip_mask wand.
9629%
9630*/
9631WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9632 const MagickWand *clip_mask)
9633{
9634 assert(wand != (MagickWand *) NULL);
9635 assert(wand->signature == WandSignature);
9636 if (wand->debug != MagickFalse)
9637 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9638 assert(clip_mask != (MagickWand *) NULL);
9639 assert(clip_mask->signature == WandSignature);
9640 if (wand->debug != MagickFalse)
9641 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9642 if (clip_mask->images == (Image *) NULL)
9643 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9644 return(SetImageClipMask(wand->images,clip_mask->images));
9645}
9646
9647/*
9648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9649% %
9650% %
9651% %
cristya5b77cb2010-05-07 19:34:48 +00009652% M a g i c k S e t I m a g e C o l o r %
9653% %
9654% %
9655% %
9656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9657%
9658% MagickSetImageColor() set the entire wand canvas to the specified color.
9659%
9660% The format of the MagickSetImageColor method is:
9661%
9662% MagickBooleanType MagickSetImageColor(MagickWand *wand,
9663% const PixelWand *color)
9664%
9665% A description of each parameter follows:
9666%
9667% o wand: the magick wand.
9668%
9669% o background: the image color.
9670%
9671*/
9672WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9673 const PixelWand *color)
9674{
9675 MagickBooleanType
9676 status;
9677
9678 MagickPixelPacket
9679 pixel;
9680
9681 assert(wand != (MagickWand *) NULL);
9682 assert(wand->signature == WandSignature);
9683 if (wand->debug != MagickFalse)
9684 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9685 PixelGetMagickColor(color,&pixel);
9686 status=SetImageColor(wand->images,&pixel);
9687 if (status == MagickFalse)
9688 InheritException(wand->exception,&wand->images->exception);
9689 return(status);
9690}
9691
9692/*
9693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9694% %
9695% %
9696% %
cristy3ed852e2009-09-05 21:47:34 +00009697% 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 %
9698% %
9699% %
9700% %
9701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9702%
9703% MagickSetImageColormapColor() sets the color of the specified colormap
9704% index.
9705%
9706% The format of the MagickSetImageColormapColor method is:
9707%
9708% MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009709% const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00009710%
9711% A description of each parameter follows:
9712%
9713% o wand: the magick wand.
9714%
9715% o index: the offset into the image colormap.
9716%
9717% o color: Return the colormap color in this wand.
9718%
9719*/
9720WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009721 const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00009722{
9723 assert(wand != (MagickWand *) NULL);
9724 assert(wand->signature == WandSignature);
9725 if (wand->debug != MagickFalse)
9726 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9727 if (wand->images == (Image *) NULL)
9728 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9729 if ((wand->images->colormap == (PixelPacket *) NULL) ||
9730 (index >= wand->images->colors))
9731 ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9732 PixelGetQuantumColor(color,wand->images->colormap+index);
9733 return(SyncImage(wand->images));
9734}
9735
9736/*
9737%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9738% %
9739% %
9740% %
9741% M a g i c k S e t I m a g e C o l o r s p a c e %
9742% %
9743% %
9744% %
9745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9746%
9747% MagickSetImageColorspace() sets the image colorspace.
9748%
9749% The format of the MagickSetImageColorspace method is:
9750%
9751% MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9752% const ColorspaceType colorspace)
9753%
9754% A description of each parameter follows:
9755%
9756% o wand: the magick wand.
9757%
9758% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
9759% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9760% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9761% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9762% HSLColorspace, or HWBColorspace.
9763%
9764*/
9765WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9766 const ColorspaceType colorspace)
9767{
9768 assert(wand != (MagickWand *) NULL);
9769 assert(wand->signature == WandSignature);
9770 if (wand->debug != MagickFalse)
9771 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9772 if (wand->images == (Image *) NULL)
9773 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9774 return(SetImageColorspace(wand->images,colorspace));
9775}
9776
9777/*
9778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9779% %
9780% %
9781% %
9782% M a g i c k S e t I m a g e C o m p o s e %
9783% %
9784% %
9785% %
9786%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9787%
9788% MagickSetImageCompose() sets the image composite operator, useful for
9789% specifying how to composite the image thumbnail when using the
9790% MagickMontageImage() method.
9791%
9792% The format of the MagickSetImageCompose method is:
9793%
9794% MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9795% const CompositeOperator compose)
9796%
9797% A description of each parameter follows:
9798%
9799% o wand: the magick wand.
9800%
9801% o compose: the image composite operator.
9802%
9803*/
9804WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9805 const CompositeOperator compose)
9806{
9807 assert(wand != (MagickWand *) NULL);
9808 assert(wand->signature == WandSignature);
9809 if (wand->debug != MagickFalse)
9810 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9811 if (wand->images == (Image *) NULL)
9812 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9813 wand->images->compose=compose;
9814 return(MagickTrue);
9815}
9816
9817/*
9818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9819% %
9820% %
9821% %
9822% 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 %
9823% %
9824% %
9825% %
9826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9827%
9828% MagickSetImageCompression() sets the image compression.
9829%
9830% The format of the MagickSetImageCompression method is:
9831%
9832% MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9833% const CompressionType compression)
9834%
9835% A description of each parameter follows:
9836%
9837% o wand: the magick wand.
9838%
9839% o compression: the image compression type.
9840%
9841*/
9842WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9843 const CompressionType compression)
9844{
9845 assert(wand != (MagickWand *) NULL);
9846 assert(wand->signature == WandSignature);
9847 if (wand->debug != MagickFalse)
9848 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9849 if (wand->images == (Image *) NULL)
9850 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9851 wand->images->compression=compression;
9852 return(MagickTrue);
9853}
9854
9855/*
9856%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9857% %
9858% %
9859% %
9860% 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 %
9861% %
9862% %
9863% %
9864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9865%
9866% MagickSetImageCompressionQuality() sets the image compression quality.
9867%
9868% The format of the MagickSetImageCompressionQuality method is:
9869%
9870% MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009871% const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009872%
9873% A description of each parameter follows:
9874%
9875% o wand: the magick wand.
9876%
9877% o quality: the image compression tlityype.
9878%
9879*/
9880WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009881 const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009882{
9883 assert(wand != (MagickWand *) NULL);
9884 assert(wand->signature == WandSignature);
9885 if (wand->debug != MagickFalse)
9886 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9887 if (wand->images == (Image *) NULL)
9888 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9889 wand->images->quality=quality;
9890 return(MagickTrue);
9891}
9892
9893/*
9894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9895% %
9896% %
9897% %
9898% M a g i c k S e t I m a g e D e l a y %
9899% %
9900% %
9901% %
9902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9903%
9904% MagickSetImageDelay() sets the image delay.
9905%
9906% The format of the MagickSetImageDelay method is:
9907%
9908% MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009909% const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009910%
9911% A description of each parameter follows:
9912%
9913% o wand: the magick wand.
9914%
9915% o delay: the image delay in ticks-per-second units.
9916%
9917*/
9918WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009919 const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009920{
9921 assert(wand != (MagickWand *) NULL);
9922 assert(wand->signature == WandSignature);
9923 if (wand->debug != MagickFalse)
9924 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9925 if (wand->images == (Image *) NULL)
9926 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9927 wand->images->delay=delay;
9928 return(MagickTrue);
9929}
9930
9931/*
9932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9933% %
9934% %
9935% %
9936% M a g i c k S e t I m a g e D e p t h %
9937% %
9938% %
9939% %
9940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9941%
9942% MagickSetImageDepth() sets the image depth.
9943%
9944% The format of the MagickSetImageDepth method is:
9945%
9946% MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009947% const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009948%
9949% A description of each parameter follows:
9950%
9951% o wand: the magick wand.
9952%
9953% o depth: the image depth in bits: 8, 16, or 32.
9954%
9955*/
9956WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009957 const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009958{
9959 assert(wand != (MagickWand *) NULL);
9960 assert(wand->signature == WandSignature);
9961 if (wand->debug != MagickFalse)
9962 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9963 if (wand->images == (Image *) NULL)
9964 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9965 wand->images->depth=depth;
9966 return(MagickTrue);
9967}
9968
9969/*
9970%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9971% %
9972% %
9973% %
9974% M a g i c k S e t I m a g e D i s p o s e %
9975% %
9976% %
9977% %
9978%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9979%
9980% MagickSetImageDispose() sets the image disposal method.
9981%
9982% The format of the MagickSetImageDispose method is:
9983%
9984% MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9985% const DisposeType dispose)
9986%
9987% A description of each parameter follows:
9988%
9989% o wand: the magick wand.
9990%
9991% o dispose: the image disposeal type.
9992%
9993*/
9994WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9995 const DisposeType dispose)
9996{
9997 assert(wand != (MagickWand *) NULL);
9998 assert(wand->signature == WandSignature);
9999 if (wand->debug != MagickFalse)
10000 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10001 if (wand->images == (Image *) NULL)
10002 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10003 wand->images->dispose=dispose;
10004 return(MagickTrue);
10005}
10006
10007/*
10008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10009% %
10010% %
10011% %
10012% M a g i c k S e t I m a g e E x t e n t %
10013% %
10014% %
10015% %
10016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10017%
10018% MagickSetImageExtent() sets the image size (i.e. columns & rows).
10019%
10020% The format of the MagickSetImageExtent method is:
10021%
10022% MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010023% const size_t columns,const unsigned rows)
cristy3ed852e2009-09-05 21:47:34 +000010024%
10025% A description of each parameter follows:
10026%
10027% o wand: the magick wand.
10028%
10029% o columns: The image width in pixels.
10030%
10031% o rows: The image height in pixels.
10032%
10033*/
10034WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010035 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010036{
10037 assert(wand != (MagickWand *) NULL);
10038 assert(wand->signature == WandSignature);
10039 if (wand->debug != MagickFalse)
10040 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10041 if (wand->images == (Image *) NULL)
10042 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10043 return(SetImageExtent(wand->images,columns,rows));
10044}
10045
10046/*
10047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10048% %
10049% %
10050% %
10051% M a g i c k S e t I m a g e F i l e n a m e %
10052% %
10053% %
10054% %
10055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10056%
10057% MagickSetImageFilename() sets the filename of a particular image in a
10058% sequence.
10059%
10060% The format of the MagickSetImageFilename method is:
10061%
10062% MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10063% const char *filename)
10064%
10065% A description of each parameter follows:
10066%
10067% o wand: the magick wand.
10068%
10069% o filename: the image filename.
10070%
10071*/
10072WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10073 const char *filename)
10074{
10075 assert(wand != (MagickWand *) NULL);
10076 assert(wand->signature == WandSignature);
10077 if (wand->debug != MagickFalse)
10078 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10079 if (wand->images == (Image *) NULL)
10080 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10081 if (filename != (const char *) NULL)
10082 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
10083 return(MagickTrue);
10084}
10085
10086/*
10087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10088% %
10089% %
10090% %
10091% M a g i c k S e t I m a g e F o r m a t %
10092% %
10093% %
10094% %
10095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10096%
10097% MagickSetImageFormat() sets the format of a particular image in a
10098% sequence.
10099%
10100% The format of the MagickSetImageFormat method is:
10101%
10102% MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10103% const char *format)
10104%
10105% A description of each parameter follows:
10106%
10107% o wand: the magick wand.
10108%
10109% o format: the image format.
10110%
10111*/
10112WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10113 const char *format)
10114{
10115 const MagickInfo
10116 *magick_info;
10117
10118 assert(wand != (MagickWand *) NULL);
10119 assert(wand->signature == WandSignature);
10120 if (wand->debug != MagickFalse)
10121 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10122 if (wand->images == (Image *) NULL)
10123 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10124 if ((format == (char *) NULL) || (*format == '\0'))
10125 {
10126 *wand->images->magick='\0';
10127 return(MagickTrue);
10128 }
10129 magick_info=GetMagickInfo(format,wand->exception);
10130 if (magick_info == (const MagickInfo *) NULL)
10131 return(MagickFalse);
10132 ClearMagickException(wand->exception);
10133 (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
10134 return(MagickTrue);
10135}
10136
10137/*
10138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10139% %
10140% %
10141% %
10142% M a g i c k S e t I m a g e F u z z %
10143% %
10144% %
10145% %
10146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10147%
10148% MagickSetImageFuzz() sets the image fuzz.
10149%
10150% The format of the MagickSetImageFuzz method is:
10151%
10152% MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10153% const double fuzz)
10154%
10155% A description of each parameter follows:
10156%
10157% o wand: the magick wand.
10158%
10159% o fuzz: the image fuzz.
10160%
10161*/
10162WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10163 const double fuzz)
10164{
10165 assert(wand != (MagickWand *) NULL);
10166 assert(wand->signature == WandSignature);
10167 if (wand->debug != MagickFalse)
10168 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10169 if (wand->images == (Image *) NULL)
10170 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10171 wand->images->fuzz=fuzz;
10172 return(MagickTrue);
10173}
10174
10175/*
10176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10177% %
10178% %
10179% %
10180% M a g i c k S e t I m a g e G a m m a %
10181% %
10182% %
10183% %
10184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10185%
10186% MagickSetImageGamma() sets the image gamma.
10187%
10188% The format of the MagickSetImageGamma method is:
10189%
10190% MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10191% const double gamma)
10192%
10193% A description of each parameter follows:
10194%
10195% o wand: the magick wand.
10196%
10197% o gamma: the image gamma.
10198%
10199*/
10200WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10201 const double gamma)
10202{
10203 assert(wand != (MagickWand *) NULL);
10204 assert(wand->signature == WandSignature);
10205 if (wand->debug != MagickFalse)
10206 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10207 if (wand->images == (Image *) NULL)
10208 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10209 wand->images->gamma=gamma;
10210 return(MagickTrue);
10211}
10212
10213/*
10214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10215% %
10216% %
10217% %
10218% M a g i c k S e t I m a g e G r a v i t y %
10219% %
10220% %
10221% %
10222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10223%
10224% MagickSetImageGravity() sets the image gravity type.
10225%
10226% The format of the MagickSetImageGravity method is:
10227%
10228% MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10229% const GravityType gravity)
10230%
10231% A description of each parameter follows:
10232%
10233% o wand: the magick wand.
10234%
10235% o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10236% PlaneInterlace, PartitionInterlace.
10237%
10238*/
10239WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10240 const GravityType gravity)
10241{
10242 assert(wand != (MagickWand *) NULL);
10243 assert(wand->signature == WandSignature);
10244 if (wand->debug != MagickFalse)
10245 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10246 if (wand->images == (Image *) NULL)
10247 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10248 wand->images->gravity=gravity;
10249 return(MagickTrue);
10250}
10251
10252/*
10253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10254% %
10255% %
10256% %
10257% 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 %
10258% %
10259% %
10260% %
10261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10262%
10263% MagickSetImageGreenPrimary() sets the image chromaticity green primary
10264% point.
10265%
10266% The format of the MagickSetImageGreenPrimary method is:
10267%
10268% MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10269% const double x,const double y)
10270%
10271% A description of each parameter follows:
10272%
10273% o wand: the magick wand.
10274%
10275% o x: the green primary x-point.
10276%
10277% o y: the green primary y-point.
10278%
10279%
10280*/
10281WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10282 const double x,const double y)
10283{
10284 assert(wand != (MagickWand *) NULL);
10285 assert(wand->signature == WandSignature);
10286 if (wand->debug != MagickFalse)
10287 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10288 if (wand->images == (Image *) NULL)
10289 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10290 wand->images->chromaticity.green_primary.x=x;
10291 wand->images->chromaticity.green_primary.y=y;
10292 return(MagickTrue);
10293}
10294
10295/*
10296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10297% %
10298% %
10299% %
10300% 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 %
10301% %
10302% %
10303% %
10304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10305%
10306% MagickSetImageInterlaceScheme() sets the image interlace scheme.
10307%
10308% The format of the MagickSetImageInterlaceScheme method is:
10309%
10310% MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10311% const InterlaceType interlace)
10312%
10313% A description of each parameter follows:
10314%
10315% o wand: the magick wand.
10316%
10317% o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10318% PlaneInterlace, PartitionInterlace.
10319%
10320*/
10321WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10322 const InterlaceType interlace)
10323{
10324 assert(wand != (MagickWand *) NULL);
10325 assert(wand->signature == WandSignature);
10326 if (wand->debug != MagickFalse)
10327 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10328 if (wand->images == (Image *) NULL)
10329 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10330 wand->images->interlace=interlace;
10331 return(MagickTrue);
10332}
10333
10334/*
10335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10336% %
10337% %
10338% %
10339% 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 %
10340% %
10341% %
10342% %
10343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10344%
10345% MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10346%
10347% The format of the MagickSetImageInterpolateMethod method is:
10348%
10349% MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10350% const InterpolatePixelMethod method)
10351%
10352% A description of each parameter follows:
10353%
10354% o wand: the magick wand.
10355%
10356% o method: the image interpole pixel methods: choose from Undefined,
10357% Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10358%
10359*/
10360WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10361 const InterpolatePixelMethod method)
10362{
10363 assert(wand != (MagickWand *) NULL);
10364 assert(wand->signature == WandSignature);
10365 if (wand->debug != MagickFalse)
10366 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10367 if (wand->images == (Image *) NULL)
10368 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10369 wand->images->interpolate=method;
10370 return(MagickTrue);
10371}
10372
10373/*
10374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10375% %
10376% %
10377% %
10378% M a g i c k S e t I m a g e I t e r a t i o n s %
10379% %
10380% %
10381% %
10382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10383%
10384% MagickSetImageIterations() sets the image iterations.
10385%
10386% The format of the MagickSetImageIterations method is:
10387%
10388% MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010389% const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +000010390%
10391% A description of each parameter follows:
10392%
10393% o wand: the magick wand.
10394%
10395% o delay: the image delay in 1/100th of a second.
10396%
10397*/
10398WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010399 const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +000010400{
10401 assert(wand != (MagickWand *) NULL);
10402 assert(wand->signature == WandSignature);
10403 if (wand->debug != MagickFalse)
10404 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10405 if (wand->images == (Image *) NULL)
10406 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10407 wand->images->iterations=iterations;
10408 return(MagickTrue);
10409}
10410
10411/*
10412%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10413% %
10414% %
10415% %
10416% M a g i c k S e t I m a g e M a t t e %
10417% %
10418% %
10419% %
10420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10421%
10422% MagickSetImageMatte() sets the image matte channel.
10423%
10424% The format of the MagickSetImageMatteColor method is:
10425%
10426% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10427% const MagickBooleanType *matte)
10428%
10429% A description of each parameter follows:
10430%
10431% o wand: the magick wand.
10432%
10433% o matte: Set to MagickTrue to enable the image matte channel otherwise
10434% MagickFalse.
10435%
10436*/
10437WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10438 const MagickBooleanType matte)
10439{
10440 assert(wand != (MagickWand *) NULL);
10441 assert(wand->signature == WandSignature);
10442 if (wand->debug != MagickFalse)
10443 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10444 if (wand->images == (Image *) NULL)
10445 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10446 if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10447 (void) SetImageOpacity(wand->images,OpaqueOpacity);
10448 wand->images->matte=matte;
10449 return(MagickTrue);
10450}
10451
10452/*
10453%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10454% %
10455% %
10456% %
10457% M a g i c k S e t I m a g e M a t t e C o l o r %
10458% %
10459% %
10460% %
10461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10462%
10463% MagickSetImageMatteColor() sets the image matte color.
10464%
10465% The format of the MagickSetImageMatteColor method is:
10466%
10467% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10468% const PixelWand *matte)
10469%
10470% A description of each parameter follows:
10471%
10472% o wand: the magick wand.
10473%
10474% o matte: the matte pixel wand.
10475%
10476*/
10477WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10478 const PixelWand *matte)
10479{
10480 assert(wand != (MagickWand *) NULL);
10481 assert(wand->signature == WandSignature);
10482 if (wand->debug != MagickFalse)
10483 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10484 if (wand->images == (Image *) NULL)
10485 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10486 PixelGetQuantumColor(matte,&wand->images->matte_color);
10487 return(MagickTrue);
10488}
10489
10490/*
10491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10492% %
10493% %
10494% %
10495% M a g i c k S e t I m a g e O p a c i t y %
10496% %
10497% %
10498% %
10499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10500%
10501% MagickSetImageOpacity() sets the image to the specified opacity level.
10502%
10503% The format of the MagickSetImageOpacity method is:
10504%
10505% MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10506% const double alpha)
10507%
10508% A description of each parameter follows:
10509%
10510% o wand: the magick wand.
10511%
10512% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10513% transparent.
10514%
10515*/
10516WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10517 const double alpha)
10518{
10519 MagickBooleanType
10520 status;
10521
10522 assert(wand != (MagickWand *) NULL);
10523 assert(wand->signature == WandSignature);
10524 if (wand->debug != MagickFalse)
10525 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10526 if (wand->images == (Image *) NULL)
10527 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyce70c172010-01-07 17:15:30 +000010528 status=SetImageOpacity(wand->images,ClampToQuantum((MagickRealType)
cristy3ed852e2009-09-05 21:47:34 +000010529 QuantumRange-QuantumRange*alpha));
10530 if (status == MagickFalse)
10531 InheritException(wand->exception,&wand->images->exception);
10532 return(status);
10533}
10534
10535/*
10536%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10537% %
10538% %
10539% %
10540% 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 %
10541% %
10542% %
10543% %
10544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10545%
10546% MagickSetImageOrientation() sets the image orientation.
10547%
10548% The format of the MagickSetImageOrientation method is:
10549%
10550% MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10551% const OrientationType orientation)
10552%
10553% A description of each parameter follows:
10554%
10555% o wand: the magick wand.
10556%
10557% o orientation: the image orientation type.
10558%
10559*/
10560WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10561 const OrientationType orientation)
10562{
10563 assert(wand != (MagickWand *) NULL);
10564 assert(wand->signature == WandSignature);
10565 if (wand->debug != MagickFalse)
10566 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10567 if (wand->images == (Image *) NULL)
10568 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10569 wand->images->orientation=orientation;
10570 return(MagickTrue);
10571}
10572
10573/*
10574%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10575% %
10576% %
10577% %
10578% M a g i c k S e t I m a g e P a g e %
10579% %
10580% %
10581% %
10582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10583%
10584% MagickSetImagePage() sets the page geometry of the image.
10585%
10586% The format of the MagickSetImagePage method is:
10587%
10588% MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010589% const size_t width,const size_t height,const ssize_t x,
10590% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010591%
10592% A description of each parameter follows:
10593%
10594% o wand: the magick wand.
10595%
10596% o width: the page width.
10597%
10598% o height: the page height.
10599%
10600% o x: the page x-offset.
10601%
10602% o y: the page y-offset.
10603%
10604*/
10605WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010606 const size_t width,const size_t height,const ssize_t x,
10607 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010608{
10609 assert(wand != (MagickWand *) NULL);
10610 assert(wand->signature == WandSignature);
10611 if (wand->debug != MagickFalse)
10612 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10613 if (wand->images == (Image *) NULL)
10614 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10615 wand->images->page.width=width;
10616 wand->images->page.height=height;
10617 wand->images->page.x=x;
10618 wand->images->page.y=y;
10619 return(MagickTrue);
10620}
10621
10622/*
10623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10624% %
10625% %
10626% %
10627% 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 %
10628% %
10629% %
10630% %
10631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10632%
10633% MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10634% specified method and returns the previous progress monitor if any. The
10635% progress monitor method looks like this:
10636%
10637% MagickBooleanType MagickProgressMonitor(const char *text,
10638% const MagickOffsetType offset,const MagickSizeType span,
10639% void *client_data)
10640%
10641% If the progress monitor returns MagickFalse, the current operation is
10642% interrupted.
10643%
10644% The format of the MagickSetImageProgressMonitor method is:
10645%
10646% MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10647% const MagickProgressMonitor progress_monitor,void *client_data)
10648%
10649% A description of each parameter follows:
10650%
10651% o wand: the magick wand.
10652%
10653% o progress_monitor: Specifies a pointer to a method to monitor progress
10654% of an image operation.
10655%
10656% o client_data: Specifies a pointer to any client data.
10657%
10658*/
10659WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10660 const MagickProgressMonitor progress_monitor,void *client_data)
10661{
10662 MagickProgressMonitor
10663 previous_monitor;
10664
10665 assert(wand != (MagickWand *) NULL);
10666 assert(wand->signature == WandSignature);
10667 if (wand->debug != MagickFalse)
10668 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10669 if (wand->images == (Image *) NULL)
10670 {
10671 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10672 "ContainsNoImages","`%s'",wand->name);
10673 return((MagickProgressMonitor) NULL);
10674 }
10675 previous_monitor=SetImageProgressMonitor(wand->images,
10676 progress_monitor,client_data);
10677 return(previous_monitor);
10678}
10679
10680/*
10681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10682% %
10683% %
10684% %
10685% M a g i c k S e t I m a g e R e d P r i m a r y %
10686% %
10687% %
10688% %
10689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10690%
10691% MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10692%
10693% The format of the MagickSetImageRedPrimary method is:
10694%
10695% MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10696% const double x,const double y)
10697%
10698% A description of each parameter follows:
10699%
10700% o wand: the magick wand.
10701%
10702% o x: the red primary x-point.
10703%
10704% o y: the red primary y-point.
10705%
10706*/
10707WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10708 const double x,const double y)
10709{
10710 assert(wand != (MagickWand *) NULL);
10711 assert(wand->signature == WandSignature);
10712 if (wand->debug != MagickFalse)
10713 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10714 if (wand->images == (Image *) NULL)
10715 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10716 wand->images->chromaticity.red_primary.x=x;
10717 wand->images->chromaticity.red_primary.y=y;
10718 return(MagickTrue);
10719}
10720
10721/*
10722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10723% %
10724% %
10725% %
10726% 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 %
10727% %
10728% %
10729% %
10730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10731%
10732% MagickSetImageRenderingIntent() sets the image rendering intent.
10733%
10734% The format of the MagickSetImageRenderingIntent method is:
10735%
10736% MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10737% const RenderingIntent rendering_intent)
10738%
10739% A description of each parameter follows:
10740%
10741% o wand: the magick wand.
10742%
10743% o rendering_intent: the image rendering intent: UndefinedIntent,
10744% SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10745%
10746*/
10747WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10748 const RenderingIntent rendering_intent)
10749{
10750 assert(wand != (MagickWand *) NULL);
10751 assert(wand->signature == WandSignature);
10752 if (wand->debug != MagickFalse)
10753 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10754 if (wand->images == (Image *) NULL)
10755 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10756 wand->images->rendering_intent=rendering_intent;
10757 return(MagickTrue);
10758}
10759
10760/*
10761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10762% %
10763% %
10764% %
10765% M a g i c k S e t I m a g e R e s o l u t i o n %
10766% %
10767% %
10768% %
10769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10770%
10771% MagickSetImageResolution() sets the image resolution.
10772%
10773% The format of the MagickSetImageResolution method is:
10774%
10775% MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10776% const double x_resolution,const doubtl y_resolution)
10777%
10778% A description of each parameter follows:
10779%
10780% o wand: the magick wand.
10781%
10782% o x_resolution: the image x resolution.
10783%
10784% o y_resolution: the image y resolution.
10785%
10786*/
10787WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10788 const double x_resolution,const double y_resolution)
10789{
10790 assert(wand != (MagickWand *) NULL);
10791 assert(wand->signature == WandSignature);
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->x_resolution=x_resolution;
10797 wand->images->y_resolution=y_resolution;
10798 return(MagickTrue);
10799}
10800
10801/*
10802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10803% %
10804% %
10805% %
10806% M a g i c k S e t I m a g e S c e n e %
10807% %
10808% %
10809% %
10810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10811%
10812% MagickSetImageScene() sets the image scene.
10813%
10814% The format of the MagickSetImageScene method is:
10815%
10816% MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010817% const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +000010818%
10819% A description of each parameter follows:
10820%
10821% o wand: the magick wand.
10822%
10823% o delay: the image scene number.
10824%
10825*/
10826WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010827 const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +000010828{
10829 assert(wand != (MagickWand *) NULL);
10830 assert(wand->signature == WandSignature);
10831 if (wand->debug != MagickFalse)
10832 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10833 if (wand->images == (Image *) NULL)
10834 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10835 wand->images->scene=scene;
10836 return(MagickTrue);
10837}
10838
10839/*
10840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10841% %
10842% %
10843% %
10844% 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 %
10845% %
10846% %
10847% %
10848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10849%
10850% MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10851%
10852% The format of the MagickSetImageTicksPerSecond method is:
10853%
10854% MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010855% const ssize_t ticks_per-second)
cristy3ed852e2009-09-05 21:47:34 +000010856%
10857% A description of each parameter follows:
10858%
10859% o wand: the magick wand.
10860%
10861% o ticks_per_second: the units to use for the image delay.
10862%
10863*/
10864WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010865 const ssize_t ticks_per_second)
cristy3ed852e2009-09-05 21:47:34 +000010866{
10867 assert(wand != (MagickWand *) NULL);
10868 assert(wand->signature == WandSignature);
10869 if (wand->debug != MagickFalse)
10870 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10871 if (wand->images == (Image *) NULL)
10872 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10873 wand->images->ticks_per_second=ticks_per_second;
10874 return(MagickTrue);
10875}
10876
10877/*
10878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10879% %
10880% %
10881% %
10882% M a g i c k S e t I m a g e T y p e %
10883% %
10884% %
10885% %
10886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10887%
10888% MagickSetImageType() sets the image type.
10889%
10890% The format of the MagickSetImageType method is:
10891%
10892% MagickBooleanType MagickSetImageType(MagickWand *wand,
10893% const ImageType image_type)
10894%
10895% A description of each parameter follows:
10896%
10897% o wand: the magick wand.
10898%
10899% o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
10900% GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10901% TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10902% or OptimizeType.
10903%
10904*/
10905WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10906 const ImageType image_type)
10907{
10908 assert(wand != (MagickWand *) NULL);
10909 assert(wand->signature == WandSignature);
10910 if (wand->debug != MagickFalse)
10911 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10912 if (wand->images == (Image *) NULL)
10913 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10914 return(SetImageType(wand->images,image_type));
10915}
10916
10917/*
10918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10919% %
10920% %
10921% %
10922% M a g i c k S e t I m a g e U n i t s %
10923% %
10924% %
10925% %
10926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10927%
10928% MagickSetImageUnits() sets the image units of resolution.
10929%
10930% The format of the MagickSetImageUnits method is:
10931%
10932% MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10933% const ResolutionType units)
10934%
10935% A description of each parameter follows:
10936%
10937% o wand: the magick wand.
10938%
10939% o units: the image units of resolution : UndefinedResolution,
10940% PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10941%
10942*/
10943WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10944 const ResolutionType units)
10945{
10946 assert(wand != (MagickWand *) NULL);
10947 assert(wand->signature == WandSignature);
10948 if (wand->debug != MagickFalse)
10949 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10950 if (wand->images == (Image *) NULL)
10951 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10952 wand->images->units=units;
10953 return(MagickTrue);
10954}
10955
10956/*
10957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10958% %
10959% %
10960% %
10961% 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 %
10962% %
10963% %
10964% %
10965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10966%
10967% MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10968%
10969% The format of the MagickSetImageVirtualPixelMethod method is:
10970%
10971% VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10972% const VirtualPixelMethod method)
10973%
10974% A description of each parameter follows:
10975%
10976% o wand: the magick wand.
10977%
10978% o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10979% ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
10980% MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10981%
10982*/
10983WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10984 const VirtualPixelMethod method)
10985{
10986 assert(wand != (MagickWand *) NULL);
10987 assert(wand->signature == WandSignature);
10988 if (wand->debug != MagickFalse)
10989 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10990 if (wand->images == (Image *) NULL)
10991 return(UndefinedVirtualPixelMethod);
10992 return(SetImageVirtualPixelMethod(wand->images,method));
10993}
10994
10995/*
10996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10997% %
10998% %
10999% %
11000% M a g i c k S e t I m a g e W h i t e P o i n t %
11001% %
11002% %
11003% %
11004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11005%
11006% MagickSetImageWhitePoint() sets the image chromaticity white point.
11007%
11008% The format of the MagickSetImageWhitePoint method is:
11009%
11010% MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11011% const double x,const double y)
11012%
11013% A description of each parameter follows:
11014%
11015% o wand: the magick wand.
11016%
11017% o x: the white x-point.
11018%
11019% o y: the white y-point.
11020%
11021*/
11022WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11023 const double x,const double y)
11024{
11025 assert(wand != (MagickWand *) NULL);
11026 assert(wand->signature == WandSignature);
11027 if (wand->debug != MagickFalse)
11028 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11029 if (wand->images == (Image *) NULL)
11030 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11031 wand->images->chromaticity.white_point.x=x;
11032 wand->images->chromaticity.white_point.y=y;
11033 return(MagickTrue);
11034}
11035
11036/*
11037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11038% %
11039% %
11040% %
11041% M a g i c k S h a d e I m a g e C h a n n e l %
11042% %
11043% %
11044% %
11045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11046%
11047% MagickShadeImage() shines a distant light on an image to create a
11048% three-dimensional effect. You control the positioning of the light with
11049% azimuth and elevation; azimuth is measured in degrees off the x axis
11050% and elevation is measured in pixels above the Z axis.
11051%
11052% The format of the MagickShadeImage method is:
11053%
11054% MagickBooleanType MagickShadeImage(MagickWand *wand,
11055% const MagickBooleanType gray,const double azimuth,
11056% const double elevation)
11057%
11058% A description of each parameter follows:
11059%
11060% o wand: the magick wand.
11061%
11062% o gray: A value other than zero shades the intensity of each pixel.
11063%
11064% o azimuth, elevation: Define the light source direction.
11065%
11066*/
11067WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11068 const MagickBooleanType gray,const double asimuth,const double elevation)
11069{
11070 Image
11071 *shade_image;
11072
11073 assert(wand != (MagickWand *) NULL);
11074 assert(wand->signature == WandSignature);
11075 if (wand->debug != MagickFalse)
11076 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11077 if (wand->images == (Image *) NULL)
11078 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11079 shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
11080 if (shade_image == (Image *) NULL)
11081 return(MagickFalse);
11082 ReplaceImageInList(&wand->images,shade_image);
11083 return(MagickTrue);
11084}
11085
11086/*
11087%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11088% %
11089% %
11090% %
11091% M a g i c k S h a d o w I m a g e %
11092% %
11093% %
11094% %
11095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11096%
11097% MagickShadowImage() simulates an image shadow.
11098%
11099% The format of the MagickShadowImage method is:
11100%
11101% MagickBooleanType MagickShadowImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011102% const double opacity,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011103%
11104% A description of each parameter follows:
11105%
11106% o wand: the magick wand.
11107%
11108% o opacity: percentage transparency.
11109%
11110% o sigma: the standard deviation of the Gaussian, in pixels.
11111%
11112% o x: the shadow x-offset.
11113%
11114% o y: the shadow y-offset.
11115%
11116*/
11117WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011118 const double opacity,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011119{
11120 Image
11121 *shadow_image;
11122
11123 assert(wand != (MagickWand *) NULL);
11124 assert(wand->signature == WandSignature);
11125 if (wand->debug != MagickFalse)
11126 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11127 if (wand->images == (Image *) NULL)
11128 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11129 shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
11130 if (shadow_image == (Image *) NULL)
11131 return(MagickFalse);
11132 ReplaceImageInList(&wand->images,shadow_image);
11133 return(MagickTrue);
11134}
11135
11136/*
11137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11138% %
11139% %
11140% %
11141% M a g i c k S h a r p e n I m a g e %
11142% %
11143% %
11144% %
11145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11146%
11147% MagickSharpenImage() sharpens an image. We convolve the image with a
11148% Gaussian operator of the given radius and standard deviation (sigma).
11149% For reasonable results, the radius should be larger than sigma. Use a
11150% radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11151%
11152% The format of the MagickSharpenImage method is:
11153%
11154% MagickBooleanType MagickSharpenImage(MagickWand *wand,
11155% const double radius,const double sigma)
11156% MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11157% const ChannelType channel,const double radius,const double sigma)
11158%
11159% A description of each parameter follows:
11160%
11161% o wand: the magick wand.
11162%
11163% o channel: the image channel(s).
11164%
11165% o radius: the radius of the Gaussian, in pixels, not counting the center
11166% pixel.
11167%
11168% o sigma: the standard deviation of the Gaussian, in pixels.
11169%
11170*/
11171
11172WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11173 const double radius,const double sigma)
11174{
11175 MagickBooleanType
11176 status;
11177
11178 status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11179 return(status);
11180}
11181
11182WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11183 const ChannelType channel,const double radius,const double sigma)
11184{
11185 Image
11186 *sharp_image;
11187
11188 assert(wand != (MagickWand *) NULL);
11189 assert(wand->signature == WandSignature);
11190 if (wand->debug != MagickFalse)
11191 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11192 if (wand->images == (Image *) NULL)
11193 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11194 sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11195 wand->exception);
11196 if (sharp_image == (Image *) NULL)
11197 return(MagickFalse);
11198 ReplaceImageInList(&wand->images,sharp_image);
11199 return(MagickTrue);
11200}
11201
11202/*
11203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11204% %
11205% %
11206% %
11207% M a g i c k S h a v e I m a g e %
11208% %
11209% %
11210% %
11211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11212%
11213% MagickShaveImage() shaves pixels from the image edges. It allocates the
11214% memory necessary for the new Image structure and returns a pointer to the
11215% new image.
11216%
11217% The format of the MagickShaveImage method is:
11218%
11219% MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011220% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011221%
11222% A description of each parameter follows:
11223%
11224% o wand: the magick wand.
11225%
11226% o columns: the number of columns in the scaled image.
11227%
11228% o rows: the number of rows in the scaled image.
11229%
11230%
11231*/
11232WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011233 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011234{
11235 Image
11236 *shave_image;
11237
11238 RectangleInfo
11239 shave_info;
11240
11241 assert(wand != (MagickWand *) NULL);
11242 assert(wand->signature == WandSignature);
11243 if (wand->debug != MagickFalse)
11244 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11245 if (wand->images == (Image *) NULL)
11246 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11247 shave_info.width=columns;
11248 shave_info.height=rows;
11249 shave_info.x=0;
11250 shave_info.y=0;
11251 shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11252 if (shave_image == (Image *) NULL)
11253 return(MagickFalse);
11254 ReplaceImageInList(&wand->images,shave_image);
11255 return(MagickTrue);
11256}
11257
11258/*
11259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11260% %
11261% %
11262% %
11263% M a g i c k S h e a r I m a g e %
11264% %
11265% %
11266% %
11267%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11268%
cristycee97112010-05-28 00:44:52 +000011269% MagickShearImage() slides one edge of an image along the X or Y axis,
11270% creating a parallelogram. An X direction shear slides an edge along the X
11271% axis, while a Y direction shear slides an edge along the Y axis. The amount
cristy3ed852e2009-09-05 21:47:34 +000011272% of the shear is controlled by a shear angle. For X direction shears, x_shear
11273% is measured relative to the Y axis, and similarly, for Y direction shears
11274% y_shear is measured relative to the X axis. Empty triangles left over from
11275% shearing the image are filled with the background color.
11276%
11277% The format of the MagickShearImage method is:
11278%
11279% MagickBooleanType MagickShearImage(MagickWand *wand,
11280% const PixelWand *background,const double x_shear,onst double y_shear)
11281%
11282% A description of each parameter follows:
11283%
11284% o wand: the magick wand.
11285%
11286% o background: the background pixel wand.
11287%
11288% o x_shear: the number of degrees to shear the image.
11289%
11290% o y_shear: the number of degrees to shear the image.
11291%
11292*/
11293WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11294 const PixelWand *background,const double x_shear,const double y_shear)
11295{
11296 Image
11297 *shear_image;
11298
11299 assert(wand != (MagickWand *) NULL);
11300 assert(wand->signature == WandSignature);
11301 if (wand->debug != MagickFalse)
11302 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11303 if (wand->images == (Image *) NULL)
11304 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11305 PixelGetQuantumColor(background,&wand->images->background_color);
11306 shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11307 if (shear_image == (Image *) NULL)
11308 return(MagickFalse);
11309 ReplaceImageInList(&wand->images,shear_image);
11310 return(MagickTrue);
11311}
11312
11313/*
11314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11315% %
11316% %
11317% %
11318% 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 %
11319% %
11320% %
11321% %
11322%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11323%
11324% MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11325% non-linear sigmoidal contrast algorithm. Increase the contrast of the
11326% image using a sigmoidal transfer function without saturating highlights or
11327% shadows. Contrast indicates how much to increase the contrast (0 is none;
11328% 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11329% the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
11330% sharpen to MagickTrue to increase the image contrast otherwise the contrast
11331% is reduced.
11332%
11333% The format of the MagickSigmoidalContrastImage method is:
11334%
11335% MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11336% const MagickBooleanType sharpen,const double alpha,const double beta)
11337% MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11338% const ChannelType channel,const MagickBooleanType sharpen,
11339% const double alpha,const double beta)
11340%
11341% A description of each parameter follows:
11342%
11343% o wand: the magick wand.
11344%
11345% o channel: Identify which channel to level: RedChannel, GreenChannel,
11346%
11347% o sharpen: Increase or decrease image contrast.
11348%
11349% o alpha: control the "shoulder" of the contast curve.
11350%
11351% o beta: control the "toe" of the contast curve.
11352%
11353*/
11354
11355WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11356 const MagickBooleanType sharpen,const double alpha,const double beta)
11357{
11358 MagickBooleanType
11359 status;
11360
11361 status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11362 alpha,beta);
11363 return(status);
11364}
11365
11366WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11367 MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11368 const double alpha,const double beta)
11369{
11370 MagickBooleanType
11371 status;
11372
11373 assert(wand != (MagickWand *) NULL);
11374 assert(wand->signature == WandSignature);
11375 if (wand->debug != MagickFalse)
11376 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11377 if (wand->images == (Image *) NULL)
11378 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11379 status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11380 if (status == MagickFalse)
11381 InheritException(wand->exception,&wand->images->exception);
11382 return(status);
11383}
11384
11385/*
11386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11387% %
11388% %
11389% %
11390% M a g i c k S i m i l a r i t y I m a g e %
11391% %
11392% %
11393% %
11394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11395%
11396% MagickSimilarityImage() compares the reference image of the image and
11397% returns the best match offset. In addition, it returns a similarity image
11398% such that an exact match location is completely white and if none of the
11399% pixels match, black, otherwise some gray level in-between.
11400%
11401% The format of the MagickSimilarityImage method is:
11402%
11403% MagickWand *MagickSimilarityImage(MagickWand *wand,
11404% const MagickWand *reference,RectangeInfo *offset,double *similarity)
11405%
11406% A description of each parameter follows:
11407%
11408% o wand: the magick wand.
11409%
11410% o reference: the reference wand.
11411%
11412% o offset: the best match offset of the reference image within the image.
11413%
11414% o similarity: the computed similarity between the images.
11415%
11416*/
11417WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11418 const MagickWand *reference,RectangleInfo *offset,double *similarity)
11419{
11420 Image
11421 *similarity_image;
11422
11423 assert(wand != (MagickWand *) NULL);
11424 assert(wand->signature == WandSignature);
11425 if (wand->debug != MagickFalse)
11426 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11427 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11428 {
11429 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11430 "ContainsNoImages","`%s'",wand->name);
11431 return((MagickWand *) NULL);
11432 }
11433 similarity_image=SimilarityImage(wand->images,reference->images,offset,
11434 similarity,&wand->images->exception);
11435 if (similarity_image == (Image *) NULL)
11436 return((MagickWand *) NULL);
11437 return(CloneMagickWandFromImages(wand,similarity_image));
11438}
11439
11440/*
11441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11442% %
11443% %
11444% %
11445% M a g i c k S k e t c h I m a g e %
11446% %
11447% %
11448% %
11449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11450%
11451% MagickSketchImage() simulates a pencil sketch. We convolve the image with
11452% a Gaussian operator of the given radius and standard deviation (sigma).
11453% For reasonable results, radius should be larger than sigma. Use a
11454% radius of 0 and SketchImage() selects a suitable radius for you.
11455% Angle gives the angle of the blurring motion.
11456%
11457% The format of the MagickSketchImage method is:
11458%
11459% MagickBooleanType MagickSketchImage(MagickWand *wand,
11460% const double radius,const double sigma,const double angle)
11461%
11462% A description of each parameter follows:
11463%
11464% o wand: the magick wand.
11465%
11466% o radius: the radius of the Gaussian, in pixels, not counting
11467% the center pixel.
11468%
11469% o sigma: the standard deviation of the Gaussian, in pixels.
11470%
cristycee97112010-05-28 00:44:52 +000011471% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +000011472%
11473*/
11474WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11475 const double radius,const double sigma,const double angle)
11476{
11477 Image
11478 *sketch_image;
11479
11480 assert(wand != (MagickWand *) NULL);
11481 assert(wand->signature == WandSignature);
11482 if (wand->debug != MagickFalse)
11483 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11484 if (wand->images == (Image *) NULL)
11485 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11486 sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11487 if (sketch_image == (Image *) NULL)
11488 return(MagickFalse);
11489 ReplaceImageInList(&wand->images,sketch_image);
11490 return(MagickTrue);
11491}
11492
11493/*
11494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11495% %
11496% %
11497% %
11498% M a g i c k S o l a r i z e I m a g e %
11499% %
11500% %
11501% %
11502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11503%
11504% MagickSolarizeImage() applies a special effect to the image, similar to the
11505% effect achieved in a photo darkroom by selectively exposing areas of photo
11506% sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
11507% measure of the extent of the solarization.
11508%
11509% The format of the MagickSolarizeImage method is:
11510%
11511% MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11512% const double threshold)
11513%
11514% A description of each parameter follows:
11515%
11516% o wand: the magick wand.
11517%
11518% o threshold: Define the extent of the solarization.
11519%
11520*/
11521WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11522 const double threshold)
11523{
11524 MagickBooleanType
11525 status;
11526
11527 assert(wand != (MagickWand *) NULL);
11528 assert(wand->signature == WandSignature);
11529 if (wand->debug != MagickFalse)
11530 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11531 if (wand->images == (Image *) NULL)
11532 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11533 status=SolarizeImage(wand->images,threshold);
11534 if (status == MagickFalse)
11535 InheritException(wand->exception,&wand->images->exception);
11536 return(status);
11537}
11538
11539/*
11540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11541% %
11542% %
11543% %
11544% M a g i c k S p a r s e C o l o r I m a g e %
11545% %
11546% %
11547% %
11548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11549%
11550% MagickSparseColorImage(), given a set of coordinates, interpolates the
11551% colors found at those coordinates, across the whole image, using various
11552% methods.
11553%
11554% The format of the MagickSparseColorImage method is:
11555%
11556% MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11557% const ChannelType channel,const SparseColorMethod method,
cristybb503372010-05-27 20:51:26 +000011558% const size_t number_arguments,const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000011559%
11560% A description of each parameter follows:
11561%
11562% o image: the image to be sparseed.
11563%
11564% o method: the method of image sparseion.
11565%
11566% ArcSparseColorion will always ignore source image offset, and always
11567% 'bestfit' the destination image with the top left corner offset
11568% relative to the polar mapping center.
11569%
11570% Bilinear has no simple inverse mapping so will not allow 'bestfit'
11571% style of image sparseion.
11572%
11573% Affine, Perspective, and Bilinear, will do least squares fitting of
11574% the distrotion when more than the minimum number of control point
11575% pairs are provided.
11576%
11577% Perspective, and Bilinear, will fall back to a Affine sparseion when
11578% less than 4 control point pairs are provided. While Affine sparseions
11579% will let you use any number of control point pairs, that is Zero pairs
11580% is a No-Op (viewport only) distrotion, one pair is a translation and
11581% two pairs of control points will do a scale-rotate-translate, without
11582% any shearing.
11583%
11584% o number_arguments: the number of arguments given for this sparseion
11585% method.
11586%
11587% o arguments: the arguments for this sparseion method.
11588%
11589*/
11590WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11591 const ChannelType channel,const SparseColorMethod method,
cristybb503372010-05-27 20:51:26 +000011592 const size_t number_arguments,const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000011593{
11594 Image
11595 *sparse_image;
11596
11597 assert(wand != (MagickWand *) NULL);
11598 assert(wand->signature == WandSignature);
11599 if (wand->debug != MagickFalse)
11600 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11601 if (wand->images == (Image *) NULL)
11602 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11603 sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11604 arguments,wand->exception);
11605 if (sparse_image == (Image *) NULL)
11606 return(MagickFalse);
11607 ReplaceImageInList(&wand->images,sparse_image);
11608 return(MagickTrue);
11609}
11610
11611/*
11612%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11613% %
11614% %
11615% %
11616% M a g i c k S p l i c e I m a g e %
11617% %
11618% %
11619% %
11620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11621%
11622% MagickSpliceImage() splices a solid color into the image.
11623%
11624% The format of the MagickSpliceImage method is:
11625%
11626% MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011627% const size_t width,const size_t height,const ssize_t x,
11628% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011629%
11630% A description of each parameter follows:
11631%
11632% o wand: the magick wand.
11633%
11634% o width: the region width.
11635%
11636% o height: the region height.
11637%
11638% o x: the region x offset.
11639%
11640% o y: the region y offset.
11641%
11642*/
11643WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011644 const size_t width,const size_t height,const ssize_t x,
11645 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011646{
11647 Image
11648 *splice_image;
11649
11650 RectangleInfo
11651 splice;
11652
11653 assert(wand != (MagickWand *) NULL);
11654 assert(wand->signature == WandSignature);
11655 if (wand->debug != MagickFalse)
11656 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11657 if (wand->images == (Image *) NULL)
11658 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11659 splice.width=width;
11660 splice.height=height;
11661 splice.x=x;
11662 splice.y=y;
11663 splice_image=SpliceImage(wand->images,&splice,wand->exception);
11664 if (splice_image == (Image *) NULL)
11665 return(MagickFalse);
11666 ReplaceImageInList(&wand->images,splice_image);
11667 return(MagickTrue);
11668}
11669
11670/*
11671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672% %
11673% %
11674% %
11675% M a g i c k S p r e a d I m a g e %
11676% %
11677% %
11678% %
11679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11680%
11681% MagickSpreadImage() is a special effects method that randomly displaces each
11682% pixel in a block defined by the radius parameter.
11683%
11684% The format of the MagickSpreadImage method is:
11685%
11686% MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11687%
11688% A description of each parameter follows:
11689%
11690% o wand: the magick wand.
11691%
11692% o radius: Choose a random pixel in a neighborhood of this extent.
11693%
11694*/
11695WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11696 const double radius)
11697{
11698 Image
11699 *spread_image;
11700
11701 assert(wand != (MagickWand *) NULL);
11702 assert(wand->signature == WandSignature);
11703 if (wand->debug != MagickFalse)
11704 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11705 if (wand->images == (Image *) NULL)
11706 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11707 spread_image=SpreadImage(wand->images,radius,wand->exception);
11708 if (spread_image == (Image *) NULL)
11709 return(MagickFalse);
11710 ReplaceImageInList(&wand->images,spread_image);
11711 return(MagickTrue);
11712}
11713
11714/*
11715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11716% %
11717% %
11718% %
11719% M a g i c k S t e g a n o I m a g e %
11720% %
11721% %
11722% %
11723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11724%
11725% MagickSteganoImage() hides a digital watermark within the image.
11726% Recover the hidden watermark later to prove that the authenticity of
11727% an image. Offset defines the start position within the image to hide
11728% the watermark.
11729%
11730% The format of the MagickSteganoImage method is:
11731%
11732% MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011733% const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000011734%
11735% A description of each parameter follows:
11736%
11737% o wand: the magick wand.
11738%
11739% o watermark_wand: the watermark wand.
11740%
11741% o offset: Start hiding at this offset into the image.
11742%
11743*/
11744WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011745 const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000011746{
11747 Image
11748 *stegano_image;
11749
11750 assert(wand != (MagickWand *) NULL);
11751 assert(wand->signature == WandSignature);
11752 if (wand->debug != MagickFalse)
11753 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11754 if ((wand->images == (Image *) NULL) ||
11755 (watermark_wand->images == (Image *) NULL))
11756 {
11757 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11758 "ContainsNoImages","`%s'",wand->name);
11759 return((MagickWand *) NULL);
11760 }
11761 wand->images->offset=offset;
11762 stegano_image=SteganoImage(wand->images,watermark_wand->images,
11763 wand->exception);
11764 if (stegano_image == (Image *) NULL)
11765 return((MagickWand *) NULL);
11766 return(CloneMagickWandFromImages(wand,stegano_image));
11767}
11768
11769/*
11770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11771% %
11772% %
11773% %
11774% M a g i c k S t e r e o I m a g e %
11775% %
11776% %
11777% %
11778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11779%
11780% MagickStereoImage() composites two images and produces a single image that
11781% is the composite of a left and right image of a stereo pair
11782%
11783% The format of the MagickStereoImage method is:
11784%
11785% MagickWand *MagickStereoImage(MagickWand *wand,
11786% const MagickWand *offset_wand)
11787%
11788% A description of each parameter follows:
11789%
11790% o wand: the magick wand.
11791%
11792% o offset_wand: Another image wand.
11793%
11794*/
11795WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11796 const MagickWand *offset_wand)
11797{
11798 Image
11799 *stereo_image;
11800
11801 assert(wand != (MagickWand *) NULL);
11802 assert(wand->signature == WandSignature);
11803 if (wand->debug != MagickFalse)
11804 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11805 if ((wand->images == (Image *) NULL) ||
11806 (offset_wand->images == (Image *) NULL))
11807 {
11808 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11809 "ContainsNoImages","`%s'",wand->name);
11810 return((MagickWand *) NULL);
11811 }
11812 stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11813 if (stereo_image == (Image *) NULL)
11814 return((MagickWand *) NULL);
11815 return(CloneMagickWandFromImages(wand,stereo_image));
11816}
11817
11818/*
11819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11820% %
11821% %
11822% %
11823% M a g i c k S t r i p I m a g e %
11824% %
11825% %
11826% %
11827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11828%
11829% MagickStripImage() strips an image of all profiles and comments.
11830%
11831% The format of the MagickStripImage method is:
11832%
11833% MagickBooleanType MagickStripImage(MagickWand *wand)
11834%
11835% A description of each parameter follows:
11836%
11837% o wand: the magick wand.
11838%
11839*/
11840WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11841{
11842 MagickBooleanType
11843 status;
11844
11845 assert(wand != (MagickWand *) NULL);
11846 assert(wand->signature == WandSignature);
11847 if (wand->debug != MagickFalse)
11848 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11849 if (wand->images == (Image *) NULL)
11850 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11851 status=StripImage(wand->images);
11852 if (status == MagickFalse)
11853 InheritException(wand->exception,&wand->images->exception);
11854 return(status);
11855}
11856
11857/*
11858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11859% %
11860% %
11861% %
11862% M a g i c k S w i r l I m a g e %
11863% %
11864% %
11865% %
11866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11867%
11868% MagickSwirlImage() swirls the pixels about the center of the image, where
11869% degrees indicates the sweep of the arc through which each pixel is moved.
11870% You get a more dramatic effect as the degrees move from 1 to 360.
11871%
11872% The format of the MagickSwirlImage method is:
11873%
11874% MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11875%
11876% A description of each parameter follows:
11877%
11878% o wand: the magick wand.
11879%
11880% o degrees: Define the tightness of the swirling effect.
11881%
11882*/
11883WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11884 const double degrees)
11885{
11886 Image
11887 *swirl_image;
11888
11889 assert(wand != (MagickWand *) NULL);
11890 assert(wand->signature == WandSignature);
11891 if (wand->debug != MagickFalse)
11892 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11893 if (wand->images == (Image *) NULL)
11894 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11895 swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11896 if (swirl_image == (Image *) NULL)
11897 return(MagickFalse);
11898 ReplaceImageInList(&wand->images,swirl_image);
11899 return(MagickTrue);
11900}
11901
11902/*
11903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11904% %
11905% %
11906% %
11907% M a g i c k T e x t u r e I m a g e %
11908% %
11909% %
11910% %
11911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11912%
11913% MagickTextureImage() repeatedly tiles the texture image across and down the
11914% image canvas.
11915%
11916% The format of the MagickTextureImage method is:
11917%
11918% MagickWand *MagickTextureImage(MagickWand *wand,
11919% const MagickWand *texture_wand)
11920%
11921% A description of each parameter follows:
11922%
11923% o wand: the magick wand.
11924%
11925% o texture_wand: the texture wand
11926%
11927*/
11928WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11929 const MagickWand *texture_wand)
11930{
11931 Image
11932 *texture_image;
11933
11934 MagickBooleanType
11935 status;
11936
11937 assert(wand != (MagickWand *) NULL);
11938 assert(wand->signature == WandSignature);
11939 if (wand->debug != MagickFalse)
11940 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11941 if ((wand->images == (Image *) NULL) ||
11942 (texture_wand->images == (Image *) NULL))
11943 {
11944 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11945 "ContainsNoImages","`%s'",wand->name);
11946 return((MagickWand *) NULL);
11947 }
11948 texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11949 if (texture_image == (Image *) NULL)
11950 return((MagickWand *) NULL);
11951 status=TextureImage(texture_image,texture_wand->images);
11952 if (status == MagickFalse)
11953 {
11954 InheritException(wand->exception,&texture_image->exception);
11955 texture_image=DestroyImage(texture_image);
11956 return((MagickWand *) NULL);
11957 }
11958 return(CloneMagickWandFromImages(wand,texture_image));
11959}
11960
11961/*
11962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11963% %
11964% %
11965% %
11966% M a g i c k T h r e s h o l d I m a g e %
11967% %
11968% %
11969% %
11970%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11971%
11972% MagickThresholdImage() changes the value of individual pixels based on
11973% the intensity of each pixel compared to threshold. The result is a
11974% high-contrast, two color image.
11975%
11976% The format of the MagickThresholdImage method is:
11977%
11978% MagickBooleanType MagickThresholdImage(MagickWand *wand,
11979% const double threshold)
11980% MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11981% const ChannelType channel,const double threshold)
11982%
11983% A description of each parameter follows:
11984%
11985% o wand: the magick wand.
11986%
11987% o channel: the image channel(s).
11988%
11989% o threshold: Define the threshold value.
11990%
11991*/
11992WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11993 const double threshold)
11994{
11995 MagickBooleanType
11996 status;
11997
11998 status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11999 return(status);
12000}
12001
12002WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12003 const ChannelType channel,const double threshold)
12004{
12005 MagickBooleanType
12006 status;
12007
12008 assert(wand != (MagickWand *) NULL);
12009 assert(wand->signature == WandSignature);
12010 if (wand->debug != MagickFalse)
12011 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12012 if (wand->images == (Image *) NULL)
12013 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12014 status=BilevelImageChannel(wand->images,channel,threshold);
12015 if (status == MagickFalse)
12016 InheritException(wand->exception,&wand->images->exception);
12017 return(status);
12018}
12019
12020/*
12021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12022% %
12023% %
12024% %
12025% M a g i c k T h u m b n a i l I m a g e %
12026% %
12027% %
12028% %
12029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12030%
12031% MagickThumbnailImage() changes the size of an image to the given dimensions
12032% and removes any associated profiles. The goal is to produce small low cost
12033% thumbnail images suited for display on the Web.
12034%
12035% The format of the MagickThumbnailImage method is:
12036%
12037% MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000012038% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000012039%
12040% A description of each parameter follows:
12041%
12042% o wand: the magick wand.
12043%
12044% o columns: the number of columns in the scaled image.
12045%
12046% o rows: the number of rows in the scaled image.
12047%
12048*/
12049WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000012050 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000012051{
12052 Image
12053 *thumbnail_image;
12054
12055 assert(wand != (MagickWand *) NULL);
12056 assert(wand->signature == WandSignature);
12057 if (wand->debug != MagickFalse)
12058 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12059 if (wand->images == (Image *) NULL)
12060 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12061 thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12062 if (thumbnail_image == (Image *) NULL)
12063 return(MagickFalse);
12064 ReplaceImageInList(&wand->images,thumbnail_image);
12065 return(MagickTrue);
12066}
12067
12068/*
12069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12070% %
12071% %
12072% %
12073% M a g i c k T i n t I m a g e %
12074% %
12075% %
12076% %
12077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12078%
12079% MagickTintImage() applies a color vector to each pixel in the image. The
12080% length of the vector is 0 for black and white and at its maximum for the
12081% midtones. The vector weighting function is
12082% f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12083%
12084% The format of the MagickTintImage method is:
12085%
12086% MagickBooleanType MagickTintImage(MagickWand *wand,
12087% const PixelWand *tint,const PixelWand *opacity)
12088%
12089% A description of each parameter follows:
12090%
12091% o wand: the magick wand.
12092%
12093% o tint: the tint pixel wand.
12094%
12095% o opacity: the opacity pixel wand.
12096%
12097*/
12098WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12099 const PixelWand *tint,const PixelWand *opacity)
12100{
12101 char
12102 percent_opaque[MaxTextExtent];
12103
12104 Image
12105 *tint_image;
12106
12107 PixelPacket
12108 target;
12109
12110 assert(wand != (MagickWand *) NULL);
12111 assert(wand->signature == WandSignature);
12112 if (wand->debug != MagickFalse)
12113 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12114 if (wand->images == (Image *) NULL)
12115 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy8cd5b312010-01-07 01:10:24 +000012116 (void) FormatMagickString(percent_opaque,MaxTextExtent,
cristye7f51092010-01-17 00:39:37 +000012117 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristy8cd5b312010-01-07 01:10:24 +000012118 PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12119 PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12120 PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12121 PixelGetOpacityQuantum(opacity)));
cristy3ed852e2009-09-05 21:47:34 +000012122 PixelGetQuantumColor(tint,&target);
12123 tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12124 if (tint_image == (Image *) NULL)
12125 return(MagickFalse);
12126 ReplaceImageInList(&wand->images,tint_image);
12127 return(MagickTrue);
12128}
12129
12130/*
12131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12132% %
12133% %
12134% %
12135% M a g i c k T r a n s f o r m I m a g e %
12136% %
12137% %
12138% %
12139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12140%
12141% MagickTransformImage() is a convenience method that behaves like
12142% MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12143% information as a region geometry specification. If the operation fails,
12144% a NULL image handle is returned.
12145%
12146% The format of the MagickTransformImage method is:
12147%
12148% MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12149% const char *geometry)
12150%
12151% A description of each parameter follows:
12152%
12153% o wand: the magick wand.
12154%
12155% o crop: A crop geometry string. This geometry defines a subregion of the
12156% image to crop.
12157%
12158% o geometry: An image geometry string. This geometry defines the final
12159% size of the image.
12160%
12161*/
12162WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12163 const char *crop,const char *geometry)
12164{
12165 Image
12166 *transform_image;
12167
12168 MagickBooleanType
12169 status;
12170
12171 assert(wand != (MagickWand *) NULL);
12172 assert(wand->signature == WandSignature);
12173 if (wand->debug != MagickFalse)
12174 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12175 if (wand->images == (Image *) NULL)
12176 return((MagickWand *) NULL);
12177 transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12178 if (transform_image == (Image *) NULL)
12179 return((MagickWand *) NULL);
12180 status=TransformImage(&transform_image,crop,geometry);
12181 if (status == MagickFalse)
12182 {
12183 InheritException(wand->exception,&transform_image->exception);
12184 transform_image=DestroyImage(transform_image);
12185 return((MagickWand *) NULL);
12186 }
12187 return(CloneMagickWandFromImages(wand,transform_image));
12188}
12189
12190/*
12191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12192% %
12193% %
12194% %
12195% 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 %
12196% %
12197% %
12198% %
12199%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12200%
12201% MagickTransformImageColorspace() transform the image colorspace.
12202%
12203% The format of the MagickTransformImageColorspace method is:
12204%
12205% MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12206% const ColorspaceType colorspace)
12207%
12208% A description of each parameter follows:
12209%
12210% o wand: the magick wand.
12211%
12212% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
12213% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
12214% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
12215% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
12216% HSLColorspace, or HWBColorspace.
12217%
12218*/
12219WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12220 const ColorspaceType colorspace)
12221{
12222 assert(wand != (MagickWand *) NULL);
12223 assert(wand->signature == WandSignature);
12224 if (wand->debug != MagickFalse)
12225 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12226 if (wand->images == (Image *) NULL)
12227 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12228 return(TransformImageColorspace(wand->images,colorspace));
12229}
12230
12231/*
12232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12233% %
12234% %
12235% %
12236% 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 %
12237% %
12238% %
12239% %
12240%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12241%
12242% MagickTransparentPaintImage() changes any pixel that matches color with the
12243% color defined by fill.
12244%
12245% The format of the MagickTransparentPaintImage method is:
12246%
12247% MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12248% const PixelWand *target,const double alpha,const double fuzz,
12249% const MagickBooleanType invert)
12250%
12251% A description of each parameter follows:
12252%
12253% o wand: the magick wand.
12254%
12255% o target: Change this target color to specified opacity value within
12256% the image.
12257%
12258% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12259% transparent.
12260%
12261% o fuzz: By default target must match a particular pixel color
12262% exactly. However, in many cases two colors may differ by a small amount.
12263% The fuzz member of image defines how much tolerance is acceptable to
12264% consider two colors as the same. For example, set fuzz to 10 and the
12265% color red at intensities of 100 and 102 respectively are now interpreted
12266% as the same color for the purposes of the floodfill.
12267%
12268% o invert: paint any pixel that does not match the target color.
12269%
12270*/
12271WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12272 const PixelWand *target,const double alpha,const double fuzz,
12273 const MagickBooleanType invert)
12274{
12275 MagickBooleanType
12276 status;
12277
12278 MagickPixelPacket
12279 target_pixel;
12280
12281 assert(wand != (MagickWand *) NULL);
12282 assert(wand->signature == WandSignature);
12283 if (wand->debug != MagickFalse)
12284 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12285 if (wand->images == (Image *) NULL)
12286 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12287 PixelGetMagickColor(target,&target_pixel);
12288 wand->images->fuzz=fuzz;
cristyce70c172010-01-07 17:15:30 +000012289 status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
cristy3ed852e2009-09-05 21:47:34 +000012290 (MagickRealType) QuantumRange-QuantumRange*alpha),invert);
12291 if (status == MagickFalse)
12292 InheritException(wand->exception,&wand->images->exception);
12293 return(status);
12294}
12295
12296/*
12297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12298% %
12299% %
12300% %
12301% M a g i c k T r a n s p o s e I m a g e %
12302% %
12303% %
12304% %
12305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12306%
12307% MagickTransposeImage() creates a vertical mirror image by reflecting the
12308% pixels around the central x-axis while rotating them 90-degrees.
12309%
12310% The format of the MagickTransposeImage method is:
12311%
12312% MagickBooleanType MagickTransposeImage(MagickWand *wand)
12313%
12314% A description of each parameter follows:
12315%
12316% o wand: the magick wand.
12317%
12318*/
12319WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12320{
12321 Image
12322 *transpose_image;
12323
12324 assert(wand != (MagickWand *) NULL);
12325 assert(wand->signature == WandSignature);
12326 if (wand->debug != MagickFalse)
12327 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12328 if (wand->images == (Image *) NULL)
12329 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12330 transpose_image=TransposeImage(wand->images,wand->exception);
12331 if (transpose_image == (Image *) NULL)
12332 return(MagickFalse);
12333 ReplaceImageInList(&wand->images,transpose_image);
12334 return(MagickTrue);
12335}
12336
12337/*
12338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12339% %
12340% %
12341% %
12342% M a g i c k T r a n s v e r s e I m a g e %
12343% %
12344% %
12345% %
12346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12347%
12348% MagickTransverseImage() creates a horizontal mirror image by reflecting the
12349% pixels around the central y-axis while rotating them 270-degrees.
12350%
12351% The format of the MagickTransverseImage method is:
12352%
12353% MagickBooleanType MagickTransverseImage(MagickWand *wand)
12354%
12355% A description of each parameter follows:
12356%
12357% o wand: the magick wand.
12358%
12359*/
12360WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12361{
12362 Image
12363 *transverse_image;
12364
12365 assert(wand != (MagickWand *) NULL);
12366 assert(wand->signature == WandSignature);
12367 if (wand->debug != MagickFalse)
12368 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12369 if (wand->images == (Image *) NULL)
12370 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12371 transverse_image=TransverseImage(wand->images,wand->exception);
12372 if (transverse_image == (Image *) NULL)
12373 return(MagickFalse);
12374 ReplaceImageInList(&wand->images,transverse_image);
12375 return(MagickTrue);
12376}
12377
12378/*
12379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12380% %
12381% %
12382% %
12383% M a g i c k T r i m I m a g e %
12384% %
12385% %
12386% %
12387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12388%
12389% MagickTrimImage() remove edges that are the background color from the image.
12390%
12391% The format of the MagickTrimImage method is:
12392%
12393% MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12394%
12395% A description of each parameter follows:
12396%
12397% o wand: the magick wand.
12398%
12399% o fuzz: By default target must match a particular pixel color
12400% exactly. However, in many cases two colors may differ by a small amount.
12401% The fuzz member of image defines how much tolerance is acceptable to
12402% consider two colors as the same. For example, set fuzz to 10 and the
12403% color red at intensities of 100 and 102 respectively are now interpreted
12404% as the same color for the purposes of the floodfill.
12405%
12406*/
12407WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12408{
12409 Image
12410 *trim_image;
12411
12412 assert(wand != (MagickWand *) NULL);
12413 assert(wand->signature == WandSignature);
12414 if (wand->debug != MagickFalse)
12415 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12416 if (wand->images == (Image *) NULL)
12417 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12418 wand->images->fuzz=fuzz;
12419 trim_image=TrimImage(wand->images,wand->exception);
12420 if (trim_image == (Image *) NULL)
12421 return(MagickFalse);
12422 ReplaceImageInList(&wand->images,trim_image);
12423 return(MagickTrue);
12424}
12425
12426/*
12427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12428% %
12429% %
12430% %
12431% M a g i c k U n i q u e I m a g e C o l o r s %
12432% %
12433% %
12434% %
12435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12436%
12437% MagickUniqueImageColors() discards all but one of any pixel color.
12438%
12439% The format of the MagickUniqueImageColors method is:
12440%
12441% MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12442%
12443% A description of each parameter follows:
12444%
12445% o wand: the magick wand.
12446%
12447*/
12448WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12449{
12450 Image
12451 *unique_image;
12452
12453 assert(wand != (MagickWand *) NULL);
12454 assert(wand->signature == WandSignature);
12455 if (wand->debug != MagickFalse)
12456 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12457 if (wand->images == (Image *) NULL)
12458 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12459 unique_image=UniqueImageColors(wand->images,wand->exception);
12460 if (unique_image == (Image *) NULL)
12461 return(MagickFalse);
12462 ReplaceImageInList(&wand->images,unique_image);
12463 return(MagickTrue);
12464}
12465
12466/*
12467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12468% %
12469% %
12470% %
12471% M a g i c k U n s h a r p M a s k I m a g e %
12472% %
12473% %
12474% %
12475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12476%
12477% MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
12478% Gaussian operator of the given radius and standard deviation (sigma).
12479% For reasonable results, radius should be larger than sigma. Use a radius
12480% of 0 and UnsharpMaskImage() selects a suitable radius for you.
12481%
12482% The format of the MagickUnsharpMaskImage method is:
12483%
12484% MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12485% const double radius,const double sigma,const double amount,
12486% const double threshold)
12487% MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12488% const ChannelType channel,const double radius,const double sigma,
12489% const double amount,const double threshold)
12490%
12491% A description of each parameter follows:
12492%
12493% o wand: the magick wand.
12494%
12495% o channel: the image channel(s).
12496%
12497% o radius: the radius of the Gaussian, in pixels, not counting the center
12498% pixel.
12499%
12500% o sigma: the standard deviation of the Gaussian, in pixels.
12501%
12502% o amount: the percentage of the difference between the original and the
12503% blur image that is added back into the original.
12504%
12505% o threshold: the threshold in pixels needed to apply the diffence amount.
12506%
12507*/
12508
12509WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12510 const double radius,const double sigma,const double amount,
12511 const double threshold)
12512{
12513 MagickBooleanType
12514 status;
12515
12516 status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12517 amount,threshold);
12518 return(status);
12519}
12520
12521WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12522 const ChannelType channel,const double radius,const double sigma,
12523 const double amount,const double threshold)
12524{
12525 Image
12526 *unsharp_image;
12527
12528 assert(wand != (MagickWand *) NULL);
12529 assert(wand->signature == WandSignature);
12530 if (wand->debug != MagickFalse)
12531 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12532 if (wand->images == (Image *) NULL)
12533 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12534 unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12535 amount,threshold,wand->exception);
12536 if (unsharp_image == (Image *) NULL)
12537 return(MagickFalse);
12538 ReplaceImageInList(&wand->images,unsharp_image);
12539 return(MagickTrue);
12540}
12541
12542/*
12543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12544% %
12545% %
12546% %
12547% M a g i c k V i g n e t t e I m a g e %
12548% %
12549% %
12550% %
12551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12552%
12553% MagickVignetteImage() softens the edges of the image in vignette style.
12554%
12555% The format of the MagickVignetteImage method is:
12556%
12557% MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000012558% const double black_point,const double white_point,const ssize_t x,
12559% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000012560%
12561% A description of each parameter follows:
12562%
12563% o wand: the magick wand.
12564%
12565% o black_point: the black point.
12566%
12567% o white_point: the white point.
12568%
12569% o x, y: Define the x and y ellipse offset.
12570%
12571*/
12572WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000012573 const double black_point,const double white_point,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000012574{
12575 Image
12576 *vignette_image;
12577
12578 assert(wand != (MagickWand *) NULL);
12579 assert(wand->signature == WandSignature);
12580 if (wand->debug != MagickFalse)
12581 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12582 if (wand->images == (Image *) NULL)
12583 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12584 vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12585 wand->exception);
12586 if (vignette_image == (Image *) NULL)
12587 return(MagickFalse);
12588 ReplaceImageInList(&wand->images,vignette_image);
12589 return(MagickTrue);
12590}
12591
12592/*
12593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12594% %
12595% %
12596% %
12597% M a g i c k W a v e I m a g e %
12598% %
12599% %
12600% %
12601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12602%
12603% MagickWaveImage() creates a "ripple" effect in the image by shifting
cristycee97112010-05-28 00:44:52 +000012604% the pixels vertically along a sine wave whose amplitude and wavelength
cristy3ed852e2009-09-05 21:47:34 +000012605% is specified by the given parameters.
12606%
12607% The format of the MagickWaveImage method is:
12608%
12609% MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12610% const double wave_length)
12611%
12612% A description of each parameter follows:
12613%
12614% o wand: the magick wand.
12615%
12616% o amplitude, wave_length: Define the amplitude and wave length of the
12617% sine wave.
12618%
12619*/
12620WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12621 const double amplitude,const double wave_length)
12622{
12623 Image
12624 *wave_image;
12625
12626 assert(wand != (MagickWand *) NULL);
12627 assert(wand->signature == WandSignature);
12628 if (wand->debug != MagickFalse)
12629 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12630 if (wand->images == (Image *) NULL)
12631 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12632 wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12633 if (wave_image == (Image *) NULL)
12634 return(MagickFalse);
12635 ReplaceImageInList(&wand->images,wave_image);
12636 return(MagickTrue);
12637}
12638
12639/*
12640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12641% %
12642% %
12643% %
12644% 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 %
12645% %
12646% %
12647% %
12648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12649%
12650% MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
12651% above the threshold into white while leaving all pixels below the threshold
12652% unchanged.
12653%
12654% The format of the MagickWhiteThresholdImage method is:
12655%
12656% MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12657% const PixelWand *threshold)
12658%
12659% A description of each parameter follows:
12660%
12661% o wand: the magick wand.
12662%
12663% o threshold: the pixel wand.
12664%
12665*/
12666WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12667 const PixelWand *threshold)
12668{
12669 char
12670 thresholds[MaxTextExtent];
12671
12672 MagickBooleanType
12673 status;
12674
12675 assert(wand != (MagickWand *) NULL);
12676 assert(wand->signature == WandSignature);
12677 if (wand->debug != MagickFalse)
12678 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12679 if (wand->images == (Image *) NULL)
12680 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12681 (void) FormatMagickString(thresholds,MaxTextExtent,
12682 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12683 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12684 PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12685 status=WhiteThresholdImage(wand->images,thresholds);
12686 if (status == MagickFalse)
12687 InheritException(wand->exception,&wand->images->exception);
12688 return(status);
12689}
12690
12691/*
12692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12693% %
12694% %
12695% %
12696% M a g i c k W r i t e I m a g e %
12697% %
12698% %
12699% %
12700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12701%
12702% MagickWriteImage() writes an image to the specified filename. If the
12703% filename parameter is NULL, the image is written to the filename set
12704% by MagickReadImage() or MagickSetImageFilename().
12705%
12706% The format of the MagickWriteImage method is:
12707%
12708% MagickBooleanType MagickWriteImage(MagickWand *wand,
12709% const char *filename)
12710%
12711% A description of each parameter follows:
12712%
12713% o wand: the magick wand.
12714%
12715% o filename: the image filename.
12716%
12717%
12718*/
12719WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12720 const char *filename)
12721{
12722 Image
12723 *image;
12724
12725 ImageInfo
12726 *write_info;
12727
12728 MagickBooleanType
12729 status;
12730
12731 assert(wand != (MagickWand *) NULL);
12732 assert(wand->signature == WandSignature);
12733 if (wand->debug != MagickFalse)
12734 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12735 if (wand->images == (Image *) NULL)
12736 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12737 if (filename != (const char *) NULL)
12738 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12739 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12740 if (image == (Image *) NULL)
12741 return(MagickFalse);
12742 write_info=CloneImageInfo(wand->image_info);
12743 write_info->adjoin=MagickTrue;
12744 status=WriteImage(write_info,image);
12745 if (status == MagickFalse)
12746 InheritException(wand->exception,&image->exception);
12747 image=DestroyImage(image);
12748 write_info=DestroyImageInfo(write_info);
12749 return(status);
12750}
12751
12752/*
12753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12754% %
12755% %
12756% %
12757% M a g i c k W r i t e I m a g e F i l e %
12758% %
12759% %
12760% %
12761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12762%
12763% MagickWriteImageFile() writes an image to an open file descriptor.
12764%
12765% The format of the MagickWriteImageFile method is:
12766%
12767% MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12768%
12769% A description of each parameter follows:
12770%
12771% o wand: the magick wand.
12772%
12773% o file: the file descriptor.
12774%
cristy3ed852e2009-09-05 21:47:34 +000012775*/
12776WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12777{
12778 Image
12779 *image;
12780
12781 ImageInfo
12782 *write_info;
12783
12784 MagickBooleanType
12785 status;
12786
12787 assert(wand != (MagickWand *) NULL);
12788 assert(wand->signature == WandSignature);
12789 assert(file != (FILE *) NULL);
12790 if (wand->debug != MagickFalse)
12791 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12792 if (wand->images == (Image *) NULL)
12793 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12794 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12795 if (image == (Image *) NULL)
12796 return(MagickFalse);
12797 write_info=CloneImageInfo(wand->image_info);
12798 SetImageInfoFile(write_info,file);
12799 write_info->adjoin=MagickTrue;
12800 status=WriteImage(write_info,image);
12801 write_info=DestroyImageInfo(write_info);
12802 if (status == MagickFalse)
12803 InheritException(wand->exception,&image->exception);
12804 image=DestroyImage(image);
12805 return(status);
12806}
12807
12808/*
12809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12810% %
12811% %
12812% %
12813% M a g i c k W r i t e I m a g e s %
12814% %
12815% %
12816% %
12817%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12818%
12819% MagickWriteImages() writes an image or image sequence.
12820%
12821% The format of the MagickWriteImages method is:
12822%
12823% MagickBooleanType MagickWriteImages(MagickWand *wand,
12824% const char *filename,const MagickBooleanType adjoin)
12825%
12826% A description of each parameter follows:
12827%
12828% o wand: the magick wand.
12829%
12830% o filename: the image filename.
12831%
12832% o adjoin: join images into a single multi-image file.
12833%
12834*/
12835WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12836 const char *filename,const MagickBooleanType adjoin)
12837{
12838 ImageInfo
12839 *write_info;
12840
12841 MagickBooleanType
12842 status;
12843
12844 assert(wand != (MagickWand *) NULL);
12845 assert(wand->signature == WandSignature);
12846 if (wand->debug != MagickFalse)
12847 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12848 if (wand->images == (Image *) NULL)
12849 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12850 write_info=CloneImageInfo(wand->image_info);
12851 write_info->adjoin=adjoin;
12852 status=WriteImages(write_info,wand->images,filename,wand->exception);
12853 if (status == MagickFalse)
12854 InheritException(wand->exception,&wand->images->exception);
12855 write_info=DestroyImageInfo(write_info);
12856 return(status);
12857}
12858
12859/*
12860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12861% %
12862% %
12863% %
12864% M a g i c k W r i t e I m a g e s F i l e %
12865% %
12866% %
12867% %
12868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12869%
12870% MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12871%
12872% The format of the MagickWriteImagesFile method is:
12873%
12874% MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12875%
12876% A description of each parameter follows:
12877%
12878% o wand: the magick wand.
12879%
12880% o file: the file descriptor.
12881%
12882*/
12883WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12884{
12885 ImageInfo
12886 *write_info;
12887
12888 MagickBooleanType
12889 status;
12890
12891 assert(wand != (MagickWand *) NULL);
12892 assert(wand->signature == WandSignature);
12893 if (wand->debug != MagickFalse)
12894 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12895 if (wand->images == (Image *) NULL)
12896 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12897 write_info=CloneImageInfo(wand->image_info);
12898 SetImageInfoFile(write_info,file);
12899 write_info->adjoin=MagickTrue;
12900 status=WriteImages(write_info,wand->images,(const char *) NULL,
12901 wand->exception);
12902 write_info=DestroyImageInfo(write_info);
12903 if (status == MagickFalse)
12904 InheritException(wand->exception,&wand->images->exception);
12905 return(status);
12906}