blob: 21bdf0c7d8efdb2a98a3e567a050826371c07e41 [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,
cristy4c11c2b2011-09-05 20:17:07 +0000180% const double radius,const double sigma,const double bias)
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%
cristy4c11c2b2011-09-05 20:17:07 +0000191% o bias: the bias.
192%
cristy3ed852e2009-09-05 21:47:34 +0000193*/
cristy3ed852e2009-09-05 21:47:34 +0000194WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
cristy4c11c2b2011-09-05 20:17:07 +0000195 const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000196{
cristy3ed852e2009-09-05 21:47:34 +0000197 Image
198 *sharp_image;
199
200 assert(wand != (MagickWand *) NULL);
201 assert(wand->signature == WandSignature);
202 if (wand->debug != MagickFalse)
203 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
204 if (wand->images == (Image *) NULL)
205 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c11c2b2011-09-05 20:17:07 +0000206 sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,bias,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000207 if (sharp_image == (Image *) NULL)
208 return(MagickFalse);
209 ReplaceImageInList(&wand->images,sharp_image);
210 return(MagickTrue);
211}
212
213/*
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215% %
216% %
217% %
218% 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 %
219% %
220% %
221% %
222%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223%
224% MagickAdaptiveResizeImage() adaptively resize image with data dependent
225% triangulation.
226%
227% MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +0000228% const size_t columns,const size_t rows,
229% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +0000230%
231% A description of each parameter follows:
232%
233% o wand: the magick wand.
234%
235% o columns: the number of columns in the scaled image.
236%
237% o rows: the number of rows in the scaled image.
238%
cristy5c4e2582011-09-11 19:21:03 +0000239% o interpolate: the pixel interpolation method.
240%
cristy3ed852e2009-09-05 21:47:34 +0000241*/
242WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +0000243 const size_t columns,const size_t rows,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +0000244{
245 Image
246 *resize_image;
247
248 assert(wand != (MagickWand *) NULL);
249 assert(wand->signature == WandSignature);
250 if (wand->debug != MagickFalse)
251 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
252 if (wand->images == (Image *) NULL)
253 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +0000254 resize_image=AdaptiveResizeImage(wand->images,columns,rows,method,
255 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000256 if (resize_image == (Image *) NULL)
257 return(MagickFalse);
258 ReplaceImageInList(&wand->images,resize_image);
259 return(MagickTrue);
260}
261
262/*
263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264% %
265% %
266% %
267% 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 %
268% %
269% %
270% %
271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
272%
273% MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
274% more intensely near image edges and less intensely far from edges. We
275% sharpen the image with a Gaussian operator of the given radius and standard
276% deviation (sigma). For reasonable results, radius should be larger than
277% sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
278% suitable radius for you.
279%
280% The format of the MagickAdaptiveSharpenImage method is:
281%
282% MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
cristy4c11c2b2011-09-05 20:17:07 +0000283% const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000284%
285% A description of each parameter follows:
286%
287% o wand: the magick wand.
288%
cristy3ed852e2009-09-05 21:47:34 +0000289% o radius: the radius of the Gaussian, in pixels, not counting the center
290% pixel.
291%
292% o sigma: the standard deviation of the Gaussian, in pixels.
293%
cristy4c11c2b2011-09-05 20:17:07 +0000294% o bias: the bias.
295%
cristy3ed852e2009-09-05 21:47:34 +0000296*/
cristy3ed852e2009-09-05 21:47:34 +0000297WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
cristy4c11c2b2011-09-05 20:17:07 +0000298 const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000299{
cristy3ed852e2009-09-05 21:47:34 +0000300 Image
301 *sharp_image;
302
303 assert(wand != (MagickWand *) NULL);
304 assert(wand->signature == WandSignature);
305 if (wand->debug != MagickFalse)
306 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
307 if (wand->images == (Image *) NULL)
308 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c11c2b2011-09-05 20:17:07 +0000309 sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
310 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000311 if (sharp_image == (Image *) NULL)
312 return(MagickFalse);
313 ReplaceImageInList(&wand->images,sharp_image);
314 return(MagickTrue);
315}
316
317/*
318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319% %
320% %
321% %
322% 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 %
323% %
324% %
325% %
326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327%
328% MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
329% based on the range of intensity values in its local neighborhood. This
330% allows for thresholding of an image whose global intensity histogram
331% doesn't contain distinctive peaks.
332%
333% The format of the AdaptiveThresholdImage method is:
334%
335% MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristy5f07f702011-09-26 17:29:10 +0000336% const size_t width,const size_t height,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000337%
338% A description of each parameter follows:
339%
340% o wand: the magick wand.
341%
342% o width: the width of the local neighborhood.
343%
344% o height: the height of the local neighborhood.
345%
cristy5f07f702011-09-26 17:29:10 +0000346% o offset: the mean bias.
cristy3ed852e2009-09-05 21:47:34 +0000347%
348*/
349WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristy5f07f702011-09-26 17:29:10 +0000350 const size_t width,const size_t height,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000351{
352 Image
353 *threshold_image;
354
355 assert(wand != (MagickWand *) NULL);
356 assert(wand->signature == WandSignature);
357 if (wand->debug != MagickFalse)
358 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
359 if (wand->images == (Image *) NULL)
360 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f07f702011-09-26 17:29:10 +0000361 threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
cristy3ed852e2009-09-05 21:47:34 +0000362 wand->exception);
363 if (threshold_image == (Image *) NULL)
364 return(MagickFalse);
365 ReplaceImageInList(&wand->images,threshold_image);
366 return(MagickTrue);
367}
368
369/*
370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371% %
372% %
373% %
374% M a g i c k A d d I m a g e %
375% %
376% %
377% %
378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379%
anthonya89dd172011-10-04 13:29:35 +0000380% MagickAddImage() adds a clone of the images in the second wand and
381% inserts them into the first wand, at the current image location.
382%
383% Use MagickSetFirstIterator(), to insert new images before all the current
384% images in the wand, otherwise image is placed after the current image.
cristy3ed852e2009-09-05 21:47:34 +0000385%
386% The format of the MagickAddImage method is:
387%
388% MagickBooleanType MagickAddImage(MagickWand *wand,
389% const MagickWand *add_wand)
390%
391% A description of each parameter follows:
392%
393% o wand: the magick wand.
394%
395% o add_wand: A wand that contains images to add at the current image
396% location.
397%
398*/
399
400static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
401 Image *images)
402{
403 Image
anthonya89dd172011-10-04 13:29:35 +0000404 *current;
cristy3ed852e2009-09-05 21:47:34 +0000405
anthonya89dd172011-10-04 13:29:35 +0000406 current=wand->images; /* note the current image */
407
408 /* if no images in wand, just add them and set first image as current */
409 if (current == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000410 {
411 wand->images=GetFirstImageInList(images);
412 return(MagickTrue);
413 }
anthonya89dd172011-10-04 13:29:35 +0000414
415 /* user jumped to first image, so prepend new images - remain active */
416 if ((wand->set_first != MagickFalse) &&
417 (current->previous == (Image *) NULL) )
cristy3ed852e2009-09-05 21:47:34 +0000418 {
anthonya89dd172011-10-04 13:29:35 +0000419 PrependImageToList(&current,images);
420 wand->images=GetFirstImageInList(images);
421 return(MagickTrue);
422 }
423 wand->set_first = MagickFalse; /* flag no longer valid */
424
425 /* Current image was flaged as 'pending' iterative processing. */
426 if (wand->image_pending != MagickFalse)
427 {
428 /* current pending image is the last, append new images */
429 if (current->next == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000430 {
anthonya89dd172011-10-04 13:29:35 +0000431 AppendImageToList(&current,images);
cristy3ed852e2009-09-05 21:47:34 +0000432 wand->images=GetLastImageInList(images);
433 return(MagickTrue);
434 }
anthonya89dd172011-10-04 13:29:35 +0000435 /* current pending image is the first image, prepend it */
436 if (current->previous == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000437 {
anthonya89dd172011-10-04 13:29:35 +0000438 PrependImageToList(&current,images);
cristy3ed852e2009-09-05 21:47:34 +0000439 wand->images=GetFirstImageInList(images);
440 return(MagickTrue);
441 }
442 }
anthonya89dd172011-10-04 13:29:35 +0000443
444 /* if at last image append new images */
445 if (current->next == (Image *) NULL)
cristy2e74b0f2010-09-01 19:42:26 +0000446 {
anthonya89dd172011-10-04 13:29:35 +0000447 InsertImageInList(&current,images);
cristy2e74b0f2010-09-01 19:42:26 +0000448 wand->images=GetLastImageInList(images);
449 return(MagickTrue);
450 }
anthonya89dd172011-10-04 13:29:35 +0000451 /* otherwise just insert image, just after the current image */
452 InsertImageInList(&current,images);
cristy3ed852e2009-09-05 21:47:34 +0000453 wand->images=GetFirstImageInList(images);
454 return(MagickTrue);
455}
456
457WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
458 const MagickWand *add_wand)
459{
460 Image
461 *images;
462
463 assert(wand != (MagickWand *) NULL);
464 assert(wand->signature == WandSignature);
465 if (wand->debug != MagickFalse)
466 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
467 assert(add_wand != (MagickWand *) NULL);
468 assert(add_wand->signature == WandSignature);
469 if (add_wand->images == (Image *) NULL)
470 ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
anthonya89dd172011-10-04 13:29:35 +0000471
472 /* clone images in second wand, and insert into first */
cristy3ed852e2009-09-05 21:47:34 +0000473 images=CloneImageList(add_wand->images,wand->exception);
474 if (images == (Image *) NULL)
475 return(MagickFalse);
476 return(InsertImageInWand(wand,images));
477}
478
479/*
480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481% %
482% %
483% %
484% M a g i c k A d d N o i s e I m a g e %
485% %
486% %
487% %
488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489%
490% MagickAddNoiseImage() adds random noise to the image.
491%
492% The format of the MagickAddNoiseImage method is:
493%
494% MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
cristy9ed1f812011-10-08 02:00:08 +0000495% const NoiseType noise_type,const double attenuate)
cristy3ed852e2009-09-05 21:47:34 +0000496%
497% A description of each parameter follows:
498%
499% o wand: the magick wand.
500%
cristy3ed852e2009-09-05 21:47:34 +0000501% o noise_type: The type of noise: Uniform, Gaussian, Multiplicative,
502% Impulse, Laplacian, or Poisson.
503%
cristy9ed1f812011-10-08 02:00:08 +0000504% o attenuate: attenuate the random distribution.
505%
cristy3ed852e2009-09-05 21:47:34 +0000506*/
cristy3ed852e2009-09-05 21:47:34 +0000507WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
cristy9ed1f812011-10-08 02:00:08 +0000508 const NoiseType noise_type,const double attenuate)
cristy3ed852e2009-09-05 21:47:34 +0000509{
cristy3ed852e2009-09-05 21:47:34 +0000510 Image
511 *noise_image;
512
513 assert(wand != (MagickWand *) NULL);
514 assert(wand->signature == WandSignature);
515 if (wand->debug != MagickFalse)
516 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
517 if (wand->images == (Image *) NULL)
518 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy9ed1f812011-10-08 02:00:08 +0000519 noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000520 if (noise_image == (Image *) NULL)
521 return(MagickFalse);
522 ReplaceImageInList(&wand->images,noise_image);
523 return(MagickTrue);
524}
525
526/*
527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
528% %
529% %
530% %
531% 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 %
532% %
533% %
534% %
535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
536%
537% MagickAffineTransformImage() transforms an image as dictated by the affine
538% matrix of the drawing wand.
539%
540% The format of the MagickAffineTransformImage method is:
541%
542% MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
543% const DrawingWand *drawing_wand)
544%
545% A description of each parameter follows:
546%
547% o wand: the magick wand.
548%
549% o drawing_wand: the draw wand.
550%
551*/
552WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
553 const DrawingWand *drawing_wand)
554{
555 DrawInfo
556 *draw_info;
557
558 Image
559 *affine_image;
560
561 assert(wand != (MagickWand *) NULL);
562 assert(wand->signature == WandSignature);
563 if (wand->debug != MagickFalse)
564 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
565 if (wand->images == (Image *) NULL)
566 ThrowWandException(WandError,"ContainsNoImages",wand->name);
567 draw_info=PeekDrawingWand(drawing_wand);
568 if (draw_info == (DrawInfo *) NULL)
569 return(MagickFalse);
570 affine_image=AffineTransformImage(wand->images,&draw_info->affine,
571 wand->exception);
572 draw_info=DestroyDrawInfo(draw_info);
573 if (affine_image == (Image *) NULL)
574 return(MagickFalse);
575 ReplaceImageInList(&wand->images,affine_image);
576 return(MagickTrue);
577}
578
579/*
580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581% %
582% %
583% %
584% M a g i c k A n n o t a t e I m a g e %
585% %
586% %
587% %
588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589%
590% MagickAnnotateImage() annotates an image with text.
591%
592% The format of the MagickAnnotateImage method is:
593%
594% MagickBooleanType MagickAnnotateImage(MagickWand *wand,
595% const DrawingWand *drawing_wand,const double x,const double y,
596% const double angle,const char *text)
597%
598% A description of each parameter follows:
599%
600% o wand: the magick wand.
601%
602% o drawing_wand: the draw wand.
603%
604% o x: x ordinate to left of text
605%
606% o y: y ordinate to text baseline
607%
608% o angle: rotate text relative to this angle.
609%
610% o text: text to draw
611%
612*/
613WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
614 const DrawingWand *drawing_wand,const double x,const double y,
615 const double angle,const char *text)
616{
617 char
618 geometry[MaxTextExtent];
619
620 DrawInfo
621 *draw_info;
622
623 MagickBooleanType
624 status;
625
626 assert(wand != (MagickWand *) NULL);
627 assert(wand->signature == WandSignature);
628 if (wand->debug != MagickFalse)
629 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
630 if (wand->images == (Image *) NULL)
631 ThrowWandException(WandError,"ContainsNoImages",wand->name);
632 draw_info=PeekDrawingWand(drawing_wand);
633 if (draw_info == (DrawInfo *) NULL)
634 return(MagickFalse);
635 (void) CloneString(&draw_info->text,text);
cristyb51dff52011-05-19 16:55:47 +0000636 (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
cristy5f07f702011-09-26 17:29:10 +0000637 draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
638 draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
639 draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
640 draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
cristy3ed852e2009-09-05 21:47:34 +0000641 (void) CloneString(&draw_info->geometry,geometry);
cristy5cbc0162011-08-29 00:36:28 +0000642 status=AnnotateImage(wand->images,draw_info,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000643 draw_info=DestroyDrawInfo(draw_info);
cristy3ed852e2009-09-05 21:47:34 +0000644 return(status);
645}
646
647/*
648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
649% %
650% %
651% %
652% M a g i c k A n i m a t e I m a g e s %
653% %
654% %
655% %
656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657%
658% MagickAnimateImages() animates an image or image sequence.
659%
660% The format of the MagickAnimateImages method is:
661%
662% MagickBooleanType MagickAnimateImages(MagickWand *wand,
663% const char *server_name)
664%
665% A description of each parameter follows:
666%
667% o wand: the magick wand.
668%
669% o server_name: the X server name.
670%
671*/
672WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
673 const char *server_name)
674{
675 MagickBooleanType
676 status;
677
678 assert(wand != (MagickWand *) NULL);
679 assert(wand->signature == WandSignature);
680 if (wand->debug != MagickFalse)
681 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
682 (void) CloneString(&wand->image_info->server_name,server_name);
cristy051718b2011-08-28 22:49:25 +0000683 status=AnimateImages(wand->image_info,wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000684 return(status);
685}
686
687/*
688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
689% %
690% %
691% %
692% M a g i c k A p p e n d I m a g e s %
693% %
694% %
695% %
696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
697%
698% MagickAppendImages() append a set of images.
699%
700% The format of the MagickAppendImages method is:
701%
702% MagickWand *MagickAppendImages(MagickWand *wand,
703% const MagickBooleanType stack)
704%
705% A description of each parameter follows:
706%
707% o wand: the magick wand.
708%
709% o stack: By default, images are stacked left-to-right. Set stack to
710% MagickTrue to stack them top-to-bottom.
711%
712*/
713WandExport MagickWand *MagickAppendImages(MagickWand *wand,
714 const MagickBooleanType stack)
715{
716 Image
717 *append_image;
718
719 assert(wand != (MagickWand *) NULL);
720 assert(wand->signature == WandSignature);
721 if (wand->debug != MagickFalse)
722 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
723 if (wand->images == (Image *) NULL)
724 return((MagickWand *) NULL);
725 append_image=AppendImages(wand->images,stack,wand->exception);
726 if (append_image == (Image *) NULL)
727 return((MagickWand *) NULL);
728 return(CloneMagickWandFromImages(wand,append_image));
729}
730
731/*
732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
733% %
734% %
735% %
736% M a g i c k A u t o G a m m a I m a g e %
737% %
738% %
739% %
740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
741%
742% MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
743% image to try make set its gamma appropriatally.
744%
745% The format of the MagickAutoGammaImage method is:
746%
747% MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000748%
749% A description of each parameter follows:
750%
751% o wand: the magick wand.
752%
cristy3ed852e2009-09-05 21:47:34 +0000753*/
754WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
755{
756 MagickBooleanType
757 status;
758
cristy3ed852e2009-09-05 21:47:34 +0000759 assert(wand != (MagickWand *) NULL);
760 assert(wand->signature == WandSignature);
761 if (wand->debug != MagickFalse)
762 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
763 if (wand->images == (Image *) NULL)
764 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy95111202011-08-09 19:41:42 +0000765 status=AutoGammaImage(wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000766 return(status);
767}
768
769/*
770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
771% %
772% %
773% %
774% M a g i c k A u t o L e v e l I m a g e %
775% %
776% %
777% %
778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779%
780% MagickAutoLevelImage() adjusts the levels of a particular image channel by
781% scaling the minimum and maximum values to the full quantum range.
782%
783% The format of the MagickAutoLevelImage method is:
784%
785% MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000786%
787% A description of each parameter follows:
788%
789% o wand: the magick wand.
790%
cristy3ed852e2009-09-05 21:47:34 +0000791*/
792WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
793{
794 MagickBooleanType
795 status;
796
cristy3ed852e2009-09-05 21:47:34 +0000797 assert(wand != (MagickWand *) NULL);
798 assert(wand->signature == WandSignature);
799 if (wand->debug != MagickFalse)
800 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
801 if (wand->images == (Image *) NULL)
802 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy95111202011-08-09 19:41:42 +0000803 status=AutoLevelImage(wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000804 return(status);
805}
806
807/*
808%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
809% %
810% %
811% %
cristy3ed852e2009-09-05 21:47:34 +0000812% 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 %
813% %
814% %
815% %
816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
817%
818% MagickBlackThresholdImage() is like MagickThresholdImage() but forces all
819% pixels below the threshold into black while leaving all pixels above the
820% threshold unchanged.
821%
822% The format of the MagickBlackThresholdImage method is:
823%
824% MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
825% const PixelWand *threshold)
826%
827% A description of each parameter follows:
828%
829% o wand: the magick wand.
830%
831% o threshold: the pixel wand.
832%
833*/
834WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
835 const PixelWand *threshold)
836{
837 char
838 thresholds[MaxTextExtent];
839
840 MagickBooleanType
841 status;
842
843 assert(wand != (MagickWand *) NULL);
844 assert(wand->signature == WandSignature);
845 if (wand->debug != MagickFalse)
846 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
847 if (wand->images == (Image *) NULL)
848 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +0000849 (void) FormatLocaleString(thresholds,MaxTextExtent,
cristy3ed852e2009-09-05 21:47:34 +0000850 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
851 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
cristyb6a294d2011-10-03 00:55:17 +0000852 PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
cristyf4ad9df2011-07-08 16:49:03 +0000853 status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +0000854 if (status == MagickFalse)
855 InheritException(wand->exception,&wand->images->exception);
856 return(status);
857}
858
859/*
860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
861% %
862% %
863% %
864% M a g i c k B l u e S h i f t I m a g e %
865% %
866% %
867% %
868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
869%
870% MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
871% nighttime in the moonlight.
872%
873% The format of the MagickBlueShiftImage method is:
874%
875% MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
876% const double factor)
877%
878% A description of each parameter follows:
879%
880% o wand: the magick wand.
881%
882% o factor: the blue shift factor (default 1.5)
883%
884*/
885WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
886 const double factor)
887{
888 Image
889 *shift_image;
890
891 assert(wand != (MagickWand *) NULL);
892 assert(wand->signature == WandSignature);
893 if (wand->debug != MagickFalse)
894 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
895 if (wand->images == (Image *) NULL)
896 ThrowWandException(WandError,"ContainsNoImages",wand->name);
897 shift_image=BlueShiftImage(wand->images,factor,wand->exception);
898 if (shift_image == (Image *) NULL)
899 return(MagickFalse);
900 ReplaceImageInList(&wand->images,shift_image);
901 return(MagickTrue);
902}
903
904/*
905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
906% %
907% %
908% %
909% M a g i c k B l u r I m a g e %
910% %
911% %
912% %
913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
914%
915% MagickBlurImage() blurs an image. We convolve the image with a
916% gaussian operator of the given radius and standard deviation (sigma).
917% For reasonable results, the radius should be larger than sigma. Use a
918% radius of 0 and BlurImage() selects a suitable radius for you.
919%
920% The format of the MagickBlurImage method is:
921%
922% MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
cristy05c0c9a2011-09-05 23:16:13 +0000923% const double sigmaconst double bias)
cristy3ed852e2009-09-05 21:47:34 +0000924%
925% A description of each parameter follows:
926%
927% o wand: the magick wand.
928%
cristy3ed852e2009-09-05 21:47:34 +0000929% o radius: the radius of the , in pixels, not counting the center
930% pixel.
931%
932% o sigma: the standard deviation of the , in pixels.
933%
cristy05c0c9a2011-09-05 23:16:13 +0000934% o bias: the bias.
935%
cristy3ed852e2009-09-05 21:47:34 +0000936*/
cristy3ed852e2009-09-05 21:47:34 +0000937WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
cristy05c0c9a2011-09-05 23:16:13 +0000938 const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000939{
cristy3ed852e2009-09-05 21:47:34 +0000940 Image
941 *blur_image;
942
943 assert(wand != (MagickWand *) NULL);
944 assert(wand->signature == WandSignature);
945 if (wand->debug != MagickFalse)
946 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
947 if (wand->images == (Image *) NULL)
948 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy05c0c9a2011-09-05 23:16:13 +0000949 blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000950 if (blur_image == (Image *) NULL)
951 return(MagickFalse);
952 ReplaceImageInList(&wand->images,blur_image);
953 return(MagickTrue);
954}
955
956/*
957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
958% %
959% %
960% %
961% M a g i c k B o r d e r I m a g e %
962% %
963% %
964% %
965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
966%
967% MagickBorderImage() surrounds the image with a border of the color defined
968% by the bordercolor pixel wand.
969%
970% The format of the MagickBorderImage method is:
971%
972% MagickBooleanType MagickBorderImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000973% const PixelWand *bordercolor,const size_t width,
cristy633f0c62011-09-15 13:27:36 +0000974% const size_t height,const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +0000975%
976% A description of each parameter follows:
977%
978% o wand: the magick wand.
979%
980% o bordercolor: the border color pixel wand.
981%
982% o width: the border width.
983%
984% o height: the border height.
985%
cristy633f0c62011-09-15 13:27:36 +0000986% o compose: the composite operator.
987%
cristy3ed852e2009-09-05 21:47:34 +0000988*/
989WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
cristy633f0c62011-09-15 13:27:36 +0000990 const PixelWand *bordercolor,const size_t width,const size_t height,
991 const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +0000992{
993 Image
994 *border_image;
995
996 RectangleInfo
997 border_info;
998
999 assert(wand != (MagickWand *) NULL);
1000 assert(wand->signature == WandSignature);
1001 if (wand->debug != MagickFalse)
1002 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1003 if (wand->images == (Image *) NULL)
1004 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1005 border_info.width=width;
1006 border_info.height=height;
1007 border_info.x=0;
1008 border_info.y=0;
cristy4c08aed2011-07-01 19:47:50 +00001009 PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
cristy633f0c62011-09-15 13:27:36 +00001010 border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001011 if (border_image == (Image *) NULL)
1012 return(MagickFalse);
1013 ReplaceImageInList(&wand->images,border_image);
1014 return(MagickTrue);
1015}
1016
1017/*
1018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1019% %
1020% %
1021% %
cristya28d6b82010-01-11 20:03:47 +00001022% 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 %
1023% %
1024% %
1025% %
1026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1027%
1028% Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1029% of an image. It converts the brightness and contrast parameters into slope
1030% and intercept and calls a polynomical function to apply to the image.
1031
1032%
1033% The format of the MagickBrightnessContrastImage method is:
1034%
1035% MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1036% const double brightness,const double contrast)
cristya28d6b82010-01-11 20:03:47 +00001037%
1038% A description of each parameter follows:
1039%
1040% o wand: the magick wand.
1041%
cristya28d6b82010-01-11 20:03:47 +00001042% o brightness: the brightness percent (-100 .. 100).
1043%
1044% o contrast: the contrast percent (-100 .. 100).
1045%
1046*/
cristy9ee60942011-07-06 14:54:38 +00001047WandExport MagickBooleanType MagickBrightnessContrastImage(
1048 MagickWand *wand,const double brightness,const double contrast)
cristya28d6b82010-01-11 20:03:47 +00001049{
1050 MagickBooleanType
1051 status;
1052
1053 assert(wand != (MagickWand *) NULL);
1054 assert(wand->signature == WandSignature);
1055 if (wand->debug != MagickFalse)
1056 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1057 if (wand->images == (Image *) NULL)
1058 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy444eda62011-08-10 02:07:46 +00001059 status=BrightnessContrastImage(wand->images,brightness,contrast,
1060 &wand->images->exception);
cristya28d6b82010-01-11 20:03:47 +00001061 return(status);
1062}
1063
1064/*
1065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1066% %
1067% %
1068% %
cristy3ed852e2009-09-05 21:47:34 +00001069% M a g i c k C h a r c o a l I m a g e %
1070% %
1071% %
1072% %
1073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1074%
1075% MagickCharcoalImage() simulates a charcoal drawing.
1076%
1077% The format of the MagickCharcoalImage method is:
1078%
1079% MagickBooleanType MagickCharcoalImage(MagickWand *wand,
cristy05c0c9a2011-09-05 23:16:13 +00001080% const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +00001081%
1082% A description of each parameter follows:
1083%
1084% o wand: the magick wand.
1085%
1086% o radius: the radius of the Gaussian, in pixels, not counting the center
1087% pixel.
1088%
1089% o sigma: the standard deviation of the Gaussian, in pixels.
1090%
cristy05c0c9a2011-09-05 23:16:13 +00001091% o bias: the bias.
1092%
cristy3ed852e2009-09-05 21:47:34 +00001093*/
1094WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
cristy05c0c9a2011-09-05 23:16:13 +00001095 const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +00001096{
1097 Image
1098 *charcoal_image;
1099
1100 assert(wand != (MagickWand *) NULL);
1101 assert(wand->signature == WandSignature);
1102 if (wand->debug != MagickFalse)
1103 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1104 if (wand->images == (Image *) NULL)
1105 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy05c0c9a2011-09-05 23:16:13 +00001106 charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001107 if (charcoal_image == (Image *) NULL)
1108 return(MagickFalse);
1109 ReplaceImageInList(&wand->images,charcoal_image);
1110 return(MagickTrue);
1111}
1112
1113/*
1114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115% %
1116% %
1117% %
1118% M a g i c k C h o p I m a g e %
1119% %
1120% %
1121% %
1122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1123%
1124% MagickChopImage() removes a region of an image and collapses the image to
1125% occupy the removed portion
1126%
1127% The format of the MagickChopImage method is:
1128%
1129% MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001130% const size_t width,const size_t height,const ssize_t x,
1131% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001132%
1133% A description of each parameter follows:
1134%
1135% o wand: the magick wand.
1136%
1137% o width: the region width.
1138%
1139% o height: the region height.
1140%
1141% o x: the region x offset.
1142%
1143% o y: the region y offset.
1144%
1145%
1146*/
1147WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001148 const size_t width,const size_t height,const ssize_t x,
1149 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001150{
1151 Image
1152 *chop_image;
1153
1154 RectangleInfo
1155 chop;
1156
1157 assert(wand != (MagickWand *) NULL);
1158 assert(wand->signature == WandSignature);
1159 if (wand->debug != MagickFalse)
1160 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1161 if (wand->images == (Image *) NULL)
1162 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1163 chop.width=width;
1164 chop.height=height;
1165 chop.x=x;
1166 chop.y=y;
1167 chop_image=ChopImage(wand->images,&chop,wand->exception);
1168 if (chop_image == (Image *) NULL)
1169 return(MagickFalse);
1170 ReplaceImageInList(&wand->images,chop_image);
1171 return(MagickTrue);
1172}
1173
1174/*
1175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1176% %
1177% %
1178% %
cristy1eb45dd2009-09-25 16:38:06 +00001179% M a g i c k C l a m p I m a g e %
1180% %
1181% %
1182% %
1183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184%
cristyecb0c6d2009-09-25 16:50:09 +00001185% MagickClampImage() restricts the color range from 0 to the quantum depth.
cristy1eb45dd2009-09-25 16:38:06 +00001186%
1187% The format of the MagickClampImage method is:
1188%
1189% MagickBooleanType MagickClampImage(MagickWand *wand)
cristy1eb45dd2009-09-25 16:38:06 +00001190%
1191% A description of each parameter follows:
1192%
1193% o wand: the magick wand.
1194%
1195% o channel: the channel.
1196%
1197*/
cristy1eb45dd2009-09-25 16:38:06 +00001198WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1199{
cristy1eb45dd2009-09-25 16:38:06 +00001200 assert(wand != (MagickWand *) NULL);
1201 assert(wand->signature == WandSignature);
1202 if (wand->debug != MagickFalse)
1203 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1204 if (wand->images == (Image *) NULL)
1205 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy092d71c2011-10-14 18:01:29 +00001206 return(ClampImage(wand->images,wand->exception));
cristy1eb45dd2009-09-25 16:38:06 +00001207}
1208
1209/*
1210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1211% %
1212% %
1213% %
cristy3ed852e2009-09-05 21:47:34 +00001214% M a g i c k C l i p I m a g e %
1215% %
1216% %
1217% %
1218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1219%
cristycee97112010-05-28 00:44:52 +00001220% MagickClipImage() clips along the first path from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001221% present.
1222%
1223% The format of the MagickClipImage method is:
1224%
1225% MagickBooleanType MagickClipImage(MagickWand *wand)
1226%
1227% A description of each parameter follows:
1228%
1229% o wand: the magick wand.
1230%
1231*/
1232WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1233{
1234 MagickBooleanType
1235 status;
1236
1237 assert(wand != (MagickWand *) NULL);
1238 assert(wand->signature == WandSignature);
1239 if (wand->debug != MagickFalse)
1240 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1241 if (wand->images == (Image *) NULL)
1242 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00001243 status=ClipImage(wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001244 return(status);
1245}
1246
1247/*
1248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1249% %
1250% %
1251% %
1252% M a g i c k C l i p I m a g e P a t h %
1253% %
1254% %
1255% %
1256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1257%
cristycee97112010-05-28 00:44:52 +00001258% MagickClipImagePath() clips along the named paths from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001259% present. Later operations take effect inside the path. Id may be a number
1260% if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1261% path.
1262%
1263% The format of the MagickClipImagePath method is:
1264%
1265% MagickBooleanType MagickClipImagePath(MagickWand *wand,
1266% const char *pathname,const MagickBooleanType inside)
1267%
1268% A description of each parameter follows:
1269%
1270% o wand: the magick wand.
1271%
1272% o pathname: name of clipping path resource. If name is preceded by #, use
1273% clipping path numbered by name.
1274%
1275% o inside: if non-zero, later operations take effect inside clipping path.
1276% Otherwise later operations take effect outside clipping path.
1277%
1278*/
1279WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1280 const char *pathname,const MagickBooleanType inside)
1281{
1282 MagickBooleanType
1283 status;
1284
1285 assert(wand != (MagickWand *) NULL);
1286 assert(wand->signature == WandSignature);
1287 if (wand->debug != MagickFalse)
1288 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1289 if (wand->images == (Image *) NULL)
1290 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00001291 status=ClipImagePath(wand->images,pathname,inside,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001292 return(status);
1293}
1294
1295/*
1296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297% %
1298% %
1299% %
1300% M a g i c k C l u t I m a g e %
1301% %
1302% %
1303% %
1304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1305%
1306% MagickClutImage() replaces colors in the image from a color lookup table.
1307%
1308% The format of the MagickClutImage method is:
1309%
1310% MagickBooleanType MagickClutImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +00001311% const MagickWand *clut_wand,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00001312%
1313% A description of each parameter follows:
1314%
1315% o wand: the magick wand.
1316%
1317% o clut_image: the clut image.
1318%
cristy5c4e2582011-09-11 19:21:03 +00001319% o method: the pixel interpolation method.
1320%
cristy3ed852e2009-09-05 21:47:34 +00001321*/
cristy3ed852e2009-09-05 21:47:34 +00001322WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +00001323 const MagickWand *clut_wand,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00001324{
1325 MagickBooleanType
1326 status;
1327
cristy3ed852e2009-09-05 21:47:34 +00001328 assert(wand != (MagickWand *) NULL);
1329 assert(wand->signature == WandSignature);
1330 if (wand->debug != MagickFalse)
1331 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1332 if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1333 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +00001334 status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001335 return(status);
1336}
1337
1338/*
1339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1340% %
1341% %
1342% %
1343% M a g i c k C o a l e s c e I m a g e s %
1344% %
1345% %
1346% %
1347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1348%
1349% MagickCoalesceImages() composites a set of images while respecting any page
1350% offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1351% typically start with an image background and each subsequent image
1352% varies in size and offset. MagickCoalesceImages() returns a new sequence
1353% where each image in the sequence is the same size as the first and
1354% composited with the next image in the sequence.
1355%
1356% The format of the MagickCoalesceImages method is:
1357%
1358% MagickWand *MagickCoalesceImages(MagickWand *wand)
1359%
1360% A description of each parameter follows:
1361%
1362% o wand: the magick wand.
1363%
1364*/
1365WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1366{
1367 Image
1368 *coalesce_image;
1369
1370 assert(wand != (MagickWand *) NULL);
1371 assert(wand->signature == WandSignature);
1372 if (wand->debug != MagickFalse)
1373 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1374 if (wand->images == (Image *) NULL)
1375 return((MagickWand *) NULL);
1376 coalesce_image=CoalesceImages(wand->images,wand->exception);
1377 if (coalesce_image == (Image *) NULL)
1378 return((MagickWand *) NULL);
1379 return(CloneMagickWandFromImages(wand,coalesce_image));
1380}
1381
1382/*
1383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1384% %
1385% %
1386% %
1387% M a g i c k C o l o r D e c i s i o n I m a g e %
1388% %
1389% %
1390% %
1391%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1392%
1393% MagickColorDecisionListImage() accepts a lightweight Color Correction
1394% Collection (CCC) file which solely contains one or more color corrections
1395% and applies the color correction to the image. Here is a sample CCC file:
1396%
1397% <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1398% <ColorCorrection id="cc03345">
1399% <SOPNode>
1400% <Slope> 0.9 1.2 0.5 </Slope>
1401% <Offset> 0.4 -0.5 0.6 </Offset>
1402% <Power> 1.0 0.8 1.5 </Power>
1403% </SOPNode>
1404% <SATNode>
1405% <Saturation> 0.85 </Saturation>
1406% </SATNode>
1407% </ColorCorrection>
1408% </ColorCorrectionCollection>
1409%
1410% which includes the offset, slope, and power for each of the RGB channels
1411% as well as the saturation.
1412%
1413% The format of the MagickColorDecisionListImage method is:
1414%
1415% MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1416% const double gamma)
1417%
1418% A description of each parameter follows:
1419%
1420% o wand: the magick wand.
1421%
1422% o color_correction_collection: the color correction collection in XML.
1423%
1424*/
1425WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1426 const char *color_correction_collection)
1427{
1428 MagickBooleanType
1429 status;
1430
1431 assert(wand != (MagickWand *) NULL);
1432 assert(wand->signature == WandSignature);
1433 if (wand->debug != MagickFalse)
1434 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1435 if (wand->images == (Image *) NULL)
1436 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy1bfa9f02011-08-11 02:35:43 +00001437 status=ColorDecisionListImage(wand->images,color_correction_collection,
1438 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00001439 return(status);
1440}
1441
1442/*
1443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1444% %
1445% %
1446% %
1447% M a g i c k C o l o r i z e I m a g e %
1448% %
1449% %
1450% %
1451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1452%
1453% MagickColorizeImage() blends the fill color with each pixel in the image.
1454%
1455% The format of the MagickColorizeImage method is:
1456%
1457% MagickBooleanType MagickColorizeImage(MagickWand *wand,
cristyc7e6ff62011-10-03 13:46:11 +00001458% const PixelWand *colorize,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +00001459%
1460% A description of each parameter follows:
1461%
1462% o wand: the magick wand.
1463%
1464% o colorize: the colorize pixel wand.
1465%
cristyb6a294d2011-10-03 00:55:17 +00001466% o alpha: the alpha pixel wand.
cristy3ed852e2009-09-05 21:47:34 +00001467%
1468*/
1469WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
cristyc7e6ff62011-10-03 13:46:11 +00001470 const PixelWand *colorize,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +00001471{
1472 char
cristyc7e6ff62011-10-03 13:46:11 +00001473 percent_blend[MaxTextExtent];
cristy3ed852e2009-09-05 21:47:34 +00001474
1475 Image
1476 *colorize_image;
1477
cristyc7e6ff62011-10-03 13:46:11 +00001478 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00001479 target;
1480
1481 assert(wand != (MagickWand *) NULL);
1482 assert(wand->signature == WandSignature);
1483 if (wand->debug != MagickFalse)
1484 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1485 if (wand->images == (Image *) NULL)
1486 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyef6ab862011-10-13 15:56:05 +00001487 GetPixelInfo(wand->images,&target);
cristyc7e6ff62011-10-03 13:46:11 +00001488 if (target.colorspace != CMYKColorspace)
1489 (void) FormatLocaleString(percent_blend,MaxTextExtent,
1490 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1491 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1492 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1493 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1494 PixelGetAlphaQuantum(blend)));
1495 else
1496 (void) FormatLocaleString(percent_blend,MaxTextExtent,
1497 "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1498 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1499 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1500 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1501 PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1502 PixelGetAlphaQuantum(blend)));
cristy445e47d2011-10-03 19:20:51 +00001503 target=PixelGetPixel(colorize);
cristyc7e6ff62011-10-03 13:46:11 +00001504 colorize_image=ColorizeImage(wand->images,percent_blend,&target,
cristy3ed852e2009-09-05 21:47:34 +00001505 wand->exception);
1506 if (colorize_image == (Image *) NULL)
1507 return(MagickFalse);
1508 ReplaceImageInList(&wand->images,colorize_image);
1509 return(MagickTrue);
1510}
1511
1512/*
1513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1514% %
1515% %
1516% %
cristye6365592010-04-02 17:31:23 +00001517% M a g i c k C o l o r M a t r i x I m a g e %
1518% %
1519% %
1520% %
1521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522%
1523% MagickColorMatrixImage() apply color transformation to an image. The method
1524% permits saturation changes, hue rotation, luminance to alpha, and various
1525% other effects. Although variable-sized transformation matrices can be used,
1526% typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1527% (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1528% except offsets are in column 6 rather than 5 (in support of CMYKA images)
1529% and offsets are normalized (divide Flash offset by 255).
1530%
1531% The format of the MagickColorMatrixImage method is:
1532%
1533% MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1534% const KernelInfo *color_matrix)
1535%
1536% A description of each parameter follows:
1537%
1538% o wand: the magick wand.
1539%
1540% o color_matrix: the color matrix.
1541%
1542*/
1543WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1544 const KernelInfo *color_matrix)
1545{
1546 Image
1547 *color_image;
1548
1549 assert(wand != (MagickWand *) NULL);
1550 assert(wand->signature == WandSignature);
1551 if (wand->debug != MagickFalse)
1552 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1553 if (color_matrix == (const KernelInfo *) NULL)
1554 return(MagickFalse);
1555 if (wand->images == (Image *) NULL)
1556 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1557 color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1558 if (color_image == (Image *) NULL)
1559 return(MagickFalse);
1560 ReplaceImageInList(&wand->images,color_image);
1561 return(MagickTrue);
1562}
1563
1564/*
1565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1566% %
1567% %
1568% %
cristy3ed852e2009-09-05 21:47:34 +00001569% M a g i c k C o m b i n e I m a g e s %
1570% %
1571% %
1572% %
1573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1574%
1575% MagickCombineImages() combines one or more images into a single image. The
1576% grayscale value of the pixels of each image in the sequence is assigned in
1577% order to the specified hannels of the combined image. The typical
1578% ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1579%
1580% The format of the MagickCombineImages method is:
1581%
cristy3139dc22011-07-08 00:11:42 +00001582% MagickWand *MagickCombineImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00001583%
1584% A description of each parameter follows:
1585%
1586% o wand: the magick wand.
1587%
cristy3ed852e2009-09-05 21:47:34 +00001588*/
cristy3139dc22011-07-08 00:11:42 +00001589WandExport MagickWand *MagickCombineImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00001590{
1591 Image
1592 *combine_image;
1593
1594 assert(wand != (MagickWand *) NULL);
1595 assert(wand->signature == WandSignature);
1596 if (wand->debug != MagickFalse)
1597 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1598 if (wand->images == (Image *) NULL)
1599 return((MagickWand *) NULL);
cristy3139dc22011-07-08 00:11:42 +00001600 combine_image=CombineImages(wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001601 if (combine_image == (Image *) NULL)
1602 return((MagickWand *) NULL);
1603 return(CloneMagickWandFromImages(wand,combine_image));
1604}
1605
1606/*
1607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1608% %
1609% %
1610% %
1611% M a g i c k C o m m e n t I m a g e %
1612% %
1613% %
1614% %
1615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1616%
1617% MagickCommentImage() adds a comment to your image.
1618%
1619% The format of the MagickCommentImage method is:
1620%
1621% MagickBooleanType MagickCommentImage(MagickWand *wand,
1622% const char *comment)
1623%
1624% A description of each parameter follows:
1625%
1626% o wand: the magick wand.
1627%
1628% o comment: the image comment.
1629%
1630*/
1631WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1632 const char *comment)
1633{
1634 MagickBooleanType
1635 status;
1636
1637 assert(wand != (MagickWand *) NULL);
1638 assert(wand->signature == WandSignature);
1639 if (wand->debug != MagickFalse)
1640 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1641 if (wand->images == (Image *) NULL)
1642 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1643 status=SetImageProperty(wand->images,"comment",comment);
1644 if (status == MagickFalse)
1645 InheritException(wand->exception,&wand->images->exception);
1646 return(status);
1647}
1648
1649/*
1650%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1651% %
1652% %
1653% %
cristy3ed852e2009-09-05 21:47:34 +00001654% M a g i c k C o m p a r e I m a g e L a y e r s %
1655% %
1656% %
1657% %
1658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1659%
cristy8a9106f2011-07-05 14:39:26 +00001660% MagickCompareImagesLayers() compares each image with the next in a sequence
cristy3ed852e2009-09-05 21:47:34 +00001661% and returns the maximum bounding region of any pixel differences it
1662% discovers.
1663%
cristy8a9106f2011-07-05 14:39:26 +00001664% The format of the MagickCompareImagesLayers method is:
cristy3ed852e2009-09-05 21:47:34 +00001665%
cristy8a9106f2011-07-05 14:39:26 +00001666% MagickWand *MagickCompareImagesLayers(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00001667% const ImageLayerMethod method)
1668%
1669% A description of each parameter follows:
1670%
1671% o wand: the magick wand.
1672%
1673% o method: the compare method.
1674%
1675*/
cristy8a9106f2011-07-05 14:39:26 +00001676WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00001677 const ImageLayerMethod method)
1678{
1679 Image
1680 *layers_image;
1681
1682 assert(wand != (MagickWand *) NULL);
1683 assert(wand->signature == WandSignature);
1684 if (wand->debug != MagickFalse)
1685 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1686 if (wand->images == (Image *) NULL)
1687 return((MagickWand *) NULL);
cristy8a9106f2011-07-05 14:39:26 +00001688 layers_image=CompareImagesLayers(wand->images,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001689 if (layers_image == (Image *) NULL)
1690 return((MagickWand *) NULL);
1691 return(CloneMagickWandFromImages(wand,layers_image));
1692}
1693
1694/*
1695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1696% %
1697% %
1698% %
1699% M a g i c k C o m p a r e I m a g e s %
1700% %
1701% %
1702% %
1703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1704%
1705% MagickCompareImages() compares an image to a reconstructed image and returns
1706% the specified difference image.
1707%
1708% The format of the MagickCompareImages method is:
1709%
1710% MagickWand *MagickCompareImages(MagickWand *wand,
1711% const MagickWand *reference,const MetricType metric,
1712% double *distortion)
1713%
1714% A description of each parameter follows:
1715%
1716% o wand: the magick wand.
1717%
1718% o reference: the reference wand.
1719%
1720% o metric: the metric.
1721%
1722% o distortion: the computed distortion between the images.
1723%
1724*/
1725WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1726 const MagickWand *reference,const MetricType metric,double *distortion)
1727{
1728 Image
1729 *compare_image;
1730
1731
1732 assert(wand != (MagickWand *) NULL);
1733 assert(wand->signature == WandSignature);
1734 if (wand->debug != MagickFalse)
1735 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1736 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1737 {
1738 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1739 "ContainsNoImages","`%s'",wand->name);
1740 return((MagickWand *) NULL);
1741 }
1742 compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1743 &wand->images->exception);
1744 if (compare_image == (Image *) NULL)
1745 return((MagickWand *) NULL);
1746 return(CloneMagickWandFromImages(wand,compare_image));
1747}
1748
1749/*
1750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1751% %
1752% %
1753% %
1754% M a g i c k C o m p o s i t e I m a g e %
1755% %
1756% %
1757% %
1758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1759%
1760% MagickCompositeImage() composite one image onto another at the specified
1761% offset.
1762%
1763% The format of the MagickCompositeImage method is:
1764%
1765% MagickBooleanType MagickCompositeImage(MagickWand *wand,
1766% const MagickWand *composite_wand,const CompositeOperator compose,
cristybb503372010-05-27 20:51:26 +00001767% const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001768%
1769% A description of each parameter follows:
1770%
1771% o wand: the magick wand.
1772%
1773% o composite_image: the composite image.
1774%
1775% o compose: This operator affects how the composite is applied to the
1776% image. The default is Over. Choose from these operators:
1777%
1778% OverCompositeOp InCompositeOp OutCompositeOp
1779% AtopCompositeOp XorCompositeOp PlusCompositeOp
1780% MinusCompositeOp AddCompositeOp SubtractCompositeOp
1781% DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1782% DisplaceCompositeOp
1783%
1784% o x: the column offset of the composited image.
1785%
1786% o y: the row offset of the composited image.
1787%
1788*/
cristy3ed852e2009-09-05 21:47:34 +00001789WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
cristyf4ad9df2011-07-08 16:49:03 +00001790 const MagickWand *composite_wand,const CompositeOperator compose,
1791 const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001792{
1793 MagickBooleanType
1794 status;
1795
1796 assert(wand != (MagickWand *) NULL);
1797 assert(wand->signature == WandSignature);
1798 if (wand->debug != MagickFalse)
1799 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1800 if ((wand->images == (Image *) NULL) ||
1801 (composite_wand->images == (Image *) NULL))
1802 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00001803 status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
cristy3ed852e2009-09-05 21:47:34 +00001804 if (status == MagickFalse)
1805 InheritException(wand->exception,&wand->images->exception);
1806 return(status);
1807}
1808
1809/*
1810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1811% %
1812% %
1813% %
1814% M a g i c k C o n t r a s t I m a g e %
1815% %
1816% %
1817% %
1818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1819%
1820% MagickContrastImage() enhances the intensity differences between the lighter
1821% and darker elements of the image. Set sharpen to a value other than 0 to
1822% increase the image contrast otherwise the contrast is reduced.
1823%
1824% The format of the MagickContrastImage method is:
1825%
1826% MagickBooleanType MagickContrastImage(MagickWand *wand,
1827% const MagickBooleanType sharpen)
1828%
1829% A description of each parameter follows:
1830%
1831% o wand: the magick wand.
1832%
1833% o sharpen: Increase or decrease image contrast.
1834%
1835%
1836*/
1837WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1838 const MagickBooleanType sharpen)
1839{
1840 MagickBooleanType
1841 status;
1842
1843 assert(wand != (MagickWand *) NULL);
1844 assert(wand->signature == WandSignature);
1845 if (wand->debug != MagickFalse)
1846 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1847 if (wand->images == (Image *) NULL)
1848 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00001849 status=ContrastImage(wand->images,sharpen,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00001850 return(status);
1851}
1852
1853/*
1854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1855% %
1856% %
1857% %
1858% 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 %
1859% %
1860% %
1861% %
1862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1863%
1864% MagickContrastStretchImage() enhances the contrast of a color image by
1865% adjusting the pixels color to span the entire range of colors available.
1866% You can also reduce the influence of a particular channel with a gamma
1867% value of 0.
1868%
1869% The format of the MagickContrastStretchImage method is:
1870%
1871% MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1872% const double black_point,const double white_point)
cristy3ed852e2009-09-05 21:47:34 +00001873%
1874% A description of each parameter follows:
1875%
1876% o wand: the magick wand.
1877%
cristy3ed852e2009-09-05 21:47:34 +00001878% o black_point: the black point.
1879%
1880% o white_point: the white point.
1881%
1882*/
cristy3ed852e2009-09-05 21:47:34 +00001883WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1884 const double black_point,const double white_point)
1885{
1886 MagickBooleanType
1887 status;
1888
cristy3ed852e2009-09-05 21:47:34 +00001889 assert(wand != (MagickWand *) NULL);
1890 assert(wand->signature == WandSignature);
1891 if (wand->debug != MagickFalse)
1892 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1893 if (wand->images == (Image *) NULL)
1894 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00001895 status=ContrastStretchImage(wand->images,black_point,white_point,
1896 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00001897 return(status);
1898}
1899
1900/*
1901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1902% %
1903% %
1904% %
1905% M a g i c k C o n v o l v e I m a g e %
1906% %
1907% %
1908% %
1909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1910%
1911% MagickConvolveImage() applies a custom convolution kernel to the image.
1912%
1913% The format of the MagickConvolveImage method is:
1914%
1915% MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00001916% const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00001917%
1918% A description of each parameter follows:
1919%
1920% o wand: the magick wand.
1921%
cristy3ed852e2009-09-05 21:47:34 +00001922% o kernel: An array of doubles representing the convolution kernel.
1923%
1924*/
cristy3ed852e2009-09-05 21:47:34 +00001925WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00001926 const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00001927{
cristy3ed852e2009-09-05 21:47:34 +00001928 Image
cristy5e6be1e2011-07-16 01:23:39 +00001929 *filter_image;
cristy3ed852e2009-09-05 21:47:34 +00001930
1931 assert(wand != (MagickWand *) NULL);
1932 assert(wand->signature == WandSignature);
1933 if (wand->debug != MagickFalse)
1934 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00001935 if (kernel == (const KernelInfo *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001936 return(MagickFalse);
1937 if (wand->images == (Image *) NULL)
1938 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00001939 filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1940 if (filter_image == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00001941 return(MagickFalse);
cristy5e6be1e2011-07-16 01:23:39 +00001942 ReplaceImageInList(&wand->images,filter_image);
cristy3ed852e2009-09-05 21:47:34 +00001943 return(MagickTrue);
1944}
1945
1946/*
1947%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1948% %
1949% %
1950% %
1951% M a g i c k C r o p I m a g e %
1952% %
1953% %
1954% %
1955%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1956%
1957% MagickCropImage() extracts a region of the image.
1958%
1959% The format of the MagickCropImage method is:
1960%
1961% MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00001962% const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001963%
1964% A description of each parameter follows:
1965%
1966% o wand: the magick wand.
1967%
1968% o width: the region width.
1969%
1970% o height: the region height.
1971%
1972% o x: the region x-offset.
1973%
1974% o y: the region y-offset.
1975%
1976*/
1977WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00001978 const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001979{
1980 Image
1981 *crop_image;
1982
1983 RectangleInfo
1984 crop;
1985
1986 assert(wand != (MagickWand *) NULL);
1987 assert(wand->signature == WandSignature);
1988 if (wand->debug != MagickFalse)
1989 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1990 if (wand->images == (Image *) NULL)
1991 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1992 crop.width=width;
1993 crop.height=height;
1994 crop.x=x;
1995 crop.y=y;
1996 crop_image=CropImage(wand->images,&crop,wand->exception);
1997 if (crop_image == (Image *) NULL)
1998 return(MagickFalse);
1999 ReplaceImageInList(&wand->images,crop_image);
2000 return(MagickTrue);
2001}
2002
2003/*
2004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2005% %
2006% %
2007% %
2008% M a g i c k C y c l e C o l o r m a p I m a g e %
2009% %
2010% %
2011% %
2012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2013%
2014% MagickCycleColormapImage() displaces an image's colormap by a given number
2015% of positions. If you cycle the colormap a number of times you can produce
2016% a psychodelic effect.
2017%
2018% The format of the MagickCycleColormapImage method is:
2019%
2020% MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002021% const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002022%
2023% A description of each parameter follows:
2024%
2025% o wand: the magick wand.
2026%
2027% o pixel_wand: the pixel wand.
2028%
2029*/
2030WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002031 const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002032{
2033 MagickBooleanType
2034 status;
2035
2036 assert(wand != (MagickWand *) NULL);
2037 assert(wand->signature == WandSignature);
2038 if (wand->debug != MagickFalse)
2039 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2040 if (wand->images == (Image *) NULL)
2041 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00002042 status=CycleColormapImage(wand->images,displace,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002043 return(status);
2044}
2045
2046/*
2047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2048% %
2049% %
2050% %
2051% M a g i c k C o n s t i t u t e I m a g e %
2052% %
2053% %
2054% %
2055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2056%
2057% MagickConstituteImage() adds an image to the wand comprised of the pixel
2058% data you supply. The pixel data must be in scanline order top-to-bottom.
2059% The data can be char, short int, int, float, or double. Float and double
2060% require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2061% is the maximum value the type can accomodate (e.g. 255 for char). For
2062% example, to create a 640x480 image from unsigned red-green-blue character
2063% data, use
2064%
2065% MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2066%
2067% The format of the MagickConstituteImage method is:
2068%
2069% MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002070% const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002071% const StorageType storage,void *pixels)
2072%
2073% A description of each parameter follows:
2074%
2075% o wand: the magick wand.
2076%
2077% o columns: width in pixels of the image.
2078%
2079% o rows: height in pixels of the image.
2080%
2081% o map: This string reflects the expected ordering of the pixel array.
2082% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00002083% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00002084% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2085% P = pad.
2086%
2087% o storage: Define the data type of the pixels. Float and double types are
2088% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2089% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2090% LongPixel, QuantumPixel, or ShortPixel.
2091%
2092% o pixels: This array of values contain the pixel components as defined by
2093% map and type. You must preallocate this array where the expected
2094% length varies depending on the values of width, height, map, and type.
2095%
2096%
2097*/
2098WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002099 const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002100 const StorageType storage,const void *pixels)
2101{
2102 Image
2103 *images;
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 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2110 if (images == (Image *) NULL)
2111 return(MagickFalse);
2112 return(InsertImageInWand(wand,images));
2113}
2114
2115/*
2116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2117% %
2118% %
2119% %
2120% M a g i c k D e c i p h e r I m a g e %
2121% %
2122% %
2123% %
2124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2125%
2126% MagickDecipherImage() converts cipher pixels to plain pixels.
2127%
2128% The format of the MagickDecipherImage method is:
2129%
2130% MagickBooleanType MagickDecipherImage(MagickWand *wand,
2131% const char *passphrase)
2132%
2133% A description of each parameter follows:
2134%
2135% o wand: the magick wand.
2136%
2137% o passphrase: the passphrase.
2138%
2139*/
2140WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2141 const char *passphrase)
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 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2149 return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2150}
2151
2152/*
2153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2154% %
2155% %
2156% %
2157% M a g i c k D e c o n s t r u c t I m a g e s %
2158% %
2159% %
2160% %
2161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2162%
2163% MagickDeconstructImages() compares each image with the next in a sequence
2164% and returns the maximum bounding region of any pixel differences it
2165% discovers.
2166%
2167% The format of the MagickDeconstructImages method is:
2168%
2169% MagickWand *MagickDeconstructImages(MagickWand *wand)
2170%
2171% A description of each parameter follows:
2172%
2173% o wand: the magick wand.
2174%
2175*/
2176WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2177{
2178 Image
2179 *deconstruct_image;
2180
2181 assert(wand != (MagickWand *) NULL);
2182 assert(wand->signature == WandSignature);
2183 if (wand->debug != MagickFalse)
2184 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2185 if (wand->images == (Image *) NULL)
2186 return((MagickWand *) NULL);
cristy8a9106f2011-07-05 14:39:26 +00002187 deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
cristy4c08aed2011-07-01 19:47:50 +00002188 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002189 if (deconstruct_image == (Image *) NULL)
2190 return((MagickWand *) NULL);
2191 return(CloneMagickWandFromImages(wand,deconstruct_image));
2192}
2193
2194/*
2195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2196% %
2197% %
2198% %
2199% M a g i c k D e s k e w I m a g e %
2200% %
2201% %
2202% %
2203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2204%
2205% MagickDeskewImage() removes skew from the image. Skew is an artifact that
2206% occurs in scanned images because of the camera being misaligned,
2207% imperfections in the scanning or surface, or simply because the paper was
2208% not placed completely flat when scanned.
2209%
2210% The format of the MagickDeskewImage method is:
2211%
2212% MagickBooleanType MagickDeskewImage(MagickWand *wand,
2213% const double threshold)
2214%
2215% A description of each parameter follows:
2216%
2217% o wand: the magick wand.
2218%
2219% o threshold: separate background from foreground.
2220%
2221*/
2222WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2223 const double threshold)
2224{
2225 Image
2226 *sepia_image;
2227
2228 assert(wand != (MagickWand *) NULL);
2229 assert(wand->signature == WandSignature);
2230 if (wand->debug != MagickFalse)
2231 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2232 if (wand->images == (Image *) NULL)
2233 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2234 sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2235 if (sepia_image == (Image *) NULL)
2236 return(MagickFalse);
2237 ReplaceImageInList(&wand->images,sepia_image);
2238 return(MagickTrue);
2239}
2240
2241/*
2242%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2243% %
2244% %
2245% %
2246% M a g i c k D e s p e c k l e I m a g e %
2247% %
2248% %
2249% %
2250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2251%
2252% MagickDespeckleImage() reduces the speckle noise in an image while
2253% perserving the edges of the original image.
2254%
2255% The format of the MagickDespeckleImage method is:
2256%
2257% MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2258%
2259% A description of each parameter follows:
2260%
2261% o wand: the magick wand.
2262%
2263*/
2264WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2265{
2266 Image
2267 *despeckle_image;
2268
2269 assert(wand != (MagickWand *) NULL);
2270 assert(wand->signature == WandSignature);
2271 if (wand->debug != MagickFalse)
2272 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2273 if (wand->images == (Image *) NULL)
2274 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2275 despeckle_image=DespeckleImage(wand->images,wand->exception);
2276 if (despeckle_image == (Image *) NULL)
2277 return(MagickFalse);
2278 ReplaceImageInList(&wand->images,despeckle_image);
2279 return(MagickTrue);
2280}
2281
2282/*
2283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2284% %
2285% %
2286% %
2287% M a g i c k D e s t r o y I m a g e %
2288% %
2289% %
2290% %
2291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2292%
2293% MagickDestroyImage() dereferences an image, deallocating memory associated
2294% with the image if the reference count becomes zero.
2295%
2296% The format of the MagickDestroyImage method is:
2297%
2298% Image *MagickDestroyImage(Image *image)
2299%
2300% A description of each parameter follows:
2301%
2302% o image: the image.
2303%
2304*/
2305WandExport Image *MagickDestroyImage(Image *image)
2306{
2307 return(DestroyImage(image));
2308}
2309
2310/*
2311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2312% %
2313% %
2314% %
2315% M a g i c k D i s p l a y I m a g e %
2316% %
2317% %
2318% %
2319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2320%
2321% MagickDisplayImage() displays an image.
2322%
2323% The format of the MagickDisplayImage method is:
2324%
2325% MagickBooleanType MagickDisplayImage(MagickWand *wand,
2326% const char *server_name)
2327%
2328% A description of each parameter follows:
2329%
2330% o wand: the magick wand.
2331%
2332% o server_name: the X server name.
2333%
2334*/
2335WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2336 const char *server_name)
2337{
2338 Image
2339 *image;
2340
2341 MagickBooleanType
2342 status;
2343
2344 assert(wand != (MagickWand *) NULL);
2345 assert(wand->signature == WandSignature);
2346 if (wand->debug != MagickFalse)
2347 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2348 if (wand->images == (Image *) NULL)
2349 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2350 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2351 if (image == (Image *) NULL)
2352 return(MagickFalse);
2353 (void) CloneString(&wand->image_info->server_name,server_name);
cristy051718b2011-08-28 22:49:25 +00002354 status=DisplayImages(wand->image_info,image,&image->exception);
cristy3ed852e2009-09-05 21:47:34 +00002355 image=DestroyImage(image);
2356 return(status);
2357}
2358
2359/*
2360%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2361% %
2362% %
2363% %
2364% M a g i c k D i s p l a y I m a g e s %
2365% %
2366% %
2367% %
2368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2369%
2370% MagickDisplayImages() displays an image or image sequence.
2371%
2372% The format of the MagickDisplayImages method is:
2373%
2374% MagickBooleanType MagickDisplayImages(MagickWand *wand,
2375% const char *server_name)
2376%
2377% A description of each parameter follows:
2378%
2379% o wand: the magick wand.
2380%
2381% o server_name: the X server name.
2382%
2383*/
2384WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2385 const char *server_name)
2386{
2387 MagickBooleanType
2388 status;
2389
2390 assert(wand != (MagickWand *) NULL);
2391 assert(wand->signature == WandSignature);
2392 if (wand->debug != MagickFalse)
2393 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2394 (void) CloneString(&wand->image_info->server_name,server_name);
cristy051718b2011-08-28 22:49:25 +00002395 status=DisplayImages(wand->image_info,wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00002396 return(status);
2397}
2398
2399/*
2400%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2401% %
2402% %
2403% %
2404% M a g i c k D i s t o r t I m a g e %
2405% %
2406% %
2407% %
2408%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2409%
2410% MagickDistortImage() distorts an image using various distortion methods, by
2411% mapping color lookups of the source image to a new destination image
2412% usally of the same size as the source image, unless 'bestfit' is set to
2413% true.
2414%
2415% If 'bestfit' is enabled, and distortion allows it, the destination image is
2416% adjusted to ensure the whole source 'image' will just fit within the final
2417% destination image, which will be sized and offset accordingly. Also in
2418% many cases the virtual offset of the source image will be taken into
2419% account in the mapping.
2420%
2421% The format of the MagickDistortImage method is:
2422%
2423% MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002424% const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002425% const double *arguments,const MagickBooleanType bestfit)
2426%
2427% A description of each parameter follows:
2428%
2429% o image: the image to be distorted.
2430%
2431% o method: the method of image distortion.
2432%
2433% ArcDistortion always ignores the source image offset, and always
2434% 'bestfit' the destination image with the top left corner offset
2435% relative to the polar mapping center.
2436%
2437% Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2438% style of image distortion.
2439%
2440% Affine, Perspective, and Bilinear, do least squares fitting of the
2441% distortion when more than the minimum number of control point pairs
2442% are provided.
2443%
2444% Perspective, and Bilinear, falls back to a Affine distortion when less
2445% that 4 control point pairs are provided. While Affine distortions let
2446% you use any number of control point pairs, that is Zero pairs is a
2447% no-Op (viewport only) distrotion, one pair is a translation and two
2448% pairs of control points do a scale-rotate-translate, without any
2449% shearing.
2450%
2451% o number_arguments: the number of arguments given for this distortion
2452% method.
2453%
2454% o arguments: the arguments for this distortion method.
2455%
2456% o bestfit: Attempt to resize destination to fit distorted source.
2457%
2458*/
2459WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002460 const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002461 const double *arguments,const MagickBooleanType bestfit)
2462{
2463 Image
2464 *distort_image;
2465
2466 assert(wand != (MagickWand *) NULL);
2467 assert(wand->signature == WandSignature);
2468 if (wand->debug != MagickFalse)
2469 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2470 if (wand->images == (Image *) NULL)
2471 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2472 distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2473 bestfit,wand->exception);
2474 if (distort_image == (Image *) NULL)
2475 return(MagickFalse);
2476 ReplaceImageInList(&wand->images,distort_image);
2477 return(MagickTrue);
2478}
2479
2480/*
2481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2482% %
2483% %
2484% %
2485% M a g i c k D r a w I m a g e %
2486% %
2487% %
2488% %
2489%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2490%
2491% MagickDrawImage() renders the drawing wand on the current image.
2492%
2493% The format of the MagickDrawImage method is:
2494%
2495% MagickBooleanType MagickDrawImage(MagickWand *wand,
2496% const DrawingWand *drawing_wand)
2497%
2498% A description of each parameter follows:
2499%
2500% o wand: the magick wand.
2501%
2502% o drawing_wand: the draw wand.
2503%
2504*/
2505WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2506 const DrawingWand *drawing_wand)
2507{
2508 char
2509 *primitive;
2510
2511 DrawInfo
2512 *draw_info;
2513
2514 MagickBooleanType
2515 status;
2516
2517 assert(wand != (MagickWand *) NULL);
2518 assert(wand->signature == WandSignature);
2519 if (wand->debug != MagickFalse)
2520 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2521 if (wand->images == (Image *) NULL)
2522 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2523 draw_info=PeekDrawingWand(drawing_wand);
2524 if ((draw_info == (DrawInfo *) NULL) ||
2525 (draw_info->primitive == (char *) NULL))
2526 return(MagickFalse);
2527 primitive=AcquireString(draw_info->primitive);
2528 draw_info=DestroyDrawInfo(draw_info);
2529 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2530 draw_info->primitive=primitive;
cristy018f07f2011-09-04 21:15:19 +00002531 status=DrawImage(wand->images,draw_info,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002532 draw_info=DestroyDrawInfo(draw_info);
2533 return(status);
2534}
2535
2536/*
2537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2538% %
2539% %
2540% %
2541% M a g i c k E d g e I m a g e %
2542% %
2543% %
2544% %
2545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2546%
2547% MagickEdgeImage() enhance edges within the image with a convolution filter
2548% of the given radius. Use a radius of 0 and Edge() selects a suitable
2549% radius for you.
2550%
2551% The format of the MagickEdgeImage method is:
2552%
cristy8ae632d2011-09-05 17:29:53 +00002553% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2554% const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00002555%
2556% A description of each parameter follows:
2557%
2558% o wand: the magick wand.
2559%
2560% o radius: the radius of the pixel neighborhood.
2561%
cristy8ae632d2011-09-05 17:29:53 +00002562% o sigma: the standard deviation of the Gaussian, in pixels.
2563%
cristy3ed852e2009-09-05 21:47:34 +00002564*/
2565WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
cristy8ae632d2011-09-05 17:29:53 +00002566 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00002567{
2568 Image
2569 *edge_image;
2570
2571 assert(wand != (MagickWand *) NULL);
2572 assert(wand->signature == WandSignature);
2573 if (wand->debug != MagickFalse)
2574 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2575 if (wand->images == (Image *) NULL)
2576 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy8ae632d2011-09-05 17:29:53 +00002577 edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002578 if (edge_image == (Image *) NULL)
2579 return(MagickFalse);
2580 ReplaceImageInList(&wand->images,edge_image);
2581 return(MagickTrue);
2582}
2583
2584/*
2585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2586% %
2587% %
2588% %
2589% M a g i c k E m b o s s I m a g e %
2590% %
2591% %
2592% %
2593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2594%
2595% MagickEmbossImage() returns a grayscale image with a three-dimensional
2596% effect. We convolve the image with a Gaussian operator of the given radius
2597% and standard deviation (sigma). For reasonable results, radius should be
2598% larger than sigma. Use a radius of 0 and Emboss() selects a suitable
2599% radius for you.
2600%
2601% The format of the MagickEmbossImage method is:
2602%
2603% MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2604% const double sigma)
2605%
2606% A description of each parameter follows:
2607%
2608% o wand: the magick wand.
2609%
2610% o radius: the radius of the Gaussian, in pixels, not counting the center
2611% pixel.
2612%
2613% o sigma: the standard deviation of the Gaussian, in pixels.
2614%
2615*/
2616WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2617 const double radius,const double sigma)
2618{
2619 Image
2620 *emboss_image;
2621
2622 assert(wand != (MagickWand *) NULL);
2623 assert(wand->signature == WandSignature);
2624 if (wand->debug != MagickFalse)
2625 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2626 if (wand->images == (Image *) NULL)
2627 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2628 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2629 if (emboss_image == (Image *) NULL)
2630 return(MagickFalse);
2631 ReplaceImageInList(&wand->images,emboss_image);
2632 return(MagickTrue);
2633}
2634
2635/*
2636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2637% %
2638% %
2639% %
2640% M a g i c k E n c i p h e r I m a g e %
2641% %
2642% %
2643% %
2644%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2645%
2646% MagickEncipherImage() converts plaint pixels to cipher pixels.
2647%
2648% The format of the MagickEncipherImage method is:
2649%
2650% MagickBooleanType MagickEncipherImage(MagickWand *wand,
2651% const char *passphrase)
2652%
2653% A description of each parameter follows:
2654%
2655% o wand: the magick wand.
2656%
2657% o passphrase: the passphrase.
2658%
2659*/
2660WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2661 const char *passphrase)
2662{
2663 assert(wand != (MagickWand *) NULL);
2664 assert(wand->signature == WandSignature);
2665 if (wand->debug != MagickFalse)
2666 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2667 if (wand->images == (Image *) NULL)
2668 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2669 return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2670}
2671
2672/*
2673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2674% %
2675% %
2676% %
2677% M a g i c k E n h a n c e I m a g e %
2678% %
2679% %
2680% %
2681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2682%
2683% MagickEnhanceImage() applies a digital filter that improves the quality of a
2684% noisy image.
2685%
2686% The format of the MagickEnhanceImage method is:
2687%
2688% MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2689%
2690% A description of each parameter follows:
2691%
2692% o wand: the magick wand.
2693%
2694*/
2695WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2696{
2697 Image
2698 *enhance_image;
2699
2700 assert(wand != (MagickWand *) NULL);
2701 assert(wand->signature == WandSignature);
2702 if (wand->debug != MagickFalse)
2703 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2704 if (wand->images == (Image *) NULL)
2705 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2706 enhance_image=EnhanceImage(wand->images,wand->exception);
2707 if (enhance_image == (Image *) NULL)
2708 return(MagickFalse);
2709 ReplaceImageInList(&wand->images,enhance_image);
2710 return(MagickTrue);
2711}
2712
2713/*
2714%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2715% %
2716% %
2717% %
2718% M a g i c k E q u a l i z e I m a g e %
2719% %
2720% %
2721% %
2722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2723%
2724% MagickEqualizeImage() equalizes the image histogram.
2725%
2726% The format of the MagickEqualizeImage method is:
2727%
2728% MagickBooleanType MagickEqualizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00002729%
2730% A description of each parameter follows:
2731%
2732% o wand: the magick wand.
2733%
2734% o channel: the image channel(s).
2735%
2736*/
cristy3ed852e2009-09-05 21:47:34 +00002737WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2738{
2739 MagickBooleanType
2740 status;
2741
cristy3ed852e2009-09-05 21:47:34 +00002742 assert(wand != (MagickWand *) NULL);
2743 assert(wand->signature == WandSignature);
2744 if (wand->debug != MagickFalse)
2745 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2746 if (wand->images == (Image *) NULL)
2747 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy6d8c3d72011-08-22 01:20:01 +00002748 status=EqualizeImage(wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00002749 return(status);
2750}
2751
2752/*
2753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2754% %
2755% %
2756% %
2757% M a g i c k E v a l u a t e I m a g e %
2758% %
2759% %
2760% %
2761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2762%
2763% MagickEvaluateImage() applys an arithmetic, relational, or logical
2764% expression to an image. Use these operators to lighten or darken an image,
2765% to increase or decrease contrast in an image, or to produce the "negative"
2766% of an image.
2767%
2768% The format of the MagickEvaluateImage method is:
2769%
2770% MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2771% const MagickEvaluateOperator operator,const double value)
cristyd18ae7c2010-03-07 17:39:52 +00002772% MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2773% const MagickEvaluateOperator operator)
cristy3ed852e2009-09-05 21:47:34 +00002774%
2775% A description of each parameter follows:
2776%
2777% o wand: the magick wand.
2778%
cristy3ed852e2009-09-05 21:47:34 +00002779% o op: A channel operator.
2780%
2781% o value: A value value.
2782%
2783*/
2784
cristyd18ae7c2010-03-07 17:39:52 +00002785WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2786 const MagickEvaluateOperator op)
2787{
2788 Image
2789 *evaluate_image;
2790
2791 assert(wand != (MagickWand *) NULL);
2792 assert(wand->signature == WandSignature);
2793 if (wand->debug != MagickFalse)
2794 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2795 if (wand->images == (Image *) NULL)
2796 return((MagickWand *) NULL);
2797 evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2798 if (evaluate_image == (Image *) NULL)
2799 return((MagickWand *) NULL);
2800 return(CloneMagickWandFromImages(wand,evaluate_image));
2801}
2802
cristyd42d9952011-07-08 14:21:50 +00002803WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2804 const MagickEvaluateOperator op,const double value)
cristy3ed852e2009-09-05 21:47:34 +00002805{
2806 MagickBooleanType
2807 status;
2808
2809 assert(wand != (MagickWand *) NULL);
2810 assert(wand->signature == WandSignature);
2811 if (wand->debug != MagickFalse)
2812 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2813 if (wand->images == (Image *) NULL)
2814 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00002815 status=EvaluateImage(wand->images,op,value,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00002816 return(status);
2817}
2818
2819/*
2820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2821% %
2822% %
2823% %
2824% M a g i c k E x p o r t I m a g e P i x e l s %
2825% %
2826% %
2827% %
2828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2829%
2830% MagickExportImagePixels() extracts pixel data from an image and returns it
2831% to you. The method returns MagickTrue on success otherwise MagickFalse if
2832% an error is encountered. The data is returned as char, short int, int,
cristybb503372010-05-27 20:51:26 +00002833% ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00002834%
2835% Suppose you want to extract the first scanline of a 640x480 image as
2836% character data in red-green-blue order:
2837%
2838% MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2839%
2840% The format of the MagickExportImagePixels method is:
2841%
2842% MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002843% const ssize_t x,const ssize_t y,const size_t columns,
2844% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00002845% void *pixels)
2846%
2847% A description of each parameter follows:
2848%
2849% o wand: the magick wand.
2850%
2851% o x, y, columns, rows: These values define the perimeter
2852% of a region of pixels you want to extract.
2853%
2854% o map: This string reflects the expected ordering of the pixel array.
2855% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00002856% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00002857% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2858% P = pad.
2859%
2860% o storage: Define the data type of the pixels. Float and double types are
2861% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2862% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2863% LongPixel, QuantumPixel, or ShortPixel.
2864%
2865% o pixels: This array of values contain the pixel components as defined by
2866% map and type. You must preallocate this array where the expected
2867% length varies depending on the values of width, height, map, and type.
2868%
2869*/
2870WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002871 const ssize_t x,const ssize_t y,const size_t columns,
2872 const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00002873 void *pixels)
2874{
2875 MagickBooleanType
2876 status;
2877
2878 assert(wand != (MagickWand *) NULL);
2879 assert(wand->signature == WandSignature);
2880 if (wand->debug != MagickFalse)
2881 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2882 if (wand->images == (Image *) NULL)
2883 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2884 status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2885 storage,pixels,wand->exception);
2886 if (status == MagickFalse)
2887 InheritException(wand->exception,&wand->images->exception);
2888 return(status);
2889}
2890
2891/*
2892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2893% %
2894% %
2895% %
2896% M a g i c k E x t e n t I m a g e %
2897% %
2898% %
2899% %
2900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2901%
2902% MagickExtentImage() extends the image as defined by the geometry, gravity,
2903% and wand background color. Set the (x,y) offset of the geometry to move
2904% the original wand relative to the extended wand.
2905%
2906% The format of the MagickExtentImage method is:
2907%
2908% MagickBooleanType MagickExtentImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002909% const size_t width,const size_t height,const ssize_t x,
2910% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002911%
2912% A description of each parameter follows:
2913%
2914% o wand: the magick wand.
2915%
2916% o width: the region width.
2917%
2918% o height: the region height.
2919%
2920% o x: the region x offset.
2921%
2922% o y: the region y offset.
2923%
2924*/
2925WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002926 const size_t width,const size_t height,const ssize_t x,
2927 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002928{
2929 Image
2930 *extent_image;
2931
2932 RectangleInfo
2933 extent;
2934
2935 assert(wand != (MagickWand *) NULL);
2936 assert(wand->signature == WandSignature);
2937 if (wand->debug != MagickFalse)
2938 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2939 if (wand->images == (Image *) NULL)
2940 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2941 extent.width=width;
2942 extent.height=height;
2943 extent.x=x;
2944 extent.y=y;
2945 extent_image=ExtentImage(wand->images,&extent,wand->exception);
2946 if (extent_image == (Image *) NULL)
2947 return(MagickFalse);
2948 ReplaceImageInList(&wand->images,extent_image);
2949 return(MagickTrue);
2950}
2951
2952/*
2953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2954% %
2955% %
2956% %
2957% M a g i c k F l i p I m a g e %
2958% %
2959% %
2960% %
2961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2962%
2963% MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2964% around the central x-axis.
2965%
2966% The format of the MagickFlipImage method is:
2967%
2968% MagickBooleanType MagickFlipImage(MagickWand *wand)
2969%
2970% A description of each parameter follows:
2971%
2972% o wand: the magick wand.
2973%
2974*/
2975WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2976{
2977 Image
2978 *flip_image;
2979
2980 assert(wand != (MagickWand *) NULL);
2981 assert(wand->signature == WandSignature);
2982 if (wand->debug != MagickFalse)
2983 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2984 if (wand->images == (Image *) NULL)
2985 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2986 flip_image=FlipImage(wand->images,wand->exception);
2987 if (flip_image == (Image *) NULL)
2988 return(MagickFalse);
2989 ReplaceImageInList(&wand->images,flip_image);
2990 return(MagickTrue);
2991}
2992
2993/*
2994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2995% %
2996% %
2997% %
2998% 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 %
2999% %
3000% %
3001% %
3002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3003%
3004% MagickFloodfillPaintImage() changes the color value of any pixel that matches
3005% target and is an immediate neighbor. If the method FillToBorderMethod is
3006% specified, the color value is changed for any neighbor pixel that does not
3007% match the bordercolor member of image.
3008%
3009% The format of the MagickFloodfillPaintImage method is:
3010%
3011% MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00003012% const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3013% const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00003014%
3015% A description of each parameter follows:
3016%
3017% o wand: the magick wand.
3018%
cristy3ed852e2009-09-05 21:47:34 +00003019% o fill: the floodfill color pixel wand.
3020%
3021% o fuzz: By default target must match a particular pixel color
3022% exactly. However, in many cases two colors may differ by a small amount.
3023% The fuzz member of image defines how much tolerance is acceptable to
3024% consider two colors as the same. For example, set fuzz to 10 and the
3025% color red at intensities of 100 and 102 respectively are now interpreted
3026% as the same color for the purposes of the floodfill.
3027%
3028% o bordercolor: the border color pixel wand.
3029%
3030% o x,y: the starting location of the operation.
3031%
3032% o invert: paint any pixel that does not match the target color.
3033%
3034*/
3035WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00003036 const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3037 const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00003038{
3039 DrawInfo
3040 *draw_info;
3041
3042 MagickBooleanType
3043 status;
3044
cristy4c08aed2011-07-01 19:47:50 +00003045 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00003046 target;
3047
3048 assert(wand != (MagickWand *) NULL);
3049 assert(wand->signature == WandSignature);
3050 if (wand->debug != MagickFalse)
3051 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3052 if (wand->images == (Image *) NULL)
3053 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3054 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
cristy4c08aed2011-07-01 19:47:50 +00003055 PixelGetQuantumPacket(fill,&draw_info->fill);
cristy3ed852e2009-09-05 21:47:34 +00003056 (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3057 y % wand->images->rows,&target,wand->exception);
3058 if (bordercolor != (PixelWand *) NULL)
3059 PixelGetMagickColor(bordercolor,&target);
3060 wand->images->fuzz=fuzz;
cristy189e84c2011-08-27 18:08:53 +00003061 status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3062 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00003063 draw_info=DestroyDrawInfo(draw_info);
3064 return(status);
3065}
3066
3067/*
3068%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3069% %
3070% %
3071% %
3072% M a g i c k F l o p I m a g e %
3073% %
3074% %
3075% %
3076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3077%
3078% MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3079% around the central y-axis.
3080%
3081% The format of the MagickFlopImage method is:
3082%
3083% MagickBooleanType MagickFlopImage(MagickWand *wand)
3084%
3085% A description of each parameter follows:
3086%
3087% o wand: the magick wand.
3088%
3089*/
3090WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3091{
3092 Image
3093 *flop_image;
3094
3095 assert(wand != (MagickWand *) NULL);
3096 assert(wand->signature == WandSignature);
3097 if (wand->debug != MagickFalse)
3098 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3099 if (wand->images == (Image *) NULL)
3100 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3101 flop_image=FlopImage(wand->images,wand->exception);
3102 if (flop_image == (Image *) NULL)
3103 return(MagickFalse);
3104 ReplaceImageInList(&wand->images,flop_image);
3105 return(MagickTrue);
3106}
3107
3108/*
3109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3110% %
3111% %
3112% %
3113% 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 %
3114% %
3115% %
3116% %
3117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3118%
3119% MagickForwardFourierTransformImage() implements the discrete Fourier
3120% transform (DFT) of the image either as a magnitude / phase or real /
3121% imaginary image pair.
3122%
3123% The format of the MagickForwardFourierTransformImage method is:
3124%
3125% MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3126% const MagickBooleanType magnitude)
3127%
3128% A description of each parameter follows:
3129%
3130% o wand: the magick wand.
3131%
3132% o magnitude: if true, return as magnitude / phase pair otherwise a real /
3133% imaginary image pair.
3134%
3135*/
3136WandExport MagickBooleanType MagickForwardFourierTransformImage(
3137 MagickWand *wand,const MagickBooleanType magnitude)
3138{
3139 Image
3140 *forward_image;
3141
3142 assert(wand != (MagickWand *) NULL);
3143 assert(wand->signature == WandSignature);
3144 if (wand->debug != MagickFalse)
3145 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3146 if (wand->images == (Image *) NULL)
3147 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3148 forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3149 wand->exception);
3150 if (forward_image == (Image *) NULL)
3151 return(MagickFalse);
3152 ReplaceImageInList(&wand->images,forward_image);
3153 return(MagickTrue);
3154}
3155
3156/*
3157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3158% %
3159% %
3160% %
3161% M a g i c k F r a m e I m a g e %
3162% %
3163% %
3164% %
3165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3166%
3167% MagickFrameImage() adds a simulated three-dimensional border around the
3168% image. The width and height specify the border width of the vertical and
3169% horizontal sides of the frame. The inner and outer bevels indicate the
3170% width of the inner and outer shadows of the frame.
3171%
3172% The format of the MagickFrameImage method is:
3173%
3174% MagickBooleanType MagickFrameImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003175% const PixelWand *matte_color,const size_t width,
3176% const size_t height,const ssize_t inner_bevel,
cristy633f0c62011-09-15 13:27:36 +00003177% const ssize_t outer_bevel,const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00003178%
3179% A description of each parameter follows:
3180%
3181% o wand: the magick wand.
3182%
3183% o matte_color: the frame color pixel wand.
3184%
3185% o width: the border width.
3186%
3187% o height: the border height.
3188%
3189% o inner_bevel: the inner bevel width.
3190%
3191% o outer_bevel: the outer bevel width.
3192%
cristy633f0c62011-09-15 13:27:36 +00003193% o compose: the composite operator.
3194%
cristy3ed852e2009-09-05 21:47:34 +00003195*/
3196WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
cristy633f0c62011-09-15 13:27:36 +00003197 const PixelWand *matte_color,const size_t width,const size_t height,
3198 const ssize_t inner_bevel,const ssize_t outer_bevel,
3199 const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00003200{
3201 Image
3202 *frame_image;
3203
3204 FrameInfo
3205 frame_info;
3206
3207 assert(wand != (MagickWand *) NULL);
3208 assert(wand->signature == WandSignature);
3209 if (wand->debug != MagickFalse)
3210 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3211 if (wand->images == (Image *) NULL)
3212 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3213 (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3214 frame_info.width=wand->images->columns+2*width;
3215 frame_info.height=wand->images->rows+2*height;
cristybb503372010-05-27 20:51:26 +00003216 frame_info.x=(ssize_t) width;
3217 frame_info.y=(ssize_t) height;
cristy3ed852e2009-09-05 21:47:34 +00003218 frame_info.inner_bevel=inner_bevel;
3219 frame_info.outer_bevel=outer_bevel;
cristy4c08aed2011-07-01 19:47:50 +00003220 PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
cristy633f0c62011-09-15 13:27:36 +00003221 frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003222 if (frame_image == (Image *) NULL)
3223 return(MagickFalse);
3224 ReplaceImageInList(&wand->images,frame_image);
3225 return(MagickTrue);
3226}
3227
3228/*
3229%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3230% %
3231% %
3232% %
3233% M a g i c k F u n c t i o n I m a g e %
3234% %
3235% %
3236% %
3237%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3238%
3239% MagickFunctionImage() applys an arithmetic, relational, or logical
3240% expression to an image. Use these operators to lighten or darken an image,
3241% to increase or decrease contrast in an image, or to produce the "negative"
3242% of an image.
3243%
3244% The format of the MagickFunctionImage method is:
3245%
3246% MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003247% const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003248% const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +00003249%
3250% A description of each parameter follows:
3251%
3252% o wand: the magick wand.
3253%
cristy3ed852e2009-09-05 21:47:34 +00003254% o function: the image function.
3255%
3256% o number_arguments: the number of function arguments.
3257%
3258% o arguments: the function arguments.
3259%
3260*/
cristy3ed852e2009-09-05 21:47:34 +00003261WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003262 const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003263 const double *arguments)
3264{
3265 MagickBooleanType
3266 status;
3267
3268 assert(wand != (MagickWand *) NULL);
3269 assert(wand->signature == WandSignature);
3270 if (wand->debug != MagickFalse)
3271 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3272 if (wand->images == (Image *) NULL)
3273 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3274 status=FunctionImage(wand->images,function,number_arguments,arguments,
3275 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00003276 return(status);
3277}
3278
3279/*
3280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3281% %
3282% %
3283% %
3284% M a g i c k F x I m a g e %
3285% %
3286% %
3287% %
3288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3289%
3290% MagickFxImage() evaluate expression for each pixel in the image.
3291%
3292% The format of the MagickFxImage method is:
3293%
3294% MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
cristy3ed852e2009-09-05 21:47:34 +00003295%
3296% A description of each parameter follows:
3297%
3298% o wand: the magick wand.
3299%
cristy3ed852e2009-09-05 21:47:34 +00003300% o expression: the expression.
3301%
3302*/
cristy3ed852e2009-09-05 21:47:34 +00003303WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3304{
cristy3ed852e2009-09-05 21:47:34 +00003305 Image
3306 *fx_image;
3307
3308 assert(wand != (MagickWand *) NULL);
3309 assert(wand->signature == WandSignature);
3310 if (wand->debug != MagickFalse)
3311 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3312 if (wand->images == (Image *) NULL)
3313 return((MagickWand *) NULL);
cristy490408a2011-07-07 14:42:05 +00003314 fx_image=FxImage(wand->images,expression,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003315 if (fx_image == (Image *) NULL)
3316 return((MagickWand *) NULL);
3317 return(CloneMagickWandFromImages(wand,fx_image));
3318}
3319
3320/*
3321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3322% %
3323% %
3324% %
3325% M a g i c k G a m m a I m a g e %
3326% %
3327% %
3328% %
3329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3330%
3331% MagickGammaImage() gamma-corrects an image. The same image viewed on
3332% different devices will have perceptual differences in the way the image's
3333% intensities are represented on the screen. Specify individual gamma levels
3334% for the red, green, and blue channels, or adjust all three with the gamma
3335% parameter. Values typically range from 0.8 to 2.3.
3336%
3337% You can also reduce the influence of a particular channel with a gamma
3338% value of 0.
3339%
3340% The format of the MagickGammaImage method is:
3341%
3342% MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
cristy3ed852e2009-09-05 21:47:34 +00003343%
3344% A description of each parameter follows:
3345%
3346% o wand: the magick wand.
3347%
cristy3ed852e2009-09-05 21:47:34 +00003348% o level: Define the level of gamma correction.
3349%
3350*/
cristy3ed852e2009-09-05 21:47:34 +00003351WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3352 const double gamma)
3353{
3354 MagickBooleanType
3355 status;
3356
cristy3ed852e2009-09-05 21:47:34 +00003357 assert(wand != (MagickWand *) NULL);
3358 assert(wand->signature == WandSignature);
3359 if (wand->debug != MagickFalse)
3360 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3361 if (wand->images == (Image *) NULL)
3362 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00003363 status=GammaImage(wand->images,gamma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003364 return(status);
3365}
3366
3367/*
3368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3369% %
3370% %
3371% %
3372% M a g i c k G a u s s i a n B l u r I m a g e %
3373% %
3374% %
3375% %
3376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3377%
3378% MagickGaussianBlurImage() blurs an image. We convolve the image with a
3379% Gaussian operator of the given radius and standard deviation (sigma).
3380% For reasonable results, the radius should be larger than sigma. Use a
3381% radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3382%
3383% The format of the MagickGaussianBlurImage method is:
3384%
3385% MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
cristy05c0c9a2011-09-05 23:16:13 +00003386% const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +00003387%
3388% A description of each parameter follows:
3389%
3390% o wand: the magick wand.
3391%
cristy3ed852e2009-09-05 21:47:34 +00003392% o radius: the radius of the Gaussian, in pixels, not counting the center
3393% pixel.
3394%
3395% o sigma: the standard deviation of the Gaussian, in pixels.
3396%
cristy05c0c9a2011-09-05 23:16:13 +00003397% o bias: the bias.
3398%
cristy3ed852e2009-09-05 21:47:34 +00003399*/
cristy3ed852e2009-09-05 21:47:34 +00003400WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
cristy05c0c9a2011-09-05 23:16:13 +00003401 const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +00003402{
cristy3ed852e2009-09-05 21:47:34 +00003403 Image
3404 *blur_image;
3405
3406 assert(wand != (MagickWand *) NULL);
3407 assert(wand->signature == WandSignature);
3408 if (wand->debug != MagickFalse)
3409 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3410 if (wand->images == (Image *) NULL)
3411 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy05c0c9a2011-09-05 23:16:13 +00003412 blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003413 if (blur_image == (Image *) NULL)
3414 return(MagickFalse);
3415 ReplaceImageInList(&wand->images,blur_image);
3416 return(MagickTrue);
3417}
3418
3419/*
3420%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3421% %
3422% %
3423% %
3424% M a g i c k G e t I m a g e %
3425% %
3426% %
3427% %
3428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3429%
3430% MagickGetImage() gets the image at the current image index.
3431%
3432% The format of the MagickGetImage method is:
3433%
3434% MagickWand *MagickGetImage(MagickWand *wand)
3435%
3436% A description of each parameter follows:
3437%
3438% o wand: the magick wand.
3439%
3440*/
3441WandExport MagickWand *MagickGetImage(MagickWand *wand)
3442{
3443 Image
3444 *image;
3445
3446 assert(wand != (MagickWand *) NULL);
3447 assert(wand->signature == WandSignature);
3448 if (wand->debug != MagickFalse)
3449 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3450 if (wand->images == (Image *) NULL)
3451 {
3452 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3453 "ContainsNoImages","`%s'",wand->name);
3454 return((MagickWand *) NULL);
3455 }
3456 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3457 if (image == (Image *) NULL)
3458 return((MagickWand *) NULL);
3459 return(CloneMagickWandFromImages(wand,image));
3460}
3461
3462/*
3463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3464% %
3465% %
3466% %
3467% 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 %
3468% %
3469% %
3470% %
3471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3472%
3473% MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3474% is not activated. That is, the image is RGB rather than RGBA or CMYK rather
3475% than CMYKA.
3476%
3477% The format of the MagickGetImageAlphaChannel method is:
3478%
cristybb503372010-05-27 20:51:26 +00003479% size_t MagickGetImageAlphaChannel(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003480%
3481% A description of each parameter follows:
3482%
3483% o wand: the magick wand.
3484%
3485*/
3486WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3487{
3488 assert(wand != (MagickWand *) NULL);
3489 assert(wand->signature == WandSignature);
3490 if (wand->debug != MagickFalse)
3491 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3492 if (wand->images == (Image *) NULL)
3493 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3494 return(GetImageAlphaChannel(wand->images));
3495}
3496
3497/*
3498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3499% %
3500% %
3501% %
3502% M a g i c k G e t I m a g e C l i p M a s k %
3503% %
3504% %
3505% %
3506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3507%
3508% MagickGetImageClipMask() gets the image clip mask at the current image index.
3509%
3510% The format of the MagickGetImageClipMask method is:
3511%
3512% MagickWand *MagickGetImageClipMask(MagickWand *wand)
3513%
3514% A description of each parameter follows:
3515%
3516% o wand: the magick wand.
3517%
3518*/
3519WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3520{
3521 Image
3522 *image;
3523
3524 assert(wand != (MagickWand *) NULL);
3525 assert(wand->signature == WandSignature);
3526 if (wand->debug != MagickFalse)
3527 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3528 if (wand->images == (Image *) NULL)
3529 {
3530 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3531 "ContainsNoImages","`%s'",wand->name);
3532 return((MagickWand *) NULL);
3533 }
3534 image=GetImageClipMask(wand->images,wand->exception);
3535 if (image == (Image *) NULL)
3536 return((MagickWand *) NULL);
3537 return(CloneMagickWandFromImages(wand,image));
3538}
3539
3540/*
3541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3542% %
3543% %
3544% %
3545% 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 %
3546% %
3547% %
3548% %
3549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3550%
3551% MagickGetImageBackgroundColor() returns the image background color.
3552%
3553% The format of the MagickGetImageBackgroundColor method is:
3554%
3555% MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3556% PixelWand *background_color)
3557%
3558% A description of each parameter follows:
3559%
3560% o wand: the magick wand.
3561%
3562% o background_color: Return the background color.
3563%
3564*/
3565WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3566 PixelWand *background_color)
3567{
3568 assert(wand != (MagickWand *) NULL);
3569 assert(wand->signature == WandSignature);
3570 if (wand->debug != MagickFalse)
3571 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3572 if (wand->images == (Image *) NULL)
3573 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00003574 PixelSetQuantumPacket(background_color,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00003575 return(MagickTrue);
3576}
3577
3578/*
3579%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3580% %
3581% %
3582% %
3583% M a g i c k G e t I m a g e B l o b %
3584% %
3585% %
3586% %
3587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3588%
cristy1a1b5622011-02-15 02:40:42 +00003589% MagickGetImageBlob() implements direct to memory image formats. It returns
3590% the image as a blob (a formatted "file" in memory) and its length, starting
anthonya89dd172011-10-04 13:29:35 +00003591% from the current position in the image sequence. Use MagickSetImageFormat()
cristy1a1b5622011-02-15 02:40:42 +00003592% to set the format to write to the blob (GIF, JPEG, PNG, etc.).
3593%
3594% Utilize MagickResetIterator() to ensure the write is from the beginning of
3595% the image sequence.
cristy3ed852e2009-09-05 21:47:34 +00003596%
3597% Use MagickRelinquishMemory() to free the blob when you are done with it.
3598%
3599% The format of the MagickGetImageBlob method is:
3600%
3601% unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3602%
3603% A description of each parameter follows:
3604%
3605% o wand: the magick wand.
3606%
3607% o length: the length of the blob.
3608%
3609*/
3610WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3611{
3612 assert(wand != (MagickWand *) NULL);
3613 assert(wand->signature == WandSignature);
3614 if (wand->debug != MagickFalse)
3615 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3616 if (wand->images == (Image *) NULL)
3617 {
3618 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3619 "ContainsNoImages","`%s'",wand->name);
3620 return((unsigned char *) NULL);
3621 }
3622 return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3623}
3624
3625/*
3626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3627% %
3628% %
3629% %
3630% M a g i c k G e t I m a g e s B l o b %
3631% %
3632% %
3633% %
3634%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3635%
3636% MagickGetImageBlob() implements direct to memory image formats. It
3637% returns the image sequence as a blob and its length. The format of the image
3638% determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
3639% return a different image format, use MagickSetImageFormat().
3640%
3641% Note, some image formats do not permit multiple images to the same image
3642% stream (e.g. JPEG). in this instance, just the first image of the
3643% sequence is returned as a blob.
3644%
3645% The format of the MagickGetImagesBlob method is:
3646%
3647% unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3648%
3649% A description of each parameter follows:
3650%
3651% o wand: the magick wand.
3652%
3653% o length: the length of the blob.
3654%
3655*/
3656WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3657{
3658 unsigned char
3659 *blob;
3660
3661 assert(wand != (MagickWand *) NULL);
3662 assert(wand->signature == WandSignature);
3663 if (wand->debug != MagickFalse)
3664 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3665 if (wand->images == (Image *) NULL)
3666 {
3667 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3668 "ContainsNoImages","`%s'",wand->name);
3669 return((unsigned char *) NULL);
3670 }
3671 blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3672 wand->exception);
3673 return(blob);
3674}
3675
3676/*
3677%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3678% %
3679% %
3680% %
3681% 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 %
3682% %
3683% %
3684% %
3685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3686%
3687% MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3688% image.
3689%
3690% The format of the MagickGetImageBluePrimary method is:
3691%
3692% MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3693% double *y)
3694%
3695% A description of each parameter follows:
3696%
3697% o wand: the magick wand.
3698%
3699% o x: the chromaticity blue primary x-point.
3700%
3701% o y: the chromaticity blue primary y-point.
3702%
3703*/
3704WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3705 double *x,double *y)
3706{
3707 assert(wand != (MagickWand *) NULL);
3708 assert(wand->signature == WandSignature);
3709 if (wand->debug != MagickFalse)
3710 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3711 if (wand->images == (Image *) NULL)
3712 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3713 *x=wand->images->chromaticity.blue_primary.x;
3714 *y=wand->images->chromaticity.blue_primary.y;
3715 return(MagickTrue);
3716}
3717
3718/*
3719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3720% %
3721% %
3722% %
3723% 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 %
3724% %
3725% %
3726% %
3727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3728%
3729% MagickGetImageBorderColor() returns the image border color.
3730%
3731% The format of the MagickGetImageBorderColor method is:
3732%
3733% MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3734% PixelWand *border_color)
3735%
3736% A description of each parameter follows:
3737%
3738% o wand: the magick wand.
3739%
3740% o border_color: Return the border color.
3741%
3742*/
3743WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3744 PixelWand *border_color)
3745{
3746 assert(wand != (MagickWand *) NULL);
3747 assert(wand->signature == WandSignature);
3748 if (wand->debug != MagickFalse)
3749 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3750 if (wand->images == (Image *) NULL)
3751 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00003752 PixelSetQuantumPacket(border_color,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00003753 return(MagickTrue);
3754}
3755
3756/*
3757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3758% %
3759% %
3760% %
cristyd42d9952011-07-08 14:21:50 +00003761% 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 +00003762% %
3763% %
3764% %
3765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3766%
cristy490408a2011-07-07 14:42:05 +00003767% MagickGetImageFeatures() returns features for each channel in the
cristy7396d882010-01-27 02:37:56 +00003768% image in each of four directions (horizontal, vertical, left and right
3769% diagonals) for the specified distance. The features include the angular
3770% second moment, contrast, correlation, sum of squares: variance, inverse
3771% difference moment, sum average, sum varience, sum entropy, entropy,
3772% difference variance, difference entropy, information measures of
3773% correlation 1, information measures of correlation 2, and maximum
3774% correlation coefficient. You can access the red channel contrast, for
3775% example, like this:
cristy3ed852e2009-09-05 21:47:34 +00003776%
cristy490408a2011-07-07 14:42:05 +00003777% channel_features=MagickGetImageFeatures(wand,1);
cristy549a37e2010-01-26 15:24:15 +00003778% contrast=channel_features[RedChannel].contrast[0];
cristy3ed852e2009-09-05 21:47:34 +00003779%
cristy549a37e2010-01-26 15:24:15 +00003780% Use MagickRelinquishMemory() to free the statistics buffer.
3781%
cristy490408a2011-07-07 14:42:05 +00003782% The format of the MagickGetImageFeatures method is:
cristy549a37e2010-01-26 15:24:15 +00003783%
cristy490408a2011-07-07 14:42:05 +00003784% ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003785% const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00003786%
3787% A description of each parameter follows:
3788%
3789% o wand: the magick wand.
3790%
cristy549a37e2010-01-26 15:24:15 +00003791% o distance: the distance.
cristy3ed852e2009-09-05 21:47:34 +00003792%
3793*/
cristy490408a2011-07-07 14:42:05 +00003794WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003795 const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00003796{
cristy3ed852e2009-09-05 21:47:34 +00003797 assert(wand != (MagickWand *) NULL);
3798 assert(wand->signature == WandSignature);
3799 if (wand->debug != MagickFalse)
3800 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3801 if (wand->images == (Image *) NULL)
cristy549a37e2010-01-26 15:24:15 +00003802 {
3803 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3804 "ContainsNoImages","`%s'",wand->name);
3805 return((ChannelFeatures *) NULL);
3806 }
cristy490408a2011-07-07 14:42:05 +00003807 return(GetImageFeatures(wand->images,distance,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00003808}
3809
3810/*
3811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3812% %
3813% %
3814% %
cristyd42d9952011-07-08 14:21:50 +00003815% 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 +00003816% %
3817% %
3818% %
3819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3820%
cristyd42d9952011-07-08 14:21:50 +00003821% MagickGetImageKurtosis() gets the kurtosis and skewness of one or
cristy3ed852e2009-09-05 21:47:34 +00003822% more image channels.
3823%
cristyd42d9952011-07-08 14:21:50 +00003824% The format of the MagickGetImageKurtosis method is:
cristy3ed852e2009-09-05 21:47:34 +00003825%
cristyd42d9952011-07-08 14:21:50 +00003826% MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3827% double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00003828%
3829% A description of each parameter follows:
3830%
3831% o wand: the magick wand.
3832%
cristy3ed852e2009-09-05 21:47:34 +00003833% o kurtosis: The kurtosis for the specified channel(s).
3834%
3835% o skewness: The skewness for the specified channel(s).
3836%
3837*/
cristyd42d9952011-07-08 14:21:50 +00003838WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3839 double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00003840{
3841 MagickBooleanType
3842 status;
3843
3844 assert(wand != (MagickWand *) NULL);
3845 assert(wand->signature == WandSignature);
3846 if (wand->debug != MagickFalse)
3847 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3848 if (wand->images == (Image *) NULL)
3849 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00003850 status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003851 return(status);
3852}
cristy549a37e2010-01-26 15:24:15 +00003853
3854/*
3855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3856% %
3857% %
3858% %
cristyd42d9952011-07-08 14:21:50 +00003859% M a g i c k G e t I m a g e M e a n %
cristy549a37e2010-01-26 15:24:15 +00003860% %
3861% %
3862% %
3863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3864%
cristyd42d9952011-07-08 14:21:50 +00003865% MagickGetImageMean() gets the mean and standard deviation of one or more
3866% image channels.
cristy549a37e2010-01-26 15:24:15 +00003867%
cristyd42d9952011-07-08 14:21:50 +00003868% The format of the MagickGetImageMean method is:
cristy549a37e2010-01-26 15:24:15 +00003869%
cristyd42d9952011-07-08 14:21:50 +00003870% MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3871% double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00003872%
3873% A description of each parameter follows:
3874%
3875% o wand: the magick wand.
3876%
3877% o channel: the image channel(s).
3878%
3879% o mean: The mean pixel value for the specified channel(s).
3880%
3881% o standard_deviation: The standard deviation for the specified channel(s).
3882%
3883*/
cristyd42d9952011-07-08 14:21:50 +00003884WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3885 double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00003886{
3887 MagickBooleanType
3888 status;
cristy3ed852e2009-09-05 21:47:34 +00003889
cristy549a37e2010-01-26 15:24:15 +00003890 assert(wand != (MagickWand *) NULL);
3891 assert(wand->signature == WandSignature);
3892 if (wand->debug != MagickFalse)
3893 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3894 if (wand->images == (Image *) NULL)
3895 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00003896 status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
cristy549a37e2010-01-26 15:24:15 +00003897 return(status);
3898}
3899
cristy3ed852e2009-09-05 21:47:34 +00003900/*
3901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3902% %
3903% %
3904% %
cristyd42d9952011-07-08 14:21:50 +00003905% 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 +00003906% %
3907% %
3908% %
3909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3910%
cristyd42d9952011-07-08 14:21:50 +00003911% MagickGetImageRange() gets the range for one or more image channels.
cristy3ed852e2009-09-05 21:47:34 +00003912%
cristyd42d9952011-07-08 14:21:50 +00003913% The format of the MagickGetImageRange method is:
cristy3ed852e2009-09-05 21:47:34 +00003914%
cristyd42d9952011-07-08 14:21:50 +00003915% MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3916% double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00003917%
3918% A description of each parameter follows:
3919%
3920% o wand: the magick wand.
3921%
cristy3ed852e2009-09-05 21:47:34 +00003922% o minima: The minimum pixel value for the specified channel(s).
3923%
3924% o maxima: The maximum pixel value for the specified channel(s).
3925%
3926*/
cristyd42d9952011-07-08 14:21:50 +00003927WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3928 double *minima,double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00003929{
3930 MagickBooleanType
3931 status;
3932
3933 assert(wand != (MagickWand *) NULL);
3934 assert(wand->signature == WandSignature);
3935 if (wand->debug != MagickFalse)
3936 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3937 if (wand->images == (Image *) NULL)
3938 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00003939 status=GetImageRange(wand->images,minima,maxima,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003940 return(status);
3941}
3942
3943/*
3944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3945% %
3946% %
3947% %
cristyd42d9952011-07-08 14:21:50 +00003948% 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 +00003949% %
3950% %
3951% %
3952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3953%
cristyd42d9952011-07-08 14:21:50 +00003954% MagickGetImageStatistics() returns statistics for each channel in the
cristy3ed852e2009-09-05 21:47:34 +00003955% image. The statistics include the channel depth, its minima and
3956% maxima, the mean, the standard deviation, the kurtosis and the skewness.
3957% You can access the red channel mean, for example, like this:
3958%
cristyd42d9952011-07-08 14:21:50 +00003959% channel_statistics=MagickGetImageStatistics(wand);
cristy3ed852e2009-09-05 21:47:34 +00003960% red_mean=channel_statistics[RedChannel].mean;
3961%
3962% Use MagickRelinquishMemory() to free the statistics buffer.
3963%
cristyd42d9952011-07-08 14:21:50 +00003964% The format of the MagickGetImageStatistics method is:
cristy3ed852e2009-09-05 21:47:34 +00003965%
cristyd42d9952011-07-08 14:21:50 +00003966% ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003967%
3968% A description of each parameter follows:
3969%
3970% o wand: the magick wand.
3971%
3972*/
cristyd42d9952011-07-08 14:21:50 +00003973WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003974{
3975 assert(wand != (MagickWand *) NULL);
3976 assert(wand->signature == WandSignature);
3977 if (wand->debug != MagickFalse)
3978 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3979 if (wand->images == (Image *) NULL)
3980 {
3981 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3982 "ContainsNoImages","`%s'",wand->name);
3983 return((ChannelStatistics *) NULL);
3984 }
cristyd42d9952011-07-08 14:21:50 +00003985 return(GetImageStatistics(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00003986}
3987
3988/*
3989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3990% %
3991% %
3992% %
3993% 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 %
3994% %
3995% %
3996% %
3997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3998%
3999% MagickGetImageColormapColor() returns the color of the specified colormap
4000% index.
4001%
4002% The format of the MagickGetImageColormapColor method is:
4003%
4004% MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004005% const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004006%
4007% A description of each parameter follows:
4008%
4009% o wand: the magick wand.
4010%
4011% o index: the offset into the image colormap.
4012%
4013% o color: Return the colormap color in this wand.
4014%
4015*/
4016WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004017 const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004018{
4019 assert(wand != (MagickWand *) NULL);
4020 assert(wand->signature == WandSignature);
4021 if (wand->debug != MagickFalse)
4022 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4023 if (wand->images == (Image *) NULL)
4024 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy101ab702011-10-13 13:06:32 +00004025 if ((wand->images->colormap == (PixelInfo *) NULL) ||
cristy3ed852e2009-09-05 21:47:34 +00004026 (index >= wand->images->colors))
4027 {
4028 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4029 "InvalidColormapIndex","`%s'",wand->name);
4030 return(MagickFalse);
4031 }
cristy4c08aed2011-07-01 19:47:50 +00004032 PixelSetQuantumPacket(color,wand->images->colormap+index);
cristy3ed852e2009-09-05 21:47:34 +00004033 return(MagickTrue);
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 %
4042% %
4043% %
4044% %
4045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4046%
4047% MagickGetImageColors() gets the number of unique colors in the image.
4048%
4049% The format of the MagickGetImageColors method is:
4050%
cristybb503372010-05-27 20:51:26 +00004051% size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004052%
4053% A description of each parameter follows:
4054%
4055% o wand: the magick wand.
4056%
4057*/
cristybb503372010-05-27 20:51:26 +00004058WandExport size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004059{
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(0);
4069 }
4070 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4071}
4072
4073/*
4074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4075% %
4076% %
4077% %
4078% M a g i c k G e t I m a g e C o l o r s p a c e %
4079% %
4080% %
4081% %
4082%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4083%
4084% MagickGetImageColorspace() gets the image colorspace.
4085%
4086% The format of the MagickGetImageColorspace method is:
4087%
4088% ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4089%
4090% A description of each parameter follows:
4091%
4092% o wand: the magick wand.
4093%
4094*/
4095WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4096{
4097 assert(wand != (MagickWand *) NULL);
4098 assert(wand->signature == WandSignature);
4099 if (wand->debug != MagickFalse)
4100 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4101 if (wand->images == (Image *) NULL)
4102 {
4103 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4104 "ContainsNoImages","`%s'",wand->name);
4105 return(UndefinedColorspace);
4106 }
4107 return(wand->images->colorspace);
4108}
4109
4110/*
4111%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4112% %
4113% %
4114% %
4115% M a g i c k G e t I m a g e C o m p o s e %
4116% %
4117% %
4118% %
4119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4120%
4121% MagickGetImageCompose() returns the composite operator associated with the
4122% image.
4123%
4124% The format of the MagickGetImageCompose method is:
4125%
4126% CompositeOperator MagickGetImageCompose(MagickWand *wand)
4127%
4128% A description of each parameter follows:
4129%
4130% o wand: the magick wand.
4131%
4132*/
4133WandExport CompositeOperator MagickGetImageCompose(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(UndefinedCompositeOp);
4144 }
4145 return(wand->images->compose);
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 %
4154% %
4155% %
4156% %
4157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4158%
4159% MagickGetImageCompression() gets the image compression.
4160%
4161% The format of the MagickGetImageCompression method is:
4162%
4163% CompressionType MagickGetImageCompression(MagickWand *wand)
4164%
4165% A description of each parameter follows:
4166%
4167% o wand: the magick wand.
4168%
4169*/
4170WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4171{
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(UndefinedCompression);
4181 }
4182 return(wand->images->compression);
4183}
4184
4185/*
4186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4187% %
4188% %
4189% %
4190% 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 %
4191% %
4192% %
4193% %
4194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4195%
4196% MagickGetImageCompression() gets the image compression quality.
4197%
4198% The format of the MagickGetImageCompression method is:
4199%
cristybb503372010-05-27 20:51:26 +00004200% size_t MagickGetImageCompression(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 MagickGetImageCompressionQuality(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 {
4215 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4216 "ContainsNoImages","`%s'",wand->name);
4217 return(0UL);
4218 }
4219 return(wand->images->quality);
4220}
4221
4222/*
4223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4224% %
4225% %
4226% %
4227% M a g i c k G e t I m a g e D e l a y %
4228% %
4229% %
4230% %
4231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4232%
4233% MagickGetImageDelay() gets the image delay.
4234%
4235% The format of the MagickGetImageDelay method is:
4236%
cristybb503372010-05-27 20:51:26 +00004237% size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004238%
4239% A description of each parameter follows:
4240%
4241% o wand: the magick wand.
4242%
4243*/
cristybb503372010-05-27 20:51:26 +00004244WandExport size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004245{
4246 assert(wand != (MagickWand *) NULL);
4247 assert(wand->signature == WandSignature);
4248 if (wand->debug != MagickFalse)
4249 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4250 if (wand->images == (Image *) NULL)
4251 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4252 return(wand->images->delay);
4253}
4254
4255/*
4256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4257% %
4258% %
4259% %
4260% M a g i c k G e t I m a g e D e p t h %
4261% %
4262% %
4263% %
4264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4265%
4266% MagickGetImageDepth() gets the image depth.
4267%
4268% The format of the MagickGetImageDepth method is:
4269%
cristybb503372010-05-27 20:51:26 +00004270% size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004271%
4272% A description of each parameter follows:
4273%
4274% o wand: the magick wand.
4275%
4276*/
cristybb503372010-05-27 20:51:26 +00004277WandExport size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004278{
4279 assert(wand != (MagickWand *) NULL);
4280 assert(wand->signature == WandSignature);
4281 if (wand->debug != MagickFalse)
4282 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4283 if (wand->images == (Image *) NULL)
4284 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyfefab1b2011-07-05 00:33:22 +00004285 return(GetImageDepth(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00004286}
4287
4288/*
4289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4290% %
4291% %
4292% %
cristy8a9106f2011-07-05 14:39:26 +00004293% M a g i c k G e t I m a g e D i s p o s e %
4294% %
4295% %
4296% %
4297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4298%
4299% MagickGetImageDispose() gets the image disposal method.
4300%
4301% The format of the MagickGetImageDispose method is:
4302%
4303% DisposeType MagickGetImageDispose(MagickWand *wand)
4304%
4305% A description of each parameter follows:
4306%
4307% o wand: the magick wand.
4308%
4309*/
4310WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4311{
4312 assert(wand != (MagickWand *) NULL);
4313 assert(wand->signature == WandSignature);
4314 if (wand->debug != MagickFalse)
4315 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4316 if (wand->images == (Image *) NULL)
4317 {
4318 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4319 "ContainsNoImages","`%s'",wand->name);
4320 return(UndefinedDispose);
4321 }
4322 return((DisposeType) wand->images->dispose);
4323}
4324
4325/*
4326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4327% %
4328% %
4329% %
cristy3ed852e2009-09-05 21:47:34 +00004330% M a g i c k G e t I m a g e D i s t o r t i o n %
4331% %
4332% %
4333% %
4334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4335%
4336% MagickGetImageDistortion() compares an image to a reconstructed image and
4337% returns the specified distortion metric.
4338%
4339% The format of the MagickGetImageDistortion method is:
4340%
4341% MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4342% const MagickWand *reference,const MetricType metric,
4343% double *distortion)
4344%
4345% A description of each parameter follows:
4346%
4347% o wand: the magick wand.
4348%
4349% o reference: the reference wand.
4350%
4351% o metric: the metric.
4352%
4353% o distortion: the computed distortion between the images.
4354%
4355*/
4356WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4357 const MagickWand *reference,const MetricType metric,double *distortion)
4358{
4359 MagickBooleanType
4360 status;
4361
cristy3ed852e2009-09-05 21:47:34 +00004362 assert(wand != (MagickWand *) NULL);
4363 assert(wand->signature == WandSignature);
4364 if (wand->debug != MagickFalse)
4365 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4366 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4367 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4368 status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4369 &wand->images->exception);
4370 return(status);
4371}
4372
4373/*
4374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4375% %
4376% %
4377% %
cristy8a9106f2011-07-05 14:39:26 +00004378% 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 +00004379% %
4380% %
4381% %
4382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4383%
cristy8a9106f2011-07-05 14:39:26 +00004384% MagickGetImageDistortions() compares one or more pixel channels of an
4385% image to a reconstructed image and returns the specified distortion metrics.
cristy3ed852e2009-09-05 21:47:34 +00004386%
cristy8a9106f2011-07-05 14:39:26 +00004387% Use MagickRelinquishMemory() to free the metrics when you are done with them.
cristy3ed852e2009-09-05 21:47:34 +00004388%
cristy8a9106f2011-07-05 14:39:26 +00004389% The format of the MagickGetImageDistortion method is:
4390%
4391% double *MagickGetImageDistortion(MagickWand *wand,
4392% const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004393%
4394% A description of each parameter follows:
4395%
4396% o wand: the magick wand.
4397%
cristy8a9106f2011-07-05 14:39:26 +00004398% o reference: the reference wand.
4399%
4400% o metric: the metric.
4401%
cristy3ed852e2009-09-05 21:47:34 +00004402*/
cristy8a9106f2011-07-05 14:39:26 +00004403WandExport double *MagickGetImageDistortions(MagickWand *wand,
4404 const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004405{
cristy8a9106f2011-07-05 14:39:26 +00004406 double
4407 *channel_distortion;
4408
cristy3ed852e2009-09-05 21:47:34 +00004409 assert(wand != (MagickWand *) NULL);
4410 assert(wand->signature == WandSignature);
4411 if (wand->debug != MagickFalse)
4412 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004413 assert(reference != (MagickWand *) NULL);
4414 assert(reference->signature == WandSignature);
4415 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
cristy3ed852e2009-09-05 21:47:34 +00004416 {
4417 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4418 "ContainsNoImages","`%s'",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004419 return((double *) NULL);
cristy3ed852e2009-09-05 21:47:34 +00004420 }
cristy8a9106f2011-07-05 14:39:26 +00004421 channel_distortion=GetImageDistortions(wand->images,reference->images,
4422 metric,&wand->images->exception);
4423 return(channel_distortion);
cristy3ed852e2009-09-05 21:47:34 +00004424}
4425
4426/*
4427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4428% %
4429% %
4430% %
4431% M a g i c k G e t I m a g e F i l e n a m e %
4432% %
4433% %
4434% %
4435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4436%
4437% MagickGetImageFilename() returns the filename of a particular image in a
4438% sequence.
4439%
4440% The format of the MagickGetImageFilename method is:
4441%
4442% char *MagickGetImageFilename(MagickWand *wand)
4443%
4444% A description of each parameter follows:
4445%
4446% o wand: the magick wand.
4447%
4448*/
4449WandExport char *MagickGetImageFilename(MagickWand *wand)
4450{
4451 assert(wand != (MagickWand *) NULL);
4452 assert(wand->signature == WandSignature);
4453 if (wand->debug != MagickFalse)
4454 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4455 if (wand->images == (Image *) NULL)
4456 {
4457 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4458 "ContainsNoImages","`%s'",wand->name);
4459 return((char *) NULL);
4460 }
4461 return(AcquireString(wand->images->filename));
4462}
4463
4464/*
4465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4466% %
4467% %
4468% %
4469% M a g i c k G e t I m a g e F o r m a t %
4470% %
4471% %
4472% %
4473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4474%
4475% MagickGetImageFormat() returns the format of a particular image in a
4476% sequence.
4477%
4478% The format of the MagickGetImageFormat method is:
4479%
cristy197d0572010-07-29 23:26:05 +00004480% const char *MagickGetImageFormat(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004481%
4482% A description of each parameter follows:
4483%
4484% o wand: the magick wand.
4485%
4486*/
4487WandExport char *MagickGetImageFormat(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((char *) NULL);
4498 }
4499 return(AcquireString(wand->images->magick));
4500}
4501
4502/*
4503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4504% %
4505% %
4506% %
4507% M a g i c k G e t I m a g e F u z z %
4508% %
4509% %
4510% %
4511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4512%
4513% MagickGetImageFuzz() gets the image fuzz.
4514%
4515% The format of the MagickGetImageFuzz method is:
4516%
4517% double MagickGetImageFuzz(MagickWand *wand)
4518%
4519% A description of each parameter follows:
4520%
4521% o wand: the magick wand.
4522%
4523*/
4524WandExport double MagickGetImageFuzz(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->fuzz);
4537}
4538
4539/*
4540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4541% %
4542% %
4543% %
4544% M a g i c k G e t I m a g e G a m m a %
4545% %
4546% %
4547% %
4548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4549%
4550% MagickGetImageGamma() gets the image gamma.
4551%
4552% The format of the MagickGetImageGamma method is:
4553%
4554% double MagickGetImageGamma(MagickWand *wand)
4555%
4556% A description of each parameter follows:
4557%
4558% o wand: the magick wand.
4559%
4560*/
4561WandExport double MagickGetImageGamma(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(0.0);
4572 }
4573 return(wand->images->gamma);
4574}
4575
4576/*
4577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4578% %
4579% %
4580% %
4581% 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 %
4582% %
4583% %
4584% %
4585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4586%
4587% MagickGetImageGravity() gets the image gravity.
4588%
4589% The format of the MagickGetImageGravity method is:
4590%
4591% GravityType MagickGetImageGravity(MagickWand *wand)
4592%
4593% A description of each parameter follows:
4594%
4595% o wand: the magick wand.
4596%
4597*/
4598WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4599{
4600 assert(wand != (MagickWand *) NULL);
4601 assert(wand->signature == WandSignature);
4602 if (wand->debug != MagickFalse)
4603 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4604 if (wand->images == (Image *) NULL)
4605 {
4606 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4607 "ContainsNoImages","`%s'",wand->name);
4608 return(UndefinedGravity);
4609 }
4610 return(wand->images->gravity);
4611}
4612
4613/*
4614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4615% %
4616% %
4617% %
4618% 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 %
4619% %
4620% %
4621% %
4622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4623%
4624% MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4625%
4626% The format of the MagickGetImageGreenPrimary method is:
4627%
4628% MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4629% double *y)
4630%
4631% A description of each parameter follows:
4632%
4633% o wand: the magick wand.
4634%
4635% o x: the chromaticity green primary x-point.
4636%
4637% o y: the chromaticity green primary y-point.
4638%
4639*/
4640WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4641 double *x,double *y)
4642{
4643 assert(wand != (MagickWand *) NULL);
4644 assert(wand->signature == WandSignature);
4645 if (wand->debug != MagickFalse)
4646 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4647 if (wand->images == (Image *) NULL)
4648 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4649 *x=wand->images->chromaticity.green_primary.x;
4650 *y=wand->images->chromaticity.green_primary.y;
4651 return(MagickTrue);
4652}
4653
4654/*
4655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656% %
4657% %
4658% %
4659% M a g i c k G e t I m a g e H e i g h t %
4660% %
4661% %
4662% %
4663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4664%
4665% MagickGetImageHeight() returns the image height.
4666%
4667% The format of the MagickGetImageHeight method is:
4668%
cristybb503372010-05-27 20:51:26 +00004669% size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004670%
4671% A description of each parameter follows:
4672%
4673% o wand: the magick wand.
4674%
4675*/
cristybb503372010-05-27 20:51:26 +00004676WandExport size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004677{
4678 assert(wand != (MagickWand *) NULL);
4679 assert(wand->signature == WandSignature);
4680 if (wand->debug != MagickFalse)
4681 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4682 if (wand->images == (Image *) NULL)
4683 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4684 return(wand->images->rows);
4685}
4686
4687/*
4688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4689% %
4690% %
4691% %
4692% M a g i c k G e t I m a g e H i s t o g r a m %
4693% %
4694% %
4695% %
4696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4697%
4698% MagickGetImageHistogram() returns the image histogram as an array of
4699% PixelWand wands.
4700%
4701% The format of the MagickGetImageHistogram method is:
4702%
4703% PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004704% size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00004705%
4706% A description of each parameter follows:
4707%
4708% o wand: the magick wand.
4709%
4710% o number_colors: the number of unique colors in the image and the number
4711% of pixel wands returned.
4712%
4713*/
4714WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004715 size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00004716{
cristy101ab702011-10-13 13:06:32 +00004717 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00004718 *histogram;
4719
4720 PixelWand
4721 **pixel_wands;
4722
cristybb503372010-05-27 20:51:26 +00004723 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +00004724 i;
4725
4726 assert(wand != (MagickWand *) NULL);
4727 assert(wand->signature == WandSignature);
4728 if (wand->debug != MagickFalse)
4729 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4730 if (wand->images == (Image *) NULL)
4731 {
4732 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4733 "ContainsNoImages","`%s'",wand->name);
4734 return((PixelWand **) NULL);
4735 }
4736 histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
cristy101ab702011-10-13 13:06:32 +00004737 if (histogram == (PixelInfo *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00004738 return((PixelWand **) NULL);
4739 pixel_wands=NewPixelWands(*number_colors);
cristybb503372010-05-27 20:51:26 +00004740 for (i=0; i < (ssize_t) *number_colors; i++)
cristy3ed852e2009-09-05 21:47:34 +00004741 {
cristy4c08aed2011-07-01 19:47:50 +00004742 PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
cristybb503372010-05-27 20:51:26 +00004743 PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
cristy3ed852e2009-09-05 21:47:34 +00004744 }
cristy101ab702011-10-13 13:06:32 +00004745 histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
cristy3ed852e2009-09-05 21:47:34 +00004746 return(pixel_wands);
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 l a c e S c h e m e %
4755% %
4756% %
4757% %
4758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4759%
4760% MagickGetImageInterlaceScheme() gets the image interlace scheme.
4761%
4762% The format of the MagickGetImageInterlaceScheme method is:
4763%
4764% InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4765%
4766% A description of each parameter follows:
4767%
4768% o wand: the magick wand.
4769%
4770*/
4771WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4772{
4773 assert(wand != (MagickWand *) NULL);
4774 assert(wand->signature == WandSignature);
4775 if (wand->debug != MagickFalse)
4776 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4777 if (wand->images == (Image *) NULL)
4778 {
4779 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4780 "ContainsNoImages","`%s'",wand->name);
4781 return(UndefinedInterlace);
4782 }
4783 return(wand->images->interlace);
4784}
4785
4786/*
4787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4788% %
4789% %
4790% %
4791% 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 %
4792% %
4793% %
4794% %
4795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4796%
4797% MagickGetImageInterpolateMethod() returns the interpolation method for the
4798% sepcified image.
4799%
4800% The format of the MagickGetImageInterpolateMethod method is:
4801%
cristy5c4e2582011-09-11 19:21:03 +00004802% PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4803% 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*/
cristy5c4e2582011-09-11 19:21:03 +00004810WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
cristy3ed852e2009-09-05 21:47:34 +00004811 MagickWand *wand)
4812{
4813 assert(wand != (MagickWand *) NULL);
4814 assert(wand->signature == WandSignature);
4815 if (wand->debug != MagickFalse)
4816 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4817 if (wand->images == (Image *) NULL)
4818 {
4819 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4820 "ContainsNoImages","`%s'",wand->name);
4821 return(UndefinedInterpolatePixel);
4822 }
4823 return(wand->images->interpolate);
4824}
4825
4826/*
4827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4828% %
4829% %
4830% %
4831% M a g i c k G e t I m a g e I t e r a t i o n s %
4832% %
4833% %
4834% %
4835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4836%
4837% MagickGetImageIterations() gets the image iterations.
4838%
4839% The format of the MagickGetImageIterations method is:
4840%
cristybb503372010-05-27 20:51:26 +00004841% size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004842%
4843% A description of each parameter follows:
4844%
4845% o wand: the magick wand.
4846%
4847*/
cristybb503372010-05-27 20:51:26 +00004848WandExport size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004849{
4850 assert(wand != (MagickWand *) NULL);
4851 assert(wand->signature == WandSignature);
4852 if (wand->debug != MagickFalse)
4853 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4854 if (wand->images == (Image *) NULL)
4855 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4856 return(wand->images->iterations);
4857}
4858
4859/*
4860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4861% %
4862% %
4863% %
4864% M a g i c k G e t I m a g e L e n g t h %
4865% %
4866% %
4867% %
4868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4869%
4870% MagickGetImageLength() returns the image length in bytes.
4871%
4872% The format of the MagickGetImageLength method is:
4873%
4874% MagickBooleanType MagickGetImageLength(MagickWand *wand,
4875% MagickSizeType *length)
4876%
4877% A description of each parameter follows:
4878%
4879% o wand: the magick wand.
4880%
4881% o length: the image length in bytes.
4882%
4883*/
4884WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4885 MagickSizeType *length)
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);
4893 *length=GetBlobSize(wand->images);
4894 return(MagickTrue);
4895}
4896
4897/*
4898%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4899% %
4900% %
4901% %
4902% M a g i c k G e t I m a g e M a t t e C o l o r %
4903% %
4904% %
4905% %
4906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4907%
4908% MagickGetImageMatteColor() returns the image matte color.
4909%
4910% The format of the MagickGetImageMatteColor method is:
4911%
4912% MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4913% PixelWand *matte_color)
4914%
4915% A description of each parameter follows:
4916%
4917% o wand: the magick wand.
4918%
4919% o matte_color: Return the matte color.
4920%
4921*/
4922WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4923 PixelWand *matte_color)
4924{
4925 assert(wand != (MagickWand *) NULL);
4926 assert(wand->signature == WandSignature);
4927 if (wand->debug != MagickFalse)
4928 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4929 if (wand->images == (Image *) NULL)
4930 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00004931 PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
cristy3ed852e2009-09-05 21:47:34 +00004932 return(MagickTrue);
4933}
4934
4935/*
4936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4937% %
4938% %
4939% %
4940% 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 %
4941% %
4942% %
4943% %
4944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4945%
4946% MagickGetImageOrientation() returns the image orientation.
4947%
4948% The format of the MagickGetImageOrientation method is:
4949%
4950% OrientationType MagickGetImageOrientation(MagickWand *wand)
4951%
4952% A description of each parameter follows:
4953%
4954% o wand: the magick wand.
4955%
4956*/
4957WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4958{
4959 assert(wand != (MagickWand *) NULL);
4960 assert(wand->signature == WandSignature);
4961 if (wand->debug != MagickFalse)
4962 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4963 if (wand->images == (Image *) NULL)
4964 {
4965 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4966 "ContainsNoImages","`%s'",wand->name);
4967 return(UndefinedOrientation);
4968 }
4969 return(wand->images->orientation);
4970}
4971
4972/*
4973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4974% %
4975% %
4976% %
4977% M a g i c k G e t I m a g e P a g e %
4978% %
4979% %
4980% %
4981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4982%
4983% MagickGetImagePage() returns the page geometry associated with the image.
4984%
4985% The format of the MagickGetImagePage method is:
4986%
4987% MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004988% size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00004989%
4990% A description of each parameter follows:
4991%
4992% o wand: the magick wand.
4993%
4994% o width: the page width.
4995%
4996% o height: the page height.
4997%
4998% o x: the page x-offset.
4999%
5000% o y: the page y-offset.
5001%
5002*/
5003WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005004 size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00005005{
5006 assert(wand != (const MagickWand *) NULL);
5007 assert(wand->signature == WandSignature);
5008 if (wand->debug != MagickFalse)
5009 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5010 if (wand->images == (Image *) NULL)
5011 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5012 *width=wand->images->page.width;
5013 *height=wand->images->page.height;
5014 *x=wand->images->page.x;
5015 *y=wand->images->page.y;
5016 return(MagickTrue);
5017}
5018
5019/*
5020%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5021% %
5022% %
5023% %
5024% M a g i c k G e t I m a g e P i x e l C o l o r %
5025% %
5026% %
5027% %
5028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5029%
5030% MagickGetImagePixelColor() returns the color of the specified pixel.
5031%
5032% The format of the MagickGetImagePixelColor method is:
5033%
5034% MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005035% const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005036%
5037% A description of each parameter follows:
5038%
5039% o wand: the magick wand.
5040%
5041% o x,y: the pixel offset into the image.
5042%
5043% o color: Return the colormap color in this wand.
5044%
5045*/
5046WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005047 const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005048{
cristy4c08aed2011-07-01 19:47:50 +00005049 register const Quantum
cristy3ed852e2009-09-05 21:47:34 +00005050 *p;
5051
5052 CacheView
5053 *image_view;
5054
5055 assert(wand != (MagickWand *) NULL);
5056 assert(wand->signature == WandSignature);
5057 if (wand->debug != MagickFalse)
5058 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5059 if (wand->images == (Image *) NULL)
5060 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5061 image_view=AcquireCacheView(wand->images);
5062 p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
cristy4c08aed2011-07-01 19:47:50 +00005063 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00005064 {
5065 image_view=DestroyCacheView(image_view);
5066 return(MagickFalse);
5067 }
cristy4c08aed2011-07-01 19:47:50 +00005068 PixelSetQuantumPixel(wand->images,p,color);
cristy3ed852e2009-09-05 21:47:34 +00005069 image_view=DestroyCacheView(image_view);
5070 return(MagickTrue);
5071}
5072
5073/*
5074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5075% %
5076% %
5077% %
cristy3ed852e2009-09-05 21:47:34 +00005078% M a g i c k G e t I m a g e R e d P r i m a r y %
5079% %
5080% %
5081% %
5082%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5083%
5084% MagickGetImageRedPrimary() returns the chromaticy red primary point.
5085%
5086% The format of the MagickGetImageRedPrimary method is:
5087%
5088% MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5089% double *y)
5090%
5091% A description of each parameter follows:
5092%
5093% o wand: the magick wand.
5094%
5095% o x: the chromaticity red primary x-point.
5096%
5097% o y: the chromaticity red primary y-point.
5098%
5099*/
5100WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5101 double *x,double *y)
5102{
5103 assert(wand != (MagickWand *) NULL);
5104 assert(wand->signature == WandSignature);
5105 if (wand->debug != MagickFalse)
5106 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5107 if (wand->images == (Image *) NULL)
5108 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5109 *x=wand->images->chromaticity.red_primary.x;
5110 *y=wand->images->chromaticity.red_primary.y;
5111 return(MagickTrue);
5112}
5113
5114/*
5115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5116% %
5117% %
5118% %
5119% M a g i c k G e t I m a g e R e g i o n %
5120% %
5121% %
5122% %
5123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5124%
5125% MagickGetImageRegion() extracts a region of the image and returns it as a
5126% a new wand.
5127%
5128% The format of the MagickGetImageRegion method is:
5129%
5130% MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005131% const size_t width,const size_t height,const ssize_t x,
5132% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005133%
5134% A description of each parameter follows:
5135%
5136% o wand: the magick wand.
5137%
5138% o width: the region width.
5139%
5140% o height: the region height.
5141%
5142% o x: the region x offset.
5143%
5144% o y: the region y offset.
5145%
5146*/
5147WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005148 const size_t width,const size_t height,const ssize_t x,
5149 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005150{
5151 Image
5152 *region_image;
5153
5154 RectangleInfo
5155 region;
5156
5157 assert(wand != (MagickWand *) NULL);
5158 assert(wand->signature == WandSignature);
5159 if (wand->debug != MagickFalse)
5160 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5161 if (wand->images == (Image *) NULL)
5162 return((MagickWand *) NULL);
5163 region.width=width;
5164 region.height=height;
5165 region.x=x;
5166 region.y=y;
5167 region_image=CropImage(wand->images,&region,wand->exception);
5168 if (region_image == (Image *) NULL)
5169 return((MagickWand *) NULL);
5170 return(CloneMagickWandFromImages(wand,region_image));
5171}
5172
5173/*
5174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5175% %
5176% %
5177% %
5178% 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 %
5179% %
5180% %
5181% %
5182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5183%
5184% MagickGetImageRenderingIntent() gets the image rendering intent.
5185%
5186% The format of the MagickGetImageRenderingIntent method is:
5187%
5188% RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5189%
5190% A description of each parameter follows:
5191%
5192% o wand: the magick wand.
5193%
5194*/
5195WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5196{
5197 assert(wand != (MagickWand *) NULL);
5198 assert(wand->signature == WandSignature);
5199 if (wand->debug != MagickFalse)
5200 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5201 if (wand->images == (Image *) NULL)
5202 {
5203 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5204 "ContainsNoImages","`%s'",wand->name);
5205 return(UndefinedIntent);
5206 }
5207 return((RenderingIntent) wand->images->rendering_intent);
5208}
5209
5210/*
5211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5212% %
5213% %
5214% %
5215% M a g i c k G e t I m a g e R e s o l u t i o n %
5216% %
5217% %
5218% %
5219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5220%
5221% MagickGetImageResolution() gets the image X and Y resolution.
5222%
5223% The format of the MagickGetImageResolution method is:
5224%
5225% MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5226% double *y)
5227%
5228% A description of each parameter follows:
5229%
5230% o wand: the magick wand.
5231%
5232% o x: the image x-resolution.
5233%
5234% o y: the image y-resolution.
5235%
5236*/
5237WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5238 double *x,double *y)
5239{
5240 assert(wand != (MagickWand *) NULL);
5241 assert(wand->signature == WandSignature);
5242 if (wand->debug != MagickFalse)
5243 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5244 if (wand->images == (Image *) NULL)
5245 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5246 *x=wand->images->x_resolution;
5247 *y=wand->images->y_resolution;
5248 return(MagickTrue);
5249}
5250
5251/*
5252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5253% %
5254% %
5255% %
5256% M a g i c k G e t I m a g e S c e n e %
5257% %
5258% %
5259% %
5260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5261%
5262% MagickGetImageScene() gets the image scene.
5263%
5264% The format of the MagickGetImageScene method is:
5265%
cristybb503372010-05-27 20:51:26 +00005266% size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005267%
5268% A description of each parameter follows:
5269%
5270% o wand: the magick wand.
5271%
5272*/
cristybb503372010-05-27 20:51:26 +00005273WandExport size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005274{
5275 assert(wand != (MagickWand *) NULL);
5276 assert(wand->signature == WandSignature);
5277 if (wand->debug != MagickFalse)
5278 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5279 if (wand->images == (Image *) NULL)
5280 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5281 return(wand->images->scene);
5282}
5283
5284/*
5285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5286% %
5287% %
5288% %
5289% M a g i c k G e t I m a g e S i g n a t u r e %
5290% %
5291% %
5292% %
5293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5294%
5295% MagickGetImageSignature() generates an SHA-256 message digest for the image
5296% pixel stream.
5297%
5298% The format of the MagickGetImageSignature method is:
5299%
5300% const char MagickGetImageSignature(MagickWand *wand)
5301%
5302% A description of each parameter follows:
5303%
5304% o wand: the magick wand.
5305%
5306*/
5307WandExport char *MagickGetImageSignature(MagickWand *wand)
5308{
5309 const char
5310 *value;
5311
5312 MagickBooleanType
5313 status;
5314
5315 assert(wand != (MagickWand *) NULL);
5316 assert(wand->signature == WandSignature);
5317 if (wand->debug != MagickFalse)
5318 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5319 if (wand->images == (Image *) NULL)
5320 {
5321 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5322 "ContainsNoImages","`%s'",wand->name);
5323 return((char *) NULL);
5324 }
cristy018f07f2011-09-04 21:15:19 +00005325 status=SignatureImage(wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005326 if (status == MagickFalse)
cristy018f07f2011-09-04 21:15:19 +00005327 return((char *) NULL);
cristy3ed852e2009-09-05 21:47:34 +00005328 value=GetImageProperty(wand->images,"signature");
cristy018f07f2011-09-04 21:15:19 +00005329 if (value == (const char *) NULL)
5330 return((char *) NULL);
5331 return(AcquireString(value));
cristy3ed852e2009-09-05 21:47:34 +00005332}
5333
5334/*
5335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5336% %
5337% %
5338% %
5339% 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 %
5340% %
5341% %
5342% %
5343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5344%
5345% MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5346%
5347% The format of the MagickGetImageTicksPerSecond method is:
5348%
cristybb503372010-05-27 20:51:26 +00005349% size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005350%
5351% A description of each parameter follows:
5352%
5353% o wand: the magick wand.
5354%
5355*/
cristybb503372010-05-27 20:51:26 +00005356WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005357{
5358 assert(wand != (MagickWand *) NULL);
5359 assert(wand->signature == WandSignature);
5360 if (wand->debug != MagickFalse)
5361 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5362 if (wand->images == (Image *) NULL)
5363 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristybb503372010-05-27 20:51:26 +00005364 return((size_t) wand->images->ticks_per_second);
cristy3ed852e2009-09-05 21:47:34 +00005365}
5366
5367/*
5368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5369% %
5370% %
5371% %
5372% M a g i c k G e t I m a g e T y p e %
5373% %
5374% %
5375% %
5376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5377%
5378% MagickGetImageType() gets the potential image type:
5379%
5380% Bilevel Grayscale GrayscaleMatte
5381% Palette PaletteMatte TrueColor
5382% TrueColorMatte ColorSeparation ColorSeparationMatte
5383%
5384% To ensure the image type matches its potential, use MagickSetImageType():
5385%
5386% (void) MagickSetImageType(wand,MagickGetImageType(wand));
5387%
5388% The format of the MagickGetImageType method is:
5389%
5390% ImageType MagickGetImageType(MagickWand *wand)
5391%
5392% A description of each parameter follows:
5393%
5394% o wand: the magick wand.
5395%
5396*/
5397WandExport ImageType MagickGetImageType(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);
cristy5f1c1ff2010-12-23 21:38:06 +00005407 return(UndefinedType);
cristy3ed852e2009-09-05 21:47:34 +00005408 }
5409 return(GetImageType(wand->images,wand->exception));
5410}
5411
5412/*
5413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5414% %
5415% %
5416% %
5417% M a g i c k G e t I m a g e U n i t s %
5418% %
5419% %
5420% %
5421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5422%
5423% MagickGetImageUnits() gets the image units of resolution.
5424%
5425% The format of the MagickGetImageUnits method is:
5426%
5427% ResolutionType MagickGetImageUnits(MagickWand *wand)
5428%
5429% A description of each parameter follows:
5430%
5431% o wand: the magick wand.
5432%
5433*/
5434WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5435{
5436 assert(wand != (MagickWand *) NULL);
5437 assert(wand->signature == WandSignature);
5438 if (wand->debug != MagickFalse)
5439 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5440 if (wand->images == (Image *) NULL)
5441 {
5442 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5443 "ContainsNoImages","`%s'",wand->name);
5444 return(UndefinedResolution);
5445 }
5446 return(wand->images->units);
5447}
5448
5449/*
5450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5451% %
5452% %
5453% %
5454% 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 %
5455% %
5456% %
5457% %
5458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5459%
5460% MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5461% sepcified image.
5462%
5463% The format of the MagickGetImageVirtualPixelMethod method is:
5464%
5465% VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5466%
5467% A description of each parameter follows:
5468%
5469% o wand: the magick wand.
5470%
5471*/
5472WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5473{
5474 assert(wand != (MagickWand *) NULL);
5475 assert(wand->signature == WandSignature);
5476 if (wand->debug != MagickFalse)
5477 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5478 if (wand->images == (Image *) NULL)
5479 {
5480 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5481 "ContainsNoImages","`%s'",wand->name);
5482 return(UndefinedVirtualPixelMethod);
5483 }
5484 return(GetImageVirtualPixelMethod(wand->images));
5485}
5486
5487/*
5488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5489% %
5490% %
5491% %
5492% M a g i c k G e t I m a g e W h i t e P o i n t %
5493% %
5494% %
5495% %
5496%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5497%
5498% MagickGetImageWhitePoint() returns the chromaticy white point.
5499%
5500% The format of the MagickGetImageWhitePoint method is:
5501%
5502% MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5503% double *y)
5504%
5505% A description of each parameter follows:
5506%
5507% o wand: the magick wand.
5508%
5509% o x: the chromaticity white x-point.
5510%
5511% o y: the chromaticity white y-point.
5512%
5513*/
5514WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5515 double *x,double *y)
5516{
5517 assert(wand != (MagickWand *) NULL);
5518 assert(wand->signature == WandSignature);
5519 if (wand->debug != MagickFalse)
5520 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5521 if (wand->images == (Image *) NULL)
5522 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5523 *x=wand->images->chromaticity.white_point.x;
5524 *y=wand->images->chromaticity.white_point.y;
5525 return(MagickTrue);
5526}
5527
5528/*
5529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5530% %
5531% %
5532% %
5533% M a g i c k G e t I m a g e W i d t h %
5534% %
5535% %
5536% %
5537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5538%
5539% MagickGetImageWidth() returns the image width.
5540%
5541% The format of the MagickGetImageWidth method is:
5542%
cristybb503372010-05-27 20:51:26 +00005543% size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005544%
5545% A description of each parameter follows:
5546%
5547% o wand: the magick wand.
5548%
5549*/
cristybb503372010-05-27 20:51:26 +00005550WandExport size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005551{
5552 assert(wand != (MagickWand *) NULL);
5553 assert(wand->signature == WandSignature);
5554 if (wand->debug != MagickFalse)
5555 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5556 if (wand->images == (Image *) NULL)
5557 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5558 return(wand->images->columns);
5559}
5560
5561/*
5562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5563% %
5564% %
5565% %
5566% M a g i c k G e t N u m b e r I m a g e s %
5567% %
5568% %
5569% %
5570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5571%
5572% MagickGetNumberImages() returns the number of images associated with a
5573% magick wand.
5574%
5575% The format of the MagickGetNumberImages method is:
5576%
cristybb503372010-05-27 20:51:26 +00005577% size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005578%
5579% A description of each parameter follows:
5580%
5581% o wand: the magick wand.
5582%
5583*/
cristybb503372010-05-27 20:51:26 +00005584WandExport size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005585{
5586 assert(wand != (MagickWand *) NULL);
5587 assert(wand->signature == WandSignature);
5588 if (wand->debug != MagickFalse)
5589 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5590 return(GetImageListLength(wand->images));
5591}
5592
5593/*
5594%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5595% %
5596% %
5597% %
5598% 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 %
5599% %
5600% %
5601% %
5602%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5603%
5604% MagickGetImageTotalInkDensity() gets the image total ink density.
5605%
5606% The format of the MagickGetImageTotalInkDensity method is:
5607%
5608% double MagickGetImageTotalInkDensity(MagickWand *wand)
5609%
5610% A description of each parameter follows:
5611%
5612% o wand: the magick wand.
5613%
5614*/
5615WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5616{
5617 assert(wand != (MagickWand *) NULL);
5618 assert(wand->signature == WandSignature);
5619 if (wand->debug != MagickFalse)
5620 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5621 if (wand->images == (Image *) NULL)
5622 {
5623 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5624 "ContainsNoImages","`%s'",wand->name);
5625 return(0.0);
5626 }
5627 return(GetImageTotalInkDensity(wand->images));
5628}
5629
5630/*
5631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5632% %
5633% %
5634% %
5635% M a g i c k H a l d C l u t I m a g e %
5636% %
5637% %
5638% %
5639%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5640%
5641% MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5642% table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
5643% dimensions. Create it with the HALD coder. You can apply any color
5644% transformation to the Hald image and then use this method to apply the
5645% transform to the image.
5646%
5647% The format of the MagickHaldClutImage method is:
5648%
5649% MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5650% const MagickWand *hald_wand)
cristy3ed852e2009-09-05 21:47:34 +00005651%
5652% A description of each parameter follows:
5653%
5654% o wand: the magick wand.
5655%
5656% o hald_image: the hald CLUT image.
5657%
5658*/
cristy3ed852e2009-09-05 21:47:34 +00005659WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5660 const MagickWand *hald_wand)
5661{
5662 MagickBooleanType
5663 status;
5664
cristy3ed852e2009-09-05 21:47:34 +00005665 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) || (hald_wand->images == (Image *) NULL))
5670 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy7c0a0a42011-08-23 17:57:25 +00005671 status=HaldClutImage(wand->images,hald_wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00005672 return(status);
5673}
5674
5675/*
5676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5677% %
5678% %
5679% %
5680% M a g i c k H a s N e x t I m a g e %
5681% %
5682% %
5683% %
5684%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5685%
5686% MagickHasNextImage() returns MagickTrue if the wand has more images when
5687% traversing the list in the forward direction
5688%
5689% The format of the MagickHasNextImage method is:
5690%
5691% MagickBooleanType MagickHasNextImage(MagickWand *wand)
5692%
5693% A description of each parameter follows:
5694%
5695% o wand: the magick wand.
5696%
5697*/
5698WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5699{
5700 assert(wand != (MagickWand *) NULL);
5701 assert(wand->signature == WandSignature);
5702 if (wand->debug != MagickFalse)
5703 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5704 if (wand->images == (Image *) NULL)
5705 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5706 if (GetNextImageInList(wand->images) == (Image *) NULL)
5707 return(MagickFalse);
5708 return(MagickTrue);
5709}
5710
5711/*
5712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5713% %
5714% %
5715% %
5716% M a g i c k H a s P r e v i o u s I m a g e %
5717% %
5718% %
5719% %
5720%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5721%
5722% MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5723% traversing the list in the reverse direction
5724%
5725% The format of the MagickHasPreviousImage method is:
5726%
5727% MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5728%
5729% A description of each parameter follows:
5730%
5731% o wand: the magick wand.
5732%
5733*/
5734WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5735{
5736 assert(wand != (MagickWand *) NULL);
5737 assert(wand->signature == WandSignature);
5738 if (wand->debug != MagickFalse)
5739 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5740 if (wand->images == (Image *) NULL)
5741 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5742 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5743 return(MagickFalse);
5744 return(MagickTrue);
5745}
5746
5747/*
5748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5749% %
5750% %
5751% %
5752% M a g i c k I d e n t i f y I m a g e %
5753% %
5754% %
5755% %
5756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5757%
5758% MagickIdentifyImage() identifies an image by printing its attributes to the
5759% file. Attributes include the image width, height, size, and others.
5760%
5761% The format of the MagickIdentifyImage method is:
5762%
5763% const char *MagickIdentifyImage(MagickWand *wand)
5764%
5765% A description of each parameter follows:
5766%
5767% o wand: the magick wand.
5768%
5769*/
5770WandExport char *MagickIdentifyImage(MagickWand *wand)
5771{
5772 char
5773 *description,
5774 filename[MaxTextExtent];
5775
5776 FILE
5777 *file;
5778
5779 int
5780 unique_file;
5781
5782 assert(wand != (MagickWand *) NULL);
5783 assert(wand->signature == WandSignature);
5784 if (wand->debug != MagickFalse)
5785 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5786 if (wand->images == (Image *) NULL)
5787 {
5788 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5789 "ContainsNoImages","`%s'",wand->name);
5790 return((char *) NULL);
5791 }
5792 description=(char *) NULL;
5793 unique_file=AcquireUniqueFileResource(filename);
5794 file=(FILE *) NULL;
5795 if (unique_file != -1)
5796 file=fdopen(unique_file,"wb");
5797 if ((unique_file == -1) || (file == (FILE *) NULL))
5798 {
5799 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5800 "UnableToCreateTemporaryFile","`%s'",wand->name);
5801 return((char *) NULL);
5802 }
cristya4037272011-08-28 15:11:39 +00005803 (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005804 (void) fclose(file);
5805 description=FileToString(filename,~0,wand->exception);
5806 (void) RelinquishUniqueFileResource(filename);
5807 return(description);
5808}
5809
5810/*
5811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5812% %
5813% %
5814% %
5815% M a g i c k I m p l o d e I m a g e %
5816% %
5817% %
5818% %
5819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5820%
5821% MagickImplodeImage() creates a new image that is a copy of an existing
5822% one with the image pixels "implode" by the specified percentage. It
5823% allocates the memory necessary for the new Image structure and returns a
5824% pointer to the new image.
5825%
5826% The format of the MagickImplodeImage method is:
5827%
5828% MagickBooleanType MagickImplodeImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +00005829% const double radius,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00005830%
5831% A description of each parameter follows:
5832%
5833% o wand: the magick wand.
5834%
5835% o amount: Define the extent of the implosion.
5836%
cristy76f512e2011-09-12 01:26:56 +00005837% o method: the pixel interpolation method.
5838%
cristy3ed852e2009-09-05 21:47:34 +00005839*/
5840WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +00005841 const double amount,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00005842{
5843 Image
5844 *implode_image;
5845
5846 assert(wand != (MagickWand *) NULL);
5847 assert(wand->signature == WandSignature);
5848 if (wand->debug != MagickFalse)
5849 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5850 if (wand->images == (Image *) NULL)
5851 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +00005852 implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005853 if (implode_image == (Image *) NULL)
5854 return(MagickFalse);
5855 ReplaceImageInList(&wand->images,implode_image);
5856 return(MagickTrue);
5857}
5858
5859/*
5860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5861% %
5862% %
5863% %
5864% M a g i c k I m p o r t I m a g e P i x e l s %
5865% %
5866% %
5867% %
5868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5869%
5870% MagickImportImagePixels() accepts pixel datand stores it in the image at the
5871% location you specify. The method returns MagickFalse on success otherwise
5872% MagickTrue if an error is encountered. The pixel data can be either char,
cristybb503372010-05-27 20:51:26 +00005873% short int, int, ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00005874%
5875% Suppose your want to upload the first scanline of a 640x480 image from
5876% character data in red-green-blue order:
5877%
5878% MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5879%
5880% The format of the MagickImportImagePixels method is:
5881%
5882% MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005883% const ssize_t x,const ssize_t y,const size_t columns,
5884% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00005885% const void *pixels)
5886%
5887% A description of each parameter follows:
5888%
5889% o wand: the magick wand.
5890%
5891% o x, y, columns, rows: These values define the perimeter of a region
5892% of pixels you want to define.
5893%
5894% o map: This string reflects the expected ordering of the pixel array.
5895% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00005896% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00005897% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5898% P = pad.
5899%
5900% o storage: Define the data type of the pixels. Float and double types are
5901% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
5902% these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5903% or DoublePixel.
5904%
5905% o pixels: This array of values contain the pixel components as defined by
5906% map and type. You must preallocate this array where the expected
5907% length varies depending on the values of width, height, map, and type.
5908%
5909*/
5910WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristy018f07f2011-09-04 21:15:19 +00005911 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5912 const char *map,const StorageType storage,const void *pixels)
cristy3ed852e2009-09-05 21:47:34 +00005913{
5914 MagickBooleanType
5915 status;
5916
5917 assert(wand != (MagickWand *) NULL);
5918 assert(wand->signature == WandSignature);
5919 if (wand->debug != MagickFalse)
5920 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5921 if (wand->images == (Image *) NULL)
5922 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00005923 status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5924 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005925 return(status);
5926}
5927
5928/*
5929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5930% %
5931% %
5932% %
5933% 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 %
5934% %
5935% %
5936% %
5937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5938%
5939% MagickInverseFourierTransformImage() implements the inverse discrete
5940% Fourier transform (DFT) of the image either as a magnitude / phase or real /
5941% imaginary image pair.
5942%
5943% The format of the MagickInverseFourierTransformImage method is:
5944%
5945% MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00005946% MagickWand *magnitude_wand,MagickWand *phase_wand,
5947% const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00005948%
5949% A description of each parameter follows:
5950%
cristyc9550792009-11-13 20:05:42 +00005951% o magnitude_wand: the magnitude or real wand.
5952%
5953% o phase_wand: the phase or imaginary wand.
cristy3ed852e2009-09-05 21:47:34 +00005954%
5955% o magnitude: if true, return as magnitude / phase pair otherwise a real /
5956% imaginary image pair.
5957%
5958*/
5959WandExport MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00005960 MagickWand *magnitude_wand,MagickWand *phase_wand,
5961 const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00005962{
5963 Image
5964 *inverse_image;
5965
cristyc9550792009-11-13 20:05:42 +00005966 MagickWand
5967 *wand;
5968
5969 assert(magnitude_wand != (MagickWand *) NULL);
5970 assert(magnitude_wand->signature == WandSignature);
5971 if (magnitude_wand->debug != MagickFalse)
5972 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5973 magnitude_wand->name);
5974 wand=magnitude_wand;
5975 if (magnitude_wand->images == (Image *) NULL)
5976 ThrowWandException(WandError,"ContainsNoImages",
5977 magnitude_wand->name);
5978 assert(phase_wand != (MagickWand *) NULL);
5979 assert(phase_wand->signature == WandSignature);
5980 inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5981 phase_wand->images,magnitude,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005982 if (inverse_image == (Image *) NULL)
5983 return(MagickFalse);
5984 ReplaceImageInList(&wand->images,inverse_image);
5985 return(MagickTrue);
5986}
5987
5988/*
5989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5990% %
5991% %
5992% %
5993% M a g i c k L a b e l I m a g e %
5994% %
5995% %
5996% %
5997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5998%
5999% MagickLabelImage() adds a label to your image.
6000%
6001% The format of the MagickLabelImage method is:
6002%
6003% MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6004%
6005% A description of each parameter follows:
6006%
6007% o wand: the magick wand.
6008%
6009% o label: the image label.
6010%
6011*/
6012WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6013 const char *label)
6014{
6015 MagickBooleanType
6016 status;
6017
6018 assert(wand != (MagickWand *) NULL);
6019 assert(wand->signature == WandSignature);
6020 if (wand->debug != MagickFalse)
6021 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6022 if (wand->images == (Image *) NULL)
6023 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6024 status=SetImageProperty(wand->images,"label",label);
6025 if (status == MagickFalse)
6026 InheritException(wand->exception,&wand->images->exception);
6027 return(status);
6028}
6029
6030/*
6031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6032% %
6033% %
6034% %
6035% M a g i c k L e v e l I m a g e %
6036% %
6037% %
6038% %
6039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6040%
6041% MagickLevelImage() adjusts the levels of an image by scaling the colors
6042% falling between specified white and black points to the full available
6043% quantum range. The parameters provided represent the black, mid, and white
6044% points. The black point specifies the darkest color in the image. Colors
6045% darker than the black point are set to zero. Mid point specifies a gamma
6046% correction to apply to the image. White point specifies the lightest color
6047% in the image. Colors brighter than the white point are set to the maximum
6048% quantum value.
6049%
6050% The format of the MagickLevelImage method is:
6051%
6052% MagickBooleanType MagickLevelImage(MagickWand *wand,
6053% const double black_point,const double gamma,const double white_point)
cristyf89cb1d2011-07-07 01:24:37 +00006054% MagickBooleanType MagickLevelImage(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00006055% const ChannelType channel,const double black_point,const double gamma,
6056% const double white_point)
6057%
6058% A description of each parameter follows:
6059%
6060% o wand: the magick wand.
6061%
6062% o channel: Identify which channel to level: RedChannel, GreenChannel,
6063%
6064% o black_point: the black point.
6065%
6066% o gamma: the gamma.
6067%
6068% o white_point: the white point.
6069%
6070*/
cristy3ed852e2009-09-05 21:47:34 +00006071WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6072 const double black_point,const double gamma,const double white_point)
6073{
6074 MagickBooleanType
6075 status;
6076
cristy3ed852e2009-09-05 21:47:34 +00006077 assert(wand != (MagickWand *) NULL);
6078 assert(wand->signature == WandSignature);
6079 if (wand->debug != MagickFalse)
6080 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6081 if (wand->images == (Image *) NULL)
6082 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy01e9afd2011-08-10 17:38:41 +00006083 status=LevelImage(wand->images,black_point,white_point,gamma,
6084 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00006085 return(status);
6086}
6087
6088/*
6089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6090% %
6091% %
6092% %
6093% M a g i c k L i n e a r S t r e t c h I m a g e %
6094% %
6095% %
6096% %
6097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6098%
6099% MagickLinearStretchImage() stretches with saturation the image intensity.
6100%
6101% You can also reduce the influence of a particular channel with a gamma
6102% value of 0.
6103%
6104% The format of the MagickLinearStretchImage method is:
6105%
6106% MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6107% const double black_point,const double white_point)
6108%
6109% A description of each parameter follows:
6110%
6111% o wand: the magick wand.
6112%
6113% o black_point: the black point.
6114%
6115% o white_point: the white point.
6116%
6117*/
6118WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6119 const double black_point,const double white_point)
6120{
6121 MagickBooleanType
6122 status;
6123
6124 assert(wand != (MagickWand *) NULL);
6125 assert(wand->signature == WandSignature);
6126 if (wand->debug != MagickFalse)
6127 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6128 if (wand->images == (Image *) NULL)
6129 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy33bd5152011-08-24 01:42:24 +00006130 status=LinearStretchImage(wand->images,black_point,white_point,
6131 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00006132 return(status);
6133}
6134
6135/*
6136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6137% %
6138% %
6139% %
6140% M a g i c k L i q u i d R e s c a l e I m a g e %
6141% %
6142% %
6143% %
6144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6145%
6146% MagickLiquidRescaleImage() rescales image with seam carving.
6147%
6148% MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006149% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006150% const double delta_x,const double rigidity)
6151%
6152% A description of each parameter follows:
6153%
6154% o wand: the magick wand.
6155%
6156% o columns: the number of columns in the scaled image.
6157%
6158% o rows: the number of rows in the scaled image.
6159%
6160% o delta_x: maximum seam transversal step (0 means straight seams).
6161%
6162% o rigidity: introduce a bias for non-straight seams (typically 0).
6163%
6164*/
6165WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006166 const size_t columns,const size_t rows,const double delta_x,
cristy3ed852e2009-09-05 21:47:34 +00006167 const double rigidity)
6168{
6169 Image
6170 *rescale_image;
6171
6172 assert(wand != (MagickWand *) NULL);
6173 assert(wand->signature == WandSignature);
6174 if (wand->debug != MagickFalse)
6175 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6176 if (wand->images == (Image *) NULL)
6177 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6178 rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6179 rigidity,wand->exception);
6180 if (rescale_image == (Image *) NULL)
6181 return(MagickFalse);
6182 ReplaceImageInList(&wand->images,rescale_image);
6183 return(MagickTrue);
6184}
6185
6186/*
6187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6188% %
6189% %
6190% %
6191% M a g i c k M a g n i f y I m a g e %
6192% %
6193% %
6194% %
6195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6196%
6197% MagickMagnifyImage() is a convenience method that scales an image
6198% proportionally to twice its original size.
6199%
6200% The format of the MagickMagnifyImage method is:
6201%
6202% MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6203%
6204% A description of each parameter follows:
6205%
6206% o wand: the magick wand.
6207%
6208*/
6209WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6210{
6211 Image
6212 *magnify_image;
6213
6214 assert(wand != (MagickWand *) NULL);
6215 assert(wand->signature == WandSignature);
6216 if (wand->debug != MagickFalse)
6217 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6218 if (wand->images == (Image *) NULL)
6219 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6220 magnify_image=MagnifyImage(wand->images,wand->exception);
6221 if (magnify_image == (Image *) NULL)
6222 return(MagickFalse);
6223 ReplaceImageInList(&wand->images,magnify_image);
6224 return(MagickTrue);
6225}
6226
6227/*
6228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6229% %
6230% %
6231% %
cristy3ed852e2009-09-05 21:47:34 +00006232% M a g i c k M e r g e I m a g e L a y e r s %
6233% %
6234% %
6235% %
6236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6237%
cristy733678d2011-03-18 21:29:28 +00006238% MagickMergeImageLayers() composes all the image layers from the current
6239% given image onward to produce a single image of the merged layers.
cristy3ed852e2009-09-05 21:47:34 +00006240%
6241% The inital canvas's size depends on the given ImageLayerMethod, and is
6242% initialized using the first images background color. The images
6243% are then compositied onto that image in sequence using the given
6244% composition that has been assigned to each individual image.
6245%
6246% The format of the MagickMergeImageLayers method is:
6247%
6248% MagickWand *MagickMergeImageLayers(MagickWand *wand,
6249% const ImageLayerMethod method)
6250%
6251% A description of each parameter follows:
6252%
6253% o wand: the magick wand.
6254%
6255% o method: the method of selecting the size of the initial canvas.
6256%
6257% MergeLayer: Merge all layers onto a canvas just large enough
6258% to hold all the actual images. The virtual canvas of the
6259% first image is preserved but otherwise ignored.
6260%
6261% FlattenLayer: Use the virtual canvas size of first image.
6262% Images which fall outside this canvas is clipped.
6263% This can be used to 'fill out' a given virtual canvas.
6264%
6265% MosaicLayer: Start with the virtual canvas of the first image,
6266% enlarging left and right edges to contain all images.
6267% Images with negative offsets will be clipped.
6268%
6269*/
6270WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6271 const ImageLayerMethod method)
6272{
6273 Image
6274 *mosaic_image;
6275
6276 assert(wand != (MagickWand *) NULL);
6277 assert(wand->signature == WandSignature);
6278 if (wand->debug != MagickFalse)
6279 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6280 if (wand->images == (Image *) NULL)
6281 return((MagickWand *) NULL);
6282 mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6283 if (mosaic_image == (Image *) NULL)
6284 return((MagickWand *) NULL);
6285 return(CloneMagickWandFromImages(wand,mosaic_image));
6286}
6287
6288/*
6289%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6290% %
6291% %
6292% %
6293% M a g i c k M i n i f y I m a g e %
6294% %
6295% %
6296% %
6297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6298%
6299% MagickMinifyImage() is a convenience method that scales an image
6300% proportionally to one-half its original size
6301%
6302% The format of the MagickMinifyImage method is:
6303%
6304% MagickBooleanType MagickMinifyImage(MagickWand *wand)
6305%
6306% A description of each parameter follows:
6307%
6308% o wand: the magick wand.
6309%
6310*/
6311WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6312{
6313 Image
6314 *minify_image;
6315
6316 assert(wand != (MagickWand *) NULL);
6317 assert(wand->signature == WandSignature);
6318 if (wand->debug != MagickFalse)
6319 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6320 if (wand->images == (Image *) NULL)
6321 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6322 minify_image=MinifyImage(wand->images,wand->exception);
6323 if (minify_image == (Image *) NULL)
6324 return(MagickFalse);
6325 ReplaceImageInList(&wand->images,minify_image);
6326 return(MagickTrue);
6327}
6328
6329/*
6330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6331% %
6332% %
6333% %
6334% M a g i c k M o d u l a t e I m a g e %
6335% %
6336% %
6337% %
6338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6339%
6340% MagickModulateImage() lets you control the brightness, saturation, and hue
6341% of an image. Hue is the percentage of absolute rotation from the current
6342% position. For example 50 results in a counter-clockwise rotation of 90
6343% degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6344% both resulting in a rotation of 180 degrees.
6345%
6346% To increase the color brightness by 20% and decrease the color saturation by
6347% 10% and leave the hue unchanged, use: 120,90,100.
6348%
6349% The format of the MagickModulateImage method is:
6350%
6351% MagickBooleanType MagickModulateImage(MagickWand *wand,
6352% const double brightness,const double saturation,const double hue)
6353%
6354% A description of each parameter follows:
6355%
6356% o wand: the magick wand.
6357%
6358% o brightness: the percent change in brighness.
6359%
6360% o saturation: the percent change in saturation.
6361%
6362% o hue: the percent change in hue.
6363%
6364*/
6365WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6366 const double brightness,const double saturation,const double hue)
6367{
6368 char
6369 modulate[MaxTextExtent];
6370
6371 MagickBooleanType
6372 status;
6373
6374 assert(wand != (MagickWand *) NULL);
6375 assert(wand->signature == WandSignature);
6376 if (wand->debug != MagickFalse)
6377 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6378 if (wand->images == (Image *) NULL)
6379 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +00006380 (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
cristy8cd5b312010-01-07 01:10:24 +00006381 brightness,saturation,hue);
cristy33bd5152011-08-24 01:42:24 +00006382 status=ModulateImage(wand->images,modulate,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00006383 return(status);
6384}
6385
6386/*
6387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6388% %
6389% %
6390% %
6391% M a g i c k M o n t a g e I m a g e %
6392% %
6393% %
6394% %
6395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6396%
6397% MagickMontageImage() creates a composite image by combining several
6398% separate images. The images are tiled on the composite image with the name
6399% of the image optionally appearing just below the individual tile.
6400%
6401% The format of the MagickMontageImage method is:
6402%
6403% MagickWand *MagickMontageImage(MagickWand *wand,
6404% const DrawingWand drawing_wand,const char *tile_geometry,
6405% const char *thumbnail_geometry,const MontageMode mode,
6406% const char *frame)
6407%
6408% A description of each parameter follows:
6409%
6410% o wand: the magick wand.
6411%
6412% o drawing_wand: the drawing wand. The font name, size, and color are
6413% obtained from this wand.
6414%
6415% o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6416%
6417% o thumbnail_geometry: Preferred image size and border size of each
6418% thumbnail (e.g. 120x120+4+3>).
6419%
6420% o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6421%
6422% o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6423% The frame color is that of the thumbnail's matte color.
6424%
6425*/
6426WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6427 const DrawingWand *drawing_wand,const char *tile_geometry,
6428 const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6429{
6430 char
6431 *font;
6432
6433 Image
6434 *montage_image;
6435
6436 MontageInfo
6437 *montage_info;
6438
6439 PixelWand
6440 *pixel_wand;
6441
6442 assert(wand != (MagickWand *) NULL);
6443 assert(wand->signature == WandSignature);
6444 if (wand->debug != MagickFalse)
6445 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6446 if (wand->images == (Image *) NULL)
6447 return((MagickWand *) NULL);
6448 montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6449 switch (mode)
6450 {
6451 case FrameMode:
6452 {
6453 (void) CloneString(&montage_info->frame,"15x15+3+3");
6454 montage_info->shadow=MagickTrue;
6455 break;
6456 }
6457 case UnframeMode:
6458 {
6459 montage_info->frame=(char *) NULL;
6460 montage_info->shadow=MagickFalse;
6461 montage_info->border_width=0;
6462 break;
6463 }
6464 case ConcatenateMode:
6465 {
6466 montage_info->frame=(char *) NULL;
6467 montage_info->shadow=MagickFalse;
6468 (void) CloneString(&montage_info->geometry,"+0+0");
6469 montage_info->border_width=0;
6470 break;
6471 }
6472 default:
6473 break;
6474 }
6475 font=DrawGetFont(drawing_wand);
6476 if (font != (char *) NULL)
6477 (void) CloneString(&montage_info->font,font);
6478 if (frame != (char *) NULL)
6479 (void) CloneString(&montage_info->frame,frame);
6480 montage_info->pointsize=DrawGetFontSize(drawing_wand);
6481 pixel_wand=NewPixelWand();
6482 DrawGetFillColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006483 PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
cristy3ed852e2009-09-05 21:47:34 +00006484 DrawGetStrokeColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006485 PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
cristy3ed852e2009-09-05 21:47:34 +00006486 pixel_wand=DestroyPixelWand(pixel_wand);
6487 if (thumbnail_geometry != (char *) NULL)
6488 (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6489 if (tile_geometry != (char *) NULL)
6490 (void) CloneString(&montage_info->tile,tile_geometry);
6491 montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6492 wand->exception);
6493 montage_info=DestroyMontageInfo(montage_info);
6494 if (montage_image == (Image *) NULL)
6495 return((MagickWand *) NULL);
6496 return(CloneMagickWandFromImages(wand,montage_image));
6497}
6498
6499/*
6500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6501% %
6502% %
6503% %
6504% M a g i c k M o r p h I m a g e s %
6505% %
6506% %
6507% %
6508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6509%
6510% MagickMorphImages() method morphs a set of images. Both the image pixels
6511% and size are linearly interpolated to give the appearance of a
6512% meta-morphosis from one image to the next.
6513%
6514% The format of the MagickMorphImages method is:
6515%
6516% MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006517% const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006518%
6519% A description of each parameter follows:
6520%
6521% o wand: the magick wand.
6522%
6523% o number_frames: the number of in-between images to generate.
6524%
6525*/
6526WandExport MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006527 const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006528{
6529 Image
6530 *morph_image;
6531
6532 assert(wand != (MagickWand *) NULL);
6533 assert(wand->signature == WandSignature);
6534 if (wand->debug != MagickFalse)
6535 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6536 if (wand->images == (Image *) NULL)
6537 return((MagickWand *) NULL);
6538 morph_image=MorphImages(wand->images,number_frames,wand->exception);
6539 if (morph_image == (Image *) NULL)
6540 return((MagickWand *) NULL);
6541 return(CloneMagickWandFromImages(wand,morph_image));
6542}
6543
6544/*
6545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6546% %
6547% %
6548% %
cristya0b81c32010-01-22 02:54:33 +00006549% M a g i c k M o r p h o l o g y I m a g e %
6550% %
6551% %
6552% %
6553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6554%
6555% MagickMorphologyImage() applies a user supplied kernel to the image
6556% according to the given mophology method.
6557%
6558% The format of the MagickMorphologyImage method is:
6559%
6560% MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006561% MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006562%
6563% A description of each parameter follows:
6564%
6565% o wand: the magick wand.
6566%
cristya0b81c32010-01-22 02:54:33 +00006567% o method: the morphology method to be applied.
6568%
6569% o iterations: apply the operation this many times (or no change).
6570% A value of -1 means loop until no change found. How this is applied
6571% may depend on the morphology method. Typically this is a value of 1.
6572%
6573% o kernel: An array of doubles representing the morphology kernel.
6574%
6575*/
cristya0b81c32010-01-22 02:54:33 +00006576WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006577 MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006578{
cristya0b81c32010-01-22 02:54:33 +00006579 Image
6580 *morphology_image;
6581
6582 assert(wand != (MagickWand *) NULL);
6583 assert(wand->signature == WandSignature);
6584 if (wand->debug != MagickFalse)
6585 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6586 if (kernel == (const KernelInfo *) NULL)
6587 return(MagickFalse);
6588 if (wand->images == (Image *) NULL)
6589 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00006590 morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6591 wand->exception);
cristya0b81c32010-01-22 02:54:33 +00006592 if (morphology_image == (Image *) NULL)
6593 return(MagickFalse);
6594 ReplaceImageInList(&wand->images,morphology_image);
6595 return(MagickTrue);
6596}
6597
6598/*
6599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6600% %
6601% %
6602% %
cristy3ed852e2009-09-05 21:47:34 +00006603% M a g i c k M o t i o n B l u r I m a g e %
6604% %
6605% %
6606% %
6607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6608%
6609% MagickMotionBlurImage() simulates motion blur. We convolve the image with a
6610% Gaussian operator of the given radius and standard deviation (sigma).
6611% For reasonable results, radius should be larger than sigma. Use a
6612% radius of 0 and MotionBlurImage() selects a suitable radius for you.
6613% Angle gives the angle of the blurring motion.
6614%
6615% The format of the MagickMotionBlurImage method is:
6616%
6617% MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
cristyf7ef0252011-09-09 14:50:06 +00006618% const double radius,const double sigma,const double angle,
6619% const double bias)
cristy3ed852e2009-09-05 21:47:34 +00006620%
6621% A description of each parameter follows:
6622%
6623% o wand: the magick wand.
6624%
cristy3ed852e2009-09-05 21:47:34 +00006625% o radius: the radius of the Gaussian, in pixels, not counting
6626% the center pixel.
6627%
6628% o sigma: the standard deviation of the Gaussian, in pixels.
6629%
cristycee97112010-05-28 00:44:52 +00006630% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00006631%
6632*/
cristy3ed852e2009-09-05 21:47:34 +00006633WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
cristyf7ef0252011-09-09 14:50:06 +00006634 const double radius,const double sigma,const double angle,const double bias)
cristy3ed852e2009-09-05 21:47:34 +00006635{
cristy3ed852e2009-09-05 21:47:34 +00006636 Image
6637 *blur_image;
6638
6639 assert(wand != (MagickWand *) NULL);
6640 assert(wand->signature == WandSignature);
6641 if (wand->debug != MagickFalse)
6642 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6643 if (wand->images == (Image *) NULL)
6644 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf7ef0252011-09-09 14:50:06 +00006645 blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6646 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006647 if (blur_image == (Image *) NULL)
6648 return(MagickFalse);
6649 ReplaceImageInList(&wand->images,blur_image);
6650 return(MagickTrue);
6651}
6652
6653/*
6654%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6655% %
6656% %
6657% %
6658% M a g i c k N e g a t e I m a g e %
6659% %
6660% %
6661% %
6662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6663%
6664% MagickNegateImage() negates the colors in the reference image. The
6665% Grayscale option means that only grayscale values within the image are
6666% negated.
6667%
6668% You can also reduce the influence of a particular channel with a gamma
6669% value of 0.
6670%
6671% The format of the MagickNegateImage method is:
6672%
6673% MagickBooleanType MagickNegateImage(MagickWand *wand,
6674% const MagickBooleanType gray)
cristy3ed852e2009-09-05 21:47:34 +00006675%
6676% A description of each parameter follows:
6677%
6678% o wand: the magick wand.
6679%
cristy3ed852e2009-09-05 21:47:34 +00006680% o gray: If MagickTrue, only negate grayscale pixels within the image.
6681%
6682*/
cristy3ed852e2009-09-05 21:47:34 +00006683WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6684 const MagickBooleanType gray)
6685{
6686 MagickBooleanType
6687 status;
6688
cristy3ed852e2009-09-05 21:47:34 +00006689 assert(wand != (MagickWand *) NULL);
6690 assert(wand->signature == WandSignature);
6691 if (wand->debug != MagickFalse)
6692 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6693 if (wand->images == (Image *) NULL)
6694 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00006695 status=NegateImage(wand->images,gray,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006696 return(status);
6697}
6698
6699/*
6700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6701% %
6702% %
6703% %
6704% M a g i c k N e w I m a g e %
6705% %
6706% %
6707% %
6708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6709%
6710% MagickNewImage() adds a blank image canvas of the specified size and
6711% background color to the wand.
6712%
6713% The format of the MagickNewImage method is:
6714%
6715% MagickBooleanType MagickNewImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006716% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006717% const PixelWand *background)
6718%
6719% A description of each parameter follows:
6720%
6721% o wand: the magick wand.
6722%
6723% o width: the image width.
6724%
6725% o height: the image height.
6726%
6727% o background: the image color.
6728%
6729*/
cristy0740a982011-10-13 15:01:01 +00006730WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6731 const size_t height,const PixelWand *background)
cristy3ed852e2009-09-05 21:47:34 +00006732{
6733 Image
6734 *images;
6735
cristy4c08aed2011-07-01 19:47:50 +00006736 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00006737 pixel;
6738
6739 assert(wand != (MagickWand *) NULL);
6740 assert(wand->signature == WandSignature);
6741 if (wand->debug != MagickFalse)
6742 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6743 PixelGetMagickColor(background,&pixel);
cristy269c9412011-10-13 23:41:15 +00006744 images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006745 if (images == (Image *) NULL)
6746 return(MagickFalse);
cristy3ed852e2009-09-05 21:47:34 +00006747 return(InsertImageInWand(wand,images));
6748}
6749
6750/*
6751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6752% %
6753% %
6754% %
6755% M a g i c k N e x t I m a g e %
6756% %
6757% %
6758% %
6759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6760%
6761% MagickNextImage() associates the next image in the image list with a magick
anthonya89dd172011-10-04 13:29:35 +00006762% wand. It returns true if the it succeeds, meaning the current image is the
6763% next image to be iterated over.
cristy3ed852e2009-09-05 21:47:34 +00006764%
6765% The format of the MagickNextImage method is:
6766%
6767% MagickBooleanType MagickNextImage(MagickWand *wand)
6768%
6769% A description of each parameter follows:
6770%
6771% o wand: the magick wand.
6772%
6773*/
6774WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6775{
6776 assert(wand != (MagickWand *) NULL);
6777 assert(wand->signature == WandSignature);
6778 if (wand->debug != MagickFalse)
6779 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6780 if (wand->images == (Image *) NULL)
6781 ThrowWandException(WandError,"ContainsNoImages",wand->name);
anthonya89dd172011-10-04 13:29:35 +00006782 /* If current image is 'pending' just return true. */
6783 if (wand->image_pending != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006784 {
anthonya89dd172011-10-04 13:29:35 +00006785 wand->image_pending=MagickFalse;
cristy3ed852e2009-09-05 21:47:34 +00006786 return(MagickTrue);
6787 }
anthonya89dd172011-10-04 13:29:35 +00006788 /* If there is no next image, (Iterator is finished) */
cristy3ed852e2009-09-05 21:47:34 +00006789 if (GetNextImageInList(wand->images) == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00006790 return(MagickFalse);
anthonya89dd172011-10-04 13:29:35 +00006791 /* just move to next image - current image is not 'pending' */
cristy3ed852e2009-09-05 21:47:34 +00006792 wand->images=GetNextImageInList(wand->images);
6793 return(MagickTrue);
6794}
6795
6796/*
6797%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6798% %
6799% %
6800% %
6801% M a g i c k N o r m a l i z e I m a g e %
6802% %
6803% %
6804% %
6805%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6806%
6807% MagickNormalizeImage() enhances the contrast of a color image by adjusting
6808% the pixels color to span the entire range of colors available
6809%
6810% You can also reduce the influence of a particular channel with a gamma
6811% value of 0.
6812%
6813% The format of the MagickNormalizeImage method is:
6814%
6815% MagickBooleanType MagickNormalizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00006816%
6817% A description of each parameter follows:
6818%
6819% o wand: the magick wand.
6820%
cristy3ed852e2009-09-05 21:47:34 +00006821*/
cristy3ed852e2009-09-05 21:47:34 +00006822WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6823{
6824 MagickBooleanType
6825 status;
6826
cristy3ed852e2009-09-05 21:47:34 +00006827 assert(wand != (MagickWand *) NULL);
6828 assert(wand->signature == WandSignature);
6829 if (wand->debug != MagickFalse)
6830 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6831 if (wand->images == (Image *) NULL)
6832 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00006833 status=NormalizeImage(wand->images,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00006834 return(status);
6835}
6836
6837/*
6838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6839% %
6840% %
6841% %
6842% M a g i c k O i l P a i n t I m a g e %
6843% %
6844% %
6845% %
6846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6847%
6848% MagickOilPaintImage() applies a special effect filter that simulates an oil
6849% painting. Each pixel is replaced by the most frequent color occurring
6850% in a circular region defined by radius.
6851%
6852% The format of the MagickOilPaintImage method is:
6853%
6854% MagickBooleanType MagickOilPaintImage(MagickWand *wand,
cristy14973ba2011-08-27 23:48:07 +00006855% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00006856%
6857% A description of each parameter follows:
6858%
6859% o wand: the magick wand.
6860%
6861% o radius: the radius of the circular neighborhood.
6862%
cristy14973ba2011-08-27 23:48:07 +00006863% o sigma: the standard deviation of the Gaussian, in pixels.
6864%
cristy3ed852e2009-09-05 21:47:34 +00006865*/
6866WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
cristy14973ba2011-08-27 23:48:07 +00006867 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00006868{
6869 Image
6870 *paint_image;
6871
6872 assert(wand != (MagickWand *) NULL);
6873 assert(wand->signature == WandSignature);
6874 if (wand->debug != MagickFalse)
6875 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6876 if (wand->images == (Image *) NULL)
6877 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy14973ba2011-08-27 23:48:07 +00006878 paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006879 if (paint_image == (Image *) NULL)
6880 return(MagickFalse);
6881 ReplaceImageInList(&wand->images,paint_image);
6882 return(MagickTrue);
6883}
6884
6885/*
6886%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6887% %
6888% %
6889% %
6890% M a g i c k O p a q u e P a i n t I m a g e %
6891% %
6892% %
6893% %
6894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6895%
6896% MagickOpaquePaintImage() changes any pixel that matches color with the color
6897% defined by fill.
6898%
6899% The format of the MagickOpaquePaintImage method is:
6900%
6901% MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6902% const PixelWand *target,const PixelWand *fill,const double fuzz,
6903% const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00006904%
6905% A description of each parameter follows:
6906%
6907% o wand: the magick wand.
6908%
cristy3ed852e2009-09-05 21:47:34 +00006909% o target: Change this target color to the fill color within the image.
6910%
6911% o fill: the fill pixel wand.
6912%
6913% o fuzz: By default target must match a particular pixel color
6914% exactly. However, in many cases two colors may differ by a small amount.
6915% The fuzz member of image defines how much tolerance is acceptable to
6916% consider two colors as the same. For example, set fuzz to 10 and the
6917% color red at intensities of 100 and 102 respectively are now interpreted
6918% as the same color for the purposes of the floodfill.
6919%
6920% o invert: paint any pixel that does not match the target color.
6921%
6922*/
cristy3ed852e2009-09-05 21:47:34 +00006923WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6924 const PixelWand *target,const PixelWand *fill,const double fuzz,
6925 const MagickBooleanType invert)
6926{
6927 MagickBooleanType
6928 status;
6929
cristy4c08aed2011-07-01 19:47:50 +00006930 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00006931 fill_pixel,
6932 target_pixel;
6933
6934 assert(wand != (MagickWand *) NULL);
6935 assert(wand->signature == WandSignature);
6936 if (wand->debug != MagickFalse)
6937 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6938 if (wand->images == (Image *) NULL)
6939 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6940 PixelGetMagickColor(target,&target_pixel);
6941 PixelGetMagickColor(fill,&fill_pixel);
6942 wand->images->fuzz=fuzz;
cristy189e84c2011-08-27 18:08:53 +00006943 status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6944 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00006945 return(status);
6946}
6947
6948/*
6949%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6950% %
6951% %
6952% %
6953% 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 %
6954% %
6955% %
6956% %
6957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6958%
6959% MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6960% previous image in the sequence. From this it attempts to select the
6961% smallest cropped image to replace each frame, while preserving the results
6962% of the animation.
6963%
6964% The format of the MagickOptimizeImageLayers method is:
6965%
6966% MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6967%
6968% A description of each parameter follows:
6969%
6970% o wand: the magick wand.
6971%
6972*/
6973WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6974{
6975 Image
6976 *optimize_image;
6977
6978 assert(wand != (MagickWand *) NULL);
6979 assert(wand->signature == WandSignature);
6980 if (wand->debug != MagickFalse)
6981 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6982 if (wand->images == (Image *) NULL)
6983 return((MagickWand *) NULL);
6984 optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6985 if (optimize_image == (Image *) NULL)
6986 return((MagickWand *) NULL);
6987 return(CloneMagickWandFromImages(wand,optimize_image));
6988}
6989
6990/*
6991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6992% %
6993% %
6994% %
6995% 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 %
6996% %
6997% %
6998% %
6999%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7000%
7001% MagickOrderedPosterizeImage() performs an ordered dither based on a number
7002% of pre-defined dithering threshold maps, but over multiple intensity levels,
7003% which can be different for different channels, according to the input
7004% arguments.
7005%
7006% The format of the MagickOrderedPosterizeImage method is:
7007%
7008% MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7009% const char *threshold_map)
cristy3ed852e2009-09-05 21:47:34 +00007010%
7011% A description of each parameter follows:
7012%
7013% o image: the image.
7014%
cristy3ed852e2009-09-05 21:47:34 +00007015% o threshold_map: A string containing the name of the threshold dither
7016% map to use, followed by zero or more numbers representing the number of
7017% color levels tho dither between.
7018%
glennrpf0a92fd2011-04-27 13:17:21 +00007019% Any level number less than 2 is equivalent to 2, and means only binary
cristy3ed852e2009-09-05 21:47:34 +00007020% dithering will be applied to each color channel.
7021%
7022% No numbers also means a 2 level (bitmap) dither will be applied to all
7023% channels, while a single number is the number of levels applied to each
7024% channel in sequence. More numbers will be applied in turn to each of
7025% the color channels.
7026%
7027% For example: "o3x3,6" generates a 6 level posterization of the image
7028% with a ordered 3x3 diffused pixel dither being applied between each
7029% level. While checker,8,8,4 will produce a 332 colormaped image with
7030% only a single checkerboard hash pattern (50% grey) between each color
7031% level, to basically double the number of color levels with a bare
7032% minimim of dithering.
7033%
7034*/
cristy3ed852e2009-09-05 21:47:34 +00007035WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7036 const char *threshold_map)
7037{
7038 MagickBooleanType
7039 status;
7040
cristy3ed852e2009-09-05 21:47:34 +00007041 assert(wand != (MagickWand *) NULL);
7042 assert(wand->signature == WandSignature);
7043 if (wand->debug != MagickFalse)
7044 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7045 if (wand->images == (Image *) NULL)
7046 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy13020672011-07-08 02:33:26 +00007047 status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007048 return(status);
7049}
7050
7051/*
7052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7053% %
7054% %
7055% %
7056% M a g i c k P i n g I m a g e %
7057% %
7058% %
7059% %
7060%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7061%
anthonya89dd172011-10-04 13:29:35 +00007062% MagickPingImage() is the same as MagickReadImage() except the only valid
cristy3ed852e2009-09-05 21:47:34 +00007063% information returned is the image width, height, size, and format. It
7064% is designed to efficiently obtain this information from a file without
7065% reading the entire image sequence into memory.
7066%
7067% The format of the MagickPingImage method is:
7068%
7069% MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7070%
7071% A description of each parameter follows:
7072%
7073% o wand: the magick wand.
7074%
7075% o filename: the image filename.
7076%
7077*/
7078WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7079 const char *filename)
7080{
7081 Image
7082 *images;
7083
7084 ImageInfo
7085 *ping_info;
7086
7087 assert(wand != (MagickWand *) NULL);
7088 assert(wand->signature == WandSignature);
7089 if (wand->debug != MagickFalse)
7090 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7091 ping_info=CloneImageInfo(wand->image_info);
7092 if (filename != (const char *) NULL)
7093 (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7094 images=PingImage(ping_info,wand->exception);
7095 ping_info=DestroyImageInfo(ping_info);
7096 if (images == (Image *) NULL)
7097 return(MagickFalse);
7098 return(InsertImageInWand(wand,images));
7099}
7100
7101/*
7102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7103% %
7104% %
7105% %
7106% M a g i c k P i n g I m a g e B l o b %
7107% %
7108% %
7109% %
7110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7111%
7112% MagickPingImageBlob() pings an image or image sequence from a blob.
7113%
7114% The format of the MagickPingImageBlob method is:
7115%
7116% MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7117% const void *blob,const size_t length)
7118%
7119% A description of each parameter follows:
7120%
7121% o wand: the magick wand.
7122%
7123% o blob: the blob.
7124%
7125% o length: the blob length.
7126%
7127*/
7128WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7129 const void *blob,const size_t length)
7130{
7131 Image
7132 *images;
7133
7134 ImageInfo
7135 *read_info;
7136
7137 assert(wand != (MagickWand *) NULL);
7138 assert(wand->signature == WandSignature);
7139 if (wand->debug != MagickFalse)
7140 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7141 read_info=CloneImageInfo(wand->image_info);
7142 SetImageInfoBlob(read_info,blob,length);
7143 images=PingImage(read_info,wand->exception);
7144 read_info=DestroyImageInfo(read_info);
7145 if (images == (Image *) NULL)
7146 return(MagickFalse);
7147 return(InsertImageInWand(wand,images));
7148}
7149
7150/*
7151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7152% %
7153% %
7154% %
7155% M a g i c k P i n g I m a g e F i l e %
7156% %
7157% %
7158% %
7159%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7160%
7161% MagickPingImageFile() pings an image or image sequence from an open file
7162% descriptor.
7163%
7164% The format of the MagickPingImageFile method is:
7165%
7166% MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7167%
7168% A description of each parameter follows:
7169%
7170% o wand: the magick wand.
7171%
7172% o file: the file descriptor.
7173%
7174*/
7175WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7176{
7177 Image
7178 *images;
7179
7180 ImageInfo
7181 *read_info;
7182
7183 assert(wand != (MagickWand *) NULL);
7184 assert(wand->signature == WandSignature);
7185 assert(file != (FILE *) NULL);
7186 if (wand->debug != MagickFalse)
7187 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7188 read_info=CloneImageInfo(wand->image_info);
7189 SetImageInfoFile(read_info,file);
7190 images=PingImage(read_info,wand->exception);
7191 read_info=DestroyImageInfo(read_info);
7192 if (images == (Image *) NULL)
7193 return(MagickFalse);
7194 return(InsertImageInWand(wand,images));
7195}
7196
7197/*
7198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7199% %
7200% %
7201% %
7202% M a g i c k P o l a r o i d I m a g e %
7203% %
7204% %
7205% %
7206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7207%
7208% MagickPolaroidImage() simulates a Polaroid picture.
7209%
7210% The format of the MagickPolaroidImage method is:
7211%
7212% MagickBooleanType MagickPolaroidImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +00007213% const DrawingWand *drawing_wand,const double angle,
7214% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007215%
7216% A description of each parameter follows:
7217%
7218% o wand: the magick wand.
7219%
7220% o drawing_wand: the draw wand.
7221%
cristycee97112010-05-28 00:44:52 +00007222% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00007223%
cristy5c4e2582011-09-11 19:21:03 +00007224% o method: the pixel interpolation method.
7225%
cristy3ed852e2009-09-05 21:47:34 +00007226*/
7227WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +00007228 const DrawingWand *drawing_wand,const double angle,
7229 const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007230{
7231 DrawInfo
7232 *draw_info;
7233
7234 Image
7235 *polaroid_image;
7236
7237 assert(wand != (MagickWand *) NULL);
7238 assert(wand->signature == WandSignature);
7239 if (wand->debug != MagickFalse)
7240 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7241 if (wand->images == (Image *) NULL)
7242 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7243 draw_info=PeekDrawingWand(drawing_wand);
7244 if (draw_info == (DrawInfo *) NULL)
7245 return(MagickFalse);
cristy5c4e2582011-09-11 19:21:03 +00007246 polaroid_image=PolaroidImage(wand->images,draw_info,angle,method,
7247 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007248 if (polaroid_image == (Image *) NULL)
7249 return(MagickFalse);
7250 ReplaceImageInList(&wand->images,polaroid_image);
7251 return(MagickTrue);
7252}
7253
7254/*
7255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7256% %
7257% %
7258% %
7259% M a g i c k P o s t e r i z e I m a g e %
7260% %
7261% %
7262% %
7263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7264%
7265% MagickPosterizeImage() reduces the image to a limited number of color level.
7266%
7267% The format of the MagickPosterizeImage method is:
7268%
7269% MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7270% const unsigned levels,const MagickBooleanType dither)
7271%
7272% A description of each parameter follows:
7273%
7274% o wand: the magick wand.
7275%
7276% o levels: Number of color levels allowed in each channel. Very low values
7277% (2, 3, or 4) have the most visible effect.
7278%
7279% o dither: Set this integer value to something other than zero to dither
7280% the mapped image.
7281%
7282*/
7283WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007284 const size_t levels,const MagickBooleanType dither)
cristy3ed852e2009-09-05 21:47:34 +00007285{
7286 MagickBooleanType
7287 status;
7288
7289 assert(wand != (MagickWand *) NULL);
7290 assert(wand->signature == WandSignature);
7291 if (wand->debug != MagickFalse)
7292 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7293 if (wand->images == (Image *) NULL)
7294 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00007295 status=PosterizeImage(wand->images,levels,dither,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007296 return(status);
7297}
7298
7299/*
7300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7301% %
7302% %
7303% %
7304% M a g i c k P r e v i e w I m a g e s %
7305% %
7306% %
7307% %
7308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7309%
7310% MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7311% image processing operation applied at varying strengths. This helpful
7312% to quickly pin-point an appropriate parameter for an image processing
7313% operation.
7314%
7315% The format of the MagickPreviewImages method is:
7316%
7317% MagickWand *MagickPreviewImages(MagickWand *wand,
7318% const PreviewType preview)
7319%
7320% A description of each parameter follows:
7321%
7322% o wand: the magick wand.
7323%
7324% o preview: the preview type.
7325%
7326*/
7327WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7328 const PreviewType preview)
7329{
7330 Image
7331 *preview_image;
7332
7333 assert(wand != (MagickWand *) NULL);
7334 assert(wand->signature == WandSignature);
7335 if (wand->debug != MagickFalse)
7336 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7337 if (wand->images == (Image *) NULL)
7338 return((MagickWand *) NULL);
7339 preview_image=PreviewImage(wand->images,preview,wand->exception);
7340 if (preview_image == (Image *) NULL)
7341 return((MagickWand *) NULL);
7342 return(CloneMagickWandFromImages(wand,preview_image));
7343}
7344
7345/*
7346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7347% %
7348% %
7349% %
7350% M a g i c k P r e v i o u s I m a g e %
7351% %
7352% %
7353% %
7354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7355%
7356% MagickPreviousImage() assocates the previous image in an image list with
7357% the magick wand.
7358%
7359% The format of the MagickPreviousImage method is:
7360%
7361% MagickBooleanType MagickPreviousImage(MagickWand *wand)
7362%
7363% A description of each parameter follows:
7364%
7365% o wand: the magick wand.
7366%
7367*/
7368WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7369{
7370 assert(wand != (MagickWand *) NULL);
7371 assert(wand->signature == WandSignature);
7372 if (wand->debug != MagickFalse)
7373 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7374 if (wand->images == (Image *) NULL)
7375 ThrowWandException(WandError,"ContainsNoImages",wand->name);
anthonya89dd172011-10-04 13:29:35 +00007376
7377 wand->image_pending=MagickFalse; /* pending status has no meaning */
7378 /* If there is no prev image, return false (Iterator is finished) */
cristy3ed852e2009-09-05 21:47:34 +00007379 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00007380 return(MagickFalse);
anthonya89dd172011-10-04 13:29:35 +00007381 /* just do it - current image is not 'pending' */
cristy3ed852e2009-09-05 21:47:34 +00007382 wand->images=GetPreviousImageInList(wand->images);
7383 return(MagickTrue);
7384}
7385
7386/*
7387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7388% %
7389% %
7390% %
7391% M a g i c k Q u a n t i z e I m a g e %
7392% %
7393% %
7394% %
7395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7396%
7397% MagickQuantizeImage() analyzes the colors within a reference image and
7398% chooses a fixed number of colors to represent the image. The goal of the
7399% algorithm is to minimize the color difference between the input and output
7400% image while minimizing the processing time.
7401%
7402% The format of the MagickQuantizeImage method is:
7403%
7404% MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007405% const size_t number_colors,const ColorspaceType colorspace,
7406% const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007407% const MagickBooleanType measure_error)
7408%
7409% A description of each parameter follows:
7410%
7411% o wand: the magick wand.
7412%
7413% o number_colors: the number of colors.
7414%
7415% o colorspace: Perform color reduction in this colorspace, typically
7416% RGBColorspace.
7417%
7418% o treedepth: Normally, this integer value is zero or one. A zero or
7419% 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
7420% reference image with the least amount of memory and the fastest
7421% computational speed. In some cases, such as an image with low color
7422% dispersion (a few number of colors), a value other than
7423% Log4(number_colors) is required. To expand the color tree completely,
7424% use a value of 8.
7425%
7426% o dither: A value other than zero distributes the difference between an
7427% original image and the corresponding color reduced image to
cristycee97112010-05-28 00:44:52 +00007428% neighboring pixels along a Hilbert curve.
cristy3ed852e2009-09-05 21:47:34 +00007429%
7430% o measure_error: A value other than zero measures the difference between
7431% the original and quantized images. This difference is the total
7432% quantization error. The error is computed by summing over all pixels
7433% in an image the distance squared in RGB space between each reference
7434% pixel value and its quantized value.
7435%
7436*/
7437WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007438 const size_t number_colors,const ColorspaceType colorspace,
7439 const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007440 const MagickBooleanType measure_error)
7441{
7442 MagickBooleanType
7443 status;
7444
7445 QuantizeInfo
7446 *quantize_info;
7447
7448 assert(wand != (MagickWand *) NULL);
7449 assert(wand->signature == WandSignature);
7450 if (wand->debug != MagickFalse)
7451 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7452 if (wand->images == (Image *) NULL)
7453 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7454 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7455 quantize_info->number_colors=number_colors;
7456 quantize_info->dither=dither;
7457 quantize_info->tree_depth=treedepth;
7458 quantize_info->colorspace=colorspace;
7459 quantize_info->measure_error=measure_error;
cristy018f07f2011-09-04 21:15:19 +00007460 status=QuantizeImage(quantize_info,wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007461 quantize_info=DestroyQuantizeInfo(quantize_info);
7462 return(status);
7463}
7464
7465/*
7466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7467% %
7468% %
7469% %
7470% M a g i c k Q u a n t i z e I m a g e s %
7471% %
7472% %
7473% %
7474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7475%
7476% MagickQuantizeImages() analyzes the colors within a sequence of images and
7477% chooses a fixed number of colors to represent the image. The goal of the
7478% algorithm is to minimize the color difference between the input and output
7479% image while minimizing the processing time.
7480%
7481% The format of the MagickQuantizeImages method is:
7482%
7483% MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007484% const size_t number_colors,const ColorspaceType colorspace,
7485% const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007486% const MagickBooleanType measure_error)
7487%
7488% A description of each parameter follows:
7489%
7490% o wand: the magick wand.
7491%
7492% o number_colors: the number of colors.
7493%
7494% o colorspace: Perform color reduction in this colorspace, typically
7495% RGBColorspace.
7496%
7497% o treedepth: Normally, this integer value is zero or one. A zero or
7498% 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
7499% reference image with the least amount of memory and the fastest
7500% computational speed. In some cases, such as an image with low color
7501% dispersion (a few number of colors), a value other than
7502% Log4(number_colors) is required. To expand the color tree completely,
7503% use a value of 8.
7504%
7505% o dither: A value other than zero distributes the difference between an
7506% original image and the corresponding color reduced algorithm to
cristycee97112010-05-28 00:44:52 +00007507% neighboring pixels along a Hilbert curve.
cristy3ed852e2009-09-05 21:47:34 +00007508%
7509% o measure_error: A value other than zero measures the difference between
7510% the original and quantized images. This difference is the total
7511% quantization error. The error is computed by summing over all pixels
7512% in an image the distance squared in RGB space between each reference
7513% pixel value and its quantized value.
7514%
7515*/
7516WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007517 const size_t number_colors,const ColorspaceType colorspace,
7518 const size_t treedepth,const MagickBooleanType dither,
cristy3ed852e2009-09-05 21:47:34 +00007519 const MagickBooleanType measure_error)
7520{
7521 MagickBooleanType
7522 status;
7523
7524 QuantizeInfo
7525 *quantize_info;
7526
7527 assert(wand != (MagickWand *) NULL);
7528 assert(wand->signature == WandSignature);
7529 if (wand->debug != MagickFalse)
7530 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7531 if (wand->images == (Image *) NULL)
7532 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7533 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7534 quantize_info->number_colors=number_colors;
7535 quantize_info->dither=dither;
7536 quantize_info->tree_depth=treedepth;
7537 quantize_info->colorspace=colorspace;
7538 quantize_info->measure_error=measure_error;
cristy018f07f2011-09-04 21:15:19 +00007539 status=QuantizeImages(quantize_info,wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007540 quantize_info=DestroyQuantizeInfo(quantize_info);
7541 return(status);
7542}
7543
7544/*
7545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7546% %
7547% %
7548% %
7549% M a g i c k R a d i a l B l u r I m a g e %
7550% %
7551% %
7552% %
7553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7554%
7555% MagickRadialBlurImage() radial blurs an image.
7556%
7557% The format of the MagickRadialBlurImage method is:
7558%
7559% MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
cristy6435bd92011-09-10 02:10:07 +00007560% const double angle,const double bias)
cristy3ed852e2009-09-05 21:47:34 +00007561%
7562% A description of each parameter follows:
7563%
7564% o wand: the magick wand.
7565%
cristy3ed852e2009-09-05 21:47:34 +00007566% o angle: the angle of the blur in degrees.
7567%
cristy6435bd92011-09-10 02:10:07 +00007568% o bias: the bias.
7569%
cristy3ed852e2009-09-05 21:47:34 +00007570*/
7571WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
cristy6435bd92011-09-10 02:10:07 +00007572 const double angle,const double bias)
cristy3ed852e2009-09-05 21:47:34 +00007573{
cristy3ed852e2009-09-05 21:47:34 +00007574 Image
7575 *blur_image;
7576
7577 assert(wand != (MagickWand *) NULL);
7578 assert(wand->signature == WandSignature);
7579 if (wand->debug != MagickFalse)
7580 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7581 if (wand->images == (Image *) NULL)
7582 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy6435bd92011-09-10 02:10:07 +00007583 blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007584 if (blur_image == (Image *) NULL)
7585 return(MagickFalse);
7586 ReplaceImageInList(&wand->images,blur_image);
7587 return(MagickTrue);
7588}
7589
7590/*
7591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7592% %
7593% %
7594% %
7595% M a g i c k R a i s e I m a g e %
7596% %
7597% %
7598% %
7599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7600%
7601% MagickRaiseImage() creates a simulated three-dimensional button-like effect
7602% by lightening and darkening the edges of the image. Members width and
7603% height of raise_info define the width of the vertical and horizontal
7604% edge of the effect.
7605%
7606% The format of the MagickRaiseImage method is:
7607%
7608% MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007609% const size_t width,const size_t height,const ssize_t x,
7610% const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00007611%
7612% A description of each parameter follows:
7613%
7614% o wand: the magick wand.
7615%
7616% o width,height,x,y: Define the dimensions of the area to raise.
7617%
7618% o raise: A value other than zero creates a 3-D raise effect,
7619% otherwise it has a lowered effect.
7620%
7621*/
7622WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007623 const size_t width,const size_t height,const ssize_t x,
7624 const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00007625{
7626 MagickBooleanType
7627 status;
7628
7629 RectangleInfo
7630 raise_info;
7631
7632 assert(wand != (MagickWand *) NULL);
7633 assert(wand->signature == WandSignature);
7634 if (wand->debug != MagickFalse)
7635 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7636 if (wand->images == (Image *) NULL)
7637 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7638 raise_info.width=width;
7639 raise_info.height=height;
7640 raise_info.x=x;
7641 raise_info.y=y;
cristy6170ac32011-08-28 14:15:37 +00007642 status=RaiseImage(wand->images,&raise_info,raise,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +00007643 return(status);
7644}
7645
7646/*
7647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7648% %
7649% %
7650% %
7651% 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 %
7652% %
7653% %
7654% %
7655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7656%
7657% MagickRandomThresholdImage() changes the value of individual pixels based on
7658% the intensity of each pixel compared to threshold. The result is a
7659% high-contrast, two color image.
7660%
7661% The format of the MagickRandomThresholdImage method is:
7662%
7663% MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7664% const double low,const double high)
cristy3ed852e2009-09-05 21:47:34 +00007665%
7666% A description of each parameter follows:
7667%
7668% o wand: the magick wand.
7669%
cristy3ed852e2009-09-05 21:47:34 +00007670% o low,high: Specify the high and low thresholds. These values range from
7671% 0 to QuantumRange.
7672%
7673*/
cristy3ed852e2009-09-05 21:47:34 +00007674WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7675 const double low,const double high)
7676{
cristy3ed852e2009-09-05 21:47:34 +00007677 char
7678 threshold[MaxTextExtent];
7679
7680 MagickBooleanType
7681 status;
7682
7683 assert(wand != (MagickWand *) NULL);
7684 assert(wand->signature == WandSignature);
7685 if (wand->debug != MagickFalse)
7686 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7687 if (wand->images == (Image *) NULL)
7688 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +00007689 (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
cristyf4ad9df2011-07-08 16:49:03 +00007690 status=RandomThresholdImage(wand->images,threshold,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007691 if (status == MagickFalse)
7692 InheritException(wand->exception,&wand->images->exception);
7693 return(status);
7694}
7695
7696/*
7697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7698% %
7699% %
7700% %
7701% M a g i c k R e a d I m a g e %
7702% %
7703% %
7704% %
7705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7706%
7707% MagickReadImage() reads an image or image sequence. The images are inserted
anthonya89dd172011-10-04 13:29:35 +00007708% at the current image pointer position.
7709%
7710% Use MagickSetFirstIterator(), to insert new images before all the current
7711% images in the wand, MagickSetLastIterator() to append add to the end,
7712% MagickSetImageIndex() to place images just after the given index.
cristy3ed852e2009-09-05 21:47:34 +00007713%
7714% The format of the MagickReadImage method is:
7715%
7716% MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7717%
7718% A description of each parameter follows:
7719%
7720% o wand: the magick wand.
7721%
7722% o filename: the image filename.
7723%
7724*/
7725WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7726 const char *filename)
7727{
7728 Image
7729 *images;
7730
7731 ImageInfo
7732 *read_info;
7733
7734 assert(wand != (MagickWand *) NULL);
7735 assert(wand->signature == WandSignature);
7736 if (wand->debug != MagickFalse)
7737 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7738 read_info=CloneImageInfo(wand->image_info);
7739 if (filename != (const char *) NULL)
7740 (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7741 images=ReadImage(read_info,wand->exception);
7742 read_info=DestroyImageInfo(read_info);
7743 if (images == (Image *) NULL)
7744 return(MagickFalse);
7745 return(InsertImageInWand(wand,images));
7746}
7747
7748/*
7749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7750% %
7751% %
7752% %
7753% M a g i c k R e a d I m a g e B l o b %
7754% %
7755% %
7756% %
7757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7758%
7759% MagickReadImageBlob() reads an image or image sequence from a blob.
anthonya89dd172011-10-04 13:29:35 +00007760% In all other respects it is like MagickReadImage().
cristy3ed852e2009-09-05 21:47:34 +00007761%
7762% The format of the MagickReadImageBlob method is:
7763%
7764% MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7765% const void *blob,const size_t length)
7766%
7767% A description of each parameter follows:
7768%
7769% o wand: the magick wand.
7770%
7771% o blob: the blob.
7772%
7773% o length: the blob length.
7774%
7775*/
7776WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7777 const void *blob,const size_t length)
7778{
7779 Image
7780 *images;
7781
7782 assert(wand != (MagickWand *) NULL);
7783 assert(wand->signature == WandSignature);
7784 if (wand->debug != MagickFalse)
7785 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7786 images=BlobToImage(wand->image_info,blob,length,wand->exception);
7787 if (images == (Image *) NULL)
7788 return(MagickFalse);
7789 return(InsertImageInWand(wand,images));
7790}
7791
7792/*
7793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7794% %
7795% %
7796% %
7797% M a g i c k R e a d I m a g e F i l e %
7798% %
7799% %
7800% %
7801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7802%
anthonya89dd172011-10-04 13:29:35 +00007803% MagickReadImageFile() reads an image or image sequence from an already
7804% opened file descriptor. Otherwise it is like MagickReadImage().
cristy3ed852e2009-09-05 21:47:34 +00007805%
7806% The format of the MagickReadImageFile method is:
7807%
7808% MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7809%
7810% A description of each parameter follows:
7811%
7812% o wand: the magick wand.
7813%
7814% o file: the file descriptor.
7815%
7816*/
7817WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7818{
7819 Image
7820 *images;
7821
7822 ImageInfo
7823 *read_info;
7824
7825 assert(wand != (MagickWand *) NULL);
7826 assert(wand->signature == WandSignature);
7827 assert(file != (FILE *) NULL);
7828 if (wand->debug != MagickFalse)
7829 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7830 read_info=CloneImageInfo(wand->image_info);
7831 SetImageInfoFile(read_info,file);
7832 images=ReadImage(read_info,wand->exception);
7833 read_info=DestroyImageInfo(read_info);
7834 if (images == (Image *) NULL)
7835 return(MagickFalse);
7836 return(InsertImageInWand(wand,images));
7837}
7838
7839/*
7840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7841% %
7842% %
7843% %
cristy3ed852e2009-09-05 21:47:34 +00007844% M a g i c k R e m a p I m a g e %
7845% %
7846% %
7847% %
7848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7849%
7850% MagickRemapImage() replaces the colors of an image with the closest color
7851% from a reference image.
7852%
7853% The format of the MagickRemapImage method is:
7854%
7855% MagickBooleanType MagickRemapImage(MagickWand *wand,
7856% const MagickWand *remap_wand,const DitherMethod method)
7857%
7858% A description of each parameter follows:
7859%
7860% o wand: the magick wand.
7861%
7862% o affinity: the affinity wand.
7863%
7864% o method: choose from these dither methods: NoDitherMethod,
7865% RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7866%
7867*/
7868WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7869 const MagickWand *remap_wand,const DitherMethod method)
7870{
7871 MagickBooleanType
7872 status;
7873
7874 QuantizeInfo
7875 *quantize_info;
7876
7877 assert(wand != (MagickWand *) NULL);
7878 assert(wand->signature == WandSignature);
7879 if (wand->debug != MagickFalse)
7880 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7881 if ((wand->images == (Image *) NULL) ||
7882 (remap_wand->images == (Image *) NULL))
7883 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7884 quantize_info=AcquireQuantizeInfo(wand->image_info);
7885 quantize_info->dither_method=method;
7886 if (method == NoDitherMethod)
7887 quantize_info->dither=MagickFalse;
cristy018f07f2011-09-04 21:15:19 +00007888 status=RemapImage(quantize_info,wand->images,remap_wand->images,
7889 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007890 quantize_info=DestroyQuantizeInfo(quantize_info);
cristy3ed852e2009-09-05 21:47:34 +00007891 return(status);
7892}
7893
7894/*
7895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7896% %
7897% %
7898% %
7899% M a g i c k R e m o v e I m a g e %
7900% %
7901% %
7902% %
7903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7904%
7905% MagickRemoveImage() removes an image from the image list.
7906%
7907% The format of the MagickRemoveImage method is:
7908%
7909% MagickBooleanType MagickRemoveImage(MagickWand *wand)
7910%
7911% A description of each parameter follows:
7912%
7913% o wand: the magick wand.
7914%
7915% o insert: the splice wand.
7916%
7917*/
7918WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7919{
7920 assert(wand != (MagickWand *) NULL);
7921 assert(wand->signature == WandSignature);
7922 if (wand->debug != MagickFalse)
7923 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7924 if (wand->images == (Image *) NULL)
7925 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7926 DeleteImageFromList(&wand->images);
7927 return(MagickTrue);
7928}
7929
7930/*
7931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7932% %
7933% %
7934% %
7935% M a g i c k R e s a m p l e I m a g e %
7936% %
7937% %
7938% %
7939%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7940%
7941% MagickResampleImage() resample image to desired resolution.
7942%
7943% Bessel Blackman Box
7944% Catrom Cubic Gaussian
7945% Hanning Hermite Lanczos
7946% Mitchell Point Quandratic
7947% Sinc Triangle
7948%
7949% Most of the filters are FIR (finite impulse response), however, Bessel,
7950% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
7951% are windowed (brought down to zero) with the Blackman filter.
7952%
7953% The format of the MagickResampleImage method is:
7954%
7955% MagickBooleanType MagickResampleImage(MagickWand *wand,
7956% const double x_resolution,const double y_resolution,
7957% const FilterTypes filter,const double blur)
7958%
7959% A description of each parameter follows:
7960%
7961% o wand: the magick wand.
7962%
7963% o x_resolution: the new image x resolution.
7964%
7965% o y_resolution: the new image y resolution.
7966%
7967% o filter: Image filter to use.
7968%
7969% o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7970%
7971*/
7972WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7973 const double x_resolution,const double y_resolution,const FilterTypes filter,
7974 const double blur)
7975{
7976 Image
7977 *resample_image;
7978
7979 assert(wand != (MagickWand *) NULL);
7980 assert(wand->signature == WandSignature);
7981 if (wand->debug != MagickFalse)
7982 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7983 if (wand->images == (Image *) NULL)
7984 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7985 resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7986 blur,wand->exception);
7987 if (resample_image == (Image *) NULL)
7988 return(MagickFalse);
7989 ReplaceImageInList(&wand->images,resample_image);
7990 return(MagickTrue);
7991}
7992
7993/*
7994%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7995% %
7996% %
7997% %
7998% M a g i c k R e s e t I m a g e P a g e %
7999% %
8000% %
8001% %
8002%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8003%
8004% MagickResetImagePage() resets the Wand page canvas and position.
8005%
8006% The format of the MagickResetImagePage method is:
8007%
8008% MagickBooleanType MagickResetImagePage(MagickWand *wand,
8009% const char *page)
8010%
8011% A description of each parameter follows:
8012%
8013% o wand: the magick wand.
8014%
8015% o page: the relative page specification.
8016%
8017*/
8018WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8019 const char *page)
8020{
8021 assert(wand != (MagickWand *) NULL);
8022 assert(wand->signature == WandSignature);
8023 if (wand->debug != MagickFalse)
8024 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8025 if (wand->images == (Image *) NULL)
8026 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8027 if ((page == (char *) NULL) || (*page == '\0'))
8028 {
8029 (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8030 return(MagickTrue);
8031 }
8032 return(ResetImagePage(wand->images,page));
8033}
8034
8035/*
8036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8037% %
8038% %
8039% %
8040% M a g i c k R e s i z e I m a g e %
8041% %
8042% %
8043% %
8044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8045%
8046% MagickResizeImage() scales an image to the desired dimensions with one of
8047% these filters:
8048%
8049% Bessel Blackman Box
8050% Catrom Cubic Gaussian
8051% Hanning Hermite Lanczos
8052% Mitchell Point Quandratic
8053% Sinc Triangle
8054%
8055% Most of the filters are FIR (finite impulse response), however, Bessel,
8056% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8057% are windowed (brought down to zero) with the Blackman filter.
8058%
8059% The format of the MagickResizeImage method is:
8060%
8061% MagickBooleanType MagickResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008062% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00008063% const FilterTypes filter,const double blur)
8064%
8065% A description of each parameter follows:
8066%
8067% o wand: the magick wand.
8068%
8069% o columns: the number of columns in the scaled image.
8070%
8071% o rows: the number of rows in the scaled image.
8072%
8073% o filter: Image filter to use.
8074%
8075% o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8076%
8077*/
8078WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008079 const size_t columns,const size_t rows,const FilterTypes filter,
cristy3ed852e2009-09-05 21:47:34 +00008080 const double blur)
8081{
8082 Image
8083 *resize_image;
8084
8085 assert(wand != (MagickWand *) NULL);
8086 assert(wand->signature == WandSignature);
8087 if (wand->debug != MagickFalse)
8088 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8089 if (wand->images == (Image *) NULL)
8090 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8091 resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8092 wand->exception);
8093 if (resize_image == (Image *) NULL)
8094 return(MagickFalse);
8095 ReplaceImageInList(&wand->images,resize_image);
8096 return(MagickTrue);
8097}
8098
8099/*
8100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8101% %
8102% %
8103% %
8104% M a g i c k R o l l I m a g e %
8105% %
8106% %
8107% %
8108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8109%
8110% MagickRollImage() offsets an image as defined by x and y.
8111%
8112% The format of the MagickRollImage method is:
8113%
cristybb503372010-05-27 20:51:26 +00008114% MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8115% const size_t y)
cristy3ed852e2009-09-05 21:47:34 +00008116%
8117% A description of each parameter follows:
8118%
8119% o wand: the magick wand.
8120%
8121% o x: the x offset.
8122%
8123% o y: the y offset.
8124%
8125%
8126*/
8127WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008128 const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00008129{
8130 Image
8131 *roll_image;
8132
8133 assert(wand != (MagickWand *) NULL);
8134 assert(wand->signature == WandSignature);
8135 if (wand->debug != MagickFalse)
8136 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8137 if (wand->images == (Image *) NULL)
8138 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8139 roll_image=RollImage(wand->images,x,y,wand->exception);
8140 if (roll_image == (Image *) NULL)
8141 return(MagickFalse);
8142 ReplaceImageInList(&wand->images,roll_image);
8143 return(MagickTrue);
8144}
8145
8146/*
8147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8148% %
8149% %
8150% %
8151% M a g i c k R o t a t e I m a g e %
8152% %
8153% %
8154% %
8155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8156%
8157% MagickRotateImage() rotates an image the specified number of degrees. Empty
8158% triangles left over from rotating the image are filled with the
8159% background color.
8160%
8161% The format of the MagickRotateImage method is:
8162%
8163% MagickBooleanType MagickRotateImage(MagickWand *wand,
8164% const PixelWand *background,const double degrees)
8165%
8166% A description of each parameter follows:
8167%
8168% o wand: the magick wand.
8169%
8170% o background: the background pixel wand.
8171%
8172% o degrees: the number of degrees to rotate the image.
8173%
8174%
8175*/
8176WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8177 const PixelWand *background,const double degrees)
8178{
8179 Image
8180 *rotate_image;
8181
8182 assert(wand != (MagickWand *) NULL);
8183 assert(wand->signature == WandSignature);
8184 if (wand->debug != MagickFalse)
8185 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8186 if (wand->images == (Image *) NULL)
8187 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008188 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00008189 rotate_image=RotateImage(wand->images,degrees,wand->exception);
8190 if (rotate_image == (Image *) NULL)
8191 return(MagickFalse);
8192 ReplaceImageInList(&wand->images,rotate_image);
8193 return(MagickTrue);
8194}
8195
8196/*
8197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8198% %
8199% %
8200% %
8201% M a g i c k S a m p l e I m a g e %
8202% %
8203% %
8204% %
8205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8206%
8207% MagickSampleImage() scales an image to the desired dimensions with pixel
8208% sampling. Unlike other scaling methods, this method does not introduce
8209% any additional color into the scaled image.
8210%
8211% The format of the MagickSampleImage method is:
8212%
8213% MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008214% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008215%
8216% A description of each parameter follows:
8217%
8218% o wand: the magick wand.
8219%
8220% o columns: the number of columns in the scaled image.
8221%
8222% o rows: the number of rows in the scaled image.
8223%
8224%
8225*/
8226WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008227 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008228{
8229 Image
8230 *sample_image;
8231
8232 assert(wand != (MagickWand *) NULL);
8233 assert(wand->signature == WandSignature);
8234 if (wand->debug != MagickFalse)
8235 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8236 if (wand->images == (Image *) NULL)
8237 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8238 sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8239 if (sample_image == (Image *) NULL)
8240 return(MagickFalse);
8241 ReplaceImageInList(&wand->images,sample_image);
8242 return(MagickTrue);
8243}
8244
8245/*
8246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8247% %
8248% %
8249% %
8250% M a g i c k S c a l e I m a g e %
8251% %
8252% %
8253% %
8254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8255%
8256% MagickScaleImage() scales the size of an image to the given dimensions.
8257%
8258% The format of the MagickScaleImage method is:
8259%
8260% MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008261% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008262%
8263% A description of each parameter follows:
8264%
8265% o wand: the magick wand.
8266%
8267% o columns: the number of columns in the scaled image.
8268%
8269% o rows: the number of rows in the scaled image.
8270%
8271%
8272*/
8273WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008274 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008275{
8276 Image
8277 *scale_image;
8278
8279 assert(wand != (MagickWand *) NULL);
8280 assert(wand->signature == WandSignature);
8281 if (wand->debug != MagickFalse)
8282 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8283 if (wand->images == (Image *) NULL)
8284 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8285 scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8286 if (scale_image == (Image *) NULL)
8287 return(MagickFalse);
8288 ReplaceImageInList(&wand->images,scale_image);
8289 return(MagickTrue);
8290}
8291
8292/*
8293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8294% %
8295% %
8296% %
8297% M a g i c k S e g m e n t I m a g e %
8298% %
8299% %
8300% %
8301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8302%
8303% MagickSegmentImage() segments an image by analyzing the histograms of the
8304% color components and identifying units that are homogeneous with the fuzzy
8305% C-means technique.
8306%
8307% The format of the SegmentImage method is:
8308%
8309% MagickBooleanType MagickSegmentImage(MagickWand *wand,
8310% const ColorspaceType colorspace,const MagickBooleanType verbose,
8311% const double cluster_threshold,const double smooth_threshold)
8312%
8313% A description of each parameter follows.
8314%
8315% o wand: the wand.
8316%
8317% o colorspace: the image colorspace.
8318%
8319% o verbose: Set to MagickTrue to print detailed information about the
8320% identified classes.
8321%
8322% o cluster_threshold: This represents the minimum number of pixels
8323% contained in a hexahedra before it can be considered valid (expressed as
8324% a percentage).
8325%
8326% o smooth_threshold: the smoothing threshold eliminates noise in the second
8327% derivative of the histogram. As the value is increased, you can expect a
8328% smoother second derivative.
8329%
8330*/
8331MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8332 const ColorspaceType colorspace,const MagickBooleanType verbose,
8333 const double cluster_threshold,const double smooth_threshold)
8334{
8335 MagickBooleanType
8336 status;
8337
8338 assert(wand != (MagickWand *) NULL);
8339 assert(wand->signature == WandSignature);
8340 if (wand->debug != MagickFalse)
8341 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8342 if (wand->images == (Image *) NULL)
8343 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8344 status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
cristy018f07f2011-09-04 21:15:19 +00008345 smooth_threshold,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008346 return(status);
8347}
8348
8349/*
8350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8351% %
8352% %
8353% %
8354% M a g i c k S e l e c t i v e B l u r I m a g e %
8355% %
8356% %
8357% %
8358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8359%
8360% MagickSelectiveBlurImage() selectively blur an image within a contrast
8361% threshold. It is similar to the unsharpen mask that sharpens everything with
8362% contrast above a certain threshold.
8363%
8364% The format of the MagickSelectiveBlurImage method is:
8365%
8366% MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
cristy1e7aa312011-09-10 20:01:36 +00008367% const double radius,const double sigma,const double threshold,
8368% const double bias)
cristy3ed852e2009-09-05 21:47:34 +00008369%
8370% A description of each parameter follows:
8371%
8372% o wand: the magick wand.
8373%
cristy3ed852e2009-09-05 21:47:34 +00008374% o radius: the radius of the gaussian, in pixels, not counting the center
8375% pixel.
8376%
8377% o sigma: the standard deviation of the gaussian, in pixels.
8378%
8379% o threshold: only pixels within this contrast threshold are included
cristy6a917d92009-10-06 19:23:54 +00008380% in the blur operation.
cristy3ed852e2009-09-05 21:47:34 +00008381%
cristy1e7aa312011-09-10 20:01:36 +00008382% o bias: the bias.
8383%
cristy3ed852e2009-09-05 21:47:34 +00008384*/
cristy3ed852e2009-09-05 21:47:34 +00008385WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
cristy1e7aa312011-09-10 20:01:36 +00008386 const double radius,const double sigma,const double threshold,
8387 const double bias)
cristy3ed852e2009-09-05 21:47:34 +00008388{
cristy3ed852e2009-09-05 21:47:34 +00008389 Image
8390 *blur_image;
8391
8392 assert(wand != (MagickWand *) NULL);
8393 assert(wand->signature == WandSignature);
8394 if (wand->debug != MagickFalse)
8395 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8396 if (wand->images == (Image *) NULL)
8397 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy1e7aa312011-09-10 20:01:36 +00008398 blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
cristyf4ad9df2011-07-08 16:49:03 +00008399 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008400 if (blur_image == (Image *) NULL)
8401 return(MagickFalse);
8402 ReplaceImageInList(&wand->images,blur_image);
8403 return(MagickTrue);
8404}
8405
8406/*
8407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8408% %
8409% %
8410% %
8411% 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 %
8412% %
8413% %
8414% %
8415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8416%
cristy3139dc22011-07-08 00:11:42 +00008417% MagickSeparateImage() separates a channel from the image and returns a
cristy3ed852e2009-09-05 21:47:34 +00008418% grayscale image. A channel is a particular color component of each pixel
8419% in the image.
8420%
cristy3139dc22011-07-08 00:11:42 +00008421% The format of the MagickSeparateImage method is:
cristy3ed852e2009-09-05 21:47:34 +00008422%
cristy3139dc22011-07-08 00:11:42 +00008423% MagickBooleanType MagickSeparateImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00008424%
8425% A description of each parameter follows:
8426%
8427% o wand: the magick wand.
8428%
cristy3ed852e2009-09-05 21:47:34 +00008429*/
cristy3139dc22011-07-08 00:11:42 +00008430WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00008431{
8432 MagickBooleanType
8433 status;
8434
8435 assert(wand != (MagickWand *) NULL);
8436 assert(wand->signature == WandSignature);
8437 if (wand->debug != MagickFalse)
8438 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8439 if (wand->images == (Image *) NULL)
8440 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3139dc22011-07-08 00:11:42 +00008441 status=SeparateImage(wand->images);
cristy3ed852e2009-09-05 21:47:34 +00008442 if (status == MagickFalse)
8443 InheritException(wand->exception,&wand->images->exception);
8444 return(status);
8445}
8446
8447/*
8448%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8449% %
8450% %
8451% %
8452% M a g i c k S e p i a T o n e I m a g e %
8453% %
8454% %
8455% %
8456%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8457%
8458% MagickSepiaToneImage() applies a special effect to the image, similar to the
8459% effect achieved in a photo darkroom by sepia toning. Threshold ranges from
8460% 0 to QuantumRange and is a measure of the extent of the sepia toning. A
8461% threshold of 80% is a good starting point for a reasonable tone.
8462%
8463% The format of the MagickSepiaToneImage method is:
8464%
8465% MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8466% const double threshold)
8467%
8468% A description of each parameter follows:
8469%
8470% o wand: the magick wand.
8471%
8472% o threshold: Define the extent of the sepia toning.
8473%
8474*/
8475WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8476 const double threshold)
8477{
8478 Image
8479 *sepia_image;
8480
8481 assert(wand != (MagickWand *) NULL);
8482 assert(wand->signature == WandSignature);
8483 if (wand->debug != MagickFalse)
8484 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8485 if (wand->images == (Image *) NULL)
8486 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8487 sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8488 if (sepia_image == (Image *) NULL)
8489 return(MagickFalse);
8490 ReplaceImageInList(&wand->images,sepia_image);
8491 return(MagickTrue);
8492}
8493
8494/*
8495%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8496% %
8497% %
8498% %
8499% M a g i c k S e t I m a g e %
8500% %
8501% %
8502% %
8503%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8504%
8505% MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8506% MagickNextImage(), MagickPreviousImage() with the images from the specified
8507% wand.
8508%
8509% The format of the MagickSetImage method is:
8510%
8511% MagickBooleanType MagickSetImage(MagickWand *wand,
8512% const MagickWand *set_wand)
8513%
8514% A description of each parameter follows:
8515%
8516% o wand: the magick wand.
8517%
8518% o set_wand: the set_wand wand.
8519%
8520*/
8521WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8522 const MagickWand *set_wand)
8523{
8524 Image
8525 *images;
8526
8527 assert(wand != (MagickWand *) NULL);
8528 assert(wand->signature == WandSignature);
8529 if (wand->debug != MagickFalse)
8530 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8531 assert(set_wand != (MagickWand *) NULL);
8532 assert(set_wand->signature == WandSignature);
8533 if (wand->debug != MagickFalse)
8534 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8535 if (set_wand->images == (Image *) NULL)
8536 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8537 images=CloneImageList(set_wand->images,wand->exception);
8538 if (images == (Image *) NULL)
8539 return(MagickFalse);
8540 ReplaceImageInList(&wand->images,images);
8541 return(MagickTrue);
8542}
8543
8544/*
8545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8546% %
8547% %
8548% %
8549% 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 %
8550% %
8551% %
8552% %
8553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8554%
8555% MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8556% alpha channel.
8557%
8558% The format of the MagickSetImageAlphaChannel method is:
8559%
8560% MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8561% const AlphaChannelType alpha_type)
8562%
8563% A description of each parameter follows:
8564%
8565% o wand: the magick wand.
8566%
8567% o alpha_type: the alpha channel type: ActivateAlphaChannel,
8568% DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8569%
8570*/
8571WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8572 const AlphaChannelType alpha_type)
8573{
8574 assert(wand != (MagickWand *) NULL);
8575 assert(wand->signature == WandSignature);
8576 if (wand->debug != MagickFalse)
8577 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8578 if (wand->images == (Image *) NULL)
8579 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy63240882011-08-05 19:05:27 +00008580 return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
cristy3ed852e2009-09-05 21:47:34 +00008581}
8582
8583/*
8584%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8585% %
8586% %
8587% %
8588% 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 %
8589% %
8590% %
8591% %
8592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8593%
8594% MagickSetImageBackgroundColor() sets the image background color.
8595%
8596% The format of the MagickSetImageBackgroundColor method is:
8597%
8598% MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8599% const PixelWand *background)
8600%
8601% A description of each parameter follows:
8602%
8603% o wand: the magick wand.
8604%
8605% o background: the background pixel wand.
8606%
8607*/
8608WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8609 const PixelWand *background)
8610{
8611 assert(wand != (MagickWand *) NULL);
8612 assert(wand->signature == WandSignature);
8613 if (wand->debug != MagickFalse)
8614 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8615 if (wand->images == (Image *) NULL)
8616 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008617 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00008618 return(MagickTrue);
8619}
8620
8621/*
8622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8623% %
8624% %
8625% %
8626% M a g i c k S e t I m a g e B i a s %
8627% %
8628% %
8629% %
8630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8631%
8632% MagickSetImageBias() sets the image bias for any method that convolves an
8633% image (e.g. MagickConvolveImage()).
8634%
8635% The format of the MagickSetImageBias method is:
8636%
8637% MagickBooleanType MagickSetImageBias(MagickWand *wand,
8638% const double bias)
8639%
8640% A description of each parameter follows:
8641%
8642% o wand: the magick wand.
8643%
8644% o bias: the image bias.
8645%
8646*/
8647WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8648 const double bias)
8649{
8650 assert(wand != (MagickWand *) NULL);
8651 assert(wand->signature == WandSignature);
8652 if (wand->debug != MagickFalse)
8653 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8654 if (wand->images == (Image *) NULL)
8655 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8656 wand->images->bias=bias;
8657 return(MagickTrue);
8658}
8659
8660/*
8661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8662% %
8663% %
8664% %
8665% 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 %
8666% %
8667% %
8668% %
8669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8670%
8671% MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8672%
8673% The format of the MagickSetImageBluePrimary method is:
8674%
8675% MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8676% const double x,const double y)
8677%
8678% A description of each parameter follows:
8679%
8680% o wand: the magick wand.
8681%
8682% o x: the blue primary x-point.
8683%
8684% o y: the blue primary y-point.
8685%
8686*/
8687WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8688 const double x,const double y)
8689{
8690 assert(wand != (MagickWand *) NULL);
8691 assert(wand->signature == WandSignature);
8692 if (wand->debug != MagickFalse)
8693 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8694 if (wand->images == (Image *) NULL)
8695 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8696 wand->images->chromaticity.blue_primary.x=x;
8697 wand->images->chromaticity.blue_primary.y=y;
8698 return(MagickTrue);
8699}
8700
8701/*
8702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8703% %
8704% %
8705% %
8706% 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 %
8707% %
8708% %
8709% %
8710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8711%
8712% MagickSetImageBorderColor() sets the image border color.
8713%
8714% The format of the MagickSetImageBorderColor method is:
8715%
8716% MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8717% const PixelWand *border)
8718%
8719% A description of each parameter follows:
8720%
8721% o wand: the magick wand.
8722%
8723% o border: the border pixel wand.
8724%
8725*/
8726WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8727 const PixelWand *border)
8728{
8729 assert(wand != (MagickWand *) NULL);
8730 assert(wand->signature == WandSignature);
8731 if (wand->debug != MagickFalse)
8732 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8733 if (wand->images == (Image *) NULL)
8734 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008735 PixelGetQuantumPacket(border,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00008736 return(MagickTrue);
8737}
8738
8739/*
8740%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8741% %
8742% %
8743% %
cristy3ed852e2009-09-05 21:47:34 +00008744% M a g i c k S e t I m a g e C l i p M a s k %
8745% %
8746% %
8747% %
8748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8749%
8750% MagickSetImageClipMask() sets image clip mask.
8751%
8752% The format of the MagickSetImageClipMask method is:
8753%
8754% MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8755% const MagickWand *clip_mask)
8756%
8757% A description of each parameter follows:
8758%
8759% o wand: the magick wand.
8760%
8761% o clip_mask: the clip_mask wand.
8762%
8763*/
8764WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8765 const MagickWand *clip_mask)
8766{
8767 assert(wand != (MagickWand *) NULL);
8768 assert(wand->signature == WandSignature);
8769 if (wand->debug != MagickFalse)
8770 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8771 assert(clip_mask != (MagickWand *) NULL);
8772 assert(clip_mask->signature == WandSignature);
8773 if (wand->debug != MagickFalse)
8774 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8775 if (clip_mask->images == (Image *) NULL)
8776 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00008777 return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00008778}
8779
8780/*
8781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8782% %
8783% %
8784% %
cristya5b77cb2010-05-07 19:34:48 +00008785% M a g i c k S e t I m a g e C o l o r %
8786% %
8787% %
8788% %
8789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8790%
8791% MagickSetImageColor() set the entire wand canvas to the specified color.
8792%
8793% The format of the MagickSetImageColor method is:
8794%
8795% MagickBooleanType MagickSetImageColor(MagickWand *wand,
8796% const PixelWand *color)
8797%
8798% A description of each parameter follows:
8799%
8800% o wand: the magick wand.
8801%
8802% o background: the image color.
8803%
8804*/
8805WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8806 const PixelWand *color)
8807{
8808 MagickBooleanType
8809 status;
8810
cristy4c08aed2011-07-01 19:47:50 +00008811 PixelInfo
cristya5b77cb2010-05-07 19:34:48 +00008812 pixel;
8813
8814 assert(wand != (MagickWand *) NULL);
8815 assert(wand->signature == WandSignature);
8816 if (wand->debug != MagickFalse)
8817 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8818 PixelGetMagickColor(color,&pixel);
8819 status=SetImageColor(wand->images,&pixel);
8820 if (status == MagickFalse)
8821 InheritException(wand->exception,&wand->images->exception);
8822 return(status);
8823}
8824
8825/*
8826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8827% %
8828% %
8829% %
cristy3ed852e2009-09-05 21:47:34 +00008830% 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 %
8831% %
8832% %
8833% %
8834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8835%
8836% MagickSetImageColormapColor() sets the color of the specified colormap
8837% index.
8838%
8839% The format of the MagickSetImageColormapColor method is:
8840%
8841% MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008842% const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00008843%
8844% A description of each parameter follows:
8845%
8846% o wand: the magick wand.
8847%
8848% o index: the offset into the image colormap.
8849%
8850% o color: Return the colormap color in this wand.
8851%
8852*/
8853WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008854 const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00008855{
8856 assert(wand != (MagickWand *) NULL);
8857 assert(wand->signature == WandSignature);
8858 if (wand->debug != MagickFalse)
8859 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8860 if (wand->images == (Image *) NULL)
8861 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy101ab702011-10-13 13:06:32 +00008862 if ((wand->images->colormap == (PixelInfo *) NULL) ||
cristy3ed852e2009-09-05 21:47:34 +00008863 (index >= wand->images->colors))
8864 ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008865 PixelGetQuantumPacket(color,wand->images->colormap+index);
cristy3ed852e2009-09-05 21:47:34 +00008866 return(SyncImage(wand->images));
8867}
8868
8869/*
8870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8871% %
8872% %
8873% %
8874% M a g i c k S e t I m a g e C o l o r s p a c e %
8875% %
8876% %
8877% %
8878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8879%
8880% MagickSetImageColorspace() sets the image colorspace.
8881%
8882% The format of the MagickSetImageColorspace method is:
8883%
8884% MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8885% const ColorspaceType colorspace)
8886%
8887% A description of each parameter follows:
8888%
8889% o wand: the magick wand.
8890%
8891% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
8892% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8893% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8894% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8895% HSLColorspace, or HWBColorspace.
8896%
8897*/
8898WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8899 const ColorspaceType colorspace)
8900{
8901 assert(wand != (MagickWand *) NULL);
8902 assert(wand->signature == WandSignature);
8903 if (wand->debug != MagickFalse)
8904 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8905 if (wand->images == (Image *) NULL)
8906 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy63240882011-08-05 19:05:27 +00008907 return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
cristy3ed852e2009-09-05 21:47:34 +00008908}
8909
8910/*
8911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8912% %
8913% %
8914% %
8915% M a g i c k S e t I m a g e C o m p o s e %
8916% %
8917% %
8918% %
8919%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8920%
8921% MagickSetImageCompose() sets the image composite operator, useful for
8922% specifying how to composite the image thumbnail when using the
8923% MagickMontageImage() method.
8924%
8925% The format of the MagickSetImageCompose method is:
8926%
8927% MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8928% const CompositeOperator compose)
8929%
8930% A description of each parameter follows:
8931%
8932% o wand: the magick wand.
8933%
8934% o compose: the image composite operator.
8935%
8936*/
8937WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8938 const CompositeOperator compose)
8939{
8940 assert(wand != (MagickWand *) NULL);
8941 assert(wand->signature == WandSignature);
8942 if (wand->debug != MagickFalse)
8943 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8944 if (wand->images == (Image *) NULL)
8945 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8946 wand->images->compose=compose;
8947 return(MagickTrue);
8948}
8949
8950/*
8951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8952% %
8953% %
8954% %
8955% 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 %
8956% %
8957% %
8958% %
8959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8960%
8961% MagickSetImageCompression() sets the image compression.
8962%
8963% The format of the MagickSetImageCompression method is:
8964%
8965% MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8966% const CompressionType compression)
8967%
8968% A description of each parameter follows:
8969%
8970% o wand: the magick wand.
8971%
8972% o compression: the image compression type.
8973%
8974*/
8975WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8976 const CompressionType compression)
8977{
8978 assert(wand != (MagickWand *) NULL);
8979 assert(wand->signature == WandSignature);
8980 if (wand->debug != MagickFalse)
8981 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8982 if (wand->images == (Image *) NULL)
8983 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8984 wand->images->compression=compression;
8985 return(MagickTrue);
8986}
8987
8988/*
8989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8990% %
8991% %
8992% %
8993% 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 %
8994% %
8995% %
8996% %
8997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8998%
8999% MagickSetImageCompressionQuality() sets the image compression quality.
9000%
9001% The format of the MagickSetImageCompressionQuality method is:
9002%
9003% MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009004% const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009005%
9006% A description of each parameter follows:
9007%
9008% o wand: the magick wand.
9009%
9010% o quality: the image compression tlityype.
9011%
9012*/
9013WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009014 const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009015{
9016 assert(wand != (MagickWand *) NULL);
9017 assert(wand->signature == WandSignature);
9018 if (wand->debug != MagickFalse)
9019 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9020 if (wand->images == (Image *) NULL)
9021 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9022 wand->images->quality=quality;
9023 return(MagickTrue);
9024}
9025
9026/*
9027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9028% %
9029% %
9030% %
9031% M a g i c k S e t I m a g e D e l a y %
9032% %
9033% %
9034% %
9035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9036%
9037% MagickSetImageDelay() sets the image delay.
9038%
9039% The format of the MagickSetImageDelay method is:
9040%
9041% MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009042% const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009043%
9044% A description of each parameter follows:
9045%
9046% o wand: the magick wand.
9047%
9048% o delay: the image delay in ticks-per-second units.
9049%
9050*/
9051WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009052 const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009053{
9054 assert(wand != (MagickWand *) NULL);
9055 assert(wand->signature == WandSignature);
9056 if (wand->debug != MagickFalse)
9057 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9058 if (wand->images == (Image *) NULL)
9059 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9060 wand->images->delay=delay;
9061 return(MagickTrue);
9062}
9063
9064/*
9065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9066% %
9067% %
9068% %
9069% M a g i c k S e t I m a g e D e p t h %
9070% %
9071% %
9072% %
9073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9074%
9075% MagickSetImageDepth() sets the image depth.
9076%
9077% The format of the MagickSetImageDepth method is:
9078%
9079% MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009080% const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009081%
9082% A description of each parameter follows:
9083%
9084% o wand: the magick wand.
9085%
9086% o depth: the image depth in bits: 8, 16, or 32.
9087%
9088*/
9089WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009090 const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009091{
9092 assert(wand != (MagickWand *) NULL);
9093 assert(wand->signature == WandSignature);
9094 if (wand->debug != MagickFalse)
9095 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9096 if (wand->images == (Image *) NULL)
9097 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyfefab1b2011-07-05 00:33:22 +00009098 return(SetImageDepth(wand->images,depth));
cristy3ed852e2009-09-05 21:47:34 +00009099}
9100
9101/*
9102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9103% %
9104% %
9105% %
9106% M a g i c k S e t I m a g e D i s p o s e %
9107% %
9108% %
9109% %
9110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9111%
9112% MagickSetImageDispose() sets the image disposal method.
9113%
9114% The format of the MagickSetImageDispose method is:
9115%
9116% MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9117% const DisposeType dispose)
9118%
9119% A description of each parameter follows:
9120%
9121% o wand: the magick wand.
9122%
9123% o dispose: the image disposeal type.
9124%
9125*/
9126WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9127 const DisposeType dispose)
9128{
9129 assert(wand != (MagickWand *) NULL);
9130 assert(wand->signature == WandSignature);
9131 if (wand->debug != MagickFalse)
9132 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9133 if (wand->images == (Image *) NULL)
9134 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9135 wand->images->dispose=dispose;
9136 return(MagickTrue);
9137}
9138
9139/*
9140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9141% %
9142% %
9143% %
9144% M a g i c k S e t I m a g e E x t e n t %
9145% %
9146% %
9147% %
9148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9149%
9150% MagickSetImageExtent() sets the image size (i.e. columns & rows).
9151%
9152% The format of the MagickSetImageExtent method is:
9153%
9154% MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009155% const size_t columns,const unsigned rows)
cristy3ed852e2009-09-05 21:47:34 +00009156%
9157% A description of each parameter follows:
9158%
9159% o wand: the magick wand.
9160%
9161% o columns: The image width in pixels.
9162%
9163% o rows: The image height in pixels.
9164%
9165*/
9166WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009167 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009168{
9169 assert(wand != (MagickWand *) NULL);
9170 assert(wand->signature == WandSignature);
9171 if (wand->debug != MagickFalse)
9172 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9173 if (wand->images == (Image *) NULL)
9174 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy63240882011-08-05 19:05:27 +00009175 return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
cristy3ed852e2009-09-05 21:47:34 +00009176}
9177
9178/*
9179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9180% %
9181% %
9182% %
9183% M a g i c k S e t I m a g e F i l e n a m e %
9184% %
9185% %
9186% %
9187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9188%
9189% MagickSetImageFilename() sets the filename of a particular image in a
9190% sequence.
9191%
9192% The format of the MagickSetImageFilename method is:
9193%
9194% MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9195% const char *filename)
9196%
9197% A description of each parameter follows:
9198%
9199% o wand: the magick wand.
9200%
9201% o filename: the image filename.
9202%
9203*/
9204WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9205 const char *filename)
9206{
9207 assert(wand != (MagickWand *) NULL);
9208 assert(wand->signature == WandSignature);
9209 if (wand->debug != MagickFalse)
9210 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9211 if (wand->images == (Image *) NULL)
9212 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9213 if (filename != (const char *) NULL)
9214 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9215 return(MagickTrue);
9216}
9217
9218/*
9219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9220% %
9221% %
9222% %
9223% M a g i c k S e t I m a g e F o r m a t %
9224% %
9225% %
9226% %
9227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9228%
9229% MagickSetImageFormat() sets the format of a particular image in a
9230% sequence.
9231%
9232% The format of the MagickSetImageFormat method is:
9233%
9234% MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9235% const char *format)
9236%
9237% A description of each parameter follows:
9238%
9239% o wand: the magick wand.
9240%
9241% o format: the image format.
9242%
9243*/
9244WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9245 const char *format)
9246{
9247 const MagickInfo
9248 *magick_info;
9249
9250 assert(wand != (MagickWand *) NULL);
9251 assert(wand->signature == WandSignature);
9252 if (wand->debug != MagickFalse)
9253 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9254 if (wand->images == (Image *) NULL)
9255 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9256 if ((format == (char *) NULL) || (*format == '\0'))
9257 {
9258 *wand->images->magick='\0';
9259 return(MagickTrue);
9260 }
9261 magick_info=GetMagickInfo(format,wand->exception);
9262 if (magick_info == (const MagickInfo *) NULL)
9263 return(MagickFalse);
9264 ClearMagickException(wand->exception);
9265 (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9266 return(MagickTrue);
9267}
9268
9269/*
9270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9271% %
9272% %
9273% %
9274% M a g i c k S e t I m a g e F u z z %
9275% %
9276% %
9277% %
9278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9279%
9280% MagickSetImageFuzz() sets the image fuzz.
9281%
9282% The format of the MagickSetImageFuzz method is:
9283%
9284% MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9285% const double fuzz)
9286%
9287% A description of each parameter follows:
9288%
9289% o wand: the magick wand.
9290%
9291% o fuzz: the image fuzz.
9292%
9293*/
9294WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9295 const double fuzz)
9296{
9297 assert(wand != (MagickWand *) NULL);
9298 assert(wand->signature == WandSignature);
9299 if (wand->debug != MagickFalse)
9300 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9301 if (wand->images == (Image *) NULL)
9302 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9303 wand->images->fuzz=fuzz;
9304 return(MagickTrue);
9305}
9306
9307/*
9308%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9309% %
9310% %
9311% %
9312% M a g i c k S e t I m a g e G a m m a %
9313% %
9314% %
9315% %
9316%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9317%
9318% MagickSetImageGamma() sets the image gamma.
9319%
9320% The format of the MagickSetImageGamma method is:
9321%
9322% MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9323% const double gamma)
9324%
9325% A description of each parameter follows:
9326%
9327% o wand: the magick wand.
9328%
9329% o gamma: the image gamma.
9330%
9331*/
9332WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9333 const double gamma)
9334{
9335 assert(wand != (MagickWand *) NULL);
9336 assert(wand->signature == WandSignature);
9337 if (wand->debug != MagickFalse)
9338 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9339 if (wand->images == (Image *) NULL)
9340 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9341 wand->images->gamma=gamma;
9342 return(MagickTrue);
9343}
9344
9345/*
9346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9347% %
9348% %
9349% %
9350% M a g i c k S e t I m a g e G r a v i t y %
9351% %
9352% %
9353% %
9354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9355%
9356% MagickSetImageGravity() sets the image gravity type.
9357%
9358% The format of the MagickSetImageGravity method is:
9359%
9360% MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9361% const GravityType gravity)
9362%
9363% A description of each parameter follows:
9364%
9365% o wand: the magick wand.
9366%
9367% o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9368% PlaneInterlace, PartitionInterlace.
9369%
9370*/
9371WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9372 const GravityType gravity)
9373{
9374 assert(wand != (MagickWand *) NULL);
9375 assert(wand->signature == WandSignature);
9376 if (wand->debug != MagickFalse)
9377 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9378 if (wand->images == (Image *) NULL)
9379 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9380 wand->images->gravity=gravity;
9381 return(MagickTrue);
9382}
9383
9384/*
9385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9386% %
9387% %
9388% %
9389% 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 %
9390% %
9391% %
9392% %
9393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9394%
9395% MagickSetImageGreenPrimary() sets the image chromaticity green primary
9396% point.
9397%
9398% The format of the MagickSetImageGreenPrimary method is:
9399%
9400% MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9401% const double x,const double y)
9402%
9403% A description of each parameter follows:
9404%
9405% o wand: the magick wand.
9406%
9407% o x: the green primary x-point.
9408%
9409% o y: the green primary y-point.
9410%
9411%
9412*/
9413WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9414 const double x,const double y)
9415{
9416 assert(wand != (MagickWand *) NULL);
9417 assert(wand->signature == WandSignature);
9418 if (wand->debug != MagickFalse)
9419 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9420 if (wand->images == (Image *) NULL)
9421 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9422 wand->images->chromaticity.green_primary.x=x;
9423 wand->images->chromaticity.green_primary.y=y;
9424 return(MagickTrue);
9425}
9426
9427/*
9428%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9429% %
9430% %
9431% %
9432% 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 %
9433% %
9434% %
9435% %
9436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9437%
9438% MagickSetImageInterlaceScheme() sets the image interlace scheme.
9439%
9440% The format of the MagickSetImageInterlaceScheme method is:
9441%
9442% MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9443% const InterlaceType interlace)
9444%
9445% A description of each parameter follows:
9446%
9447% o wand: the magick wand.
9448%
9449% o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9450% PlaneInterlace, PartitionInterlace.
9451%
9452*/
9453WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9454 const InterlaceType interlace)
9455{
9456 assert(wand != (MagickWand *) NULL);
9457 assert(wand->signature == WandSignature);
9458 if (wand->debug != MagickFalse)
9459 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9460 if (wand->images == (Image *) NULL)
9461 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9462 wand->images->interlace=interlace;
9463 return(MagickTrue);
9464}
9465
9466/*
9467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9468% %
9469% %
9470% %
9471% 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 %
9472% %
9473% %
9474% %
9475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9476%
cristy5c4e2582011-09-11 19:21:03 +00009477% MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
cristy3ed852e2009-09-05 21:47:34 +00009478%
cristy5c4e2582011-09-11 19:21:03 +00009479% The format of the MagickSetImagePixelInterpolateMethod method is:
cristy3ed852e2009-09-05 21:47:34 +00009480%
cristy5c4e2582011-09-11 19:21:03 +00009481% MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9482% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00009483%
9484% A description of each parameter follows:
9485%
9486% o wand: the magick wand.
9487%
9488% o method: the image interpole pixel methods: choose from Undefined,
9489% Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9490%
9491*/
cristy5c4e2582011-09-11 19:21:03 +00009492WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9493 const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00009494{
9495 assert(wand != (MagickWand *) NULL);
9496 assert(wand->signature == WandSignature);
9497 if (wand->debug != MagickFalse)
9498 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9499 if (wand->images == (Image *) NULL)
9500 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9501 wand->images->interpolate=method;
9502 return(MagickTrue);
9503}
9504
9505/*
9506%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9507% %
9508% %
9509% %
9510% M a g i c k S e t I m a g e I t e r a t i o n s %
9511% %
9512% %
9513% %
9514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9515%
9516% MagickSetImageIterations() sets the image iterations.
9517%
9518% The format of the MagickSetImageIterations method is:
9519%
9520% MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009521% const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +00009522%
9523% A description of each parameter follows:
9524%
9525% o wand: the magick wand.
9526%
9527% o delay: the image delay in 1/100th of a second.
9528%
9529*/
9530WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009531 const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +00009532{
9533 assert(wand != (MagickWand *) NULL);
9534 assert(wand->signature == WandSignature);
9535 if (wand->debug != MagickFalse)
9536 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9537 if (wand->images == (Image *) NULL)
9538 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9539 wand->images->iterations=iterations;
9540 return(MagickTrue);
9541}
9542
9543/*
9544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9545% %
9546% %
9547% %
9548% M a g i c k S e t I m a g e M a t t e %
9549% %
9550% %
9551% %
9552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9553%
9554% MagickSetImageMatte() sets the image matte channel.
9555%
9556% The format of the MagickSetImageMatteColor method is:
9557%
9558% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9559% const MagickBooleanType *matte)
9560%
9561% A description of each parameter follows:
9562%
9563% o wand: the magick wand.
9564%
9565% o matte: Set to MagickTrue to enable the image matte channel otherwise
9566% MagickFalse.
9567%
9568*/
9569WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9570 const MagickBooleanType matte)
9571{
9572 assert(wand != (MagickWand *) NULL);
9573 assert(wand->signature == WandSignature);
9574 if (wand->debug != MagickFalse)
9575 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9576 if (wand->images == (Image *) NULL)
9577 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9578 if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
cristyb6a294d2011-10-03 00:55:17 +00009579 (void) SetImageAlpha(wand->images,OpaqueAlpha);
cristy3ed852e2009-09-05 21:47:34 +00009580 wand->images->matte=matte;
9581 return(MagickTrue);
9582}
9583
9584/*
9585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9586% %
9587% %
9588% %
9589% M a g i c k S e t I m a g e M a t t e C o l o r %
9590% %
9591% %
9592% %
9593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9594%
9595% MagickSetImageMatteColor() sets the image matte color.
9596%
9597% The format of the MagickSetImageMatteColor method is:
9598%
9599% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9600% const PixelWand *matte)
9601%
9602% A description of each parameter follows:
9603%
9604% o wand: the magick wand.
9605%
9606% o matte: the matte pixel wand.
9607%
9608*/
9609WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9610 const PixelWand *matte)
9611{
9612 assert(wand != (MagickWand *) NULL);
9613 assert(wand->signature == WandSignature);
9614 if (wand->debug != MagickFalse)
9615 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9616 if (wand->images == (Image *) NULL)
9617 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009618 PixelGetQuantumPacket(matte,&wand->images->matte_color);
cristy3ed852e2009-09-05 21:47:34 +00009619 return(MagickTrue);
9620}
9621
9622/*
9623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9624% %
9625% %
9626% %
9627% M a g i c k S e t I m a g e O p a c i t y %
9628% %
9629% %
9630% %
9631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9632%
cristyb6a294d2011-10-03 00:55:17 +00009633% MagickSetImageAlpha() sets the image to the specified alpha level.
cristy3ed852e2009-09-05 21:47:34 +00009634%
cristyb6a294d2011-10-03 00:55:17 +00009635% The format of the MagickSetImageAlpha method is:
cristy3ed852e2009-09-05 21:47:34 +00009636%
cristyb6a294d2011-10-03 00:55:17 +00009637% MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00009638% const double alpha)
9639%
9640% A description of each parameter follows:
9641%
9642% o wand: the magick wand.
9643%
9644% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9645% transparent.
9646%
9647*/
cristyb6a294d2011-10-03 00:55:17 +00009648WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00009649 const double alpha)
9650{
9651 MagickBooleanType
9652 status;
9653
9654 assert(wand != (MagickWand *) NULL);
9655 assert(wand->signature == WandSignature);
9656 if (wand->debug != MagickFalse)
9657 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9658 if (wand->images == (Image *) NULL)
9659 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb6a294d2011-10-03 00:55:17 +00009660 status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha));
cristy3ed852e2009-09-05 21:47:34 +00009661 if (status == MagickFalse)
9662 InheritException(wand->exception,&wand->images->exception);
9663 return(status);
9664}
9665
9666/*
9667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9668% %
9669% %
9670% %
9671% 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 %
9672% %
9673% %
9674% %
9675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9676%
9677% MagickSetImageOrientation() sets the image orientation.
9678%
9679% The format of the MagickSetImageOrientation method is:
9680%
9681% MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9682% const OrientationType orientation)
9683%
9684% A description of each parameter follows:
9685%
9686% o wand: the magick wand.
9687%
9688% o orientation: the image orientation type.
9689%
9690*/
9691WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9692 const OrientationType orientation)
9693{
9694 assert(wand != (MagickWand *) NULL);
9695 assert(wand->signature == WandSignature);
9696 if (wand->debug != MagickFalse)
9697 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9698 if (wand->images == (Image *) NULL)
9699 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9700 wand->images->orientation=orientation;
9701 return(MagickTrue);
9702}
9703
9704/*
9705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9706% %
9707% %
9708% %
9709% M a g i c k S e t I m a g e P a g e %
9710% %
9711% %
9712% %
9713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9714%
9715% MagickSetImagePage() sets the page geometry of the image.
9716%
9717% The format of the MagickSetImagePage method is:
9718%
9719% MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009720% const size_t width,const size_t height,const ssize_t x,
9721% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00009722%
9723% A description of each parameter follows:
9724%
9725% o wand: the magick wand.
9726%
9727% o width: the page width.
9728%
9729% o height: the page height.
9730%
9731% o x: the page x-offset.
9732%
9733% o y: the page y-offset.
9734%
9735*/
9736WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009737 const size_t width,const size_t height,const ssize_t x,
9738 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00009739{
9740 assert(wand != (MagickWand *) NULL);
9741 assert(wand->signature == WandSignature);
9742 if (wand->debug != MagickFalse)
9743 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9744 if (wand->images == (Image *) NULL)
9745 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9746 wand->images->page.width=width;
9747 wand->images->page.height=height;
9748 wand->images->page.x=x;
9749 wand->images->page.y=y;
9750 return(MagickTrue);
9751}
9752
9753/*
9754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9755% %
9756% %
9757% %
9758% 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 %
9759% %
9760% %
9761% %
9762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9763%
9764% MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9765% specified method and returns the previous progress monitor if any. The
9766% progress monitor method looks like this:
9767%
9768% MagickBooleanType MagickProgressMonitor(const char *text,
9769% const MagickOffsetType offset,const MagickSizeType span,
9770% void *client_data)
9771%
9772% If the progress monitor returns MagickFalse, the current operation is
9773% interrupted.
9774%
9775% The format of the MagickSetImageProgressMonitor method is:
9776%
9777% MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9778% const MagickProgressMonitor progress_monitor,void *client_data)
9779%
9780% A description of each parameter follows:
9781%
9782% o wand: the magick wand.
9783%
9784% o progress_monitor: Specifies a pointer to a method to monitor progress
9785% of an image operation.
9786%
9787% o client_data: Specifies a pointer to any client data.
9788%
9789*/
9790WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9791 const MagickProgressMonitor progress_monitor,void *client_data)
9792{
9793 MagickProgressMonitor
9794 previous_monitor;
9795
9796 assert(wand != (MagickWand *) NULL);
9797 assert(wand->signature == WandSignature);
9798 if (wand->debug != MagickFalse)
9799 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9800 if (wand->images == (Image *) NULL)
9801 {
9802 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9803 "ContainsNoImages","`%s'",wand->name);
9804 return((MagickProgressMonitor) NULL);
9805 }
9806 previous_monitor=SetImageProgressMonitor(wand->images,
9807 progress_monitor,client_data);
9808 return(previous_monitor);
9809}
9810
9811/*
9812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9813% %
9814% %
9815% %
9816% M a g i c k S e t I m a g e R e d P r i m a r y %
9817% %
9818% %
9819% %
9820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9821%
9822% MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9823%
9824% The format of the MagickSetImageRedPrimary method is:
9825%
9826% MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9827% const double x,const double y)
9828%
9829% A description of each parameter follows:
9830%
9831% o wand: the magick wand.
9832%
9833% o x: the red primary x-point.
9834%
9835% o y: the red primary y-point.
9836%
9837*/
9838WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9839 const double x,const double y)
9840{
9841 assert(wand != (MagickWand *) NULL);
9842 assert(wand->signature == WandSignature);
9843 if (wand->debug != MagickFalse)
9844 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9845 if (wand->images == (Image *) NULL)
9846 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9847 wand->images->chromaticity.red_primary.x=x;
9848 wand->images->chromaticity.red_primary.y=y;
9849 return(MagickTrue);
9850}
9851
9852/*
9853%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9854% %
9855% %
9856% %
9857% 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 %
9858% %
9859% %
9860% %
9861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9862%
9863% MagickSetImageRenderingIntent() sets the image rendering intent.
9864%
9865% The format of the MagickSetImageRenderingIntent method is:
9866%
9867% MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9868% const RenderingIntent rendering_intent)
9869%
9870% A description of each parameter follows:
9871%
9872% o wand: the magick wand.
9873%
9874% o rendering_intent: the image rendering intent: UndefinedIntent,
9875% SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9876%
9877*/
9878WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9879 const RenderingIntent rendering_intent)
9880{
9881 assert(wand != (MagickWand *) NULL);
9882 assert(wand->signature == WandSignature);
9883 if (wand->debug != MagickFalse)
9884 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9885 if (wand->images == (Image *) NULL)
9886 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9887 wand->images->rendering_intent=rendering_intent;
9888 return(MagickTrue);
9889}
9890
9891/*
9892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9893% %
9894% %
9895% %
9896% M a g i c k S e t I m a g e R e s o l u t i o n %
9897% %
9898% %
9899% %
9900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9901%
9902% MagickSetImageResolution() sets the image resolution.
9903%
9904% The format of the MagickSetImageResolution method is:
9905%
9906% MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9907% const double x_resolution,const doubtl y_resolution)
9908%
9909% A description of each parameter follows:
9910%
9911% o wand: the magick wand.
9912%
9913% o x_resolution: the image x resolution.
9914%
9915% o y_resolution: the image y resolution.
9916%
9917*/
9918WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9919 const double x_resolution,const double y_resolution)
9920{
9921 assert(wand != (MagickWand *) NULL);
9922 assert(wand->signature == WandSignature);
9923 if (wand->debug != MagickFalse)
9924 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9925 if (wand->images == (Image *) NULL)
9926 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9927 wand->images->x_resolution=x_resolution;
9928 wand->images->y_resolution=y_resolution;
9929 return(MagickTrue);
9930}
9931
9932/*
9933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9934% %
9935% %
9936% %
9937% M a g i c k S e t I m a g e S c e n e %
9938% %
9939% %
9940% %
9941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9942%
9943% MagickSetImageScene() sets the image scene.
9944%
9945% The format of the MagickSetImageScene method is:
9946%
9947% MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009948% const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +00009949%
9950% A description of each parameter follows:
9951%
9952% o wand: the magick wand.
9953%
9954% o delay: the image scene number.
9955%
9956*/
9957WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009958 const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +00009959{
9960 assert(wand != (MagickWand *) NULL);
9961 assert(wand->signature == WandSignature);
9962 if (wand->debug != MagickFalse)
9963 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9964 if (wand->images == (Image *) NULL)
9965 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9966 wand->images->scene=scene;
9967 return(MagickTrue);
9968}
9969
9970/*
9971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9972% %
9973% %
9974% %
9975% 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 %
9976% %
9977% %
9978% %
9979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9980%
9981% MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9982%
9983% The format of the MagickSetImageTicksPerSecond method is:
9984%
9985% MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009986% const ssize_t ticks_per-second)
cristy3ed852e2009-09-05 21:47:34 +00009987%
9988% A description of each parameter follows:
9989%
9990% o wand: the magick wand.
9991%
9992% o ticks_per_second: the units to use for the image delay.
9993%
9994*/
9995WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009996 const ssize_t ticks_per_second)
cristy3ed852e2009-09-05 21:47:34 +00009997{
9998 assert(wand != (MagickWand *) NULL);
9999 assert(wand->signature == WandSignature);
10000 if (wand->debug != MagickFalse)
10001 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10002 if (wand->images == (Image *) NULL)
10003 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10004 wand->images->ticks_per_second=ticks_per_second;
10005 return(MagickTrue);
10006}
10007
10008/*
10009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10010% %
10011% %
10012% %
10013% M a g i c k S e t I m a g e T y p e %
10014% %
10015% %
10016% %
10017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10018%
10019% MagickSetImageType() sets the image type.
10020%
10021% The format of the MagickSetImageType method is:
10022%
10023% MagickBooleanType MagickSetImageType(MagickWand *wand,
10024% const ImageType image_type)
10025%
10026% A description of each parameter follows:
10027%
10028% o wand: the magick wand.
10029%
cristy5f1c1ff2010-12-23 21:38:06 +000010030% o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
cristy3ed852e2009-09-05 21:47:34 +000010031% GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10032% TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10033% or OptimizeType.
10034%
10035*/
10036WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10037 const ImageType image_type)
10038{
10039 assert(wand != (MagickWand *) NULL);
10040 assert(wand->signature == WandSignature);
10041 if (wand->debug != MagickFalse)
10042 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10043 if (wand->images == (Image *) NULL)
10044 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +000010045 return(SetImageType(wand->images,image_type,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000010046}
10047
10048/*
10049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10050% %
10051% %
10052% %
10053% M a g i c k S e t I m a g e U n i t s %
10054% %
10055% %
10056% %
10057%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10058%
10059% MagickSetImageUnits() sets the image units of resolution.
10060%
10061% The format of the MagickSetImageUnits method is:
10062%
10063% MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10064% const ResolutionType units)
10065%
10066% A description of each parameter follows:
10067%
10068% o wand: the magick wand.
10069%
10070% o units: the image units of resolution : UndefinedResolution,
10071% PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10072%
10073*/
10074WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10075 const ResolutionType units)
10076{
10077 assert(wand != (MagickWand *) NULL);
10078 assert(wand->signature == WandSignature);
10079 if (wand->debug != MagickFalse)
10080 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10081 if (wand->images == (Image *) NULL)
10082 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10083 wand->images->units=units;
10084 return(MagickTrue);
10085}
10086
10087/*
10088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10089% %
10090% %
10091% %
10092% 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 %
10093% %
10094% %
10095% %
10096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10097%
10098% MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10099%
10100% The format of the MagickSetImageVirtualPixelMethod method is:
10101%
10102% VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10103% const VirtualPixelMethod method)
10104%
10105% A description of each parameter follows:
10106%
10107% o wand: the magick wand.
10108%
10109% o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10110% ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
10111% MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10112%
10113*/
10114WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10115 const VirtualPixelMethod method)
10116{
10117 assert(wand != (MagickWand *) NULL);
10118 assert(wand->signature == WandSignature);
10119 if (wand->debug != MagickFalse)
10120 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10121 if (wand->images == (Image *) NULL)
10122 return(UndefinedVirtualPixelMethod);
10123 return(SetImageVirtualPixelMethod(wand->images,method));
10124}
10125
10126/*
10127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10128% %
10129% %
10130% %
10131% M a g i c k S e t I m a g e W h i t e P o i n t %
10132% %
10133% %
10134% %
10135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10136%
10137% MagickSetImageWhitePoint() sets the image chromaticity white point.
10138%
10139% The format of the MagickSetImageWhitePoint method is:
10140%
10141% MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10142% const double x,const double y)
10143%
10144% A description of each parameter follows:
10145%
10146% o wand: the magick wand.
10147%
10148% o x: the white x-point.
10149%
10150% o y: the white y-point.
10151%
10152*/
10153WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10154 const double x,const double y)
10155{
10156 assert(wand != (MagickWand *) NULL);
10157 assert(wand->signature == WandSignature);
10158 if (wand->debug != MagickFalse)
10159 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10160 if (wand->images == (Image *) NULL)
10161 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10162 wand->images->chromaticity.white_point.x=x;
10163 wand->images->chromaticity.white_point.y=y;
10164 return(MagickTrue);
10165}
10166
10167/*
10168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10169% %
10170% %
10171% %
10172% M a g i c k S h a d e I m a g e C h a n n e l %
10173% %
10174% %
10175% %
10176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10177%
10178% MagickShadeImage() shines a distant light on an image to create a
10179% three-dimensional effect. You control the positioning of the light with
10180% azimuth and elevation; azimuth is measured in degrees off the x axis
10181% and elevation is measured in pixels above the Z axis.
10182%
10183% The format of the MagickShadeImage method is:
10184%
10185% MagickBooleanType MagickShadeImage(MagickWand *wand,
10186% const MagickBooleanType gray,const double azimuth,
10187% const double elevation)
10188%
10189% A description of each parameter follows:
10190%
10191% o wand: the magick wand.
10192%
10193% o gray: A value other than zero shades the intensity of each pixel.
10194%
10195% o azimuth, elevation: Define the light source direction.
10196%
10197*/
10198WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10199 const MagickBooleanType gray,const double asimuth,const double elevation)
10200{
10201 Image
10202 *shade_image;
10203
10204 assert(wand != (MagickWand *) NULL);
10205 assert(wand->signature == WandSignature);
10206 if (wand->debug != MagickFalse)
10207 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10208 if (wand->images == (Image *) NULL)
10209 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10210 shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10211 if (shade_image == (Image *) NULL)
10212 return(MagickFalse);
10213 ReplaceImageInList(&wand->images,shade_image);
10214 return(MagickTrue);
10215}
10216
10217/*
10218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10219% %
10220% %
10221% %
10222% M a g i c k S h a d o w I m a g e %
10223% %
10224% %
10225% %
10226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10227%
10228% MagickShadowImage() simulates an image shadow.
10229%
10230% The format of the MagickShadowImage method is:
10231%
10232% MagickBooleanType MagickShadowImage(MagickWand *wand,
cristyb6a294d2011-10-03 00:55:17 +000010233% const double alpha,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010234%
10235% A description of each parameter follows:
10236%
10237% o wand: the magick wand.
10238%
cristyb6a294d2011-10-03 00:55:17 +000010239% o alpha: percentage transparency.
cristy3ed852e2009-09-05 21:47:34 +000010240%
10241% o sigma: the standard deviation of the Gaussian, in pixels.
10242%
10243% o x: the shadow x-offset.
10244%
10245% o y: the shadow y-offset.
10246%
10247*/
10248WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
cristyb6a294d2011-10-03 00:55:17 +000010249 const double alpha,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010250{
10251 Image
10252 *shadow_image;
10253
10254 assert(wand != (MagickWand *) NULL);
10255 assert(wand->signature == WandSignature);
10256 if (wand->debug != MagickFalse)
10257 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10258 if (wand->images == (Image *) NULL)
10259 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb6a294d2011-10-03 00:55:17 +000010260 shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010261 if (shadow_image == (Image *) NULL)
10262 return(MagickFalse);
10263 ReplaceImageInList(&wand->images,shadow_image);
10264 return(MagickTrue);
10265}
10266
10267/*
10268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10269% %
10270% %
10271% %
10272% M a g i c k S h a r p e n I m a g e %
10273% %
10274% %
10275% %
10276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10277%
10278% MagickSharpenImage() sharpens an image. We convolve the image with a
10279% Gaussian operator of the given radius and standard deviation (sigma).
10280% For reasonable results, the radius should be larger than sigma. Use a
10281% radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10282%
10283% The format of the MagickSharpenImage method is:
10284%
10285% MagickBooleanType MagickSharpenImage(MagickWand *wand,
cristy05c0c9a2011-09-05 23:16:13 +000010286% const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +000010287%
10288% A description of each parameter follows:
10289%
10290% o wand: the magick wand.
10291%
cristy3ed852e2009-09-05 21:47:34 +000010292% o radius: the radius of the Gaussian, in pixels, not counting the center
10293% pixel.
10294%
10295% o sigma: the standard deviation of the Gaussian, in pixels.
10296%
cristy05c0c9a2011-09-05 23:16:13 +000010297% o bias: the bias.
10298%
cristy3ed852e2009-09-05 21:47:34 +000010299*/
cristy3ed852e2009-09-05 21:47:34 +000010300WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
cristy05c0c9a2011-09-05 23:16:13 +000010301 const double radius,const double sigma,const double bias)
cristy3ed852e2009-09-05 21:47:34 +000010302{
cristy3ed852e2009-09-05 21:47:34 +000010303 Image
10304 *sharp_image;
10305
10306 assert(wand != (MagickWand *) NULL);
10307 assert(wand->signature == WandSignature);
10308 if (wand->debug != MagickFalse)
10309 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10310 if (wand->images == (Image *) NULL)
10311 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy05c0c9a2011-09-05 23:16:13 +000010312 sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010313 if (sharp_image == (Image *) NULL)
10314 return(MagickFalse);
10315 ReplaceImageInList(&wand->images,sharp_image);
10316 return(MagickTrue);
10317}
10318
10319/*
10320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10321% %
10322% %
10323% %
10324% M a g i c k S h a v e I m a g e %
10325% %
10326% %
10327% %
10328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10329%
10330% MagickShaveImage() shaves pixels from the image edges. It allocates the
10331% memory necessary for the new Image structure and returns a pointer to the
10332% new image.
10333%
10334% The format of the MagickShaveImage method is:
10335%
10336% MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010337% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010338%
10339% A description of each parameter follows:
10340%
10341% o wand: the magick wand.
10342%
10343% o columns: the number of columns in the scaled image.
10344%
10345% o rows: the number of rows in the scaled image.
10346%
10347%
10348*/
10349WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010350 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010351{
10352 Image
10353 *shave_image;
10354
10355 RectangleInfo
10356 shave_info;
10357
10358 assert(wand != (MagickWand *) NULL);
10359 assert(wand->signature == WandSignature);
10360 if (wand->debug != MagickFalse)
10361 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10362 if (wand->images == (Image *) NULL)
10363 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10364 shave_info.width=columns;
10365 shave_info.height=rows;
10366 shave_info.x=0;
10367 shave_info.y=0;
10368 shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10369 if (shave_image == (Image *) NULL)
10370 return(MagickFalse);
10371 ReplaceImageInList(&wand->images,shave_image);
10372 return(MagickTrue);
10373}
10374
10375/*
10376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10377% %
10378% %
10379% %
10380% M a g i c k S h e a r I m a g e %
10381% %
10382% %
10383% %
10384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10385%
cristycee97112010-05-28 00:44:52 +000010386% MagickShearImage() slides one edge of an image along the X or Y axis,
10387% creating a parallelogram. An X direction shear slides an edge along the X
10388% axis, while a Y direction shear slides an edge along the Y axis. The amount
cristy3ed852e2009-09-05 21:47:34 +000010389% of the shear is controlled by a shear angle. For X direction shears, x_shear
10390% is measured relative to the Y axis, and similarly, for Y direction shears
10391% y_shear is measured relative to the X axis. Empty triangles left over from
10392% shearing the image are filled with the background color.
10393%
10394% The format of the MagickShearImage method is:
10395%
10396% MagickBooleanType MagickShearImage(MagickWand *wand,
10397% const PixelWand *background,const double x_shear,onst double y_shear)
10398%
10399% A description of each parameter follows:
10400%
10401% o wand: the magick wand.
10402%
10403% o background: the background pixel wand.
10404%
10405% o x_shear: the number of degrees to shear the image.
10406%
10407% o y_shear: the number of degrees to shear the image.
10408%
10409*/
10410WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10411 const PixelWand *background,const double x_shear,const double y_shear)
10412{
10413 Image
10414 *shear_image;
10415
10416 assert(wand != (MagickWand *) NULL);
10417 assert(wand->signature == WandSignature);
10418 if (wand->debug != MagickFalse)
10419 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10420 if (wand->images == (Image *) NULL)
10421 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +000010422 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +000010423 shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10424 if (shear_image == (Image *) NULL)
10425 return(MagickFalse);
10426 ReplaceImageInList(&wand->images,shear_image);
10427 return(MagickTrue);
10428}
10429
10430/*
10431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10432% %
10433% %
10434% %
10435% 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 %
10436% %
10437% %
10438% %
10439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10440%
10441% MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10442% non-linear sigmoidal contrast algorithm. Increase the contrast of the
10443% image using a sigmoidal transfer function without saturating highlights or
10444% shadows. Contrast indicates how much to increase the contrast (0 is none;
10445% 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10446% the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
10447% sharpen to MagickTrue to increase the image contrast otherwise the contrast
10448% is reduced.
10449%
10450% The format of the MagickSigmoidalContrastImage method is:
10451%
10452% MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10453% const MagickBooleanType sharpen,const double alpha,const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010454%
10455% A description of each parameter follows:
10456%
10457% o wand: the magick wand.
10458%
cristy3ed852e2009-09-05 21:47:34 +000010459% o sharpen: Increase or decrease image contrast.
10460%
cristyfa769582010-09-30 23:30:03 +000010461% o alpha: strength of the contrast, the larger the number the more
10462% 'threshold-like' it becomes.
cristy3ed852e2009-09-05 21:47:34 +000010463%
cristyfa769582010-09-30 23:30:03 +000010464% o beta: midpoint of the function as a color value 0 to QuantumRange.
cristy3ed852e2009-09-05 21:47:34 +000010465%
10466*/
cristy9ee60942011-07-06 14:54:38 +000010467WandExport MagickBooleanType MagickSigmoidalContrastImage(
10468 MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10469 const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010470{
10471 MagickBooleanType
10472 status;
10473
10474 assert(wand != (MagickWand *) NULL);
10475 assert(wand->signature == WandSignature);
10476 if (wand->debug != MagickFalse)
10477 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10478 if (wand->images == (Image *) NULL)
10479 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy33bd5152011-08-24 01:42:24 +000010480 status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10481 &wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +000010482 return(status);
10483}
10484
10485/*
10486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10487% %
10488% %
10489% %
10490% M a g i c k S i m i l a r i t y I m a g e %
10491% %
10492% %
10493% %
10494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10495%
10496% MagickSimilarityImage() compares the reference image of the image and
10497% returns the best match offset. In addition, it returns a similarity image
10498% such that an exact match location is completely white and if none of the
10499% pixels match, black, otherwise some gray level in-between.
10500%
10501% The format of the MagickSimilarityImage method is:
10502%
10503% MagickWand *MagickSimilarityImage(MagickWand *wand,
10504% const MagickWand *reference,RectangeInfo *offset,double *similarity)
10505%
10506% A description of each parameter follows:
10507%
10508% o wand: the magick wand.
10509%
10510% o reference: the reference wand.
10511%
10512% o offset: the best match offset of the reference image within the image.
10513%
10514% o similarity: the computed similarity between the images.
10515%
10516*/
10517WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10518 const MagickWand *reference,RectangleInfo *offset,double *similarity)
10519{
10520 Image
10521 *similarity_image;
10522
10523 assert(wand != (MagickWand *) NULL);
10524 assert(wand->signature == WandSignature);
10525 if (wand->debug != MagickFalse)
10526 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10527 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10528 {
10529 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10530 "ContainsNoImages","`%s'",wand->name);
10531 return((MagickWand *) NULL);
10532 }
10533 similarity_image=SimilarityImage(wand->images,reference->images,offset,
10534 similarity,&wand->images->exception);
10535 if (similarity_image == (Image *) NULL)
10536 return((MagickWand *) NULL);
10537 return(CloneMagickWandFromImages(wand,similarity_image));
10538}
10539
10540/*
10541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10542% %
10543% %
10544% %
10545% M a g i c k S k e t c h I m a g e %
10546% %
10547% %
10548% %
10549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10550%
10551% MagickSketchImage() simulates a pencil sketch. We convolve the image with
10552% a Gaussian operator of the given radius and standard deviation (sigma).
10553% For reasonable results, radius should be larger than sigma. Use a
10554% radius of 0 and SketchImage() selects a suitable radius for you.
10555% Angle gives the angle of the blurring motion.
10556%
10557% The format of the MagickSketchImage method is:
10558%
10559% MagickBooleanType MagickSketchImage(MagickWand *wand,
cristyf7ef0252011-09-09 14:50:06 +000010560% const double radius,const double sigma,const double angle,
10561% const double bias)
cristy3ed852e2009-09-05 21:47:34 +000010562%
10563% A description of each parameter follows:
10564%
10565% o wand: the magick wand.
10566%
10567% o radius: the radius of the Gaussian, in pixels, not counting
10568% the center pixel.
10569%
10570% o sigma: the standard deviation of the Gaussian, in pixels.
10571%
cristyf7ef0252011-09-09 14:50:06 +000010572% o angle: apply the effect along this angle.
10573%
10574% o bias: the bias.
cristy3ed852e2009-09-05 21:47:34 +000010575%
10576*/
10577WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
cristyf7ef0252011-09-09 14:50:06 +000010578 const double radius,const double sigma,const double angle,const double bias)
cristy3ed852e2009-09-05 21:47:34 +000010579{
10580 Image
10581 *sketch_image;
10582
10583 assert(wand != (MagickWand *) NULL);
10584 assert(wand->signature == WandSignature);
10585 if (wand->debug != MagickFalse)
10586 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10587 if (wand->images == (Image *) NULL)
10588 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf7ef0252011-09-09 14:50:06 +000010589 sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10590 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010591 if (sketch_image == (Image *) NULL)
10592 return(MagickFalse);
10593 ReplaceImageInList(&wand->images,sketch_image);
10594 return(MagickTrue);
10595}
10596
10597/*
10598%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10599% %
10600% %
10601% %
cristy4285d782011-02-09 20:12:28 +000010602% M a g i c k S m u s h I m a g e s %
10603% %
10604% %
10605% %
10606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10607%
10608% MagickSmushImages() takes all images from the current image pointer to the
10609% end of the image list and smushs them to each other top-to-bottom if the
10610% stack parameter is true, otherwise left-to-right.
10611%
10612% The format of the MagickSmushImages method is:
10613%
10614% MagickWand *MagickSmushImages(MagickWand *wand,
10615% const MagickBooleanType stack,const ssize_t offset)
10616%
10617% A description of each parameter follows:
10618%
10619% o wand: the magick wand.
10620%
10621% o stack: By default, images are stacked left-to-right. Set stack to
10622% MagickTrue to stack them top-to-bottom.
10623%
10624% o offset: minimum distance in pixels between images.
10625%
10626*/
10627WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10628 const MagickBooleanType stack,const ssize_t offset)
10629{
10630 Image
10631 *smush_image;
10632
10633 assert(wand != (MagickWand *) NULL);
10634 assert(wand->signature == WandSignature);
10635 if (wand->debug != MagickFalse)
10636 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10637 if (wand->images == (Image *) NULL)
10638 return((MagickWand *) NULL);
10639 smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10640 if (smush_image == (Image *) NULL)
10641 return((MagickWand *) NULL);
10642 return(CloneMagickWandFromImages(wand,smush_image));
10643}
10644
10645/*
10646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10647% %
10648% %
10649% %
cristy3ed852e2009-09-05 21:47:34 +000010650% M a g i c k S o l a r i z e I m a g e %
10651% %
10652% %
10653% %
10654%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10655%
10656% MagickSolarizeImage() applies a special effect to the image, similar to the
10657% effect achieved in a photo darkroom by selectively exposing areas of photo
10658% sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
10659% measure of the extent of the solarization.
10660%
10661% The format of the MagickSolarizeImage method is:
10662%
10663% MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10664% const double threshold)
10665%
10666% A description of each parameter follows:
10667%
10668% o wand: the magick wand.
10669%
10670% o threshold: Define the extent of the solarization.
10671%
10672*/
10673WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10674 const double threshold)
10675{
10676 MagickBooleanType
10677 status;
10678
10679 assert(wand != (MagickWand *) NULL);
10680 assert(wand->signature == WandSignature);
10681 if (wand->debug != MagickFalse)
10682 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10683 if (wand->images == (Image *) NULL)
10684 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5cbc0162011-08-29 00:36:28 +000010685 status=SolarizeImage(wand->images,threshold,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +000010686 return(status);
10687}
10688
10689/*
10690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10691% %
10692% %
10693% %
10694% M a g i c k S p a r s e C o l o r I m a g e %
10695% %
10696% %
10697% %
10698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10699%
10700% MagickSparseColorImage(), given a set of coordinates, interpolates the
10701% colors found at those coordinates, across the whole image, using various
10702% methods.
10703%
10704% The format of the MagickSparseColorImage method is:
10705%
10706% 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% A description of each parameter follows:
10711%
10712% o image: the image to be sparseed.
10713%
10714% o method: the method of image sparseion.
10715%
10716% ArcSparseColorion will always ignore source image offset, and always
10717% 'bestfit' the destination image with the top left corner offset
10718% relative to the polar mapping center.
10719%
10720% Bilinear has no simple inverse mapping so will not allow 'bestfit'
10721% style of image sparseion.
10722%
10723% Affine, Perspective, and Bilinear, will do least squares fitting of
10724% the distrotion when more than the minimum number of control point
10725% pairs are provided.
10726%
10727% Perspective, and Bilinear, will fall back to a Affine sparseion when
10728% less than 4 control point pairs are provided. While Affine sparseions
10729% will let you use any number of control point pairs, that is Zero pairs
10730% is a No-Op (viewport only) distrotion, one pair is a translation and
10731% two pairs of control points will do a scale-rotate-translate, without
10732% any shearing.
10733%
10734% o number_arguments: the number of arguments given for this sparseion
10735% method.
10736%
10737% o arguments: the arguments for this sparseion method.
10738%
10739*/
10740WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
cristy3884f692011-07-08 18:00:18 +000010741 const SparseColorMethod method,const size_t number_arguments,
10742 const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000010743{
10744 Image
10745 *sparse_image;
10746
10747 assert(wand != (MagickWand *) NULL);
10748 assert(wand->signature == WandSignature);
10749 if (wand->debug != MagickFalse)
10750 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10751 if (wand->images == (Image *) NULL)
10752 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3884f692011-07-08 18:00:18 +000010753 sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10754 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010755 if (sparse_image == (Image *) NULL)
10756 return(MagickFalse);
10757 ReplaceImageInList(&wand->images,sparse_image);
10758 return(MagickTrue);
10759}
10760
10761/*
10762%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10763% %
10764% %
10765% %
10766% M a g i c k S p l i c e I m a g e %
10767% %
10768% %
10769% %
10770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10771%
10772% MagickSpliceImage() splices a solid color into the image.
10773%
10774% The format of the MagickSpliceImage method is:
10775%
10776% MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010777% const size_t width,const size_t height,const ssize_t x,
10778% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010779%
10780% A description of each parameter follows:
10781%
10782% o wand: the magick wand.
10783%
10784% o width: the region width.
10785%
10786% o height: the region height.
10787%
10788% o x: the region x offset.
10789%
10790% o y: the region y offset.
10791%
10792*/
10793WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010794 const size_t width,const size_t height,const ssize_t x,
10795 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010796{
10797 Image
10798 *splice_image;
10799
10800 RectangleInfo
10801 splice;
10802
10803 assert(wand != (MagickWand *) NULL);
10804 assert(wand->signature == WandSignature);
10805 if (wand->debug != MagickFalse)
10806 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10807 if (wand->images == (Image *) NULL)
10808 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10809 splice.width=width;
10810 splice.height=height;
10811 splice.x=x;
10812 splice.y=y;
10813 splice_image=SpliceImage(wand->images,&splice,wand->exception);
10814 if (splice_image == (Image *) NULL)
10815 return(MagickFalse);
10816 ReplaceImageInList(&wand->images,splice_image);
10817 return(MagickTrue);
10818}
10819
10820/*
10821%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10822% %
10823% %
10824% %
10825% M a g i c k S p r e a d I m a g e %
10826% %
10827% %
10828% %
10829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10830%
10831% MagickSpreadImage() is a special effects method that randomly displaces each
10832% pixel in a block defined by the radius parameter.
10833%
10834% The format of the MagickSpreadImage method is:
10835%
cristy5c4e2582011-09-11 19:21:03 +000010836% MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10837% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000010838%
10839% A description of each parameter follows:
10840%
10841% o wand: the magick wand.
10842%
10843% o radius: Choose a random pixel in a neighborhood of this extent.
10844%
cristy5c4e2582011-09-11 19:21:03 +000010845% o method: the pixel interpolation method.
10846%
cristy3ed852e2009-09-05 21:47:34 +000010847*/
10848WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +000010849 const double radius,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000010850{
10851 Image
10852 *spread_image;
10853
10854 assert(wand != (MagickWand *) NULL);
10855 assert(wand->signature == WandSignature);
10856 if (wand->debug != MagickFalse)
10857 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10858 if (wand->images == (Image *) NULL)
10859 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +000010860 spread_image=SpreadImage(wand->images,radius,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010861 if (spread_image == (Image *) NULL)
10862 return(MagickFalse);
10863 ReplaceImageInList(&wand->images,spread_image);
10864 return(MagickTrue);
10865}
10866
10867/*
10868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10869% %
10870% %
10871% %
cristy12453682011-03-18 18:45:04 +000010872% M a g i c k S t a t i s t i c I m a g e %
10873% %
10874% %
10875% %
10876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10877%
10878% MagickStatisticImage() replace each pixel with corresponding statistic from
cristy8d752042011-03-19 01:00:36 +000010879% the neighborhood of the specified width and height.
cristy12453682011-03-18 18:45:04 +000010880%
10881% The format of the MagickStatisticImage method is:
10882%
10883% MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristy95c38342011-03-18 22:39:51 +000010884% const StatisticType type,const double width,const size_t height)
cristy12453682011-03-18 18:45:04 +000010885%
10886% A description of each parameter follows:
10887%
10888% o wand: the magick wand.
10889%
cristy12453682011-03-18 18:45:04 +000010890% o type: the statistic type (e.g. median, mode, etc.).
10891%
cristy8d752042011-03-19 01:00:36 +000010892% o width: the width of the pixel neighborhood.
10893%
10894% o height: the height of the pixel neighborhood.
cristy12453682011-03-18 18:45:04 +000010895%
10896*/
10897WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristyf4ad9df2011-07-08 16:49:03 +000010898 const StatisticType type,const size_t width,const size_t height)
cristy12453682011-03-18 18:45:04 +000010899{
10900 Image
10901 *statistic_image;
10902
10903 assert(wand != (MagickWand *) NULL);
10904 assert(wand->signature == WandSignature);
10905 if (wand->debug != MagickFalse)
10906 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10907 if (wand->images == (Image *) NULL)
10908 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000010909 statistic_image=StatisticImage(wand->images,type,width,height,
cristy12453682011-03-18 18:45:04 +000010910 wand->exception);
10911 if (statistic_image == (Image *) NULL)
10912 return(MagickFalse);
10913 ReplaceImageInList(&wand->images,statistic_image);
10914 return(MagickTrue);
10915}
10916
10917/*
10918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10919% %
10920% %
10921% %
cristy3ed852e2009-09-05 21:47:34 +000010922% M a g i c k S t e g a n o I m a g e %
10923% %
10924% %
10925% %
10926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10927%
10928% MagickSteganoImage() hides a digital watermark within the image.
10929% Recover the hidden watermark later to prove that the authenticity of
10930% an image. Offset defines the start position within the image to hide
10931% the watermark.
10932%
10933% The format of the MagickSteganoImage method is:
10934%
10935% MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010936% const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000010937%
10938% A description of each parameter follows:
10939%
10940% o wand: the magick wand.
10941%
10942% o watermark_wand: the watermark wand.
10943%
10944% o offset: Start hiding at this offset into the image.
10945%
10946*/
10947WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010948 const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000010949{
10950 Image
10951 *stegano_image;
10952
10953 assert(wand != (MagickWand *) NULL);
10954 assert(wand->signature == WandSignature);
10955 if (wand->debug != MagickFalse)
10956 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10957 if ((wand->images == (Image *) NULL) ||
10958 (watermark_wand->images == (Image *) NULL))
10959 {
10960 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10961 "ContainsNoImages","`%s'",wand->name);
10962 return((MagickWand *) NULL);
10963 }
10964 wand->images->offset=offset;
10965 stegano_image=SteganoImage(wand->images,watermark_wand->images,
10966 wand->exception);
10967 if (stegano_image == (Image *) NULL)
10968 return((MagickWand *) NULL);
10969 return(CloneMagickWandFromImages(wand,stegano_image));
10970}
10971
10972/*
10973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10974% %
10975% %
10976% %
10977% M a g i c k S t e r e o I m a g e %
10978% %
10979% %
10980% %
10981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10982%
10983% MagickStereoImage() composites two images and produces a single image that
10984% is the composite of a left and right image of a stereo pair
10985%
10986% The format of the MagickStereoImage method is:
10987%
10988% MagickWand *MagickStereoImage(MagickWand *wand,
10989% const MagickWand *offset_wand)
10990%
10991% A description of each parameter follows:
10992%
10993% o wand: the magick wand.
10994%
10995% o offset_wand: Another image wand.
10996%
10997*/
10998WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10999 const MagickWand *offset_wand)
11000{
11001 Image
11002 *stereo_image;
11003
11004 assert(wand != (MagickWand *) NULL);
11005 assert(wand->signature == WandSignature);
11006 if (wand->debug != MagickFalse)
11007 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11008 if ((wand->images == (Image *) NULL) ||
11009 (offset_wand->images == (Image *) NULL))
11010 {
11011 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11012 "ContainsNoImages","`%s'",wand->name);
11013 return((MagickWand *) NULL);
11014 }
11015 stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11016 if (stereo_image == (Image *) NULL)
11017 return((MagickWand *) NULL);
11018 return(CloneMagickWandFromImages(wand,stereo_image));
11019}
11020
11021/*
11022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11023% %
11024% %
11025% %
11026% M a g i c k S t r i p I m a g e %
11027% %
11028% %
11029% %
11030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11031%
11032% MagickStripImage() strips an image of all profiles and comments.
11033%
11034% The format of the MagickStripImage method is:
11035%
11036% MagickBooleanType MagickStripImage(MagickWand *wand)
11037%
11038% A description of each parameter follows:
11039%
11040% o wand: the magick wand.
11041%
11042*/
11043WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11044{
11045 MagickBooleanType
11046 status;
11047
11048 assert(wand != (MagickWand *) NULL);
11049 assert(wand->signature == WandSignature);
11050 if (wand->debug != MagickFalse)
11051 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11052 if (wand->images == (Image *) NULL)
11053 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11054 status=StripImage(wand->images);
11055 if (status == MagickFalse)
11056 InheritException(wand->exception,&wand->images->exception);
11057 return(status);
11058}
11059
11060/*
11061%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11062% %
11063% %
11064% %
11065% M a g i c k S w i r l I m a g e %
11066% %
11067% %
11068% %
11069%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11070%
11071% MagickSwirlImage() swirls the pixels about the center of the image, where
11072% degrees indicates the sweep of the arc through which each pixel is moved.
11073% You get a more dramatic effect as the degrees move from 1 to 360.
11074%
11075% The format of the MagickSwirlImage method is:
11076%
cristy76f512e2011-09-12 01:26:56 +000011077% MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11078% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011079%
11080% A description of each parameter follows:
11081%
11082% o wand: the magick wand.
11083%
11084% o degrees: Define the tightness of the swirling effect.
11085%
cristy76f512e2011-09-12 01:26:56 +000011086% o method: the pixel interpolation method.
11087%
cristy3ed852e2009-09-05 21:47:34 +000011088*/
11089WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +000011090 const double degrees,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011091{
11092 Image
11093 *swirl_image;
11094
11095 assert(wand != (MagickWand *) NULL);
11096 assert(wand->signature == WandSignature);
11097 if (wand->debug != MagickFalse)
11098 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11099 if (wand->images == (Image *) NULL)
11100 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +000011101 swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011102 if (swirl_image == (Image *) NULL)
11103 return(MagickFalse);
11104 ReplaceImageInList(&wand->images,swirl_image);
11105 return(MagickTrue);
11106}
11107
11108/*
11109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11110% %
11111% %
11112% %
11113% M a g i c k T e x t u r e I m a g e %
11114% %
11115% %
11116% %
11117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11118%
11119% MagickTextureImage() repeatedly tiles the texture image across and down the
11120% image canvas.
11121%
11122% The format of the MagickTextureImage method is:
11123%
11124% MagickWand *MagickTextureImage(MagickWand *wand,
11125% const MagickWand *texture_wand)
11126%
11127% A description of each parameter follows:
11128%
11129% o wand: the magick wand.
11130%
11131% o texture_wand: the texture wand
11132%
11133*/
11134WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11135 const MagickWand *texture_wand)
11136{
11137 Image
11138 *texture_image;
11139
11140 MagickBooleanType
11141 status;
11142
11143 assert(wand != (MagickWand *) NULL);
11144 assert(wand->signature == WandSignature);
11145 if (wand->debug != MagickFalse)
11146 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11147 if ((wand->images == (Image *) NULL) ||
11148 (texture_wand->images == (Image *) NULL))
11149 {
11150 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11151 "ContainsNoImages","`%s'",wand->name);
11152 return((MagickWand *) NULL);
11153 }
11154 texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11155 if (texture_image == (Image *) NULL)
11156 return((MagickWand *) NULL);
11157 status=TextureImage(texture_image,texture_wand->images);
11158 if (status == MagickFalse)
11159 {
11160 InheritException(wand->exception,&texture_image->exception);
11161 texture_image=DestroyImage(texture_image);
11162 return((MagickWand *) NULL);
11163 }
11164 return(CloneMagickWandFromImages(wand,texture_image));
11165}
11166
11167/*
11168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11169% %
11170% %
11171% %
11172% M a g i c k T h r e s h o l d I m a g e %
11173% %
11174% %
11175% %
11176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11177%
11178% MagickThresholdImage() changes the value of individual pixels based on
11179% the intensity of each pixel compared to threshold. The result is a
11180% high-contrast, two color image.
11181%
11182% The format of the MagickThresholdImage method is:
11183%
11184% MagickBooleanType MagickThresholdImage(MagickWand *wand,
11185% const double threshold)
11186% MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11187% const ChannelType channel,const double threshold)
11188%
11189% A description of each parameter follows:
11190%
11191% o wand: the magick wand.
11192%
11193% o channel: the image channel(s).
11194%
11195% o threshold: Define the threshold value.
11196%
11197*/
11198WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11199 const double threshold)
11200{
11201 MagickBooleanType
11202 status;
11203
11204 status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11205 return(status);
11206}
11207
11208WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11209 const ChannelType channel,const double threshold)
11210{
11211 MagickBooleanType
11212 status;
11213
11214 assert(wand != (MagickWand *) NULL);
11215 assert(wand->signature == WandSignature);
11216 if (wand->debug != MagickFalse)
11217 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11218 if (wand->images == (Image *) NULL)
11219 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000011220 status=BilevelImage(wand->images,threshold);
cristy3ed852e2009-09-05 21:47:34 +000011221 if (status == MagickFalse)
11222 InheritException(wand->exception,&wand->images->exception);
11223 return(status);
11224}
11225
11226/*
11227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11228% %
11229% %
11230% %
11231% M a g i c k T h u m b n a i l I m a g e %
11232% %
11233% %
11234% %
11235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11236%
11237% MagickThumbnailImage() changes the size of an image to the given dimensions
11238% and removes any associated profiles. The goal is to produce small low cost
11239% thumbnail images suited for display on the Web.
11240%
11241% The format of the MagickThumbnailImage method is:
11242%
11243% MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011244% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011245%
11246% A description of each parameter follows:
11247%
11248% o wand: the magick wand.
11249%
11250% o columns: the number of columns in the scaled image.
11251%
11252% o rows: the number of rows in the scaled image.
11253%
11254*/
11255WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011256 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011257{
11258 Image
11259 *thumbnail_image;
11260
11261 assert(wand != (MagickWand *) NULL);
11262 assert(wand->signature == WandSignature);
11263 if (wand->debug != MagickFalse)
11264 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11265 if (wand->images == (Image *) NULL)
11266 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11267 thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11268 if (thumbnail_image == (Image *) NULL)
11269 return(MagickFalse);
11270 ReplaceImageInList(&wand->images,thumbnail_image);
11271 return(MagickTrue);
11272}
11273
11274/*
11275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11276% %
11277% %
11278% %
11279% M a g i c k T i n t I m a g e %
11280% %
11281% %
11282% %
11283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11284%
11285% MagickTintImage() applies a color vector to each pixel in the image. The
11286% length of the vector is 0 for black and white and at its maximum for the
11287% midtones. The vector weighting function is
11288% f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11289%
11290% The format of the MagickTintImage method is:
11291%
11292% MagickBooleanType MagickTintImage(MagickWand *wand,
cristyb817c3f2011-10-03 14:00:35 +000011293% const PixelWand *tint,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +000011294%
11295% A description of each parameter follows:
11296%
11297% o wand: the magick wand.
11298%
11299% o tint: the tint pixel wand.
11300%
cristyb6a294d2011-10-03 00:55:17 +000011301% o alpha: the alpha pixel wand.
cristy3ed852e2009-09-05 21:47:34 +000011302%
11303*/
11304WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
cristyb817c3f2011-10-03 14:00:35 +000011305 const PixelWand *tint,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +000011306{
11307 char
cristyb817c3f2011-10-03 14:00:35 +000011308 percent_blend[MaxTextExtent];
cristy3ed852e2009-09-05 21:47:34 +000011309
11310 Image
11311 *tint_image;
11312
cristy28474bf2011-09-11 23:32:52 +000011313 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000011314 target;
11315
11316 assert(wand != (MagickWand *) NULL);
11317 assert(wand->signature == WandSignature);
11318 if (wand->debug != MagickFalse)
11319 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11320 if (wand->images == (Image *) NULL)
11321 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +000011322 if (wand->images->colorspace != CMYKColorspace)
cristyb817c3f2011-10-03 14:00:35 +000011323 (void) FormatLocaleString(percent_blend,MaxTextExtent,
cristy76f512e2011-09-12 01:26:56 +000011324 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristyb817c3f2011-10-03 14:00:35 +000011325 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11326 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11327 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11328 PixelGetAlphaQuantum(blend)));
cristy76f512e2011-09-12 01:26:56 +000011329 else
cristyb817c3f2011-10-03 14:00:35 +000011330 (void) FormatLocaleString(percent_blend,MaxTextExtent,
cristy76f512e2011-09-12 01:26:56 +000011331 "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristyb817c3f2011-10-03 14:00:35 +000011332 PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11333 PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11334 PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11335 PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11336 PixelGetAlphaQuantum(blend)));
cristy28474bf2011-09-11 23:32:52 +000011337 target=PixelGetPixel(tint);
cristyb817c3f2011-10-03 14:00:35 +000011338 tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011339 if (tint_image == (Image *) NULL)
11340 return(MagickFalse);
11341 ReplaceImageInList(&wand->images,tint_image);
11342 return(MagickTrue);
11343}
11344
11345/*
11346%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11347% %
11348% %
11349% %
11350% M a g i c k T r a n s f o r m I m a g e %
11351% %
11352% %
11353% %
11354%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11355%
11356% MagickTransformImage() is a convenience method that behaves like
11357% MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11358% information as a region geometry specification. If the operation fails,
11359% a NULL image handle is returned.
11360%
11361% The format of the MagickTransformImage method is:
11362%
11363% MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11364% const char *geometry)
11365%
11366% A description of each parameter follows:
11367%
11368% o wand: the magick wand.
11369%
11370% o crop: A crop geometry string. This geometry defines a subregion of the
11371% image to crop.
11372%
11373% o geometry: An image geometry string. This geometry defines the final
11374% size of the image.
11375%
11376*/
11377WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11378 const char *crop,const char *geometry)
11379{
11380 Image
11381 *transform_image;
11382
11383 MagickBooleanType
11384 status;
11385
11386 assert(wand != (MagickWand *) NULL);
11387 assert(wand->signature == WandSignature);
11388 if (wand->debug != MagickFalse)
11389 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11390 if (wand->images == (Image *) NULL)
11391 return((MagickWand *) NULL);
11392 transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11393 if (transform_image == (Image *) NULL)
11394 return((MagickWand *) NULL);
11395 status=TransformImage(&transform_image,crop,geometry);
11396 if (status == MagickFalse)
11397 {
11398 InheritException(wand->exception,&transform_image->exception);
11399 transform_image=DestroyImage(transform_image);
11400 return((MagickWand *) NULL);
11401 }
11402 return(CloneMagickWandFromImages(wand,transform_image));
11403}
11404
11405/*
11406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11407% %
11408% %
11409% %
11410% 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 %
11411% %
11412% %
11413% %
11414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11415%
11416% MagickTransformImageColorspace() transform the image colorspace.
11417%
11418% The format of the MagickTransformImageColorspace method is:
11419%
11420% MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11421% const ColorspaceType colorspace)
11422%
11423% A description of each parameter follows:
11424%
11425% o wand: the magick wand.
11426%
11427% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
11428% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11429% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11430% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11431% HSLColorspace, or HWBColorspace.
11432%
11433*/
11434WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11435 const ColorspaceType colorspace)
11436{
11437 assert(wand != (MagickWand *) NULL);
11438 assert(wand->signature == WandSignature);
11439 if (wand->debug != MagickFalse)
11440 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11441 if (wand->images == (Image *) NULL)
11442 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11443 return(TransformImageColorspace(wand->images,colorspace));
11444}
11445
11446/*
11447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11448% %
11449% %
11450% %
11451% 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 %
11452% %
11453% %
11454% %
11455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11456%
11457% MagickTransparentPaintImage() changes any pixel that matches color with the
11458% color defined by fill.
11459%
11460% The format of the MagickTransparentPaintImage method is:
11461%
11462% MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11463% const PixelWand *target,const double alpha,const double fuzz,
11464% const MagickBooleanType invert)
11465%
11466% A description of each parameter follows:
11467%
11468% o wand: the magick wand.
11469%
cristyb6a294d2011-10-03 00:55:17 +000011470% o target: Change this target color to specified alpha value within
cristy3ed852e2009-09-05 21:47:34 +000011471% the image.
11472%
11473% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11474% transparent.
11475%
11476% o fuzz: By default target must match a particular pixel color
11477% exactly. However, in many cases two colors may differ by a small amount.
11478% The fuzz member of image defines how much tolerance is acceptable to
11479% consider two colors as the same. For example, set fuzz to 10 and the
11480% color red at intensities of 100 and 102 respectively are now interpreted
11481% as the same color for the purposes of the floodfill.
11482%
11483% o invert: paint any pixel that does not match the target color.
11484%
11485*/
11486WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11487 const PixelWand *target,const double alpha,const double fuzz,
11488 const MagickBooleanType invert)
11489{
11490 MagickBooleanType
11491 status;
11492
cristy4c08aed2011-07-01 19:47:50 +000011493 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000011494 target_pixel;
11495
11496 assert(wand != (MagickWand *) NULL);
11497 assert(wand->signature == WandSignature);
11498 if (wand->debug != MagickFalse)
11499 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11500 if (wand->images == (Image *) NULL)
11501 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11502 PixelGetMagickColor(target,&target_pixel);
11503 wand->images->fuzz=fuzz;
cristyce70c172010-01-07 17:15:30 +000011504 status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
cristy189e84c2011-08-27 18:08:53 +000011505 QuantumRange*alpha),invert,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +000011506 return(status);
11507}
11508
11509/*
11510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11511% %
11512% %
11513% %
11514% M a g i c k T r a n s p o s e I m a g e %
11515% %
11516% %
11517% %
11518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11519%
11520% MagickTransposeImage() creates a vertical mirror image by reflecting the
11521% pixels around the central x-axis while rotating them 90-degrees.
11522%
11523% The format of the MagickTransposeImage method is:
11524%
11525% MagickBooleanType MagickTransposeImage(MagickWand *wand)
11526%
11527% A description of each parameter follows:
11528%
11529% o wand: the magick wand.
11530%
11531*/
11532WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11533{
11534 Image
11535 *transpose_image;
11536
11537 assert(wand != (MagickWand *) NULL);
11538 assert(wand->signature == WandSignature);
11539 if (wand->debug != MagickFalse)
11540 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11541 if (wand->images == (Image *) NULL)
11542 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11543 transpose_image=TransposeImage(wand->images,wand->exception);
11544 if (transpose_image == (Image *) NULL)
11545 return(MagickFalse);
11546 ReplaceImageInList(&wand->images,transpose_image);
11547 return(MagickTrue);
11548}
11549
11550/*
11551%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11552% %
11553% %
11554% %
11555% M a g i c k T r a n s v e r s e I m a g e %
11556% %
11557% %
11558% %
11559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11560%
11561% MagickTransverseImage() creates a horizontal mirror image by reflecting the
11562% pixels around the central y-axis while rotating them 270-degrees.
11563%
11564% The format of the MagickTransverseImage method is:
11565%
11566% MagickBooleanType MagickTransverseImage(MagickWand *wand)
11567%
11568% A description of each parameter follows:
11569%
11570% o wand: the magick wand.
11571%
11572*/
11573WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11574{
11575 Image
11576 *transverse_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 transverse_image=TransverseImage(wand->images,wand->exception);
11585 if (transverse_image == (Image *) NULL)
11586 return(MagickFalse);
11587 ReplaceImageInList(&wand->images,transverse_image);
11588 return(MagickTrue);
11589}
11590
11591/*
11592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11593% %
11594% %
11595% %
11596% M a g i c k T r i m I m a g e %
11597% %
11598% %
11599% %
11600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11601%
11602% MagickTrimImage() remove edges that are the background color from the image.
11603%
11604% The format of the MagickTrimImage method is:
11605%
11606% MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11607%
11608% A description of each parameter follows:
11609%
11610% o wand: the magick wand.
11611%
11612% o fuzz: By default target must match a particular pixel color
11613% exactly. However, in many cases two colors may differ by a small amount.
11614% The fuzz member of image defines how much tolerance is acceptable to
11615% consider two colors as the same. For example, set fuzz to 10 and the
11616% color red at intensities of 100 and 102 respectively are now interpreted
11617% as the same color for the purposes of the floodfill.
11618%
11619*/
11620WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11621{
11622 Image
11623 *trim_image;
11624
11625 assert(wand != (MagickWand *) NULL);
11626 assert(wand->signature == WandSignature);
11627 if (wand->debug != MagickFalse)
11628 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11629 if (wand->images == (Image *) NULL)
11630 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11631 wand->images->fuzz=fuzz;
11632 trim_image=TrimImage(wand->images,wand->exception);
11633 if (trim_image == (Image *) NULL)
11634 return(MagickFalse);
11635 ReplaceImageInList(&wand->images,trim_image);
11636 return(MagickTrue);
11637}
11638
11639/*
11640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11641% %
11642% %
11643% %
11644% M a g i c k U n i q u e I m a g e C o l o r s %
11645% %
11646% %
11647% %
11648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11649%
11650% MagickUniqueImageColors() discards all but one of any pixel color.
11651%
11652% The format of the MagickUniqueImageColors method is:
11653%
11654% MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11655%
11656% A description of each parameter follows:
11657%
11658% o wand: the magick wand.
11659%
11660*/
11661WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11662{
11663 Image
11664 *unique_image;
11665
11666 assert(wand != (MagickWand *) NULL);
11667 assert(wand->signature == WandSignature);
11668 if (wand->debug != MagickFalse)
11669 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11670 if (wand->images == (Image *) NULL)
11671 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11672 unique_image=UniqueImageColors(wand->images,wand->exception);
11673 if (unique_image == (Image *) NULL)
11674 return(MagickFalse);
11675 ReplaceImageInList(&wand->images,unique_image);
11676 return(MagickTrue);
11677}
11678
11679/*
11680%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11681% %
11682% %
11683% %
11684% M a g i c k U n s h a r p M a s k I m a g e %
11685% %
11686% %
11687% %
11688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11689%
11690% MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
11691% Gaussian operator of the given radius and standard deviation (sigma).
11692% For reasonable results, radius should be larger than sigma. Use a radius
11693% of 0 and UnsharpMaskImage() selects a suitable radius for you.
11694%
11695% The format of the MagickUnsharpMaskImage method is:
11696%
11697% MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11698% const double radius,const double sigma,const double amount,
11699% const double threshold)
cristy3ed852e2009-09-05 21:47:34 +000011700%
11701% A description of each parameter follows:
11702%
11703% o wand: the magick wand.
11704%
cristy3ed852e2009-09-05 21:47:34 +000011705% o radius: the radius of the Gaussian, in pixels, not counting the center
11706% pixel.
11707%
11708% o sigma: the standard deviation of the Gaussian, in pixels.
11709%
11710% o amount: the percentage of the difference between the original and the
11711% blur image that is added back into the original.
11712%
11713% o threshold: the threshold in pixels needed to apply the diffence amount.
11714%
11715*/
cristy3ed852e2009-09-05 21:47:34 +000011716WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11717 const double radius,const double sigma,const double amount,
11718 const double threshold)
11719{
cristy3ed852e2009-09-05 21:47:34 +000011720 Image
11721 *unsharp_image;
11722
11723 assert(wand != (MagickWand *) NULL);
11724 assert(wand->signature == WandSignature);
11725 if (wand->debug != MagickFalse)
11726 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11727 if (wand->images == (Image *) NULL)
11728 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000011729 unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11730 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011731 if (unsharp_image == (Image *) NULL)
11732 return(MagickFalse);
11733 ReplaceImageInList(&wand->images,unsharp_image);
11734 return(MagickTrue);
11735}
11736
11737/*
11738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11739% %
11740% %
11741% %
11742% M a g i c k V i g n e t t e I m a g e %
11743% %
11744% %
11745% %
11746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11747%
11748% MagickVignetteImage() softens the edges of the image in vignette style.
11749%
11750% The format of the MagickVignetteImage method is:
11751%
11752% MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011753% const double black_point,const double white_point,const ssize_t x,
11754% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011755%
11756% A description of each parameter follows:
11757%
11758% o wand: the magick wand.
11759%
11760% o black_point: the black point.
11761%
11762% o white_point: the white point.
11763%
11764% o x, y: Define the x and y ellipse offset.
11765%
11766*/
11767WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011768 const double black_point,const double white_point,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011769{
11770 Image
11771 *vignette_image;
11772
11773 assert(wand != (MagickWand *) NULL);
11774 assert(wand->signature == WandSignature);
11775 if (wand->debug != MagickFalse)
11776 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11777 if (wand->images == (Image *) NULL)
11778 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11779 vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11780 wand->exception);
11781 if (vignette_image == (Image *) NULL)
11782 return(MagickFalse);
11783 ReplaceImageInList(&wand->images,vignette_image);
11784 return(MagickTrue);
11785}
11786
11787/*
11788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11789% %
11790% %
11791% %
11792% M a g i c k W a v e I m a g e %
11793% %
11794% %
11795% %
11796%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11797%
11798% MagickWaveImage() creates a "ripple" effect in the image by shifting
cristycee97112010-05-28 00:44:52 +000011799% the pixels vertically along a sine wave whose amplitude and wavelength
cristy3ed852e2009-09-05 21:47:34 +000011800% is specified by the given parameters.
11801%
11802% The format of the MagickWaveImage method is:
11803%
cristy5c4e2582011-09-11 19:21:03 +000011804% MagickBooleanType MagickWaveImage(MagickWand *wand,
11805% const double amplitude,const double wave_length,
11806% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011807%
11808% A description of each parameter follows:
11809%
11810% o wand: the magick wand.
11811%
11812% o amplitude, wave_length: Define the amplitude and wave length of the
11813% sine wave.
11814%
cristy5c4e2582011-09-11 19:21:03 +000011815% o method: the pixel interpolation method.
11816%
cristy3ed852e2009-09-05 21:47:34 +000011817*/
11818WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +000011819 const double amplitude,const double wave_length,
11820 const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011821{
11822 Image
11823 *wave_image;
11824
11825 assert(wand != (MagickWand *) NULL);
11826 assert(wand->signature == WandSignature);
11827 if (wand->debug != MagickFalse)
11828 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11829 if (wand->images == (Image *) NULL)
11830 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +000011831 wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11832 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011833 if (wave_image == (Image *) NULL)
11834 return(MagickFalse);
11835 ReplaceImageInList(&wand->images,wave_image);
11836 return(MagickTrue);
11837}
11838
11839/*
11840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11841% %
11842% %
11843% %
11844% 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 %
11845% %
11846% %
11847% %
11848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11849%
11850% MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
11851% above the threshold into white while leaving all pixels below the threshold
11852% unchanged.
11853%
11854% The format of the MagickWhiteThresholdImage method is:
11855%
11856% MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11857% const PixelWand *threshold)
11858%
11859% A description of each parameter follows:
11860%
11861% o wand: the magick wand.
11862%
11863% o threshold: the pixel wand.
11864%
11865*/
11866WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11867 const PixelWand *threshold)
11868{
11869 char
11870 thresholds[MaxTextExtent];
11871
11872 MagickBooleanType
11873 status;
11874
11875 assert(wand != (MagickWand *) NULL);
11876 assert(wand->signature == WandSignature);
11877 if (wand->debug != MagickFalse)
11878 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11879 if (wand->images == (Image *) NULL)
11880 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +000011881 (void) FormatLocaleString(thresholds,MaxTextExtent,
cristy3ed852e2009-09-05 21:47:34 +000011882 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11883 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
cristyb6a294d2011-10-03 00:55:17 +000011884 PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
cristyf4ad9df2011-07-08 16:49:03 +000011885 status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
cristy3ed852e2009-09-05 21:47:34 +000011886 if (status == MagickFalse)
11887 InheritException(wand->exception,&wand->images->exception);
11888 return(status);
11889}
11890
11891/*
11892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11893% %
11894% %
11895% %
11896% M a g i c k W r i t e I m a g e %
11897% %
11898% %
11899% %
11900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11901%
11902% MagickWriteImage() writes an image to the specified filename. If the
11903% filename parameter is NULL, the image is written to the filename set
11904% by MagickReadImage() or MagickSetImageFilename().
11905%
11906% The format of the MagickWriteImage method is:
11907%
11908% MagickBooleanType MagickWriteImage(MagickWand *wand,
11909% const char *filename)
11910%
11911% A description of each parameter follows:
11912%
11913% o wand: the magick wand.
11914%
11915% o filename: the image filename.
11916%
11917%
11918*/
11919WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11920 const char *filename)
11921{
11922 Image
11923 *image;
11924
11925 ImageInfo
11926 *write_info;
11927
11928 MagickBooleanType
11929 status;
11930
11931 assert(wand != (MagickWand *) NULL);
11932 assert(wand->signature == WandSignature);
11933 if (wand->debug != MagickFalse)
11934 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11935 if (wand->images == (Image *) NULL)
11936 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11937 if (filename != (const char *) NULL)
11938 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11939 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11940 if (image == (Image *) NULL)
11941 return(MagickFalse);
11942 write_info=CloneImageInfo(wand->image_info);
11943 write_info->adjoin=MagickTrue;
cristy6f9e0d32011-08-28 16:32:09 +000011944 status=WriteImage(write_info,image,&image->exception);
cristy3ed852e2009-09-05 21:47:34 +000011945 image=DestroyImage(image);
11946 write_info=DestroyImageInfo(write_info);
11947 return(status);
11948}
11949
11950/*
11951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11952% %
11953% %
11954% %
11955% M a g i c k W r i t e I m a g e F i l e %
11956% %
11957% %
11958% %
11959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11960%
11961% MagickWriteImageFile() writes an image to an open file descriptor.
11962%
11963% The format of the MagickWriteImageFile method is:
11964%
11965% MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11966%
11967% A description of each parameter follows:
11968%
11969% o wand: the magick wand.
11970%
11971% o file: the file descriptor.
11972%
cristy3ed852e2009-09-05 21:47:34 +000011973*/
11974WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11975{
11976 Image
11977 *image;
11978
11979 ImageInfo
11980 *write_info;
11981
11982 MagickBooleanType
11983 status;
11984
11985 assert(wand != (MagickWand *) NULL);
11986 assert(wand->signature == WandSignature);
11987 assert(file != (FILE *) NULL);
11988 if (wand->debug != MagickFalse)
11989 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11990 if (wand->images == (Image *) NULL)
11991 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11992 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11993 if (image == (Image *) NULL)
11994 return(MagickFalse);
11995 write_info=CloneImageInfo(wand->image_info);
11996 SetImageInfoFile(write_info,file);
11997 write_info->adjoin=MagickTrue;
cristy6f9e0d32011-08-28 16:32:09 +000011998 status=WriteImage(write_info,image,&image->exception);
cristy3ed852e2009-09-05 21:47:34 +000011999 write_info=DestroyImageInfo(write_info);
cristy3ed852e2009-09-05 21:47:34 +000012000 image=DestroyImage(image);
12001 return(status);
12002}
12003
12004/*
12005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12006% %
12007% %
12008% %
12009% M a g i c k W r i t e I m a g e s %
12010% %
12011% %
12012% %
12013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12014%
12015% MagickWriteImages() writes an image or image sequence.
12016%
12017% The format of the MagickWriteImages method is:
12018%
12019% MagickBooleanType MagickWriteImages(MagickWand *wand,
12020% const char *filename,const MagickBooleanType adjoin)
12021%
12022% A description of each parameter follows:
12023%
12024% o wand: the magick wand.
12025%
12026% o filename: the image filename.
12027%
12028% o adjoin: join images into a single multi-image file.
12029%
12030*/
12031WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12032 const char *filename,const MagickBooleanType adjoin)
12033{
12034 ImageInfo
12035 *write_info;
12036
12037 MagickBooleanType
12038 status;
12039
12040 assert(wand != (MagickWand *) NULL);
12041 assert(wand->signature == WandSignature);
12042 if (wand->debug != MagickFalse)
12043 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12044 if (wand->images == (Image *) NULL)
12045 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12046 write_info=CloneImageInfo(wand->image_info);
12047 write_info->adjoin=adjoin;
12048 status=WriteImages(write_info,wand->images,filename,wand->exception);
12049 if (status == MagickFalse)
12050 InheritException(wand->exception,&wand->images->exception);
12051 write_info=DestroyImageInfo(write_info);
12052 return(status);
12053}
12054
12055/*
12056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12057% %
12058% %
12059% %
12060% M a g i c k W r i t e I m a g e s F i l e %
12061% %
12062% %
12063% %
12064%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12065%
12066% MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12067%
12068% The format of the MagickWriteImagesFile method is:
12069%
12070% MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12071%
12072% A description of each parameter follows:
12073%
12074% o wand: the magick wand.
12075%
12076% o file: the file descriptor.
12077%
12078*/
12079WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12080{
12081 ImageInfo
12082 *write_info;
12083
12084 MagickBooleanType
12085 status;
12086
12087 assert(wand != (MagickWand *) NULL);
12088 assert(wand->signature == WandSignature);
12089 if (wand->debug != MagickFalse)
12090 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12091 if (wand->images == (Image *) NULL)
12092 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12093 write_info=CloneImageInfo(wand->image_info);
12094 SetImageInfoFile(write_info,file);
12095 write_info->adjoin=MagickTrue;
12096 status=WriteImages(write_info,wand->images,(const char *) NULL,
12097 wand->exception);
12098 write_info=DestroyImageInfo(write_info);
12099 if (status == MagickFalse)
12100 InheritException(wand->exception,&wand->images->exception);
12101 return(status);
12102}