blob: 5c4e4f88efaef768b1f98e8c3816186f7a18cbb2 [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% %
cristy7e41fe82010-12-04 23:12:08 +000026% Copyright 1999-2011 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*/
cristy4c08aed2011-07-01 19:47:50 +000049#include "MagickWand/studio.h"
50#include "MagickWand/MagickWand.h"
51#include "MagickWand/magick-wand-private.h"
52#include "MagickWand/wand.h"
53#include "MagickWand/pixel-wand-private.h"
cristy3ed852e2009-09-05 21:47:34 +000054
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);
cristy73bd4a52010-10-05 11:24:23 +0000102 clone_wand=(MagickWand *) AcquireMagickMemory(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();
cristyb51dff52011-05-19 16:55:47 +0000108 (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
cristye8c25f92010-06-03 00:53:06 +0000109 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)
cristy3ed852e2009-09-05 21:47:34 +0000181%
182% A description of each parameter follows:
183%
184% o wand: the magick wand.
185%
cristy3ed852e2009-09-05 21:47:34 +0000186% o radius: the radius of the Gaussian, in pixels, not counting the center
187% pixel.
188%
189% o sigma: the standard deviation of the Gaussian, in pixels.
190%
191*/
cristy3ed852e2009-09-05 21:47:34 +0000192WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
193 const double radius,const double sigma)
194{
cristy3ed852e2009-09-05 21:47:34 +0000195 Image
196 *sharp_image;
197
198 assert(wand != (MagickWand *) NULL);
199 assert(wand->signature == WandSignature);
200 if (wand->debug != MagickFalse)
201 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
202 if (wand->images == (Image *) NULL)
203 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +0000204 sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000205 if (sharp_image == (Image *) NULL)
206 return(MagickFalse);
207 ReplaceImageInList(&wand->images,sharp_image);
208 return(MagickTrue);
209}
210
211/*
212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213% %
214% %
215% %
216% 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 %
217% %
218% %
219% %
220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221%
222% MagickAdaptiveResizeImage() adaptively resize image with data dependent
223% triangulation.
224%
225% MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000226% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +0000227%
228% A description of each parameter follows:
229%
230% o wand: the magick wand.
231%
232% o columns: the number of columns in the scaled image.
233%
234% o rows: the number of rows in the scaled image.
235%
236*/
237WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000238 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +0000239{
240 Image
241 *resize_image;
242
243 assert(wand != (MagickWand *) NULL);
244 assert(wand->signature == WandSignature);
245 if (wand->debug != MagickFalse)
246 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
247 if (wand->images == (Image *) NULL)
248 ThrowWandException(WandError,"ContainsNoImages",wand->name);
249 resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
250 if (resize_image == (Image *) NULL)
251 return(MagickFalse);
252 ReplaceImageInList(&wand->images,resize_image);
253 return(MagickTrue);
254}
255
256/*
257%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258% %
259% %
260% %
261% 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 %
262% %
263% %
264% %
265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266%
267% MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
268% more intensely near image edges and less intensely far from edges. We
269% sharpen the image with a Gaussian operator of the given radius and standard
270% deviation (sigma). For reasonable results, radius should be larger than
271% sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
272% suitable radius for you.
273%
274% The format of the MagickAdaptiveSharpenImage method is:
275%
276% MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
277% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000278%
279% A description of each parameter follows:
280%
281% o wand: the magick wand.
282%
cristy3ed852e2009-09-05 21:47:34 +0000283% o radius: the radius of the Gaussian, in pixels, not counting the center
284% pixel.
285%
286% o sigma: the standard deviation of the Gaussian, in pixels.
287%
288*/
cristy3ed852e2009-09-05 21:47:34 +0000289WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
290 const double radius,const double sigma)
291{
cristy3ed852e2009-09-05 21:47:34 +0000292 Image
293 *sharp_image;
294
295 assert(wand != (MagickWand *) NULL);
296 assert(wand->signature == WandSignature);
297 if (wand->debug != MagickFalse)
298 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
299 if (wand->images == (Image *) NULL)
300 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +0000301 sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000302 if (sharp_image == (Image *) NULL)
303 return(MagickFalse);
304 ReplaceImageInList(&wand->images,sharp_image);
305 return(MagickTrue);
306}
307
308/*
309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310% %
311% %
312% %
313% 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 %
314% %
315% %
316% %
317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318%
319% MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
320% based on the range of intensity values in its local neighborhood. This
321% allows for thresholding of an image whose global intensity histogram
322% doesn't contain distinctive peaks.
323%
324% The format of the AdaptiveThresholdImage method is:
325%
326% MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000327% const size_t width,const size_t height,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +0000328%
329% A description of each parameter follows:
330%
331% o wand: the magick wand.
332%
333% o width: the width of the local neighborhood.
334%
335% o height: the height of the local neighborhood.
336%
337% o offset: the mean offset.
338%
339*/
340WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000341 const size_t width,const size_t height,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +0000342{
343 Image
344 *threshold_image;
345
346 assert(wand != (MagickWand *) NULL);
347 assert(wand->signature == WandSignature);
348 if (wand->debug != MagickFalse)
349 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
350 if (wand->images == (Image *) NULL)
351 ThrowWandException(WandError,"ContainsNoImages",wand->name);
352 threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
353 wand->exception);
354 if (threshold_image == (Image *) NULL)
355 return(MagickFalse);
356 ReplaceImageInList(&wand->images,threshold_image);
357 return(MagickTrue);
358}
359
360/*
361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362% %
363% %
364% %
365% M a g i c k A d d I m a g e %
366% %
367% %
368% %
369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370%
371% MagickAddImage() adds the specified images at the current image location.
372%
373% The format of the MagickAddImage method is:
374%
375% MagickBooleanType MagickAddImage(MagickWand *wand,
376% const MagickWand *add_wand)
377%
378% A description of each parameter follows:
379%
380% o wand: the magick wand.
381%
382% o add_wand: A wand that contains images to add at the current image
383% location.
384%
385*/
386
387static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
388 Image *images)
389{
390 Image
391 *sentinel;
392
393 sentinel=wand->images;
394 if (sentinel == (Image *) NULL)
395 {
396 wand->images=GetFirstImageInList(images);
397 return(MagickTrue);
398 }
399 if (wand->active == MagickFalse)
400 {
401 if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
402 {
403 AppendImageToList(&sentinel,images);
404 wand->images=GetLastImageInList(images);
405 return(MagickTrue);
406 }
407 if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
408 {
409 PrependImageToList(&sentinel,images);
410 wand->images=GetFirstImageInList(images);
411 return(MagickTrue);
412 }
413 }
cristy2e74b0f2010-09-01 19:42:26 +0000414 if (sentinel->next == (Image *) NULL)
415 {
416 InsertImageInList(&sentinel,images);
417 wand->images=GetLastImageInList(images);
418 return(MagickTrue);
419 }
cristy3ed852e2009-09-05 21:47:34 +0000420 InsertImageInList(&sentinel,images);
421 wand->images=GetFirstImageInList(images);
422 return(MagickTrue);
423}
424
425WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
426 const MagickWand *add_wand)
427{
428 Image
429 *images;
430
431 assert(wand != (MagickWand *) NULL);
432 assert(wand->signature == WandSignature);
433 if (wand->debug != MagickFalse)
434 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
435 assert(add_wand != (MagickWand *) NULL);
436 assert(add_wand->signature == WandSignature);
437 if (add_wand->images == (Image *) NULL)
438 ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
439 images=CloneImageList(add_wand->images,wand->exception);
440 if (images == (Image *) NULL)
441 return(MagickFalse);
442 return(InsertImageInWand(wand,images));
443}
444
445/*
446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447% %
448% %
449% %
450% M a g i c k A d d N o i s e I m a g e %
451% %
452% %
453% %
454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455%
456% MagickAddNoiseImage() adds random noise to the image.
457%
458% The format of the MagickAddNoiseImage method is:
459%
460% MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
461% const NoiseType noise_type)
cristy3ed852e2009-09-05 21:47:34 +0000462%
463% A description of each parameter follows:
464%
465% o wand: the magick wand.
466%
cristy3ed852e2009-09-05 21:47:34 +0000467% o noise_type: The type of noise: Uniform, Gaussian, Multiplicative,
468% Impulse, Laplacian, or Poisson.
469%
470*/
cristy3ed852e2009-09-05 21:47:34 +0000471WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
472 const NoiseType noise_type)
473{
cristy3ed852e2009-09-05 21:47:34 +0000474 Image
475 *noise_image;
476
477 assert(wand != (MagickWand *) NULL);
478 assert(wand->signature == WandSignature);
479 if (wand->debug != MagickFalse)
480 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
481 if (wand->images == (Image *) NULL)
482 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy490408a2011-07-07 14:42:05 +0000483 noise_image=AddNoiseImage(wand->images,noise_type,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000484 if (noise_image == (Image *) NULL)
485 return(MagickFalse);
486 ReplaceImageInList(&wand->images,noise_image);
487 return(MagickTrue);
488}
489
490/*
491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492% %
493% %
494% %
495% 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 %
496% %
497% %
498% %
499%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500%
501% MagickAffineTransformImage() transforms an image as dictated by the affine
502% matrix of the drawing wand.
503%
504% The format of the MagickAffineTransformImage method is:
505%
506% MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
507% const DrawingWand *drawing_wand)
508%
509% A description of each parameter follows:
510%
511% o wand: the magick wand.
512%
513% o drawing_wand: the draw wand.
514%
515*/
516WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
517 const DrawingWand *drawing_wand)
518{
519 DrawInfo
520 *draw_info;
521
522 Image
523 *affine_image;
524
525 assert(wand != (MagickWand *) NULL);
526 assert(wand->signature == WandSignature);
527 if (wand->debug != MagickFalse)
528 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
529 if (wand->images == (Image *) NULL)
530 ThrowWandException(WandError,"ContainsNoImages",wand->name);
531 draw_info=PeekDrawingWand(drawing_wand);
532 if (draw_info == (DrawInfo *) NULL)
533 return(MagickFalse);
534 affine_image=AffineTransformImage(wand->images,&draw_info->affine,
535 wand->exception);
536 draw_info=DestroyDrawInfo(draw_info);
537 if (affine_image == (Image *) NULL)
538 return(MagickFalse);
539 ReplaceImageInList(&wand->images,affine_image);
540 return(MagickTrue);
541}
542
543/*
544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545% %
546% %
547% %
548% M a g i c k A n n o t a t e I m a g e %
549% %
550% %
551% %
552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
553%
554% MagickAnnotateImage() annotates an image with text.
555%
556% The format of the MagickAnnotateImage method is:
557%
558% MagickBooleanType MagickAnnotateImage(MagickWand *wand,
559% const DrawingWand *drawing_wand,const double x,const double y,
560% const double angle,const char *text)
561%
562% A description of each parameter follows:
563%
564% o wand: the magick wand.
565%
566% o drawing_wand: the draw wand.
567%
568% o x: x ordinate to left of text
569%
570% o y: y ordinate to text baseline
571%
572% o angle: rotate text relative to this angle.
573%
574% o text: text to draw
575%
576*/
577WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
578 const DrawingWand *drawing_wand,const double x,const double y,
579 const double angle,const char *text)
580{
581 char
582 geometry[MaxTextExtent];
583
584 DrawInfo
585 *draw_info;
586
587 MagickBooleanType
588 status;
589
590 assert(wand != (MagickWand *) NULL);
591 assert(wand->signature == WandSignature);
592 if (wand->debug != MagickFalse)
593 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
594 if (wand->images == (Image *) NULL)
595 ThrowWandException(WandError,"ContainsNoImages",wand->name);
596 draw_info=PeekDrawingWand(drawing_wand);
597 if (draw_info == (DrawInfo *) NULL)
598 return(MagickFalse);
599 (void) CloneString(&draw_info->text,text);
cristyb51dff52011-05-19 16:55:47 +0000600 (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
cristy3ed852e2009-09-05 21:47:34 +0000601 draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
602 draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
603 draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
604 draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
605 (void) CloneString(&draw_info->geometry,geometry);
606 status=AnnotateImage(wand->images,draw_info);
607 draw_info=DestroyDrawInfo(draw_info);
608 if (status == MagickFalse)
609 InheritException(wand->exception,&wand->images->exception);
610 return(status);
611}
612
613/*
614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615% %
616% %
617% %
618% M a g i c k A n i m a t e I m a g e s %
619% %
620% %
621% %
622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
623%
624% MagickAnimateImages() animates an image or image sequence.
625%
626% The format of the MagickAnimateImages method is:
627%
628% MagickBooleanType MagickAnimateImages(MagickWand *wand,
629% const char *server_name)
630%
631% A description of each parameter follows:
632%
633% o wand: the magick wand.
634%
635% o server_name: the X server name.
636%
637*/
638WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
639 const char *server_name)
640{
641 MagickBooleanType
642 status;
643
644 assert(wand != (MagickWand *) NULL);
645 assert(wand->signature == WandSignature);
646 if (wand->debug != MagickFalse)
647 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
648 (void) CloneString(&wand->image_info->server_name,server_name);
649 status=AnimateImages(wand->image_info,wand->images);
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 p p e n d I m a g e s %
661% %
662% %
663% %
664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
665%
666% MagickAppendImages() append a set of images.
667%
668% The format of the MagickAppendImages method is:
669%
670% MagickWand *MagickAppendImages(MagickWand *wand,
671% const MagickBooleanType stack)
672%
673% A description of each parameter follows:
674%
675% o wand: the magick wand.
676%
677% o stack: By default, images are stacked left-to-right. Set stack to
678% MagickTrue to stack them top-to-bottom.
679%
680*/
681WandExport MagickWand *MagickAppendImages(MagickWand *wand,
682 const MagickBooleanType stack)
683{
684 Image
685 *append_image;
686
687 assert(wand != (MagickWand *) NULL);
688 assert(wand->signature == WandSignature);
689 if (wand->debug != MagickFalse)
690 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
691 if (wand->images == (Image *) NULL)
692 return((MagickWand *) NULL);
693 append_image=AppendImages(wand->images,stack,wand->exception);
694 if (append_image == (Image *) NULL)
695 return((MagickWand *) NULL);
696 return(CloneMagickWandFromImages(wand,append_image));
697}
698
699/*
700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701% %
702% %
703% %
704% M a g i c k A u t o G a m m a I m a g e %
705% %
706% %
707% %
708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
709%
710% MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
711% image to try make set its gamma appropriatally.
712%
713% The format of the MagickAutoGammaImage method is:
714%
715% MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000716%
717% A description of each parameter follows:
718%
719% o wand: the magick wand.
720%
cristy3ed852e2009-09-05 21:47:34 +0000721*/
722WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
723{
724 MagickBooleanType
725 status;
726
cristy3ed852e2009-09-05 21:47:34 +0000727 assert(wand != (MagickWand *) NULL);
728 assert(wand->signature == WandSignature);
729 if (wand->debug != MagickFalse)
730 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
731 if (wand->images == (Image *) NULL)
732 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy95111202011-08-09 19:41:42 +0000733 status=AutoGammaImage(wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000734 return(status);
735}
736
737/*
738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
739% %
740% %
741% %
742% M a g i c k A u t o L e v e l I m a g e %
743% %
744% %
745% %
746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
747%
748% MagickAutoLevelImage() adjusts the levels of a particular image channel by
749% scaling the minimum and maximum values to the full quantum range.
750%
751% The format of the MagickAutoLevelImage method is:
752%
753% MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000754%
755% A description of each parameter follows:
756%
757% o wand: the magick wand.
758%
cristy3ed852e2009-09-05 21:47:34 +0000759*/
760WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
761{
762 MagickBooleanType
763 status;
764
cristy3ed852e2009-09-05 21:47:34 +0000765 assert(wand != (MagickWand *) NULL);
766 assert(wand->signature == WandSignature);
767 if (wand->debug != MagickFalse)
768 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
769 if (wand->images == (Image *) NULL)
770 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy95111202011-08-09 19:41:42 +0000771 status=AutoLevelImage(wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000772 return(status);
773}
774
775/*
776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
777% %
778% %
779% %
cristy3ed852e2009-09-05 21:47:34 +0000780% 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 %
781% %
782% %
783% %
784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
785%
786% MagickBlackThresholdImage() is like MagickThresholdImage() but forces all
787% pixels below the threshold into black while leaving all pixels above the
788% threshold unchanged.
789%
790% The format of the MagickBlackThresholdImage method is:
791%
792% MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
793% const PixelWand *threshold)
794%
795% A description of each parameter follows:
796%
797% o wand: the magick wand.
798%
799% o threshold: the pixel wand.
800%
801*/
802WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
803 const PixelWand *threshold)
804{
805 char
806 thresholds[MaxTextExtent];
807
808 MagickBooleanType
809 status;
810
811 assert(wand != (MagickWand *) NULL);
812 assert(wand->signature == WandSignature);
813 if (wand->debug != MagickFalse)
814 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
815 if (wand->images == (Image *) NULL)
816 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +0000817 (void) FormatLocaleString(thresholds,MaxTextExtent,
cristy3ed852e2009-09-05 21:47:34 +0000818 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
819 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
820 PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
cristyf4ad9df2011-07-08 16:49:03 +0000821 status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000822 if (status == MagickFalse)
823 InheritException(wand->exception,&wand->images->exception);
824 return(status);
825}
826
827/*
828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
829% %
830% %
831% %
832% M a g i c k B l u e S h i f t I m a g e %
833% %
834% %
835% %
836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
837%
838% MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
839% nighttime in the moonlight.
840%
841% The format of the MagickBlueShiftImage method is:
842%
843% MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
844% const double factor)
845%
846% A description of each parameter follows:
847%
848% o wand: the magick wand.
849%
850% o factor: the blue shift factor (default 1.5)
851%
852*/
853WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
854 const double factor)
855{
856 Image
857 *shift_image;
858
859 assert(wand != (MagickWand *) NULL);
860 assert(wand->signature == WandSignature);
861 if (wand->debug != MagickFalse)
862 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
863 if (wand->images == (Image *) NULL)
864 ThrowWandException(WandError,"ContainsNoImages",wand->name);
865 shift_image=BlueShiftImage(wand->images,factor,wand->exception);
866 if (shift_image == (Image *) NULL)
867 return(MagickFalse);
868 ReplaceImageInList(&wand->images,shift_image);
869 return(MagickTrue);
870}
871
872/*
873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
874% %
875% %
876% %
877% M a g i c k B l u r I m a g e %
878% %
879% %
880% %
881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882%
883% MagickBlurImage() blurs an image. We convolve the image with a
884% gaussian operator of the given radius and standard deviation (sigma).
885% For reasonable results, the radius should be larger than sigma. Use a
886% radius of 0 and BlurImage() selects a suitable radius for you.
887%
888% The format of the MagickBlurImage method is:
889%
890% MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
891% const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000892%
893% A description of each parameter follows:
894%
895% o wand: the magick wand.
896%
cristy3ed852e2009-09-05 21:47:34 +0000897% o radius: the radius of the , in pixels, not counting the center
898% pixel.
899%
900% o sigma: the standard deviation of the , in pixels.
901%
902*/
cristy3ed852e2009-09-05 21:47:34 +0000903WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
904 const double radius,const double sigma)
905{
cristy3ed852e2009-09-05 21:47:34 +0000906 Image
907 *blur_image;
908
909 assert(wand != (MagickWand *) NULL);
910 assert(wand->signature == WandSignature);
911 if (wand->debug != MagickFalse)
912 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
913 if (wand->images == (Image *) NULL)
914 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +0000915 blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000916 if (blur_image == (Image *) NULL)
917 return(MagickFalse);
918 ReplaceImageInList(&wand->images,blur_image);
919 return(MagickTrue);
920}
921
922/*
923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
924% %
925% %
926% %
927% M a g i c k B o r d e r I m a g e %
928% %
929% %
930% %
931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
932%
933% MagickBorderImage() surrounds the image with a border of the color defined
934% by the bordercolor pixel wand.
935%
936% The format of the MagickBorderImage method is:
937%
938% MagickBooleanType MagickBorderImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000939% const PixelWand *bordercolor,const size_t width,
940% const size_t height)
cristy3ed852e2009-09-05 21:47:34 +0000941%
942% A description of each parameter follows:
943%
944% o wand: the magick wand.
945%
946% o bordercolor: the border color pixel wand.
947%
948% o width: the border width.
949%
950% o height: the border height.
951%
952*/
953WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000954 const PixelWand *bordercolor,const size_t width,
955 const size_t height)
cristy3ed852e2009-09-05 21:47:34 +0000956{
957 Image
958 *border_image;
959
960 RectangleInfo
961 border_info;
962
963 assert(wand != (MagickWand *) NULL);
964 assert(wand->signature == WandSignature);
965 if (wand->debug != MagickFalse)
966 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
967 if (wand->images == (Image *) NULL)
968 ThrowWandException(WandError,"ContainsNoImages",wand->name);
969 border_info.width=width;
970 border_info.height=height;
971 border_info.x=0;
972 border_info.y=0;
cristy4c08aed2011-07-01 19:47:50 +0000973 PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +0000974 border_image=BorderImage(wand->images,&border_info,wand->exception);
975 if (border_image == (Image *) NULL)
976 return(MagickFalse);
977 ReplaceImageInList(&wand->images,border_image);
978 return(MagickTrue);
979}
980
981/*
982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983% %
984% %
985% %
cristya28d6b82010-01-11 20:03:47 +0000986% 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 %
987% %
988% %
989% %
990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991%
992% Use MagickBrightnessContrastImage() to change the brightness and/or contrast
993% of an image. It converts the brightness and contrast parameters into slope
994% and intercept and calls a polynomical function to apply to the image.
995
996%
997% The format of the MagickBrightnessContrastImage method is:
998%
999% MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1000% const double brightness,const double contrast)
cristya28d6b82010-01-11 20:03:47 +00001001%
1002% A description of each parameter follows:
1003%
1004% o wand: the magick wand.
1005%
cristya28d6b82010-01-11 20:03:47 +00001006% o brightness: the brightness percent (-100 .. 100).
1007%
1008% o contrast: the contrast percent (-100 .. 100).
1009%
1010*/
cristy9ee60942011-07-06 14:54:38 +00001011WandExport MagickBooleanType MagickBrightnessContrastImage(
1012 MagickWand *wand,const double brightness,const double contrast)
cristya28d6b82010-01-11 20:03:47 +00001013{
1014 MagickBooleanType
1015 status;
1016
1017 assert(wand != (MagickWand *) NULL);
1018 assert(wand->signature == WandSignature);
1019 if (wand->debug != MagickFalse)
1020 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1021 if (wand->images == (Image *) NULL)
1022 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy444eda62011-08-10 02:07:46 +00001023 status=BrightnessContrastImage(wand->images,brightness,contrast,
1024 &wand->images->exception);
cristya28d6b82010-01-11 20:03:47 +00001025 return(status);
1026}
1027
1028/*
1029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1030% %
1031% %
1032% %
cristy3ed852e2009-09-05 21:47:34 +00001033% M a g i c k C h a r c o a l I m a g e %
1034% %
1035% %
1036% %
1037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1038%
1039% MagickCharcoalImage() simulates a charcoal drawing.
1040%
1041% The format of the MagickCharcoalImage method is:
1042%
1043% MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1044% const double radius,const double sigma)
1045%
1046% A description of each parameter follows:
1047%
1048% o wand: the magick wand.
1049%
1050% o radius: the radius of the Gaussian, in pixels, not counting the center
1051% pixel.
1052%
1053% o sigma: the standard deviation of the Gaussian, in pixels.
1054%
1055*/
1056WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1057 const double radius,const double sigma)
1058{
1059 Image
1060 *charcoal_image;
1061
1062 assert(wand != (MagickWand *) NULL);
1063 assert(wand->signature == WandSignature);
1064 if (wand->debug != MagickFalse)
1065 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1066 if (wand->images == (Image *) NULL)
1067 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1068 charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1069 if (charcoal_image == (Image *) NULL)
1070 return(MagickFalse);
1071 ReplaceImageInList(&wand->images,charcoal_image);
1072 return(MagickTrue);
1073}
1074
1075/*
1076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1077% %
1078% %
1079% %
1080% M a g i c k C h o p I m a g e %
1081% %
1082% %
1083% %
1084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1085%
1086% MagickChopImage() removes a region of an image and collapses the image to
1087% occupy the removed portion
1088%
1089% The format of the MagickChopImage method is:
1090%
1091% MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001092% const size_t width,const size_t height,const ssize_t x,
1093% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001094%
1095% A description of each parameter follows:
1096%
1097% o wand: the magick wand.
1098%
1099% o width: the region width.
1100%
1101% o height: the region height.
1102%
1103% o x: the region x offset.
1104%
1105% o y: the region y offset.
1106%
1107%
1108*/
1109WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001110 const size_t width,const size_t height,const ssize_t x,
1111 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001112{
1113 Image
1114 *chop_image;
1115
1116 RectangleInfo
1117 chop;
1118
1119 assert(wand != (MagickWand *) NULL);
1120 assert(wand->signature == WandSignature);
1121 if (wand->debug != MagickFalse)
1122 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1123 if (wand->images == (Image *) NULL)
1124 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1125 chop.width=width;
1126 chop.height=height;
1127 chop.x=x;
1128 chop.y=y;
1129 chop_image=ChopImage(wand->images,&chop,wand->exception);
1130 if (chop_image == (Image *) NULL)
1131 return(MagickFalse);
1132 ReplaceImageInList(&wand->images,chop_image);
1133 return(MagickTrue);
1134}
1135
1136/*
1137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1138% %
1139% %
1140% %
cristy1eb45dd2009-09-25 16:38:06 +00001141% M a g i c k C l a m p I m a g e %
1142% %
1143% %
1144% %
1145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146%
cristyecb0c6d2009-09-25 16:50:09 +00001147% MagickClampImage() restricts the color range from 0 to the quantum depth.
cristy1eb45dd2009-09-25 16:38:06 +00001148%
1149% The format of the MagickClampImage method is:
1150%
1151% MagickBooleanType MagickClampImage(MagickWand *wand)
cristy1eb45dd2009-09-25 16:38:06 +00001152%
1153% A description of each parameter follows:
1154%
1155% o wand: the magick wand.
1156%
1157% o channel: the channel.
1158%
1159*/
cristy1eb45dd2009-09-25 16:38:06 +00001160WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1161{
1162 MagickBooleanType
1163 status;
1164
cristy1eb45dd2009-09-25 16:38:06 +00001165 assert(wand != (MagickWand *) NULL);
1166 assert(wand->signature == WandSignature);
1167 if (wand->debug != MagickFalse)
1168 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1169 if (wand->images == (Image *) NULL)
1170 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00001171 status=ClampImage(wand->images);
cristy1eb45dd2009-09-25 16:38:06 +00001172 if (status == MagickFalse)
1173 InheritException(wand->exception,&wand->images->exception);
1174 return(status);
1175}
1176
1177/*
1178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1179% %
1180% %
1181% %
cristy3ed852e2009-09-05 21:47:34 +00001182% M a g i c k C l i p I m a g e %
1183% %
1184% %
1185% %
1186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1187%
cristycee97112010-05-28 00:44:52 +00001188% MagickClipImage() clips along the first path from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001189% present.
1190%
1191% The format of the MagickClipImage method is:
1192%
1193% MagickBooleanType MagickClipImage(MagickWand *wand)
1194%
1195% A description of each parameter follows:
1196%
1197% o wand: the magick wand.
1198%
1199*/
1200WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1201{
1202 MagickBooleanType
1203 status;
1204
1205 assert(wand != (MagickWand *) NULL);
1206 assert(wand->signature == WandSignature);
1207 if (wand->debug != MagickFalse)
1208 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1209 if (wand->images == (Image *) NULL)
1210 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1211 status=ClipImage(wand->images);
1212 if (status == MagickFalse)
1213 InheritException(wand->exception,&wand->images->exception);
1214 return(status);
1215}
1216
1217/*
1218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1219% %
1220% %
1221% %
1222% M a g i c k C l i p I m a g e P a t h %
1223% %
1224% %
1225% %
1226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1227%
cristycee97112010-05-28 00:44:52 +00001228% MagickClipImagePath() clips along the named paths from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001229% present. Later operations take effect inside the path. Id may be a number
1230% if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1231% path.
1232%
1233% The format of the MagickClipImagePath method is:
1234%
1235% MagickBooleanType MagickClipImagePath(MagickWand *wand,
1236% const char *pathname,const MagickBooleanType inside)
1237%
1238% A description of each parameter follows:
1239%
1240% o wand: the magick wand.
1241%
1242% o pathname: name of clipping path resource. If name is preceded by #, use
1243% clipping path numbered by name.
1244%
1245% o inside: if non-zero, later operations take effect inside clipping path.
1246% Otherwise later operations take effect outside clipping path.
1247%
1248*/
1249WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1250 const char *pathname,const MagickBooleanType inside)
1251{
1252 MagickBooleanType
1253 status;
1254
1255 assert(wand != (MagickWand *) NULL);
1256 assert(wand->signature == WandSignature);
1257 if (wand->debug != MagickFalse)
1258 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1259 if (wand->images == (Image *) NULL)
1260 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1261 status=ClipImagePath(wand->images,pathname,inside);
1262 if (status == MagickFalse)
1263 InheritException(wand->exception,&wand->images->exception);
1264 return(status);
1265}
1266
1267/*
1268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1269% %
1270% %
1271% %
1272% M a g i c k C l u t I m a g e %
1273% %
1274% %
1275% %
1276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1277%
1278% MagickClutImage() replaces colors in the image from a color lookup table.
1279%
1280% The format of the MagickClutImage method is:
1281%
1282% MagickBooleanType MagickClutImage(MagickWand *wand,
1283% const MagickWand *clut_wand)
cristy3ed852e2009-09-05 21:47:34 +00001284%
1285% A description of each parameter follows:
1286%
1287% o wand: the magick wand.
1288%
1289% o clut_image: the clut image.
1290%
1291*/
cristy3ed852e2009-09-05 21:47:34 +00001292WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1293 const MagickWand *clut_wand)
1294{
1295 MagickBooleanType
1296 status;
1297
cristy3ed852e2009-09-05 21:47:34 +00001298 assert(wand != (MagickWand *) NULL);
1299 assert(wand->signature == WandSignature);
1300 if (wand->debug != MagickFalse)
1301 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1302 if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1303 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy444eda62011-08-10 02:07:46 +00001304 status=ClutImage(wand->images,clut_wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00001305 return(status);
1306}
1307
1308/*
1309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1310% %
1311% %
1312% %
1313% M a g i c k C o a l e s c e I m a g e s %
1314% %
1315% %
1316% %
1317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1318%
1319% MagickCoalesceImages() composites a set of images while respecting any page
1320% offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1321% typically start with an image background and each subsequent image
1322% varies in size and offset. MagickCoalesceImages() returns a new sequence
1323% where each image in the sequence is the same size as the first and
1324% composited with the next image in the sequence.
1325%
1326% The format of the MagickCoalesceImages method is:
1327%
1328% MagickWand *MagickCoalesceImages(MagickWand *wand)
1329%
1330% A description of each parameter follows:
1331%
1332% o wand: the magick wand.
1333%
1334*/
1335WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1336{
1337 Image
1338 *coalesce_image;
1339
1340 assert(wand != (MagickWand *) NULL);
1341 assert(wand->signature == WandSignature);
1342 if (wand->debug != MagickFalse)
1343 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1344 if (wand->images == (Image *) NULL)
1345 return((MagickWand *) NULL);
1346 coalesce_image=CoalesceImages(wand->images,wand->exception);
1347 if (coalesce_image == (Image *) NULL)
1348 return((MagickWand *) NULL);
1349 return(CloneMagickWandFromImages(wand,coalesce_image));
1350}
1351
1352/*
1353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1354% %
1355% %
1356% %
1357% M a g i c k C o l o r D e c i s i o n I m a g e %
1358% %
1359% %
1360% %
1361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1362%
1363% MagickColorDecisionListImage() accepts a lightweight Color Correction
1364% Collection (CCC) file which solely contains one or more color corrections
1365% and applies the color correction to the image. Here is a sample CCC file:
1366%
1367% <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1368% <ColorCorrection id="cc03345">
1369% <SOPNode>
1370% <Slope> 0.9 1.2 0.5 </Slope>
1371% <Offset> 0.4 -0.5 0.6 </Offset>
1372% <Power> 1.0 0.8 1.5 </Power>
1373% </SOPNode>
1374% <SATNode>
1375% <Saturation> 0.85 </Saturation>
1376% </SATNode>
1377% </ColorCorrection>
1378% </ColorCorrectionCollection>
1379%
1380% which includes the offset, slope, and power for each of the RGB channels
1381% as well as the saturation.
1382%
1383% The format of the MagickColorDecisionListImage method is:
1384%
1385% MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1386% const double gamma)
1387%
1388% A description of each parameter follows:
1389%
1390% o wand: the magick wand.
1391%
1392% o color_correction_collection: the color correction collection in XML.
1393%
1394*/
1395WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1396 const char *color_correction_collection)
1397{
1398 MagickBooleanType
1399 status;
1400
1401 assert(wand != (MagickWand *) NULL);
1402 assert(wand->signature == WandSignature);
1403 if (wand->debug != MagickFalse)
1404 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1405 if (wand->images == (Image *) NULL)
1406 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy1bfa9f02011-08-11 02:35:43 +00001407 status=ColorDecisionListImage(wand->images,color_correction_collection,
1408 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00001409 return(status);
1410}
1411
1412/*
1413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1414% %
1415% %
1416% %
1417% M a g i c k C o l o r i z e I m a g e %
1418% %
1419% %
1420% %
1421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1422%
1423% MagickColorizeImage() blends the fill color with each pixel in the image.
1424%
1425% The format of the MagickColorizeImage method is:
1426%
1427% MagickBooleanType MagickColorizeImage(MagickWand *wand,
1428% const PixelWand *colorize,const PixelWand *opacity)
1429%
1430% A description of each parameter follows:
1431%
1432% o wand: the magick wand.
1433%
1434% o colorize: the colorize pixel wand.
1435%
1436% o opacity: the opacity pixel wand.
1437%
1438*/
1439WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1440 const PixelWand *colorize,const PixelWand *opacity)
1441{
1442 char
1443 percent_opaque[MaxTextExtent];
1444
1445 Image
1446 *colorize_image;
1447
1448 PixelPacket
1449 target;
1450
1451 assert(wand != (MagickWand *) NULL);
1452 assert(wand->signature == WandSignature);
1453 if (wand->debug != MagickFalse)
1454 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1455 if (wand->images == (Image *) NULL)
1456 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +00001457 (void) FormatLocaleString(percent_opaque,MaxTextExtent,
cristye7f51092010-01-17 00:39:37 +00001458 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristy8cd5b312010-01-07 01:10:24 +00001459 PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1460 PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1461 PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1462 PixelGetOpacityQuantum(opacity)));
cristy4c08aed2011-07-01 19:47:50 +00001463 PixelGetQuantumPacket(colorize,&target);
cristy3ed852e2009-09-05 21:47:34 +00001464 colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1465 wand->exception);
1466 if (colorize_image == (Image *) NULL)
1467 return(MagickFalse);
1468 ReplaceImageInList(&wand->images,colorize_image);
1469 return(MagickTrue);
1470}
1471
1472/*
1473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1474% %
1475% %
1476% %
cristye6365592010-04-02 17:31:23 +00001477% M a g i c k C o l o r M a t r i x I m a g e %
1478% %
1479% %
1480% %
1481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1482%
1483% MagickColorMatrixImage() apply color transformation to an image. The method
1484% permits saturation changes, hue rotation, luminance to alpha, and various
1485% other effects. Although variable-sized transformation matrices can be used,
1486% typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1487% (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1488% except offsets are in column 6 rather than 5 (in support of CMYKA images)
1489% and offsets are normalized (divide Flash offset by 255).
1490%
1491% The format of the MagickColorMatrixImage method is:
1492%
1493% MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1494% const KernelInfo *color_matrix)
1495%
1496% A description of each parameter follows:
1497%
1498% o wand: the magick wand.
1499%
1500% o color_matrix: the color matrix.
1501%
1502*/
1503WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1504 const KernelInfo *color_matrix)
1505{
1506 Image
1507 *color_image;
1508
1509 assert(wand != (MagickWand *) NULL);
1510 assert(wand->signature == WandSignature);
1511 if (wand->debug != MagickFalse)
1512 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1513 if (color_matrix == (const KernelInfo *) NULL)
1514 return(MagickFalse);
1515 if (wand->images == (Image *) NULL)
1516 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1517 color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1518 if (color_image == (Image *) NULL)
1519 return(MagickFalse);
1520 ReplaceImageInList(&wand->images,color_image);
1521 return(MagickTrue);
1522}
1523
1524/*
1525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1526% %
1527% %
1528% %
cristy3ed852e2009-09-05 21:47:34 +00001529% M a g i c k C o m b i n e I m a g e s %
1530% %
1531% %
1532% %
1533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1534%
1535% MagickCombineImages() combines one or more images into a single image. The
1536% grayscale value of the pixels of each image in the sequence is assigned in
1537% order to the specified hannels of the combined image. The typical
1538% ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1539%
1540% The format of the MagickCombineImages method is:
1541%
cristy3139dc22011-07-08 00:11:42 +00001542% MagickWand *MagickCombineImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00001543%
1544% A description of each parameter follows:
1545%
1546% o wand: the magick wand.
1547%
cristy3ed852e2009-09-05 21:47:34 +00001548*/
cristy3139dc22011-07-08 00:11:42 +00001549WandExport MagickWand *MagickCombineImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00001550{
1551 Image
1552 *combine_image;
1553
1554 assert(wand != (MagickWand *) NULL);
1555 assert(wand->signature == WandSignature);
1556 if (wand->debug != MagickFalse)
1557 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1558 if (wand->images == (Image *) NULL)
1559 return((MagickWand *) NULL);
cristy3139dc22011-07-08 00:11:42 +00001560 combine_image=CombineImages(wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001561 if (combine_image == (Image *) NULL)
1562 return((MagickWand *) NULL);
1563 return(CloneMagickWandFromImages(wand,combine_image));
1564}
1565
1566/*
1567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1568% %
1569% %
1570% %
1571% M a g i c k C o m m e n t I m a g e %
1572% %
1573% %
1574% %
1575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1576%
1577% MagickCommentImage() adds a comment to your image.
1578%
1579% The format of the MagickCommentImage method is:
1580%
1581% MagickBooleanType MagickCommentImage(MagickWand *wand,
1582% const char *comment)
1583%
1584% A description of each parameter follows:
1585%
1586% o wand: the magick wand.
1587%
1588% o comment: the image comment.
1589%
1590*/
1591WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1592 const char *comment)
1593{
1594 MagickBooleanType
1595 status;
1596
1597 assert(wand != (MagickWand *) NULL);
1598 assert(wand->signature == WandSignature);
1599 if (wand->debug != MagickFalse)
1600 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1601 if (wand->images == (Image *) NULL)
1602 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1603 status=SetImageProperty(wand->images,"comment",comment);
1604 if (status == MagickFalse)
1605 InheritException(wand->exception,&wand->images->exception);
1606 return(status);
1607}
1608
1609/*
1610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1611% %
1612% %
1613% %
cristy3ed852e2009-09-05 21:47:34 +00001614% M a g i c k C o m p a r e I m a g e L a y e r s %
1615% %
1616% %
1617% %
1618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1619%
cristy8a9106f2011-07-05 14:39:26 +00001620% MagickCompareImagesLayers() compares each image with the next in a sequence
cristy3ed852e2009-09-05 21:47:34 +00001621% and returns the maximum bounding region of any pixel differences it
1622% discovers.
1623%
cristy8a9106f2011-07-05 14:39:26 +00001624% The format of the MagickCompareImagesLayers method is:
cristy3ed852e2009-09-05 21:47:34 +00001625%
cristy8a9106f2011-07-05 14:39:26 +00001626% MagickWand *MagickCompareImagesLayers(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00001627% const ImageLayerMethod method)
1628%
1629% A description of each parameter follows:
1630%
1631% o wand: the magick wand.
1632%
1633% o method: the compare method.
1634%
1635*/
cristy8a9106f2011-07-05 14:39:26 +00001636WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00001637 const ImageLayerMethod method)
1638{
1639 Image
1640 *layers_image;
1641
1642 assert(wand != (MagickWand *) NULL);
1643 assert(wand->signature == WandSignature);
1644 if (wand->debug != MagickFalse)
1645 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1646 if (wand->images == (Image *) NULL)
1647 return((MagickWand *) NULL);
cristy8a9106f2011-07-05 14:39:26 +00001648 layers_image=CompareImagesLayers(wand->images,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001649 if (layers_image == (Image *) NULL)
1650 return((MagickWand *) NULL);
1651 return(CloneMagickWandFromImages(wand,layers_image));
1652}
1653
1654/*
1655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1656% %
1657% %
1658% %
1659% M a g i c k C o m p a r e I m a g e s %
1660% %
1661% %
1662% %
1663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1664%
1665% MagickCompareImages() compares an image to a reconstructed image and returns
1666% the specified difference image.
1667%
1668% The format of the MagickCompareImages method is:
1669%
1670% MagickWand *MagickCompareImages(MagickWand *wand,
1671% const MagickWand *reference,const MetricType metric,
1672% double *distortion)
1673%
1674% A description of each parameter follows:
1675%
1676% o wand: the magick wand.
1677%
1678% o reference: the reference wand.
1679%
1680% o metric: the metric.
1681%
1682% o distortion: the computed distortion between the images.
1683%
1684*/
1685WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1686 const MagickWand *reference,const MetricType metric,double *distortion)
1687{
1688 Image
1689 *compare_image;
1690
1691
1692 assert(wand != (MagickWand *) NULL);
1693 assert(wand->signature == WandSignature);
1694 if (wand->debug != MagickFalse)
1695 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1696 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1697 {
1698 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1699 "ContainsNoImages","`%s'",wand->name);
1700 return((MagickWand *) NULL);
1701 }
1702 compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1703 &wand->images->exception);
1704 if (compare_image == (Image *) NULL)
1705 return((MagickWand *) NULL);
1706 return(CloneMagickWandFromImages(wand,compare_image));
1707}
1708
1709/*
1710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1711% %
1712% %
1713% %
1714% M a g i c k C o m p o s i t e I m a g e %
1715% %
1716% %
1717% %
1718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1719%
1720% MagickCompositeImage() composite one image onto another at the specified
1721% offset.
1722%
1723% The format of the MagickCompositeImage method is:
1724%
1725% MagickBooleanType MagickCompositeImage(MagickWand *wand,
1726% const MagickWand *composite_wand,const CompositeOperator compose,
cristybb503372010-05-27 20:51:26 +00001727% const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001728%
1729% A description of each parameter follows:
1730%
1731% o wand: the magick wand.
1732%
1733% o composite_image: the composite image.
1734%
1735% o compose: This operator affects how the composite is applied to the
1736% image. The default is Over. Choose from these operators:
1737%
1738% OverCompositeOp InCompositeOp OutCompositeOp
1739% AtopCompositeOp XorCompositeOp PlusCompositeOp
1740% MinusCompositeOp AddCompositeOp SubtractCompositeOp
1741% DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1742% DisplaceCompositeOp
1743%
1744% o x: the column offset of the composited image.
1745%
1746% o y: the row offset of the composited image.
1747%
1748*/
cristy3ed852e2009-09-05 21:47:34 +00001749WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
cristyf4ad9df2011-07-08 16:49:03 +00001750 const MagickWand *composite_wand,const CompositeOperator compose,
1751 const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001752{
1753 MagickBooleanType
1754 status;
1755
1756 assert(wand != (MagickWand *) NULL);
1757 assert(wand->signature == WandSignature);
1758 if (wand->debug != MagickFalse)
1759 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1760 if ((wand->images == (Image *) NULL) ||
1761 (composite_wand->images == (Image *) NULL))
1762 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00001763 status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
cristy3ed852e2009-09-05 21:47:34 +00001764 if (status == MagickFalse)
1765 InheritException(wand->exception,&wand->images->exception);
1766 return(status);
1767}
1768
1769/*
1770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1771% %
1772% %
1773% %
1774% M a g i c k C o n t r a s t I m a g e %
1775% %
1776% %
1777% %
1778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1779%
1780% MagickContrastImage() enhances the intensity differences between the lighter
1781% and darker elements of the image. Set sharpen to a value other than 0 to
1782% increase the image contrast otherwise the contrast is reduced.
1783%
1784% The format of the MagickContrastImage method is:
1785%
1786% MagickBooleanType MagickContrastImage(MagickWand *wand,
1787% const MagickBooleanType sharpen)
1788%
1789% A description of each parameter follows:
1790%
1791% o wand: the magick wand.
1792%
1793% o sharpen: Increase or decrease image contrast.
1794%
1795%
1796*/
1797WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1798 const MagickBooleanType sharpen)
1799{
1800 MagickBooleanType
1801 status;
1802
1803 assert(wand != (MagickWand *) NULL);
1804 assert(wand->signature == WandSignature);
1805 if (wand->debug != MagickFalse)
1806 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1807 if (wand->images == (Image *) NULL)
1808 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00001809 status=ContrastImage(wand->images,sharpen,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00001810 return(status);
1811}
1812
1813/*
1814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1815% %
1816% %
1817% %
1818% 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 %
1819% %
1820% %
1821% %
1822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1823%
1824% MagickContrastStretchImage() enhances the contrast of a color image by
1825% adjusting the pixels color to span the entire range of colors available.
1826% You can also reduce the influence of a particular channel with a gamma
1827% value of 0.
1828%
1829% The format of the MagickContrastStretchImage method is:
1830%
1831% MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1832% const double black_point,const double white_point)
cristy3ed852e2009-09-05 21:47:34 +00001833%
1834% A description of each parameter follows:
1835%
1836% o wand: the magick wand.
1837%
cristy3ed852e2009-09-05 21:47:34 +00001838% o black_point: the black point.
1839%
1840% o white_point: the white point.
1841%
1842*/
cristy3ed852e2009-09-05 21:47:34 +00001843WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1844 const double black_point,const double white_point)
1845{
1846 MagickBooleanType
1847 status;
1848
cristy3ed852e2009-09-05 21:47:34 +00001849 assert(wand != (MagickWand *) NULL);
1850 assert(wand->signature == WandSignature);
1851 if (wand->debug != MagickFalse)
1852 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1853 if (wand->images == (Image *) NULL)
1854 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00001855 status=ContrastStretchImage(wand->images,black_point,white_point,
1856 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00001857 return(status);
1858}
1859
1860/*
1861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1862% %
1863% %
1864% %
1865% M a g i c k C o n v o l v e I m a g e %
1866% %
1867% %
1868% %
1869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1870%
1871% MagickConvolveImage() applies a custom convolution kernel to the image.
1872%
1873% The format of the MagickConvolveImage method is:
1874%
1875% MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00001876% const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00001877%
1878% A description of each parameter follows:
1879%
1880% o wand: the magick wand.
1881%
cristy3ed852e2009-09-05 21:47:34 +00001882% o kernel: An array of doubles representing the convolution kernel.
1883%
1884*/
cristy3ed852e2009-09-05 21:47:34 +00001885WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00001886 const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00001887{
cristy3ed852e2009-09-05 21:47:34 +00001888 Image
cristy5e6be1e2011-07-16 01:23:39 +00001889 *filter_image;
cristy3ed852e2009-09-05 21:47:34 +00001890
1891 assert(wand != (MagickWand *) NULL);
1892 assert(wand->signature == WandSignature);
1893 if (wand->debug != MagickFalse)
1894 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00001895 if (kernel == (const KernelInfo *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001896 return(MagickFalse);
1897 if (wand->images == (Image *) NULL)
1898 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00001899 filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1900 if (filter_image == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001901 return(MagickFalse);
cristy5e6be1e2011-07-16 01:23:39 +00001902 ReplaceImageInList(&wand->images,filter_image);
cristy3ed852e2009-09-05 21:47:34 +00001903 return(MagickTrue);
1904}
1905
1906/*
1907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1908% %
1909% %
1910% %
1911% M a g i c k C r o p I m a g e %
1912% %
1913% %
1914% %
1915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1916%
1917% MagickCropImage() extracts a region of the image.
1918%
1919% The format of the MagickCropImage method is:
1920%
1921% MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00001922% const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001923%
1924% A description of each parameter follows:
1925%
1926% o wand: the magick wand.
1927%
1928% o width: the region width.
1929%
1930% o height: the region height.
1931%
1932% o x: the region x-offset.
1933%
1934% o y: the region y-offset.
1935%
1936*/
1937WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00001938 const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001939{
1940 Image
1941 *crop_image;
1942
1943 RectangleInfo
1944 crop;
1945
1946 assert(wand != (MagickWand *) NULL);
1947 assert(wand->signature == WandSignature);
1948 if (wand->debug != MagickFalse)
1949 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1950 if (wand->images == (Image *) NULL)
1951 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1952 crop.width=width;
1953 crop.height=height;
1954 crop.x=x;
1955 crop.y=y;
1956 crop_image=CropImage(wand->images,&crop,wand->exception);
1957 if (crop_image == (Image *) NULL)
1958 return(MagickFalse);
1959 ReplaceImageInList(&wand->images,crop_image);
1960 return(MagickTrue);
1961}
1962
1963/*
1964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1965% %
1966% %
1967% %
1968% M a g i c k C y c l e C o l o r m a p I m a g e %
1969% %
1970% %
1971% %
1972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1973%
1974% MagickCycleColormapImage() displaces an image's colormap by a given number
1975% of positions. If you cycle the colormap a number of times you can produce
1976% a psychodelic effect.
1977%
1978% The format of the MagickCycleColormapImage method is:
1979%
1980% MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001981% const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00001982%
1983% A description of each parameter follows:
1984%
1985% o wand: the magick wand.
1986%
1987% o pixel_wand: the pixel wand.
1988%
1989*/
1990WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001991 const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00001992{
1993 MagickBooleanType
1994 status;
1995
1996 assert(wand != (MagickWand *) NULL);
1997 assert(wand->signature == WandSignature);
1998 if (wand->debug != MagickFalse)
1999 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2000 if (wand->images == (Image *) NULL)
2001 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2002 status=CycleColormapImage(wand->images,displace);
2003 if (status == MagickFalse)
2004 InheritException(wand->exception,&wand->images->exception);
2005 return(status);
2006}
2007
2008/*
2009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010% %
2011% %
2012% %
2013% M a g i c k C o n s t i t u t e I m a g e %
2014% %
2015% %
2016% %
2017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018%
2019% MagickConstituteImage() adds an image to the wand comprised of the pixel
2020% data you supply. The pixel data must be in scanline order top-to-bottom.
2021% The data can be char, short int, int, float, or double. Float and double
2022% require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2023% is the maximum value the type can accomodate (e.g. 255 for char). For
2024% example, to create a 640x480 image from unsigned red-green-blue character
2025% data, use
2026%
2027% MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2028%
2029% The format of the MagickConstituteImage method is:
2030%
2031% MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002032% const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002033% const StorageType storage,void *pixels)
2034%
2035% A description of each parameter follows:
2036%
2037% o wand: the magick wand.
2038%
2039% o columns: width in pixels of the image.
2040%
2041% o rows: height in pixels of the image.
2042%
2043% o map: This string reflects the expected ordering of the pixel array.
2044% It can be any combination or order of R = red, G = green, B = blue,
2045% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2046% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2047% P = pad.
2048%
2049% o storage: Define the data type of the pixels. Float and double types are
2050% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2051% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2052% LongPixel, QuantumPixel, or ShortPixel.
2053%
2054% o pixels: This array of values contain the pixel components as defined by
2055% map and type. You must preallocate this array where the expected
2056% length varies depending on the values of width, height, map, and type.
2057%
2058%
2059*/
2060WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002061 const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002062 const StorageType storage,const void *pixels)
2063{
2064 Image
2065 *images;
2066
2067 assert(wand != (MagickWand *) NULL);
2068 assert(wand->signature == WandSignature);
2069 if (wand->debug != MagickFalse)
2070 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2071 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2072 if (images == (Image *) NULL)
2073 return(MagickFalse);
2074 return(InsertImageInWand(wand,images));
2075}
2076
2077/*
2078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2079% %
2080% %
2081% %
2082% M a g i c k D e c i p h e r I m a g e %
2083% %
2084% %
2085% %
2086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2087%
2088% MagickDecipherImage() converts cipher pixels to plain pixels.
2089%
2090% The format of the MagickDecipherImage method is:
2091%
2092% MagickBooleanType MagickDecipherImage(MagickWand *wand,
2093% const char *passphrase)
2094%
2095% A description of each parameter follows:
2096%
2097% o wand: the magick wand.
2098%
2099% o passphrase: the passphrase.
2100%
2101*/
2102WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2103 const char *passphrase)
2104{
2105 assert(wand != (MagickWand *) NULL);
2106 assert(wand->signature == WandSignature);
2107 if (wand->debug != MagickFalse)
2108 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2109 if (wand->images == (Image *) NULL)
2110 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2111 return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2112}
2113
2114/*
2115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2116% %
2117% %
2118% %
2119% M a g i c k D e c o n s t r u c t I m a g e s %
2120% %
2121% %
2122% %
2123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2124%
2125% MagickDeconstructImages() compares each image with the next in a sequence
2126% and returns the maximum bounding region of any pixel differences it
2127% discovers.
2128%
2129% The format of the MagickDeconstructImages method is:
2130%
2131% MagickWand *MagickDeconstructImages(MagickWand *wand)
2132%
2133% A description of each parameter follows:
2134%
2135% o wand: the magick wand.
2136%
2137*/
2138WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2139{
2140 Image
2141 *deconstruct_image;
2142
2143 assert(wand != (MagickWand *) NULL);
2144 assert(wand->signature == WandSignature);
2145 if (wand->debug != MagickFalse)
2146 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2147 if (wand->images == (Image *) NULL)
2148 return((MagickWand *) NULL);
cristy8a9106f2011-07-05 14:39:26 +00002149 deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
cristy4c08aed2011-07-01 19:47:50 +00002150 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002151 if (deconstruct_image == (Image *) NULL)
2152 return((MagickWand *) NULL);
2153 return(CloneMagickWandFromImages(wand,deconstruct_image));
2154}
2155
2156/*
2157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2158% %
2159% %
2160% %
2161% M a g i c k D e s k e w I m a g e %
2162% %
2163% %
2164% %
2165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2166%
2167% MagickDeskewImage() removes skew from the image. Skew is an artifact that
2168% occurs in scanned images because of the camera being misaligned,
2169% imperfections in the scanning or surface, or simply because the paper was
2170% not placed completely flat when scanned.
2171%
2172% The format of the MagickDeskewImage method is:
2173%
2174% MagickBooleanType MagickDeskewImage(MagickWand *wand,
2175% const double threshold)
2176%
2177% A description of each parameter follows:
2178%
2179% o wand: the magick wand.
2180%
2181% o threshold: separate background from foreground.
2182%
2183*/
2184WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2185 const double threshold)
2186{
2187 Image
2188 *sepia_image;
2189
2190 assert(wand != (MagickWand *) NULL);
2191 assert(wand->signature == WandSignature);
2192 if (wand->debug != MagickFalse)
2193 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2194 if (wand->images == (Image *) NULL)
2195 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2196 sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2197 if (sepia_image == (Image *) NULL)
2198 return(MagickFalse);
2199 ReplaceImageInList(&wand->images,sepia_image);
2200 return(MagickTrue);
2201}
2202
2203/*
2204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2205% %
2206% %
2207% %
2208% M a g i c k D e s p e c k l e I m a g e %
2209% %
2210% %
2211% %
2212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2213%
2214% MagickDespeckleImage() reduces the speckle noise in an image while
2215% perserving the edges of the original image.
2216%
2217% The format of the MagickDespeckleImage method is:
2218%
2219% MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2220%
2221% A description of each parameter follows:
2222%
2223% o wand: the magick wand.
2224%
2225*/
2226WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2227{
2228 Image
2229 *despeckle_image;
2230
2231 assert(wand != (MagickWand *) NULL);
2232 assert(wand->signature == WandSignature);
2233 if (wand->debug != MagickFalse)
2234 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2235 if (wand->images == (Image *) NULL)
2236 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2237 despeckle_image=DespeckleImage(wand->images,wand->exception);
2238 if (despeckle_image == (Image *) NULL)
2239 return(MagickFalse);
2240 ReplaceImageInList(&wand->images,despeckle_image);
2241 return(MagickTrue);
2242}
2243
2244/*
2245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2246% %
2247% %
2248% %
2249% M a g i c k D e s t r o y I m a g e %
2250% %
2251% %
2252% %
2253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2254%
2255% MagickDestroyImage() dereferences an image, deallocating memory associated
2256% with the image if the reference count becomes zero.
2257%
2258% The format of the MagickDestroyImage method is:
2259%
2260% Image *MagickDestroyImage(Image *image)
2261%
2262% A description of each parameter follows:
2263%
2264% o image: the image.
2265%
2266*/
2267WandExport Image *MagickDestroyImage(Image *image)
2268{
2269 return(DestroyImage(image));
2270}
2271
2272/*
2273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2274% %
2275% %
2276% %
2277% M a g i c k D i s p l a y I m a g e %
2278% %
2279% %
2280% %
2281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2282%
2283% MagickDisplayImage() displays an image.
2284%
2285% The format of the MagickDisplayImage method is:
2286%
2287% MagickBooleanType MagickDisplayImage(MagickWand *wand,
2288% const char *server_name)
2289%
2290% A description of each parameter follows:
2291%
2292% o wand: the magick wand.
2293%
2294% o server_name: the X server name.
2295%
2296*/
2297WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2298 const char *server_name)
2299{
2300 Image
2301 *image;
2302
2303 MagickBooleanType
2304 status;
2305
2306 assert(wand != (MagickWand *) NULL);
2307 assert(wand->signature == WandSignature);
2308 if (wand->debug != MagickFalse)
2309 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2310 if (wand->images == (Image *) NULL)
2311 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2312 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2313 if (image == (Image *) NULL)
2314 return(MagickFalse);
2315 (void) CloneString(&wand->image_info->server_name,server_name);
2316 status=DisplayImages(wand->image_info,image);
2317 if (status == MagickFalse)
2318 InheritException(wand->exception,&image->exception);
2319 image=DestroyImage(image);
2320 return(status);
2321}
2322
2323/*
2324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2325% %
2326% %
2327% %
2328% M a g i c k D i s p l a y I m a g e s %
2329% %
2330% %
2331% %
2332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2333%
2334% MagickDisplayImages() displays an image or image sequence.
2335%
2336% The format of the MagickDisplayImages method is:
2337%
2338% MagickBooleanType MagickDisplayImages(MagickWand *wand,
2339% const char *server_name)
2340%
2341% A description of each parameter follows:
2342%
2343% o wand: the magick wand.
2344%
2345% o server_name: the X server name.
2346%
2347*/
2348WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2349 const char *server_name)
2350{
2351 MagickBooleanType
2352 status;
2353
2354 assert(wand != (MagickWand *) NULL);
2355 assert(wand->signature == WandSignature);
2356 if (wand->debug != MagickFalse)
2357 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2358 (void) CloneString(&wand->image_info->server_name,server_name);
2359 status=DisplayImages(wand->image_info,wand->images);
2360 if (status == MagickFalse)
2361 InheritException(wand->exception,&wand->images->exception);
2362 return(status);
2363}
2364
2365/*
2366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2367% %
2368% %
2369% %
2370% M a g i c k D i s t o r t I m a g e %
2371% %
2372% %
2373% %
2374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375%
2376% MagickDistortImage() distorts an image using various distortion methods, by
2377% mapping color lookups of the source image to a new destination image
2378% usally of the same size as the source image, unless 'bestfit' is set to
2379% true.
2380%
2381% If 'bestfit' is enabled, and distortion allows it, the destination image is
2382% adjusted to ensure the whole source 'image' will just fit within the final
2383% destination image, which will be sized and offset accordingly. Also in
2384% many cases the virtual offset of the source image will be taken into
2385% account in the mapping.
2386%
2387% The format of the MagickDistortImage method is:
2388%
2389% MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002390% const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002391% const double *arguments,const MagickBooleanType bestfit)
2392%
2393% A description of each parameter follows:
2394%
2395% o image: the image to be distorted.
2396%
2397% o method: the method of image distortion.
2398%
2399% ArcDistortion always ignores the source image offset, and always
2400% 'bestfit' the destination image with the top left corner offset
2401% relative to the polar mapping center.
2402%
2403% Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2404% style of image distortion.
2405%
2406% Affine, Perspective, and Bilinear, do least squares fitting of the
2407% distortion when more than the minimum number of control point pairs
2408% are provided.
2409%
2410% Perspective, and Bilinear, falls back to a Affine distortion when less
2411% that 4 control point pairs are provided. While Affine distortions let
2412% you use any number of control point pairs, that is Zero pairs is a
2413% no-Op (viewport only) distrotion, one pair is a translation and two
2414% pairs of control points do a scale-rotate-translate, without any
2415% shearing.
2416%
2417% o number_arguments: the number of arguments given for this distortion
2418% method.
2419%
2420% o arguments: the arguments for this distortion method.
2421%
2422% o bestfit: Attempt to resize destination to fit distorted source.
2423%
2424*/
2425WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002426 const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002427 const double *arguments,const MagickBooleanType bestfit)
2428{
2429 Image
2430 *distort_image;
2431
2432 assert(wand != (MagickWand *) NULL);
2433 assert(wand->signature == WandSignature);
2434 if (wand->debug != MagickFalse)
2435 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2436 if (wand->images == (Image *) NULL)
2437 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2438 distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2439 bestfit,wand->exception);
2440 if (distort_image == (Image *) NULL)
2441 return(MagickFalse);
2442 ReplaceImageInList(&wand->images,distort_image);
2443 return(MagickTrue);
2444}
2445
2446/*
2447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2448% %
2449% %
2450% %
2451% M a g i c k D r a w I m a g e %
2452% %
2453% %
2454% %
2455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2456%
2457% MagickDrawImage() renders the drawing wand on the current image.
2458%
2459% The format of the MagickDrawImage method is:
2460%
2461% MagickBooleanType MagickDrawImage(MagickWand *wand,
2462% const DrawingWand *drawing_wand)
2463%
2464% A description of each parameter follows:
2465%
2466% o wand: the magick wand.
2467%
2468% o drawing_wand: the draw wand.
2469%
2470*/
2471WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2472 const DrawingWand *drawing_wand)
2473{
2474 char
2475 *primitive;
2476
2477 DrawInfo
2478 *draw_info;
2479
2480 MagickBooleanType
2481 status;
2482
2483 assert(wand != (MagickWand *) NULL);
2484 assert(wand->signature == WandSignature);
2485 if (wand->debug != MagickFalse)
2486 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2487 if (wand->images == (Image *) NULL)
2488 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2489 draw_info=PeekDrawingWand(drawing_wand);
2490 if ((draw_info == (DrawInfo *) NULL) ||
2491 (draw_info->primitive == (char *) NULL))
2492 return(MagickFalse);
2493 primitive=AcquireString(draw_info->primitive);
2494 draw_info=DestroyDrawInfo(draw_info);
2495 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2496 draw_info->primitive=primitive;
2497 status=DrawImage(wand->images,draw_info);
2498 if (status == MagickFalse)
2499 InheritException(wand->exception,&wand->images->exception);
2500 draw_info=DestroyDrawInfo(draw_info);
2501 return(status);
2502}
2503
2504/*
2505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2506% %
2507% %
2508% %
2509% M a g i c k E d g e I m a g e %
2510% %
2511% %
2512% %
2513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2514%
2515% MagickEdgeImage() enhance edges within the image with a convolution filter
2516% of the given radius. Use a radius of 0 and Edge() selects a suitable
2517% radius for you.
2518%
2519% The format of the MagickEdgeImage method is:
2520%
2521% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2522%
2523% A description of each parameter follows:
2524%
2525% o wand: the magick wand.
2526%
2527% o radius: the radius of the pixel neighborhood.
2528%
2529*/
2530WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2531 const double radius)
2532{
2533 Image
2534 *edge_image;
2535
2536 assert(wand != (MagickWand *) NULL);
2537 assert(wand->signature == WandSignature);
2538 if (wand->debug != MagickFalse)
2539 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2540 if (wand->images == (Image *) NULL)
2541 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2542 edge_image=EdgeImage(wand->images,radius,wand->exception);
2543 if (edge_image == (Image *) NULL)
2544 return(MagickFalse);
2545 ReplaceImageInList(&wand->images,edge_image);
2546 return(MagickTrue);
2547}
2548
2549/*
2550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2551% %
2552% %
2553% %
2554% M a g i c k E m b o s s I m a g e %
2555% %
2556% %
2557% %
2558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2559%
2560% MagickEmbossImage() returns a grayscale image with a three-dimensional
2561% effect. We convolve the image with a Gaussian operator of the given radius
2562% and standard deviation (sigma). For reasonable results, radius should be
2563% larger than sigma. Use a radius of 0 and Emboss() selects a suitable
2564% radius for you.
2565%
2566% The format of the MagickEmbossImage method is:
2567%
2568% MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2569% const double sigma)
2570%
2571% A description of each parameter follows:
2572%
2573% o wand: the magick wand.
2574%
2575% o radius: the radius of the Gaussian, in pixels, not counting the center
2576% pixel.
2577%
2578% o sigma: the standard deviation of the Gaussian, in pixels.
2579%
2580*/
2581WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2582 const double radius,const double sigma)
2583{
2584 Image
2585 *emboss_image;
2586
2587 assert(wand != (MagickWand *) NULL);
2588 assert(wand->signature == WandSignature);
2589 if (wand->debug != MagickFalse)
2590 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2591 if (wand->images == (Image *) NULL)
2592 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2593 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2594 if (emboss_image == (Image *) NULL)
2595 return(MagickFalse);
2596 ReplaceImageInList(&wand->images,emboss_image);
2597 return(MagickTrue);
2598}
2599
2600/*
2601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2602% %
2603% %
2604% %
2605% M a g i c k E n c i p h e r I m a g e %
2606% %
2607% %
2608% %
2609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2610%
2611% MagickEncipherImage() converts plaint pixels to cipher pixels.
2612%
2613% The format of the MagickEncipherImage method is:
2614%
2615% MagickBooleanType MagickEncipherImage(MagickWand *wand,
2616% const char *passphrase)
2617%
2618% A description of each parameter follows:
2619%
2620% o wand: the magick wand.
2621%
2622% o passphrase: the passphrase.
2623%
2624*/
2625WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2626 const char *passphrase)
2627{
2628 assert(wand != (MagickWand *) NULL);
2629 assert(wand->signature == WandSignature);
2630 if (wand->debug != MagickFalse)
2631 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2632 if (wand->images == (Image *) NULL)
2633 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2634 return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2635}
2636
2637/*
2638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2639% %
2640% %
2641% %
2642% M a g i c k E n h a n c e I m a g e %
2643% %
2644% %
2645% %
2646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2647%
2648% MagickEnhanceImage() applies a digital filter that improves the quality of a
2649% noisy image.
2650%
2651% The format of the MagickEnhanceImage method is:
2652%
2653% MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2654%
2655% A description of each parameter follows:
2656%
2657% o wand: the magick wand.
2658%
2659*/
2660WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2661{
2662 Image
2663 *enhance_image;
2664
2665 assert(wand != (MagickWand *) NULL);
2666 assert(wand->signature == WandSignature);
2667 if (wand->debug != MagickFalse)
2668 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2669 if (wand->images == (Image *) NULL)
2670 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2671 enhance_image=EnhanceImage(wand->images,wand->exception);
2672 if (enhance_image == (Image *) NULL)
2673 return(MagickFalse);
2674 ReplaceImageInList(&wand->images,enhance_image);
2675 return(MagickTrue);
2676}
2677
2678/*
2679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2680% %
2681% %
2682% %
2683% M a g i c k E q u a l i z e I m a g e %
2684% %
2685% %
2686% %
2687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2688%
2689% MagickEqualizeImage() equalizes the image histogram.
2690%
2691% The format of the MagickEqualizeImage method is:
2692%
2693% MagickBooleanType MagickEqualizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00002694%
2695% A description of each parameter follows:
2696%
2697% o wand: the magick wand.
2698%
2699% o channel: the image channel(s).
2700%
2701*/
cristy3ed852e2009-09-05 21:47:34 +00002702WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2703{
2704 MagickBooleanType
2705 status;
2706
cristy3ed852e2009-09-05 21:47:34 +00002707 assert(wand != (MagickWand *) NULL);
2708 assert(wand->signature == WandSignature);
2709 if (wand->debug != MagickFalse)
2710 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2711 if (wand->images == (Image *) NULL)
2712 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy50fbc382011-07-07 02:19:17 +00002713 status=EqualizeImage(wand->images);
cristy3ed852e2009-09-05 21:47:34 +00002714 if (status == MagickFalse)
2715 InheritException(wand->exception,&wand->images->exception);
2716 return(status);
2717}
2718
2719/*
2720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2721% %
2722% %
2723% %
2724% M a g i c k E v a l u a t e I m a g e %
2725% %
2726% %
2727% %
2728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2729%
2730% MagickEvaluateImage() applys an arithmetic, relational, or logical
2731% expression to an image. Use these operators to lighten or darken an image,
2732% to increase or decrease contrast in an image, or to produce the "negative"
2733% of an image.
2734%
2735% The format of the MagickEvaluateImage method is:
2736%
2737% MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2738% const MagickEvaluateOperator operator,const double value)
cristyd18ae7c2010-03-07 17:39:52 +00002739% MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2740% const MagickEvaluateOperator operator)
cristy3ed852e2009-09-05 21:47:34 +00002741%
2742% A description of each parameter follows:
2743%
2744% o wand: the magick wand.
2745%
cristy3ed852e2009-09-05 21:47:34 +00002746% o op: A channel operator.
2747%
2748% o value: A value value.
2749%
2750*/
2751
cristyd18ae7c2010-03-07 17:39:52 +00002752WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2753 const MagickEvaluateOperator op)
2754{
2755 Image
2756 *evaluate_image;
2757
2758 assert(wand != (MagickWand *) NULL);
2759 assert(wand->signature == WandSignature);
2760 if (wand->debug != MagickFalse)
2761 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2762 if (wand->images == (Image *) NULL)
2763 return((MagickWand *) NULL);
2764 evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2765 if (evaluate_image == (Image *) NULL)
2766 return((MagickWand *) NULL);
2767 return(CloneMagickWandFromImages(wand,evaluate_image));
2768}
2769
cristyd42d9952011-07-08 14:21:50 +00002770WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2771 const MagickEvaluateOperator op,const double value)
cristy3ed852e2009-09-05 21:47:34 +00002772{
2773 MagickBooleanType
2774 status;
2775
2776 assert(wand != (MagickWand *) NULL);
2777 assert(wand->signature == WandSignature);
2778 if (wand->debug != MagickFalse)
2779 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2780 if (wand->images == (Image *) NULL)
2781 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00002782 status=EvaluateImage(wand->images,op,value,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00002783 return(status);
2784}
2785
2786/*
2787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2788% %
2789% %
2790% %
2791% M a g i c k E x p o r t I m a g e P i x e l s %
2792% %
2793% %
2794% %
2795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2796%
2797% MagickExportImagePixels() extracts pixel data from an image and returns it
2798% to you. The method returns MagickTrue on success otherwise MagickFalse if
2799% an error is encountered. The data is returned as char, short int, int,
cristybb503372010-05-27 20:51:26 +00002800% ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00002801%
2802% Suppose you want to extract the first scanline of a 640x480 image as
2803% character data in red-green-blue order:
2804%
2805% MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2806%
2807% The format of the MagickExportImagePixels method is:
2808%
2809% MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002810% const ssize_t x,const ssize_t y,const size_t columns,
2811% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00002812% void *pixels)
2813%
2814% A description of each parameter follows:
2815%
2816% o wand: the magick wand.
2817%
2818% o x, y, columns, rows: These values define the perimeter
2819% of a region of pixels you want to extract.
2820%
2821% o map: This string reflects the expected ordering of the pixel array.
2822% It can be any combination or order of R = red, G = green, B = blue,
2823% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2824% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2825% P = pad.
2826%
2827% o storage: Define the data type of the pixels. Float and double types are
2828% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2829% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2830% LongPixel, QuantumPixel, or ShortPixel.
2831%
2832% o pixels: This array of values contain the pixel components as defined by
2833% map and type. You must preallocate this array where the expected
2834% length varies depending on the values of width, height, map, and type.
2835%
2836*/
2837WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002838 const ssize_t x,const ssize_t y,const size_t columns,
2839 const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00002840 void *pixels)
2841{
2842 MagickBooleanType
2843 status;
2844
2845 assert(wand != (MagickWand *) NULL);
2846 assert(wand->signature == WandSignature);
2847 if (wand->debug != MagickFalse)
2848 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2849 if (wand->images == (Image *) NULL)
2850 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2851 status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2852 storage,pixels,wand->exception);
2853 if (status == MagickFalse)
2854 InheritException(wand->exception,&wand->images->exception);
2855 return(status);
2856}
2857
2858/*
2859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2860% %
2861% %
2862% %
2863% M a g i c k E x t e n t I m a g e %
2864% %
2865% %
2866% %
2867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2868%
2869% MagickExtentImage() extends the image as defined by the geometry, gravity,
2870% and wand background color. Set the (x,y) offset of the geometry to move
2871% the original wand relative to the extended wand.
2872%
2873% The format of the MagickExtentImage method is:
2874%
2875% MagickBooleanType MagickExtentImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002876% const size_t width,const size_t height,const ssize_t x,
2877% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002878%
2879% A description of each parameter follows:
2880%
2881% o wand: the magick wand.
2882%
2883% o width: the region width.
2884%
2885% o height: the region height.
2886%
2887% o x: the region x offset.
2888%
2889% o y: the region y offset.
2890%
2891*/
2892WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002893 const size_t width,const size_t height,const ssize_t x,
2894 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002895{
2896 Image
2897 *extent_image;
2898
2899 RectangleInfo
2900 extent;
2901
2902 assert(wand != (MagickWand *) NULL);
2903 assert(wand->signature == WandSignature);
2904 if (wand->debug != MagickFalse)
2905 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2906 if (wand->images == (Image *) NULL)
2907 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2908 extent.width=width;
2909 extent.height=height;
2910 extent.x=x;
2911 extent.y=y;
2912 extent_image=ExtentImage(wand->images,&extent,wand->exception);
2913 if (extent_image == (Image *) NULL)
2914 return(MagickFalse);
2915 ReplaceImageInList(&wand->images,extent_image);
2916 return(MagickTrue);
2917}
2918
2919/*
2920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2921% %
2922% %
2923% %
2924% M a g i c k F l i p I m a g e %
2925% %
2926% %
2927% %
2928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2929%
2930% MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2931% around the central x-axis.
2932%
2933% The format of the MagickFlipImage method is:
2934%
2935% MagickBooleanType MagickFlipImage(MagickWand *wand)
2936%
2937% A description of each parameter follows:
2938%
2939% o wand: the magick wand.
2940%
2941*/
2942WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2943{
2944 Image
2945 *flip_image;
2946
2947 assert(wand != (MagickWand *) NULL);
2948 assert(wand->signature == WandSignature);
2949 if (wand->debug != MagickFalse)
2950 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2951 if (wand->images == (Image *) NULL)
2952 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2953 flip_image=FlipImage(wand->images,wand->exception);
2954 if (flip_image == (Image *) NULL)
2955 return(MagickFalse);
2956 ReplaceImageInList(&wand->images,flip_image);
2957 return(MagickTrue);
2958}
2959
2960/*
2961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2962% %
2963% %
2964% %
2965% 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 %
2966% %
2967% %
2968% %
2969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2970%
2971% MagickFloodfillPaintImage() changes the color value of any pixel that matches
2972% target and is an immediate neighbor. If the method FillToBorderMethod is
2973% specified, the color value is changed for any neighbor pixel that does not
2974% match the bordercolor member of image.
2975%
2976% The format of the MagickFloodfillPaintImage method is:
2977%
2978% MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00002979% const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2980% const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00002981%
2982% A description of each parameter follows:
2983%
2984% o wand: the magick wand.
2985%
cristy3ed852e2009-09-05 21:47:34 +00002986% o fill: the floodfill color pixel wand.
2987%
2988% o fuzz: By default target must match a particular pixel color
2989% exactly. However, in many cases two colors may differ by a small amount.
2990% The fuzz member of image defines how much tolerance is acceptable to
2991% consider two colors as the same. For example, set fuzz to 10 and the
2992% color red at intensities of 100 and 102 respectively are now interpreted
2993% as the same color for the purposes of the floodfill.
2994%
2995% o bordercolor: the border color pixel wand.
2996%
2997% o x,y: the starting location of the operation.
2998%
2999% o invert: paint any pixel that does not match the target color.
3000%
3001*/
3002WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00003003 const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3004 const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00003005{
3006 DrawInfo
3007 *draw_info;
3008
3009 MagickBooleanType
3010 status;
3011
cristy4c08aed2011-07-01 19:47:50 +00003012 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00003013 target;
3014
3015 assert(wand != (MagickWand *) NULL);
3016 assert(wand->signature == WandSignature);
3017 if (wand->debug != MagickFalse)
3018 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3019 if (wand->images == (Image *) NULL)
3020 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3021 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
cristy4c08aed2011-07-01 19:47:50 +00003022 PixelGetQuantumPacket(fill,&draw_info->fill);
cristy3ed852e2009-09-05 21:47:34 +00003023 (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3024 y % wand->images->rows,&target,wand->exception);
3025 if (bordercolor != (PixelWand *) NULL)
3026 PixelGetMagickColor(bordercolor,&target);
3027 wand->images->fuzz=fuzz;
cristyd42d9952011-07-08 14:21:50 +00003028 status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert);
cristy3ed852e2009-09-05 21:47:34 +00003029 if (status == MagickFalse)
3030 InheritException(wand->exception,&wand->images->exception);
3031 draw_info=DestroyDrawInfo(draw_info);
3032 return(status);
3033}
3034
3035/*
3036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3037% %
3038% %
3039% %
3040% M a g i c k F l o p I m a g e %
3041% %
3042% %
3043% %
3044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3045%
3046% MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3047% around the central y-axis.
3048%
3049% The format of the MagickFlopImage method is:
3050%
3051% MagickBooleanType MagickFlopImage(MagickWand *wand)
3052%
3053% A description of each parameter follows:
3054%
3055% o wand: the magick wand.
3056%
3057*/
3058WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3059{
3060 Image
3061 *flop_image;
3062
3063 assert(wand != (MagickWand *) NULL);
3064 assert(wand->signature == WandSignature);
3065 if (wand->debug != MagickFalse)
3066 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3067 if (wand->images == (Image *) NULL)
3068 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3069 flop_image=FlopImage(wand->images,wand->exception);
3070 if (flop_image == (Image *) NULL)
3071 return(MagickFalse);
3072 ReplaceImageInList(&wand->images,flop_image);
3073 return(MagickTrue);
3074}
3075
3076/*
3077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3078% %
3079% %
3080% %
3081% 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 %
3082% %
3083% %
3084% %
3085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3086%
3087% MagickForwardFourierTransformImage() implements the discrete Fourier
3088% transform (DFT) of the image either as a magnitude / phase or real /
3089% imaginary image pair.
3090%
3091% The format of the MagickForwardFourierTransformImage method is:
3092%
3093% MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3094% const MagickBooleanType magnitude)
3095%
3096% A description of each parameter follows:
3097%
3098% o wand: the magick wand.
3099%
3100% o magnitude: if true, return as magnitude / phase pair otherwise a real /
3101% imaginary image pair.
3102%
3103*/
3104WandExport MagickBooleanType MagickForwardFourierTransformImage(
3105 MagickWand *wand,const MagickBooleanType magnitude)
3106{
3107 Image
3108 *forward_image;
3109
3110 assert(wand != (MagickWand *) NULL);
3111 assert(wand->signature == WandSignature);
3112 if (wand->debug != MagickFalse)
3113 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3114 if (wand->images == (Image *) NULL)
3115 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3116 forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3117 wand->exception);
3118 if (forward_image == (Image *) NULL)
3119 return(MagickFalse);
3120 ReplaceImageInList(&wand->images,forward_image);
3121 return(MagickTrue);
3122}
3123
3124/*
3125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3126% %
3127% %
3128% %
3129% M a g i c k F r a m e I m a g e %
3130% %
3131% %
3132% %
3133%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3134%
3135% MagickFrameImage() adds a simulated three-dimensional border around the
3136% image. The width and height specify the border width of the vertical and
3137% horizontal sides of the frame. The inner and outer bevels indicate the
3138% width of the inner and outer shadows of the frame.
3139%
3140% The format of the MagickFrameImage method is:
3141%
3142% MagickBooleanType MagickFrameImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003143% const PixelWand *matte_color,const size_t width,
3144% const size_t height,const ssize_t inner_bevel,
3145% const ssize_t outer_bevel)
cristy3ed852e2009-09-05 21:47:34 +00003146%
3147% A description of each parameter follows:
3148%
3149% o wand: the magick wand.
3150%
3151% o matte_color: the frame color pixel wand.
3152%
3153% o width: the border width.
3154%
3155% o height: the border height.
3156%
3157% o inner_bevel: the inner bevel width.
3158%
3159% o outer_bevel: the outer bevel width.
3160%
3161*/
3162WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003163 const PixelWand *matte_color,const size_t width,
3164 const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
cristy3ed852e2009-09-05 21:47:34 +00003165{
3166 Image
3167 *frame_image;
3168
3169 FrameInfo
3170 frame_info;
3171
3172 assert(wand != (MagickWand *) NULL);
3173 assert(wand->signature == WandSignature);
3174 if (wand->debug != MagickFalse)
3175 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3176 if (wand->images == (Image *) NULL)
3177 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3178 (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3179 frame_info.width=wand->images->columns+2*width;
3180 frame_info.height=wand->images->rows+2*height;
cristybb503372010-05-27 20:51:26 +00003181 frame_info.x=(ssize_t) width;
3182 frame_info.y=(ssize_t) height;
cristy3ed852e2009-09-05 21:47:34 +00003183 frame_info.inner_bevel=inner_bevel;
3184 frame_info.outer_bevel=outer_bevel;
cristy4c08aed2011-07-01 19:47:50 +00003185 PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
cristy3ed852e2009-09-05 21:47:34 +00003186 frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3187 if (frame_image == (Image *) NULL)
3188 return(MagickFalse);
3189 ReplaceImageInList(&wand->images,frame_image);
3190 return(MagickTrue);
3191}
3192
3193/*
3194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3195% %
3196% %
3197% %
3198% M a g i c k F u n c t i o n I m a g e %
3199% %
3200% %
3201% %
3202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3203%
3204% MagickFunctionImage() applys an arithmetic, relational, or logical
3205% expression to an image. Use these operators to lighten or darken an image,
3206% to increase or decrease contrast in an image, or to produce the "negative"
3207% of an image.
3208%
3209% The format of the MagickFunctionImage method is:
3210%
3211% MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003212% const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003213% const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +00003214%
3215% A description of each parameter follows:
3216%
3217% o wand: the magick wand.
3218%
cristy3ed852e2009-09-05 21:47:34 +00003219% o function: the image function.
3220%
3221% o number_arguments: the number of function arguments.
3222%
3223% o arguments: the function arguments.
3224%
3225*/
cristy3ed852e2009-09-05 21:47:34 +00003226WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003227 const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003228 const double *arguments)
3229{
3230 MagickBooleanType
3231 status;
3232
3233 assert(wand != (MagickWand *) NULL);
3234 assert(wand->signature == WandSignature);
3235 if (wand->debug != MagickFalse)
3236 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3237 if (wand->images == (Image *) NULL)
3238 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3239 status=FunctionImage(wand->images,function,number_arguments,arguments,
3240 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00003241 return(status);
3242}
3243
3244/*
3245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3246% %
3247% %
3248% %
3249% M a g i c k F x I m a g e %
3250% %
3251% %
3252% %
3253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3254%
3255% MagickFxImage() evaluate expression for each pixel in the image.
3256%
3257% The format of the MagickFxImage method is:
3258%
3259% MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
cristy3ed852e2009-09-05 21:47:34 +00003260%
3261% A description of each parameter follows:
3262%
3263% o wand: the magick wand.
3264%
cristy3ed852e2009-09-05 21:47:34 +00003265% o expression: the expression.
3266%
3267*/
cristy3ed852e2009-09-05 21:47:34 +00003268WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3269{
cristy3ed852e2009-09-05 21:47:34 +00003270 Image
3271 *fx_image;
3272
3273 assert(wand != (MagickWand *) NULL);
3274 assert(wand->signature == WandSignature);
3275 if (wand->debug != MagickFalse)
3276 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3277 if (wand->images == (Image *) NULL)
3278 return((MagickWand *) NULL);
cristy490408a2011-07-07 14:42:05 +00003279 fx_image=FxImage(wand->images,expression,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003280 if (fx_image == (Image *) NULL)
3281 return((MagickWand *) NULL);
3282 return(CloneMagickWandFromImages(wand,fx_image));
3283}
3284
3285/*
3286%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3287% %
3288% %
3289% %
3290% M a g i c k G a m m a I m a g e %
3291% %
3292% %
3293% %
3294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3295%
3296% MagickGammaImage() gamma-corrects an image. The same image viewed on
3297% different devices will have perceptual differences in the way the image's
3298% intensities are represented on the screen. Specify individual gamma levels
3299% for the red, green, and blue channels, or adjust all three with the gamma
3300% parameter. Values typically range from 0.8 to 2.3.
3301%
3302% You can also reduce the influence of a particular channel with a gamma
3303% value of 0.
3304%
3305% The format of the MagickGammaImage method is:
3306%
3307% MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
cristy3ed852e2009-09-05 21:47:34 +00003308%
3309% A description of each parameter follows:
3310%
3311% o wand: the magick wand.
3312%
cristy3ed852e2009-09-05 21:47:34 +00003313% o level: Define the level of gamma correction.
3314%
3315*/
cristy3ed852e2009-09-05 21:47:34 +00003316WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3317 const double gamma)
3318{
3319 MagickBooleanType
3320 status;
3321
cristy3ed852e2009-09-05 21:47:34 +00003322 assert(wand != (MagickWand *) NULL);
3323 assert(wand->signature == WandSignature);
3324 if (wand->debug != MagickFalse)
3325 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3326 if (wand->images == (Image *) NULL)
3327 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00003328 status=GammaImage(wand->images,gamma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003329 return(status);
3330}
3331
3332/*
3333%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3334% %
3335% %
3336% %
3337% M a g i c k G a u s s i a n B l u r I m a g e %
3338% %
3339% %
3340% %
3341%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3342%
3343% MagickGaussianBlurImage() blurs an image. We convolve the image with a
3344% Gaussian operator of the given radius and standard deviation (sigma).
3345% For reasonable results, the radius should be larger than sigma. Use a
3346% radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3347%
3348% The format of the MagickGaussianBlurImage method is:
3349%
3350% MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3351% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00003352%
3353% A description of each parameter follows:
3354%
3355% o wand: the magick wand.
3356%
cristy3ed852e2009-09-05 21:47:34 +00003357% o radius: the radius of the Gaussian, in pixels, not counting the center
3358% pixel.
3359%
3360% o sigma: the standard deviation of the Gaussian, in pixels.
3361%
3362*/
cristy3ed852e2009-09-05 21:47:34 +00003363WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3364 const double radius,const double sigma)
3365{
cristy3ed852e2009-09-05 21:47:34 +00003366 Image
3367 *blur_image;
3368
3369 assert(wand != (MagickWand *) NULL);
3370 assert(wand->signature == WandSignature);
3371 if (wand->debug != MagickFalse)
3372 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3373 if (wand->images == (Image *) NULL)
3374 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00003375 blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003376 if (blur_image == (Image *) NULL)
3377 return(MagickFalse);
3378 ReplaceImageInList(&wand->images,blur_image);
3379 return(MagickTrue);
3380}
3381
3382/*
3383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3384% %
3385% %
3386% %
3387% M a g i c k G e t I m a g e %
3388% %
3389% %
3390% %
3391%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3392%
3393% MagickGetImage() gets the image at the current image index.
3394%
3395% The format of the MagickGetImage method is:
3396%
3397% MagickWand *MagickGetImage(MagickWand *wand)
3398%
3399% A description of each parameter follows:
3400%
3401% o wand: the magick wand.
3402%
3403*/
3404WandExport MagickWand *MagickGetImage(MagickWand *wand)
3405{
3406 Image
3407 *image;
3408
3409 assert(wand != (MagickWand *) NULL);
3410 assert(wand->signature == WandSignature);
3411 if (wand->debug != MagickFalse)
3412 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3413 if (wand->images == (Image *) NULL)
3414 {
3415 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3416 "ContainsNoImages","`%s'",wand->name);
3417 return((MagickWand *) NULL);
3418 }
3419 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3420 if (image == (Image *) NULL)
3421 return((MagickWand *) NULL);
3422 return(CloneMagickWandFromImages(wand,image));
3423}
3424
3425/*
3426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3427% %
3428% %
3429% %
3430% 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 %
3431% %
3432% %
3433% %
3434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3435%
3436% MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3437% is not activated. That is, the image is RGB rather than RGBA or CMYK rather
3438% than CMYKA.
3439%
3440% The format of the MagickGetImageAlphaChannel method is:
3441%
cristybb503372010-05-27 20:51:26 +00003442% size_t MagickGetImageAlphaChannel(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003443%
3444% A description of each parameter follows:
3445%
3446% o wand: the magick wand.
3447%
3448*/
3449WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3450{
3451 assert(wand != (MagickWand *) NULL);
3452 assert(wand->signature == WandSignature);
3453 if (wand->debug != MagickFalse)
3454 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3455 if (wand->images == (Image *) NULL)
3456 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3457 return(GetImageAlphaChannel(wand->images));
3458}
3459
3460/*
3461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3462% %
3463% %
3464% %
3465% M a g i c k G e t I m a g e C l i p M a s k %
3466% %
3467% %
3468% %
3469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3470%
3471% MagickGetImageClipMask() gets the image clip mask at the current image index.
3472%
3473% The format of the MagickGetImageClipMask method is:
3474%
3475% MagickWand *MagickGetImageClipMask(MagickWand *wand)
3476%
3477% A description of each parameter follows:
3478%
3479% o wand: the magick wand.
3480%
3481*/
3482WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3483{
3484 Image
3485 *image;
3486
3487 assert(wand != (MagickWand *) NULL);
3488 assert(wand->signature == WandSignature);
3489 if (wand->debug != MagickFalse)
3490 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3491 if (wand->images == (Image *) NULL)
3492 {
3493 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3494 "ContainsNoImages","`%s'",wand->name);
3495 return((MagickWand *) NULL);
3496 }
3497 image=GetImageClipMask(wand->images,wand->exception);
3498 if (image == (Image *) NULL)
3499 return((MagickWand *) NULL);
3500 return(CloneMagickWandFromImages(wand,image));
3501}
3502
3503/*
3504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3505% %
3506% %
3507% %
3508% 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 %
3509% %
3510% %
3511% %
3512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3513%
3514% MagickGetImageBackgroundColor() returns the image background color.
3515%
3516% The format of the MagickGetImageBackgroundColor method is:
3517%
3518% MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3519% PixelWand *background_color)
3520%
3521% A description of each parameter follows:
3522%
3523% o wand: the magick wand.
3524%
3525% o background_color: Return the background color.
3526%
3527*/
3528WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3529 PixelWand *background_color)
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);
cristy4c08aed2011-07-01 19:47:50 +00003537 PixelSetQuantumPacket(background_color,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00003538 return(MagickTrue);
3539}
3540
3541/*
3542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3543% %
3544% %
3545% %
3546% M a g i c k G e t I m a g e B l o b %
3547% %
3548% %
3549% %
3550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3551%
cristy1a1b5622011-02-15 02:40:42 +00003552% MagickGetImageBlob() implements direct to memory image formats. It returns
3553% the image as a blob (a formatted "file" in memory) and its length, starting
3554% from the current position in the image sequence. Use MagickSetImageFormat()
3555% to set the format to write to the blob (GIF, JPEG, PNG, etc.).
3556%
3557% Utilize MagickResetIterator() to ensure the write is from the beginning of
3558% the image sequence.
cristy3ed852e2009-09-05 21:47:34 +00003559%
3560% Use MagickRelinquishMemory() to free the blob when you are done with it.
3561%
3562% The format of the MagickGetImageBlob method is:
3563%
3564% unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3565%
3566% A description of each parameter follows:
3567%
3568% o wand: the magick wand.
3569%
3570% o length: the length of the blob.
3571%
3572*/
3573WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3574{
3575 assert(wand != (MagickWand *) NULL);
3576 assert(wand->signature == WandSignature);
3577 if (wand->debug != MagickFalse)
3578 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3579 if (wand->images == (Image *) NULL)
3580 {
3581 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3582 "ContainsNoImages","`%s'",wand->name);
3583 return((unsigned char *) NULL);
3584 }
3585 return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3586}
3587
3588/*
3589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3590% %
3591% %
3592% %
3593% M a g i c k G e t I m a g e s B l o b %
3594% %
3595% %
3596% %
3597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3598%
3599% MagickGetImageBlob() implements direct to memory image formats. It
3600% returns the image sequence as a blob and its length. The format of the image
3601% determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
3602% return a different image format, use MagickSetImageFormat().
3603%
3604% Note, some image formats do not permit multiple images to the same image
3605% stream (e.g. JPEG). in this instance, just the first image of the
3606% sequence is returned as a blob.
3607%
3608% The format of the MagickGetImagesBlob method is:
3609%
3610% unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3611%
3612% A description of each parameter follows:
3613%
3614% o wand: the magick wand.
3615%
3616% o length: the length of the blob.
3617%
3618*/
3619WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3620{
3621 unsigned char
3622 *blob;
3623
3624 assert(wand != (MagickWand *) NULL);
3625 assert(wand->signature == WandSignature);
3626 if (wand->debug != MagickFalse)
3627 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3628 if (wand->images == (Image *) NULL)
3629 {
3630 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3631 "ContainsNoImages","`%s'",wand->name);
3632 return((unsigned char *) NULL);
3633 }
3634 blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3635 wand->exception);
3636 return(blob);
3637}
3638
3639/*
3640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641% %
3642% %
3643% %
3644% 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 %
3645% %
3646% %
3647% %
3648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3649%
3650% MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3651% image.
3652%
3653% The format of the MagickGetImageBluePrimary method is:
3654%
3655% MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3656% double *y)
3657%
3658% A description of each parameter follows:
3659%
3660% o wand: the magick wand.
3661%
3662% o x: the chromaticity blue primary x-point.
3663%
3664% o y: the chromaticity blue primary y-point.
3665%
3666*/
3667WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3668 double *x,double *y)
3669{
3670 assert(wand != (MagickWand *) NULL);
3671 assert(wand->signature == WandSignature);
3672 if (wand->debug != MagickFalse)
3673 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3674 if (wand->images == (Image *) NULL)
3675 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3676 *x=wand->images->chromaticity.blue_primary.x;
3677 *y=wand->images->chromaticity.blue_primary.y;
3678 return(MagickTrue);
3679}
3680
3681/*
3682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3683% %
3684% %
3685% %
3686% 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 %
3687% %
3688% %
3689% %
3690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3691%
3692% MagickGetImageBorderColor() returns the image border color.
3693%
3694% The format of the MagickGetImageBorderColor method is:
3695%
3696% MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3697% PixelWand *border_color)
3698%
3699% A description of each parameter follows:
3700%
3701% o wand: the magick wand.
3702%
3703% o border_color: Return the border color.
3704%
3705*/
3706WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3707 PixelWand *border_color)
3708{
3709 assert(wand != (MagickWand *) NULL);
3710 assert(wand->signature == WandSignature);
3711 if (wand->debug != MagickFalse)
3712 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3713 if (wand->images == (Image *) NULL)
3714 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00003715 PixelSetQuantumPacket(border_color,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00003716 return(MagickTrue);
3717}
3718
3719/*
3720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3721% %
3722% %
3723% %
cristyd42d9952011-07-08 14:21:50 +00003724% M a g i c k G e t I m a g e F e a t u r e s %
cristy3ed852e2009-09-05 21:47:34 +00003725% %
3726% %
3727% %
3728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3729%
cristy490408a2011-07-07 14:42:05 +00003730% MagickGetImageFeatures() returns features for each channel in the
cristy7396d882010-01-27 02:37:56 +00003731% image in each of four directions (horizontal, vertical, left and right
3732% diagonals) for the specified distance. The features include the angular
3733% second moment, contrast, correlation, sum of squares: variance, inverse
3734% difference moment, sum average, sum varience, sum entropy, entropy,
3735% difference variance, difference entropy, information measures of
3736% correlation 1, information measures of correlation 2, and maximum
3737% correlation coefficient. You can access the red channel contrast, for
3738% example, like this:
cristy3ed852e2009-09-05 21:47:34 +00003739%
cristy490408a2011-07-07 14:42:05 +00003740% channel_features=MagickGetImageFeatures(wand,1);
cristy549a37e2010-01-26 15:24:15 +00003741% contrast=channel_features[RedChannel].contrast[0];
cristy3ed852e2009-09-05 21:47:34 +00003742%
cristy549a37e2010-01-26 15:24:15 +00003743% Use MagickRelinquishMemory() to free the statistics buffer.
3744%
cristy490408a2011-07-07 14:42:05 +00003745% The format of the MagickGetImageFeatures method is:
cristy549a37e2010-01-26 15:24:15 +00003746%
cristy490408a2011-07-07 14:42:05 +00003747% ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003748% const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00003749%
3750% A description of each parameter follows:
3751%
3752% o wand: the magick wand.
3753%
cristy549a37e2010-01-26 15:24:15 +00003754% o distance: the distance.
cristy3ed852e2009-09-05 21:47:34 +00003755%
3756*/
cristy490408a2011-07-07 14:42:05 +00003757WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003758 const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00003759{
cristy3ed852e2009-09-05 21:47:34 +00003760 assert(wand != (MagickWand *) NULL);
3761 assert(wand->signature == WandSignature);
3762 if (wand->debug != MagickFalse)
3763 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3764 if (wand->images == (Image *) NULL)
cristy549a37e2010-01-26 15:24:15 +00003765 {
3766 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3767 "ContainsNoImages","`%s'",wand->name);
3768 return((ChannelFeatures *) NULL);
3769 }
cristy490408a2011-07-07 14:42:05 +00003770 return(GetImageFeatures(wand->images,distance,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00003771}
3772
3773/*
3774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3775% %
3776% %
3777% %
cristyd42d9952011-07-08 14:21:50 +00003778% M a g i c k G e t I m a g e K u r t o s i s %
cristy3ed852e2009-09-05 21:47:34 +00003779% %
3780% %
3781% %
3782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3783%
cristyd42d9952011-07-08 14:21:50 +00003784% MagickGetImageKurtosis() gets the kurtosis and skewness of one or
cristy3ed852e2009-09-05 21:47:34 +00003785% more image channels.
3786%
cristyd42d9952011-07-08 14:21:50 +00003787% The format of the MagickGetImageKurtosis method is:
cristy3ed852e2009-09-05 21:47:34 +00003788%
cristyd42d9952011-07-08 14:21:50 +00003789% MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3790% double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00003791%
3792% A description of each parameter follows:
3793%
3794% o wand: the magick wand.
3795%
cristy3ed852e2009-09-05 21:47:34 +00003796% o kurtosis: The kurtosis for the specified channel(s).
3797%
3798% o skewness: The skewness for the specified channel(s).
3799%
3800*/
cristyd42d9952011-07-08 14:21:50 +00003801WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3802 double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00003803{
3804 MagickBooleanType
3805 status;
3806
3807 assert(wand != (MagickWand *) NULL);
3808 assert(wand->signature == WandSignature);
3809 if (wand->debug != MagickFalse)
3810 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3811 if (wand->images == (Image *) NULL)
3812 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00003813 status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003814 return(status);
3815}
cristy549a37e2010-01-26 15:24:15 +00003816
3817/*
3818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3819% %
3820% %
3821% %
cristyd42d9952011-07-08 14:21:50 +00003822% M a g i c k G e t I m a g e M e a n %
cristy549a37e2010-01-26 15:24:15 +00003823% %
3824% %
3825% %
3826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3827%
cristyd42d9952011-07-08 14:21:50 +00003828% MagickGetImageMean() gets the mean and standard deviation of one or more
3829% image channels.
cristy549a37e2010-01-26 15:24:15 +00003830%
cristyd42d9952011-07-08 14:21:50 +00003831% The format of the MagickGetImageMean method is:
cristy549a37e2010-01-26 15:24:15 +00003832%
cristyd42d9952011-07-08 14:21:50 +00003833% MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3834% double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00003835%
3836% A description of each parameter follows:
3837%
3838% o wand: the magick wand.
3839%
3840% o channel: the image channel(s).
3841%
3842% o mean: The mean pixel value for the specified channel(s).
3843%
3844% o standard_deviation: The standard deviation for the specified channel(s).
3845%
3846*/
cristyd42d9952011-07-08 14:21:50 +00003847WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3848 double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00003849{
3850 MagickBooleanType
3851 status;
cristy3ed852e2009-09-05 21:47:34 +00003852
cristy549a37e2010-01-26 15:24:15 +00003853 assert(wand != (MagickWand *) NULL);
3854 assert(wand->signature == WandSignature);
3855 if (wand->debug != MagickFalse)
3856 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3857 if (wand->images == (Image *) NULL)
3858 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00003859 status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
cristy549a37e2010-01-26 15:24:15 +00003860 return(status);
3861}
3862
cristy3ed852e2009-09-05 21:47:34 +00003863/*
3864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3865% %
3866% %
3867% %
cristyd42d9952011-07-08 14:21:50 +00003868% M a g i c k G e t I m a g e R a n g e %
cristy3ed852e2009-09-05 21:47:34 +00003869% %
3870% %
3871% %
3872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3873%
cristyd42d9952011-07-08 14:21:50 +00003874% MagickGetImageRange() gets the range for one or more image channels.
cristy3ed852e2009-09-05 21:47:34 +00003875%
cristyd42d9952011-07-08 14:21:50 +00003876% The format of the MagickGetImageRange method is:
cristy3ed852e2009-09-05 21:47:34 +00003877%
cristyd42d9952011-07-08 14:21:50 +00003878% MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3879% double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00003880%
3881% A description of each parameter follows:
3882%
3883% o wand: the magick wand.
3884%
cristy3ed852e2009-09-05 21:47:34 +00003885% o minima: The minimum pixel value for the specified channel(s).
3886%
3887% o maxima: The maximum pixel value for the specified channel(s).
3888%
3889*/
cristyd42d9952011-07-08 14:21:50 +00003890WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3891 double *minima,double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00003892{
3893 MagickBooleanType
3894 status;
3895
3896 assert(wand != (MagickWand *) NULL);
3897 assert(wand->signature == WandSignature);
3898 if (wand->debug != MagickFalse)
3899 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3900 if (wand->images == (Image *) NULL)
3901 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00003902 status=GetImageRange(wand->images,minima,maxima,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003903 return(status);
3904}
3905
3906/*
3907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3908% %
3909% %
3910% %
cristyd42d9952011-07-08 14:21:50 +00003911% M a g i c k G e t I m a g e S t a t i s t i c s %
cristy3ed852e2009-09-05 21:47:34 +00003912% %
3913% %
3914% %
3915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3916%
cristyd42d9952011-07-08 14:21:50 +00003917% MagickGetImageStatistics() returns statistics for each channel in the
cristy3ed852e2009-09-05 21:47:34 +00003918% image. The statistics include the channel depth, its minima and
3919% maxima, the mean, the standard deviation, the kurtosis and the skewness.
3920% You can access the red channel mean, for example, like this:
3921%
cristyd42d9952011-07-08 14:21:50 +00003922% channel_statistics=MagickGetImageStatistics(wand);
cristy3ed852e2009-09-05 21:47:34 +00003923% red_mean=channel_statistics[RedChannel].mean;
3924%
3925% Use MagickRelinquishMemory() to free the statistics buffer.
3926%
cristyd42d9952011-07-08 14:21:50 +00003927% The format of the MagickGetImageStatistics method is:
cristy3ed852e2009-09-05 21:47:34 +00003928%
cristyd42d9952011-07-08 14:21:50 +00003929% ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003930%
3931% A description of each parameter follows:
3932%
3933% o wand: the magick wand.
3934%
3935*/
cristyd42d9952011-07-08 14:21:50 +00003936WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003937{
3938 assert(wand != (MagickWand *) NULL);
3939 assert(wand->signature == WandSignature);
3940 if (wand->debug != MagickFalse)
3941 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3942 if (wand->images == (Image *) NULL)
3943 {
3944 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3945 "ContainsNoImages","`%s'",wand->name);
3946 return((ChannelStatistics *) NULL);
3947 }
cristyd42d9952011-07-08 14:21:50 +00003948 return(GetImageStatistics(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00003949}
3950
3951/*
3952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3953% %
3954% %
3955% %
3956% 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 %
3957% %
3958% %
3959% %
3960%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3961%
3962% MagickGetImageColormapColor() returns the color of the specified colormap
3963% index.
3964%
3965% The format of the MagickGetImageColormapColor method is:
3966%
3967% MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003968% const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00003969%
3970% A description of each parameter follows:
3971%
3972% o wand: the magick wand.
3973%
3974% o index: the offset into the image colormap.
3975%
3976% o color: Return the colormap color in this wand.
3977%
3978*/
3979WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003980 const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00003981{
3982 assert(wand != (MagickWand *) NULL);
3983 assert(wand->signature == WandSignature);
3984 if (wand->debug != MagickFalse)
3985 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3986 if (wand->images == (Image *) NULL)
3987 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3988 if ((wand->images->colormap == (PixelPacket *) NULL) ||
3989 (index >= wand->images->colors))
3990 {
3991 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3992 "InvalidColormapIndex","`%s'",wand->name);
3993 return(MagickFalse);
3994 }
cristy4c08aed2011-07-01 19:47:50 +00003995 PixelSetQuantumPacket(color,wand->images->colormap+index);
cristy3ed852e2009-09-05 21:47:34 +00003996 return(MagickTrue);
3997}
3998
3999/*
4000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4001% %
4002% %
4003% %
4004% M a g i c k G e t I m a g e C o l o r s %
4005% %
4006% %
4007% %
4008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4009%
4010% MagickGetImageColors() gets the number of unique colors in the image.
4011%
4012% The format of the MagickGetImageColors method is:
4013%
cristybb503372010-05-27 20:51:26 +00004014% size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004015%
4016% A description of each parameter follows:
4017%
4018% o wand: the magick wand.
4019%
4020*/
cristybb503372010-05-27 20:51:26 +00004021WandExport size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004022{
4023 assert(wand != (MagickWand *) NULL);
4024 assert(wand->signature == WandSignature);
4025 if (wand->debug != MagickFalse)
4026 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4027 if (wand->images == (Image *) NULL)
4028 {
4029 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4030 "ContainsNoImages","`%s'",wand->name);
4031 return(0);
4032 }
4033 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4034}
4035
4036/*
4037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4038% %
4039% %
4040% %
4041% M a g i c k G e t I m a g e C o l o r s p a c e %
4042% %
4043% %
4044% %
4045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4046%
4047% MagickGetImageColorspace() gets the image colorspace.
4048%
4049% The format of the MagickGetImageColorspace method is:
4050%
4051% ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4052%
4053% A description of each parameter follows:
4054%
4055% o wand: the magick wand.
4056%
4057*/
4058WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4059{
4060 assert(wand != (MagickWand *) NULL);
4061 assert(wand->signature == WandSignature);
4062 if (wand->debug != MagickFalse)
4063 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4064 if (wand->images == (Image *) NULL)
4065 {
4066 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4067 "ContainsNoImages","`%s'",wand->name);
4068 return(UndefinedColorspace);
4069 }
4070 return(wand->images->colorspace);
4071}
4072
4073/*
4074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4075% %
4076% %
4077% %
4078% M a g i c k G e t I m a g e C o m p o s e %
4079% %
4080% %
4081% %
4082%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4083%
4084% MagickGetImageCompose() returns the composite operator associated with the
4085% image.
4086%
4087% The format of the MagickGetImageCompose method is:
4088%
4089% CompositeOperator MagickGetImageCompose(MagickWand *wand)
4090%
4091% A description of each parameter follows:
4092%
4093% o wand: the magick wand.
4094%
4095*/
4096WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4097{
4098 assert(wand != (MagickWand *) NULL);
4099 assert(wand->signature == WandSignature);
4100 if (wand->debug != MagickFalse)
4101 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4102 if (wand->images == (Image *) NULL)
4103 {
4104 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4105 "ContainsNoImages","`%s'",wand->name);
4106 return(UndefinedCompositeOp);
4107 }
4108 return(wand->images->compose);
4109}
4110
4111/*
4112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4113% %
4114% %
4115% %
4116% 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 %
4117% %
4118% %
4119% %
4120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4121%
4122% MagickGetImageCompression() gets the image compression.
4123%
4124% The format of the MagickGetImageCompression method is:
4125%
4126% CompressionType MagickGetImageCompression(MagickWand *wand)
4127%
4128% A description of each parameter follows:
4129%
4130% o wand: the magick wand.
4131%
4132*/
4133WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4134{
4135 assert(wand != (MagickWand *) NULL);
4136 assert(wand->signature == WandSignature);
4137 if (wand->debug != MagickFalse)
4138 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4139 if (wand->images == (Image *) NULL)
4140 {
4141 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4142 "ContainsNoImages","`%s'",wand->name);
4143 return(UndefinedCompression);
4144 }
4145 return(wand->images->compression);
4146}
4147
4148/*
4149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4150% %
4151% %
4152% %
4153% 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 %
4154% %
4155% %
4156% %
4157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4158%
4159% MagickGetImageCompression() gets the image compression quality.
4160%
4161% The format of the MagickGetImageCompression method is:
4162%
cristybb503372010-05-27 20:51:26 +00004163% size_t MagickGetImageCompression(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004164%
4165% A description of each parameter follows:
4166%
4167% o wand: the magick wand.
4168%
4169*/
cristybb503372010-05-27 20:51:26 +00004170WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004171{
4172 assert(wand != (MagickWand *) NULL);
4173 assert(wand->signature == WandSignature);
4174 if (wand->debug != MagickFalse)
4175 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4176 if (wand->images == (Image *) NULL)
4177 {
4178 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4179 "ContainsNoImages","`%s'",wand->name);
4180 return(0UL);
4181 }
4182 return(wand->images->quality);
4183}
4184
4185/*
4186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4187% %
4188% %
4189% %
4190% M a g i c k G e t I m a g e D e l a y %
4191% %
4192% %
4193% %
4194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4195%
4196% MagickGetImageDelay() gets the image delay.
4197%
4198% The format of the MagickGetImageDelay method is:
4199%
cristybb503372010-05-27 20:51:26 +00004200% size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004201%
4202% A description of each parameter follows:
4203%
4204% o wand: the magick wand.
4205%
4206*/
cristybb503372010-05-27 20:51:26 +00004207WandExport size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004208{
4209 assert(wand != (MagickWand *) NULL);
4210 assert(wand->signature == WandSignature);
4211 if (wand->debug != MagickFalse)
4212 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4213 if (wand->images == (Image *) NULL)
4214 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4215 return(wand->images->delay);
4216}
4217
4218/*
4219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4220% %
4221% %
4222% %
4223% M a g i c k G e t I m a g e D e p t h %
4224% %
4225% %
4226% %
4227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4228%
4229% MagickGetImageDepth() gets the image depth.
4230%
4231% The format of the MagickGetImageDepth method is:
4232%
cristybb503372010-05-27 20:51:26 +00004233% size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004234%
4235% A description of each parameter follows:
4236%
4237% o wand: the magick wand.
4238%
4239*/
cristybb503372010-05-27 20:51:26 +00004240WandExport size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004241{
4242 assert(wand != (MagickWand *) NULL);
4243 assert(wand->signature == WandSignature);
4244 if (wand->debug != MagickFalse)
4245 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4246 if (wand->images == (Image *) NULL)
4247 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyfefab1b2011-07-05 00:33:22 +00004248 return(GetImageDepth(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00004249}
4250
4251/*
4252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4253% %
4254% %
4255% %
cristy8a9106f2011-07-05 14:39:26 +00004256% M a g i c k G e t I m a g e D i s p o s e %
4257% %
4258% %
4259% %
4260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4261%
4262% MagickGetImageDispose() gets the image disposal method.
4263%
4264% The format of the MagickGetImageDispose method is:
4265%
4266% DisposeType MagickGetImageDispose(MagickWand *wand)
4267%
4268% A description of each parameter follows:
4269%
4270% o wand: the magick wand.
4271%
4272*/
4273WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4274{
4275 assert(wand != (MagickWand *) NULL);
4276 assert(wand->signature == WandSignature);
4277 if (wand->debug != MagickFalse)
4278 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4279 if (wand->images == (Image *) NULL)
4280 {
4281 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4282 "ContainsNoImages","`%s'",wand->name);
4283 return(UndefinedDispose);
4284 }
4285 return((DisposeType) wand->images->dispose);
4286}
4287
4288/*
4289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4290% %
4291% %
4292% %
cristy3ed852e2009-09-05 21:47:34 +00004293% M a g i c k G e t I m a g e D i s t o r t i o n %
4294% %
4295% %
4296% %
4297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4298%
4299% MagickGetImageDistortion() compares an image to a reconstructed image and
4300% returns the specified distortion metric.
4301%
4302% The format of the MagickGetImageDistortion method is:
4303%
4304% MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4305% const MagickWand *reference,const MetricType metric,
4306% double *distortion)
4307%
4308% A description of each parameter follows:
4309%
4310% o wand: the magick wand.
4311%
4312% o reference: the reference wand.
4313%
4314% o metric: the metric.
4315%
4316% o distortion: the computed distortion between the images.
4317%
4318*/
4319WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4320 const MagickWand *reference,const MetricType metric,double *distortion)
4321{
4322 MagickBooleanType
4323 status;
4324
cristy3ed852e2009-09-05 21:47:34 +00004325 assert(wand != (MagickWand *) NULL);
4326 assert(wand->signature == WandSignature);
4327 if (wand->debug != MagickFalse)
4328 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4329 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4330 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4331 status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4332 &wand->images->exception);
4333 return(status);
4334}
4335
4336/*
4337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4338% %
4339% %
4340% %
cristy8a9106f2011-07-05 14:39:26 +00004341% M a g i c k G e t I m a g e D i s t o r t i o n s %
cristy3ed852e2009-09-05 21:47:34 +00004342% %
4343% %
4344% %
4345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4346%
cristy8a9106f2011-07-05 14:39:26 +00004347% MagickGetImageDistortions() compares one or more pixel channels of an
4348% image to a reconstructed image and returns the specified distortion metrics.
cristy3ed852e2009-09-05 21:47:34 +00004349%
cristy8a9106f2011-07-05 14:39:26 +00004350% Use MagickRelinquishMemory() to free the metrics when you are done with them.
cristy3ed852e2009-09-05 21:47:34 +00004351%
cristy8a9106f2011-07-05 14:39:26 +00004352% The format of the MagickGetImageDistortion method is:
4353%
4354% double *MagickGetImageDistortion(MagickWand *wand,
4355% const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004356%
4357% A description of each parameter follows:
4358%
4359% o wand: the magick wand.
4360%
cristy8a9106f2011-07-05 14:39:26 +00004361% o reference: the reference wand.
4362%
4363% o metric: the metric.
4364%
cristy3ed852e2009-09-05 21:47:34 +00004365*/
cristy8a9106f2011-07-05 14:39:26 +00004366WandExport double *MagickGetImageDistortions(MagickWand *wand,
4367 const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004368{
cristy8a9106f2011-07-05 14:39:26 +00004369 double
4370 *channel_distortion;
4371
cristy3ed852e2009-09-05 21:47:34 +00004372 assert(wand != (MagickWand *) NULL);
4373 assert(wand->signature == WandSignature);
4374 if (wand->debug != MagickFalse)
4375 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004376 assert(reference != (MagickWand *) NULL);
4377 assert(reference->signature == WandSignature);
4378 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
cristy3ed852e2009-09-05 21:47:34 +00004379 {
4380 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4381 "ContainsNoImages","`%s'",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004382 return((double *) NULL);
cristy3ed852e2009-09-05 21:47:34 +00004383 }
cristy8a9106f2011-07-05 14:39:26 +00004384 channel_distortion=GetImageDistortions(wand->images,reference->images,
4385 metric,&wand->images->exception);
4386 return(channel_distortion);
cristy3ed852e2009-09-05 21:47:34 +00004387}
4388
4389/*
4390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4391% %
4392% %
4393% %
4394% M a g i c k G e t I m a g e F i l e n a m e %
4395% %
4396% %
4397% %
4398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4399%
4400% MagickGetImageFilename() returns the filename of a particular image in a
4401% sequence.
4402%
4403% The format of the MagickGetImageFilename method is:
4404%
4405% char *MagickGetImageFilename(MagickWand *wand)
4406%
4407% A description of each parameter follows:
4408%
4409% o wand: the magick wand.
4410%
4411*/
4412WandExport char *MagickGetImageFilename(MagickWand *wand)
4413{
4414 assert(wand != (MagickWand *) NULL);
4415 assert(wand->signature == WandSignature);
4416 if (wand->debug != MagickFalse)
4417 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4418 if (wand->images == (Image *) NULL)
4419 {
4420 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4421 "ContainsNoImages","`%s'",wand->name);
4422 return((char *) NULL);
4423 }
4424 return(AcquireString(wand->images->filename));
4425}
4426
4427/*
4428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4429% %
4430% %
4431% %
4432% M a g i c k G e t I m a g e F o r m a t %
4433% %
4434% %
4435% %
4436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4437%
4438% MagickGetImageFormat() returns the format of a particular image in a
4439% sequence.
4440%
4441% The format of the MagickGetImageFormat method is:
4442%
cristy197d0572010-07-29 23:26:05 +00004443% const char *MagickGetImageFormat(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004444%
4445% A description of each parameter follows:
4446%
4447% o wand: the magick wand.
4448%
4449*/
4450WandExport char *MagickGetImageFormat(MagickWand *wand)
4451{
4452 assert(wand != (MagickWand *) NULL);
4453 assert(wand->signature == WandSignature);
4454 if (wand->debug != MagickFalse)
4455 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4456 if (wand->images == (Image *) NULL)
4457 {
4458 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4459 "ContainsNoImages","`%s'",wand->name);
4460 return((char *) NULL);
4461 }
4462 return(AcquireString(wand->images->magick));
4463}
4464
4465/*
4466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4467% %
4468% %
4469% %
4470% M a g i c k G e t I m a g e F u z z %
4471% %
4472% %
4473% %
4474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4475%
4476% MagickGetImageFuzz() gets the image fuzz.
4477%
4478% The format of the MagickGetImageFuzz method is:
4479%
4480% double MagickGetImageFuzz(MagickWand *wand)
4481%
4482% A description of each parameter follows:
4483%
4484% o wand: the magick wand.
4485%
4486*/
4487WandExport double MagickGetImageFuzz(MagickWand *wand)
4488{
4489 assert(wand != (MagickWand *) NULL);
4490 assert(wand->signature == WandSignature);
4491 if (wand->debug != MagickFalse)
4492 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4493 if (wand->images == (Image *) NULL)
4494 {
4495 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4496 "ContainsNoImages","`%s'",wand->name);
4497 return(0.0);
4498 }
4499 return(wand->images->fuzz);
4500}
4501
4502/*
4503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4504% %
4505% %
4506% %
4507% M a g i c k G e t I m a g e G a m m a %
4508% %
4509% %
4510% %
4511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4512%
4513% MagickGetImageGamma() gets the image gamma.
4514%
4515% The format of the MagickGetImageGamma method is:
4516%
4517% double MagickGetImageGamma(MagickWand *wand)
4518%
4519% A description of each parameter follows:
4520%
4521% o wand: the magick wand.
4522%
4523*/
4524WandExport double MagickGetImageGamma(MagickWand *wand)
4525{
4526 assert(wand != (MagickWand *) NULL);
4527 assert(wand->signature == WandSignature);
4528 if (wand->debug != MagickFalse)
4529 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4530 if (wand->images == (Image *) NULL)
4531 {
4532 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4533 "ContainsNoImages","`%s'",wand->name);
4534 return(0.0);
4535 }
4536 return(wand->images->gamma);
4537}
4538
4539/*
4540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4541% %
4542% %
4543% %
4544% 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 %
4545% %
4546% %
4547% %
4548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4549%
4550% MagickGetImageGravity() gets the image gravity.
4551%
4552% The format of the MagickGetImageGravity method is:
4553%
4554% GravityType MagickGetImageGravity(MagickWand *wand)
4555%
4556% A description of each parameter follows:
4557%
4558% o wand: the magick wand.
4559%
4560*/
4561WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4562{
4563 assert(wand != (MagickWand *) NULL);
4564 assert(wand->signature == WandSignature);
4565 if (wand->debug != MagickFalse)
4566 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4567 if (wand->images == (Image *) NULL)
4568 {
4569 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4570 "ContainsNoImages","`%s'",wand->name);
4571 return(UndefinedGravity);
4572 }
4573 return(wand->images->gravity);
4574}
4575
4576/*
4577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4578% %
4579% %
4580% %
4581% 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 %
4582% %
4583% %
4584% %
4585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4586%
4587% MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4588%
4589% The format of the MagickGetImageGreenPrimary method is:
4590%
4591% MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4592% double *y)
4593%
4594% A description of each parameter follows:
4595%
4596% o wand: the magick wand.
4597%
4598% o x: the chromaticity green primary x-point.
4599%
4600% o y: the chromaticity green primary y-point.
4601%
4602*/
4603WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4604 double *x,double *y)
4605{
4606 assert(wand != (MagickWand *) NULL);
4607 assert(wand->signature == WandSignature);
4608 if (wand->debug != MagickFalse)
4609 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4610 if (wand->images == (Image *) NULL)
4611 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4612 *x=wand->images->chromaticity.green_primary.x;
4613 *y=wand->images->chromaticity.green_primary.y;
4614 return(MagickTrue);
4615}
4616
4617/*
4618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4619% %
4620% %
4621% %
4622% M a g i c k G e t I m a g e H e i g h t %
4623% %
4624% %
4625% %
4626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4627%
4628% MagickGetImageHeight() returns the image height.
4629%
4630% The format of the MagickGetImageHeight method is:
4631%
cristybb503372010-05-27 20:51:26 +00004632% size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004633%
4634% A description of each parameter follows:
4635%
4636% o wand: the magick wand.
4637%
4638*/
cristybb503372010-05-27 20:51:26 +00004639WandExport size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004640{
4641 assert(wand != (MagickWand *) NULL);
4642 assert(wand->signature == WandSignature);
4643 if (wand->debug != MagickFalse)
4644 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4645 if (wand->images == (Image *) NULL)
4646 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4647 return(wand->images->rows);
4648}
4649
4650/*
4651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4652% %
4653% %
4654% %
4655% M a g i c k G e t I m a g e H i s t o g r a m %
4656% %
4657% %
4658% %
4659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4660%
4661% MagickGetImageHistogram() returns the image histogram as an array of
4662% PixelWand wands.
4663%
4664% The format of the MagickGetImageHistogram method is:
4665%
4666% PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004667% size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00004668%
4669% A description of each parameter follows:
4670%
4671% o wand: the magick wand.
4672%
4673% o number_colors: the number of unique colors in the image and the number
4674% of pixel wands returned.
4675%
4676*/
4677WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004678 size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00004679{
cristy4c08aed2011-07-01 19:47:50 +00004680 PixelPacket
cristy3ed852e2009-09-05 21:47:34 +00004681 *histogram;
4682
4683 PixelWand
4684 **pixel_wands;
4685
cristybb503372010-05-27 20:51:26 +00004686 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +00004687 i;
4688
4689 assert(wand != (MagickWand *) NULL);
4690 assert(wand->signature == WandSignature);
4691 if (wand->debug != MagickFalse)
4692 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4693 if (wand->images == (Image *) NULL)
4694 {
4695 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4696 "ContainsNoImages","`%s'",wand->name);
4697 return((PixelWand **) NULL);
4698 }
4699 histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
cristy4c08aed2011-07-01 19:47:50 +00004700 if (histogram == (PixelPacket *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00004701 return((PixelWand **) NULL);
4702 pixel_wands=NewPixelWands(*number_colors);
cristybb503372010-05-27 20:51:26 +00004703 for (i=0; i < (ssize_t) *number_colors; i++)
cristy3ed852e2009-09-05 21:47:34 +00004704 {
cristy4c08aed2011-07-01 19:47:50 +00004705 PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
cristybb503372010-05-27 20:51:26 +00004706 PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
cristy3ed852e2009-09-05 21:47:34 +00004707 }
cristy4c08aed2011-07-01 19:47:50 +00004708 histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
cristy3ed852e2009-09-05 21:47:34 +00004709 return(pixel_wands);
4710}
4711
4712/*
4713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4714% %
4715% %
4716% %
4717% 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 %
4718% %
4719% %
4720% %
4721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4722%
4723% MagickGetImageInterlaceScheme() gets the image interlace scheme.
4724%
4725% The format of the MagickGetImageInterlaceScheme method is:
4726%
4727% InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4728%
4729% A description of each parameter follows:
4730%
4731% o wand: the magick wand.
4732%
4733*/
4734WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4735{
4736 assert(wand != (MagickWand *) NULL);
4737 assert(wand->signature == WandSignature);
4738 if (wand->debug != MagickFalse)
4739 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4740 if (wand->images == (Image *) NULL)
4741 {
4742 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4743 "ContainsNoImages","`%s'",wand->name);
4744 return(UndefinedInterlace);
4745 }
4746 return(wand->images->interlace);
4747}
4748
4749/*
4750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4751% %
4752% %
4753% %
4754% 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 %
4755% %
4756% %
4757% %
4758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4759%
4760% MagickGetImageInterpolateMethod() returns the interpolation method for the
4761% sepcified image.
4762%
4763% The format of the MagickGetImageInterpolateMethod method is:
4764%
4765% InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
4766%
4767% A description of each parameter follows:
4768%
4769% o wand: the magick wand.
4770%
4771*/
4772WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
4773 MagickWand *wand)
4774{
4775 assert(wand != (MagickWand *) NULL);
4776 assert(wand->signature == WandSignature);
4777 if (wand->debug != MagickFalse)
4778 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4779 if (wand->images == (Image *) NULL)
4780 {
4781 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4782 "ContainsNoImages","`%s'",wand->name);
4783 return(UndefinedInterpolatePixel);
4784 }
4785 return(wand->images->interpolate);
4786}
4787
4788/*
4789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4790% %
4791% %
4792% %
4793% M a g i c k G e t I m a g e I t e r a t i o n s %
4794% %
4795% %
4796% %
4797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4798%
4799% MagickGetImageIterations() gets the image iterations.
4800%
4801% The format of the MagickGetImageIterations method is:
4802%
cristybb503372010-05-27 20:51:26 +00004803% size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004804%
4805% A description of each parameter follows:
4806%
4807% o wand: the magick wand.
4808%
4809*/
cristybb503372010-05-27 20:51:26 +00004810WandExport size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004811{
4812 assert(wand != (MagickWand *) NULL);
4813 assert(wand->signature == WandSignature);
4814 if (wand->debug != MagickFalse)
4815 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4816 if (wand->images == (Image *) NULL)
4817 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4818 return(wand->images->iterations);
4819}
4820
4821/*
4822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4823% %
4824% %
4825% %
4826% M a g i c k G e t I m a g e L e n g t h %
4827% %
4828% %
4829% %
4830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4831%
4832% MagickGetImageLength() returns the image length in bytes.
4833%
4834% The format of the MagickGetImageLength method is:
4835%
4836% MagickBooleanType MagickGetImageLength(MagickWand *wand,
4837% MagickSizeType *length)
4838%
4839% A description of each parameter follows:
4840%
4841% o wand: the magick wand.
4842%
4843% o length: the image length in bytes.
4844%
4845*/
4846WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4847 MagickSizeType *length)
4848{
4849 assert(wand != (MagickWand *) NULL);
4850 assert(wand->signature == WandSignature);
4851 if (wand->debug != MagickFalse)
4852 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4853 if (wand->images == (Image *) NULL)
4854 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4855 *length=GetBlobSize(wand->images);
4856 return(MagickTrue);
4857}
4858
4859/*
4860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4861% %
4862% %
4863% %
4864% M a g i c k G e t I m a g e M a t t e C o l o r %
4865% %
4866% %
4867% %
4868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4869%
4870% MagickGetImageMatteColor() returns the image matte color.
4871%
4872% The format of the MagickGetImageMatteColor method is:
4873%
4874% MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4875% PixelWand *matte_color)
4876%
4877% A description of each parameter follows:
4878%
4879% o wand: the magick wand.
4880%
4881% o matte_color: Return the matte color.
4882%
4883*/
4884WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4885 PixelWand *matte_color)
4886{
4887 assert(wand != (MagickWand *) NULL);
4888 assert(wand->signature == WandSignature);
4889 if (wand->debug != MagickFalse)
4890 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4891 if (wand->images == (Image *) NULL)
4892 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00004893 PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
cristy3ed852e2009-09-05 21:47:34 +00004894 return(MagickTrue);
4895}
4896
4897/*
4898%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4899% %
4900% %
4901% %
4902% 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 %
4903% %
4904% %
4905% %
4906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4907%
4908% MagickGetImageOrientation() returns the image orientation.
4909%
4910% The format of the MagickGetImageOrientation method is:
4911%
4912% OrientationType MagickGetImageOrientation(MagickWand *wand)
4913%
4914% A description of each parameter follows:
4915%
4916% o wand: the magick wand.
4917%
4918*/
4919WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4920{
4921 assert(wand != (MagickWand *) NULL);
4922 assert(wand->signature == WandSignature);
4923 if (wand->debug != MagickFalse)
4924 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4925 if (wand->images == (Image *) NULL)
4926 {
4927 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4928 "ContainsNoImages","`%s'",wand->name);
4929 return(UndefinedOrientation);
4930 }
4931 return(wand->images->orientation);
4932}
4933
4934/*
4935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4936% %
4937% %
4938% %
4939% M a g i c k G e t I m a g e P a g e %
4940% %
4941% %
4942% %
4943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4944%
4945% MagickGetImagePage() returns the page geometry associated with the image.
4946%
4947% The format of the MagickGetImagePage method is:
4948%
4949% MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004950% size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00004951%
4952% A description of each parameter follows:
4953%
4954% o wand: the magick wand.
4955%
4956% o width: the page width.
4957%
4958% o height: the page height.
4959%
4960% o x: the page x-offset.
4961%
4962% o y: the page y-offset.
4963%
4964*/
4965WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004966 size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00004967{
4968 assert(wand != (const MagickWand *) NULL);
4969 assert(wand->signature == WandSignature);
4970 if (wand->debug != MagickFalse)
4971 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4972 if (wand->images == (Image *) NULL)
4973 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4974 *width=wand->images->page.width;
4975 *height=wand->images->page.height;
4976 *x=wand->images->page.x;
4977 *y=wand->images->page.y;
4978 return(MagickTrue);
4979}
4980
4981/*
4982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4983% %
4984% %
4985% %
4986% M a g i c k G e t I m a g e P i x e l C o l o r %
4987% %
4988% %
4989% %
4990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4991%
4992% MagickGetImagePixelColor() returns the color of the specified pixel.
4993%
4994% The format of the MagickGetImagePixelColor method is:
4995%
4996% MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004997% const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004998%
4999% A description of each parameter follows:
5000%
5001% o wand: the magick wand.
5002%
5003% o x,y: the pixel offset into the image.
5004%
5005% o color: Return the colormap color in this wand.
5006%
5007*/
5008WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005009 const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005010{
cristy4c08aed2011-07-01 19:47:50 +00005011 register const Quantum
cristy3ed852e2009-09-05 21:47:34 +00005012 *p;
5013
5014 CacheView
5015 *image_view;
5016
5017 assert(wand != (MagickWand *) NULL);
5018 assert(wand->signature == WandSignature);
5019 if (wand->debug != MagickFalse)
5020 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5021 if (wand->images == (Image *) NULL)
5022 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5023 image_view=AcquireCacheView(wand->images);
5024 p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
cristy4c08aed2011-07-01 19:47:50 +00005025 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00005026 {
5027 image_view=DestroyCacheView(image_view);
5028 return(MagickFalse);
5029 }
cristy4c08aed2011-07-01 19:47:50 +00005030 PixelSetQuantumPixel(wand->images,p,color);
cristy3ed852e2009-09-05 21:47:34 +00005031 image_view=DestroyCacheView(image_view);
5032 return(MagickTrue);
5033}
5034
5035/*
5036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5037% %
5038% %
5039% %
cristy3ed852e2009-09-05 21:47:34 +00005040% M a g i c k G e t I m a g e R e d P r i m a r y %
5041% %
5042% %
5043% %
5044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5045%
5046% MagickGetImageRedPrimary() returns the chromaticy red primary point.
5047%
5048% The format of the MagickGetImageRedPrimary method is:
5049%
5050% MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5051% double *y)
5052%
5053% A description of each parameter follows:
5054%
5055% o wand: the magick wand.
5056%
5057% o x: the chromaticity red primary x-point.
5058%
5059% o y: the chromaticity red primary y-point.
5060%
5061*/
5062WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5063 double *x,double *y)
5064{
5065 assert(wand != (MagickWand *) NULL);
5066 assert(wand->signature == WandSignature);
5067 if (wand->debug != MagickFalse)
5068 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5069 if (wand->images == (Image *) NULL)
5070 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5071 *x=wand->images->chromaticity.red_primary.x;
5072 *y=wand->images->chromaticity.red_primary.y;
5073 return(MagickTrue);
5074}
5075
5076/*
5077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5078% %
5079% %
5080% %
5081% M a g i c k G e t I m a g e R e g i o n %
5082% %
5083% %
5084% %
5085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5086%
5087% MagickGetImageRegion() extracts a region of the image and returns it as a
5088% a new wand.
5089%
5090% The format of the MagickGetImageRegion method is:
5091%
5092% MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005093% const size_t width,const size_t height,const ssize_t x,
5094% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005095%
5096% A description of each parameter follows:
5097%
5098% o wand: the magick wand.
5099%
5100% o width: the region width.
5101%
5102% o height: the region height.
5103%
5104% o x: the region x offset.
5105%
5106% o y: the region y offset.
5107%
5108*/
5109WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005110 const size_t width,const size_t height,const ssize_t x,
5111 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005112{
5113 Image
5114 *region_image;
5115
5116 RectangleInfo
5117 region;
5118
5119 assert(wand != (MagickWand *) NULL);
5120 assert(wand->signature == WandSignature);
5121 if (wand->debug != MagickFalse)
5122 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5123 if (wand->images == (Image *) NULL)
5124 return((MagickWand *) NULL);
5125 region.width=width;
5126 region.height=height;
5127 region.x=x;
5128 region.y=y;
5129 region_image=CropImage(wand->images,&region,wand->exception);
5130 if (region_image == (Image *) NULL)
5131 return((MagickWand *) NULL);
5132 return(CloneMagickWandFromImages(wand,region_image));
5133}
5134
5135/*
5136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5137% %
5138% %
5139% %
5140% 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 %
5141% %
5142% %
5143% %
5144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5145%
5146% MagickGetImageRenderingIntent() gets the image rendering intent.
5147%
5148% The format of the MagickGetImageRenderingIntent method is:
5149%
5150% RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5151%
5152% A description of each parameter follows:
5153%
5154% o wand: the magick wand.
5155%
5156*/
5157WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5158{
5159 assert(wand != (MagickWand *) NULL);
5160 assert(wand->signature == WandSignature);
5161 if (wand->debug != MagickFalse)
5162 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5163 if (wand->images == (Image *) NULL)
5164 {
5165 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5166 "ContainsNoImages","`%s'",wand->name);
5167 return(UndefinedIntent);
5168 }
5169 return((RenderingIntent) wand->images->rendering_intent);
5170}
5171
5172/*
5173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5174% %
5175% %
5176% %
5177% M a g i c k G e t I m a g e R e s o l u t i o n %
5178% %
5179% %
5180% %
5181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5182%
5183% MagickGetImageResolution() gets the image X and Y resolution.
5184%
5185% The format of the MagickGetImageResolution method is:
5186%
5187% MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5188% double *y)
5189%
5190% A description of each parameter follows:
5191%
5192% o wand: the magick wand.
5193%
5194% o x: the image x-resolution.
5195%
5196% o y: the image y-resolution.
5197%
5198*/
5199WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5200 double *x,double *y)
5201{
5202 assert(wand != (MagickWand *) NULL);
5203 assert(wand->signature == WandSignature);
5204 if (wand->debug != MagickFalse)
5205 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5206 if (wand->images == (Image *) NULL)
5207 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5208 *x=wand->images->x_resolution;
5209 *y=wand->images->y_resolution;
5210 return(MagickTrue);
5211}
5212
5213/*
5214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5215% %
5216% %
5217% %
5218% M a g i c k G e t I m a g e S c e n e %
5219% %
5220% %
5221% %
5222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5223%
5224% MagickGetImageScene() gets the image scene.
5225%
5226% The format of the MagickGetImageScene method is:
5227%
cristybb503372010-05-27 20:51:26 +00005228% size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005229%
5230% A description of each parameter follows:
5231%
5232% o wand: the magick wand.
5233%
5234*/
cristybb503372010-05-27 20:51:26 +00005235WandExport size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005236{
5237 assert(wand != (MagickWand *) NULL);
5238 assert(wand->signature == WandSignature);
5239 if (wand->debug != MagickFalse)
5240 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5241 if (wand->images == (Image *) NULL)
5242 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5243 return(wand->images->scene);
5244}
5245
5246/*
5247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5248% %
5249% %
5250% %
5251% M a g i c k G e t I m a g e S i g n a t u r e %
5252% %
5253% %
5254% %
5255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5256%
5257% MagickGetImageSignature() generates an SHA-256 message digest for the image
5258% pixel stream.
5259%
5260% The format of the MagickGetImageSignature method is:
5261%
5262% const char MagickGetImageSignature(MagickWand *wand)
5263%
5264% A description of each parameter follows:
5265%
5266% o wand: the magick wand.
5267%
5268*/
5269WandExport char *MagickGetImageSignature(MagickWand *wand)
5270{
5271 const char
5272 *value;
5273
5274 MagickBooleanType
5275 status;
5276
5277 assert(wand != (MagickWand *) NULL);
5278 assert(wand->signature == WandSignature);
5279 if (wand->debug != MagickFalse)
5280 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5281 if (wand->images == (Image *) NULL)
5282 {
5283 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5284 "ContainsNoImages","`%s'",wand->name);
5285 return((char *) NULL);
5286 }
5287 status=SignatureImage(wand->images);
5288 if (status == MagickFalse)
5289 InheritException(wand->exception,&wand->images->exception);
5290 value=GetImageProperty(wand->images,"signature");
5291 if (value != (const char *) NULL)
5292 return(AcquireString(value));
5293 InheritException(wand->exception,&wand->images->exception);
5294 return((char *) NULL);
5295}
5296
5297/*
5298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5299% %
5300% %
5301% %
5302% 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 %
5303% %
5304% %
5305% %
5306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5307%
5308% MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5309%
5310% The format of the MagickGetImageTicksPerSecond method is:
5311%
cristybb503372010-05-27 20:51:26 +00005312% size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005313%
5314% A description of each parameter follows:
5315%
5316% o wand: the magick wand.
5317%
5318*/
cristybb503372010-05-27 20:51:26 +00005319WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005320{
5321 assert(wand != (MagickWand *) NULL);
5322 assert(wand->signature == WandSignature);
5323 if (wand->debug != MagickFalse)
5324 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5325 if (wand->images == (Image *) NULL)
5326 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristybb503372010-05-27 20:51:26 +00005327 return((size_t) wand->images->ticks_per_second);
cristy3ed852e2009-09-05 21:47:34 +00005328}
5329
5330/*
5331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5332% %
5333% %
5334% %
5335% M a g i c k G e t I m a g e T y p e %
5336% %
5337% %
5338% %
5339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5340%
5341% MagickGetImageType() gets the potential image type:
5342%
5343% Bilevel Grayscale GrayscaleMatte
5344% Palette PaletteMatte TrueColor
5345% TrueColorMatte ColorSeparation ColorSeparationMatte
5346%
5347% To ensure the image type matches its potential, use MagickSetImageType():
5348%
5349% (void) MagickSetImageType(wand,MagickGetImageType(wand));
5350%
5351% The format of the MagickGetImageType method is:
5352%
5353% ImageType MagickGetImageType(MagickWand *wand)
5354%
5355% A description of each parameter follows:
5356%
5357% o wand: the magick wand.
5358%
5359*/
5360WandExport ImageType MagickGetImageType(MagickWand *wand)
5361{
5362 assert(wand != (MagickWand *) NULL);
5363 assert(wand->signature == WandSignature);
5364 if (wand->debug != MagickFalse)
5365 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5366 if (wand->images == (Image *) NULL)
5367 {
5368 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5369 "ContainsNoImages","`%s'",wand->name);
cristy5f1c1ff2010-12-23 21:38:06 +00005370 return(UndefinedType);
cristy3ed852e2009-09-05 21:47:34 +00005371 }
5372 return(GetImageType(wand->images,wand->exception));
5373}
5374
5375/*
5376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5377% %
5378% %
5379% %
5380% M a g i c k G e t I m a g e U n i t s %
5381% %
5382% %
5383% %
5384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5385%
5386% MagickGetImageUnits() gets the image units of resolution.
5387%
5388% The format of the MagickGetImageUnits method is:
5389%
5390% ResolutionType MagickGetImageUnits(MagickWand *wand)
5391%
5392% A description of each parameter follows:
5393%
5394% o wand: the magick wand.
5395%
5396*/
5397WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5398{
5399 assert(wand != (MagickWand *) NULL);
5400 assert(wand->signature == WandSignature);
5401 if (wand->debug != MagickFalse)
5402 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5403 if (wand->images == (Image *) NULL)
5404 {
5405 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5406 "ContainsNoImages","`%s'",wand->name);
5407 return(UndefinedResolution);
5408 }
5409 return(wand->images->units);
5410}
5411
5412/*
5413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5414% %
5415% %
5416% %
5417% 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 %
5418% %
5419% %
5420% %
5421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5422%
5423% MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5424% sepcified image.
5425%
5426% The format of the MagickGetImageVirtualPixelMethod method is:
5427%
5428% VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5429%
5430% A description of each parameter follows:
5431%
5432% o wand: the magick wand.
5433%
5434*/
5435WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5436{
5437 assert(wand != (MagickWand *) NULL);
5438 assert(wand->signature == WandSignature);
5439 if (wand->debug != MagickFalse)
5440 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5441 if (wand->images == (Image *) NULL)
5442 {
5443 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5444 "ContainsNoImages","`%s'",wand->name);
5445 return(UndefinedVirtualPixelMethod);
5446 }
5447 return(GetImageVirtualPixelMethod(wand->images));
5448}
5449
5450/*
5451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5452% %
5453% %
5454% %
5455% M a g i c k G e t I m a g e W h i t e P o i n t %
5456% %
5457% %
5458% %
5459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5460%
5461% MagickGetImageWhitePoint() returns the chromaticy white point.
5462%
5463% The format of the MagickGetImageWhitePoint method is:
5464%
5465% MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5466% double *y)
5467%
5468% A description of each parameter follows:
5469%
5470% o wand: the magick wand.
5471%
5472% o x: the chromaticity white x-point.
5473%
5474% o y: the chromaticity white y-point.
5475%
5476*/
5477WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5478 double *x,double *y)
5479{
5480 assert(wand != (MagickWand *) NULL);
5481 assert(wand->signature == WandSignature);
5482 if (wand->debug != MagickFalse)
5483 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5484 if (wand->images == (Image *) NULL)
5485 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5486 *x=wand->images->chromaticity.white_point.x;
5487 *y=wand->images->chromaticity.white_point.y;
5488 return(MagickTrue);
5489}
5490
5491/*
5492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5493% %
5494% %
5495% %
5496% M a g i c k G e t I m a g e W i d t h %
5497% %
5498% %
5499% %
5500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5501%
5502% MagickGetImageWidth() returns the image width.
5503%
5504% The format of the MagickGetImageWidth method is:
5505%
cristybb503372010-05-27 20:51:26 +00005506% size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005507%
5508% A description of each parameter follows:
5509%
5510% o wand: the magick wand.
5511%
5512*/
cristybb503372010-05-27 20:51:26 +00005513WandExport size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005514{
5515 assert(wand != (MagickWand *) NULL);
5516 assert(wand->signature == WandSignature);
5517 if (wand->debug != MagickFalse)
5518 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5519 if (wand->images == (Image *) NULL)
5520 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5521 return(wand->images->columns);
5522}
5523
5524/*
5525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5526% %
5527% %
5528% %
5529% M a g i c k G e t N u m b e r I m a g e s %
5530% %
5531% %
5532% %
5533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5534%
5535% MagickGetNumberImages() returns the number of images associated with a
5536% magick wand.
5537%
5538% The format of the MagickGetNumberImages method is:
5539%
cristybb503372010-05-27 20:51:26 +00005540% size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005541%
5542% A description of each parameter follows:
5543%
5544% o wand: the magick wand.
5545%
5546*/
cristybb503372010-05-27 20:51:26 +00005547WandExport size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005548{
5549 assert(wand != (MagickWand *) NULL);
5550 assert(wand->signature == WandSignature);
5551 if (wand->debug != MagickFalse)
5552 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5553 return(GetImageListLength(wand->images));
5554}
5555
5556/*
5557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5558% %
5559% %
5560% %
5561% 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 %
5562% %
5563% %
5564% %
5565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5566%
5567% MagickGetImageTotalInkDensity() gets the image total ink density.
5568%
5569% The format of the MagickGetImageTotalInkDensity method is:
5570%
5571% double MagickGetImageTotalInkDensity(MagickWand *wand)
5572%
5573% A description of each parameter follows:
5574%
5575% o wand: the magick wand.
5576%
5577*/
5578WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5579{
5580 assert(wand != (MagickWand *) NULL);
5581 assert(wand->signature == WandSignature);
5582 if (wand->debug != MagickFalse)
5583 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5584 if (wand->images == (Image *) NULL)
5585 {
5586 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5587 "ContainsNoImages","`%s'",wand->name);
5588 return(0.0);
5589 }
5590 return(GetImageTotalInkDensity(wand->images));
5591}
5592
5593/*
5594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5595% %
5596% %
5597% %
5598% M a g i c k H a l d C l u t I m a g e %
5599% %
5600% %
5601% %
5602%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5603%
5604% MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5605% table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
5606% dimensions. Create it with the HALD coder. You can apply any color
5607% transformation to the Hald image and then use this method to apply the
5608% transform to the image.
5609%
5610% The format of the MagickHaldClutImage method is:
5611%
5612% MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5613% const MagickWand *hald_wand)
cristy3ed852e2009-09-05 21:47:34 +00005614%
5615% A description of each parameter follows:
5616%
5617% o wand: the magick wand.
5618%
5619% o hald_image: the hald CLUT image.
5620%
5621*/
cristy3ed852e2009-09-05 21:47:34 +00005622WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5623 const MagickWand *hald_wand)
5624{
5625 MagickBooleanType
5626 status;
5627
cristy3ed852e2009-09-05 21:47:34 +00005628 assert(wand != (MagickWand *) NULL);
5629 assert(wand->signature == WandSignature);
5630 if (wand->debug != MagickFalse)
5631 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5632 if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5633 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf89cb1d2011-07-07 01:24:37 +00005634 status=HaldClutImage(wand->images,hald_wand->images);
cristy3ed852e2009-09-05 21:47:34 +00005635 if (status == MagickFalse)
5636 InheritException(wand->exception,&wand->images->exception);
5637 return(status);
5638}
5639
5640/*
5641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5642% %
5643% %
5644% %
5645% M a g i c k H a s N e x t I m a g e %
5646% %
5647% %
5648% %
5649%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5650%
5651% MagickHasNextImage() returns MagickTrue if the wand has more images when
5652% traversing the list in the forward direction
5653%
5654% The format of the MagickHasNextImage method is:
5655%
5656% MagickBooleanType MagickHasNextImage(MagickWand *wand)
5657%
5658% A description of each parameter follows:
5659%
5660% o wand: the magick wand.
5661%
5662*/
5663WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5664{
5665 assert(wand != (MagickWand *) NULL);
5666 assert(wand->signature == WandSignature);
5667 if (wand->debug != MagickFalse)
5668 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5669 if (wand->images == (Image *) NULL)
5670 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5671 if (GetNextImageInList(wand->images) == (Image *) NULL)
5672 return(MagickFalse);
5673 return(MagickTrue);
5674}
5675
5676/*
5677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5678% %
5679% %
5680% %
5681% M a g i c k H a s P r e v i o u s I m a g e %
5682% %
5683% %
5684% %
5685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5686%
5687% MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5688% traversing the list in the reverse direction
5689%
5690% The format of the MagickHasPreviousImage method is:
5691%
5692% MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5693%
5694% A description of each parameter follows:
5695%
5696% o wand: the magick wand.
5697%
5698*/
5699WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5700{
5701 assert(wand != (MagickWand *) NULL);
5702 assert(wand->signature == WandSignature);
5703 if (wand->debug != MagickFalse)
5704 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5705 if (wand->images == (Image *) NULL)
5706 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5707 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5708 return(MagickFalse);
5709 return(MagickTrue);
5710}
5711
5712/*
5713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5714% %
5715% %
5716% %
5717% M a g i c k I d e n t i f y I m a g e %
5718% %
5719% %
5720% %
5721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5722%
5723% MagickIdentifyImage() identifies an image by printing its attributes to the
5724% file. Attributes include the image width, height, size, and others.
5725%
5726% The format of the MagickIdentifyImage method is:
5727%
5728% const char *MagickIdentifyImage(MagickWand *wand)
5729%
5730% A description of each parameter follows:
5731%
5732% o wand: the magick wand.
5733%
5734*/
5735WandExport char *MagickIdentifyImage(MagickWand *wand)
5736{
5737 char
5738 *description,
5739 filename[MaxTextExtent];
5740
5741 FILE
5742 *file;
5743
5744 int
5745 unique_file;
5746
5747 assert(wand != (MagickWand *) NULL);
5748 assert(wand->signature == WandSignature);
5749 if (wand->debug != MagickFalse)
5750 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5751 if (wand->images == (Image *) NULL)
5752 {
5753 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5754 "ContainsNoImages","`%s'",wand->name);
5755 return((char *) NULL);
5756 }
5757 description=(char *) NULL;
5758 unique_file=AcquireUniqueFileResource(filename);
5759 file=(FILE *) NULL;
5760 if (unique_file != -1)
5761 file=fdopen(unique_file,"wb");
5762 if ((unique_file == -1) || (file == (FILE *) NULL))
5763 {
5764 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5765 "UnableToCreateTemporaryFile","`%s'",wand->name);
5766 return((char *) NULL);
5767 }
5768 (void) IdentifyImage(wand->images,file,MagickTrue);
5769 (void) fclose(file);
5770 description=FileToString(filename,~0,wand->exception);
5771 (void) RelinquishUniqueFileResource(filename);
5772 return(description);
5773}
5774
5775/*
5776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5777% %
5778% %
5779% %
5780% M a g i c k I m p l o d e I m a g e %
5781% %
5782% %
5783% %
5784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5785%
5786% MagickImplodeImage() creates a new image that is a copy of an existing
5787% one with the image pixels "implode" by the specified percentage. It
5788% allocates the memory necessary for the new Image structure and returns a
5789% pointer to the new image.
5790%
5791% The format of the MagickImplodeImage method is:
5792%
5793% MagickBooleanType MagickImplodeImage(MagickWand *wand,
5794% const double radius)
5795%
5796% A description of each parameter follows:
5797%
5798% o wand: the magick wand.
5799%
5800% o amount: Define the extent of the implosion.
5801%
5802*/
5803WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5804 const double amount)
5805{
5806 Image
5807 *implode_image;
5808
5809 assert(wand != (MagickWand *) NULL);
5810 assert(wand->signature == WandSignature);
5811 if (wand->debug != MagickFalse)
5812 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5813 if (wand->images == (Image *) NULL)
5814 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5815 implode_image=ImplodeImage(wand->images,amount,wand->exception);
5816 if (implode_image == (Image *) NULL)
5817 return(MagickFalse);
5818 ReplaceImageInList(&wand->images,implode_image);
5819 return(MagickTrue);
5820}
5821
5822/*
5823%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824% %
5825% %
5826% %
5827% M a g i c k I m p o r t I m a g e P i x e l s %
5828% %
5829% %
5830% %
5831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5832%
5833% MagickImportImagePixels() accepts pixel datand stores it in the image at the
5834% location you specify. The method returns MagickFalse on success otherwise
5835% MagickTrue if an error is encountered. The pixel data can be either char,
cristybb503372010-05-27 20:51:26 +00005836% short int, int, ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00005837%
5838% Suppose your want to upload the first scanline of a 640x480 image from
5839% character data in red-green-blue order:
5840%
5841% MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5842%
5843% The format of the MagickImportImagePixels method is:
5844%
5845% MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005846% const ssize_t x,const ssize_t y,const size_t columns,
5847% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00005848% const void *pixels)
5849%
5850% A description of each parameter follows:
5851%
5852% o wand: the magick wand.
5853%
5854% o x, y, columns, rows: These values define the perimeter of a region
5855% of pixels you want to define.
5856%
5857% o map: This string reflects the expected ordering of the pixel array.
5858% It can be any combination or order of R = red, G = green, B = blue,
5859% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5860% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5861% P = pad.
5862%
5863% o storage: Define the data type of the pixels. Float and double types are
5864% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
5865% these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5866% or DoublePixel.
5867%
5868% o pixels: This array of values contain the pixel components as defined by
5869% map and type. You must preallocate this array where the expected
5870% length varies depending on the values of width, height, map, and type.
5871%
5872*/
5873WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005874 const ssize_t x,const ssize_t y,const size_t columns,
5875 const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00005876 const void *pixels)
5877{
5878 MagickBooleanType
5879 status;
5880
5881 assert(wand != (MagickWand *) NULL);
5882 assert(wand->signature == WandSignature);
5883 if (wand->debug != MagickFalse)
5884 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5885 if (wand->images == (Image *) NULL)
5886 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5887 status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
5888 if (status == MagickFalse)
5889 InheritException(wand->exception,&wand->images->exception);
5890 return(status);
5891}
5892
5893/*
5894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5895% %
5896% %
5897% %
5898% 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 %
5899% %
5900% %
5901% %
5902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5903%
5904% MagickInverseFourierTransformImage() implements the inverse discrete
5905% Fourier transform (DFT) of the image either as a magnitude / phase or real /
5906% imaginary image pair.
5907%
5908% The format of the MagickInverseFourierTransformImage method is:
5909%
5910% MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00005911% MagickWand *magnitude_wand,MagickWand *phase_wand,
5912% const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00005913%
5914% A description of each parameter follows:
5915%
cristyc9550792009-11-13 20:05:42 +00005916% o magnitude_wand: the magnitude or real wand.
5917%
5918% o phase_wand: the phase or imaginary wand.
cristy3ed852e2009-09-05 21:47:34 +00005919%
5920% o magnitude: if true, return as magnitude / phase pair otherwise a real /
5921% imaginary image pair.
5922%
5923*/
5924WandExport MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00005925 MagickWand *magnitude_wand,MagickWand *phase_wand,
5926 const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00005927{
5928 Image
5929 *inverse_image;
5930
cristyc9550792009-11-13 20:05:42 +00005931 MagickWand
5932 *wand;
5933
5934 assert(magnitude_wand != (MagickWand *) NULL);
5935 assert(magnitude_wand->signature == WandSignature);
5936 if (magnitude_wand->debug != MagickFalse)
5937 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5938 magnitude_wand->name);
5939 wand=magnitude_wand;
5940 if (magnitude_wand->images == (Image *) NULL)
5941 ThrowWandException(WandError,"ContainsNoImages",
5942 magnitude_wand->name);
5943 assert(phase_wand != (MagickWand *) NULL);
5944 assert(phase_wand->signature == WandSignature);
5945 inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5946 phase_wand->images,magnitude,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005947 if (inverse_image == (Image *) NULL)
5948 return(MagickFalse);
5949 ReplaceImageInList(&wand->images,inverse_image);
5950 return(MagickTrue);
5951}
5952
5953/*
5954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5955% %
5956% %
5957% %
5958% M a g i c k L a b e l I m a g e %
5959% %
5960% %
5961% %
5962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5963%
5964% MagickLabelImage() adds a label to your image.
5965%
5966% The format of the MagickLabelImage method is:
5967%
5968% MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5969%
5970% A description of each parameter follows:
5971%
5972% o wand: the magick wand.
5973%
5974% o label: the image label.
5975%
5976*/
5977WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
5978 const char *label)
5979{
5980 MagickBooleanType
5981 status;
5982
5983 assert(wand != (MagickWand *) NULL);
5984 assert(wand->signature == WandSignature);
5985 if (wand->debug != MagickFalse)
5986 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5987 if (wand->images == (Image *) NULL)
5988 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5989 status=SetImageProperty(wand->images,"label",label);
5990 if (status == MagickFalse)
5991 InheritException(wand->exception,&wand->images->exception);
5992 return(status);
5993}
5994
5995/*
5996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5997% %
5998% %
5999% %
6000% M a g i c k L e v e l I m a g e %
6001% %
6002% %
6003% %
6004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6005%
6006% MagickLevelImage() adjusts the levels of an image by scaling the colors
6007% falling between specified white and black points to the full available
6008% quantum range. The parameters provided represent the black, mid, and white
6009% points. The black point specifies the darkest color in the image. Colors
6010% darker than the black point are set to zero. Mid point specifies a gamma
6011% correction to apply to the image. White point specifies the lightest color
6012% in the image. Colors brighter than the white point are set to the maximum
6013% quantum value.
6014%
6015% The format of the MagickLevelImage method is:
6016%
6017% MagickBooleanType MagickLevelImage(MagickWand *wand,
6018% const double black_point,const double gamma,const double white_point)
cristyf89cb1d2011-07-07 01:24:37 +00006019% MagickBooleanType MagickLevelImage(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00006020% const ChannelType channel,const double black_point,const double gamma,
6021% const double white_point)
6022%
6023% A description of each parameter follows:
6024%
6025% o wand: the magick wand.
6026%
6027% o channel: Identify which channel to level: RedChannel, GreenChannel,
6028%
6029% o black_point: the black point.
6030%
6031% o gamma: the gamma.
6032%
6033% o white_point: the white point.
6034%
6035*/
cristy3ed852e2009-09-05 21:47:34 +00006036WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6037 const double black_point,const double gamma,const double white_point)
6038{
6039 MagickBooleanType
6040 status;
6041
cristy3ed852e2009-09-05 21:47:34 +00006042 assert(wand != (MagickWand *) NULL);
6043 assert(wand->signature == WandSignature);
6044 if (wand->debug != MagickFalse)
6045 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6046 if (wand->images == (Image *) NULL)
6047 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy01e9afd2011-08-10 17:38:41 +00006048 status=LevelImage(wand->images,black_point,white_point,gamma,
6049 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00006050 return(status);
6051}
6052
6053/*
6054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6055% %
6056% %
6057% %
6058% M a g i c k L i n e a r S t r e t c h I m a g e %
6059% %
6060% %
6061% %
6062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6063%
6064% MagickLinearStretchImage() stretches with saturation the image intensity.
6065%
6066% You can also reduce the influence of a particular channel with a gamma
6067% value of 0.
6068%
6069% The format of the MagickLinearStretchImage method is:
6070%
6071% MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6072% const double black_point,const double white_point)
6073%
6074% A description of each parameter follows:
6075%
6076% o wand: the magick wand.
6077%
6078% o black_point: the black point.
6079%
6080% o white_point: the white point.
6081%
6082*/
6083WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6084 const double black_point,const double white_point)
6085{
6086 MagickBooleanType
6087 status;
6088
6089 assert(wand != (MagickWand *) NULL);
6090 assert(wand->signature == WandSignature);
6091 if (wand->debug != MagickFalse)
6092 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6093 if (wand->images == (Image *) NULL)
6094 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6095 status=LinearStretchImage(wand->images,black_point,white_point);
6096 if (status == MagickFalse)
6097 InheritException(wand->exception,&wand->images->exception);
6098 return(status);
6099}
6100
6101/*
6102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6103% %
6104% %
6105% %
6106% M a g i c k L i q u i d R e s c a l e I m a g e %
6107% %
6108% %
6109% %
6110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6111%
6112% MagickLiquidRescaleImage() rescales image with seam carving.
6113%
6114% MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006115% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006116% const double delta_x,const double rigidity)
6117%
6118% A description of each parameter follows:
6119%
6120% o wand: the magick wand.
6121%
6122% o columns: the number of columns in the scaled image.
6123%
6124% o rows: the number of rows in the scaled image.
6125%
6126% o delta_x: maximum seam transversal step (0 means straight seams).
6127%
6128% o rigidity: introduce a bias for non-straight seams (typically 0).
6129%
6130*/
6131WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006132 const size_t columns,const size_t rows,const double delta_x,
cristy3ed852e2009-09-05 21:47:34 +00006133 const double rigidity)
6134{
6135 Image
6136 *rescale_image;
6137
6138 assert(wand != (MagickWand *) NULL);
6139 assert(wand->signature == WandSignature);
6140 if (wand->debug != MagickFalse)
6141 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6142 if (wand->images == (Image *) NULL)
6143 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6144 rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6145 rigidity,wand->exception);
6146 if (rescale_image == (Image *) NULL)
6147 return(MagickFalse);
6148 ReplaceImageInList(&wand->images,rescale_image);
6149 return(MagickTrue);
6150}
6151
6152/*
6153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6154% %
6155% %
6156% %
6157% M a g i c k M a g n i f y I m a g e %
6158% %
6159% %
6160% %
6161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6162%
6163% MagickMagnifyImage() is a convenience method that scales an image
6164% proportionally to twice its original size.
6165%
6166% The format of the MagickMagnifyImage method is:
6167%
6168% MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6169%
6170% A description of each parameter follows:
6171%
6172% o wand: the magick wand.
6173%
6174*/
6175WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6176{
6177 Image
6178 *magnify_image;
6179
6180 assert(wand != (MagickWand *) NULL);
6181 assert(wand->signature == WandSignature);
6182 if (wand->debug != MagickFalse)
6183 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6184 if (wand->images == (Image *) NULL)
6185 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6186 magnify_image=MagnifyImage(wand->images,wand->exception);
6187 if (magnify_image == (Image *) NULL)
6188 return(MagickFalse);
6189 ReplaceImageInList(&wand->images,magnify_image);
6190 return(MagickTrue);
6191}
6192
6193/*
6194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6195% %
6196% %
6197% %
cristy3ed852e2009-09-05 21:47:34 +00006198% M a g i c k M e r g e I m a g e L a y e r s %
6199% %
6200% %
6201% %
6202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6203%
cristy733678d2011-03-18 21:29:28 +00006204% MagickMergeImageLayers() composes all the image layers from the current
6205% given image onward to produce a single image of the merged layers.
cristy3ed852e2009-09-05 21:47:34 +00006206%
6207% The inital canvas's size depends on the given ImageLayerMethod, and is
6208% initialized using the first images background color. The images
6209% are then compositied onto that image in sequence using the given
6210% composition that has been assigned to each individual image.
6211%
6212% The format of the MagickMergeImageLayers method is:
6213%
6214% MagickWand *MagickMergeImageLayers(MagickWand *wand,
6215% const ImageLayerMethod method)
6216%
6217% A description of each parameter follows:
6218%
6219% o wand: the magick wand.
6220%
6221% o method: the method of selecting the size of the initial canvas.
6222%
6223% MergeLayer: Merge all layers onto a canvas just large enough
6224% to hold all the actual images. The virtual canvas of the
6225% first image is preserved but otherwise ignored.
6226%
6227% FlattenLayer: Use the virtual canvas size of first image.
6228% Images which fall outside this canvas is clipped.
6229% This can be used to 'fill out' a given virtual canvas.
6230%
6231% MosaicLayer: Start with the virtual canvas of the first image,
6232% enlarging left and right edges to contain all images.
6233% Images with negative offsets will be clipped.
6234%
6235*/
6236WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6237 const ImageLayerMethod method)
6238{
6239 Image
6240 *mosaic_image;
6241
6242 assert(wand != (MagickWand *) NULL);
6243 assert(wand->signature == WandSignature);
6244 if (wand->debug != MagickFalse)
6245 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6246 if (wand->images == (Image *) NULL)
6247 return((MagickWand *) NULL);
6248 mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6249 if (mosaic_image == (Image *) NULL)
6250 return((MagickWand *) NULL);
6251 return(CloneMagickWandFromImages(wand,mosaic_image));
6252}
6253
6254/*
6255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6256% %
6257% %
6258% %
6259% M a g i c k M i n i f y I m a g e %
6260% %
6261% %
6262% %
6263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6264%
6265% MagickMinifyImage() is a convenience method that scales an image
6266% proportionally to one-half its original size
6267%
6268% The format of the MagickMinifyImage method is:
6269%
6270% MagickBooleanType MagickMinifyImage(MagickWand *wand)
6271%
6272% A description of each parameter follows:
6273%
6274% o wand: the magick wand.
6275%
6276*/
6277WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6278{
6279 Image
6280 *minify_image;
6281
6282 assert(wand != (MagickWand *) NULL);
6283 assert(wand->signature == WandSignature);
6284 if (wand->debug != MagickFalse)
6285 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6286 if (wand->images == (Image *) NULL)
6287 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6288 minify_image=MinifyImage(wand->images,wand->exception);
6289 if (minify_image == (Image *) NULL)
6290 return(MagickFalse);
6291 ReplaceImageInList(&wand->images,minify_image);
6292 return(MagickTrue);
6293}
6294
6295/*
6296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6297% %
6298% %
6299% %
6300% M a g i c k M o d u l a t e I m a g e %
6301% %
6302% %
6303% %
6304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6305%
6306% MagickModulateImage() lets you control the brightness, saturation, and hue
6307% of an image. Hue is the percentage of absolute rotation from the current
6308% position. For example 50 results in a counter-clockwise rotation of 90
6309% degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6310% both resulting in a rotation of 180 degrees.
6311%
6312% To increase the color brightness by 20% and decrease the color saturation by
6313% 10% and leave the hue unchanged, use: 120,90,100.
6314%
6315% The format of the MagickModulateImage method is:
6316%
6317% MagickBooleanType MagickModulateImage(MagickWand *wand,
6318% const double brightness,const double saturation,const double hue)
6319%
6320% A description of each parameter follows:
6321%
6322% o wand: the magick wand.
6323%
6324% o brightness: the percent change in brighness.
6325%
6326% o saturation: the percent change in saturation.
6327%
6328% o hue: the percent change in hue.
6329%
6330*/
6331WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6332 const double brightness,const double saturation,const double hue)
6333{
6334 char
6335 modulate[MaxTextExtent];
6336
6337 MagickBooleanType
6338 status;
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 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +00006346 (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
cristy8cd5b312010-01-07 01:10:24 +00006347 brightness,saturation,hue);
cristy3ed852e2009-09-05 21:47:34 +00006348 status=ModulateImage(wand->images,modulate);
6349 if (status == MagickFalse)
6350 InheritException(wand->exception,&wand->images->exception);
6351 return(status);
6352}
6353
6354/*
6355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6356% %
6357% %
6358% %
6359% M a g i c k M o n t a g e I m a g e %
6360% %
6361% %
6362% %
6363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6364%
6365% MagickMontageImage() creates a composite image by combining several
6366% separate images. The images are tiled on the composite image with the name
6367% of the image optionally appearing just below the individual tile.
6368%
6369% The format of the MagickMontageImage method is:
6370%
6371% MagickWand *MagickMontageImage(MagickWand *wand,
6372% const DrawingWand drawing_wand,const char *tile_geometry,
6373% const char *thumbnail_geometry,const MontageMode mode,
6374% const char *frame)
6375%
6376% A description of each parameter follows:
6377%
6378% o wand: the magick wand.
6379%
6380% o drawing_wand: the drawing wand. The font name, size, and color are
6381% obtained from this wand.
6382%
6383% o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6384%
6385% o thumbnail_geometry: Preferred image size and border size of each
6386% thumbnail (e.g. 120x120+4+3>).
6387%
6388% o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6389%
6390% o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6391% The frame color is that of the thumbnail's matte color.
6392%
6393*/
6394WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6395 const DrawingWand *drawing_wand,const char *tile_geometry,
6396 const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6397{
6398 char
6399 *font;
6400
6401 Image
6402 *montage_image;
6403
6404 MontageInfo
6405 *montage_info;
6406
6407 PixelWand
6408 *pixel_wand;
6409
6410 assert(wand != (MagickWand *) NULL);
6411 assert(wand->signature == WandSignature);
6412 if (wand->debug != MagickFalse)
6413 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6414 if (wand->images == (Image *) NULL)
6415 return((MagickWand *) NULL);
6416 montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6417 switch (mode)
6418 {
6419 case FrameMode:
6420 {
6421 (void) CloneString(&montage_info->frame,"15x15+3+3");
6422 montage_info->shadow=MagickTrue;
6423 break;
6424 }
6425 case UnframeMode:
6426 {
6427 montage_info->frame=(char *) NULL;
6428 montage_info->shadow=MagickFalse;
6429 montage_info->border_width=0;
6430 break;
6431 }
6432 case ConcatenateMode:
6433 {
6434 montage_info->frame=(char *) NULL;
6435 montage_info->shadow=MagickFalse;
6436 (void) CloneString(&montage_info->geometry,"+0+0");
6437 montage_info->border_width=0;
6438 break;
6439 }
6440 default:
6441 break;
6442 }
6443 font=DrawGetFont(drawing_wand);
6444 if (font != (char *) NULL)
6445 (void) CloneString(&montage_info->font,font);
6446 if (frame != (char *) NULL)
6447 (void) CloneString(&montage_info->frame,frame);
6448 montage_info->pointsize=DrawGetFontSize(drawing_wand);
6449 pixel_wand=NewPixelWand();
6450 DrawGetFillColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006451 PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
cristy3ed852e2009-09-05 21:47:34 +00006452 DrawGetStrokeColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006453 PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
cristy3ed852e2009-09-05 21:47:34 +00006454 pixel_wand=DestroyPixelWand(pixel_wand);
6455 if (thumbnail_geometry != (char *) NULL)
6456 (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6457 if (tile_geometry != (char *) NULL)
6458 (void) CloneString(&montage_info->tile,tile_geometry);
6459 montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6460 wand->exception);
6461 montage_info=DestroyMontageInfo(montage_info);
6462 if (montage_image == (Image *) NULL)
6463 return((MagickWand *) NULL);
6464 return(CloneMagickWandFromImages(wand,montage_image));
6465}
6466
6467/*
6468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6469% %
6470% %
6471% %
6472% M a g i c k M o r p h I m a g e s %
6473% %
6474% %
6475% %
6476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6477%
6478% MagickMorphImages() method morphs a set of images. Both the image pixels
6479% and size are linearly interpolated to give the appearance of a
6480% meta-morphosis from one image to the next.
6481%
6482% The format of the MagickMorphImages method is:
6483%
6484% MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006485% const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006486%
6487% A description of each parameter follows:
6488%
6489% o wand: the magick wand.
6490%
6491% o number_frames: the number of in-between images to generate.
6492%
6493*/
6494WandExport MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006495 const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006496{
6497 Image
6498 *morph_image;
6499
6500 assert(wand != (MagickWand *) NULL);
6501 assert(wand->signature == WandSignature);
6502 if (wand->debug != MagickFalse)
6503 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6504 if (wand->images == (Image *) NULL)
6505 return((MagickWand *) NULL);
6506 morph_image=MorphImages(wand->images,number_frames,wand->exception);
6507 if (morph_image == (Image *) NULL)
6508 return((MagickWand *) NULL);
6509 return(CloneMagickWandFromImages(wand,morph_image));
6510}
6511
6512/*
6513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6514% %
6515% %
6516% %
cristya0b81c32010-01-22 02:54:33 +00006517% M a g i c k M o r p h o l o g y I m a g e %
6518% %
6519% %
6520% %
6521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6522%
6523% MagickMorphologyImage() applies a user supplied kernel to the image
6524% according to the given mophology method.
6525%
6526% The format of the MagickMorphologyImage method is:
6527%
6528% MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006529% MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006530%
6531% A description of each parameter follows:
6532%
6533% o wand: the magick wand.
6534%
cristya0b81c32010-01-22 02:54:33 +00006535% o method: the morphology method to be applied.
6536%
6537% o iterations: apply the operation this many times (or no change).
6538% A value of -1 means loop until no change found. How this is applied
6539% may depend on the morphology method. Typically this is a value of 1.
6540%
6541% o kernel: An array of doubles representing the morphology kernel.
6542%
6543*/
cristya0b81c32010-01-22 02:54:33 +00006544WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006545 MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006546{
cristya0b81c32010-01-22 02:54:33 +00006547 Image
6548 *morphology_image;
6549
6550 assert(wand != (MagickWand *) NULL);
6551 assert(wand->signature == WandSignature);
6552 if (wand->debug != MagickFalse)
6553 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6554 if (kernel == (const KernelInfo *) NULL)
6555 return(MagickFalse);
6556 if (wand->images == (Image *) NULL)
6557 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00006558 morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6559 wand->exception);
cristya0b81c32010-01-22 02:54:33 +00006560 if (morphology_image == (Image *) NULL)
6561 return(MagickFalse);
6562 ReplaceImageInList(&wand->images,morphology_image);
6563 return(MagickTrue);
6564}
6565
6566/*
6567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6568% %
6569% %
6570% %
cristy3ed852e2009-09-05 21:47:34 +00006571% M a g i c k M o t i o n B l u r I m a g e %
6572% %
6573% %
6574% %
6575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6576%
6577% MagickMotionBlurImage() simulates motion blur. We convolve the image with a
6578% Gaussian operator of the given radius and standard deviation (sigma).
6579% For reasonable results, radius should be larger than sigma. Use a
6580% radius of 0 and MotionBlurImage() selects a suitable radius for you.
6581% Angle gives the angle of the blurring motion.
6582%
6583% The format of the MagickMotionBlurImage method is:
6584%
6585% MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6586% const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +00006587%
6588% A description of each parameter follows:
6589%
6590% o wand: the magick wand.
6591%
cristy3ed852e2009-09-05 21:47:34 +00006592% o radius: the radius of the Gaussian, in pixels, not counting
6593% the center pixel.
6594%
6595% o sigma: the standard deviation of the Gaussian, in pixels.
6596%
cristycee97112010-05-28 00:44:52 +00006597% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00006598%
6599*/
cristy3ed852e2009-09-05 21:47:34 +00006600WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6601 const double radius,const double sigma,const double angle)
6602{
cristy3ed852e2009-09-05 21:47:34 +00006603 Image
6604 *blur_image;
6605
6606 assert(wand != (MagickWand *) NULL);
6607 assert(wand->signature == WandSignature);
6608 if (wand->debug != MagickFalse)
6609 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6610 if (wand->images == (Image *) NULL)
6611 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00006612 blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006613 if (blur_image == (Image *) NULL)
6614 return(MagickFalse);
6615 ReplaceImageInList(&wand->images,blur_image);
6616 return(MagickTrue);
6617}
6618
6619/*
6620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6621% %
6622% %
6623% %
6624% M a g i c k N e g a t e I m a g e %
6625% %
6626% %
6627% %
6628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6629%
6630% MagickNegateImage() negates the colors in the reference image. The
6631% Grayscale option means that only grayscale values within the image are
6632% negated.
6633%
6634% You can also reduce the influence of a particular channel with a gamma
6635% value of 0.
6636%
6637% The format of the MagickNegateImage method is:
6638%
6639% MagickBooleanType MagickNegateImage(MagickWand *wand,
6640% const MagickBooleanType gray)
cristy3ed852e2009-09-05 21:47:34 +00006641%
6642% A description of each parameter follows:
6643%
6644% o wand: the magick wand.
6645%
cristy3ed852e2009-09-05 21:47:34 +00006646% o gray: If MagickTrue, only negate grayscale pixels within the image.
6647%
6648*/
cristy3ed852e2009-09-05 21:47:34 +00006649WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6650 const MagickBooleanType gray)
6651{
6652 MagickBooleanType
6653 status;
6654
cristy3ed852e2009-09-05 21:47:34 +00006655 assert(wand != (MagickWand *) NULL);
6656 assert(wand->signature == WandSignature);
6657 if (wand->debug != MagickFalse)
6658 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6659 if (wand->images == (Image *) NULL)
6660 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00006661 status=NegateImage(wand->images,gray,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006662 return(status);
6663}
6664
6665/*
6666%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6667% %
6668% %
6669% %
6670% M a g i c k N e w I m a g e %
6671% %
6672% %
6673% %
6674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6675%
6676% MagickNewImage() adds a blank image canvas of the specified size and
6677% background color to the wand.
6678%
6679% The format of the MagickNewImage method is:
6680%
6681% MagickBooleanType MagickNewImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006682% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006683% const PixelWand *background)
6684%
6685% A description of each parameter follows:
6686%
6687% o wand: the magick wand.
6688%
6689% o width: the image width.
6690%
6691% o height: the image height.
6692%
6693% o background: the image color.
6694%
6695*/
6696WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006697 const size_t width,const size_t height,
cristy3ed852e2009-09-05 21:47:34 +00006698 const PixelWand *background)
6699{
6700 Image
6701 *images;
6702
cristy4c08aed2011-07-01 19:47:50 +00006703 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00006704 pixel;
6705
6706 assert(wand != (MagickWand *) NULL);
6707 assert(wand->signature == WandSignature);
6708 if (wand->debug != MagickFalse)
6709 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6710 PixelGetMagickColor(background,&pixel);
6711 images=NewMagickImage(wand->image_info,width,height,&pixel);
6712 if (images == (Image *) NULL)
6713 return(MagickFalse);
6714 if (images->exception.severity != UndefinedException)
6715 InheritException(wand->exception,&images->exception);
6716 return(InsertImageInWand(wand,images));
6717}
6718
6719/*
6720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6721% %
6722% %
6723% %
6724% M a g i c k N e x t I m a g e %
6725% %
6726% %
6727% %
6728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6729%
6730% MagickNextImage() associates the next image in the image list with a magick
6731% wand.
6732%
6733% The format of the MagickNextImage method is:
6734%
6735% MagickBooleanType MagickNextImage(MagickWand *wand)
6736%
6737% A description of each parameter follows:
6738%
6739% o wand: the magick wand.
6740%
6741*/
6742WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6743{
6744 assert(wand != (MagickWand *) NULL);
6745 assert(wand->signature == WandSignature);
6746 if (wand->debug != MagickFalse)
6747 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6748 if (wand->images == (Image *) NULL)
6749 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6750 if (wand->pend != MagickFalse)
6751 {
6752 wand->pend=MagickFalse;
6753 return(MagickTrue);
6754 }
6755 if (GetNextImageInList(wand->images) == (Image *) NULL)
6756 {
6757 wand->pend=MagickTrue;
6758 return(MagickFalse);
6759 }
6760 wand->images=GetNextImageInList(wand->images);
6761 return(MagickTrue);
6762}
6763
6764/*
6765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6766% %
6767% %
6768% %
6769% M a g i c k N o r m a l i z e I m a g e %
6770% %
6771% %
6772% %
6773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6774%
6775% MagickNormalizeImage() enhances the contrast of a color image by adjusting
6776% the pixels color to span the entire range of colors available
6777%
6778% You can also reduce the influence of a particular channel with a gamma
6779% value of 0.
6780%
6781% The format of the MagickNormalizeImage method is:
6782%
6783% MagickBooleanType MagickNormalizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00006784%
6785% A description of each parameter follows:
6786%
6787% o wand: the magick wand.
6788%
cristy3ed852e2009-09-05 21:47:34 +00006789*/
cristy3ed852e2009-09-05 21:47:34 +00006790WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6791{
6792 MagickBooleanType
6793 status;
6794
cristy3ed852e2009-09-05 21:47:34 +00006795 assert(wand != (MagickWand *) NULL);
6796 assert(wand->signature == WandSignature);
6797 if (wand->debug != MagickFalse)
6798 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6799 if (wand->images == (Image *) NULL)
6800 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00006801 status=NormalizeImage(wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00006802 return(status);
6803}
6804
6805/*
6806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6807% %
6808% %
6809% %
6810% M a g i c k O i l P a i n t I m a g e %
6811% %
6812% %
6813% %
6814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6815%
6816% MagickOilPaintImage() applies a special effect filter that simulates an oil
6817% painting. Each pixel is replaced by the most frequent color occurring
6818% in a circular region defined by radius.
6819%
6820% The format of the MagickOilPaintImage method is:
6821%
6822% MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6823% const double radius)
6824%
6825% A description of each parameter follows:
6826%
6827% o wand: the magick wand.
6828%
6829% o radius: the radius of the circular neighborhood.
6830%
6831*/
6832WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6833 const double radius)
6834{
6835 Image
6836 *paint_image;
6837
6838 assert(wand != (MagickWand *) NULL);
6839 assert(wand->signature == WandSignature);
6840 if (wand->debug != MagickFalse)
6841 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6842 if (wand->images == (Image *) NULL)
6843 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6844 paint_image=OilPaintImage(wand->images,radius,wand->exception);
6845 if (paint_image == (Image *) NULL)
6846 return(MagickFalse);
6847 ReplaceImageInList(&wand->images,paint_image);
6848 return(MagickTrue);
6849}
6850
6851/*
6852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6853% %
6854% %
6855% %
6856% M a g i c k O p a q u e P a i n t I m a g e %
6857% %
6858% %
6859% %
6860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6861%
6862% MagickOpaquePaintImage() changes any pixel that matches color with the color
6863% defined by fill.
6864%
6865% The format of the MagickOpaquePaintImage method is:
6866%
6867% MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6868% const PixelWand *target,const PixelWand *fill,const double fuzz,
6869% const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00006870%
6871% A description of each parameter follows:
6872%
6873% o wand: the magick wand.
6874%
cristy3ed852e2009-09-05 21:47:34 +00006875% o target: Change this target color to the fill color within the image.
6876%
6877% o fill: the fill pixel wand.
6878%
6879% o fuzz: By default target must match a particular pixel color
6880% exactly. However, in many cases two colors may differ by a small amount.
6881% The fuzz member of image defines how much tolerance is acceptable to
6882% consider two colors as the same. For example, set fuzz to 10 and the
6883% color red at intensities of 100 and 102 respectively are now interpreted
6884% as the same color for the purposes of the floodfill.
6885%
6886% o invert: paint any pixel that does not match the target color.
6887%
6888*/
cristy3ed852e2009-09-05 21:47:34 +00006889WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6890 const PixelWand *target,const PixelWand *fill,const double fuzz,
6891 const MagickBooleanType invert)
6892{
6893 MagickBooleanType
6894 status;
6895
cristy4c08aed2011-07-01 19:47:50 +00006896 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00006897 fill_pixel,
6898 target_pixel;
6899
6900 assert(wand != (MagickWand *) NULL);
6901 assert(wand->signature == WandSignature);
6902 if (wand->debug != MagickFalse)
6903 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6904 if (wand->images == (Image *) NULL)
6905 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6906 PixelGetMagickColor(target,&target_pixel);
6907 PixelGetMagickColor(fill,&fill_pixel);
6908 wand->images->fuzz=fuzz;
cristyd42d9952011-07-08 14:21:50 +00006909 status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert);
cristy3ed852e2009-09-05 21:47:34 +00006910 if (status == MagickFalse)
6911 InheritException(wand->exception,&wand->images->exception);
6912 return(status);
6913}
6914
6915/*
6916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6917% %
6918% %
6919% %
6920% 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 %
6921% %
6922% %
6923% %
6924%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6925%
6926% MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6927% previous image in the sequence. From this it attempts to select the
6928% smallest cropped image to replace each frame, while preserving the results
6929% of the animation.
6930%
6931% The format of the MagickOptimizeImageLayers method is:
6932%
6933% MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6934%
6935% A description of each parameter follows:
6936%
6937% o wand: the magick wand.
6938%
6939*/
6940WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6941{
6942 Image
6943 *optimize_image;
6944
6945 assert(wand != (MagickWand *) NULL);
6946 assert(wand->signature == WandSignature);
6947 if (wand->debug != MagickFalse)
6948 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6949 if (wand->images == (Image *) NULL)
6950 return((MagickWand *) NULL);
6951 optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6952 if (optimize_image == (Image *) NULL)
6953 return((MagickWand *) NULL);
6954 return(CloneMagickWandFromImages(wand,optimize_image));
6955}
6956
6957/*
6958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6959% %
6960% %
6961% %
6962% 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 %
6963% %
6964% %
6965% %
6966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6967%
6968% MagickOrderedPosterizeImage() performs an ordered dither based on a number
6969% of pre-defined dithering threshold maps, but over multiple intensity levels,
6970% which can be different for different channels, according to the input
6971% arguments.
6972%
6973% The format of the MagickOrderedPosterizeImage method is:
6974%
6975% MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6976% const char *threshold_map)
cristy3ed852e2009-09-05 21:47:34 +00006977%
6978% A description of each parameter follows:
6979%
6980% o image: the image.
6981%
cristy3ed852e2009-09-05 21:47:34 +00006982% o threshold_map: A string containing the name of the threshold dither
6983% map to use, followed by zero or more numbers representing the number of
6984% color levels tho dither between.
6985%
glennrpf0a92fd2011-04-27 13:17:21 +00006986% Any level number less than 2 is equivalent to 2, and means only binary
cristy3ed852e2009-09-05 21:47:34 +00006987% dithering will be applied to each color channel.
6988%
6989% No numbers also means a 2 level (bitmap) dither will be applied to all
6990% channels, while a single number is the number of levels applied to each
6991% channel in sequence. More numbers will be applied in turn to each of
6992% the color channels.
6993%
6994% For example: "o3x3,6" generates a 6 level posterization of the image
6995% with a ordered 3x3 diffused pixel dither being applied between each
6996% level. While checker,8,8,4 will produce a 332 colormaped image with
6997% only a single checkerboard hash pattern (50% grey) between each color
6998% level, to basically double the number of color levels with a bare
6999% minimim of dithering.
7000%
7001*/
cristy3ed852e2009-09-05 21:47:34 +00007002WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7003 const char *threshold_map)
7004{
7005 MagickBooleanType
7006 status;
7007
cristy3ed852e2009-09-05 21:47:34 +00007008 assert(wand != (MagickWand *) NULL);
7009 assert(wand->signature == WandSignature);
7010 if (wand->debug != MagickFalse)
7011 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7012 if (wand->images == (Image *) NULL)
7013 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy13020672011-07-08 02:33:26 +00007014 status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007015 return(status);
7016}
7017
7018/*
7019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7020% %
7021% %
7022% %
7023% M a g i c k P i n g I m a g e %
7024% %
7025% %
7026% %
7027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7028%
7029% MagickPingImage() is like MagickReadImage() except the only valid
7030% information returned is the image width, height, size, and format. It
7031% is designed to efficiently obtain this information from a file without
7032% reading the entire image sequence into memory.
7033%
7034% The format of the MagickPingImage method is:
7035%
7036% MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7037%
7038% A description of each parameter follows:
7039%
7040% o wand: the magick wand.
7041%
7042% o filename: the image filename.
7043%
7044*/
7045WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7046 const char *filename)
7047{
7048 Image
7049 *images;
7050
7051 ImageInfo
7052 *ping_info;
7053
7054 assert(wand != (MagickWand *) NULL);
7055 assert(wand->signature == WandSignature);
7056 if (wand->debug != MagickFalse)
7057 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7058 ping_info=CloneImageInfo(wand->image_info);
7059 if (filename != (const char *) NULL)
7060 (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7061 images=PingImage(ping_info,wand->exception);
7062 ping_info=DestroyImageInfo(ping_info);
7063 if (images == (Image *) NULL)
7064 return(MagickFalse);
7065 return(InsertImageInWand(wand,images));
7066}
7067
7068/*
7069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7070% %
7071% %
7072% %
7073% M a g i c k P i n g I m a g e B l o b %
7074% %
7075% %
7076% %
7077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7078%
7079% MagickPingImageBlob() pings an image or image sequence from a blob.
7080%
7081% The format of the MagickPingImageBlob method is:
7082%
7083% MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7084% const void *blob,const size_t length)
7085%
7086% A description of each parameter follows:
7087%
7088% o wand: the magick wand.
7089%
7090% o blob: the blob.
7091%
7092% o length: the blob length.
7093%
7094*/
7095WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7096 const void *blob,const size_t length)
7097{
7098 Image
7099 *images;
7100
7101 ImageInfo
7102 *read_info;
7103
7104 assert(wand != (MagickWand *) NULL);
7105 assert(wand->signature == WandSignature);
7106 if (wand->debug != MagickFalse)
7107 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7108 read_info=CloneImageInfo(wand->image_info);
7109 SetImageInfoBlob(read_info,blob,length);
7110 images=PingImage(read_info,wand->exception);
7111 read_info=DestroyImageInfo(read_info);
7112 if (images == (Image *) NULL)
7113 return(MagickFalse);
7114 return(InsertImageInWand(wand,images));
7115}
7116
7117/*
7118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7119% %
7120% %
7121% %
7122% M a g i c k P i n g I m a g e F i l e %
7123% %
7124% %
7125% %
7126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7127%
7128% MagickPingImageFile() pings an image or image sequence from an open file
7129% descriptor.
7130%
7131% The format of the MagickPingImageFile method is:
7132%
7133% MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7134%
7135% A description of each parameter follows:
7136%
7137% o wand: the magick wand.
7138%
7139% o file: the file descriptor.
7140%
7141*/
7142WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7143{
7144 Image
7145 *images;
7146
7147 ImageInfo
7148 *read_info;
7149
7150 assert(wand != (MagickWand *) NULL);
7151 assert(wand->signature == WandSignature);
7152 assert(file != (FILE *) NULL);
7153 if (wand->debug != MagickFalse)
7154 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7155 read_info=CloneImageInfo(wand->image_info);
7156 SetImageInfoFile(read_info,file);
7157 images=PingImage(read_info,wand->exception);
7158 read_info=DestroyImageInfo(read_info);
7159 if (images == (Image *) NULL)
7160 return(MagickFalse);
7161 return(InsertImageInWand(wand,images));
7162}
7163
7164/*
7165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7166% %
7167% %
7168% %
7169% M a g i c k P o l a r o i d I m a g e %
7170% %
7171% %
7172% %
7173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7174%
7175% MagickPolaroidImage() simulates a Polaroid picture.
7176%
7177% The format of the MagickPolaroidImage method is:
7178%
7179% MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7180% const DrawingWand *drawing_wand,const double angle)
7181%
7182% A description of each parameter follows:
7183%
7184% o wand: the magick wand.
7185%
7186% o drawing_wand: the draw wand.
7187%
cristycee97112010-05-28 00:44:52 +00007188% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00007189%
7190*/
7191WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7192 const DrawingWand *drawing_wand,const double angle)
7193{
7194 DrawInfo
7195 *draw_info;
7196
7197 Image
7198 *polaroid_image;
7199
7200 assert(wand != (MagickWand *) NULL);
7201 assert(wand->signature == WandSignature);
7202 if (wand->debug != MagickFalse)
7203 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7204 if (wand->images == (Image *) NULL)
7205 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7206 draw_info=PeekDrawingWand(drawing_wand);
7207 if (draw_info == (DrawInfo *) NULL)
7208 return(MagickFalse);
7209 polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7210 if (polaroid_image == (Image *) NULL)
7211 return(MagickFalse);
7212 ReplaceImageInList(&wand->images,polaroid_image);
7213 return(MagickTrue);
7214}
7215
7216/*
7217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7218% %
7219% %
7220% %
7221% M a g i c k P o s t e r i z e I m a g e %
7222% %
7223% %
7224% %
7225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7226%
7227% MagickPosterizeImage() reduces the image to a limited number of color level.
7228%
7229% The format of the MagickPosterizeImage method is:
7230%
7231% MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7232% const unsigned levels,const MagickBooleanType dither)
7233%
7234% A description of each parameter follows:
7235%
7236% o wand: the magick wand.
7237%
7238% o levels: Number of color levels allowed in each channel. Very low values
7239% (2, 3, or 4) have the most visible effect.
7240%
7241% o dither: Set this integer value to something other than zero to dither
7242% the mapped image.
7243%
7244*/
7245WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007246 const size_t levels,const MagickBooleanType dither)
cristy3ed852e2009-09-05 21:47:34 +00007247{
7248 MagickBooleanType
7249 status;
7250
7251 assert(wand != (MagickWand *) NULL);
7252 assert(wand->signature == WandSignature);
7253 if (wand->debug != MagickFalse)
7254 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7255 if (wand->images == (Image *) NULL)
7256 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7257 status=PosterizeImage(wand->images,levels,dither);
7258 if (status == MagickFalse)
7259 InheritException(wand->exception,&wand->images->exception);
7260 return(status);
7261}
7262
7263/*
7264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7265% %
7266% %
7267% %
7268% M a g i c k P r e v i e w I m a g e s %
7269% %
7270% %
7271% %
7272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7273%
7274% MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7275% image processing operation applied at varying strengths. This helpful
7276% to quickly pin-point an appropriate parameter for an image processing
7277% operation.
7278%
7279% The format of the MagickPreviewImages method is:
7280%
7281% MagickWand *MagickPreviewImages(MagickWand *wand,
7282% const PreviewType preview)
7283%
7284% A description of each parameter follows:
7285%
7286% o wand: the magick wand.
7287%
7288% o preview: the preview type.
7289%
7290*/
7291WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7292 const PreviewType preview)
7293{
7294 Image
7295 *preview_image;
7296
7297 assert(wand != (MagickWand *) NULL);
7298 assert(wand->signature == WandSignature);
7299 if (wand->debug != MagickFalse)
7300 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7301 if (wand->images == (Image *) NULL)
7302 return((MagickWand *) NULL);
7303 preview_image=PreviewImage(wand->images,preview,wand->exception);
7304 if (preview_image == (Image *) NULL)
7305 return((MagickWand *) NULL);
7306 return(CloneMagickWandFromImages(wand,preview_image));
7307}
7308
7309/*
7310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7311% %
7312% %
7313% %
7314% M a g i c k P r e v i o u s I m a g e %
7315% %
7316% %
7317% %
7318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7319%
7320% MagickPreviousImage() assocates the previous image in an image list with
7321% the magick wand.
7322%
7323% The format of the MagickPreviousImage method is:
7324%
7325% MagickBooleanType MagickPreviousImage(MagickWand *wand)
7326%
7327% A description of each parameter follows:
7328%
7329% o wand: the magick wand.
7330%
7331*/
7332WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7333{
7334 assert(wand != (MagickWand *) NULL);
7335 assert(wand->signature == WandSignature);
7336 if (wand->debug != MagickFalse)
7337 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7338 if (wand->images == (Image *) NULL)
7339 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7340 if (wand->pend != MagickFalse)
7341 {
7342 wand->pend=MagickFalse;
7343 return(MagickTrue);
7344 }
7345 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7346 {
7347 wand->pend=MagickTrue;
7348 return(MagickFalse);
7349 }
7350 wand->images=GetPreviousImageInList(wand->images);
7351 return(MagickTrue);
7352}
7353
7354/*
7355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7356% %
7357% %
7358% %
7359% M a g i c k Q u a n t i z e I m a g e %
7360% %
7361% %
7362% %
7363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7364%
7365% MagickQuantizeImage() analyzes the colors within a reference image and
7366% chooses a fixed number of colors to represent the image. The goal of the
7367% algorithm is to minimize the color difference between the input and output
7368% image while minimizing the processing time.
7369%
7370% The format of the MagickQuantizeImage method is:
7371%
7372% MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007373% const size_t number_colors,const ColorspaceType colorspace,
7374% const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007375% const MagickBooleanType measure_error)
7376%
7377% A description of each parameter follows:
7378%
7379% o wand: the magick wand.
7380%
7381% o number_colors: the number of colors.
7382%
7383% o colorspace: Perform color reduction in this colorspace, typically
7384% RGBColorspace.
7385%
7386% o treedepth: Normally, this integer value is zero or one. A zero or
7387% 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
7388% reference image with the least amount of memory and the fastest
7389% computational speed. In some cases, such as an image with low color
7390% dispersion (a few number of colors), a value other than
7391% Log4(number_colors) is required. To expand the color tree completely,
7392% use a value of 8.
7393%
7394% o dither: A value other than zero distributes the difference between an
7395% original image and the corresponding color reduced image to
cristycee97112010-05-28 00:44:52 +00007396% neighboring pixels along a Hilbert curve.
cristy3ed852e2009-09-05 21:47:34 +00007397%
7398% o measure_error: A value other than zero measures the difference between
7399% the original and quantized images. This difference is the total
7400% quantization error. The error is computed by summing over all pixels
7401% in an image the distance squared in RGB space between each reference
7402% pixel value and its quantized value.
7403%
7404*/
7405WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007406 const size_t number_colors,const ColorspaceType colorspace,
7407 const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007408 const MagickBooleanType measure_error)
7409{
7410 MagickBooleanType
7411 status;
7412
7413 QuantizeInfo
7414 *quantize_info;
7415
7416 assert(wand != (MagickWand *) NULL);
7417 assert(wand->signature == WandSignature);
7418 if (wand->debug != MagickFalse)
7419 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7420 if (wand->images == (Image *) NULL)
7421 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7422 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7423 quantize_info->number_colors=number_colors;
7424 quantize_info->dither=dither;
7425 quantize_info->tree_depth=treedepth;
7426 quantize_info->colorspace=colorspace;
7427 quantize_info->measure_error=measure_error;
7428 status=QuantizeImage(quantize_info,wand->images);
7429 if (status == MagickFalse)
7430 InheritException(wand->exception,&wand->images->exception);
7431 quantize_info=DestroyQuantizeInfo(quantize_info);
7432 return(status);
7433}
7434
7435/*
7436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7437% %
7438% %
7439% %
7440% M a g i c k Q u a n t i z e I m a g e s %
7441% %
7442% %
7443% %
7444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7445%
7446% MagickQuantizeImages() analyzes the colors within a sequence of images and
7447% chooses a fixed number of colors to represent the image. The goal of the
7448% algorithm is to minimize the color difference between the input and output
7449% image while minimizing the processing time.
7450%
7451% The format of the MagickQuantizeImages method is:
7452%
7453% MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007454% const size_t number_colors,const ColorspaceType colorspace,
7455% const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007456% const MagickBooleanType measure_error)
7457%
7458% A description of each parameter follows:
7459%
7460% o wand: the magick wand.
7461%
7462% o number_colors: the number of colors.
7463%
7464% o colorspace: Perform color reduction in this colorspace, typically
7465% RGBColorspace.
7466%
7467% o treedepth: Normally, this integer value is zero or one. A zero or
7468% 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
7469% reference image with the least amount of memory and the fastest
7470% computational speed. In some cases, such as an image with low color
7471% dispersion (a few number of colors), a value other than
7472% Log4(number_colors) is required. To expand the color tree completely,
7473% use a value of 8.
7474%
7475% o dither: A value other than zero distributes the difference between an
7476% original image and the corresponding color reduced algorithm to
cristycee97112010-05-28 00:44:52 +00007477% neighboring pixels along a Hilbert curve.
cristy3ed852e2009-09-05 21:47:34 +00007478%
7479% o measure_error: A value other than zero measures the difference between
7480% the original and quantized images. This difference is the total
7481% quantization error. The error is computed by summing over all pixels
7482% in an image the distance squared in RGB space between each reference
7483% pixel value and its quantized value.
7484%
7485*/
7486WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007487 const size_t number_colors,const ColorspaceType colorspace,
7488 const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007489 const MagickBooleanType measure_error)
7490{
7491 MagickBooleanType
7492 status;
7493
7494 QuantizeInfo
7495 *quantize_info;
7496
7497 assert(wand != (MagickWand *) NULL);
7498 assert(wand->signature == WandSignature);
7499 if (wand->debug != MagickFalse)
7500 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7501 if (wand->images == (Image *) NULL)
7502 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7503 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7504 quantize_info->number_colors=number_colors;
7505 quantize_info->dither=dither;
7506 quantize_info->tree_depth=treedepth;
7507 quantize_info->colorspace=colorspace;
7508 quantize_info->measure_error=measure_error;
7509 status=QuantizeImages(quantize_info,wand->images);
7510 if (status == MagickFalse)
7511 InheritException(wand->exception,&wand->images->exception);
7512 quantize_info=DestroyQuantizeInfo(quantize_info);
7513 return(status);
7514}
7515
7516/*
7517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7518% %
7519% %
7520% %
7521% M a g i c k R a d i a l B l u r I m a g e %
7522% %
7523% %
7524% %
7525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7526%
7527% MagickRadialBlurImage() radial blurs an image.
7528%
7529% The format of the MagickRadialBlurImage method is:
7530%
7531% MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7532% const double angle)
cristy3ed852e2009-09-05 21:47:34 +00007533%
7534% A description of each parameter follows:
7535%
7536% o wand: the magick wand.
7537%
cristy3ed852e2009-09-05 21:47:34 +00007538% o angle: the angle of the blur in degrees.
7539%
7540*/
7541WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7542 const double angle)
7543{
cristy3ed852e2009-09-05 21:47:34 +00007544 Image
7545 *blur_image;
7546
7547 assert(wand != (MagickWand *) NULL);
7548 assert(wand->signature == WandSignature);
7549 if (wand->debug != MagickFalse)
7550 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7551 if (wand->images == (Image *) NULL)
7552 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00007553 blur_image=RadialBlurImage(wand->images,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007554 if (blur_image == (Image *) NULL)
7555 return(MagickFalse);
7556 ReplaceImageInList(&wand->images,blur_image);
7557 return(MagickTrue);
7558}
7559
7560/*
7561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7562% %
7563% %
7564% %
7565% M a g i c k R a i s e I m a g e %
7566% %
7567% %
7568% %
7569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7570%
7571% MagickRaiseImage() creates a simulated three-dimensional button-like effect
7572% by lightening and darkening the edges of the image. Members width and
7573% height of raise_info define the width of the vertical and horizontal
7574% edge of the effect.
7575%
7576% The format of the MagickRaiseImage method is:
7577%
7578% MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007579% const size_t width,const size_t height,const ssize_t x,
7580% const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00007581%
7582% A description of each parameter follows:
7583%
7584% o wand: the magick wand.
7585%
7586% o width,height,x,y: Define the dimensions of the area to raise.
7587%
7588% o raise: A value other than zero creates a 3-D raise effect,
7589% otherwise it has a lowered effect.
7590%
7591*/
7592WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007593 const size_t width,const size_t height,const ssize_t x,
7594 const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00007595{
7596 MagickBooleanType
7597 status;
7598
7599 RectangleInfo
7600 raise_info;
7601
7602 assert(wand != (MagickWand *) NULL);
7603 assert(wand->signature == WandSignature);
7604 if (wand->debug != MagickFalse)
7605 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7606 if (wand->images == (Image *) NULL)
7607 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7608 raise_info.width=width;
7609 raise_info.height=height;
7610 raise_info.x=x;
7611 raise_info.y=y;
7612 status=RaiseImage(wand->images,&raise_info,raise);
7613 if (status == MagickFalse)
7614 InheritException(wand->exception,&wand->images->exception);
7615 return(status);
7616}
7617
7618/*
7619%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7620% %
7621% %
7622% %
7623% 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 %
7624% %
7625% %
7626% %
7627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7628%
7629% MagickRandomThresholdImage() changes the value of individual pixels based on
7630% the intensity of each pixel compared to threshold. The result is a
7631% high-contrast, two color image.
7632%
7633% The format of the MagickRandomThresholdImage method is:
7634%
7635% MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7636% const double low,const double high)
cristy3ed852e2009-09-05 21:47:34 +00007637%
7638% A description of each parameter follows:
7639%
7640% o wand: the magick wand.
7641%
cristy3ed852e2009-09-05 21:47:34 +00007642% o low,high: Specify the high and low thresholds. These values range from
7643% 0 to QuantumRange.
7644%
7645*/
cristy3ed852e2009-09-05 21:47:34 +00007646WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7647 const double low,const double high)
7648{
cristy3ed852e2009-09-05 21:47:34 +00007649 char
7650 threshold[MaxTextExtent];
7651
7652 MagickBooleanType
7653 status;
7654
7655 assert(wand != (MagickWand *) NULL);
7656 assert(wand->signature == WandSignature);
7657 if (wand->debug != MagickFalse)
7658 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7659 if (wand->images == (Image *) NULL)
7660 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +00007661 (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
cristyf4ad9df2011-07-08 16:49:03 +00007662 status=RandomThresholdImage(wand->images,threshold,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007663 if (status == MagickFalse)
7664 InheritException(wand->exception,&wand->images->exception);
7665 return(status);
7666}
7667
7668/*
7669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7670% %
7671% %
7672% %
7673% M a g i c k R e a d I m a g e %
7674% %
7675% %
7676% %
7677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7678%
7679% MagickReadImage() reads an image or image sequence. The images are inserted
7680% at the current image pointer position. Use MagickSetFirstIterator(),
7681% MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7682% image pointer position at the beginning of the image list, the end, or
7683% anywhere in-between respectively.
7684%
7685% The format of the MagickReadImage method is:
7686%
7687% MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7688%
7689% A description of each parameter follows:
7690%
7691% o wand: the magick wand.
7692%
7693% o filename: the image filename.
7694%
7695*/
7696WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7697 const char *filename)
7698{
7699 Image
7700 *images;
7701
7702 ImageInfo
7703 *read_info;
7704
7705 assert(wand != (MagickWand *) NULL);
7706 assert(wand->signature == WandSignature);
7707 if (wand->debug != MagickFalse)
7708 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7709 read_info=CloneImageInfo(wand->image_info);
7710 if (filename != (const char *) NULL)
7711 (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7712 images=ReadImage(read_info,wand->exception);
7713 read_info=DestroyImageInfo(read_info);
7714 if (images == (Image *) NULL)
7715 return(MagickFalse);
7716 return(InsertImageInWand(wand,images));
7717}
7718
7719/*
7720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7721% %
7722% %
7723% %
7724% M a g i c k R e a d I m a g e B l o b %
7725% %
7726% %
7727% %
7728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7729%
7730% MagickReadImageBlob() reads an image or image sequence from a blob.
7731%
7732% The format of the MagickReadImageBlob method is:
7733%
7734% MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7735% const void *blob,const size_t length)
7736%
7737% A description of each parameter follows:
7738%
7739% o wand: the magick wand.
7740%
7741% o blob: the blob.
7742%
7743% o length: the blob length.
7744%
7745*/
7746WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7747 const void *blob,const size_t length)
7748{
7749 Image
7750 *images;
7751
7752 assert(wand != (MagickWand *) NULL);
7753 assert(wand->signature == WandSignature);
7754 if (wand->debug != MagickFalse)
7755 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7756 images=BlobToImage(wand->image_info,blob,length,wand->exception);
7757 if (images == (Image *) NULL)
7758 return(MagickFalse);
7759 return(InsertImageInWand(wand,images));
7760}
7761
7762/*
7763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7764% %
7765% %
7766% %
7767% M a g i c k R e a d I m a g e F i l e %
7768% %
7769% %
7770% %
7771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7772%
7773% MagickReadImageFile() reads an image or image sequence from an open file
7774% descriptor.
7775%
7776% The format of the MagickReadImageFile method is:
7777%
7778% MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7779%
7780% A description of each parameter follows:
7781%
7782% o wand: the magick wand.
7783%
7784% o file: the file descriptor.
7785%
7786*/
7787WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7788{
7789 Image
7790 *images;
7791
7792 ImageInfo
7793 *read_info;
7794
7795 assert(wand != (MagickWand *) NULL);
7796 assert(wand->signature == WandSignature);
7797 assert(file != (FILE *) NULL);
7798 if (wand->debug != MagickFalse)
7799 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7800 read_info=CloneImageInfo(wand->image_info);
7801 SetImageInfoFile(read_info,file);
7802 images=ReadImage(read_info,wand->exception);
7803 read_info=DestroyImageInfo(read_info);
7804 if (images == (Image *) NULL)
7805 return(MagickFalse);
7806 return(InsertImageInWand(wand,images));
7807}
7808
7809/*
7810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7811% %
7812% %
7813% %
cristy3ed852e2009-09-05 21:47:34 +00007814% M a g i c k R e m a p I m a g e %
7815% %
7816% %
7817% %
7818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7819%
7820% MagickRemapImage() replaces the colors of an image with the closest color
7821% from a reference image.
7822%
7823% The format of the MagickRemapImage method is:
7824%
7825% MagickBooleanType MagickRemapImage(MagickWand *wand,
7826% const MagickWand *remap_wand,const DitherMethod method)
7827%
7828% A description of each parameter follows:
7829%
7830% o wand: the magick wand.
7831%
7832% o affinity: the affinity wand.
7833%
7834% o method: choose from these dither methods: NoDitherMethod,
7835% RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7836%
7837*/
7838WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7839 const MagickWand *remap_wand,const DitherMethod method)
7840{
7841 MagickBooleanType
7842 status;
7843
7844 QuantizeInfo
7845 *quantize_info;
7846
7847 assert(wand != (MagickWand *) NULL);
7848 assert(wand->signature == WandSignature);
7849 if (wand->debug != MagickFalse)
7850 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7851 if ((wand->images == (Image *) NULL) ||
7852 (remap_wand->images == (Image *) NULL))
7853 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7854 quantize_info=AcquireQuantizeInfo(wand->image_info);
7855 quantize_info->dither_method=method;
7856 if (method == NoDitherMethod)
7857 quantize_info->dither=MagickFalse;
7858 status=RemapImage(quantize_info,wand->images,remap_wand->images);
7859 quantize_info=DestroyQuantizeInfo(quantize_info);
7860 if (status == MagickFalse)
7861 InheritException(wand->exception,&wand->images->exception);
7862 return(status);
7863}
7864
7865/*
7866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7867% %
7868% %
7869% %
7870% M a g i c k R e m o v e I m a g e %
7871% %
7872% %
7873% %
7874%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7875%
7876% MagickRemoveImage() removes an image from the image list.
7877%
7878% The format of the MagickRemoveImage method is:
7879%
7880% MagickBooleanType MagickRemoveImage(MagickWand *wand)
7881%
7882% A description of each parameter follows:
7883%
7884% o wand: the magick wand.
7885%
7886% o insert: the splice wand.
7887%
7888*/
7889WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7890{
7891 assert(wand != (MagickWand *) NULL);
7892 assert(wand->signature == WandSignature);
7893 if (wand->debug != MagickFalse)
7894 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7895 if (wand->images == (Image *) NULL)
7896 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7897 DeleteImageFromList(&wand->images);
7898 return(MagickTrue);
7899}
7900
7901/*
7902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7903% %
7904% %
7905% %
7906% M a g i c k R e s a m p l e I m a g e %
7907% %
7908% %
7909% %
7910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7911%
7912% MagickResampleImage() resample image to desired resolution.
7913%
7914% Bessel Blackman Box
7915% Catrom Cubic Gaussian
7916% Hanning Hermite Lanczos
7917% Mitchell Point Quandratic
7918% Sinc Triangle
7919%
7920% Most of the filters are FIR (finite impulse response), however, Bessel,
7921% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
7922% are windowed (brought down to zero) with the Blackman filter.
7923%
7924% The format of the MagickResampleImage method is:
7925%
7926% MagickBooleanType MagickResampleImage(MagickWand *wand,
7927% const double x_resolution,const double y_resolution,
7928% const FilterTypes filter,const double blur)
7929%
7930% A description of each parameter follows:
7931%
7932% o wand: the magick wand.
7933%
7934% o x_resolution: the new image x resolution.
7935%
7936% o y_resolution: the new image y resolution.
7937%
7938% o filter: Image filter to use.
7939%
7940% o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7941%
7942*/
7943WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7944 const double x_resolution,const double y_resolution,const FilterTypes filter,
7945 const double blur)
7946{
7947 Image
7948 *resample_image;
7949
7950 assert(wand != (MagickWand *) NULL);
7951 assert(wand->signature == WandSignature);
7952 if (wand->debug != MagickFalse)
7953 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7954 if (wand->images == (Image *) NULL)
7955 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7956 resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7957 blur,wand->exception);
7958 if (resample_image == (Image *) NULL)
7959 return(MagickFalse);
7960 ReplaceImageInList(&wand->images,resample_image);
7961 return(MagickTrue);
7962}
7963
7964/*
7965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7966% %
7967% %
7968% %
7969% M a g i c k R e s e t I m a g e P a g e %
7970% %
7971% %
7972% %
7973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7974%
7975% MagickResetImagePage() resets the Wand page canvas and position.
7976%
7977% The format of the MagickResetImagePage method is:
7978%
7979% MagickBooleanType MagickResetImagePage(MagickWand *wand,
7980% const char *page)
7981%
7982% A description of each parameter follows:
7983%
7984% o wand: the magick wand.
7985%
7986% o page: the relative page specification.
7987%
7988*/
7989WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
7990 const char *page)
7991{
7992 assert(wand != (MagickWand *) NULL);
7993 assert(wand->signature == WandSignature);
7994 if (wand->debug != MagickFalse)
7995 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7996 if (wand->images == (Image *) NULL)
7997 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7998 if ((page == (char *) NULL) || (*page == '\0'))
7999 {
8000 (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8001 return(MagickTrue);
8002 }
8003 return(ResetImagePage(wand->images,page));
8004}
8005
8006/*
8007%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8008% %
8009% %
8010% %
8011% M a g i c k R e s i z e I m a g e %
8012% %
8013% %
8014% %
8015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8016%
8017% MagickResizeImage() scales an image to the desired dimensions with one of
8018% these filters:
8019%
8020% Bessel Blackman Box
8021% Catrom Cubic Gaussian
8022% Hanning Hermite Lanczos
8023% Mitchell Point Quandratic
8024% Sinc Triangle
8025%
8026% Most of the filters are FIR (finite impulse response), however, Bessel,
8027% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8028% are windowed (brought down to zero) with the Blackman filter.
8029%
8030% The format of the MagickResizeImage method is:
8031%
8032% MagickBooleanType MagickResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008033% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00008034% const FilterTypes filter,const double blur)
8035%
8036% A description of each parameter follows:
8037%
8038% o wand: the magick wand.
8039%
8040% o columns: the number of columns in the scaled image.
8041%
8042% o rows: the number of rows in the scaled image.
8043%
8044% o filter: Image filter to use.
8045%
8046% o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8047%
8048*/
8049WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008050 const size_t columns,const size_t rows,const FilterTypes filter,
cristy3ed852e2009-09-05 21:47:34 +00008051 const double blur)
8052{
8053 Image
8054 *resize_image;
8055
8056 assert(wand != (MagickWand *) NULL);
8057 assert(wand->signature == WandSignature);
8058 if (wand->debug != MagickFalse)
8059 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8060 if (wand->images == (Image *) NULL)
8061 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8062 resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8063 wand->exception);
8064 if (resize_image == (Image *) NULL)
8065 return(MagickFalse);
8066 ReplaceImageInList(&wand->images,resize_image);
8067 return(MagickTrue);
8068}
8069
8070/*
8071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8072% %
8073% %
8074% %
8075% M a g i c k R o l l I m a g e %
8076% %
8077% %
8078% %
8079%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8080%
8081% MagickRollImage() offsets an image as defined by x and y.
8082%
8083% The format of the MagickRollImage method is:
8084%
cristybb503372010-05-27 20:51:26 +00008085% MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8086% const size_t y)
cristy3ed852e2009-09-05 21:47:34 +00008087%
8088% A description of each parameter follows:
8089%
8090% o wand: the magick wand.
8091%
8092% o x: the x offset.
8093%
8094% o y: the y offset.
8095%
8096%
8097*/
8098WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008099 const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00008100{
8101 Image
8102 *roll_image;
8103
8104 assert(wand != (MagickWand *) NULL);
8105 assert(wand->signature == WandSignature);
8106 if (wand->debug != MagickFalse)
8107 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8108 if (wand->images == (Image *) NULL)
8109 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8110 roll_image=RollImage(wand->images,x,y,wand->exception);
8111 if (roll_image == (Image *) NULL)
8112 return(MagickFalse);
8113 ReplaceImageInList(&wand->images,roll_image);
8114 return(MagickTrue);
8115}
8116
8117/*
8118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8119% %
8120% %
8121% %
8122% M a g i c k R o t a t e I m a g e %
8123% %
8124% %
8125% %
8126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8127%
8128% MagickRotateImage() rotates an image the specified number of degrees. Empty
8129% triangles left over from rotating the image are filled with the
8130% background color.
8131%
8132% The format of the MagickRotateImage method is:
8133%
8134% MagickBooleanType MagickRotateImage(MagickWand *wand,
8135% const PixelWand *background,const double degrees)
8136%
8137% A description of each parameter follows:
8138%
8139% o wand: the magick wand.
8140%
8141% o background: the background pixel wand.
8142%
8143% o degrees: the number of degrees to rotate the image.
8144%
8145%
8146*/
8147WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8148 const PixelWand *background,const double degrees)
8149{
8150 Image
8151 *rotate_image;
8152
8153 assert(wand != (MagickWand *) NULL);
8154 assert(wand->signature == WandSignature);
8155 if (wand->debug != MagickFalse)
8156 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8157 if (wand->images == (Image *) NULL)
8158 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008159 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00008160 rotate_image=RotateImage(wand->images,degrees,wand->exception);
8161 if (rotate_image == (Image *) NULL)
8162 return(MagickFalse);
8163 ReplaceImageInList(&wand->images,rotate_image);
8164 return(MagickTrue);
8165}
8166
8167/*
8168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8169% %
8170% %
8171% %
8172% M a g i c k S a m p l e I m a g e %
8173% %
8174% %
8175% %
8176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8177%
8178% MagickSampleImage() scales an image to the desired dimensions with pixel
8179% sampling. Unlike other scaling methods, this method does not introduce
8180% any additional color into the scaled image.
8181%
8182% The format of the MagickSampleImage method is:
8183%
8184% MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008185% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008186%
8187% A description of each parameter follows:
8188%
8189% o wand: the magick wand.
8190%
8191% o columns: the number of columns in the scaled image.
8192%
8193% o rows: the number of rows in the scaled image.
8194%
8195%
8196*/
8197WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008198 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008199{
8200 Image
8201 *sample_image;
8202
8203 assert(wand != (MagickWand *) NULL);
8204 assert(wand->signature == WandSignature);
8205 if (wand->debug != MagickFalse)
8206 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8207 if (wand->images == (Image *) NULL)
8208 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8209 sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8210 if (sample_image == (Image *) NULL)
8211 return(MagickFalse);
8212 ReplaceImageInList(&wand->images,sample_image);
8213 return(MagickTrue);
8214}
8215
8216/*
8217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8218% %
8219% %
8220% %
8221% M a g i c k S c a l e I m a g e %
8222% %
8223% %
8224% %
8225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8226%
8227% MagickScaleImage() scales the size of an image to the given dimensions.
8228%
8229% The format of the MagickScaleImage method is:
8230%
8231% MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008232% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008233%
8234% A description of each parameter follows:
8235%
8236% o wand: the magick wand.
8237%
8238% o columns: the number of columns in the scaled image.
8239%
8240% o rows: the number of rows in the scaled image.
8241%
8242%
8243*/
8244WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008245 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008246{
8247 Image
8248 *scale_image;
8249
8250 assert(wand != (MagickWand *) NULL);
8251 assert(wand->signature == WandSignature);
8252 if (wand->debug != MagickFalse)
8253 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8254 if (wand->images == (Image *) NULL)
8255 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8256 scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8257 if (scale_image == (Image *) NULL)
8258 return(MagickFalse);
8259 ReplaceImageInList(&wand->images,scale_image);
8260 return(MagickTrue);
8261}
8262
8263/*
8264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8265% %
8266% %
8267% %
8268% M a g i c k S e g m e n t I m a g e %
8269% %
8270% %
8271% %
8272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8273%
8274% MagickSegmentImage() segments an image by analyzing the histograms of the
8275% color components and identifying units that are homogeneous with the fuzzy
8276% C-means technique.
8277%
8278% The format of the SegmentImage method is:
8279%
8280% MagickBooleanType MagickSegmentImage(MagickWand *wand,
8281% const ColorspaceType colorspace,const MagickBooleanType verbose,
8282% const double cluster_threshold,const double smooth_threshold)
8283%
8284% A description of each parameter follows.
8285%
8286% o wand: the wand.
8287%
8288% o colorspace: the image colorspace.
8289%
8290% o verbose: Set to MagickTrue to print detailed information about the
8291% identified classes.
8292%
8293% o cluster_threshold: This represents the minimum number of pixels
8294% contained in a hexahedra before it can be considered valid (expressed as
8295% a percentage).
8296%
8297% o smooth_threshold: the smoothing threshold eliminates noise in the second
8298% derivative of the histogram. As the value is increased, you can expect a
8299% smoother second derivative.
8300%
8301*/
8302MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8303 const ColorspaceType colorspace,const MagickBooleanType verbose,
8304 const double cluster_threshold,const double smooth_threshold)
8305{
8306 MagickBooleanType
8307 status;
8308
8309 assert(wand != (MagickWand *) NULL);
8310 assert(wand->signature == WandSignature);
8311 if (wand->debug != MagickFalse)
8312 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8313 if (wand->images == (Image *) NULL)
8314 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8315 status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8316 smooth_threshold);
8317 if (status == MagickFalse)
8318 InheritException(wand->exception,&wand->images->exception);
8319 return(status);
8320}
8321
8322/*
8323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8324% %
8325% %
8326% %
8327% M a g i c k S e l e c t i v e B l u r I m a g e %
8328% %
8329% %
8330% %
8331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8332%
8333% MagickSelectiveBlurImage() selectively blur an image within a contrast
8334% threshold. It is similar to the unsharpen mask that sharpens everything with
8335% contrast above a certain threshold.
8336%
8337% The format of the MagickSelectiveBlurImage method is:
8338%
8339% MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8340% const double radius,const double sigma,const double threshold)
cristy3ed852e2009-09-05 21:47:34 +00008341%
8342% A description of each parameter follows:
8343%
8344% o wand: the magick wand.
8345%
cristy3ed852e2009-09-05 21:47:34 +00008346% o radius: the radius of the gaussian, in pixels, not counting the center
8347% pixel.
8348%
8349% o sigma: the standard deviation of the gaussian, in pixels.
8350%
8351% o threshold: only pixels within this contrast threshold are included
cristy6a917d92009-10-06 19:23:54 +00008352% in the blur operation.
cristy3ed852e2009-09-05 21:47:34 +00008353%
8354*/
cristy3ed852e2009-09-05 21:47:34 +00008355WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8356 const double radius,const double sigma,const double threshold)
8357{
cristy3ed852e2009-09-05 21:47:34 +00008358 Image
8359 *blur_image;
8360
8361 assert(wand != (MagickWand *) NULL);
8362 assert(wand->signature == WandSignature);
8363 if (wand->debug != MagickFalse)
8364 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8365 if (wand->images == (Image *) NULL)
8366 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00008367 blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8368 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008369 if (blur_image == (Image *) NULL)
8370 return(MagickFalse);
8371 ReplaceImageInList(&wand->images,blur_image);
8372 return(MagickTrue);
8373}
8374
8375/*
8376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8377% %
8378% %
8379% %
8380% 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 %
8381% %
8382% %
8383% %
8384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8385%
cristy3139dc22011-07-08 00:11:42 +00008386% MagickSeparateImage() separates a channel from the image and returns a
cristy3ed852e2009-09-05 21:47:34 +00008387% grayscale image. A channel is a particular color component of each pixel
8388% in the image.
8389%
cristy3139dc22011-07-08 00:11:42 +00008390% The format of the MagickSeparateImage method is:
cristy3ed852e2009-09-05 21:47:34 +00008391%
cristy3139dc22011-07-08 00:11:42 +00008392% MagickBooleanType MagickSeparateImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00008393%
8394% A description of each parameter follows:
8395%
8396% o wand: the magick wand.
8397%
cristy3ed852e2009-09-05 21:47:34 +00008398*/
cristy3139dc22011-07-08 00:11:42 +00008399WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00008400{
8401 MagickBooleanType
8402 status;
8403
8404 assert(wand != (MagickWand *) NULL);
8405 assert(wand->signature == WandSignature);
8406 if (wand->debug != MagickFalse)
8407 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8408 if (wand->images == (Image *) NULL)
8409 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3139dc22011-07-08 00:11:42 +00008410 status=SeparateImage(wand->images);
cristy3ed852e2009-09-05 21:47:34 +00008411 if (status == MagickFalse)
8412 InheritException(wand->exception,&wand->images->exception);
8413 return(status);
8414}
8415
8416/*
8417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8418% %
8419% %
8420% %
8421% M a g i c k S e p i a T o n e I m a g e %
8422% %
8423% %
8424% %
8425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8426%
8427% MagickSepiaToneImage() applies a special effect to the image, similar to the
8428% effect achieved in a photo darkroom by sepia toning. Threshold ranges from
8429% 0 to QuantumRange and is a measure of the extent of the sepia toning. A
8430% threshold of 80% is a good starting point for a reasonable tone.
8431%
8432% The format of the MagickSepiaToneImage method is:
8433%
8434% MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8435% const double threshold)
8436%
8437% A description of each parameter follows:
8438%
8439% o wand: the magick wand.
8440%
8441% o threshold: Define the extent of the sepia toning.
8442%
8443*/
8444WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8445 const double threshold)
8446{
8447 Image
8448 *sepia_image;
8449
8450 assert(wand != (MagickWand *) NULL);
8451 assert(wand->signature == WandSignature);
8452 if (wand->debug != MagickFalse)
8453 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8454 if (wand->images == (Image *) NULL)
8455 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8456 sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8457 if (sepia_image == (Image *) NULL)
8458 return(MagickFalse);
8459 ReplaceImageInList(&wand->images,sepia_image);
8460 return(MagickTrue);
8461}
8462
8463/*
8464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8465% %
8466% %
8467% %
8468% M a g i c k S e t I m a g e %
8469% %
8470% %
8471% %
8472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8473%
8474% MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8475% MagickNextImage(), MagickPreviousImage() with the images from the specified
8476% wand.
8477%
8478% The format of the MagickSetImage method is:
8479%
8480% MagickBooleanType MagickSetImage(MagickWand *wand,
8481% const MagickWand *set_wand)
8482%
8483% A description of each parameter follows:
8484%
8485% o wand: the magick wand.
8486%
8487% o set_wand: the set_wand wand.
8488%
8489*/
8490WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8491 const MagickWand *set_wand)
8492{
8493 Image
8494 *images;
8495
8496 assert(wand != (MagickWand *) NULL);
8497 assert(wand->signature == WandSignature);
8498 if (wand->debug != MagickFalse)
8499 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8500 assert(set_wand != (MagickWand *) NULL);
8501 assert(set_wand->signature == WandSignature);
8502 if (wand->debug != MagickFalse)
8503 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8504 if (set_wand->images == (Image *) NULL)
8505 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8506 images=CloneImageList(set_wand->images,wand->exception);
8507 if (images == (Image *) NULL)
8508 return(MagickFalse);
8509 ReplaceImageInList(&wand->images,images);
8510 return(MagickTrue);
8511}
8512
8513/*
8514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8515% %
8516% %
8517% %
8518% 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 %
8519% %
8520% %
8521% %
8522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8523%
8524% MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8525% alpha channel.
8526%
8527% The format of the MagickSetImageAlphaChannel method is:
8528%
8529% MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8530% const AlphaChannelType alpha_type)
8531%
8532% A description of each parameter follows:
8533%
8534% o wand: the magick wand.
8535%
8536% o alpha_type: the alpha channel type: ActivateAlphaChannel,
8537% DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8538%
8539*/
8540WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8541 const AlphaChannelType alpha_type)
8542{
8543 assert(wand != (MagickWand *) NULL);
8544 assert(wand->signature == WandSignature);
8545 if (wand->debug != MagickFalse)
8546 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8547 if (wand->images == (Image *) NULL)
8548 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy63240882011-08-05 19:05:27 +00008549 return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
cristy3ed852e2009-09-05 21:47:34 +00008550}
8551
8552/*
8553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8554% %
8555% %
8556% %
8557% 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 %
8558% %
8559% %
8560% %
8561%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8562%
8563% MagickSetImageBackgroundColor() sets the image background color.
8564%
8565% The format of the MagickSetImageBackgroundColor method is:
8566%
8567% MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8568% const PixelWand *background)
8569%
8570% A description of each parameter follows:
8571%
8572% o wand: the magick wand.
8573%
8574% o background: the background pixel wand.
8575%
8576*/
8577WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8578 const PixelWand *background)
8579{
8580 assert(wand != (MagickWand *) NULL);
8581 assert(wand->signature == WandSignature);
8582 if (wand->debug != MagickFalse)
8583 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8584 if (wand->images == (Image *) NULL)
8585 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008586 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00008587 return(MagickTrue);
8588}
8589
8590/*
8591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8592% %
8593% %
8594% %
8595% M a g i c k S e t I m a g e B i a s %
8596% %
8597% %
8598% %
8599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8600%
8601% MagickSetImageBias() sets the image bias for any method that convolves an
8602% image (e.g. MagickConvolveImage()).
8603%
8604% The format of the MagickSetImageBias method is:
8605%
8606% MagickBooleanType MagickSetImageBias(MagickWand *wand,
8607% const double bias)
8608%
8609% A description of each parameter follows:
8610%
8611% o wand: the magick wand.
8612%
8613% o bias: the image bias.
8614%
8615*/
8616WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8617 const double bias)
8618{
8619 assert(wand != (MagickWand *) NULL);
8620 assert(wand->signature == WandSignature);
8621 if (wand->debug != MagickFalse)
8622 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8623 if (wand->images == (Image *) NULL)
8624 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8625 wand->images->bias=bias;
8626 return(MagickTrue);
8627}
8628
8629/*
8630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8631% %
8632% %
8633% %
8634% 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 %
8635% %
8636% %
8637% %
8638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8639%
8640% MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8641%
8642% The format of the MagickSetImageBluePrimary method is:
8643%
8644% MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8645% const double x,const double y)
8646%
8647% A description of each parameter follows:
8648%
8649% o wand: the magick wand.
8650%
8651% o x: the blue primary x-point.
8652%
8653% o y: the blue primary y-point.
8654%
8655*/
8656WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8657 const double x,const double y)
8658{
8659 assert(wand != (MagickWand *) NULL);
8660 assert(wand->signature == WandSignature);
8661 if (wand->debug != MagickFalse)
8662 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8663 if (wand->images == (Image *) NULL)
8664 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8665 wand->images->chromaticity.blue_primary.x=x;
8666 wand->images->chromaticity.blue_primary.y=y;
8667 return(MagickTrue);
8668}
8669
8670/*
8671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8672% %
8673% %
8674% %
8675% 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 %
8676% %
8677% %
8678% %
8679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8680%
8681% MagickSetImageBorderColor() sets the image border color.
8682%
8683% The format of the MagickSetImageBorderColor method is:
8684%
8685% MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8686% const PixelWand *border)
8687%
8688% A description of each parameter follows:
8689%
8690% o wand: the magick wand.
8691%
8692% o border: the border pixel wand.
8693%
8694*/
8695WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8696 const PixelWand *border)
8697{
8698 assert(wand != (MagickWand *) NULL);
8699 assert(wand->signature == WandSignature);
8700 if (wand->debug != MagickFalse)
8701 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8702 if (wand->images == (Image *) NULL)
8703 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008704 PixelGetQuantumPacket(border,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00008705 return(MagickTrue);
8706}
8707
8708/*
8709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8710% %
8711% %
8712% %
cristy3ed852e2009-09-05 21:47:34 +00008713% M a g i c k S e t I m a g e C l i p M a s k %
8714% %
8715% %
8716% %
8717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8718%
8719% MagickSetImageClipMask() sets image clip mask.
8720%
8721% The format of the MagickSetImageClipMask method is:
8722%
8723% MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8724% const MagickWand *clip_mask)
8725%
8726% A description of each parameter follows:
8727%
8728% o wand: the magick wand.
8729%
8730% o clip_mask: the clip_mask wand.
8731%
8732*/
8733WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8734 const MagickWand *clip_mask)
8735{
8736 assert(wand != (MagickWand *) NULL);
8737 assert(wand->signature == WandSignature);
8738 if (wand->debug != MagickFalse)
8739 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8740 assert(clip_mask != (MagickWand *) NULL);
8741 assert(clip_mask->signature == WandSignature);
8742 if (wand->debug != MagickFalse)
8743 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8744 if (clip_mask->images == (Image *) NULL)
8745 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8746 return(SetImageClipMask(wand->images,clip_mask->images));
8747}
8748
8749/*
8750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8751% %
8752% %
8753% %
cristya5b77cb2010-05-07 19:34:48 +00008754% M a g i c k S e t I m a g e C o l o r %
8755% %
8756% %
8757% %
8758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8759%
8760% MagickSetImageColor() set the entire wand canvas to the specified color.
8761%
8762% The format of the MagickSetImageColor method is:
8763%
8764% MagickBooleanType MagickSetImageColor(MagickWand *wand,
8765% const PixelWand *color)
8766%
8767% A description of each parameter follows:
8768%
8769% o wand: the magick wand.
8770%
8771% o background: the image color.
8772%
8773*/
8774WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8775 const PixelWand *color)
8776{
8777 MagickBooleanType
8778 status;
8779
cristy4c08aed2011-07-01 19:47:50 +00008780 PixelInfo
cristya5b77cb2010-05-07 19:34:48 +00008781 pixel;
8782
8783 assert(wand != (MagickWand *) NULL);
8784 assert(wand->signature == WandSignature);
8785 if (wand->debug != MagickFalse)
8786 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8787 PixelGetMagickColor(color,&pixel);
8788 status=SetImageColor(wand->images,&pixel);
8789 if (status == MagickFalse)
8790 InheritException(wand->exception,&wand->images->exception);
8791 return(status);
8792}
8793
8794/*
8795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8796% %
8797% %
8798% %
cristy3ed852e2009-09-05 21:47:34 +00008799% 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 %
8800% %
8801% %
8802% %
8803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8804%
8805% MagickSetImageColormapColor() sets the color of the specified colormap
8806% index.
8807%
8808% The format of the MagickSetImageColormapColor method is:
8809%
8810% MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008811% const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00008812%
8813% A description of each parameter follows:
8814%
8815% o wand: the magick wand.
8816%
8817% o index: the offset into the image colormap.
8818%
8819% o color: Return the colormap color in this wand.
8820%
8821*/
8822WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008823 const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00008824{
8825 assert(wand != (MagickWand *) NULL);
8826 assert(wand->signature == WandSignature);
8827 if (wand->debug != MagickFalse)
8828 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8829 if (wand->images == (Image *) NULL)
8830 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8831 if ((wand->images->colormap == (PixelPacket *) NULL) ||
8832 (index >= wand->images->colors))
8833 ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008834 PixelGetQuantumPacket(color,wand->images->colormap+index);
cristy3ed852e2009-09-05 21:47:34 +00008835 return(SyncImage(wand->images));
8836}
8837
8838/*
8839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8840% %
8841% %
8842% %
8843% M a g i c k S e t I m a g e C o l o r s p a c e %
8844% %
8845% %
8846% %
8847%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8848%
8849% MagickSetImageColorspace() sets the image colorspace.
8850%
8851% The format of the MagickSetImageColorspace method is:
8852%
8853% MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8854% const ColorspaceType colorspace)
8855%
8856% A description of each parameter follows:
8857%
8858% o wand: the magick wand.
8859%
8860% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
8861% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8862% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8863% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8864% HSLColorspace, or HWBColorspace.
8865%
8866*/
8867WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8868 const ColorspaceType colorspace)
8869{
8870 assert(wand != (MagickWand *) NULL);
8871 assert(wand->signature == WandSignature);
8872 if (wand->debug != MagickFalse)
8873 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8874 if (wand->images == (Image *) NULL)
8875 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy63240882011-08-05 19:05:27 +00008876 return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
cristy3ed852e2009-09-05 21:47:34 +00008877}
8878
8879/*
8880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8881% %
8882% %
8883% %
8884% M a g i c k S e t I m a g e C o m p o s e %
8885% %
8886% %
8887% %
8888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8889%
8890% MagickSetImageCompose() sets the image composite operator, useful for
8891% specifying how to composite the image thumbnail when using the
8892% MagickMontageImage() method.
8893%
8894% The format of the MagickSetImageCompose method is:
8895%
8896% MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8897% const CompositeOperator compose)
8898%
8899% A description of each parameter follows:
8900%
8901% o wand: the magick wand.
8902%
8903% o compose: the image composite operator.
8904%
8905*/
8906WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8907 const CompositeOperator compose)
8908{
8909 assert(wand != (MagickWand *) NULL);
8910 assert(wand->signature == WandSignature);
8911 if (wand->debug != MagickFalse)
8912 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8913 if (wand->images == (Image *) NULL)
8914 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8915 wand->images->compose=compose;
8916 return(MagickTrue);
8917}
8918
8919/*
8920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8921% %
8922% %
8923% %
8924% 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 %
8925% %
8926% %
8927% %
8928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8929%
8930% MagickSetImageCompression() sets the image compression.
8931%
8932% The format of the MagickSetImageCompression method is:
8933%
8934% MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8935% const CompressionType compression)
8936%
8937% A description of each parameter follows:
8938%
8939% o wand: the magick wand.
8940%
8941% o compression: the image compression type.
8942%
8943*/
8944WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8945 const CompressionType compression)
8946{
8947 assert(wand != (MagickWand *) NULL);
8948 assert(wand->signature == WandSignature);
8949 if (wand->debug != MagickFalse)
8950 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8951 if (wand->images == (Image *) NULL)
8952 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8953 wand->images->compression=compression;
8954 return(MagickTrue);
8955}
8956
8957/*
8958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8959% %
8960% %
8961% %
8962% 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 %
8963% %
8964% %
8965% %
8966%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8967%
8968% MagickSetImageCompressionQuality() sets the image compression quality.
8969%
8970% The format of the MagickSetImageCompressionQuality method is:
8971%
8972% MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008973% const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00008974%
8975% A description of each parameter follows:
8976%
8977% o wand: the magick wand.
8978%
8979% o quality: the image compression tlityype.
8980%
8981*/
8982WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008983 const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00008984{
8985 assert(wand != (MagickWand *) NULL);
8986 assert(wand->signature == WandSignature);
8987 if (wand->debug != MagickFalse)
8988 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8989 if (wand->images == (Image *) NULL)
8990 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8991 wand->images->quality=quality;
8992 return(MagickTrue);
8993}
8994
8995/*
8996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8997% %
8998% %
8999% %
9000% M a g i c k S e t I m a g e D e l a y %
9001% %
9002% %
9003% %
9004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9005%
9006% MagickSetImageDelay() sets the image delay.
9007%
9008% The format of the MagickSetImageDelay method is:
9009%
9010% MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009011% const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009012%
9013% A description of each parameter follows:
9014%
9015% o wand: the magick wand.
9016%
9017% o delay: the image delay in ticks-per-second units.
9018%
9019*/
9020WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009021 const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009022{
9023 assert(wand != (MagickWand *) NULL);
9024 assert(wand->signature == WandSignature);
9025 if (wand->debug != MagickFalse)
9026 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9027 if (wand->images == (Image *) NULL)
9028 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9029 wand->images->delay=delay;
9030 return(MagickTrue);
9031}
9032
9033/*
9034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9035% %
9036% %
9037% %
9038% M a g i c k S e t I m a g e D e p t h %
9039% %
9040% %
9041% %
9042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9043%
9044% MagickSetImageDepth() sets the image depth.
9045%
9046% The format of the MagickSetImageDepth method is:
9047%
9048% MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009049% const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009050%
9051% A description of each parameter follows:
9052%
9053% o wand: the magick wand.
9054%
9055% o depth: the image depth in bits: 8, 16, or 32.
9056%
9057*/
9058WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009059 const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009060{
9061 assert(wand != (MagickWand *) NULL);
9062 assert(wand->signature == WandSignature);
9063 if (wand->debug != MagickFalse)
9064 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9065 if (wand->images == (Image *) NULL)
9066 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyfefab1b2011-07-05 00:33:22 +00009067 return(SetImageDepth(wand->images,depth));
cristy3ed852e2009-09-05 21:47:34 +00009068}
9069
9070/*
9071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9072% %
9073% %
9074% %
9075% M a g i c k S e t I m a g e D i s p o s e %
9076% %
9077% %
9078% %
9079%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9080%
9081% MagickSetImageDispose() sets the image disposal method.
9082%
9083% The format of the MagickSetImageDispose method is:
9084%
9085% MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9086% const DisposeType dispose)
9087%
9088% A description of each parameter follows:
9089%
9090% o wand: the magick wand.
9091%
9092% o dispose: the image disposeal type.
9093%
9094*/
9095WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9096 const DisposeType dispose)
9097{
9098 assert(wand != (MagickWand *) NULL);
9099 assert(wand->signature == WandSignature);
9100 if (wand->debug != MagickFalse)
9101 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9102 if (wand->images == (Image *) NULL)
9103 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9104 wand->images->dispose=dispose;
9105 return(MagickTrue);
9106}
9107
9108/*
9109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9110% %
9111% %
9112% %
9113% M a g i c k S e t I m a g e E x t e n t %
9114% %
9115% %
9116% %
9117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9118%
9119% MagickSetImageExtent() sets the image size (i.e. columns & rows).
9120%
9121% The format of the MagickSetImageExtent method is:
9122%
9123% MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009124% const size_t columns,const unsigned rows)
cristy3ed852e2009-09-05 21:47:34 +00009125%
9126% A description of each parameter follows:
9127%
9128% o wand: the magick wand.
9129%
9130% o columns: The image width in pixels.
9131%
9132% o rows: The image height in pixels.
9133%
9134*/
9135WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009136 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009137{
9138 assert(wand != (MagickWand *) NULL);
9139 assert(wand->signature == WandSignature);
9140 if (wand->debug != MagickFalse)
9141 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9142 if (wand->images == (Image *) NULL)
9143 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy63240882011-08-05 19:05:27 +00009144 return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
cristy3ed852e2009-09-05 21:47:34 +00009145}
9146
9147/*
9148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9149% %
9150% %
9151% %
9152% M a g i c k S e t I m a g e F i l e n a m e %
9153% %
9154% %
9155% %
9156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9157%
9158% MagickSetImageFilename() sets the filename of a particular image in a
9159% sequence.
9160%
9161% The format of the MagickSetImageFilename method is:
9162%
9163% MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9164% const char *filename)
9165%
9166% A description of each parameter follows:
9167%
9168% o wand: the magick wand.
9169%
9170% o filename: the image filename.
9171%
9172*/
9173WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9174 const char *filename)
9175{
9176 assert(wand != (MagickWand *) NULL);
9177 assert(wand->signature == WandSignature);
9178 if (wand->debug != MagickFalse)
9179 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9180 if (wand->images == (Image *) NULL)
9181 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9182 if (filename != (const char *) NULL)
9183 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9184 return(MagickTrue);
9185}
9186
9187/*
9188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9189% %
9190% %
9191% %
9192% M a g i c k S e t I m a g e F o r m a t %
9193% %
9194% %
9195% %
9196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9197%
9198% MagickSetImageFormat() sets the format of a particular image in a
9199% sequence.
9200%
9201% The format of the MagickSetImageFormat method is:
9202%
9203% MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9204% const char *format)
9205%
9206% A description of each parameter follows:
9207%
9208% o wand: the magick wand.
9209%
9210% o format: the image format.
9211%
9212*/
9213WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9214 const char *format)
9215{
9216 const MagickInfo
9217 *magick_info;
9218
9219 assert(wand != (MagickWand *) NULL);
9220 assert(wand->signature == WandSignature);
9221 if (wand->debug != MagickFalse)
9222 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9223 if (wand->images == (Image *) NULL)
9224 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9225 if ((format == (char *) NULL) || (*format == '\0'))
9226 {
9227 *wand->images->magick='\0';
9228 return(MagickTrue);
9229 }
9230 magick_info=GetMagickInfo(format,wand->exception);
9231 if (magick_info == (const MagickInfo *) NULL)
9232 return(MagickFalse);
9233 ClearMagickException(wand->exception);
9234 (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9235 return(MagickTrue);
9236}
9237
9238/*
9239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9240% %
9241% %
9242% %
9243% M a g i c k S e t I m a g e F u z z %
9244% %
9245% %
9246% %
9247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9248%
9249% MagickSetImageFuzz() sets the image fuzz.
9250%
9251% The format of the MagickSetImageFuzz method is:
9252%
9253% MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9254% const double fuzz)
9255%
9256% A description of each parameter follows:
9257%
9258% o wand: the magick wand.
9259%
9260% o fuzz: the image fuzz.
9261%
9262*/
9263WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9264 const double fuzz)
9265{
9266 assert(wand != (MagickWand *) NULL);
9267 assert(wand->signature == WandSignature);
9268 if (wand->debug != MagickFalse)
9269 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9270 if (wand->images == (Image *) NULL)
9271 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9272 wand->images->fuzz=fuzz;
9273 return(MagickTrue);
9274}
9275
9276/*
9277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9278% %
9279% %
9280% %
9281% M a g i c k S e t I m a g e G a m m a %
9282% %
9283% %
9284% %
9285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9286%
9287% MagickSetImageGamma() sets the image gamma.
9288%
9289% The format of the MagickSetImageGamma method is:
9290%
9291% MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9292% const double gamma)
9293%
9294% A description of each parameter follows:
9295%
9296% o wand: the magick wand.
9297%
9298% o gamma: the image gamma.
9299%
9300*/
9301WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9302 const double gamma)
9303{
9304 assert(wand != (MagickWand *) NULL);
9305 assert(wand->signature == WandSignature);
9306 if (wand->debug != MagickFalse)
9307 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9308 if (wand->images == (Image *) NULL)
9309 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9310 wand->images->gamma=gamma;
9311 return(MagickTrue);
9312}
9313
9314/*
9315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9316% %
9317% %
9318% %
9319% M a g i c k S e t I m a g e G r a v i t y %
9320% %
9321% %
9322% %
9323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9324%
9325% MagickSetImageGravity() sets the image gravity type.
9326%
9327% The format of the MagickSetImageGravity method is:
9328%
9329% MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9330% const GravityType gravity)
9331%
9332% A description of each parameter follows:
9333%
9334% o wand: the magick wand.
9335%
9336% o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9337% PlaneInterlace, PartitionInterlace.
9338%
9339*/
9340WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9341 const GravityType gravity)
9342{
9343 assert(wand != (MagickWand *) NULL);
9344 assert(wand->signature == WandSignature);
9345 if (wand->debug != MagickFalse)
9346 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9347 if (wand->images == (Image *) NULL)
9348 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9349 wand->images->gravity=gravity;
9350 return(MagickTrue);
9351}
9352
9353/*
9354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9355% %
9356% %
9357% %
9358% 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 %
9359% %
9360% %
9361% %
9362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9363%
9364% MagickSetImageGreenPrimary() sets the image chromaticity green primary
9365% point.
9366%
9367% The format of the MagickSetImageGreenPrimary method is:
9368%
9369% MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9370% const double x,const double y)
9371%
9372% A description of each parameter follows:
9373%
9374% o wand: the magick wand.
9375%
9376% o x: the green primary x-point.
9377%
9378% o y: the green primary y-point.
9379%
9380%
9381*/
9382WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9383 const double x,const double y)
9384{
9385 assert(wand != (MagickWand *) NULL);
9386 assert(wand->signature == WandSignature);
9387 if (wand->debug != MagickFalse)
9388 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9389 if (wand->images == (Image *) NULL)
9390 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9391 wand->images->chromaticity.green_primary.x=x;
9392 wand->images->chromaticity.green_primary.y=y;
9393 return(MagickTrue);
9394}
9395
9396/*
9397%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9398% %
9399% %
9400% %
9401% 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 %
9402% %
9403% %
9404% %
9405%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9406%
9407% MagickSetImageInterlaceScheme() sets the image interlace scheme.
9408%
9409% The format of the MagickSetImageInterlaceScheme method is:
9410%
9411% MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9412% const InterlaceType interlace)
9413%
9414% A description of each parameter follows:
9415%
9416% o wand: the magick wand.
9417%
9418% o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9419% PlaneInterlace, PartitionInterlace.
9420%
9421*/
9422WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9423 const InterlaceType interlace)
9424{
9425 assert(wand != (MagickWand *) NULL);
9426 assert(wand->signature == WandSignature);
9427 if (wand->debug != MagickFalse)
9428 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9429 if (wand->images == (Image *) NULL)
9430 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9431 wand->images->interlace=interlace;
9432 return(MagickTrue);
9433}
9434
9435/*
9436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9437% %
9438% %
9439% %
9440% 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 %
9441% %
9442% %
9443% %
9444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9445%
9446% MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9447%
9448% The format of the MagickSetImageInterpolateMethod method is:
9449%
9450% MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9451% const InterpolatePixelMethod method)
9452%
9453% A description of each parameter follows:
9454%
9455% o wand: the magick wand.
9456%
9457% o method: the image interpole pixel methods: choose from Undefined,
9458% Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9459%
9460*/
9461WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9462 const InterpolatePixelMethod method)
9463{
9464 assert(wand != (MagickWand *) NULL);
9465 assert(wand->signature == WandSignature);
9466 if (wand->debug != MagickFalse)
9467 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9468 if (wand->images == (Image *) NULL)
9469 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9470 wand->images->interpolate=method;
9471 return(MagickTrue);
9472}
9473
9474/*
9475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9476% %
9477% %
9478% %
9479% M a g i c k S e t I m a g e I t e r a t i o n s %
9480% %
9481% %
9482% %
9483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9484%
9485% MagickSetImageIterations() sets the image iterations.
9486%
9487% The format of the MagickSetImageIterations method is:
9488%
9489% MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009490% const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +00009491%
9492% A description of each parameter follows:
9493%
9494% o wand: the magick wand.
9495%
9496% o delay: the image delay in 1/100th of a second.
9497%
9498*/
9499WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009500 const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +00009501{
9502 assert(wand != (MagickWand *) NULL);
9503 assert(wand->signature == WandSignature);
9504 if (wand->debug != MagickFalse)
9505 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9506 if (wand->images == (Image *) NULL)
9507 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9508 wand->images->iterations=iterations;
9509 return(MagickTrue);
9510}
9511
9512/*
9513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9514% %
9515% %
9516% %
9517% M a g i c k S e t I m a g e M a t t e %
9518% %
9519% %
9520% %
9521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9522%
9523% MagickSetImageMatte() sets the image matte channel.
9524%
9525% The format of the MagickSetImageMatteColor method is:
9526%
9527% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9528% const MagickBooleanType *matte)
9529%
9530% A description of each parameter follows:
9531%
9532% o wand: the magick wand.
9533%
9534% o matte: Set to MagickTrue to enable the image matte channel otherwise
9535% MagickFalse.
9536%
9537*/
9538WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9539 const MagickBooleanType matte)
9540{
9541 assert(wand != (MagickWand *) NULL);
9542 assert(wand->signature == WandSignature);
9543 if (wand->debug != MagickFalse)
9544 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9545 if (wand->images == (Image *) NULL)
9546 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9547 if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
cristy4c08aed2011-07-01 19:47:50 +00009548 (void) SetImageOpacity(wand->images,OpaqueAlpha);
cristy3ed852e2009-09-05 21:47:34 +00009549 wand->images->matte=matte;
9550 return(MagickTrue);
9551}
9552
9553/*
9554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9555% %
9556% %
9557% %
9558% M a g i c k S e t I m a g e M a t t e C o l o r %
9559% %
9560% %
9561% %
9562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9563%
9564% MagickSetImageMatteColor() sets the image matte color.
9565%
9566% The format of the MagickSetImageMatteColor method is:
9567%
9568% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9569% const PixelWand *matte)
9570%
9571% A description of each parameter follows:
9572%
9573% o wand: the magick wand.
9574%
9575% o matte: the matte pixel wand.
9576%
9577*/
9578WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9579 const PixelWand *matte)
9580{
9581 assert(wand != (MagickWand *) NULL);
9582 assert(wand->signature == WandSignature);
9583 if (wand->debug != MagickFalse)
9584 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9585 if (wand->images == (Image *) NULL)
9586 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009587 PixelGetQuantumPacket(matte,&wand->images->matte_color);
cristy3ed852e2009-09-05 21:47:34 +00009588 return(MagickTrue);
9589}
9590
9591/*
9592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9593% %
9594% %
9595% %
9596% M a g i c k S e t I m a g e O p a c i t y %
9597% %
9598% %
9599% %
9600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9601%
9602% MagickSetImageOpacity() sets the image to the specified opacity level.
9603%
9604% The format of the MagickSetImageOpacity method is:
9605%
9606% MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9607% const double alpha)
9608%
9609% A description of each parameter follows:
9610%
9611% o wand: the magick wand.
9612%
9613% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9614% transparent.
9615%
9616*/
9617WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9618 const double alpha)
9619{
9620 MagickBooleanType
9621 status;
9622
9623 assert(wand != (MagickWand *) NULL);
9624 assert(wand->signature == WandSignature);
9625 if (wand->debug != MagickFalse)
9626 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9627 if (wand->images == (Image *) NULL)
9628 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009629 status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
cristy3ed852e2009-09-05 21:47:34 +00009630 if (status == MagickFalse)
9631 InheritException(wand->exception,&wand->images->exception);
9632 return(status);
9633}
9634
9635/*
9636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9637% %
9638% %
9639% %
9640% 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 %
9641% %
9642% %
9643% %
9644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9645%
9646% MagickSetImageOrientation() sets the image orientation.
9647%
9648% The format of the MagickSetImageOrientation method is:
9649%
9650% MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9651% const OrientationType orientation)
9652%
9653% A description of each parameter follows:
9654%
9655% o wand: the magick wand.
9656%
9657% o orientation: the image orientation type.
9658%
9659*/
9660WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9661 const OrientationType orientation)
9662{
9663 assert(wand != (MagickWand *) NULL);
9664 assert(wand->signature == WandSignature);
9665 if (wand->debug != MagickFalse)
9666 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9667 if (wand->images == (Image *) NULL)
9668 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9669 wand->images->orientation=orientation;
9670 return(MagickTrue);
9671}
9672
9673/*
9674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9675% %
9676% %
9677% %
9678% M a g i c k S e t I m a g e P a g e %
9679% %
9680% %
9681% %
9682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9683%
9684% MagickSetImagePage() sets the page geometry of the image.
9685%
9686% The format of the MagickSetImagePage method is:
9687%
9688% MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009689% const size_t width,const size_t height,const ssize_t x,
9690% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00009691%
9692% A description of each parameter follows:
9693%
9694% o wand: the magick wand.
9695%
9696% o width: the page width.
9697%
9698% o height: the page height.
9699%
9700% o x: the page x-offset.
9701%
9702% o y: the page y-offset.
9703%
9704*/
9705WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009706 const size_t width,const size_t height,const ssize_t x,
9707 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00009708{
9709 assert(wand != (MagickWand *) NULL);
9710 assert(wand->signature == WandSignature);
9711 if (wand->debug != MagickFalse)
9712 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9713 if (wand->images == (Image *) NULL)
9714 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9715 wand->images->page.width=width;
9716 wand->images->page.height=height;
9717 wand->images->page.x=x;
9718 wand->images->page.y=y;
9719 return(MagickTrue);
9720}
9721
9722/*
9723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9724% %
9725% %
9726% %
9727% 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 %
9728% %
9729% %
9730% %
9731%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9732%
9733% MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9734% specified method and returns the previous progress monitor if any. The
9735% progress monitor method looks like this:
9736%
9737% MagickBooleanType MagickProgressMonitor(const char *text,
9738% const MagickOffsetType offset,const MagickSizeType span,
9739% void *client_data)
9740%
9741% If the progress monitor returns MagickFalse, the current operation is
9742% interrupted.
9743%
9744% The format of the MagickSetImageProgressMonitor method is:
9745%
9746% MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9747% const MagickProgressMonitor progress_monitor,void *client_data)
9748%
9749% A description of each parameter follows:
9750%
9751% o wand: the magick wand.
9752%
9753% o progress_monitor: Specifies a pointer to a method to monitor progress
9754% of an image operation.
9755%
9756% o client_data: Specifies a pointer to any client data.
9757%
9758*/
9759WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9760 const MagickProgressMonitor progress_monitor,void *client_data)
9761{
9762 MagickProgressMonitor
9763 previous_monitor;
9764
9765 assert(wand != (MagickWand *) NULL);
9766 assert(wand->signature == WandSignature);
9767 if (wand->debug != MagickFalse)
9768 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9769 if (wand->images == (Image *) NULL)
9770 {
9771 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9772 "ContainsNoImages","`%s'",wand->name);
9773 return((MagickProgressMonitor) NULL);
9774 }
9775 previous_monitor=SetImageProgressMonitor(wand->images,
9776 progress_monitor,client_data);
9777 return(previous_monitor);
9778}
9779
9780/*
9781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9782% %
9783% %
9784% %
9785% M a g i c k S e t I m a g e R e d P r i m a r y %
9786% %
9787% %
9788% %
9789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9790%
9791% MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9792%
9793% The format of the MagickSetImageRedPrimary method is:
9794%
9795% MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9796% const double x,const double y)
9797%
9798% A description of each parameter follows:
9799%
9800% o wand: the magick wand.
9801%
9802% o x: the red primary x-point.
9803%
9804% o y: the red primary y-point.
9805%
9806*/
9807WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9808 const double x,const double y)
9809{
9810 assert(wand != (MagickWand *) NULL);
9811 assert(wand->signature == WandSignature);
9812 if (wand->debug != MagickFalse)
9813 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9814 if (wand->images == (Image *) NULL)
9815 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9816 wand->images->chromaticity.red_primary.x=x;
9817 wand->images->chromaticity.red_primary.y=y;
9818 return(MagickTrue);
9819}
9820
9821/*
9822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9823% %
9824% %
9825% %
9826% 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 %
9827% %
9828% %
9829% %
9830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9831%
9832% MagickSetImageRenderingIntent() sets the image rendering intent.
9833%
9834% The format of the MagickSetImageRenderingIntent method is:
9835%
9836% MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9837% const RenderingIntent rendering_intent)
9838%
9839% A description of each parameter follows:
9840%
9841% o wand: the magick wand.
9842%
9843% o rendering_intent: the image rendering intent: UndefinedIntent,
9844% SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9845%
9846*/
9847WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9848 const RenderingIntent rendering_intent)
9849{
9850 assert(wand != (MagickWand *) NULL);
9851 assert(wand->signature == WandSignature);
9852 if (wand->debug != MagickFalse)
9853 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9854 if (wand->images == (Image *) NULL)
9855 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9856 wand->images->rendering_intent=rendering_intent;
9857 return(MagickTrue);
9858}
9859
9860/*
9861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9862% %
9863% %
9864% %
9865% M a g i c k S e t I m a g e R e s o l u t i o n %
9866% %
9867% %
9868% %
9869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9870%
9871% MagickSetImageResolution() sets the image resolution.
9872%
9873% The format of the MagickSetImageResolution method is:
9874%
9875% MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9876% const double x_resolution,const doubtl y_resolution)
9877%
9878% A description of each parameter follows:
9879%
9880% o wand: the magick wand.
9881%
9882% o x_resolution: the image x resolution.
9883%
9884% o y_resolution: the image y resolution.
9885%
9886*/
9887WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9888 const double x_resolution,const double y_resolution)
9889{
9890 assert(wand != (MagickWand *) NULL);
9891 assert(wand->signature == WandSignature);
9892 if (wand->debug != MagickFalse)
9893 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9894 if (wand->images == (Image *) NULL)
9895 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9896 wand->images->x_resolution=x_resolution;
9897 wand->images->y_resolution=y_resolution;
9898 return(MagickTrue);
9899}
9900
9901/*
9902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9903% %
9904% %
9905% %
9906% M a g i c k S e t I m a g e S c e n e %
9907% %
9908% %
9909% %
9910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9911%
9912% MagickSetImageScene() sets the image scene.
9913%
9914% The format of the MagickSetImageScene method is:
9915%
9916% MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009917% const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +00009918%
9919% A description of each parameter follows:
9920%
9921% o wand: the magick wand.
9922%
9923% o delay: the image scene number.
9924%
9925*/
9926WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009927 const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +00009928{
9929 assert(wand != (MagickWand *) NULL);
9930 assert(wand->signature == WandSignature);
9931 if (wand->debug != MagickFalse)
9932 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9933 if (wand->images == (Image *) NULL)
9934 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9935 wand->images->scene=scene;
9936 return(MagickTrue);
9937}
9938
9939/*
9940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9941% %
9942% %
9943% %
9944% 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 %
9945% %
9946% %
9947% %
9948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9949%
9950% MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9951%
9952% The format of the MagickSetImageTicksPerSecond method is:
9953%
9954% MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009955% const ssize_t ticks_per-second)
cristy3ed852e2009-09-05 21:47:34 +00009956%
9957% A description of each parameter follows:
9958%
9959% o wand: the magick wand.
9960%
9961% o ticks_per_second: the units to use for the image delay.
9962%
9963*/
9964WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009965 const ssize_t ticks_per_second)
cristy3ed852e2009-09-05 21:47:34 +00009966{
9967 assert(wand != (MagickWand *) NULL);
9968 assert(wand->signature == WandSignature);
9969 if (wand->debug != MagickFalse)
9970 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9971 if (wand->images == (Image *) NULL)
9972 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9973 wand->images->ticks_per_second=ticks_per_second;
9974 return(MagickTrue);
9975}
9976
9977/*
9978%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9979% %
9980% %
9981% %
9982% M a g i c k S e t I m a g e T y p e %
9983% %
9984% %
9985% %
9986%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9987%
9988% MagickSetImageType() sets the image type.
9989%
9990% The format of the MagickSetImageType method is:
9991%
9992% MagickBooleanType MagickSetImageType(MagickWand *wand,
9993% const ImageType image_type)
9994%
9995% A description of each parameter follows:
9996%
9997% o wand: the magick wand.
9998%
cristy5f1c1ff2010-12-23 21:38:06 +00009999% o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
cristy3ed852e2009-09-05 21:47:34 +000010000% GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10001% TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10002% or OptimizeType.
10003%
10004*/
10005WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10006 const ImageType image_type)
10007{
10008 assert(wand != (MagickWand *) NULL);
10009 assert(wand->signature == WandSignature);
10010 if (wand->debug != MagickFalse)
10011 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10012 if (wand->images == (Image *) NULL)
10013 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10014 return(SetImageType(wand->images,image_type));
10015}
10016
10017/*
10018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10019% %
10020% %
10021% %
10022% M a g i c k S e t I m a g e U n i t s %
10023% %
10024% %
10025% %
10026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10027%
10028% MagickSetImageUnits() sets the image units of resolution.
10029%
10030% The format of the MagickSetImageUnits method is:
10031%
10032% MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10033% const ResolutionType units)
10034%
10035% A description of each parameter follows:
10036%
10037% o wand: the magick wand.
10038%
10039% o units: the image units of resolution : UndefinedResolution,
10040% PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10041%
10042*/
10043WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10044 const ResolutionType units)
10045{
10046 assert(wand != (MagickWand *) NULL);
10047 assert(wand->signature == WandSignature);
10048 if (wand->debug != MagickFalse)
10049 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10050 if (wand->images == (Image *) NULL)
10051 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10052 wand->images->units=units;
10053 return(MagickTrue);
10054}
10055
10056/*
10057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10058% %
10059% %
10060% %
10061% 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 %
10062% %
10063% %
10064% %
10065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10066%
10067% MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10068%
10069% The format of the MagickSetImageVirtualPixelMethod method is:
10070%
10071% VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10072% const VirtualPixelMethod method)
10073%
10074% A description of each parameter follows:
10075%
10076% o wand: the magick wand.
10077%
10078% o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10079% ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
10080% MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10081%
10082*/
10083WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10084 const VirtualPixelMethod method)
10085{
10086 assert(wand != (MagickWand *) NULL);
10087 assert(wand->signature == WandSignature);
10088 if (wand->debug != MagickFalse)
10089 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10090 if (wand->images == (Image *) NULL)
10091 return(UndefinedVirtualPixelMethod);
10092 return(SetImageVirtualPixelMethod(wand->images,method));
10093}
10094
10095/*
10096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10097% %
10098% %
10099% %
10100% M a g i c k S e t I m a g e W h i t e P o i n t %
10101% %
10102% %
10103% %
10104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10105%
10106% MagickSetImageWhitePoint() sets the image chromaticity white point.
10107%
10108% The format of the MagickSetImageWhitePoint method is:
10109%
10110% MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10111% const double x,const double y)
10112%
10113% A description of each parameter follows:
10114%
10115% o wand: the magick wand.
10116%
10117% o x: the white x-point.
10118%
10119% o y: the white y-point.
10120%
10121*/
10122WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10123 const double x,const double y)
10124{
10125 assert(wand != (MagickWand *) NULL);
10126 assert(wand->signature == WandSignature);
10127 if (wand->debug != MagickFalse)
10128 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10129 if (wand->images == (Image *) NULL)
10130 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10131 wand->images->chromaticity.white_point.x=x;
10132 wand->images->chromaticity.white_point.y=y;
10133 return(MagickTrue);
10134}
10135
10136/*
10137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10138% %
10139% %
10140% %
10141% M a g i c k S h a d e I m a g e C h a n n e l %
10142% %
10143% %
10144% %
10145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10146%
10147% MagickShadeImage() shines a distant light on an image to create a
10148% three-dimensional effect. You control the positioning of the light with
10149% azimuth and elevation; azimuth is measured in degrees off the x axis
10150% and elevation is measured in pixels above the Z axis.
10151%
10152% The format of the MagickShadeImage method is:
10153%
10154% MagickBooleanType MagickShadeImage(MagickWand *wand,
10155% const MagickBooleanType gray,const double azimuth,
10156% const double elevation)
10157%
10158% A description of each parameter follows:
10159%
10160% o wand: the magick wand.
10161%
10162% o gray: A value other than zero shades the intensity of each pixel.
10163%
10164% o azimuth, elevation: Define the light source direction.
10165%
10166*/
10167WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10168 const MagickBooleanType gray,const double asimuth,const double elevation)
10169{
10170 Image
10171 *shade_image;
10172
10173 assert(wand != (MagickWand *) NULL);
10174 assert(wand->signature == WandSignature);
10175 if (wand->debug != MagickFalse)
10176 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10177 if (wand->images == (Image *) NULL)
10178 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10179 shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10180 if (shade_image == (Image *) NULL)
10181 return(MagickFalse);
10182 ReplaceImageInList(&wand->images,shade_image);
10183 return(MagickTrue);
10184}
10185
10186/*
10187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10188% %
10189% %
10190% %
10191% M a g i c k S h a d o w I m a g e %
10192% %
10193% %
10194% %
10195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10196%
10197% MagickShadowImage() simulates an image shadow.
10198%
10199% The format of the MagickShadowImage method is:
10200%
10201% MagickBooleanType MagickShadowImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010202% const double opacity,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010203%
10204% A description of each parameter follows:
10205%
10206% o wand: the magick wand.
10207%
10208% o opacity: percentage transparency.
10209%
10210% o sigma: the standard deviation of the Gaussian, in pixels.
10211%
10212% o x: the shadow x-offset.
10213%
10214% o y: the shadow y-offset.
10215%
10216*/
10217WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010218 const double opacity,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010219{
10220 Image
10221 *shadow_image;
10222
10223 assert(wand != (MagickWand *) NULL);
10224 assert(wand->signature == WandSignature);
10225 if (wand->debug != MagickFalse)
10226 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10227 if (wand->images == (Image *) NULL)
10228 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10229 shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10230 if (shadow_image == (Image *) NULL)
10231 return(MagickFalse);
10232 ReplaceImageInList(&wand->images,shadow_image);
10233 return(MagickTrue);
10234}
10235
10236/*
10237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10238% %
10239% %
10240% %
10241% M a g i c k S h a r p e n I m a g e %
10242% %
10243% %
10244% %
10245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10246%
10247% MagickSharpenImage() sharpens an image. We convolve the image with a
10248% Gaussian operator of the given radius and standard deviation (sigma).
10249% For reasonable results, the radius should be larger than sigma. Use a
10250% radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10251%
10252% The format of the MagickSharpenImage method is:
10253%
10254% MagickBooleanType MagickSharpenImage(MagickWand *wand,
10255% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +000010256%
10257% A description of each parameter follows:
10258%
10259% o wand: the magick wand.
10260%
cristy3ed852e2009-09-05 21:47:34 +000010261% o radius: the radius of the Gaussian, in pixels, not counting the center
10262% pixel.
10263%
10264% o sigma: the standard deviation of the Gaussian, in pixels.
10265%
10266*/
cristy3ed852e2009-09-05 21:47:34 +000010267WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10268 const double radius,const double sigma)
10269{
cristy3ed852e2009-09-05 21:47:34 +000010270 Image
10271 *sharp_image;
10272
10273 assert(wand != (MagickWand *) NULL);
10274 assert(wand->signature == WandSignature);
10275 if (wand->debug != MagickFalse)
10276 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10277 if (wand->images == (Image *) NULL)
10278 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000010279 sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010280 if (sharp_image == (Image *) NULL)
10281 return(MagickFalse);
10282 ReplaceImageInList(&wand->images,sharp_image);
10283 return(MagickTrue);
10284}
10285
10286/*
10287%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10288% %
10289% %
10290% %
10291% M a g i c k S h a v e I m a g e %
10292% %
10293% %
10294% %
10295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10296%
10297% MagickShaveImage() shaves pixels from the image edges. It allocates the
10298% memory necessary for the new Image structure and returns a pointer to the
10299% new image.
10300%
10301% The format of the MagickShaveImage method is:
10302%
10303% MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010304% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010305%
10306% A description of each parameter follows:
10307%
10308% o wand: the magick wand.
10309%
10310% o columns: the number of columns in the scaled image.
10311%
10312% o rows: the number of rows in the scaled image.
10313%
10314%
10315*/
10316WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010317 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010318{
10319 Image
10320 *shave_image;
10321
10322 RectangleInfo
10323 shave_info;
10324
10325 assert(wand != (MagickWand *) NULL);
10326 assert(wand->signature == WandSignature);
10327 if (wand->debug != MagickFalse)
10328 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10329 if (wand->images == (Image *) NULL)
10330 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10331 shave_info.width=columns;
10332 shave_info.height=rows;
10333 shave_info.x=0;
10334 shave_info.y=0;
10335 shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10336 if (shave_image == (Image *) NULL)
10337 return(MagickFalse);
10338 ReplaceImageInList(&wand->images,shave_image);
10339 return(MagickTrue);
10340}
10341
10342/*
10343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10344% %
10345% %
10346% %
10347% M a g i c k S h e a r I m a g e %
10348% %
10349% %
10350% %
10351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10352%
cristycee97112010-05-28 00:44:52 +000010353% MagickShearImage() slides one edge of an image along the X or Y axis,
10354% creating a parallelogram. An X direction shear slides an edge along the X
10355% axis, while a Y direction shear slides an edge along the Y axis. The amount
cristy3ed852e2009-09-05 21:47:34 +000010356% of the shear is controlled by a shear angle. For X direction shears, x_shear
10357% is measured relative to the Y axis, and similarly, for Y direction shears
10358% y_shear is measured relative to the X axis. Empty triangles left over from
10359% shearing the image are filled with the background color.
10360%
10361% The format of the MagickShearImage method is:
10362%
10363% MagickBooleanType MagickShearImage(MagickWand *wand,
10364% const PixelWand *background,const double x_shear,onst double y_shear)
10365%
10366% A description of each parameter follows:
10367%
10368% o wand: the magick wand.
10369%
10370% o background: the background pixel wand.
10371%
10372% o x_shear: the number of degrees to shear the image.
10373%
10374% o y_shear: the number of degrees to shear the image.
10375%
10376*/
10377WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10378 const PixelWand *background,const double x_shear,const double y_shear)
10379{
10380 Image
10381 *shear_image;
10382
10383 assert(wand != (MagickWand *) NULL);
10384 assert(wand->signature == WandSignature);
10385 if (wand->debug != MagickFalse)
10386 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10387 if (wand->images == (Image *) NULL)
10388 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +000010389 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +000010390 shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10391 if (shear_image == (Image *) NULL)
10392 return(MagickFalse);
10393 ReplaceImageInList(&wand->images,shear_image);
10394 return(MagickTrue);
10395}
10396
10397/*
10398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10399% %
10400% %
10401% %
10402% 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 %
10403% %
10404% %
10405% %
10406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10407%
10408% MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10409% non-linear sigmoidal contrast algorithm. Increase the contrast of the
10410% image using a sigmoidal transfer function without saturating highlights or
10411% shadows. Contrast indicates how much to increase the contrast (0 is none;
10412% 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10413% the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
10414% sharpen to MagickTrue to increase the image contrast otherwise the contrast
10415% is reduced.
10416%
10417% The format of the MagickSigmoidalContrastImage method is:
10418%
10419% MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10420% const MagickBooleanType sharpen,const double alpha,const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010421%
10422% A description of each parameter follows:
10423%
10424% o wand: the magick wand.
10425%
cristy3ed852e2009-09-05 21:47:34 +000010426% o sharpen: Increase or decrease image contrast.
10427%
cristyfa769582010-09-30 23:30:03 +000010428% o alpha: strength of the contrast, the larger the number the more
10429% 'threshold-like' it becomes.
cristy3ed852e2009-09-05 21:47:34 +000010430%
cristyfa769582010-09-30 23:30:03 +000010431% o beta: midpoint of the function as a color value 0 to QuantumRange.
cristy3ed852e2009-09-05 21:47:34 +000010432%
10433*/
cristy9ee60942011-07-06 14:54:38 +000010434WandExport MagickBooleanType MagickSigmoidalContrastImage(
10435 MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10436 const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010437{
10438 MagickBooleanType
10439 status;
10440
10441 assert(wand != (MagickWand *) NULL);
10442 assert(wand->signature == WandSignature);
10443 if (wand->debug != MagickFalse)
10444 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10445 if (wand->images == (Image *) NULL)
10446 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy9ee60942011-07-06 14:54:38 +000010447 status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta);
cristy3ed852e2009-09-05 21:47:34 +000010448 if (status == MagickFalse)
10449 InheritException(wand->exception,&wand->images->exception);
10450 return(status);
10451}
10452
10453/*
10454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10455% %
10456% %
10457% %
10458% M a g i c k S i m i l a r i t y I m a g e %
10459% %
10460% %
10461% %
10462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10463%
10464% MagickSimilarityImage() compares the reference image of the image and
10465% returns the best match offset. In addition, it returns a similarity image
10466% such that an exact match location is completely white and if none of the
10467% pixels match, black, otherwise some gray level in-between.
10468%
10469% The format of the MagickSimilarityImage method is:
10470%
10471% MagickWand *MagickSimilarityImage(MagickWand *wand,
10472% const MagickWand *reference,RectangeInfo *offset,double *similarity)
10473%
10474% A description of each parameter follows:
10475%
10476% o wand: the magick wand.
10477%
10478% o reference: the reference wand.
10479%
10480% o offset: the best match offset of the reference image within the image.
10481%
10482% o similarity: the computed similarity between the images.
10483%
10484*/
10485WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10486 const MagickWand *reference,RectangleInfo *offset,double *similarity)
10487{
10488 Image
10489 *similarity_image;
10490
10491 assert(wand != (MagickWand *) NULL);
10492 assert(wand->signature == WandSignature);
10493 if (wand->debug != MagickFalse)
10494 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10495 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10496 {
10497 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10498 "ContainsNoImages","`%s'",wand->name);
10499 return((MagickWand *) NULL);
10500 }
10501 similarity_image=SimilarityImage(wand->images,reference->images,offset,
10502 similarity,&wand->images->exception);
10503 if (similarity_image == (Image *) NULL)
10504 return((MagickWand *) NULL);
10505 return(CloneMagickWandFromImages(wand,similarity_image));
10506}
10507
10508/*
10509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10510% %
10511% %
10512% %
10513% M a g i c k S k e t c h I m a g e %
10514% %
10515% %
10516% %
10517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10518%
10519% MagickSketchImage() simulates a pencil sketch. We convolve the image with
10520% a Gaussian operator of the given radius and standard deviation (sigma).
10521% For reasonable results, radius should be larger than sigma. Use a
10522% radius of 0 and SketchImage() selects a suitable radius for you.
10523% Angle gives the angle of the blurring motion.
10524%
10525% The format of the MagickSketchImage method is:
10526%
10527% MagickBooleanType MagickSketchImage(MagickWand *wand,
10528% const double radius,const double sigma,const double angle)
10529%
10530% A description of each parameter follows:
10531%
10532% o wand: the magick wand.
10533%
10534% o radius: the radius of the Gaussian, in pixels, not counting
10535% the center pixel.
10536%
10537% o sigma: the standard deviation of the Gaussian, in pixels.
10538%
cristycee97112010-05-28 00:44:52 +000010539% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +000010540%
10541*/
10542WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10543 const double radius,const double sigma,const double angle)
10544{
10545 Image
10546 *sketch_image;
10547
10548 assert(wand != (MagickWand *) NULL);
10549 assert(wand->signature == WandSignature);
10550 if (wand->debug != MagickFalse)
10551 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10552 if (wand->images == (Image *) NULL)
10553 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10554 sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10555 if (sketch_image == (Image *) NULL)
10556 return(MagickFalse);
10557 ReplaceImageInList(&wand->images,sketch_image);
10558 return(MagickTrue);
10559}
10560
10561/*
10562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10563% %
10564% %
10565% %
cristy4285d782011-02-09 20:12:28 +000010566% M a g i c k S m u s h I m a g e s %
10567% %
10568% %
10569% %
10570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10571%
10572% MagickSmushImages() takes all images from the current image pointer to the
10573% end of the image list and smushs them to each other top-to-bottom if the
10574% stack parameter is true, otherwise left-to-right.
10575%
10576% The format of the MagickSmushImages method is:
10577%
10578% MagickWand *MagickSmushImages(MagickWand *wand,
10579% const MagickBooleanType stack,const ssize_t offset)
10580%
10581% A description of each parameter follows:
10582%
10583% o wand: the magick wand.
10584%
10585% o stack: By default, images are stacked left-to-right. Set stack to
10586% MagickTrue to stack them top-to-bottom.
10587%
10588% o offset: minimum distance in pixels between images.
10589%
10590*/
10591WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10592 const MagickBooleanType stack,const ssize_t offset)
10593{
10594 Image
10595 *smush_image;
10596
10597 assert(wand != (MagickWand *) NULL);
10598 assert(wand->signature == WandSignature);
10599 if (wand->debug != MagickFalse)
10600 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10601 if (wand->images == (Image *) NULL)
10602 return((MagickWand *) NULL);
10603 smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10604 if (smush_image == (Image *) NULL)
10605 return((MagickWand *) NULL);
10606 return(CloneMagickWandFromImages(wand,smush_image));
10607}
10608
10609/*
10610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10611% %
10612% %
10613% %
cristy3ed852e2009-09-05 21:47:34 +000010614% M a g i c k S o l a r i z e I m a g e %
10615% %
10616% %
10617% %
10618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10619%
10620% MagickSolarizeImage() applies a special effect to the image, similar to the
10621% effect achieved in a photo darkroom by selectively exposing areas of photo
10622% sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
10623% measure of the extent of the solarization.
10624%
10625% The format of the MagickSolarizeImage method is:
10626%
10627% MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10628% const double threshold)
10629%
10630% A description of each parameter follows:
10631%
10632% o wand: the magick wand.
10633%
10634% o threshold: Define the extent of the solarization.
10635%
10636*/
10637WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10638 const double threshold)
10639{
10640 MagickBooleanType
10641 status;
10642
10643 assert(wand != (MagickWand *) NULL);
10644 assert(wand->signature == WandSignature);
10645 if (wand->debug != MagickFalse)
10646 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10647 if (wand->images == (Image *) NULL)
10648 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10649 status=SolarizeImage(wand->images,threshold);
10650 if (status == MagickFalse)
10651 InheritException(wand->exception,&wand->images->exception);
10652 return(status);
10653}
10654
10655/*
10656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10657% %
10658% %
10659% %
10660% M a g i c k S p a r s e C o l o r I m a g e %
10661% %
10662% %
10663% %
10664%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10665%
10666% MagickSparseColorImage(), given a set of coordinates, interpolates the
10667% colors found at those coordinates, across the whole image, using various
10668% methods.
10669%
10670% The format of the MagickSparseColorImage method is:
10671%
10672% MagickBooleanType MagickSparseColorImage(MagickWand *wand,
cristy3884f692011-07-08 18:00:18 +000010673% const SparseColorMethod method,const size_t number_arguments,
10674% const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000010675%
10676% A description of each parameter follows:
10677%
10678% o image: the image to be sparseed.
10679%
10680% o method: the method of image sparseion.
10681%
10682% ArcSparseColorion will always ignore source image offset, and always
10683% 'bestfit' the destination image with the top left corner offset
10684% relative to the polar mapping center.
10685%
10686% Bilinear has no simple inverse mapping so will not allow 'bestfit'
10687% style of image sparseion.
10688%
10689% Affine, Perspective, and Bilinear, will do least squares fitting of
10690% the distrotion when more than the minimum number of control point
10691% pairs are provided.
10692%
10693% Perspective, and Bilinear, will fall back to a Affine sparseion when
10694% less than 4 control point pairs are provided. While Affine sparseions
10695% will let you use any number of control point pairs, that is Zero pairs
10696% is a No-Op (viewport only) distrotion, one pair is a translation and
10697% two pairs of control points will do a scale-rotate-translate, without
10698% any shearing.
10699%
10700% o number_arguments: the number of arguments given for this sparseion
10701% method.
10702%
10703% o arguments: the arguments for this sparseion method.
10704%
10705*/
10706WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
cristy3884f692011-07-08 18:00:18 +000010707 const SparseColorMethod method,const size_t number_arguments,
10708 const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000010709{
10710 Image
10711 *sparse_image;
10712
10713 assert(wand != (MagickWand *) NULL);
10714 assert(wand->signature == WandSignature);
10715 if (wand->debug != MagickFalse)
10716 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10717 if (wand->images == (Image *) NULL)
10718 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3884f692011-07-08 18:00:18 +000010719 sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10720 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010721 if (sparse_image == (Image *) NULL)
10722 return(MagickFalse);
10723 ReplaceImageInList(&wand->images,sparse_image);
10724 return(MagickTrue);
10725}
10726
10727/*
10728%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10729% %
10730% %
10731% %
10732% M a g i c k S p l i c e I m a g e %
10733% %
10734% %
10735% %
10736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10737%
10738% MagickSpliceImage() splices a solid color into the image.
10739%
10740% The format of the MagickSpliceImage method is:
10741%
10742% MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010743% const size_t width,const size_t height,const ssize_t x,
10744% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010745%
10746% A description of each parameter follows:
10747%
10748% o wand: the magick wand.
10749%
10750% o width: the region width.
10751%
10752% o height: the region height.
10753%
10754% o x: the region x offset.
10755%
10756% o y: the region y offset.
10757%
10758*/
10759WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010760 const size_t width,const size_t height,const ssize_t x,
10761 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010762{
10763 Image
10764 *splice_image;
10765
10766 RectangleInfo
10767 splice;
10768
10769 assert(wand != (MagickWand *) NULL);
10770 assert(wand->signature == WandSignature);
10771 if (wand->debug != MagickFalse)
10772 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10773 if (wand->images == (Image *) NULL)
10774 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10775 splice.width=width;
10776 splice.height=height;
10777 splice.x=x;
10778 splice.y=y;
10779 splice_image=SpliceImage(wand->images,&splice,wand->exception);
10780 if (splice_image == (Image *) NULL)
10781 return(MagickFalse);
10782 ReplaceImageInList(&wand->images,splice_image);
10783 return(MagickTrue);
10784}
10785
10786/*
10787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10788% %
10789% %
10790% %
10791% M a g i c k S p r e a d I m a g e %
10792% %
10793% %
10794% %
10795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10796%
10797% MagickSpreadImage() is a special effects method that randomly displaces each
10798% pixel in a block defined by the radius parameter.
10799%
10800% The format of the MagickSpreadImage method is:
10801%
10802% MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
10803%
10804% A description of each parameter follows:
10805%
10806% o wand: the magick wand.
10807%
10808% o radius: Choose a random pixel in a neighborhood of this extent.
10809%
10810*/
10811WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10812 const double radius)
10813{
10814 Image
10815 *spread_image;
10816
10817 assert(wand != (MagickWand *) NULL);
10818 assert(wand->signature == WandSignature);
10819 if (wand->debug != MagickFalse)
10820 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10821 if (wand->images == (Image *) NULL)
10822 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10823 spread_image=SpreadImage(wand->images,radius,wand->exception);
10824 if (spread_image == (Image *) NULL)
10825 return(MagickFalse);
10826 ReplaceImageInList(&wand->images,spread_image);
10827 return(MagickTrue);
10828}
10829
10830/*
10831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10832% %
10833% %
10834% %
cristy12453682011-03-18 18:45:04 +000010835% M a g i c k S t a t i s t i c I m a g e %
10836% %
10837% %
10838% %
10839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10840%
10841% MagickStatisticImage() replace each pixel with corresponding statistic from
cristy8d752042011-03-19 01:00:36 +000010842% the neighborhood of the specified width and height.
cristy12453682011-03-18 18:45:04 +000010843%
10844% The format of the MagickStatisticImage method is:
10845%
10846% MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristy95c38342011-03-18 22:39:51 +000010847% const StatisticType type,const double width,const size_t height)
cristy12453682011-03-18 18:45:04 +000010848%
10849% A description of each parameter follows:
10850%
10851% o wand: the magick wand.
10852%
cristy12453682011-03-18 18:45:04 +000010853% o type: the statistic type (e.g. median, mode, etc.).
10854%
cristy8d752042011-03-19 01:00:36 +000010855% o width: the width of the pixel neighborhood.
10856%
10857% o height: the height of the pixel neighborhood.
cristy12453682011-03-18 18:45:04 +000010858%
10859*/
10860WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristyf4ad9df2011-07-08 16:49:03 +000010861 const StatisticType type,const size_t width,const size_t height)
cristy12453682011-03-18 18:45:04 +000010862{
10863 Image
10864 *statistic_image;
10865
10866 assert(wand != (MagickWand *) NULL);
10867 assert(wand->signature == WandSignature);
10868 if (wand->debug != MagickFalse)
10869 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10870 if (wand->images == (Image *) NULL)
10871 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000010872 statistic_image=StatisticImage(wand->images,type,width,height,
cristy12453682011-03-18 18:45:04 +000010873 wand->exception);
10874 if (statistic_image == (Image *) NULL)
10875 return(MagickFalse);
10876 ReplaceImageInList(&wand->images,statistic_image);
10877 return(MagickTrue);
10878}
10879
10880/*
10881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10882% %
10883% %
10884% %
cristy3ed852e2009-09-05 21:47:34 +000010885% M a g i c k S t e g a n o I m a g e %
10886% %
10887% %
10888% %
10889%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10890%
10891% MagickSteganoImage() hides a digital watermark within the image.
10892% Recover the hidden watermark later to prove that the authenticity of
10893% an image. Offset defines the start position within the image to hide
10894% the watermark.
10895%
10896% The format of the MagickSteganoImage method is:
10897%
10898% MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010899% const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000010900%
10901% A description of each parameter follows:
10902%
10903% o wand: the magick wand.
10904%
10905% o watermark_wand: the watermark wand.
10906%
10907% o offset: Start hiding at this offset into the image.
10908%
10909*/
10910WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010911 const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000010912{
10913 Image
10914 *stegano_image;
10915
10916 assert(wand != (MagickWand *) NULL);
10917 assert(wand->signature == WandSignature);
10918 if (wand->debug != MagickFalse)
10919 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10920 if ((wand->images == (Image *) NULL) ||
10921 (watermark_wand->images == (Image *) NULL))
10922 {
10923 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10924 "ContainsNoImages","`%s'",wand->name);
10925 return((MagickWand *) NULL);
10926 }
10927 wand->images->offset=offset;
10928 stegano_image=SteganoImage(wand->images,watermark_wand->images,
10929 wand->exception);
10930 if (stegano_image == (Image *) NULL)
10931 return((MagickWand *) NULL);
10932 return(CloneMagickWandFromImages(wand,stegano_image));
10933}
10934
10935/*
10936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10937% %
10938% %
10939% %
10940% M a g i c k S t e r e o I m a g e %
10941% %
10942% %
10943% %
10944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10945%
10946% MagickStereoImage() composites two images and produces a single image that
10947% is the composite of a left and right image of a stereo pair
10948%
10949% The format of the MagickStereoImage method is:
10950%
10951% MagickWand *MagickStereoImage(MagickWand *wand,
10952% const MagickWand *offset_wand)
10953%
10954% A description of each parameter follows:
10955%
10956% o wand: the magick wand.
10957%
10958% o offset_wand: Another image wand.
10959%
10960*/
10961WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10962 const MagickWand *offset_wand)
10963{
10964 Image
10965 *stereo_image;
10966
10967 assert(wand != (MagickWand *) NULL);
10968 assert(wand->signature == WandSignature);
10969 if (wand->debug != MagickFalse)
10970 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10971 if ((wand->images == (Image *) NULL) ||
10972 (offset_wand->images == (Image *) NULL))
10973 {
10974 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10975 "ContainsNoImages","`%s'",wand->name);
10976 return((MagickWand *) NULL);
10977 }
10978 stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10979 if (stereo_image == (Image *) NULL)
10980 return((MagickWand *) NULL);
10981 return(CloneMagickWandFromImages(wand,stereo_image));
10982}
10983
10984/*
10985%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10986% %
10987% %
10988% %
10989% M a g i c k S t r i p I m a g e %
10990% %
10991% %
10992% %
10993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10994%
10995% MagickStripImage() strips an image of all profiles and comments.
10996%
10997% The format of the MagickStripImage method is:
10998%
10999% MagickBooleanType MagickStripImage(MagickWand *wand)
11000%
11001% A description of each parameter follows:
11002%
11003% o wand: the magick wand.
11004%
11005*/
11006WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11007{
11008 MagickBooleanType
11009 status;
11010
11011 assert(wand != (MagickWand *) NULL);
11012 assert(wand->signature == WandSignature);
11013 if (wand->debug != MagickFalse)
11014 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11015 if (wand->images == (Image *) NULL)
11016 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11017 status=StripImage(wand->images);
11018 if (status == MagickFalse)
11019 InheritException(wand->exception,&wand->images->exception);
11020 return(status);
11021}
11022
11023/*
11024%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11025% %
11026% %
11027% %
11028% M a g i c k S w i r l I m a g e %
11029% %
11030% %
11031% %
11032%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11033%
11034% MagickSwirlImage() swirls the pixels about the center of the image, where
11035% degrees indicates the sweep of the arc through which each pixel is moved.
11036% You get a more dramatic effect as the degrees move from 1 to 360.
11037%
11038% The format of the MagickSwirlImage method is:
11039%
11040% MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11041%
11042% A description of each parameter follows:
11043%
11044% o wand: the magick wand.
11045%
11046% o degrees: Define the tightness of the swirling effect.
11047%
11048*/
11049WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11050 const double degrees)
11051{
11052 Image
11053 *swirl_image;
11054
11055 assert(wand != (MagickWand *) NULL);
11056 assert(wand->signature == WandSignature);
11057 if (wand->debug != MagickFalse)
11058 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11059 if (wand->images == (Image *) NULL)
11060 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11061 swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11062 if (swirl_image == (Image *) NULL)
11063 return(MagickFalse);
11064 ReplaceImageInList(&wand->images,swirl_image);
11065 return(MagickTrue);
11066}
11067
11068/*
11069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11070% %
11071% %
11072% %
11073% M a g i c k T e x t u r e I m a g e %
11074% %
11075% %
11076% %
11077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11078%
11079% MagickTextureImage() repeatedly tiles the texture image across and down the
11080% image canvas.
11081%
11082% The format of the MagickTextureImage method is:
11083%
11084% MagickWand *MagickTextureImage(MagickWand *wand,
11085% const MagickWand *texture_wand)
11086%
11087% A description of each parameter follows:
11088%
11089% o wand: the magick wand.
11090%
11091% o texture_wand: the texture wand
11092%
11093*/
11094WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11095 const MagickWand *texture_wand)
11096{
11097 Image
11098 *texture_image;
11099
11100 MagickBooleanType
11101 status;
11102
11103 assert(wand != (MagickWand *) NULL);
11104 assert(wand->signature == WandSignature);
11105 if (wand->debug != MagickFalse)
11106 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11107 if ((wand->images == (Image *) NULL) ||
11108 (texture_wand->images == (Image *) NULL))
11109 {
11110 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11111 "ContainsNoImages","`%s'",wand->name);
11112 return((MagickWand *) NULL);
11113 }
11114 texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11115 if (texture_image == (Image *) NULL)
11116 return((MagickWand *) NULL);
11117 status=TextureImage(texture_image,texture_wand->images);
11118 if (status == MagickFalse)
11119 {
11120 InheritException(wand->exception,&texture_image->exception);
11121 texture_image=DestroyImage(texture_image);
11122 return((MagickWand *) NULL);
11123 }
11124 return(CloneMagickWandFromImages(wand,texture_image));
11125}
11126
11127/*
11128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11129% %
11130% %
11131% %
11132% M a g i c k T h r e s h o l d I m a g e %
11133% %
11134% %
11135% %
11136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11137%
11138% MagickThresholdImage() changes the value of individual pixels based on
11139% the intensity of each pixel compared to threshold. The result is a
11140% high-contrast, two color image.
11141%
11142% The format of the MagickThresholdImage method is:
11143%
11144% MagickBooleanType MagickThresholdImage(MagickWand *wand,
11145% const double threshold)
11146% MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11147% const ChannelType channel,const double threshold)
11148%
11149% A description of each parameter follows:
11150%
11151% o wand: the magick wand.
11152%
11153% o channel: the image channel(s).
11154%
11155% o threshold: Define the threshold value.
11156%
11157*/
11158WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11159 const double threshold)
11160{
11161 MagickBooleanType
11162 status;
11163
11164 status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11165 return(status);
11166}
11167
11168WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11169 const ChannelType channel,const double threshold)
11170{
11171 MagickBooleanType
11172 status;
11173
11174 assert(wand != (MagickWand *) NULL);
11175 assert(wand->signature == WandSignature);
11176 if (wand->debug != MagickFalse)
11177 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11178 if (wand->images == (Image *) NULL)
11179 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000011180 status=BilevelImage(wand->images,threshold);
cristy3ed852e2009-09-05 21:47:34 +000011181 if (status == MagickFalse)
11182 InheritException(wand->exception,&wand->images->exception);
11183 return(status);
11184}
11185
11186/*
11187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11188% %
11189% %
11190% %
11191% M a g i c k T h u m b n a i l I m a g e %
11192% %
11193% %
11194% %
11195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11196%
11197% MagickThumbnailImage() changes the size of an image to the given dimensions
11198% and removes any associated profiles. The goal is to produce small low cost
11199% thumbnail images suited for display on the Web.
11200%
11201% The format of the MagickThumbnailImage method is:
11202%
11203% MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011204% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011205%
11206% A description of each parameter follows:
11207%
11208% o wand: the magick wand.
11209%
11210% o columns: the number of columns in the scaled image.
11211%
11212% o rows: the number of rows in the scaled image.
11213%
11214*/
11215WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011216 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011217{
11218 Image
11219 *thumbnail_image;
11220
11221 assert(wand != (MagickWand *) NULL);
11222 assert(wand->signature == WandSignature);
11223 if (wand->debug != MagickFalse)
11224 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11225 if (wand->images == (Image *) NULL)
11226 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11227 thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11228 if (thumbnail_image == (Image *) NULL)
11229 return(MagickFalse);
11230 ReplaceImageInList(&wand->images,thumbnail_image);
11231 return(MagickTrue);
11232}
11233
11234/*
11235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11236% %
11237% %
11238% %
11239% M a g i c k T i n t I m a g e %
11240% %
11241% %
11242% %
11243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11244%
11245% MagickTintImage() applies a color vector to each pixel in the image. The
11246% length of the vector is 0 for black and white and at its maximum for the
11247% midtones. The vector weighting function is
11248% f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11249%
11250% The format of the MagickTintImage method is:
11251%
11252% MagickBooleanType MagickTintImage(MagickWand *wand,
11253% const PixelWand *tint,const PixelWand *opacity)
11254%
11255% A description of each parameter follows:
11256%
11257% o wand: the magick wand.
11258%
11259% o tint: the tint pixel wand.
11260%
11261% o opacity: the opacity pixel wand.
11262%
11263*/
11264WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11265 const PixelWand *tint,const PixelWand *opacity)
11266{
11267 char
11268 percent_opaque[MaxTextExtent];
11269
11270 Image
11271 *tint_image;
11272
11273 PixelPacket
11274 target;
11275
11276 assert(wand != (MagickWand *) NULL);
11277 assert(wand->signature == WandSignature);
11278 if (wand->debug != MagickFalse)
11279 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11280 if (wand->images == (Image *) NULL)
11281 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +000011282 (void) FormatLocaleString(percent_opaque,MaxTextExtent,
cristye7f51092010-01-17 00:39:37 +000011283 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristy8cd5b312010-01-07 01:10:24 +000011284 PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11285 PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11286 PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11287 PixelGetOpacityQuantum(opacity)));
cristy4c08aed2011-07-01 19:47:50 +000011288 PixelGetQuantumPacket(tint,&target);
cristy3ed852e2009-09-05 21:47:34 +000011289 tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11290 if (tint_image == (Image *) NULL)
11291 return(MagickFalse);
11292 ReplaceImageInList(&wand->images,tint_image);
11293 return(MagickTrue);
11294}
11295
11296/*
11297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11298% %
11299% %
11300% %
11301% M a g i c k T r a n s f o r m I m a g e %
11302% %
11303% %
11304% %
11305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11306%
11307% MagickTransformImage() is a convenience method that behaves like
11308% MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11309% information as a region geometry specification. If the operation fails,
11310% a NULL image handle is returned.
11311%
11312% The format of the MagickTransformImage method is:
11313%
11314% MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11315% const char *geometry)
11316%
11317% A description of each parameter follows:
11318%
11319% o wand: the magick wand.
11320%
11321% o crop: A crop geometry string. This geometry defines a subregion of the
11322% image to crop.
11323%
11324% o geometry: An image geometry string. This geometry defines the final
11325% size of the image.
11326%
11327*/
11328WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11329 const char *crop,const char *geometry)
11330{
11331 Image
11332 *transform_image;
11333
11334 MagickBooleanType
11335 status;
11336
11337 assert(wand != (MagickWand *) NULL);
11338 assert(wand->signature == WandSignature);
11339 if (wand->debug != MagickFalse)
11340 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11341 if (wand->images == (Image *) NULL)
11342 return((MagickWand *) NULL);
11343 transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11344 if (transform_image == (Image *) NULL)
11345 return((MagickWand *) NULL);
11346 status=TransformImage(&transform_image,crop,geometry);
11347 if (status == MagickFalse)
11348 {
11349 InheritException(wand->exception,&transform_image->exception);
11350 transform_image=DestroyImage(transform_image);
11351 return((MagickWand *) NULL);
11352 }
11353 return(CloneMagickWandFromImages(wand,transform_image));
11354}
11355
11356/*
11357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11358% %
11359% %
11360% %
11361% 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 %
11362% %
11363% %
11364% %
11365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11366%
11367% MagickTransformImageColorspace() transform the image colorspace.
11368%
11369% The format of the MagickTransformImageColorspace method is:
11370%
11371% MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11372% const ColorspaceType colorspace)
11373%
11374% A description of each parameter follows:
11375%
11376% o wand: the magick wand.
11377%
11378% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
11379% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11380% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11381% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11382% HSLColorspace, or HWBColorspace.
11383%
11384*/
11385WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11386 const ColorspaceType colorspace)
11387{
11388 assert(wand != (MagickWand *) NULL);
11389 assert(wand->signature == WandSignature);
11390 if (wand->debug != MagickFalse)
11391 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11392 if (wand->images == (Image *) NULL)
11393 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11394 return(TransformImageColorspace(wand->images,colorspace));
11395}
11396
11397/*
11398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11399% %
11400% %
11401% %
11402% 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 %
11403% %
11404% %
11405% %
11406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11407%
11408% MagickTransparentPaintImage() changes any pixel that matches color with the
11409% color defined by fill.
11410%
11411% The format of the MagickTransparentPaintImage method is:
11412%
11413% MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11414% const PixelWand *target,const double alpha,const double fuzz,
11415% const MagickBooleanType invert)
11416%
11417% A description of each parameter follows:
11418%
11419% o wand: the magick wand.
11420%
11421% o target: Change this target color to specified opacity value within
11422% the image.
11423%
11424% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11425% transparent.
11426%
11427% o fuzz: By default target must match a particular pixel color
11428% exactly. However, in many cases two colors may differ by a small amount.
11429% The fuzz member of image defines how much tolerance is acceptable to
11430% consider two colors as the same. For example, set fuzz to 10 and the
11431% color red at intensities of 100 and 102 respectively are now interpreted
11432% as the same color for the purposes of the floodfill.
11433%
11434% o invert: paint any pixel that does not match the target color.
11435%
11436*/
11437WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11438 const PixelWand *target,const double alpha,const double fuzz,
11439 const MagickBooleanType invert)
11440{
11441 MagickBooleanType
11442 status;
11443
cristy4c08aed2011-07-01 19:47:50 +000011444 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000011445 target_pixel;
11446
11447 assert(wand != (MagickWand *) NULL);
11448 assert(wand->signature == WandSignature);
11449 if (wand->debug != MagickFalse)
11450 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11451 if (wand->images == (Image *) NULL)
11452 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11453 PixelGetMagickColor(target,&target_pixel);
11454 wand->images->fuzz=fuzz;
cristyce70c172010-01-07 17:15:30 +000011455 status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
cristy4c08aed2011-07-01 19:47:50 +000011456 QuantumRange*alpha),invert);
cristy3ed852e2009-09-05 21:47:34 +000011457 if (status == MagickFalse)
11458 InheritException(wand->exception,&wand->images->exception);
11459 return(status);
11460}
11461
11462/*
11463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11464% %
11465% %
11466% %
11467% M a g i c k T r a n s p o s e I m a g e %
11468% %
11469% %
11470% %
11471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11472%
11473% MagickTransposeImage() creates a vertical mirror image by reflecting the
11474% pixels around the central x-axis while rotating them 90-degrees.
11475%
11476% The format of the MagickTransposeImage method is:
11477%
11478% MagickBooleanType MagickTransposeImage(MagickWand *wand)
11479%
11480% A description of each parameter follows:
11481%
11482% o wand: the magick wand.
11483%
11484*/
11485WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11486{
11487 Image
11488 *transpose_image;
11489
11490 assert(wand != (MagickWand *) NULL);
11491 assert(wand->signature == WandSignature);
11492 if (wand->debug != MagickFalse)
11493 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11494 if (wand->images == (Image *) NULL)
11495 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11496 transpose_image=TransposeImage(wand->images,wand->exception);
11497 if (transpose_image == (Image *) NULL)
11498 return(MagickFalse);
11499 ReplaceImageInList(&wand->images,transpose_image);
11500 return(MagickTrue);
11501}
11502
11503/*
11504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11505% %
11506% %
11507% %
11508% M a g i c k T r a n s v e r s e I m a g e %
11509% %
11510% %
11511% %
11512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11513%
11514% MagickTransverseImage() creates a horizontal mirror image by reflecting the
11515% pixels around the central y-axis while rotating them 270-degrees.
11516%
11517% The format of the MagickTransverseImage method is:
11518%
11519% MagickBooleanType MagickTransverseImage(MagickWand *wand)
11520%
11521% A description of each parameter follows:
11522%
11523% o wand: the magick wand.
11524%
11525*/
11526WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11527{
11528 Image
11529 *transverse_image;
11530
11531 assert(wand != (MagickWand *) NULL);
11532 assert(wand->signature == WandSignature);
11533 if (wand->debug != MagickFalse)
11534 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11535 if (wand->images == (Image *) NULL)
11536 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11537 transverse_image=TransverseImage(wand->images,wand->exception);
11538 if (transverse_image == (Image *) NULL)
11539 return(MagickFalse);
11540 ReplaceImageInList(&wand->images,transverse_image);
11541 return(MagickTrue);
11542}
11543
11544/*
11545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11546% %
11547% %
11548% %
11549% M a g i c k T r i m I m a g e %
11550% %
11551% %
11552% %
11553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11554%
11555% MagickTrimImage() remove edges that are the background color from the image.
11556%
11557% The format of the MagickTrimImage method is:
11558%
11559% MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11560%
11561% A description of each parameter follows:
11562%
11563% o wand: the magick wand.
11564%
11565% o fuzz: By default target must match a particular pixel color
11566% exactly. However, in many cases two colors may differ by a small amount.
11567% The fuzz member of image defines how much tolerance is acceptable to
11568% consider two colors as the same. For example, set fuzz to 10 and the
11569% color red at intensities of 100 and 102 respectively are now interpreted
11570% as the same color for the purposes of the floodfill.
11571%
11572*/
11573WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11574{
11575 Image
11576 *trim_image;
11577
11578 assert(wand != (MagickWand *) NULL);
11579 assert(wand->signature == WandSignature);
11580 if (wand->debug != MagickFalse)
11581 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11582 if (wand->images == (Image *) NULL)
11583 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11584 wand->images->fuzz=fuzz;
11585 trim_image=TrimImage(wand->images,wand->exception);
11586 if (trim_image == (Image *) NULL)
11587 return(MagickFalse);
11588 ReplaceImageInList(&wand->images,trim_image);
11589 return(MagickTrue);
11590}
11591
11592/*
11593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11594% %
11595% %
11596% %
11597% M a g i c k U n i q u e I m a g e C o l o r s %
11598% %
11599% %
11600% %
11601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11602%
11603% MagickUniqueImageColors() discards all but one of any pixel color.
11604%
11605% The format of the MagickUniqueImageColors method is:
11606%
11607% MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11608%
11609% A description of each parameter follows:
11610%
11611% o wand: the magick wand.
11612%
11613*/
11614WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11615{
11616 Image
11617 *unique_image;
11618
11619 assert(wand != (MagickWand *) NULL);
11620 assert(wand->signature == WandSignature);
11621 if (wand->debug != MagickFalse)
11622 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11623 if (wand->images == (Image *) NULL)
11624 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11625 unique_image=UniqueImageColors(wand->images,wand->exception);
11626 if (unique_image == (Image *) NULL)
11627 return(MagickFalse);
11628 ReplaceImageInList(&wand->images,unique_image);
11629 return(MagickTrue);
11630}
11631
11632/*
11633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11634% %
11635% %
11636% %
11637% M a g i c k U n s h a r p M a s k I m a g e %
11638% %
11639% %
11640% %
11641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11642%
11643% MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
11644% Gaussian operator of the given radius and standard deviation (sigma).
11645% For reasonable results, radius should be larger than sigma. Use a radius
11646% of 0 and UnsharpMaskImage() selects a suitable radius for you.
11647%
11648% The format of the MagickUnsharpMaskImage method is:
11649%
11650% MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11651% const double radius,const double sigma,const double amount,
11652% const double threshold)
cristy3ed852e2009-09-05 21:47:34 +000011653%
11654% A description of each parameter follows:
11655%
11656% o wand: the magick wand.
11657%
cristy3ed852e2009-09-05 21:47:34 +000011658% o radius: the radius of the Gaussian, in pixels, not counting the center
11659% pixel.
11660%
11661% o sigma: the standard deviation of the Gaussian, in pixels.
11662%
11663% o amount: the percentage of the difference between the original and the
11664% blur image that is added back into the original.
11665%
11666% o threshold: the threshold in pixels needed to apply the diffence amount.
11667%
11668*/
cristy3ed852e2009-09-05 21:47:34 +000011669WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11670 const double radius,const double sigma,const double amount,
11671 const double threshold)
11672{
cristy3ed852e2009-09-05 21:47:34 +000011673 Image
11674 *unsharp_image;
11675
11676 assert(wand != (MagickWand *) NULL);
11677 assert(wand->signature == WandSignature);
11678 if (wand->debug != MagickFalse)
11679 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11680 if (wand->images == (Image *) NULL)
11681 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000011682 unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11683 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011684 if (unsharp_image == (Image *) NULL)
11685 return(MagickFalse);
11686 ReplaceImageInList(&wand->images,unsharp_image);
11687 return(MagickTrue);
11688}
11689
11690/*
11691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11692% %
11693% %
11694% %
11695% M a g i c k V i g n e t t e I m a g e %
11696% %
11697% %
11698% %
11699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11700%
11701% MagickVignetteImage() softens the edges of the image in vignette style.
11702%
11703% The format of the MagickVignetteImage method is:
11704%
11705% MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011706% const double black_point,const double white_point,const ssize_t x,
11707% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011708%
11709% A description of each parameter follows:
11710%
11711% o wand: the magick wand.
11712%
11713% o black_point: the black point.
11714%
11715% o white_point: the white point.
11716%
11717% o x, y: Define the x and y ellipse offset.
11718%
11719*/
11720WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011721 const double black_point,const double white_point,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011722{
11723 Image
11724 *vignette_image;
11725
11726 assert(wand != (MagickWand *) NULL);
11727 assert(wand->signature == WandSignature);
11728 if (wand->debug != MagickFalse)
11729 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11730 if (wand->images == (Image *) NULL)
11731 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11732 vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11733 wand->exception);
11734 if (vignette_image == (Image *) NULL)
11735 return(MagickFalse);
11736 ReplaceImageInList(&wand->images,vignette_image);
11737 return(MagickTrue);
11738}
11739
11740/*
11741%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11742% %
11743% %
11744% %
11745% M a g i c k W a v e I m a g e %
11746% %
11747% %
11748% %
11749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11750%
11751% MagickWaveImage() creates a "ripple" effect in the image by shifting
cristycee97112010-05-28 00:44:52 +000011752% the pixels vertically along a sine wave whose amplitude and wavelength
cristy3ed852e2009-09-05 21:47:34 +000011753% is specified by the given parameters.
11754%
11755% The format of the MagickWaveImage method is:
11756%
11757% MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11758% const double wave_length)
11759%
11760% A description of each parameter follows:
11761%
11762% o wand: the magick wand.
11763%
11764% o amplitude, wave_length: Define the amplitude and wave length of the
11765% sine wave.
11766%
11767*/
11768WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11769 const double amplitude,const double wave_length)
11770{
11771 Image
11772 *wave_image;
11773
11774 assert(wand != (MagickWand *) NULL);
11775 assert(wand->signature == WandSignature);
11776 if (wand->debug != MagickFalse)
11777 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11778 if (wand->images == (Image *) NULL)
11779 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11780 wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11781 if (wave_image == (Image *) NULL)
11782 return(MagickFalse);
11783 ReplaceImageInList(&wand->images,wave_image);
11784 return(MagickTrue);
11785}
11786
11787/*
11788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11789% %
11790% %
11791% %
11792% 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 %
11793% %
11794% %
11795% %
11796%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11797%
11798% MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
11799% above the threshold into white while leaving all pixels below the threshold
11800% unchanged.
11801%
11802% The format of the MagickWhiteThresholdImage method is:
11803%
11804% MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11805% const PixelWand *threshold)
11806%
11807% A description of each parameter follows:
11808%
11809% o wand: the magick wand.
11810%
11811% o threshold: the pixel wand.
11812%
11813*/
11814WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11815 const PixelWand *threshold)
11816{
11817 char
11818 thresholds[MaxTextExtent];
11819
11820 MagickBooleanType
11821 status;
11822
11823 assert(wand != (MagickWand *) NULL);
11824 assert(wand->signature == WandSignature);
11825 if (wand->debug != MagickFalse)
11826 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11827 if (wand->images == (Image *) NULL)
11828 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +000011829 (void) FormatLocaleString(thresholds,MaxTextExtent,
cristy3ed852e2009-09-05 21:47:34 +000011830 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11831 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11832 PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
cristyf4ad9df2011-07-08 16:49:03 +000011833 status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +000011834 if (status == MagickFalse)
11835 InheritException(wand->exception,&wand->images->exception);
11836 return(status);
11837}
11838
11839/*
11840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11841% %
11842% %
11843% %
11844% M a g i c k W r i t e I m a g e %
11845% %
11846% %
11847% %
11848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11849%
11850% MagickWriteImage() writes an image to the specified filename. If the
11851% filename parameter is NULL, the image is written to the filename set
11852% by MagickReadImage() or MagickSetImageFilename().
11853%
11854% The format of the MagickWriteImage method is:
11855%
11856% MagickBooleanType MagickWriteImage(MagickWand *wand,
11857% const char *filename)
11858%
11859% A description of each parameter follows:
11860%
11861% o wand: the magick wand.
11862%
11863% o filename: the image filename.
11864%
11865%
11866*/
11867WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11868 const char *filename)
11869{
11870 Image
11871 *image;
11872
11873 ImageInfo
11874 *write_info;
11875
11876 MagickBooleanType
11877 status;
11878
11879 assert(wand != (MagickWand *) NULL);
11880 assert(wand->signature == WandSignature);
11881 if (wand->debug != MagickFalse)
11882 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11883 if (wand->images == (Image *) NULL)
11884 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11885 if (filename != (const char *) NULL)
11886 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11887 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11888 if (image == (Image *) NULL)
11889 return(MagickFalse);
11890 write_info=CloneImageInfo(wand->image_info);
11891 write_info->adjoin=MagickTrue;
11892 status=WriteImage(write_info,image);
11893 if (status == MagickFalse)
11894 InheritException(wand->exception,&image->exception);
11895 image=DestroyImage(image);
11896 write_info=DestroyImageInfo(write_info);
11897 return(status);
11898}
11899
11900/*
11901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11902% %
11903% %
11904% %
11905% M a g i c k W r i t e I m a g e F i l e %
11906% %
11907% %
11908% %
11909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11910%
11911% MagickWriteImageFile() writes an image to an open file descriptor.
11912%
11913% The format of the MagickWriteImageFile method is:
11914%
11915% MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11916%
11917% A description of each parameter follows:
11918%
11919% o wand: the magick wand.
11920%
11921% o file: the file descriptor.
11922%
cristy3ed852e2009-09-05 21:47:34 +000011923*/
11924WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11925{
11926 Image
11927 *image;
11928
11929 ImageInfo
11930 *write_info;
11931
11932 MagickBooleanType
11933 status;
11934
11935 assert(wand != (MagickWand *) NULL);
11936 assert(wand->signature == WandSignature);
11937 assert(file != (FILE *) NULL);
11938 if (wand->debug != MagickFalse)
11939 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11940 if (wand->images == (Image *) NULL)
11941 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11942 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11943 if (image == (Image *) NULL)
11944 return(MagickFalse);
11945 write_info=CloneImageInfo(wand->image_info);
11946 SetImageInfoFile(write_info,file);
11947 write_info->adjoin=MagickTrue;
11948 status=WriteImage(write_info,image);
11949 write_info=DestroyImageInfo(write_info);
11950 if (status == MagickFalse)
11951 InheritException(wand->exception,&image->exception);
11952 image=DestroyImage(image);
11953 return(status);
11954}
11955
11956/*
11957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11958% %
11959% %
11960% %
11961% M a g i c k W r i t e I m a g e s %
11962% %
11963% %
11964% %
11965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11966%
11967% MagickWriteImages() writes an image or image sequence.
11968%
11969% The format of the MagickWriteImages method is:
11970%
11971% MagickBooleanType MagickWriteImages(MagickWand *wand,
11972% const char *filename,const MagickBooleanType adjoin)
11973%
11974% A description of each parameter follows:
11975%
11976% o wand: the magick wand.
11977%
11978% o filename: the image filename.
11979%
11980% o adjoin: join images into a single multi-image file.
11981%
11982*/
11983WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11984 const char *filename,const MagickBooleanType adjoin)
11985{
11986 ImageInfo
11987 *write_info;
11988
11989 MagickBooleanType
11990 status;
11991
11992 assert(wand != (MagickWand *) NULL);
11993 assert(wand->signature == WandSignature);
11994 if (wand->debug != MagickFalse)
11995 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11996 if (wand->images == (Image *) NULL)
11997 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11998 write_info=CloneImageInfo(wand->image_info);
11999 write_info->adjoin=adjoin;
12000 status=WriteImages(write_info,wand->images,filename,wand->exception);
12001 if (status == MagickFalse)
12002 InheritException(wand->exception,&wand->images->exception);
12003 write_info=DestroyImageInfo(write_info);
12004 return(status);
12005}
12006
12007/*
12008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12009% %
12010% %
12011% %
12012% M a g i c k W r i t e I m a g e s F i l e %
12013% %
12014% %
12015% %
12016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12017%
12018% MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12019%
12020% The format of the MagickWriteImagesFile method is:
12021%
12022% MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12023%
12024% A description of each parameter follows:
12025%
12026% o wand: the magick wand.
12027%
12028% o file: the file descriptor.
12029%
12030*/
12031WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12032{
12033 ImageInfo
12034 *write_info;
12035
12036 MagickBooleanType
12037 status;
12038
12039 assert(wand != (MagickWand *) NULL);
12040 assert(wand->signature == WandSignature);
12041 if (wand->debug != MagickFalse)
12042 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12043 if (wand->images == (Image *) NULL)
12044 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12045 write_info=CloneImageInfo(wand->image_info);
12046 SetImageInfoFile(write_info,file);
12047 write_info->adjoin=MagickTrue;
12048 status=WriteImages(write_info,wand->images,(const char *) NULL,
12049 wand->exception);
12050 write_info=DestroyImageInfo(write_info);
12051 if (status == MagickFalse)
12052 InheritException(wand->exception,&wand->images->exception);
12053 return(status);
12054}