blob: 51a76af38d5f06179e8762f83f66e95cd7fc2018 [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 %
cristyde984cd2013-12-01 14:49:27 +000022% Cristy %
cristy3ed852e2009-09-05 21:47:34 +000023% August 2003 %
24% %
25% %
cristyb56bb242014-11-25 17:12:48 +000026% Copyright 1999-2015 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"
cristydf68be42014-01-14 21:22:40 +000054#include "MagickCore/image-private.h"
cristy3ed852e2009-09-05 21:47:34 +000055
56/*
57 Define declarations.
58*/
cristy3ed852e2009-09-05 21:47:34 +000059#define MagickWandId "MagickWand"
60
61/*
62%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63% %
64% %
65% %
66+ C l o n e M a g i c k W a n d F r o m I m a g e s %
67% %
68% %
69% %
70%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71%
72% CloneMagickWandFromImages() clones the magick wand and inserts a new image
73% list.
74%
75% The format of the CloneMagickWandFromImages method is:
76%
77% MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
78% Image *images)
79%
80% A description of each parameter follows:
81%
82% o wand: the magick wand.
83%
84% o images: replace the image list with these image(s).
85%
86*/
87static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88 Image *images)
89{
90 MagickWand
91 *clone_wand;
92
93 assert(wand != (MagickWand *) NULL);
94 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000095 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000096 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy73bd4a52010-10-05 11:24:23 +000097 clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
cristy3ed852e2009-09-05 21:47:34 +000098 if (clone_wand == (MagickWand *) NULL)
99 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
100 images->filename);
101 (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
102 clone_wand->id=AcquireWandId();
cristyb51dff52011-05-19 16:55:47 +0000103 (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
cristye8c25f92010-06-03 00:53:06 +0000104 MagickWandId,(double) clone_wand->id);
cristye7139e02012-02-29 12:42:18 +0000105 clone_wand->exception=AcquireExceptionInfo();
cristy3ed852e2009-09-05 21:47:34 +0000106 InheritException(clone_wand->exception,wand->exception);
107 clone_wand->image_info=CloneImageInfo(wand->image_info);
cristy3ed852e2009-09-05 21:47:34 +0000108 clone_wand->images=images;
109 clone_wand->debug=IsEventLogging();
cristy3ed852e2009-09-05 21:47:34 +0000110 clone_wand->signature=WandSignature;
cristy5221b602012-10-30 18:02:55 +0000111 if (IfMagickTrue(clone_wand->debug))
anthony8270b722012-03-30 14:35:24 +0000112 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
cristy3ed852e2009-09-05 21:47:34 +0000113 return(clone_wand);
114}
115
116/*
117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118% %
119% %
120% %
121% G e t I m a g e F r o m M a g i c k W a n d %
122% %
123% %
124% %
125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126%
127% GetImageFromMagickWand() returns the current image from the magick wand.
128%
129% The format of the GetImageFromMagickWand method is:
130%
131% Image *GetImageFromMagickWand(const MagickWand *wand)
132%
133% A description of each parameter follows:
134%
135% o wand: the magick wand.
136%
137*/
138WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
139{
140 assert(wand != (MagickWand *) NULL);
141 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000142 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000143 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
144 if (wand->images == (Image *) NULL)
145 {
146 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +0000147 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +0000148 return((Image *) NULL);
149 }
150 return(wand->images);
151}
152
153/*
154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155% %
156% %
157% %
158% 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 %
159% %
160% %
161% %
162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163%
164% MagickAdaptiveBlurImage() adaptively blurs the image by blurring
165% less intensely near image edges and more intensely far from edges. We
166% blur the image with a Gaussian operator of the given radius and standard
167% deviation (sigma). For reasonable results, radius should be larger than
168% sigma. Use a radius of 0 and MagickAdaptiveBlurImage() selects a
169% suitable radius for you.
170%
171% The format of the MagickAdaptiveBlurImage method is:
172%
173% MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +0000174% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000175%
176% A description of each parameter follows:
177%
178% o wand: the magick wand.
179%
cristy3ed852e2009-09-05 21:47:34 +0000180% o radius: the radius of the Gaussian, in pixels, not counting the center
181% pixel.
182%
183% o sigma: the standard deviation of the Gaussian, in pixels.
184%
185*/
cristy3ed852e2009-09-05 21:47:34 +0000186WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +0000187 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000188{
cristy3ed852e2009-09-05 21:47:34 +0000189 Image
190 *sharp_image;
191
192 assert(wand != (MagickWand *) NULL);
193 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000194 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000195 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
196 if (wand->images == (Image *) NULL)
197 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +0000198 sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000199 if (sharp_image == (Image *) NULL)
200 return(MagickFalse);
201 ReplaceImageInList(&wand->images,sharp_image);
202 return(MagickTrue);
203}
204
205/*
206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207% %
208% %
209% %
210% 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 %
211% %
212% %
213% %
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215%
216% MagickAdaptiveResizeImage() adaptively resize image with data dependent
217% triangulation.
218%
219% MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
anthonyfd706f92012-01-19 04:22:02 +0000220% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +0000221%
222% A description of each parameter follows:
223%
224% o wand: the magick wand.
225%
226% o columns: the number of columns in the scaled image.
227%
228% o rows: the number of rows in the scaled image.
229%
230*/
231WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
anthonyfd706f92012-01-19 04:22:02 +0000232 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +0000233{
234 Image
235 *resize_image;
236
237 assert(wand != (MagickWand *) NULL);
238 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000239 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000240 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
241 if (wand->images == (Image *) NULL)
242 ThrowWandException(WandError,"ContainsNoImages",wand->name);
anthonyfd706f92012-01-19 04:22:02 +0000243 resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000244 if (resize_image == (Image *) NULL)
245 return(MagickFalse);
246 ReplaceImageInList(&wand->images,resize_image);
247 return(MagickTrue);
248}
249
250/*
251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252% %
253% %
254% %
255% 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 %
256% %
257% %
258% %
259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260%
261% MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
262% more intensely near image edges and less intensely far from edges. We
263% sharpen the image with a Gaussian operator of the given radius and standard
264% deviation (sigma). For reasonable results, radius should be larger than
265% sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
266% suitable radius for you.
267%
268% The format of the MagickAdaptiveSharpenImage method is:
269%
270% MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +0000271% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000272%
273% A description of each parameter follows:
274%
275% o wand: the magick wand.
276%
cristy3ed852e2009-09-05 21:47:34 +0000277% o radius: the radius of the Gaussian, in pixels, not counting the center
278% pixel.
279%
280% o sigma: the standard deviation of the Gaussian, in pixels.
281%
282*/
cristy3ed852e2009-09-05 21:47:34 +0000283WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +0000284 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000285{
cristy3ed852e2009-09-05 21:47:34 +0000286 Image
287 *sharp_image;
288
289 assert(wand != (MagickWand *) NULL);
290 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000291 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000292 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
293 if (wand->images == (Image *) NULL)
294 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +0000295 sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000296 if (sharp_image == (Image *) NULL)
297 return(MagickFalse);
298 ReplaceImageInList(&wand->images,sharp_image);
299 return(MagickTrue);
300}
301
302/*
303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304% %
305% %
306% %
307% 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 %
308% %
309% %
310% %
311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312%
313% MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
314% based on the range of intensity values in its local neighborhood. This
315% allows for thresholding of an image whose global intensity histogram
316% doesn't contain distinctive peaks.
317%
318% The format of the AdaptiveThresholdImage method is:
319%
320% MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristy5f07f702011-09-26 17:29:10 +0000321% const size_t width,const size_t height,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000322%
323% A description of each parameter follows:
324%
325% o wand: the magick wand.
326%
327% o width: the width of the local neighborhood.
328%
329% o height: the height of the local neighborhood.
330%
cristy5f07f702011-09-26 17:29:10 +0000331% o offset: the mean bias.
cristy3ed852e2009-09-05 21:47:34 +0000332%
333*/
334WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
cristy5f07f702011-09-26 17:29:10 +0000335 const size_t width,const size_t height,const double bias)
cristy3ed852e2009-09-05 21:47:34 +0000336{
337 Image
338 *threshold_image;
339
340 assert(wand != (MagickWand *) NULL);
341 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000342 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000343 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
344 if (wand->images == (Image *) NULL)
345 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f07f702011-09-26 17:29:10 +0000346 threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
cristy3ed852e2009-09-05 21:47:34 +0000347 wand->exception);
348 if (threshold_image == (Image *) NULL)
349 return(MagickFalse);
350 ReplaceImageInList(&wand->images,threshold_image);
351 return(MagickTrue);
352}
353
354/*
355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356% %
357% %
358% %
359% M a g i c k A d d I m a g e %
360% %
361% %
362% %
363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364%
anthonyf93964e2012-03-16 08:25:58 +0000365% MagickAddImage() adds a clone of the images from the second wand and
366% inserts them into the first wand.
anthonya89dd172011-10-04 13:29:35 +0000367%
anthony45083312012-03-14 14:49:12 +0000368% Use MagickSetLastIterator(), to append new images into an existing wand,
369% current image will be set to last image so later adds with also be
370% appened to end of wand.
371%
anthonyf93964e2012-03-16 08:25:58 +0000372% Use MagickSetFirstIterator() to prepend new images into wand, any more
373% images added will also be prepended before other images in the wand.
374% However the order of a list of new images will not change.
anthony45083312012-03-14 14:49:12 +0000375%
376% Otherwise the new images will be inserted just after the current image,
anthonyf93964e2012-03-16 08:25:58 +0000377% and any later image will also be added after this current image but
378% before the previously added images. Caution is advised when multiple
379% image adds are inserted into the middle of the wand image list.
cristy3ed852e2009-09-05 21:47:34 +0000380%
381% The format of the MagickAddImage method is:
382%
383% MagickBooleanType MagickAddImage(MagickWand *wand,
384% const MagickWand *add_wand)
385%
386% A description of each parameter follows:
387%
388% o wand: the magick wand.
389%
anthonyf93964e2012-03-16 08:25:58 +0000390% o add_wand: A wand that contains the image list to be added
cristy3ed852e2009-09-05 21:47:34 +0000391%
392*/
cristy3ed852e2009-09-05 21:47:34 +0000393static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
394 Image *images)
395{
anthony45083312012-03-14 14:49:12 +0000396 if (wand->images == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +0000397 {
cristy5221b602012-10-30 18:02:55 +0000398 /*
399 No images in wand, just add them, set current as appropriate.
400 */
401 if (IfMagickTrue(wand->insert_before))
anthony45083312012-03-14 14:49:12 +0000402 wand->images=GetFirstImageInList(images);
403 else
404 wand->images=GetLastImageInList(images);
cristy3ed852e2009-09-05 21:47:34 +0000405 return(MagickTrue);
406 }
anthonya89dd172011-10-04 13:29:35 +0000407 /* user jumped to first image, so prepend new images - remain active */
cristy5221b602012-10-30 18:02:55 +0000408 if (IfMagickTrue((wand->insert_before)) &&
409 (wand->images->previous == (Image *) NULL))
cristy3ed852e2009-09-05 21:47:34 +0000410 {
anthony45083312012-03-14 14:49:12 +0000411 PrependImageToList(&wand->images,images);
anthonya89dd172011-10-04 13:29:35 +0000412 wand->images=GetFirstImageInList(images);
413 return(MagickTrue);
414 }
cristy5221b602012-10-30 18:02:55 +0000415 /*
416 Note you should never have 'insert_before' true when current image is not
417 the first image in the wand! That is no insert before current image, only
418 after current image
419 */
anthony45083312012-03-14 14:49:12 +0000420 if (wand->images->next == (Image *) NULL)
cristy2e74b0f2010-09-01 19:42:26 +0000421 {
cristy5221b602012-10-30 18:02:55 +0000422 /*
423 At last image, append new images.
424 */
anthony45083312012-03-14 14:49:12 +0000425 InsertImageInList(&wand->images,images);
cristy2e74b0f2010-09-01 19:42:26 +0000426 wand->images=GetLastImageInList(images);
427 return(MagickTrue);
428 }
cristy5221b602012-10-30 18:02:55 +0000429 /*
430 Insert new images, just after the current image.
431 */
anthony45083312012-03-14 14:49:12 +0000432 InsertImageInList(&wand->images,images);
cristy3ed852e2009-09-05 21:47:34 +0000433 return(MagickTrue);
434}
435
436WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437 const MagickWand *add_wand)
438{
439 Image
440 *images;
441
442 assert(wand != (MagickWand *) NULL);
443 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000444 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000445 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446 assert(add_wand != (MagickWand *) NULL);
447 assert(add_wand->signature == WandSignature);
448 if (add_wand->images == (Image *) NULL)
449 ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
cristy5221b602012-10-30 18:02:55 +0000450 /*
451 Clone images in second wand, and insert into first.
452 */
cristy3ed852e2009-09-05 21:47:34 +0000453 images=CloneImageList(add_wand->images,wand->exception);
454 if (images == (Image *) NULL)
455 return(MagickFalse);
456 return(InsertImageInWand(wand,images));
457}
458
459/*
460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461% %
462% %
463% %
464% M a g i c k A d d N o i s e I m a g e %
465% %
466% %
467% %
468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469%
470% MagickAddNoiseImage() adds random noise to the image.
471%
472% The format of the MagickAddNoiseImage method is:
473%
474% MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
cristy9ed1f812011-10-08 02:00:08 +0000475% const NoiseType noise_type,const double attenuate)
cristy3ed852e2009-09-05 21:47:34 +0000476%
477% A description of each parameter follows:
478%
479% o wand: the magick wand.
480%
cristy3ed852e2009-09-05 21:47:34 +0000481% o noise_type: The type of noise: Uniform, Gaussian, Multiplicative,
482% Impulse, Laplacian, or Poisson.
483%
cristy9ed1f812011-10-08 02:00:08 +0000484% o attenuate: attenuate the random distribution.
485%
cristy3ed852e2009-09-05 21:47:34 +0000486*/
cristy3ed852e2009-09-05 21:47:34 +0000487WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
cristy9ed1f812011-10-08 02:00:08 +0000488 const NoiseType noise_type,const double attenuate)
cristy3ed852e2009-09-05 21:47:34 +0000489{
cristy3ed852e2009-09-05 21:47:34 +0000490 Image
491 *noise_image;
492
493 assert(wand != (MagickWand *) NULL);
494 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000495 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000496 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497 if (wand->images == (Image *) NULL)
498 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy9ed1f812011-10-08 02:00:08 +0000499 noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000500 if (noise_image == (Image *) NULL)
501 return(MagickFalse);
502 ReplaceImageInList(&wand->images,noise_image);
503 return(MagickTrue);
504}
505
506/*
507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508% %
509% %
510% %
511% M a g i c k A f f i n e T r a n s f o r m I m a g e %
512% %
513% %
514% %
515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516%
517% MagickAffineTransformImage() transforms an image as dictated by the affine
518% matrix of the drawing wand.
519%
520% The format of the MagickAffineTransformImage method is:
521%
522% MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
523% const DrawingWand *drawing_wand)
524%
525% A description of each parameter follows:
526%
527% o wand: the magick wand.
528%
529% o drawing_wand: the draw wand.
530%
531*/
532WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
533 const DrawingWand *drawing_wand)
534{
535 DrawInfo
536 *draw_info;
537
538 Image
539 *affine_image;
540
541 assert(wand != (MagickWand *) NULL);
542 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000543 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000544 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
545 if (wand->images == (Image *) NULL)
546 ThrowWandException(WandError,"ContainsNoImages",wand->name);
547 draw_info=PeekDrawingWand(drawing_wand);
548 if (draw_info == (DrawInfo *) NULL)
549 return(MagickFalse);
550 affine_image=AffineTransformImage(wand->images,&draw_info->affine,
551 wand->exception);
552 draw_info=DestroyDrawInfo(draw_info);
553 if (affine_image == (Image *) NULL)
554 return(MagickFalse);
555 ReplaceImageInList(&wand->images,affine_image);
556 return(MagickTrue);
557}
558
559/*
560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561% %
562% %
563% %
564% M a g i c k A n n o t a t e I m a g e %
565% %
566% %
567% %
568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
569%
570% MagickAnnotateImage() annotates an image with text.
571%
572% The format of the MagickAnnotateImage method is:
573%
574% MagickBooleanType MagickAnnotateImage(MagickWand *wand,
575% const DrawingWand *drawing_wand,const double x,const double y,
576% const double angle,const char *text)
577%
578% A description of each parameter follows:
579%
580% o wand: the magick wand.
581%
582% o drawing_wand: the draw wand.
583%
584% o x: x ordinate to left of text
585%
586% o y: y ordinate to text baseline
587%
588% o angle: rotate text relative to this angle.
589%
590% o text: text to draw
591%
592*/
593WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594 const DrawingWand *drawing_wand,const double x,const double y,
595 const double angle,const char *text)
596{
597 char
598 geometry[MaxTextExtent];
599
600 DrawInfo
601 *draw_info;
602
603 MagickBooleanType
604 status;
605
606 assert(wand != (MagickWand *) NULL);
607 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000608 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000609 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
610 if (wand->images == (Image *) NULL)
611 ThrowWandException(WandError,"ContainsNoImages",wand->name);
612 draw_info=PeekDrawingWand(drawing_wand);
613 if (draw_info == (DrawInfo *) NULL)
614 return(MagickFalse);
615 (void) CloneString(&draw_info->text,text);
cristyb51dff52011-05-19 16:55:47 +0000616 (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
cristy5f07f702011-09-26 17:29:10 +0000617 draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
618 draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
619 draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
620 draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
cristy3ed852e2009-09-05 21:47:34 +0000621 (void) CloneString(&draw_info->geometry,geometry);
cristy5f49bdb2011-10-16 14:28:56 +0000622 status=AnnotateImage(wand->images,draw_info,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000623 draw_info=DestroyDrawInfo(draw_info);
cristy220c4d52013-11-27 19:31:32 +0000624 return(status);
cristy3ed852e2009-09-05 21:47:34 +0000625}
626
627/*
628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629% %
630% %
631% %
632% M a g i c k A n i m a t e I m a g e s %
633% %
634% %
635% %
636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637%
638% MagickAnimateImages() animates an image or image sequence.
639%
640% The format of the MagickAnimateImages method is:
641%
642% MagickBooleanType MagickAnimateImages(MagickWand *wand,
643% const char *server_name)
644%
645% A description of each parameter follows:
646%
647% o wand: the magick wand.
648%
649% o server_name: the X server name.
650%
651*/
652WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653 const char *server_name)
654{
655 MagickBooleanType
656 status;
657
658 assert(wand != (MagickWand *) NULL);
659 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000660 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000661 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662 (void) CloneString(&wand->image_info->server_name,server_name);
cristy5f49bdb2011-10-16 14:28:56 +0000663 status=AnimateImages(wand->image_info,wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +0000664 return(status);
cristy3ed852e2009-09-05 21:47:34 +0000665}
666
667/*
668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669% %
670% %
671% %
672% M a g i c k A p p e n d I m a g e s %
673% %
674% %
675% %
676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677%
anthonyf93964e2012-03-16 08:25:58 +0000678% MagickAppendImages() append the images in a wand from the current image
679% onwards, creating a new wand with the single image result. This is
680% affected by the gravity and background settings of the first image.
681%
682% Typically you would call either MagickResetIterator() or
683% MagickSetFirstImage() before calling this function to ensure that all
684% the images in the wand's image list will be appended together.
cristy3ed852e2009-09-05 21:47:34 +0000685%
686% The format of the MagickAppendImages method is:
687%
688% MagickWand *MagickAppendImages(MagickWand *wand,
689% const MagickBooleanType stack)
690%
691% A description of each parameter follows:
692%
693% o wand: the magick wand.
694%
695% o stack: By default, images are stacked left-to-right. Set stack to
696% MagickTrue to stack them top-to-bottom.
697%
698*/
699WandExport MagickWand *MagickAppendImages(MagickWand *wand,
700 const MagickBooleanType stack)
701{
702 Image
703 *append_image;
704
705 assert(wand != (MagickWand *) NULL);
706 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000707 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000708 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
709 if (wand->images == (Image *) NULL)
710 return((MagickWand *) NULL);
711 append_image=AppendImages(wand->images,stack,wand->exception);
712 if (append_image == (Image *) NULL)
713 return((MagickWand *) NULL);
714 return(CloneMagickWandFromImages(wand,append_image));
715}
716
717/*
718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719% %
720% %
721% %
722% M a g i c k A u t o G a m m a I m a g e %
723% %
724% %
725% %
726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727%
728% MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
729% image to try make set its gamma appropriatally.
730%
731% The format of the MagickAutoGammaImage method is:
732%
733% MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000734%
735% A description of each parameter follows:
736%
737% o wand: the magick wand.
738%
cristy3ed852e2009-09-05 21:47:34 +0000739*/
740WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
741{
742 MagickBooleanType
743 status;
744
cristy3ed852e2009-09-05 21:47:34 +0000745 assert(wand != (MagickWand *) NULL);
746 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000747 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000748 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749 if (wand->images == (Image *) NULL)
750 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +0000751 status=AutoGammaImage(wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +0000752 return(status);
cristy3ed852e2009-09-05 21:47:34 +0000753}
754
755/*
756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757% %
758% %
759% %
760% M a g i c k A u t o L e v e l I m a g e %
761% %
762% %
763% %
764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765%
766% MagickAutoLevelImage() adjusts the levels of a particular image channel by
767% scaling the minimum and maximum values to the full quantum range.
768%
769% The format of the MagickAutoLevelImage method is:
770%
771% MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +0000772%
773% A description of each parameter follows:
774%
775% o wand: the magick wand.
776%
cristy3ed852e2009-09-05 21:47:34 +0000777*/
778WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
779{
780 MagickBooleanType
781 status;
782
cristy3ed852e2009-09-05 21:47:34 +0000783 assert(wand != (MagickWand *) NULL);
784 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000785 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000786 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787 if (wand->images == (Image *) NULL)
788 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +0000789 status=AutoLevelImage(wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +0000790 return(status);
cristy3ed852e2009-09-05 21:47:34 +0000791}
dirkcf870d12014-10-03 18:24:06 +0000792
793/*
794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
795% %
796% %
797% %
798% M a g i c k A u t o O r i e n t I m a g e %
799% %
800% %
801% %
802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803%
804% MagickAutoOrientImage() adjusts an image so that its orientation is suitable
805$ for viewing (i.e. top-left orientation).
806%
807% The format of the MagickAutoOrientImage method is:
808%
809% MagickBooleanType MagickAutoOrientImage(MagickWand *image)
810%
811% A description of each parameter follows:
812%
813% o wand: the magick wand.
814%
815*/
816WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
817{
818
819 Image
820 *orient_image;
821
822 assert(wand != (MagickWand *) NULL);
823 assert(wand->signature == WandSignature);
824 if (wand->debug != MagickFalse)
825 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826 if (wand->images == (Image *) NULL)
827 ThrowWandException(WandError,"ContainsNoImages",wand->name);
828 orient_image=AutoOrientImage(wand->images,wand->images->orientation,
829 wand->exception);
830 if (orient_image == (Image *) NULL)
831 return(MagickFalse);
832 ReplaceImageInList(&wand->images,orient_image);
833 return(MagickTrue);
834}
cristy3ed852e2009-09-05 21:47:34 +0000835
836/*
837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838% %
839% %
840% %
cristy3ed852e2009-09-05 21:47:34 +0000841% 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 %
842% %
843% %
844% %
845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846%
847% MagickBlackThresholdImage() is like MagickThresholdImage() but forces all
848% pixels below the threshold into black while leaving all pixels above the
849% threshold unchanged.
850%
851% The format of the MagickBlackThresholdImage method is:
852%
853% MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
854% const PixelWand *threshold)
855%
856% A description of each parameter follows:
857%
858% o wand: the magick wand.
859%
860% o threshold: the pixel wand.
861%
862*/
863WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
864 const PixelWand *threshold)
865{
866 char
867 thresholds[MaxTextExtent];
868
869 MagickBooleanType
870 status;
871
872 assert(wand != (MagickWand *) NULL);
873 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000874 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000875 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
876 if (wand->images == (Image *) NULL)
877 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +0000878 (void) FormatLocaleString(thresholds,MaxTextExtent,
cristy3ed852e2009-09-05 21:47:34 +0000879 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
880 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
cristyb6a294d2011-10-03 00:55:17 +0000881 PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
cristyd15e6592011-10-15 00:13:06 +0000882 status=BlackThresholdImage(wand->images,thresholds,wand->exception);
cristy220c4d52013-11-27 19:31:32 +0000883 return(status);
cristy3ed852e2009-09-05 21:47:34 +0000884}
885
886/*
887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888% %
889% %
890% %
891% M a g i c k B l u e S h i f t I m a g e %
892% %
893% %
894% %
895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896%
897% MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
898% nighttime in the moonlight.
899%
900% The format of the MagickBlueShiftImage method is:
901%
902% MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
903% const double factor)
904%
905% A description of each parameter follows:
906%
907% o wand: the magick wand.
908%
909% o factor: the blue shift factor (default 1.5)
910%
911*/
912WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
913 const double factor)
914{
915 Image
916 *shift_image;
917
918 assert(wand != (MagickWand *) NULL);
919 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000920 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000921 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
922 if (wand->images == (Image *) NULL)
923 ThrowWandException(WandError,"ContainsNoImages",wand->name);
924 shift_image=BlueShiftImage(wand->images,factor,wand->exception);
925 if (shift_image == (Image *) NULL)
926 return(MagickFalse);
927 ReplaceImageInList(&wand->images,shift_image);
928 return(MagickTrue);
929}
930
931/*
932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
933% %
934% %
935% %
936% M a g i c k B l u r I m a g e %
937% %
938% %
939% %
940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
941%
942% MagickBlurImage() blurs an image. We convolve the image with a
943% gaussian operator of the given radius and standard deviation (sigma).
944% For reasonable results, the radius should be larger than sigma. Use a
945% radius of 0 and BlurImage() selects a suitable radius for you.
946%
947% The format of the MagickBlurImage method is:
948%
949% MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
cristyaa2c16c2012-03-25 22:21:35 +0000950% const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000951%
952% A description of each parameter follows:
953%
954% o wand: the magick wand.
955%
cristy3ed852e2009-09-05 21:47:34 +0000956% o radius: the radius of the , in pixels, not counting the center
957% pixel.
958%
959% o sigma: the standard deviation of the , in pixels.
960%
961*/
cristy3ed852e2009-09-05 21:47:34 +0000962WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +0000963 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +0000964{
cristy3ed852e2009-09-05 21:47:34 +0000965 Image
966 *blur_image;
967
968 assert(wand != (MagickWand *) NULL);
969 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +0000970 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +0000971 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
972 if (wand->images == (Image *) NULL)
973 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +0000974 blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +0000975 if (blur_image == (Image *) NULL)
976 return(MagickFalse);
977 ReplaceImageInList(&wand->images,blur_image);
978 return(MagickTrue);
979}
980
981/*
982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983% %
984% %
985% %
986% M a g i c k B o r d e r I m a g e %
987% %
988% %
989% %
990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991%
992% MagickBorderImage() surrounds the image with a border of the color defined
993% by the bordercolor pixel wand.
994%
995% The format of the MagickBorderImage method is:
996%
997% MagickBooleanType MagickBorderImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +0000998% const PixelWand *bordercolor,const size_t width,
cristy633f0c62011-09-15 13:27:36 +0000999% const size_t height,const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00001000%
1001% A description of each parameter follows:
1002%
1003% o wand: the magick wand.
1004%
1005% o bordercolor: the border color pixel wand.
1006%
1007% o width: the border width.
1008%
1009% o height: the border height.
1010%
cristy633f0c62011-09-15 13:27:36 +00001011% o compose: the composite operator.
1012%
cristy3ed852e2009-09-05 21:47:34 +00001013*/
1014WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
cristy633f0c62011-09-15 13:27:36 +00001015 const PixelWand *bordercolor,const size_t width,const size_t height,
1016 const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00001017{
1018 Image
1019 *border_image;
1020
1021 RectangleInfo
1022 border_info;
1023
1024 assert(wand != (MagickWand *) NULL);
1025 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001026 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001027 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1028 if (wand->images == (Image *) NULL)
1029 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1030 border_info.width=width;
1031 border_info.height=height;
1032 border_info.x=0;
1033 border_info.y=0;
cristy4c08aed2011-07-01 19:47:50 +00001034 PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
cristy633f0c62011-09-15 13:27:36 +00001035 border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001036 if (border_image == (Image *) NULL)
1037 return(MagickFalse);
1038 ReplaceImageInList(&wand->images,border_image);
1039 return(MagickTrue);
1040}
1041
1042/*
1043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044% %
1045% %
1046% %
cristya28d6b82010-01-11 20:03:47 +00001047% 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 %
1048% %
1049% %
1050% %
1051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1052%
1053% Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1054% of an image. It converts the brightness and contrast parameters into slope
1055% and intercept and calls a polynomical function to apply to the image.
1056
1057%
1058% The format of the MagickBrightnessContrastImage method is:
1059%
1060% MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1061% const double brightness,const double contrast)
cristya28d6b82010-01-11 20:03:47 +00001062%
1063% A description of each parameter follows:
1064%
1065% o wand: the magick wand.
1066%
cristya28d6b82010-01-11 20:03:47 +00001067% o brightness: the brightness percent (-100 .. 100).
1068%
1069% o contrast: the contrast percent (-100 .. 100).
1070%
1071*/
cristy9ee60942011-07-06 14:54:38 +00001072WandExport MagickBooleanType MagickBrightnessContrastImage(
1073 MagickWand *wand,const double brightness,const double contrast)
cristya28d6b82010-01-11 20:03:47 +00001074{
1075 MagickBooleanType
1076 status;
1077
1078 assert(wand != (MagickWand *) NULL);
1079 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001080 if (IfMagickTrue(wand->debug))
cristya28d6b82010-01-11 20:03:47 +00001081 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1082 if (wand->images == (Image *) NULL)
1083 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy444eda62011-08-10 02:07:46 +00001084 status=BrightnessContrastImage(wand->images,brightness,contrast,
cristy5f49bdb2011-10-16 14:28:56 +00001085 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00001086 return(status);
cristya28d6b82010-01-11 20:03:47 +00001087}
1088
1089/*
1090%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1091% %
1092% %
1093% %
cristy5f257b22012-03-07 00:27:29 +00001094% M a g i c k C h a n n e l F x I m a g e %
1095% %
1096% %
1097% %
1098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1099%
1100% MagickChannelFxImage() applies a channel expression to the specified image.
1101% The expression consists of one or more channels, either mnemonic or numeric
1102% (e.g. red, 1), separated by actions as follows:
1103%
1104% <=> exchange two channels (e.g. red<=>blue)
1105% => transfer a channel to another (e.g. red=>green)
1106% , separate channel operations (e.g. red, green)
1107% | read channels from next input image (e.g. red | green)
1108% ; write channels to next output image (e.g. red; green; blue)
1109%
1110% A channel without a operation symbol implies extract. For example, to create
1111% 3 grayscale images from the red, green, and blue channels of an image, use:
1112%
1113% -channel-fx "red; green; blue"
1114%
1115% The format of the MagickChannelFxImage method is:
1116%
1117% MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1118%
1119% A description of each parameter follows:
1120%
1121% o wand: the magick wand.
1122%
1123% o expression: the expression.
1124%
1125*/
1126WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1127 const char *expression)
1128{
1129 Image
1130 *fx_image;
1131
1132 assert(wand != (MagickWand *) NULL);
1133 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001134 if (IfMagickTrue(wand->debug))
cristy5f257b22012-03-07 00:27:29 +00001135 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1136 if (wand->images == (Image *) NULL)
1137 return((MagickWand *) NULL);
1138 fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1139 if (fx_image == (Image *) NULL)
1140 return((MagickWand *) NULL);
1141 return(CloneMagickWandFromImages(wand,fx_image));
1142}
1143
1144/*
1145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146% %
1147% %
1148% %
cristy3ed852e2009-09-05 21:47:34 +00001149% M a g i c k C h a r c o a l I m a g e %
1150% %
1151% %
1152% %
1153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154%
1155% MagickCharcoalImage() simulates a charcoal drawing.
1156%
1157% The format of the MagickCharcoalImage method is:
1158%
1159% MagickBooleanType MagickCharcoalImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00001160% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00001161%
1162% A description of each parameter follows:
1163%
1164% o wand: the magick wand.
1165%
1166% o radius: the radius of the Gaussian, in pixels, not counting the center
1167% pixel.
1168%
1169% o sigma: the standard deviation of the Gaussian, in pixels.
1170%
1171*/
1172WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00001173 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00001174{
1175 Image
1176 *charcoal_image;
1177
1178 assert(wand != (MagickWand *) NULL);
1179 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001180 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001181 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182 if (wand->images == (Image *) NULL)
1183 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +00001184 charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001185 if (charcoal_image == (Image *) NULL)
1186 return(MagickFalse);
1187 ReplaceImageInList(&wand->images,charcoal_image);
1188 return(MagickTrue);
1189}
1190
1191/*
1192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193% %
1194% %
1195% %
1196% M a g i c k C h o p I m a g e %
1197% %
1198% %
1199% %
1200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201%
1202% MagickChopImage() removes a region of an image and collapses the image to
1203% occupy the removed portion
1204%
1205% The format of the MagickChopImage method is:
1206%
1207% MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001208% const size_t width,const size_t height,const ssize_t x,
1209% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001210%
1211% A description of each parameter follows:
1212%
1213% o wand: the magick wand.
1214%
1215% o width: the region width.
1216%
1217% o height: the region height.
1218%
1219% o x: the region x offset.
1220%
1221% o y: the region y offset.
1222%
1223%
1224*/
1225WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00001226 const size_t width,const size_t height,const ssize_t x,
1227 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001228{
1229 Image
1230 *chop_image;
1231
1232 RectangleInfo
1233 chop;
1234
1235 assert(wand != (MagickWand *) NULL);
1236 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001237 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001238 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239 if (wand->images == (Image *) NULL)
1240 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241 chop.width=width;
1242 chop.height=height;
1243 chop.x=x;
1244 chop.y=y;
1245 chop_image=ChopImage(wand->images,&chop,wand->exception);
1246 if (chop_image == (Image *) NULL)
1247 return(MagickFalse);
1248 ReplaceImageInList(&wand->images,chop_image);
1249 return(MagickTrue);
1250}
1251
1252/*
1253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254% %
1255% %
1256% %
cristy1eb45dd2009-09-25 16:38:06 +00001257% M a g i c k C l a m p I m a g e %
1258% %
1259% %
1260% %
1261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262%
cristyecb0c6d2009-09-25 16:50:09 +00001263% MagickClampImage() restricts the color range from 0 to the quantum depth.
cristy1eb45dd2009-09-25 16:38:06 +00001264%
1265% The format of the MagickClampImage method is:
1266%
1267% MagickBooleanType MagickClampImage(MagickWand *wand)
cristy1eb45dd2009-09-25 16:38:06 +00001268%
1269% A description of each parameter follows:
1270%
1271% o wand: the magick wand.
1272%
1273% o channel: the channel.
1274%
1275*/
cristy1eb45dd2009-09-25 16:38:06 +00001276WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1277{
cristy1eb45dd2009-09-25 16:38:06 +00001278 assert(wand != (MagickWand *) NULL);
1279 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001280 if (IfMagickTrue(wand->debug))
cristy1eb45dd2009-09-25 16:38:06 +00001281 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1282 if (wand->images == (Image *) NULL)
1283 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy092d71c2011-10-14 18:01:29 +00001284 return(ClampImage(wand->images,wand->exception));
cristy1eb45dd2009-09-25 16:38:06 +00001285}
1286
1287/*
1288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289% %
1290% %
1291% %
cristy3ed852e2009-09-05 21:47:34 +00001292% M a g i c k C l i p I m a g e %
1293% %
1294% %
1295% %
1296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297%
cristycee97112010-05-28 00:44:52 +00001298% MagickClipImage() clips along the first path from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001299% present.
1300%
1301% The format of the MagickClipImage method is:
1302%
1303% MagickBooleanType MagickClipImage(MagickWand *wand)
1304%
1305% A description of each parameter follows:
1306%
1307% o wand: the magick wand.
1308%
1309*/
1310WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1311{
1312 MagickBooleanType
1313 status;
1314
1315 assert(wand != (MagickWand *) NULL);
1316 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001317 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001318 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1319 if (wand->images == (Image *) NULL)
1320 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00001321 status=ClipImage(wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00001322 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001323}
1324
1325/*
1326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1327% %
1328% %
1329% %
1330% M a g i c k C l i p I m a g e P a t h %
1331% %
1332% %
1333% %
1334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1335%
cristycee97112010-05-28 00:44:52 +00001336% MagickClipImagePath() clips along the named paths from the 8BIM profile, if
cristy3ed852e2009-09-05 21:47:34 +00001337% present. Later operations take effect inside the path. Id may be a number
1338% if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1339% path.
1340%
1341% The format of the MagickClipImagePath method is:
1342%
1343% MagickBooleanType MagickClipImagePath(MagickWand *wand,
1344% const char *pathname,const MagickBooleanType inside)
1345%
1346% A description of each parameter follows:
1347%
1348% o wand: the magick wand.
1349%
1350% o pathname: name of clipping path resource. If name is preceded by #, use
1351% clipping path numbered by name.
1352%
1353% o inside: if non-zero, later operations take effect inside clipping path.
1354% Otherwise later operations take effect outside clipping path.
1355%
1356*/
1357WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1358 const char *pathname,const MagickBooleanType inside)
1359{
1360 MagickBooleanType
1361 status;
1362
1363 assert(wand != (MagickWand *) NULL);
1364 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001365 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001366 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1367 if (wand->images == (Image *) NULL)
1368 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00001369 status=ClipImagePath(wand->images,pathname,inside,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00001370 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001371}
1372
1373/*
1374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1375% %
1376% %
1377% %
1378% M a g i c k C l u t I m a g e %
1379% %
1380% %
1381% %
1382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1383%
1384% MagickClutImage() replaces colors in the image from a color lookup table.
1385%
1386% The format of the MagickClutImage method is:
1387%
1388% MagickBooleanType MagickClutImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +00001389% const MagickWand *clut_wand,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00001390%
1391% A description of each parameter follows:
1392%
1393% o wand: the magick wand.
1394%
1395% o clut_image: the clut image.
1396%
cristy5c4e2582011-09-11 19:21:03 +00001397% o method: the pixel interpolation method.
1398%
cristy3ed852e2009-09-05 21:47:34 +00001399*/
cristy3ed852e2009-09-05 21:47:34 +00001400WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +00001401 const MagickWand *clut_wand,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00001402{
1403 MagickBooleanType
1404 status;
1405
cristy3ed852e2009-09-05 21:47:34 +00001406 assert(wand != (MagickWand *) NULL);
1407 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001408 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001409 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1410 if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1411 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +00001412 status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00001413 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001414}
1415
1416/*
1417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418% %
1419% %
1420% %
1421% M a g i c k C o a l e s c e I m a g e s %
1422% %
1423% %
1424% %
1425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426%
1427% MagickCoalesceImages() composites a set of images while respecting any page
1428% offsets and disposal methods. GIF, MIFF, and MNG animation sequences
1429% typically start with an image background and each subsequent image
1430% varies in size and offset. MagickCoalesceImages() returns a new sequence
1431% where each image in the sequence is the same size as the first and
1432% composited with the next image in the sequence.
1433%
1434% The format of the MagickCoalesceImages method is:
1435%
1436% MagickWand *MagickCoalesceImages(MagickWand *wand)
1437%
1438% A description of each parameter follows:
1439%
1440% o wand: the magick wand.
1441%
1442*/
1443WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1444{
1445 Image
1446 *coalesce_image;
1447
1448 assert(wand != (MagickWand *) NULL);
1449 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001450 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001451 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1452 if (wand->images == (Image *) NULL)
1453 return((MagickWand *) NULL);
1454 coalesce_image=CoalesceImages(wand->images,wand->exception);
1455 if (coalesce_image == (Image *) NULL)
1456 return((MagickWand *) NULL);
1457 return(CloneMagickWandFromImages(wand,coalesce_image));
1458}
1459
1460/*
1461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462% %
1463% %
1464% %
1465% M a g i c k C o l o r D e c i s i o n I m a g e %
1466% %
1467% %
1468% %
1469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1470%
1471% MagickColorDecisionListImage() accepts a lightweight Color Correction
1472% Collection (CCC) file which solely contains one or more color corrections
1473% and applies the color correction to the image. Here is a sample CCC file:
1474%
1475% <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1476% <ColorCorrection id="cc03345">
1477% <SOPNode>
1478% <Slope> 0.9 1.2 0.5 </Slope>
1479% <Offset> 0.4 -0.5 0.6 </Offset>
1480% <Power> 1.0 0.8 1.5 </Power>
1481% </SOPNode>
1482% <SATNode>
1483% <Saturation> 0.85 </Saturation>
1484% </SATNode>
1485% </ColorCorrection>
1486% </ColorCorrectionCollection>
1487%
1488% which includes the offset, slope, and power for each of the RGB channels
1489% as well as the saturation.
1490%
1491% The format of the MagickColorDecisionListImage method is:
1492%
1493% MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
cristyf9b81362012-04-25 01:27:01 +00001494% const char *color_correction_collection)
cristy3ed852e2009-09-05 21:47:34 +00001495%
1496% A description of each parameter follows:
1497%
1498% o wand: the magick wand.
1499%
1500% o color_correction_collection: the color correction collection in XML.
1501%
1502*/
1503WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1504 const char *color_correction_collection)
1505{
1506 MagickBooleanType
1507 status;
1508
1509 assert(wand != (MagickWand *) NULL);
1510 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001511 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001512 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1513 if (wand->images == (Image *) NULL)
1514 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy1bfa9f02011-08-11 02:35:43 +00001515 status=ColorDecisionListImage(wand->images,color_correction_collection,
cristy5f49bdb2011-10-16 14:28:56 +00001516 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00001517 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001518}
1519
1520/*
1521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522% %
1523% %
1524% %
1525% M a g i c k C o l o r i z e I m a g e %
1526% %
1527% %
1528% %
1529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1530%
1531% MagickColorizeImage() blends the fill color with each pixel in the image.
1532%
1533% The format of the MagickColorizeImage method is:
1534%
1535% MagickBooleanType MagickColorizeImage(MagickWand *wand,
cristyc7e6ff62011-10-03 13:46:11 +00001536% const PixelWand *colorize,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +00001537%
1538% A description of each parameter follows:
1539%
1540% o wand: the magick wand.
1541%
1542% o colorize: the colorize pixel wand.
1543%
cristyb6a294d2011-10-03 00:55:17 +00001544% o alpha: the alpha pixel wand.
cristy3ed852e2009-09-05 21:47:34 +00001545%
1546*/
1547WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
cristyc7e6ff62011-10-03 13:46:11 +00001548 const PixelWand *colorize,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +00001549{
1550 char
cristyc7e6ff62011-10-03 13:46:11 +00001551 percent_blend[MaxTextExtent];
cristy3ed852e2009-09-05 21:47:34 +00001552
1553 Image
1554 *colorize_image;
1555
cristyc7e6ff62011-10-03 13:46:11 +00001556 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00001557 target;
1558
1559 assert(wand != (MagickWand *) NULL);
1560 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001561 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001562 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1563 if (wand->images == (Image *) NULL)
1564 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyef6ab862011-10-13 15:56:05 +00001565 GetPixelInfo(wand->images,&target);
cristyc7e6ff62011-10-03 13:46:11 +00001566 if (target.colorspace != CMYKColorspace)
1567 (void) FormatLocaleString(percent_blend,MaxTextExtent,
1568 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1569 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1570 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1571 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1572 PixelGetAlphaQuantum(blend)));
1573 else
1574 (void) FormatLocaleString(percent_blend,MaxTextExtent,
1575 "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1576 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1577 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1578 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1579 PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1580 PixelGetAlphaQuantum(blend)));
cristy445e47d2011-10-03 19:20:51 +00001581 target=PixelGetPixel(colorize);
cristyc7e6ff62011-10-03 13:46:11 +00001582 colorize_image=ColorizeImage(wand->images,percent_blend,&target,
cristy3ed852e2009-09-05 21:47:34 +00001583 wand->exception);
1584 if (colorize_image == (Image *) NULL)
1585 return(MagickFalse);
1586 ReplaceImageInList(&wand->images,colorize_image);
1587 return(MagickTrue);
1588}
1589
1590/*
1591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1592% %
1593% %
1594% %
cristye6365592010-04-02 17:31:23 +00001595% M a g i c k C o l o r M a t r i x I m a g e %
1596% %
1597% %
1598% %
1599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1600%
1601% MagickColorMatrixImage() apply color transformation to an image. The method
1602% permits saturation changes, hue rotation, luminance to alpha, and various
1603% other effects. Although variable-sized transformation matrices can be used,
1604% typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1605% (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1606% except offsets are in column 6 rather than 5 (in support of CMYKA images)
1607% and offsets are normalized (divide Flash offset by 255).
1608%
1609% The format of the MagickColorMatrixImage method is:
1610%
1611% MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1612% const KernelInfo *color_matrix)
1613%
1614% A description of each parameter follows:
1615%
1616% o wand: the magick wand.
1617%
1618% o color_matrix: the color matrix.
1619%
1620*/
1621WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1622 const KernelInfo *color_matrix)
1623{
1624 Image
1625 *color_image;
1626
1627 assert(wand != (MagickWand *) NULL);
1628 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001629 if (IfMagickTrue(wand->debug))
cristye6365592010-04-02 17:31:23 +00001630 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1631 if (color_matrix == (const KernelInfo *) NULL)
1632 return(MagickFalse);
1633 if (wand->images == (Image *) NULL)
1634 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1635 color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1636 if (color_image == (Image *) NULL)
1637 return(MagickFalse);
1638 ReplaceImageInList(&wand->images,color_image);
1639 return(MagickTrue);
1640}
1641
1642/*
1643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1644% %
1645% %
1646% %
cristy3ed852e2009-09-05 21:47:34 +00001647% M a g i c k C o m b i n e I m a g e s %
1648% %
1649% %
1650% %
1651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652%
1653% MagickCombineImages() combines one or more images into a single image. The
1654% grayscale value of the pixels of each image in the sequence is assigned in
1655% order to the specified hannels of the combined image. The typical
1656% ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1657%
1658% The format of the MagickCombineImages method is:
1659%
cristy1ecceec2012-07-04 15:39:10 +00001660% MagickWand *MagickCombineImages(MagickWand *wand,
1661% const ColorspaceType colorspace)
cristy3ed852e2009-09-05 21:47:34 +00001662%
1663% A description of each parameter follows:
1664%
1665% o wand: the magick wand.
1666%
cristy1ecceec2012-07-04 15:39:10 +00001667% o colorspace: the colorspace.
1668%
cristy3ed852e2009-09-05 21:47:34 +00001669*/
cristy1ecceec2012-07-04 15:39:10 +00001670WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1671 const ColorspaceType colorspace)
cristy3ed852e2009-09-05 21:47:34 +00001672{
1673 Image
1674 *combine_image;
1675
1676 assert(wand != (MagickWand *) NULL);
1677 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001678 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001679 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1680 if (wand->images == (Image *) NULL)
1681 return((MagickWand *) NULL);
cristy1ecceec2012-07-04 15:39:10 +00001682 combine_image=CombineImages(wand->images,colorspace,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001683 if (combine_image == (Image *) NULL)
1684 return((MagickWand *) NULL);
1685 return(CloneMagickWandFromImages(wand,combine_image));
1686}
1687
1688/*
1689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1690% %
1691% %
1692% %
1693% M a g i c k C o m m e n t I m a g e %
1694% %
1695% %
1696% %
1697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1698%
1699% MagickCommentImage() adds a comment to your image.
1700%
1701% The format of the MagickCommentImage method is:
1702%
1703% MagickBooleanType MagickCommentImage(MagickWand *wand,
1704% const char *comment)
1705%
1706% A description of each parameter follows:
1707%
1708% o wand: the magick wand.
1709%
1710% o comment: the image comment.
1711%
1712*/
1713WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1714 const char *comment)
1715{
1716 MagickBooleanType
1717 status;
1718
1719 assert(wand != (MagickWand *) NULL);
1720 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001721 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001722 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1723 if (wand->images == (Image *) NULL)
1724 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd15e6592011-10-15 00:13:06 +00001725 status=SetImageProperty(wand->images,"comment",comment,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00001726 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001727}
1728
1729/*
1730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1731% %
1732% %
1733% %
cristy3ed852e2009-09-05 21:47:34 +00001734% M a g i c k C o m p a r e I m a g e L a y e r s %
1735% %
1736% %
1737% %
1738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1739%
cristy8a9106f2011-07-05 14:39:26 +00001740% MagickCompareImagesLayers() compares each image with the next in a sequence
cristy3ed852e2009-09-05 21:47:34 +00001741% and returns the maximum bounding region of any pixel differences it
1742% discovers.
1743%
cristy8a9106f2011-07-05 14:39:26 +00001744% The format of the MagickCompareImagesLayers method is:
cristy3ed852e2009-09-05 21:47:34 +00001745%
cristy8a9106f2011-07-05 14:39:26 +00001746% MagickWand *MagickCompareImagesLayers(MagickWand *wand,
cristya0417062012-09-02 23:34:56 +00001747% const LayerMethod method)
cristy3ed852e2009-09-05 21:47:34 +00001748%
1749% A description of each parameter follows:
1750%
1751% o wand: the magick wand.
1752%
1753% o method: the compare method.
1754%
1755*/
cristy8a9106f2011-07-05 14:39:26 +00001756WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
cristya0417062012-09-02 23:34:56 +00001757 const LayerMethod method)
cristy3ed852e2009-09-05 21:47:34 +00001758{
1759 Image
1760 *layers_image;
1761
1762 assert(wand != (MagickWand *) NULL);
1763 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001764 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001765 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1766 if (wand->images == (Image *) NULL)
1767 return((MagickWand *) NULL);
cristy8a9106f2011-07-05 14:39:26 +00001768 layers_image=CompareImagesLayers(wand->images,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001769 if (layers_image == (Image *) NULL)
1770 return((MagickWand *) NULL);
1771 return(CloneMagickWandFromImages(wand,layers_image));
1772}
1773
1774/*
1775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1776% %
1777% %
1778% %
1779% M a g i c k C o m p a r e I m a g e s %
1780% %
1781% %
1782% %
1783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1784%
1785% MagickCompareImages() compares an image to a reconstructed image and returns
1786% the specified difference image.
1787%
1788% The format of the MagickCompareImages method is:
1789%
1790% MagickWand *MagickCompareImages(MagickWand *wand,
1791% const MagickWand *reference,const MetricType metric,
1792% double *distortion)
1793%
1794% A description of each parameter follows:
1795%
1796% o wand: the magick wand.
1797%
1798% o reference: the reference wand.
1799%
1800% o metric: the metric.
1801%
1802% o distortion: the computed distortion between the images.
1803%
1804*/
1805WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1806 const MagickWand *reference,const MetricType metric,double *distortion)
1807{
1808 Image
1809 *compare_image;
1810
1811
1812 assert(wand != (MagickWand *) NULL);
1813 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001814 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001815 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1816 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1817 {
1818 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00001819 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00001820 return((MagickWand *) NULL);
1821 }
1822 compare_image=CompareImages(wand->images,reference->images,metric,distortion,
cristy5f49bdb2011-10-16 14:28:56 +00001823 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00001824 if (compare_image == (Image *) NULL)
1825 return((MagickWand *) NULL);
1826 return(CloneMagickWandFromImages(wand,compare_image));
1827}
1828
1829/*
1830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1831% %
1832% %
1833% %
1834% M a g i c k C o m p o s i t e I m a g e %
1835% %
1836% %
1837% %
1838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1839%
1840% MagickCompositeImage() composite one image onto another at the specified
1841% offset.
1842%
1843% The format of the MagickCompositeImage method is:
1844%
1845% MagickBooleanType MagickCompositeImage(MagickWand *wand,
anthonye5840b22012-03-17 12:22:34 +00001846% const MagickWand *source_wand,const CompositeOperator compose,
cristyfeb3e962012-03-29 17:25:55 +00001847% const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001848%
1849% A description of each parameter follows:
1850%
anthonye5840b22012-03-17 12:22:34 +00001851% o wand: the magick wand holding the destination images
cristy3ed852e2009-09-05 21:47:34 +00001852%
anthonye5840b22012-03-17 12:22:34 +00001853% o source_image: the magick wand holding source image.
cristy3ed852e2009-09-05 21:47:34 +00001854%
1855% o compose: This operator affects how the composite is applied to the
anthonye5840b22012-03-17 12:22:34 +00001856% image. The default is Over. These are some of the compose methods
1857% availble.
cristy3ed852e2009-09-05 21:47:34 +00001858%
1859% OverCompositeOp InCompositeOp OutCompositeOp
1860% AtopCompositeOp XorCompositeOp PlusCompositeOp
1861% MinusCompositeOp AddCompositeOp SubtractCompositeOp
1862% DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1863% DisplaceCompositeOp
1864%
cristyfeb3e962012-03-29 17:25:55 +00001865% o clip_to_self: set to MagickTrue to limit composition to area composed.
1866%
cristy3ed852e2009-09-05 21:47:34 +00001867% o x: the column offset of the composited image.
1868%
1869% o y: the row offset of the composited image.
1870%
1871*/
cristy3ed852e2009-09-05 21:47:34 +00001872WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
anthonye5840b22012-03-17 12:22:34 +00001873 const MagickWand *source_wand,const CompositeOperator compose,
cristyfeb3e962012-03-29 17:25:55 +00001874 const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00001875{
1876 MagickBooleanType
1877 status;
1878
1879 assert(wand != (MagickWand *) NULL);
1880 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001881 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00001882 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1883 if ((wand->images == (Image *) NULL) ||
anthonye5840b22012-03-17 12:22:34 +00001884 (source_wand->images == (Image *) NULL))
cristy3ed852e2009-09-05 21:47:34 +00001885 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyfeb3e962012-03-29 17:25:55 +00001886 status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1887 x,y,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00001888 return(status);
cristy3ed852e2009-09-05 21:47:34 +00001889}
1890
1891/*
1892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1893% %
1894% %
1895% %
anthonye5840b22012-03-17 12:22:34 +00001896% M a g i c k C o m p o s i t e L a y e r s %
1897% %
1898% %
1899% %
1900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901%
1902% MagickCompositeLayers() composite the images in the source wand over the
1903% images in the destination wand in sequence, starting with the current
1904% image in both lists.
1905%
1906% Each layer from the two image lists are composted together until the end of
1907% one of the image lists is reached. The offset of each composition is also
1908% adjusted to match the virtual canvas offsets of each layer. As such the
1909% given offset is relative to the virtual canvas, and not the actual image.
1910%
1911% Composition uses given x and y offsets, as the 'origin' location of the
1912% source images virtual canvas (not the real image) allowing you to compose a
1913% list of 'layer images' into the destiantioni images. This makes it well
1914% sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1915% Animations' onto a static or other 'Coaleased Animation' destination image
1916% list. GIF disposal handling is not looked at.
1917%
1918% Special case:- If one of the image sequences is the last image (just a
1919% single image remaining), that image is repeatally composed with all the
1920% images in the other image list. Either the source or destination lists may
1921% be the single image, for this situation.
1922%
1923% In the case of a single destination image (or last image given), that image
1924% will ve cloned to match the number of images remaining in the source image
1925% list.
1926%
1927% This is equivelent to the "-layer Composite" Shell API operator.
1928%
1929% The format of the MagickCompositeLayers method is:
1930%
1931% MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1932% const MagickWand *source_wand, const CompositeOperator compose,
1933% const ssize_t x,const ssize_t y)
1934%
1935% A description of each parameter follows:
1936%
1937% o wand: the magick wand holding destaintion images
1938%
1939% o source_wand: the wand holding the source images
1940%
1941% o compose, x, y: composition arguments
1942%
1943*/
1944WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1945 const MagickWand *source_wand,const CompositeOperator compose,
1946 const ssize_t x,const ssize_t y)
1947{
1948 MagickBooleanType
1949 status;
1950
1951 assert(wand != (MagickWand *) NULL);
1952 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001953 if (IfMagickTrue(wand->debug))
anthonye5840b22012-03-17 12:22:34 +00001954 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1955 if ((wand->images == (Image *) NULL) ||
1956 (source_wand->images == (Image *) NULL))
1957 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5221b602012-10-30 18:02:55 +00001958 CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
anthonye5840b22012-03-17 12:22:34 +00001959 status=MagickTrue; /* FUTURE: determine status from exceptions */
cristy220c4d52013-11-27 19:31:32 +00001960 return(status);
anthonye5840b22012-03-17 12:22:34 +00001961}
1962
1963/*
1964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1965% %
1966% %
1967% %
cristy3ed852e2009-09-05 21:47:34 +00001968% M a g i c k C o n t r a s t I m a g e %
1969% %
1970% %
1971% %
1972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1973%
1974% MagickContrastImage() enhances the intensity differences between the lighter
1975% and darker elements of the image. Set sharpen to a value other than 0 to
1976% increase the image contrast otherwise the contrast is reduced.
1977%
1978% The format of the MagickContrastImage method is:
1979%
1980% MagickBooleanType MagickContrastImage(MagickWand *wand,
1981% const MagickBooleanType sharpen)
1982%
1983% A description of each parameter follows:
1984%
1985% o wand: the magick wand.
1986%
1987% o sharpen: Increase or decrease image contrast.
1988%
1989%
1990*/
1991WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1992 const MagickBooleanType sharpen)
1993{
1994 MagickBooleanType
1995 status;
1996
1997 assert(wand != (MagickWand *) NULL);
1998 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00001999 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002000 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2001 if (wand->images == (Image *) NULL)
2002 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002003 status=ContrastImage(wand->images,sharpen,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002004 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002005}
2006
2007/*
2008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2009% %
2010% %
2011% %
2012% 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 %
2013% %
2014% %
2015% %
2016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017%
2018% MagickContrastStretchImage() enhances the contrast of a color image by
2019% adjusting the pixels color to span the entire range of colors available.
2020% You can also reduce the influence of a particular channel with a gamma
2021% value of 0.
2022%
2023% The format of the MagickContrastStretchImage method is:
2024%
2025% MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2026% const double black_point,const double white_point)
cristy3ed852e2009-09-05 21:47:34 +00002027%
2028% A description of each parameter follows:
2029%
2030% o wand: the magick wand.
2031%
cristy3ed852e2009-09-05 21:47:34 +00002032% o black_point: the black point.
2033%
2034% o white_point: the white point.
2035%
2036*/
cristy3ed852e2009-09-05 21:47:34 +00002037WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2038 const double black_point,const double white_point)
2039{
2040 MagickBooleanType
2041 status;
2042
cristy3ed852e2009-09-05 21:47:34 +00002043 assert(wand != (MagickWand *) NULL);
2044 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002045 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002046 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2047 if (wand->images == (Image *) NULL)
2048 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00002049 status=ContrastStretchImage(wand->images,black_point,white_point,
cristy5f49bdb2011-10-16 14:28:56 +00002050 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002051 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002052}
2053
2054/*
2055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2056% %
2057% %
2058% %
2059% M a g i c k C o n v o l v e I m a g e %
2060% %
2061% %
2062% %
2063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2064%
2065% MagickConvolveImage() applies a custom convolution kernel to the image.
2066%
2067% The format of the MagickConvolveImage method is:
2068%
2069% MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00002070% const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00002071%
2072% A description of each parameter follows:
2073%
2074% o wand: the magick wand.
2075%
cristy3ed852e2009-09-05 21:47:34 +00002076% o kernel: An array of doubles representing the convolution kernel.
2077%
2078*/
cristy3ed852e2009-09-05 21:47:34 +00002079WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00002080 const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00002081{
cristy3ed852e2009-09-05 21:47:34 +00002082 Image
cristy5e6be1e2011-07-16 01:23:39 +00002083 *filter_image;
cristy3ed852e2009-09-05 21:47:34 +00002084
2085 assert(wand != (MagickWand *) NULL);
2086 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002087 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002088 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00002089 if (kernel == (const KernelInfo *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00002090 return(MagickFalse);
2091 if (wand->images == (Image *) NULL)
2092 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00002093 filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2094 if (filter_image == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00002095 return(MagickFalse);
cristy5e6be1e2011-07-16 01:23:39 +00002096 ReplaceImageInList(&wand->images,filter_image);
cristy3ed852e2009-09-05 21:47:34 +00002097 return(MagickTrue);
2098}
2099
2100/*
2101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2102% %
2103% %
2104% %
2105% M a g i c k C r o p I m a g e %
2106% %
2107% %
2108% %
2109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2110%
2111% MagickCropImage() extracts a region of the image.
2112%
2113% The format of the MagickCropImage method is:
2114%
2115% MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00002116% const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002117%
2118% A description of each parameter follows:
2119%
2120% o wand: the magick wand.
2121%
2122% o width: the region width.
2123%
2124% o height: the region height.
2125%
2126% o x: the region x-offset.
2127%
2128% o y: the region y-offset.
2129%
2130*/
2131WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00002132 const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002133{
2134 Image
2135 *crop_image;
2136
2137 RectangleInfo
2138 crop;
2139
2140 assert(wand != (MagickWand *) NULL);
2141 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002142 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002143 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2144 if (wand->images == (Image *) NULL)
2145 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2146 crop.width=width;
2147 crop.height=height;
2148 crop.x=x;
2149 crop.y=y;
2150 crop_image=CropImage(wand->images,&crop,wand->exception);
2151 if (crop_image == (Image *) NULL)
2152 return(MagickFalse);
2153 ReplaceImageInList(&wand->images,crop_image);
2154 return(MagickTrue);
2155}
2156
2157/*
2158%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2159% %
2160% %
2161% %
2162% M a g i c k C y c l e C o l o r m a p I m a g e %
2163% %
2164% %
2165% %
2166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2167%
2168% MagickCycleColormapImage() displaces an image's colormap by a given number
2169% of positions. If you cycle the colormap a number of times you can produce
2170% a psychodelic effect.
2171%
2172% The format of the MagickCycleColormapImage method is:
2173%
2174% MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002175% const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002176%
2177% A description of each parameter follows:
2178%
2179% o wand: the magick wand.
2180%
2181% o pixel_wand: the pixel wand.
2182%
2183*/
2184WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002185 const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002186{
2187 MagickBooleanType
2188 status;
2189
2190 assert(wand != (MagickWand *) NULL);
2191 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002192 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002193 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2194 if (wand->images == (Image *) NULL)
2195 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00002196 status=CycleColormapImage(wand->images,displace,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002197 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002198}
2199
2200/*
2201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2202% %
2203% %
2204% %
2205% M a g i c k C o n s t i t u t e I m a g e %
2206% %
2207% %
2208% %
2209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2210%
2211% MagickConstituteImage() adds an image to the wand comprised of the pixel
2212% data you supply. The pixel data must be in scanline order top-to-bottom.
2213% The data can be char, short int, int, float, or double. Float and double
2214% require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2215% is the maximum value the type can accomodate (e.g. 255 for char). For
2216% example, to create a 640x480 image from unsigned red-green-blue character
2217% data, use
2218%
2219% MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2220%
2221% The format of the MagickConstituteImage method is:
2222%
2223% MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002224% const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002225% const StorageType storage,void *pixels)
2226%
2227% A description of each parameter follows:
2228%
2229% o wand: the magick wand.
2230%
2231% o columns: width in pixels of the image.
2232%
2233% o rows: height in pixels of the image.
2234%
2235% o map: This string reflects the expected ordering of the pixel array.
2236% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00002237% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00002238% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2239% P = pad.
2240%
2241% o storage: Define the data type of the pixels. Float and double types are
2242% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2243% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2244% LongPixel, QuantumPixel, or ShortPixel.
2245%
2246% o pixels: This array of values contain the pixel components as defined by
2247% map and type. You must preallocate this array where the expected
2248% length varies depending on the values of width, height, map, and type.
2249%
2250%
2251*/
2252WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002253 const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002254 const StorageType storage,const void *pixels)
2255{
2256 Image
2257 *images;
2258
2259 assert(wand != (MagickWand *) NULL);
2260 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002261 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002262 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2263 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2264 if (images == (Image *) NULL)
2265 return(MagickFalse);
2266 return(InsertImageInWand(wand,images));
2267}
2268
2269/*
2270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2271% %
2272% %
2273% %
2274% M a g i c k D e c i p h e r I m a g e %
2275% %
2276% %
2277% %
2278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2279%
2280% MagickDecipherImage() converts cipher pixels to plain pixels.
2281%
2282% The format of the MagickDecipherImage method is:
2283%
2284% MagickBooleanType MagickDecipherImage(MagickWand *wand,
2285% const char *passphrase)
2286%
2287% A description of each parameter follows:
2288%
2289% o wand: the magick wand.
2290%
2291% o passphrase: the passphrase.
2292%
2293*/
2294WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2295 const char *passphrase)
2296{
2297 assert(wand != (MagickWand *) NULL);
2298 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002299 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002300 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2301 if (wand->images == (Image *) NULL)
2302 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002303 return(DecipherImage(wand->images,passphrase,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00002304}
2305
2306/*
2307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2308% %
2309% %
2310% %
2311% M a g i c k D e c o n s t r u c t I m a g e s %
2312% %
2313% %
2314% %
2315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2316%
2317% MagickDeconstructImages() compares each image with the next in a sequence
2318% and returns the maximum bounding region of any pixel differences it
2319% discovers.
2320%
2321% The format of the MagickDeconstructImages method is:
2322%
2323% MagickWand *MagickDeconstructImages(MagickWand *wand)
2324%
2325% A description of each parameter follows:
2326%
2327% o wand: the magick wand.
2328%
2329*/
2330WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2331{
2332 Image
2333 *deconstruct_image;
2334
2335 assert(wand != (MagickWand *) NULL);
2336 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002337 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002338 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2339 if (wand->images == (Image *) NULL)
2340 return((MagickWand *) NULL);
cristy8a9106f2011-07-05 14:39:26 +00002341 deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
cristy4c08aed2011-07-01 19:47:50 +00002342 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002343 if (deconstruct_image == (Image *) NULL)
2344 return((MagickWand *) NULL);
2345 return(CloneMagickWandFromImages(wand,deconstruct_image));
2346}
2347
2348/*
2349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2350% %
2351% %
2352% %
2353% M a g i c k D e s k e w I m a g e %
2354% %
2355% %
2356% %
2357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2358%
2359% MagickDeskewImage() removes skew from the image. Skew is an artifact that
2360% occurs in scanned images because of the camera being misaligned,
2361% imperfections in the scanning or surface, or simply because the paper was
2362% not placed completely flat when scanned.
2363%
2364% The format of the MagickDeskewImage method is:
2365%
2366% MagickBooleanType MagickDeskewImage(MagickWand *wand,
2367% const double threshold)
2368%
2369% A description of each parameter follows:
2370%
2371% o wand: the magick wand.
2372%
2373% o threshold: separate background from foreground.
2374%
2375*/
2376WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2377 const double threshold)
2378{
2379 Image
2380 *sepia_image;
2381
2382 assert(wand != (MagickWand *) NULL);
2383 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002384 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002385 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2386 if (wand->images == (Image *) NULL)
2387 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2388 sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2389 if (sepia_image == (Image *) NULL)
2390 return(MagickFalse);
2391 ReplaceImageInList(&wand->images,sepia_image);
2392 return(MagickTrue);
2393}
2394
2395/*
2396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2397% %
2398% %
2399% %
2400% M a g i c k D e s p e c k l e I m a g e %
2401% %
2402% %
2403% %
2404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2405%
2406% MagickDespeckleImage() reduces the speckle noise in an image while
2407% perserving the edges of the original image.
2408%
2409% The format of the MagickDespeckleImage method is:
2410%
2411% MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2412%
2413% A description of each parameter follows:
2414%
2415% o wand: the magick wand.
2416%
2417*/
2418WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2419{
2420 Image
2421 *despeckle_image;
2422
2423 assert(wand != (MagickWand *) NULL);
2424 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002425 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002426 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2427 if (wand->images == (Image *) NULL)
2428 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2429 despeckle_image=DespeckleImage(wand->images,wand->exception);
2430 if (despeckle_image == (Image *) NULL)
2431 return(MagickFalse);
2432 ReplaceImageInList(&wand->images,despeckle_image);
2433 return(MagickTrue);
2434}
2435
2436/*
2437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2438% %
2439% %
2440% %
2441% M a g i c k D e s t r o y I m a g e %
2442% %
2443% %
2444% %
2445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2446%
2447% MagickDestroyImage() dereferences an image, deallocating memory associated
2448% with the image if the reference count becomes zero.
2449%
2450% The format of the MagickDestroyImage method is:
2451%
2452% Image *MagickDestroyImage(Image *image)
2453%
2454% A description of each parameter follows:
2455%
2456% o image: the image.
2457%
2458*/
2459WandExport Image *MagickDestroyImage(Image *image)
2460{
2461 return(DestroyImage(image));
2462}
2463
2464/*
2465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2466% %
2467% %
2468% %
2469% M a g i c k D i s p l a y I m a g e %
2470% %
2471% %
2472% %
2473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2474%
2475% MagickDisplayImage() displays an image.
2476%
2477% The format of the MagickDisplayImage method is:
2478%
2479% MagickBooleanType MagickDisplayImage(MagickWand *wand,
2480% const char *server_name)
2481%
2482% A description of each parameter follows:
2483%
2484% o wand: the magick wand.
2485%
2486% o server_name: the X server name.
2487%
2488*/
2489WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2490 const char *server_name)
2491{
2492 Image
2493 *image;
2494
2495 MagickBooleanType
2496 status;
2497
2498 assert(wand != (MagickWand *) NULL);
2499 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002500 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002501 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2502 if (wand->images == (Image *) NULL)
2503 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2504 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2505 if (image == (Image *) NULL)
2506 return(MagickFalse);
2507 (void) CloneString(&wand->image_info->server_name,server_name);
cristy5f49bdb2011-10-16 14:28:56 +00002508 status=DisplayImages(wand->image_info,image,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002509 image=DestroyImage(image);
cristy220c4d52013-11-27 19:31:32 +00002510 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002511}
2512
2513/*
2514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2515% %
2516% %
2517% %
2518% M a g i c k D i s p l a y I m a g e s %
2519% %
2520% %
2521% %
2522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2523%
2524% MagickDisplayImages() displays an image or image sequence.
2525%
2526% The format of the MagickDisplayImages method is:
2527%
2528% MagickBooleanType MagickDisplayImages(MagickWand *wand,
2529% const char *server_name)
2530%
2531% A description of each parameter follows:
2532%
2533% o wand: the magick wand.
2534%
2535% o server_name: the X server name.
2536%
2537*/
2538WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2539 const char *server_name)
2540{
2541 MagickBooleanType
2542 status;
2543
2544 assert(wand != (MagickWand *) NULL);
2545 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002546 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002547 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2548 (void) CloneString(&wand->image_info->server_name,server_name);
cristy5f49bdb2011-10-16 14:28:56 +00002549 status=DisplayImages(wand->image_info,wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002550 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002551}
2552
2553/*
2554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555% %
2556% %
2557% %
2558% M a g i c k D i s t o r t I m a g e %
2559% %
2560% %
2561% %
2562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563%
2564% MagickDistortImage() distorts an image using various distortion methods, by
2565% mapping color lookups of the source image to a new destination image
2566% usally of the same size as the source image, unless 'bestfit' is set to
2567% true.
2568%
2569% If 'bestfit' is enabled, and distortion allows it, the destination image is
2570% adjusted to ensure the whole source 'image' will just fit within the final
2571% destination image, which will be sized and offset accordingly. Also in
2572% many cases the virtual offset of the source image will be taken into
2573% account in the mapping.
2574%
2575% The format of the MagickDistortImage method is:
2576%
2577% MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002578% const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002579% const double *arguments,const MagickBooleanType bestfit)
2580%
2581% A description of each parameter follows:
2582%
2583% o image: the image to be distorted.
2584%
2585% o method: the method of image distortion.
2586%
2587% ArcDistortion always ignores the source image offset, and always
2588% 'bestfit' the destination image with the top left corner offset
2589% relative to the polar mapping center.
2590%
2591% Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2592% style of image distortion.
2593%
2594% Affine, Perspective, and Bilinear, do least squares fitting of the
2595% distortion when more than the minimum number of control point pairs
2596% are provided.
2597%
2598% Perspective, and Bilinear, falls back to a Affine distortion when less
2599% that 4 control point pairs are provided. While Affine distortions let
2600% you use any number of control point pairs, that is Zero pairs is a
2601% no-Op (viewport only) distrotion, one pair is a translation and two
2602% pairs of control points do a scale-rotate-translate, without any
2603% shearing.
2604%
2605% o number_arguments: the number of arguments given for this distortion
2606% method.
2607%
2608% o arguments: the arguments for this distortion method.
2609%
2610% o bestfit: Attempt to resize destination to fit distorted source.
2611%
2612*/
2613WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002614 const DistortImageMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002615 const double *arguments,const MagickBooleanType bestfit)
2616{
2617 Image
2618 *distort_image;
2619
2620 assert(wand != (MagickWand *) NULL);
2621 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002622 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002623 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2624 if (wand->images == (Image *) NULL)
2625 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2626 distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2627 bestfit,wand->exception);
2628 if (distort_image == (Image *) NULL)
2629 return(MagickFalse);
2630 ReplaceImageInList(&wand->images,distort_image);
2631 return(MagickTrue);
2632}
2633
2634/*
2635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2636% %
2637% %
2638% %
2639% M a g i c k D r a w I m a g e %
2640% %
2641% %
2642% %
2643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2644%
2645% MagickDrawImage() renders the drawing wand on the current image.
2646%
2647% The format of the MagickDrawImage method is:
2648%
2649% MagickBooleanType MagickDrawImage(MagickWand *wand,
2650% const DrawingWand *drawing_wand)
2651%
2652% A description of each parameter follows:
2653%
2654% o wand: the magick wand.
2655%
2656% o drawing_wand: the draw wand.
2657%
2658*/
2659WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2660 const DrawingWand *drawing_wand)
2661{
2662 char
2663 *primitive;
2664
2665 DrawInfo
2666 *draw_info;
2667
2668 MagickBooleanType
2669 status;
2670
2671 assert(wand != (MagickWand *) NULL);
2672 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002673 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002674 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2675 if (wand->images == (Image *) NULL)
2676 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2677 draw_info=PeekDrawingWand(drawing_wand);
2678 if ((draw_info == (DrawInfo *) NULL) ||
2679 (draw_info->primitive == (char *) NULL))
2680 return(MagickFalse);
2681 primitive=AcquireString(draw_info->primitive);
2682 draw_info=DestroyDrawInfo(draw_info);
2683 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2684 draw_info->primitive=primitive;
cristy018f07f2011-09-04 21:15:19 +00002685 status=DrawImage(wand->images,draw_info,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002686 draw_info=DestroyDrawInfo(draw_info);
cristy220c4d52013-11-27 19:31:32 +00002687 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002688}
2689
2690/*
2691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2692% %
2693% %
2694% %
2695% M a g i c k E d g e I m a g e %
2696% %
2697% %
2698% %
2699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2700%
2701% MagickEdgeImage() enhance edges within the image with a convolution filter
2702% of the given radius. Use a radius of 0 and Edge() selects a suitable
2703% radius for you.
2704%
2705% The format of the MagickEdgeImage method is:
2706%
cristy9dc4c512013-03-24 01:38:00 +00002707% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
cristy3ed852e2009-09-05 21:47:34 +00002708%
2709% A description of each parameter follows:
2710%
2711% o wand: the magick wand.
2712%
2713% o radius: the radius of the pixel neighborhood.
2714%
2715*/
2716WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
cristy9dc4c512013-03-24 01:38:00 +00002717 const double radius)
cristy3ed852e2009-09-05 21:47:34 +00002718{
2719 Image
2720 *edge_image;
2721
2722 assert(wand != (MagickWand *) NULL);
2723 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002724 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002725 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2726 if (wand->images == (Image *) NULL)
2727 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy9dc4c512013-03-24 01:38:00 +00002728 edge_image=EdgeImage(wand->images,radius,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002729 if (edge_image == (Image *) NULL)
2730 return(MagickFalse);
2731 ReplaceImageInList(&wand->images,edge_image);
2732 return(MagickTrue);
2733}
2734
2735/*
2736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2737% %
2738% %
2739% %
2740% M a g i c k E m b o s s I m a g e %
2741% %
2742% %
2743% %
2744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2745%
2746% MagickEmbossImage() returns a grayscale image with a three-dimensional
2747% effect. We convolve the image with a Gaussian operator of the given radius
2748% and standard deviation (sigma). For reasonable results, radius should be
2749% larger than sigma. Use a radius of 0 and Emboss() selects a suitable
2750% radius for you.
2751%
2752% The format of the MagickEmbossImage method is:
2753%
2754% MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2755% const double sigma)
2756%
2757% A description of each parameter follows:
2758%
2759% o wand: the magick wand.
2760%
2761% o radius: the radius of the Gaussian, in pixels, not counting the center
2762% pixel.
2763%
2764% o sigma: the standard deviation of the Gaussian, in pixels.
2765%
2766*/
2767WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2768 const double radius,const double sigma)
2769{
2770 Image
2771 *emboss_image;
2772
2773 assert(wand != (MagickWand *) NULL);
2774 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002775 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002776 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2777 if (wand->images == (Image *) NULL)
2778 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2779 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2780 if (emboss_image == (Image *) NULL)
2781 return(MagickFalse);
2782 ReplaceImageInList(&wand->images,emboss_image);
2783 return(MagickTrue);
2784}
2785
2786/*
2787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2788% %
2789% %
2790% %
2791% M a g i c k E n c i p h e r I m a g e %
2792% %
2793% %
2794% %
2795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2796%
2797% MagickEncipherImage() converts plaint pixels to cipher pixels.
2798%
2799% The format of the MagickEncipherImage method is:
2800%
2801% MagickBooleanType MagickEncipherImage(MagickWand *wand,
2802% const char *passphrase)
2803%
2804% A description of each parameter follows:
2805%
2806% o wand: the magick wand.
2807%
2808% o passphrase: the passphrase.
2809%
2810*/
2811WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2812 const char *passphrase)
2813{
2814 assert(wand != (MagickWand *) NULL);
2815 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002816 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002817 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2818 if (wand->images == (Image *) NULL)
2819 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002820 return(EncipherImage(wand->images,passphrase,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00002821}
2822
2823/*
2824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2825% %
2826% %
2827% %
2828% M a g i c k E n h a n c e I m a g e %
2829% %
2830% %
2831% %
2832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2833%
2834% MagickEnhanceImage() applies a digital filter that improves the quality of a
2835% noisy image.
2836%
2837% The format of the MagickEnhanceImage method is:
2838%
2839% MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2840%
2841% A description of each parameter follows:
2842%
2843% o wand: the magick wand.
2844%
2845*/
2846WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2847{
2848 Image
2849 *enhance_image;
2850
2851 assert(wand != (MagickWand *) NULL);
2852 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002853 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002854 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2855 if (wand->images == (Image *) NULL)
2856 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2857 enhance_image=EnhanceImage(wand->images,wand->exception);
2858 if (enhance_image == (Image *) NULL)
2859 return(MagickFalse);
2860 ReplaceImageInList(&wand->images,enhance_image);
2861 return(MagickTrue);
2862}
2863
2864/*
2865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2866% %
2867% %
2868% %
2869% M a g i c k E q u a l i z e I m a g e %
2870% %
2871% %
2872% %
2873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2874%
2875% MagickEqualizeImage() equalizes the image histogram.
2876%
2877% The format of the MagickEqualizeImage method is:
2878%
2879% MagickBooleanType MagickEqualizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00002880%
2881% A description of each parameter follows:
2882%
2883% o wand: the magick wand.
2884%
2885% o channel: the image channel(s).
2886%
2887*/
cristy3ed852e2009-09-05 21:47:34 +00002888WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2889{
2890 MagickBooleanType
2891 status;
2892
cristy3ed852e2009-09-05 21:47:34 +00002893 assert(wand != (MagickWand *) NULL);
2894 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002895 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002896 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2897 if (wand->images == (Image *) NULL)
2898 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002899 status=EqualizeImage(wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002900 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002901}
2902
2903/*
2904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2905% %
2906% %
2907% %
2908% M a g i c k E v a l u a t e I m a g e %
2909% %
2910% %
2911% %
2912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2913%
2914% MagickEvaluateImage() applys an arithmetic, relational, or logical
2915% expression to an image. Use these operators to lighten or darken an image,
2916% to increase or decrease contrast in an image, or to produce the "negative"
2917% of an image.
2918%
2919% The format of the MagickEvaluateImage method is:
2920%
2921% MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2922% const MagickEvaluateOperator operator,const double value)
cristyd18ae7c2010-03-07 17:39:52 +00002923% MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2924% const MagickEvaluateOperator operator)
cristy3ed852e2009-09-05 21:47:34 +00002925%
2926% A description of each parameter follows:
2927%
2928% o wand: the magick wand.
2929%
cristy3ed852e2009-09-05 21:47:34 +00002930% o op: A channel operator.
2931%
2932% o value: A value value.
2933%
2934*/
2935
cristyd18ae7c2010-03-07 17:39:52 +00002936WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2937 const MagickEvaluateOperator op)
2938{
2939 Image
2940 *evaluate_image;
2941
2942 assert(wand != (MagickWand *) NULL);
2943 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002944 if (IfMagickTrue(wand->debug))
cristyd18ae7c2010-03-07 17:39:52 +00002945 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2946 if (wand->images == (Image *) NULL)
2947 return((MagickWand *) NULL);
2948 evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2949 if (evaluate_image == (Image *) NULL)
2950 return((MagickWand *) NULL);
2951 return(CloneMagickWandFromImages(wand,evaluate_image));
2952}
2953
cristyd42d9952011-07-08 14:21:50 +00002954WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2955 const MagickEvaluateOperator op,const double value)
cristy3ed852e2009-09-05 21:47:34 +00002956{
2957 MagickBooleanType
2958 status;
2959
2960 assert(wand != (MagickWand *) NULL);
2961 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00002962 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00002963 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2964 if (wand->images == (Image *) NULL)
2965 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002966 status=EvaluateImage(wand->images,op,value,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002967 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002968}
2969
2970/*
2971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2972% %
2973% %
2974% %
2975% M a g i c k E x p o r t I m a g e P i x e l s %
2976% %
2977% %
2978% %
2979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2980%
2981% MagickExportImagePixels() extracts pixel data from an image and returns it
2982% to you. The method returns MagickTrue on success otherwise MagickFalse if
2983% an error is encountered. The data is returned as char, short int, int,
cristybb503372010-05-27 20:51:26 +00002984% ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00002985%
2986% Suppose you want to extract the first scanline of a 640x480 image as
2987% character data in red-green-blue order:
2988%
2989% MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2990%
2991% The format of the MagickExportImagePixels method is:
2992%
2993% MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002994% const ssize_t x,const ssize_t y,const size_t columns,
2995% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00002996% void *pixels)
2997%
2998% A description of each parameter follows:
2999%
3000% o wand: the magick wand.
3001%
3002% o x, y, columns, rows: These values define the perimeter
3003% of a region of pixels you want to extract.
3004%
3005% o map: This string reflects the expected ordering of the pixel array.
3006% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00003007% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00003008% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3009% P = pad.
3010%
3011% o storage: Define the data type of the pixels. Float and double types are
3012% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3013% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3014% LongPixel, QuantumPixel, or ShortPixel.
3015%
3016% o pixels: This array of values contain the pixel components as defined by
3017% map and type. You must preallocate this array where the expected
3018% length varies depending on the values of width, height, map, and type.
3019%
3020*/
3021WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003022 const ssize_t x,const ssize_t y,const size_t columns,
3023 const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00003024 void *pixels)
3025{
3026 MagickBooleanType
3027 status;
3028
3029 assert(wand != (MagickWand *) NULL);
3030 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003031 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003032 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3033 if (wand->images == (Image *) NULL)
3034 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3035 status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3036 storage,pixels,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003037 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003038}
3039
3040/*
3041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3042% %
3043% %
3044% %
3045% M a g i c k E x t e n t I m a g e %
3046% %
3047% %
3048% %
3049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3050%
3051% MagickExtentImage() extends the image as defined by the geometry, gravity,
3052% and wand background color. Set the (x,y) offset of the geometry to move
3053% the original wand relative to the extended wand.
3054%
3055% The format of the MagickExtentImage method is:
3056%
cristy01299f02012-01-12 01:11:04 +00003057% MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3058% const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00003059%
3060% A description of each parameter follows:
3061%
3062% o wand: the magick wand.
3063%
3064% o width: the region width.
3065%
3066% o height: the region height.
3067%
3068% o x: the region x offset.
3069%
3070% o y: the region y offset.
3071%
3072*/
3073WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
cristy27cb26f2012-01-12 01:09:25 +00003074 const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00003075{
3076 Image
3077 *extent_image;
3078
3079 RectangleInfo
3080 extent;
3081
3082 assert(wand != (MagickWand *) NULL);
3083 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003084 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003085 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3086 if (wand->images == (Image *) NULL)
3087 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3088 extent.width=width;
3089 extent.height=height;
3090 extent.x=x;
3091 extent.y=y;
3092 extent_image=ExtentImage(wand->images,&extent,wand->exception);
3093 if (extent_image == (Image *) NULL)
3094 return(MagickFalse);
3095 ReplaceImageInList(&wand->images,extent_image);
3096 return(MagickTrue);
3097}
3098
3099/*
3100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3101% %
3102% %
3103% %
3104% M a g i c k F l i p I m a g e %
3105% %
3106% %
3107% %
3108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3109%
3110% MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3111% around the central x-axis.
3112%
3113% The format of the MagickFlipImage method is:
3114%
3115% MagickBooleanType MagickFlipImage(MagickWand *wand)
3116%
3117% A description of each parameter follows:
3118%
3119% o wand: the magick wand.
3120%
3121*/
3122WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3123{
3124 Image
3125 *flip_image;
3126
3127 assert(wand != (MagickWand *) NULL);
3128 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003129 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003130 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3131 if (wand->images == (Image *) NULL)
3132 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3133 flip_image=FlipImage(wand->images,wand->exception);
3134 if (flip_image == (Image *) NULL)
3135 return(MagickFalse);
3136 ReplaceImageInList(&wand->images,flip_image);
3137 return(MagickTrue);
3138}
3139
3140/*
3141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3142% %
3143% %
3144% %
3145% 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 %
3146% %
3147% %
3148% %
3149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3150%
3151% MagickFloodfillPaintImage() changes the color value of any pixel that matches
3152% target and is an immediate neighbor. If the method FillToBorderMethod is
3153% specified, the color value is changed for any neighbor pixel that does not
3154% match the bordercolor member of image.
3155%
3156% The format of the MagickFloodfillPaintImage method is:
3157%
3158% MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00003159% const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3160% const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00003161%
3162% A description of each parameter follows:
3163%
3164% o wand: the magick wand.
3165%
cristy3ed852e2009-09-05 21:47:34 +00003166% o fill: the floodfill color pixel wand.
3167%
3168% o fuzz: By default target must match a particular pixel color
3169% exactly. However, in many cases two colors may differ by a small amount.
3170% The fuzz member of image defines how much tolerance is acceptable to
3171% consider two colors as the same. For example, set fuzz to 10 and the
3172% color red at intensities of 100 and 102 respectively are now interpreted
3173% as the same color for the purposes of the floodfill.
3174%
3175% o bordercolor: the border color pixel wand.
3176%
3177% o x,y: the starting location of the operation.
3178%
3179% o invert: paint any pixel that does not match the target color.
3180%
3181*/
3182WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00003183 const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3184 const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00003185{
3186 DrawInfo
3187 *draw_info;
3188
3189 MagickBooleanType
3190 status;
3191
cristy4c08aed2011-07-01 19:47:50 +00003192 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00003193 target;
3194
3195 assert(wand != (MagickWand *) NULL);
3196 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003197 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003198 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3199 if (wand->images == (Image *) NULL)
3200 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3201 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
cristy4c08aed2011-07-01 19:47:50 +00003202 PixelGetQuantumPacket(fill,&draw_info->fill);
cristy3aa93752011-12-18 15:54:24 +00003203 (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
cristy52010022011-10-21 18:07:37 +00003204 wand->images->columns,y % wand->images->rows,&target,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003205 if (bordercolor != (PixelWand *) NULL)
3206 PixelGetMagickColor(bordercolor,&target);
3207 wand->images->fuzz=fuzz;
cristy189e84c2011-08-27 18:08:53 +00003208 status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
cristy5f49bdb2011-10-16 14:28:56 +00003209 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003210 draw_info=DestroyDrawInfo(draw_info);
cristy220c4d52013-11-27 19:31:32 +00003211 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003212}
3213
3214/*
3215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3216% %
3217% %
3218% %
3219% M a g i c k F l o p I m a g e %
3220% %
3221% %
3222% %
3223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3224%
3225% MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3226% around the central y-axis.
3227%
3228% The format of the MagickFlopImage method is:
3229%
3230% MagickBooleanType MagickFlopImage(MagickWand *wand)
3231%
3232% A description of each parameter follows:
3233%
3234% o wand: the magick wand.
3235%
3236*/
3237WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3238{
3239 Image
3240 *flop_image;
3241
3242 assert(wand != (MagickWand *) NULL);
3243 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003244 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003245 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3246 if (wand->images == (Image *) NULL)
3247 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3248 flop_image=FlopImage(wand->images,wand->exception);
3249 if (flop_image == (Image *) NULL)
3250 return(MagickFalse);
3251 ReplaceImageInList(&wand->images,flop_image);
3252 return(MagickTrue);
3253}
3254
3255/*
3256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3257% %
3258% %
3259% %
3260% 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 %
3261% %
3262% %
3263% %
3264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3265%
3266% MagickForwardFourierTransformImage() implements the discrete Fourier
3267% transform (DFT) of the image either as a magnitude / phase or real /
3268% imaginary image pair.
3269%
3270% The format of the MagickForwardFourierTransformImage method is:
3271%
3272% MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3273% const MagickBooleanType magnitude)
3274%
3275% A description of each parameter follows:
3276%
3277% o wand: the magick wand.
3278%
3279% o magnitude: if true, return as magnitude / phase pair otherwise a real /
3280% imaginary image pair.
3281%
3282*/
3283WandExport MagickBooleanType MagickForwardFourierTransformImage(
3284 MagickWand *wand,const MagickBooleanType magnitude)
3285{
3286 Image
3287 *forward_image;
3288
3289 assert(wand != (MagickWand *) NULL);
3290 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003291 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003292 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3293 if (wand->images == (Image *) NULL)
3294 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3295 forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3296 wand->exception);
3297 if (forward_image == (Image *) NULL)
3298 return(MagickFalse);
3299 ReplaceImageInList(&wand->images,forward_image);
3300 return(MagickTrue);
3301}
3302
3303/*
3304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3305% %
3306% %
3307% %
3308% M a g i c k F r a m e I m a g e %
3309% %
3310% %
3311% %
3312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3313%
3314% MagickFrameImage() adds a simulated three-dimensional border around the
3315% image. The width and height specify the border width of the vertical and
3316% horizontal sides of the frame. The inner and outer bevels indicate the
3317% width of the inner and outer shadows of the frame.
3318%
3319% The format of the MagickFrameImage method is:
3320%
3321% MagickBooleanType MagickFrameImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003322% const PixelWand *matte_color,const size_t width,
3323% const size_t height,const ssize_t inner_bevel,
cristy633f0c62011-09-15 13:27:36 +00003324% const ssize_t outer_bevel,const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00003325%
3326% A description of each parameter follows:
3327%
3328% o wand: the magick wand.
3329%
3330% o matte_color: the frame color pixel wand.
3331%
3332% o width: the border width.
3333%
3334% o height: the border height.
3335%
3336% o inner_bevel: the inner bevel width.
3337%
3338% o outer_bevel: the outer bevel width.
3339%
cristy633f0c62011-09-15 13:27:36 +00003340% o compose: the composite operator.
3341%
cristy3ed852e2009-09-05 21:47:34 +00003342*/
3343WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
cristy633f0c62011-09-15 13:27:36 +00003344 const PixelWand *matte_color,const size_t width,const size_t height,
3345 const ssize_t inner_bevel,const ssize_t outer_bevel,
3346 const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00003347{
3348 Image
3349 *frame_image;
3350
3351 FrameInfo
3352 frame_info;
3353
3354 assert(wand != (MagickWand *) NULL);
3355 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003356 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003357 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3358 if (wand->images == (Image *) NULL)
3359 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3360 (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3361 frame_info.width=wand->images->columns+2*width;
3362 frame_info.height=wand->images->rows+2*height;
cristybb503372010-05-27 20:51:26 +00003363 frame_info.x=(ssize_t) width;
3364 frame_info.y=(ssize_t) height;
cristy3ed852e2009-09-05 21:47:34 +00003365 frame_info.inner_bevel=inner_bevel;
3366 frame_info.outer_bevel=outer_bevel;
cristy4c08aed2011-07-01 19:47:50 +00003367 PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
cristy633f0c62011-09-15 13:27:36 +00003368 frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003369 if (frame_image == (Image *) NULL)
3370 return(MagickFalse);
3371 ReplaceImageInList(&wand->images,frame_image);
3372 return(MagickTrue);
3373}
3374
3375/*
3376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3377% %
3378% %
3379% %
3380% M a g i c k F u n c t i o n I m a g e %
3381% %
3382% %
3383% %
3384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3385%
3386% MagickFunctionImage() applys an arithmetic, relational, or logical
3387% expression to an image. Use these operators to lighten or darken an image,
3388% to increase or decrease contrast in an image, or to produce the "negative"
3389% of an image.
3390%
3391% The format of the MagickFunctionImage method is:
3392%
3393% MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003394% const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003395% const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +00003396%
3397% A description of each parameter follows:
3398%
3399% o wand: the magick wand.
3400%
cristy3ed852e2009-09-05 21:47:34 +00003401% o function: the image function.
3402%
3403% o number_arguments: the number of function arguments.
3404%
3405% o arguments: the function arguments.
3406%
3407*/
cristy3ed852e2009-09-05 21:47:34 +00003408WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003409 const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003410 const double *arguments)
3411{
3412 MagickBooleanType
3413 status;
3414
3415 assert(wand != (MagickWand *) NULL);
3416 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003417 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003418 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3419 if (wand->images == (Image *) NULL)
3420 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3421 status=FunctionImage(wand->images,function,number_arguments,arguments,
cristy5f49bdb2011-10-16 14:28:56 +00003422 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003423 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003424}
3425
3426/*
3427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3428% %
3429% %
3430% %
3431% M a g i c k F x I m a g e %
3432% %
3433% %
3434% %
3435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3436%
3437% MagickFxImage() evaluate expression for each pixel in the image.
3438%
3439% The format of the MagickFxImage method is:
3440%
3441% MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
cristy3ed852e2009-09-05 21:47:34 +00003442%
3443% A description of each parameter follows:
3444%
3445% o wand: the magick wand.
3446%
cristy3ed852e2009-09-05 21:47:34 +00003447% o expression: the expression.
3448%
3449*/
cristy3ed852e2009-09-05 21:47:34 +00003450WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3451{
cristy3ed852e2009-09-05 21:47:34 +00003452 Image
3453 *fx_image;
3454
3455 assert(wand != (MagickWand *) NULL);
3456 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003457 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003458 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3459 if (wand->images == (Image *) NULL)
3460 return((MagickWand *) NULL);
cristy490408a2011-07-07 14:42:05 +00003461 fx_image=FxImage(wand->images,expression,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003462 if (fx_image == (Image *) NULL)
3463 return((MagickWand *) NULL);
3464 return(CloneMagickWandFromImages(wand,fx_image));
3465}
3466
3467/*
3468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3469% %
3470% %
3471% %
3472% M a g i c k G a m m a I m a g e %
3473% %
3474% %
3475% %
3476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3477%
3478% MagickGammaImage() gamma-corrects an image. The same image viewed on
3479% different devices will have perceptual differences in the way the image's
3480% intensities are represented on the screen. Specify individual gamma levels
3481% for the red, green, and blue channels, or adjust all three with the gamma
3482% parameter. Values typically range from 0.8 to 2.3.
3483%
3484% You can also reduce the influence of a particular channel with a gamma
3485% value of 0.
3486%
3487% The format of the MagickGammaImage method is:
3488%
3489% MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
cristy3ed852e2009-09-05 21:47:34 +00003490%
3491% A description of each parameter follows:
3492%
3493% o wand: the magick wand.
3494%
cristy3ed852e2009-09-05 21:47:34 +00003495% o level: Define the level of gamma correction.
3496%
3497*/
cristy3ed852e2009-09-05 21:47:34 +00003498WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3499 const double gamma)
3500{
3501 MagickBooleanType
3502 status;
3503
cristy3ed852e2009-09-05 21:47:34 +00003504 assert(wand != (MagickWand *) NULL);
3505 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003506 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003507 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3508 if (wand->images == (Image *) NULL)
3509 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00003510 status=GammaImage(wand->images,gamma,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003511 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003512}
3513
3514/*
3515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3516% %
3517% %
3518% %
3519% M a g i c k G a u s s i a n B l u r I m a g e %
3520% %
3521% %
3522% %
3523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3524%
3525% MagickGaussianBlurImage() blurs an image. We convolve the image with a
3526% Gaussian operator of the given radius and standard deviation (sigma).
3527% For reasonable results, the radius should be larger than sigma. Use a
3528% radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3529%
3530% The format of the MagickGaussianBlurImage method is:
3531%
3532% MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
cristyd89705a2012-01-20 02:52:24 +00003533% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00003534%
3535% A description of each parameter follows:
3536%
3537% o wand: the magick wand.
3538%
cristy3ed852e2009-09-05 21:47:34 +00003539% o radius: the radius of the Gaussian, in pixels, not counting the center
3540% pixel.
3541%
3542% o sigma: the standard deviation of the Gaussian, in pixels.
3543%
3544*/
cristy3ed852e2009-09-05 21:47:34 +00003545WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
cristyd89705a2012-01-20 02:52:24 +00003546 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00003547{
cristy3ed852e2009-09-05 21:47:34 +00003548 Image
3549 *blur_image;
3550
3551 assert(wand != (MagickWand *) NULL);
3552 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003553 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003554 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3555 if (wand->images == (Image *) NULL)
3556 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd89705a2012-01-20 02:52:24 +00003557 blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003558 if (blur_image == (Image *) NULL)
3559 return(MagickFalse);
3560 ReplaceImageInList(&wand->images,blur_image);
3561 return(MagickTrue);
3562}
3563
3564/*
3565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3566% %
3567% %
3568% %
3569% M a g i c k G e t I m a g e %
3570% %
3571% %
3572% %
3573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3574%
3575% MagickGetImage() gets the image at the current image index.
3576%
3577% The format of the MagickGetImage method is:
3578%
3579% MagickWand *MagickGetImage(MagickWand *wand)
3580%
3581% A description of each parameter follows:
3582%
3583% o wand: the magick wand.
3584%
3585*/
3586WandExport MagickWand *MagickGetImage(MagickWand *wand)
3587{
3588 Image
3589 *image;
3590
3591 assert(wand != (MagickWand *) NULL);
3592 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003593 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003594 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3595 if (wand->images == (Image *) NULL)
3596 {
3597 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003598 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003599 return((MagickWand *) NULL);
3600 }
3601 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3602 if (image == (Image *) NULL)
3603 return((MagickWand *) NULL);
3604 return(CloneMagickWandFromImages(wand,image));
3605}
3606
3607/*
3608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3609% %
3610% %
3611% %
3612% 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 %
3613% %
3614% %
3615% %
3616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3617%
3618% MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3619% is not activated. That is, the image is RGB rather than RGBA or CMYK rather
3620% than CMYKA.
3621%
3622% The format of the MagickGetImageAlphaChannel method is:
3623%
cristybb503372010-05-27 20:51:26 +00003624% size_t MagickGetImageAlphaChannel(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003625%
3626% A description of each parameter follows:
3627%
3628% o wand: the magick wand.
3629%
3630*/
3631WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3632{
3633 assert(wand != (MagickWand *) NULL);
3634 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003635 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003636 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3637 if (wand->images == (Image *) NULL)
3638 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3639 return(GetImageAlphaChannel(wand->images));
3640}
3641
3642/*
3643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3644% %
3645% %
3646% %
3647% M a g i c k G e t I m a g e C l i p M a s k %
3648% %
3649% %
3650% %
3651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3652%
cristy10a6c612012-01-29 21:41:05 +00003653% MagickGetImageMask() gets the image clip mask at the current image index.
cristy3ed852e2009-09-05 21:47:34 +00003654%
cristy10a6c612012-01-29 21:41:05 +00003655% The format of the MagickGetImageMask method is:
cristy3ed852e2009-09-05 21:47:34 +00003656%
cristy10a6c612012-01-29 21:41:05 +00003657% MagickWand *MagickGetImageMask(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003658%
3659% A description of each parameter follows:
3660%
3661% o wand: the magick wand.
3662%
3663*/
cristy10a6c612012-01-29 21:41:05 +00003664WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003665{
3666 Image
3667 *image;
3668
3669 assert(wand != (MagickWand *) NULL);
3670 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003671 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003672 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3673 if (wand->images == (Image *) NULL)
3674 {
3675 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003676 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003677 return((MagickWand *) NULL);
3678 }
cristy10a6c612012-01-29 21:41:05 +00003679 image=GetImageMask(wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003680 if (image == (Image *) NULL)
3681 return((MagickWand *) NULL);
3682 return(CloneMagickWandFromImages(wand,image));
3683}
3684
3685/*
3686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3687% %
3688% %
3689% %
3690% 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 %
3691% %
3692% %
3693% %
3694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3695%
3696% MagickGetImageBackgroundColor() returns the image background color.
3697%
3698% The format of the MagickGetImageBackgroundColor method is:
3699%
3700% MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3701% PixelWand *background_color)
3702%
3703% A description of each parameter follows:
3704%
3705% o wand: the magick wand.
3706%
3707% o background_color: Return the background color.
3708%
3709*/
3710WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3711 PixelWand *background_color)
3712{
3713 assert(wand != (MagickWand *) NULL);
3714 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003715 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003716 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3717 if (wand->images == (Image *) NULL)
3718 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf82c4a02011-12-15 02:43:44 +00003719 PixelSetPixelColor(background_color,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00003720 return(MagickTrue);
3721}
3722
3723/*
3724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3725% %
3726% %
3727% %
3728% M a g i c k G e t I m a g e B l o b %
3729% %
3730% %
3731% %
3732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3733%
cristy1a1b5622011-02-15 02:40:42 +00003734% MagickGetImageBlob() implements direct to memory image formats. It returns
3735% the image as a blob (a formatted "file" in memory) and its length, starting
anthonya89dd172011-10-04 13:29:35 +00003736% from the current position in the image sequence. Use MagickSetImageFormat()
cristy1a1b5622011-02-15 02:40:42 +00003737% to set the format to write to the blob (GIF, JPEG, PNG, etc.).
3738%
3739% Utilize MagickResetIterator() to ensure the write is from the beginning of
3740% the image sequence.
cristy3ed852e2009-09-05 21:47:34 +00003741%
3742% Use MagickRelinquishMemory() to free the blob when you are done with it.
3743%
3744% The format of the MagickGetImageBlob method is:
3745%
3746% unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3747%
3748% A description of each parameter follows:
3749%
3750% o wand: the magick wand.
3751%
3752% o length: the length of the blob.
3753%
3754*/
3755WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3756{
3757 assert(wand != (MagickWand *) NULL);
3758 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003759 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003760 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3761 if (wand->images == (Image *) NULL)
3762 {
3763 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003764 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003765 return((unsigned char *) NULL);
3766 }
3767 return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3768}
3769
3770/*
3771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3772% %
3773% %
3774% %
3775% M a g i c k G e t I m a g e s B l o b %
3776% %
3777% %
3778% %
3779%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3780%
3781% MagickGetImageBlob() implements direct to memory image formats. It
3782% returns the image sequence as a blob and its length. The format of the image
3783% determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
3784% return a different image format, use MagickSetImageFormat().
3785%
3786% Note, some image formats do not permit multiple images to the same image
3787% stream (e.g. JPEG). in this instance, just the first image of the
3788% sequence is returned as a blob.
3789%
3790% The format of the MagickGetImagesBlob method is:
3791%
3792% unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3793%
3794% A description of each parameter follows:
3795%
3796% o wand: the magick wand.
3797%
3798% o length: the length of the blob.
3799%
3800*/
3801WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3802{
3803 unsigned char
3804 *blob;
3805
3806 assert(wand != (MagickWand *) NULL);
3807 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003808 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003809 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3810 if (wand->images == (Image *) NULL)
3811 {
3812 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003813 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003814 return((unsigned char *) NULL);
3815 }
3816 blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3817 wand->exception);
3818 return(blob);
3819}
3820
3821/*
3822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3823% %
3824% %
3825% %
3826% 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 %
3827% %
3828% %
3829% %
3830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3831%
3832% MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3833% image.
3834%
3835% The format of the MagickGetImageBluePrimary method is:
3836%
3837% MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3838% double *y)
3839%
3840% A description of each parameter follows:
3841%
3842% o wand: the magick wand.
3843%
3844% o x: the chromaticity blue primary x-point.
3845%
3846% o y: the chromaticity blue primary y-point.
3847%
3848*/
3849WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3850 double *x,double *y)
3851{
3852 assert(wand != (MagickWand *) NULL);
3853 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003854 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003855 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3856 if (wand->images == (Image *) NULL)
3857 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3858 *x=wand->images->chromaticity.blue_primary.x;
3859 *y=wand->images->chromaticity.blue_primary.y;
3860 return(MagickTrue);
3861}
3862
3863/*
3864%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3865% %
3866% %
3867% %
3868% 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 %
3869% %
3870% %
3871% %
3872%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3873%
3874% MagickGetImageBorderColor() returns the image border color.
3875%
3876% The format of the MagickGetImageBorderColor method is:
3877%
3878% MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3879% PixelWand *border_color)
3880%
3881% A description of each parameter follows:
3882%
3883% o wand: the magick wand.
3884%
3885% o border_color: Return the border color.
3886%
3887*/
3888WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3889 PixelWand *border_color)
3890{
3891 assert(wand != (MagickWand *) NULL);
3892 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003893 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003894 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3895 if (wand->images == (Image *) NULL)
3896 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf82c4a02011-12-15 02:43:44 +00003897 PixelSetPixelColor(border_color,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00003898 return(MagickTrue);
3899}
3900
3901/*
3902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903% %
3904% %
3905% %
cristyd42d9952011-07-08 14:21:50 +00003906% 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 +00003907% %
3908% %
3909% %
3910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3911%
cristy490408a2011-07-07 14:42:05 +00003912% MagickGetImageFeatures() returns features for each channel in the
cristy7396d882010-01-27 02:37:56 +00003913% image in each of four directions (horizontal, vertical, left and right
3914% diagonals) for the specified distance. The features include the angular
3915% second moment, contrast, correlation, sum of squares: variance, inverse
3916% difference moment, sum average, sum varience, sum entropy, entropy,
3917% difference variance, difference entropy, information measures of
3918% correlation 1, information measures of correlation 2, and maximum
3919% correlation coefficient. You can access the red channel contrast, for
3920% example, like this:
cristy3ed852e2009-09-05 21:47:34 +00003921%
cristy490408a2011-07-07 14:42:05 +00003922% channel_features=MagickGetImageFeatures(wand,1);
cristyd3090f92011-10-18 00:05:15 +00003923% contrast=channel_features[RedPixelChannel].contrast[0];
cristy3ed852e2009-09-05 21:47:34 +00003924%
cristy549a37e2010-01-26 15:24:15 +00003925% Use MagickRelinquishMemory() to free the statistics buffer.
3926%
cristy490408a2011-07-07 14:42:05 +00003927% The format of the MagickGetImageFeatures method is:
cristy549a37e2010-01-26 15:24:15 +00003928%
cristy490408a2011-07-07 14:42:05 +00003929% ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003930% const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00003931%
3932% A description of each parameter follows:
3933%
3934% o wand: the magick wand.
3935%
cristy549a37e2010-01-26 15:24:15 +00003936% o distance: the distance.
cristy3ed852e2009-09-05 21:47:34 +00003937%
3938*/
cristy490408a2011-07-07 14:42:05 +00003939WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003940 const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00003941{
cristy3ed852e2009-09-05 21:47:34 +00003942 assert(wand != (MagickWand *) NULL);
3943 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003944 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003945 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3946 if (wand->images == (Image *) NULL)
cristy549a37e2010-01-26 15:24:15 +00003947 {
3948 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003949 "ContainsNoImages","`%s'",wand->name);
cristy549a37e2010-01-26 15:24:15 +00003950 return((ChannelFeatures *) NULL);
3951 }
cristy490408a2011-07-07 14:42:05 +00003952 return(GetImageFeatures(wand->images,distance,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00003953}
3954
3955/*
3956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3957% %
3958% %
3959% %
cristyd42d9952011-07-08 14:21:50 +00003960% 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 +00003961% %
3962% %
3963% %
3964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3965%
cristyd42d9952011-07-08 14:21:50 +00003966% MagickGetImageKurtosis() gets the kurtosis and skewness of one or
cristy3ed852e2009-09-05 21:47:34 +00003967% more image channels.
3968%
cristyd42d9952011-07-08 14:21:50 +00003969% The format of the MagickGetImageKurtosis method is:
cristy3ed852e2009-09-05 21:47:34 +00003970%
cristyd42d9952011-07-08 14:21:50 +00003971% MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3972% double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00003973%
3974% A description of each parameter follows:
3975%
3976% o wand: the magick wand.
3977%
cristy3ed852e2009-09-05 21:47:34 +00003978% o kurtosis: The kurtosis for the specified channel(s).
3979%
3980% o skewness: The skewness for the specified channel(s).
3981%
3982*/
cristyd42d9952011-07-08 14:21:50 +00003983WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3984 double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00003985{
3986 MagickBooleanType
3987 status;
3988
3989 assert(wand != (MagickWand *) NULL);
3990 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00003991 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00003992 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3993 if (wand->images == (Image *) NULL)
3994 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00003995 status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003996 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003997}
cristy549a37e2010-01-26 15:24:15 +00003998
3999/*
4000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4001% %
4002% %
4003% %
cristyd42d9952011-07-08 14:21:50 +00004004% M a g i c k G e t I m a g e M e a n %
cristy549a37e2010-01-26 15:24:15 +00004005% %
4006% %
4007% %
4008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4009%
cristyd42d9952011-07-08 14:21:50 +00004010% MagickGetImageMean() gets the mean and standard deviation of one or more
4011% image channels.
cristy549a37e2010-01-26 15:24:15 +00004012%
cristyd42d9952011-07-08 14:21:50 +00004013% The format of the MagickGetImageMean method is:
cristy549a37e2010-01-26 15:24:15 +00004014%
cristyd42d9952011-07-08 14:21:50 +00004015% MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4016% double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00004017%
4018% A description of each parameter follows:
4019%
4020% o wand: the magick wand.
4021%
4022% o channel: the image channel(s).
4023%
4024% o mean: The mean pixel value for the specified channel(s).
4025%
4026% o standard_deviation: The standard deviation for the specified channel(s).
4027%
4028*/
cristyd42d9952011-07-08 14:21:50 +00004029WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4030 double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00004031{
4032 MagickBooleanType
4033 status;
cristy3ed852e2009-09-05 21:47:34 +00004034
cristy549a37e2010-01-26 15:24:15 +00004035 assert(wand != (MagickWand *) NULL);
4036 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004037 if (IfMagickTrue(wand->debug))
cristy549a37e2010-01-26 15:24:15 +00004038 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4039 if (wand->images == (Image *) NULL)
4040 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00004041 status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00004042 return(status);
cristy549a37e2010-01-26 15:24:15 +00004043}
4044
cristy3ed852e2009-09-05 21:47:34 +00004045/*
4046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4047% %
4048% %
4049% %
cristyd42d9952011-07-08 14:21:50 +00004050% 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 +00004051% %
4052% %
4053% %
4054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4055%
cristyd42d9952011-07-08 14:21:50 +00004056% MagickGetImageRange() gets the range for one or more image channels.
cristy3ed852e2009-09-05 21:47:34 +00004057%
cristyd42d9952011-07-08 14:21:50 +00004058% The format of the MagickGetImageRange method is:
cristy3ed852e2009-09-05 21:47:34 +00004059%
cristyd42d9952011-07-08 14:21:50 +00004060% MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4061% double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00004062%
4063% A description of each parameter follows:
4064%
4065% o wand: the magick wand.
4066%
cristy3ed852e2009-09-05 21:47:34 +00004067% o minima: The minimum pixel value for the specified channel(s).
4068%
4069% o maxima: The maximum pixel value for the specified channel(s).
4070%
4071*/
cristyd42d9952011-07-08 14:21:50 +00004072WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4073 double *minima,double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00004074{
4075 MagickBooleanType
4076 status;
4077
4078 assert(wand != (MagickWand *) NULL);
4079 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004080 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004081 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4082 if (wand->images == (Image *) NULL)
4083 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00004084 status=GetImageRange(wand->images,minima,maxima,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00004085 return(status);
cristy3ed852e2009-09-05 21:47:34 +00004086}
4087
4088/*
4089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4090% %
4091% %
4092% %
cristyd42d9952011-07-08 14:21:50 +00004093% 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 +00004094% %
4095% %
4096% %
4097%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4098%
cristyd42d9952011-07-08 14:21:50 +00004099% MagickGetImageStatistics() returns statistics for each channel in the
cristy3ed852e2009-09-05 21:47:34 +00004100% image. The statistics include the channel depth, its minima and
4101% maxima, the mean, the standard deviation, the kurtosis and the skewness.
4102% You can access the red channel mean, for example, like this:
4103%
cristyd42d9952011-07-08 14:21:50 +00004104% channel_statistics=MagickGetImageStatistics(wand);
cristyd3090f92011-10-18 00:05:15 +00004105% red_mean=channel_statistics[RedPixelChannel].mean;
cristy3ed852e2009-09-05 21:47:34 +00004106%
4107% Use MagickRelinquishMemory() to free the statistics buffer.
4108%
cristyd42d9952011-07-08 14:21:50 +00004109% The format of the MagickGetImageStatistics method is:
cristy3ed852e2009-09-05 21:47:34 +00004110%
cristyd42d9952011-07-08 14:21:50 +00004111% ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004112%
4113% A description of each parameter follows:
4114%
4115% o wand: the magick wand.
4116%
4117*/
cristyd42d9952011-07-08 14:21:50 +00004118WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004119{
4120 assert(wand != (MagickWand *) NULL);
4121 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004122 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004123 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4124 if (wand->images == (Image *) NULL)
4125 {
4126 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004127 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004128 return((ChannelStatistics *) NULL);
4129 }
cristyd42d9952011-07-08 14:21:50 +00004130 return(GetImageStatistics(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00004131}
4132
4133/*
4134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4135% %
4136% %
4137% %
4138% 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 %
4139% %
4140% %
4141% %
4142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4143%
4144% MagickGetImageColormapColor() returns the color of the specified colormap
4145% index.
4146%
4147% The format of the MagickGetImageColormapColor method is:
4148%
4149% MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004150% const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004151%
4152% A description of each parameter follows:
4153%
4154% o wand: the magick wand.
4155%
4156% o index: the offset into the image colormap.
4157%
4158% o color: Return the colormap color in this wand.
4159%
4160*/
4161WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004162 const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004163{
4164 assert(wand != (MagickWand *) NULL);
4165 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004166 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004167 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4168 if (wand->images == (Image *) NULL)
4169 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy101ab702011-10-13 13:06:32 +00004170 if ((wand->images->colormap == (PixelInfo *) NULL) ||
cristy3ed852e2009-09-05 21:47:34 +00004171 (index >= wand->images->colors))
4172 {
4173 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004174 "InvalidColormapIndex","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004175 return(MagickFalse);
4176 }
cristyf82c4a02011-12-15 02:43:44 +00004177 PixelSetPixelColor(color,wand->images->colormap+index);
cristy3ed852e2009-09-05 21:47:34 +00004178 return(MagickTrue);
4179}
4180
4181/*
4182%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4183% %
4184% %
4185% %
4186% M a g i c k G e t I m a g e C o l o r s %
4187% %
4188% %
4189% %
4190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4191%
4192% MagickGetImageColors() gets the number of unique colors in the image.
4193%
4194% The format of the MagickGetImageColors method is:
4195%
cristybb503372010-05-27 20:51:26 +00004196% size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004197%
4198% A description of each parameter follows:
4199%
4200% o wand: the magick wand.
4201%
4202*/
cristybb503372010-05-27 20:51:26 +00004203WandExport size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004204{
4205 assert(wand != (MagickWand *) NULL);
4206 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004207 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004208 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4209 if (wand->images == (Image *) NULL)
4210 {
4211 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004212 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004213 return(0);
4214 }
4215 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4216}
4217
4218/*
4219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4220% %
4221% %
4222% %
4223% M a g i c k G e t I m a g e C o l o r s p a c e %
4224% %
4225% %
4226% %
4227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4228%
4229% MagickGetImageColorspace() gets the image colorspace.
4230%
4231% The format of the MagickGetImageColorspace method is:
4232%
4233% ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4234%
4235% A description of each parameter follows:
4236%
4237% o wand: the magick wand.
4238%
4239*/
4240WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4241{
4242 assert(wand != (MagickWand *) NULL);
4243 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004244 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004245 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4246 if (wand->images == (Image *) NULL)
4247 {
4248 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004249 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004250 return(UndefinedColorspace);
4251 }
4252 return(wand->images->colorspace);
4253}
4254
4255/*
4256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4257% %
4258% %
4259% %
4260% M a g i c k G e t I m a g e C o m p o s e %
4261% %
4262% %
4263% %
4264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4265%
4266% MagickGetImageCompose() returns the composite operator associated with the
4267% image.
4268%
4269% The format of the MagickGetImageCompose method is:
4270%
4271% CompositeOperator MagickGetImageCompose(MagickWand *wand)
4272%
4273% A description of each parameter follows:
4274%
4275% o wand: the magick wand.
4276%
4277*/
4278WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4279{
4280 assert(wand != (MagickWand *) NULL);
4281 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004282 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004283 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4284 if (wand->images == (Image *) NULL)
4285 {
4286 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004287 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004288 return(UndefinedCompositeOp);
4289 }
4290 return(wand->images->compose);
4291}
4292
4293/*
4294%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4295% %
4296% %
4297% %
4298% 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 %
4299% %
4300% %
4301% %
4302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4303%
4304% MagickGetImageCompression() gets the image compression.
4305%
4306% The format of the MagickGetImageCompression method is:
4307%
4308% CompressionType MagickGetImageCompression(MagickWand *wand)
4309%
4310% A description of each parameter follows:
4311%
4312% o wand: the magick wand.
4313%
4314*/
4315WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4316{
4317 assert(wand != (MagickWand *) NULL);
4318 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004319 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004320 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4321 if (wand->images == (Image *) NULL)
4322 {
4323 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004324 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004325 return(UndefinedCompression);
4326 }
4327 return(wand->images->compression);
4328}
4329
4330/*
4331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4332% %
4333% %
4334% %
4335% 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 %
4336% %
4337% %
4338% %
4339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4340%
cristyaf5ee052012-04-25 16:45:39 +00004341% MagickGetImageCompressionQuality() gets the image compression quality.
cristy3ed852e2009-09-05 21:47:34 +00004342%
cristyaf5ee052012-04-25 16:45:39 +00004343% The format of the MagickGetImageCompressionQuality method is:
cristy3ed852e2009-09-05 21:47:34 +00004344%
cristyaf5ee052012-04-25 16:45:39 +00004345% size_t MagickGetImageCompressionQuality(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004346%
4347% A description of each parameter follows:
4348%
4349% o wand: the magick wand.
4350%
4351*/
cristybb503372010-05-27 20:51:26 +00004352WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004353{
4354 assert(wand != (MagickWand *) NULL);
4355 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004356 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004357 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4358 if (wand->images == (Image *) NULL)
4359 {
4360 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004361 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004362 return(0UL);
4363 }
4364 return(wand->images->quality);
4365}
4366
4367/*
4368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4369% %
4370% %
4371% %
4372% M a g i c k G e t I m a g e D e l a y %
4373% %
4374% %
4375% %
4376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4377%
4378% MagickGetImageDelay() gets the image delay.
4379%
4380% The format of the MagickGetImageDelay method is:
4381%
cristybb503372010-05-27 20:51:26 +00004382% size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004383%
4384% A description of each parameter follows:
4385%
4386% o wand: the magick wand.
4387%
4388*/
cristybb503372010-05-27 20:51:26 +00004389WandExport size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004390{
4391 assert(wand != (MagickWand *) NULL);
4392 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004393 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004394 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4395 if (wand->images == (Image *) NULL)
4396 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4397 return(wand->images->delay);
4398}
4399
4400/*
4401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4402% %
4403% %
4404% %
4405% M a g i c k G e t I m a g e D e p t h %
4406% %
4407% %
4408% %
4409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4410%
4411% MagickGetImageDepth() gets the image depth.
4412%
4413% The format of the MagickGetImageDepth method is:
4414%
cristybb503372010-05-27 20:51:26 +00004415% size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004416%
4417% A description of each parameter follows:
4418%
4419% o wand: the magick wand.
4420%
4421*/
cristybb503372010-05-27 20:51:26 +00004422WandExport size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004423{
4424 assert(wand != (MagickWand *) NULL);
4425 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004426 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004427 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4428 if (wand->images == (Image *) NULL)
4429 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy6970a7e2011-12-13 01:54:01 +00004430 return(wand->images->depth);
cristy3ed852e2009-09-05 21:47:34 +00004431}
4432
4433/*
4434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4435% %
4436% %
4437% %
cristy8a9106f2011-07-05 14:39:26 +00004438% M a g i c k G e t I m a g e D i s p o s e %
4439% %
4440% %
4441% %
4442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4443%
4444% MagickGetImageDispose() gets the image disposal method.
4445%
4446% The format of the MagickGetImageDispose method is:
4447%
4448% DisposeType MagickGetImageDispose(MagickWand *wand)
4449%
4450% A description of each parameter follows:
4451%
4452% o wand: the magick wand.
4453%
4454*/
4455WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4456{
4457 assert(wand != (MagickWand *) NULL);
4458 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004459 if (IfMagickTrue(wand->debug))
cristy8a9106f2011-07-05 14:39:26 +00004460 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4461 if (wand->images == (Image *) NULL)
4462 {
4463 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004464 "ContainsNoImages","`%s'",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004465 return(UndefinedDispose);
4466 }
4467 return((DisposeType) wand->images->dispose);
4468}
4469
4470/*
4471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4472% %
4473% %
4474% %
cristy3ed852e2009-09-05 21:47:34 +00004475% M a g i c k G e t I m a g e D i s t o r t i o n %
4476% %
4477% %
4478% %
4479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4480%
4481% MagickGetImageDistortion() compares an image to a reconstructed image and
4482% returns the specified distortion metric.
4483%
4484% The format of the MagickGetImageDistortion method is:
4485%
4486% MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4487% const MagickWand *reference,const MetricType metric,
4488% double *distortion)
4489%
4490% A description of each parameter follows:
4491%
4492% o wand: the magick wand.
4493%
4494% o reference: the reference wand.
4495%
4496% o metric: the metric.
4497%
4498% o distortion: the computed distortion between the images.
4499%
4500*/
4501WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4502 const MagickWand *reference,const MetricType metric,double *distortion)
4503{
4504 MagickBooleanType
4505 status;
4506
cristy3ed852e2009-09-05 21:47:34 +00004507 assert(wand != (MagickWand *) NULL);
4508 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004509 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004510 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4511 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4512 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4513 status=GetImageDistortion(wand->images,reference->images,metric,distortion,
cristy5f49bdb2011-10-16 14:28:56 +00004514 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00004515 return(status);
cristy3ed852e2009-09-05 21:47:34 +00004516}
4517
4518/*
4519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4520% %
4521% %
4522% %
cristy8a9106f2011-07-05 14:39:26 +00004523% 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 +00004524% %
4525% %
4526% %
4527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4528%
cristy8a9106f2011-07-05 14:39:26 +00004529% MagickGetImageDistortions() compares one or more pixel channels of an
4530% image to a reconstructed image and returns the specified distortion metrics.
cristy3ed852e2009-09-05 21:47:34 +00004531%
cristy8a9106f2011-07-05 14:39:26 +00004532% Use MagickRelinquishMemory() to free the metrics when you are done with them.
cristy3ed852e2009-09-05 21:47:34 +00004533%
cristy8a9106f2011-07-05 14:39:26 +00004534% The format of the MagickGetImageDistortion method is:
4535%
4536% double *MagickGetImageDistortion(MagickWand *wand,
4537% const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004538%
4539% A description of each parameter follows:
4540%
4541% o wand: the magick wand.
4542%
cristy8a9106f2011-07-05 14:39:26 +00004543% o reference: the reference wand.
4544%
4545% o metric: the metric.
4546%
cristy3ed852e2009-09-05 21:47:34 +00004547*/
cristy8a9106f2011-07-05 14:39:26 +00004548WandExport double *MagickGetImageDistortions(MagickWand *wand,
4549 const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004550{
cristy8a9106f2011-07-05 14:39:26 +00004551 double
4552 *channel_distortion;
4553
cristy3ed852e2009-09-05 21:47:34 +00004554 assert(wand != (MagickWand *) NULL);
4555 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004556 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004557 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004558 assert(reference != (MagickWand *) NULL);
4559 assert(reference->signature == WandSignature);
4560 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
cristy3ed852e2009-09-05 21:47:34 +00004561 {
4562 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004563 "ContainsNoImages","`%s'",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004564 return((double *) NULL);
cristy3ed852e2009-09-05 21:47:34 +00004565 }
cristy8a9106f2011-07-05 14:39:26 +00004566 channel_distortion=GetImageDistortions(wand->images,reference->images,
cristy5f49bdb2011-10-16 14:28:56 +00004567 metric,wand->exception);
cristy8a9106f2011-07-05 14:39:26 +00004568 return(channel_distortion);
cristy3ed852e2009-09-05 21:47:34 +00004569}
4570
4571/*
4572%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4573% %
4574% %
4575% %
cristy0ae397c2012-06-02 12:49:12 +00004576% M a g i c k G e t I m a g e E n d i a n %
4577% %
4578% %
4579% %
4580%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4581%
4582% MagickGetImageEndian() gets the image endian.
4583%
4584% The format of the MagickGetImageEndian method is:
4585%
4586% EndianType MagickGetImageEndian(MagickWand *wand)
4587%
4588% A description of each parameter follows:
4589%
4590% o wand: the magick wand.
4591%
4592*/
4593WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4594{
4595 assert(wand != (MagickWand *) NULL);
4596 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004597 if (IfMagickTrue(wand->debug))
cristy0ae397c2012-06-02 12:49:12 +00004598 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy0ae397c2012-06-02 12:49:12 +00004599 if (wand->images == (Image *) NULL)
4600 {
4601 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004602 "ContainsNoImages","`%s'",wand->name);
cristy0ae397c2012-06-02 12:49:12 +00004603 return(UndefinedEndian);
4604 }
4605 return(wand->images->endian);
4606}
4607
4608/*
4609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4610% %
4611% %
4612% %
cristy3ed852e2009-09-05 21:47:34 +00004613% M a g i c k G e t I m a g e F i l e n a m e %
4614% %
4615% %
4616% %
4617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4618%
4619% MagickGetImageFilename() returns the filename of a particular image in a
4620% sequence.
4621%
4622% The format of the MagickGetImageFilename method is:
4623%
4624% char *MagickGetImageFilename(MagickWand *wand)
4625%
4626% A description of each parameter follows:
4627%
4628% o wand: the magick wand.
4629%
4630*/
4631WandExport char *MagickGetImageFilename(MagickWand *wand)
4632{
4633 assert(wand != (MagickWand *) NULL);
4634 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004635 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004636 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4637 if (wand->images == (Image *) NULL)
4638 {
4639 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004640 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004641 return((char *) NULL);
4642 }
4643 return(AcquireString(wand->images->filename));
4644}
4645
4646/*
4647%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4648% %
4649% %
4650% %
4651% M a g i c k G e t I m a g e F o r m a t %
4652% %
4653% %
4654% %
4655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656%
4657% MagickGetImageFormat() returns the format of a particular image in a
4658% sequence.
4659%
4660% The format of the MagickGetImageFormat method is:
4661%
cristy03e23ab2012-08-23 12:25:01 +00004662% char *MagickGetImageFormat(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004663%
4664% A description of each parameter follows:
4665%
4666% o wand: the magick wand.
4667%
4668*/
4669WandExport char *MagickGetImageFormat(MagickWand *wand)
4670{
4671 assert(wand != (MagickWand *) NULL);
4672 assert(wand->signature == WandSignature);
cristy03e23ab2012-08-23 12:25:01 +00004673 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004674 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4675 if (wand->images == (Image *) NULL)
4676 {
4677 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004678 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004679 return((char *) NULL);
4680 }
4681 return(AcquireString(wand->images->magick));
4682}
4683
4684/*
4685%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4686% %
4687% %
4688% %
4689% M a g i c k G e t I m a g e F u z z %
4690% %
4691% %
4692% %
4693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4694%
4695% MagickGetImageFuzz() gets the image fuzz.
4696%
4697% The format of the MagickGetImageFuzz method is:
4698%
4699% double MagickGetImageFuzz(MagickWand *wand)
4700%
4701% A description of each parameter follows:
4702%
4703% o wand: the magick wand.
4704%
4705*/
4706WandExport double MagickGetImageFuzz(MagickWand *wand)
4707{
4708 assert(wand != (MagickWand *) NULL);
4709 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004710 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004711 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4712 if (wand->images == (Image *) NULL)
4713 {
4714 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004715 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004716 return(0.0);
4717 }
4718 return(wand->images->fuzz);
4719}
4720
4721/*
4722%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4723% %
4724% %
4725% %
4726% M a g i c k G e t I m a g e G a m m a %
4727% %
4728% %
4729% %
4730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4731%
4732% MagickGetImageGamma() gets the image gamma.
4733%
4734% The format of the MagickGetImageGamma method is:
4735%
4736% double MagickGetImageGamma(MagickWand *wand)
4737%
4738% A description of each parameter follows:
4739%
4740% o wand: the magick wand.
4741%
4742*/
4743WandExport double MagickGetImageGamma(MagickWand *wand)
4744{
4745 assert(wand != (MagickWand *) NULL);
4746 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004747 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004748 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4749 if (wand->images == (Image *) NULL)
4750 {
4751 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004752 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004753 return(0.0);
4754 }
4755 return(wand->images->gamma);
4756}
4757
4758/*
4759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4760% %
4761% %
4762% %
cristy0ae397c2012-06-02 12:49:12 +00004763% M a g i c k G e t I m a g e G r a v i t y %
cristy3ed852e2009-09-05 21:47:34 +00004764% %
4765% %
4766% %
4767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4768%
4769% MagickGetImageGravity() gets the image gravity.
4770%
4771% The format of the MagickGetImageGravity method is:
4772%
4773% GravityType MagickGetImageGravity(MagickWand *wand)
4774%
4775% A description of each parameter follows:
4776%
4777% o wand: the magick wand.
4778%
4779*/
4780WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4781{
4782 assert(wand != (MagickWand *) NULL);
4783 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004784 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004785 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4786 if (wand->images == (Image *) NULL)
4787 {
4788 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004789 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004790 return(UndefinedGravity);
4791 }
4792 return(wand->images->gravity);
4793}
4794
4795/*
4796%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4797% %
4798% %
4799% %
4800% 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 %
4801% %
4802% %
4803% %
4804%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4805%
4806% MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4807%
4808% The format of the MagickGetImageGreenPrimary method is:
4809%
4810% MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4811% double *y)
4812%
4813% A description of each parameter follows:
4814%
4815% o wand: the magick wand.
4816%
4817% o x: the chromaticity green primary x-point.
4818%
4819% o y: the chromaticity green primary y-point.
4820%
4821*/
4822WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4823 double *x,double *y)
4824{
4825 assert(wand != (MagickWand *) NULL);
4826 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004827 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004828 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4829 if (wand->images == (Image *) NULL)
4830 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4831 *x=wand->images->chromaticity.green_primary.x;
4832 *y=wand->images->chromaticity.green_primary.y;
4833 return(MagickTrue);
4834}
4835
4836/*
4837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4838% %
4839% %
4840% %
4841% M a g i c k G e t I m a g e H e i g h t %
4842% %
4843% %
4844% %
4845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4846%
4847% MagickGetImageHeight() returns the image height.
4848%
4849% The format of the MagickGetImageHeight method is:
4850%
cristybb503372010-05-27 20:51:26 +00004851% size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004852%
4853% A description of each parameter follows:
4854%
4855% o wand: the magick wand.
4856%
4857*/
cristybb503372010-05-27 20:51:26 +00004858WandExport size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004859{
4860 assert(wand != (MagickWand *) NULL);
4861 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004862 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004863 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4864 if (wand->images == (Image *) NULL)
4865 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4866 return(wand->images->rows);
4867}
4868
4869/*
4870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4871% %
4872% %
4873% %
4874% M a g i c k G e t I m a g e H i s t o g r a m %
4875% %
4876% %
4877% %
4878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4879%
4880% MagickGetImageHistogram() returns the image histogram as an array of
4881% PixelWand wands.
4882%
4883% The format of the MagickGetImageHistogram method is:
4884%
4885% PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004886% size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00004887%
4888% A description of each parameter follows:
4889%
4890% o wand: the magick wand.
4891%
4892% o number_colors: the number of unique colors in the image and the number
4893% of pixel wands returned.
4894%
4895*/
4896WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004897 size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00004898{
cristy101ab702011-10-13 13:06:32 +00004899 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00004900 *histogram;
4901
4902 PixelWand
4903 **pixel_wands;
4904
cristybb503372010-05-27 20:51:26 +00004905 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +00004906 i;
4907
4908 assert(wand != (MagickWand *) NULL);
4909 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004910 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004911 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4912 if (wand->images == (Image *) NULL)
4913 {
4914 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004915 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004916 return((PixelWand **) NULL);
4917 }
4918 histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
cristy101ab702011-10-13 13:06:32 +00004919 if (histogram == (PixelInfo *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00004920 return((PixelWand **) NULL);
4921 pixel_wands=NewPixelWands(*number_colors);
cristybb503372010-05-27 20:51:26 +00004922 for (i=0; i < (ssize_t) *number_colors; i++)
cristy3ed852e2009-09-05 21:47:34 +00004923 {
cristyf82c4a02011-12-15 02:43:44 +00004924 PixelSetPixelColor(pixel_wands[i],&histogram[i]);
cristybb503372010-05-27 20:51:26 +00004925 PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
cristy3ed852e2009-09-05 21:47:34 +00004926 }
cristy101ab702011-10-13 13:06:32 +00004927 histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
cristy3ed852e2009-09-05 21:47:34 +00004928 return(pixel_wands);
4929}
4930
4931/*
4932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4933% %
4934% %
4935% %
4936% 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 %
4937% %
4938% %
4939% %
4940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4941%
4942% MagickGetImageInterlaceScheme() gets the image interlace scheme.
4943%
4944% The format of the MagickGetImageInterlaceScheme method is:
4945%
4946% InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4947%
4948% A description of each parameter follows:
4949%
4950% o wand: the magick wand.
4951%
4952*/
4953WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4954{
4955 assert(wand != (MagickWand *) NULL);
4956 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004957 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004958 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4959 if (wand->images == (Image *) NULL)
4960 {
4961 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004962 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004963 return(UndefinedInterlace);
4964 }
4965 return(wand->images->interlace);
4966}
4967
4968/*
4969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4970% %
4971% %
4972% %
4973% 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 %
4974% %
4975% %
4976% %
4977%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4978%
4979% MagickGetImageInterpolateMethod() returns the interpolation method for the
4980% sepcified image.
4981%
4982% The format of the MagickGetImageInterpolateMethod method is:
4983%
cristy5c4e2582011-09-11 19:21:03 +00004984% PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4985% MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004986%
4987% A description of each parameter follows:
4988%
4989% o wand: the magick wand.
4990%
4991*/
cristy5c4e2582011-09-11 19:21:03 +00004992WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
cristy3ed852e2009-09-05 21:47:34 +00004993 MagickWand *wand)
4994{
4995 assert(wand != (MagickWand *) NULL);
4996 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00004997 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00004998 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4999 if (wand->images == (Image *) NULL)
5000 {
5001 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005002 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005003 return(UndefinedInterpolatePixel);
5004 }
5005 return(wand->images->interpolate);
5006}
5007
5008/*
5009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5010% %
5011% %
5012% %
5013% M a g i c k G e t I m a g e I t e r a t i o n s %
5014% %
5015% %
5016% %
5017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5018%
5019% MagickGetImageIterations() gets the image iterations.
5020%
5021% The format of the MagickGetImageIterations method is:
5022%
cristybb503372010-05-27 20:51:26 +00005023% size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005024%
5025% A description of each parameter follows:
5026%
5027% o wand: the magick wand.
5028%
5029*/
cristybb503372010-05-27 20:51:26 +00005030WandExport size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005031{
5032 assert(wand != (MagickWand *) NULL);
5033 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005034 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005035 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5036 if (wand->images == (Image *) NULL)
5037 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5038 return(wand->images->iterations);
5039}
5040
5041/*
5042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5043% %
5044% %
5045% %
5046% M a g i c k G e t I m a g e L e n g t h %
5047% %
5048% %
5049% %
5050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5051%
5052% MagickGetImageLength() returns the image length in bytes.
5053%
5054% The format of the MagickGetImageLength method is:
5055%
5056% MagickBooleanType MagickGetImageLength(MagickWand *wand,
5057% MagickSizeType *length)
5058%
5059% A description of each parameter follows:
5060%
5061% o wand: the magick wand.
5062%
5063% o length: the image length in bytes.
5064%
5065*/
5066WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5067 MagickSizeType *length)
5068{
5069 assert(wand != (MagickWand *) NULL);
5070 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005071 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005072 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5073 if (wand->images == (Image *) NULL)
5074 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5075 *length=GetBlobSize(wand->images);
5076 return(MagickTrue);
5077}
5078
5079/*
5080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5081% %
5082% %
5083% %
5084% M a g i c k G e t I m a g e M a t t e C o l o r %
5085% %
5086% %
5087% %
5088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5089%
5090% MagickGetImageMatteColor() returns the image matte color.
5091%
5092% The format of the MagickGetImageMatteColor method is:
5093%
5094% MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5095% PixelWand *matte_color)
5096%
5097% A description of each parameter follows:
5098%
5099% o wand: the magick wand.
5100%
5101% o matte_color: Return the matte color.
5102%
5103*/
5104WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5105 PixelWand *matte_color)
5106{
5107 assert(wand != (MagickWand *) NULL);
5108 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005109 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005110 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5111 if (wand->images == (Image *) NULL)
5112 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf82c4a02011-12-15 02:43:44 +00005113 PixelSetPixelColor(matte_color,&wand->images->matte_color);
cristy3ed852e2009-09-05 21:47:34 +00005114 return(MagickTrue);
5115}
5116
5117/*
5118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5119% %
5120% %
5121% %
5122% 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 %
5123% %
5124% %
5125% %
5126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5127%
5128% MagickGetImageOrientation() returns the image orientation.
5129%
5130% The format of the MagickGetImageOrientation method is:
5131%
5132% OrientationType MagickGetImageOrientation(MagickWand *wand)
5133%
5134% A description of each parameter follows:
5135%
5136% o wand: the magick wand.
5137%
5138*/
5139WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5140{
5141 assert(wand != (MagickWand *) NULL);
5142 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005143 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005144 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5145 if (wand->images == (Image *) NULL)
5146 {
5147 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005148 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005149 return(UndefinedOrientation);
5150 }
5151 return(wand->images->orientation);
5152}
5153
5154/*
5155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5156% %
5157% %
5158% %
5159% M a g i c k G e t I m a g e P a g e %
5160% %
5161% %
5162% %
5163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5164%
5165% MagickGetImagePage() returns the page geometry associated with the image.
5166%
5167% The format of the MagickGetImagePage method is:
5168%
5169% MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005170% size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00005171%
5172% A description of each parameter follows:
5173%
5174% o wand: the magick wand.
5175%
5176% o width: the page width.
5177%
5178% o height: the page height.
5179%
5180% o x: the page x-offset.
5181%
5182% o y: the page y-offset.
5183%
5184*/
5185WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005186 size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00005187{
5188 assert(wand != (const MagickWand *) NULL);
5189 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005190 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005191 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5192 if (wand->images == (Image *) NULL)
5193 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5194 *width=wand->images->page.width;
5195 *height=wand->images->page.height;
5196 *x=wand->images->page.x;
5197 *y=wand->images->page.y;
5198 return(MagickTrue);
5199}
5200
5201/*
5202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5203% %
5204% %
5205% %
5206% M a g i c k G e t I m a g e P i x e l C o l o r %
5207% %
5208% %
5209% %
5210%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5211%
5212% MagickGetImagePixelColor() returns the color of the specified pixel.
5213%
5214% The format of the MagickGetImagePixelColor method is:
5215%
5216% MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005217% const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005218%
5219% A description of each parameter follows:
5220%
5221% o wand: the magick wand.
5222%
5223% o x,y: the pixel offset into the image.
5224%
5225% o color: Return the colormap color in this wand.
5226%
5227*/
5228WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005229 const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005230{
cristy4c08aed2011-07-01 19:47:50 +00005231 register const Quantum
cristy3ed852e2009-09-05 21:47:34 +00005232 *p;
5233
5234 CacheView
5235 *image_view;
5236
5237 assert(wand != (MagickWand *) NULL);
5238 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005239 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005240 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5241 if (wand->images == (Image *) NULL)
5242 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy46ff2672012-12-14 15:32:26 +00005243 image_view=AcquireVirtualCacheView(wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005244 p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
cristy4c08aed2011-07-01 19:47:50 +00005245 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00005246 {
5247 image_view=DestroyCacheView(image_view);
5248 return(MagickFalse);
5249 }
cristy4c08aed2011-07-01 19:47:50 +00005250 PixelSetQuantumPixel(wand->images,p,color);
cristy3ed852e2009-09-05 21:47:34 +00005251 image_view=DestroyCacheView(image_view);
5252 return(MagickTrue);
5253}
5254
5255/*
5256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5257% %
5258% %
5259% %
cristy3ed852e2009-09-05 21:47:34 +00005260% M a g i c k G e t I m a g e R e d P r i m a r y %
5261% %
5262% %
5263% %
5264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5265%
5266% MagickGetImageRedPrimary() returns the chromaticy red primary point.
5267%
5268% The format of the MagickGetImageRedPrimary method is:
5269%
5270% MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5271% double *y)
5272%
5273% A description of each parameter follows:
5274%
5275% o wand: the magick wand.
5276%
5277% o x: the chromaticity red primary x-point.
5278%
5279% o y: the chromaticity red primary y-point.
5280%
5281*/
5282WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5283 double *x,double *y)
5284{
5285 assert(wand != (MagickWand *) NULL);
5286 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005287 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005288 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5289 if (wand->images == (Image *) NULL)
5290 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5291 *x=wand->images->chromaticity.red_primary.x;
5292 *y=wand->images->chromaticity.red_primary.y;
5293 return(MagickTrue);
5294}
5295
5296/*
5297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5298% %
5299% %
5300% %
5301% M a g i c k G e t I m a g e R e g i o n %
5302% %
5303% %
5304% %
5305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5306%
5307% MagickGetImageRegion() extracts a region of the image and returns it as a
5308% a new wand.
5309%
5310% The format of the MagickGetImageRegion method is:
5311%
5312% MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005313% const size_t width,const size_t height,const ssize_t x,
5314% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005315%
5316% A description of each parameter follows:
5317%
5318% o wand: the magick wand.
5319%
5320% o width: the region width.
5321%
5322% o height: the region height.
5323%
5324% o x: the region x offset.
5325%
5326% o y: the region y offset.
5327%
5328*/
5329WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005330 const size_t width,const size_t height,const ssize_t x,
5331 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005332{
5333 Image
5334 *region_image;
5335
5336 RectangleInfo
5337 region;
5338
5339 assert(wand != (MagickWand *) NULL);
5340 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005341 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005342 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5343 if (wand->images == (Image *) NULL)
5344 return((MagickWand *) NULL);
5345 region.width=width;
5346 region.height=height;
5347 region.x=x;
5348 region.y=y;
5349 region_image=CropImage(wand->images,&region,wand->exception);
5350 if (region_image == (Image *) NULL)
5351 return((MagickWand *) NULL);
5352 return(CloneMagickWandFromImages(wand,region_image));
5353}
5354
5355/*
5356%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5357% %
5358% %
5359% %
5360% 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 %
5361% %
5362% %
5363% %
5364%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5365%
5366% MagickGetImageRenderingIntent() gets the image rendering intent.
5367%
5368% The format of the MagickGetImageRenderingIntent method is:
5369%
5370% RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5371%
5372% A description of each parameter follows:
5373%
5374% o wand: the magick wand.
5375%
5376*/
5377WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5378{
5379 assert(wand != (MagickWand *) NULL);
5380 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005381 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005382 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5383 if (wand->images == (Image *) NULL)
5384 {
5385 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005386 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005387 return(UndefinedIntent);
5388 }
5389 return((RenderingIntent) wand->images->rendering_intent);
5390}
5391
5392/*
5393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5394% %
5395% %
5396% %
5397% M a g i c k G e t I m a g e R e s o l u t i o n %
5398% %
5399% %
5400% %
5401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5402%
5403% MagickGetImageResolution() gets the image X and Y resolution.
5404%
5405% The format of the MagickGetImageResolution method is:
5406%
5407% MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5408% double *y)
5409%
5410% A description of each parameter follows:
5411%
5412% o wand: the magick wand.
5413%
5414% o x: the image x-resolution.
5415%
5416% o y: the image y-resolution.
5417%
5418*/
5419WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5420 double *x,double *y)
5421{
5422 assert(wand != (MagickWand *) NULL);
5423 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005424 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005425 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5426 if (wand->images == (Image *) NULL)
5427 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy2a11bef2011-10-28 18:33:11 +00005428 *x=wand->images->resolution.x;
5429 *y=wand->images->resolution.y;
cristy3ed852e2009-09-05 21:47:34 +00005430 return(MagickTrue);
5431}
5432
5433/*
5434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5435% %
5436% %
5437% %
5438% M a g i c k G e t I m a g e S c e n e %
5439% %
5440% %
5441% %
5442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5443%
5444% MagickGetImageScene() gets the image scene.
5445%
5446% The format of the MagickGetImageScene method is:
5447%
cristybb503372010-05-27 20:51:26 +00005448% size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005449%
5450% A description of each parameter follows:
5451%
5452% o wand: the magick wand.
5453%
5454*/
cristybb503372010-05-27 20:51:26 +00005455WandExport size_t MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005456{
5457 assert(wand != (MagickWand *) NULL);
5458 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005459 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005460 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5461 if (wand->images == (Image *) NULL)
5462 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5463 return(wand->images->scene);
5464}
5465
5466/*
5467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5468% %
5469% %
5470% %
5471% M a g i c k G e t I m a g e S i g n a t u r e %
5472% %
5473% %
5474% %
5475%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5476%
5477% MagickGetImageSignature() generates an SHA-256 message digest for the image
5478% pixel stream.
5479%
5480% The format of the MagickGetImageSignature method is:
5481%
cristy3a0daa42012-04-25 16:59:57 +00005482% char *MagickGetImageSignature(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005483%
5484% A description of each parameter follows:
5485%
5486% o wand: the magick wand.
5487%
5488*/
5489WandExport char *MagickGetImageSignature(MagickWand *wand)
5490{
5491 const char
5492 *value;
5493
5494 MagickBooleanType
5495 status;
5496
5497 assert(wand != (MagickWand *) NULL);
5498 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005499 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005500 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5501 if (wand->images == (Image *) NULL)
5502 {
5503 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005504 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005505 return((char *) NULL);
5506 }
cristy018f07f2011-09-04 21:15:19 +00005507 status=SignatureImage(wand->images,wand->exception);
cristy5221b602012-10-30 18:02:55 +00005508 if (IfMagickFalse(status))
cristy018f07f2011-09-04 21:15:19 +00005509 return((char *) NULL);
cristyd15e6592011-10-15 00:13:06 +00005510 value=GetImageProperty(wand->images,"signature",wand->exception);
cristy018f07f2011-09-04 21:15:19 +00005511 if (value == (const char *) NULL)
5512 return((char *) NULL);
5513 return(AcquireString(value));
cristy3ed852e2009-09-05 21:47:34 +00005514}
5515
5516/*
5517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5518% %
5519% %
5520% %
5521% 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 %
5522% %
5523% %
5524% %
5525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5526%
5527% MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5528%
5529% The format of the MagickGetImageTicksPerSecond method is:
5530%
cristybb503372010-05-27 20:51:26 +00005531% size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005532%
5533% A description of each parameter follows:
5534%
5535% o wand: the magick wand.
5536%
5537*/
cristybb503372010-05-27 20:51:26 +00005538WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005539{
5540 assert(wand != (MagickWand *) NULL);
5541 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005542 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005543 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5544 if (wand->images == (Image *) NULL)
5545 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristybb503372010-05-27 20:51:26 +00005546 return((size_t) wand->images->ticks_per_second);
cristy3ed852e2009-09-05 21:47:34 +00005547}
5548
5549/*
5550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5551% %
5552% %
5553% %
5554% M a g i c k G e t I m a g e T y p e %
5555% %
5556% %
5557% %
5558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5559%
5560% MagickGetImageType() gets the potential image type:
5561%
5562% Bilevel Grayscale GrayscaleMatte
5563% Palette PaletteMatte TrueColor
5564% TrueColorMatte ColorSeparation ColorSeparationMatte
5565%
5566% To ensure the image type matches its potential, use MagickSetImageType():
5567%
5568% (void) MagickSetImageType(wand,MagickGetImageType(wand));
5569%
5570% The format of the MagickGetImageType method is:
5571%
5572% ImageType MagickGetImageType(MagickWand *wand)
5573%
5574% A description of each parameter follows:
5575%
5576% o wand: the magick wand.
5577%
5578*/
5579WandExport ImageType MagickGetImageType(MagickWand *wand)
5580{
5581 assert(wand != (MagickWand *) NULL);
5582 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005583 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005584 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5585 if (wand->images == (Image *) NULL)
5586 {
5587 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005588 "ContainsNoImages","`%s'",wand->name);
cristy5f1c1ff2010-12-23 21:38:06 +00005589 return(UndefinedType);
cristy3ed852e2009-09-05 21:47:34 +00005590 }
5591 return(GetImageType(wand->images,wand->exception));
5592}
5593
5594/*
5595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5596% %
5597% %
5598% %
5599% M a g i c k G e t I m a g e U n i t s %
5600% %
5601% %
5602% %
5603%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5604%
5605% MagickGetImageUnits() gets the image units of resolution.
5606%
5607% The format of the MagickGetImageUnits method is:
5608%
5609% ResolutionType MagickGetImageUnits(MagickWand *wand)
5610%
5611% A description of each parameter follows:
5612%
5613% o wand: the magick wand.
5614%
5615*/
5616WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5617{
5618 assert(wand != (MagickWand *) NULL);
5619 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005620 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005621 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5622 if (wand->images == (Image *) NULL)
5623 {
5624 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005625 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005626 return(UndefinedResolution);
5627 }
5628 return(wand->images->units);
5629}
5630
5631/*
5632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5633% %
5634% %
5635% %
5636% 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 %
5637% %
5638% %
5639% %
5640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5641%
5642% MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5643% sepcified image.
5644%
5645% The format of the MagickGetImageVirtualPixelMethod method is:
5646%
5647% VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5648%
5649% A description of each parameter follows:
5650%
5651% o wand: the magick wand.
5652%
5653*/
5654WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5655{
5656 assert(wand != (MagickWand *) NULL);
5657 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005658 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005659 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5660 if (wand->images == (Image *) NULL)
5661 {
5662 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005663 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005664 return(UndefinedVirtualPixelMethod);
5665 }
5666 return(GetImageVirtualPixelMethod(wand->images));
5667}
5668
5669/*
5670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5671% %
5672% %
5673% %
5674% M a g i c k G e t I m a g e W h i t e P o i n t %
5675% %
5676% %
5677% %
5678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5679%
5680% MagickGetImageWhitePoint() returns the chromaticy white point.
5681%
5682% The format of the MagickGetImageWhitePoint method is:
5683%
5684% MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5685% double *y)
5686%
5687% A description of each parameter follows:
5688%
5689% o wand: the magick wand.
5690%
5691% o x: the chromaticity white x-point.
5692%
5693% o y: the chromaticity white y-point.
5694%
5695*/
5696WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5697 double *x,double *y)
5698{
5699 assert(wand != (MagickWand *) NULL);
5700 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005701 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005702 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5703 if (wand->images == (Image *) NULL)
5704 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5705 *x=wand->images->chromaticity.white_point.x;
5706 *y=wand->images->chromaticity.white_point.y;
5707 return(MagickTrue);
5708}
5709
5710/*
5711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5712% %
5713% %
5714% %
5715% M a g i c k G e t I m a g e W i d t h %
5716% %
5717% %
5718% %
5719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5720%
5721% MagickGetImageWidth() returns the image width.
5722%
5723% The format of the MagickGetImageWidth method is:
5724%
cristybb503372010-05-27 20:51:26 +00005725% size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005726%
5727% A description of each parameter follows:
5728%
5729% o wand: the magick wand.
5730%
5731*/
cristybb503372010-05-27 20:51:26 +00005732WandExport size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005733{
5734 assert(wand != (MagickWand *) NULL);
5735 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005736 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005737 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5738 if (wand->images == (Image *) NULL)
5739 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5740 return(wand->images->columns);
5741}
5742
5743/*
5744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5745% %
5746% %
5747% %
5748% M a g i c k G e t N u m b e r I m a g e s %
5749% %
5750% %
5751% %
5752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5753%
5754% MagickGetNumberImages() returns the number of images associated with a
5755% magick wand.
5756%
5757% The format of the MagickGetNumberImages method is:
5758%
cristybb503372010-05-27 20:51:26 +00005759% size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005760%
5761% A description of each parameter follows:
5762%
5763% o wand: the magick wand.
5764%
5765*/
cristybb503372010-05-27 20:51:26 +00005766WandExport size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005767{
5768 assert(wand != (MagickWand *) NULL);
5769 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005770 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005771 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5772 return(GetImageListLength(wand->images));
5773}
5774
5775/*
5776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5777% %
5778% %
5779% %
5780% 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 %
5781% %
5782% %
5783% %
5784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5785%
5786% MagickGetImageTotalInkDensity() gets the image total ink density.
5787%
5788% The format of the MagickGetImageTotalInkDensity method is:
5789%
5790% double MagickGetImageTotalInkDensity(MagickWand *wand)
5791%
5792% A description of each parameter follows:
5793%
5794% o wand: the magick wand.
5795%
5796*/
5797WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5798{
5799 assert(wand != (MagickWand *) NULL);
5800 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005801 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005802 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5803 if (wand->images == (Image *) NULL)
5804 {
5805 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005806 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005807 return(0.0);
5808 }
cristy7c3af952011-10-20 16:04:16 +00005809 return(GetImageTotalInkDensity(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00005810}
5811
5812/*
5813%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5814% %
5815% %
5816% %
5817% M a g i c k H a l d C l u t I m a g e %
5818% %
5819% %
5820% %
5821%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5822%
5823% MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5824% table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
5825% dimensions. Create it with the HALD coder. You can apply any color
5826% transformation to the Hald image and then use this method to apply the
5827% transform to the image.
5828%
5829% The format of the MagickHaldClutImage method is:
5830%
5831% MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5832% const MagickWand *hald_wand)
cristy3ed852e2009-09-05 21:47:34 +00005833%
5834% A description of each parameter follows:
5835%
5836% o wand: the magick wand.
5837%
5838% o hald_image: the hald CLUT image.
5839%
5840*/
cristy3ed852e2009-09-05 21:47:34 +00005841WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5842 const MagickWand *hald_wand)
5843{
5844 MagickBooleanType
5845 status;
5846
cristy3ed852e2009-09-05 21:47:34 +00005847 assert(wand != (MagickWand *) NULL);
5848 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005849 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005850 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5851 if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5852 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00005853 status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00005854 return(status);
cristy3ed852e2009-09-05 21:47:34 +00005855}
5856
5857/*
5858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5859% %
5860% %
5861% %
5862% M a g i c k H a s N e x t I m a g e %
5863% %
5864% %
5865% %
5866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5867%
5868% MagickHasNextImage() returns MagickTrue if the wand has more images when
5869% traversing the list in the forward direction
5870%
5871% The format of the MagickHasNextImage method is:
5872%
5873% MagickBooleanType MagickHasNextImage(MagickWand *wand)
5874%
5875% A description of each parameter follows:
5876%
5877% o wand: the magick wand.
5878%
5879*/
5880WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5881{
5882 assert(wand != (MagickWand *) NULL);
5883 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005884 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005885 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5886 if (wand->images == (Image *) NULL)
5887 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5888 if (GetNextImageInList(wand->images) == (Image *) NULL)
5889 return(MagickFalse);
5890 return(MagickTrue);
5891}
5892
5893/*
5894%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5895% %
5896% %
5897% %
5898% M a g i c k H a s P r e v i o u s I m a g e %
5899% %
5900% %
5901% %
5902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5903%
5904% MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5905% traversing the list in the reverse direction
5906%
5907% The format of the MagickHasPreviousImage method is:
5908%
5909% MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5910%
5911% A description of each parameter follows:
5912%
5913% o wand: the magick wand.
5914%
5915*/
5916WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5917{
5918 assert(wand != (MagickWand *) NULL);
5919 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005920 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005921 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5922 if (wand->images == (Image *) NULL)
5923 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5924 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5925 return(MagickFalse);
5926 return(MagickTrue);
5927}
5928
5929/*
5930%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5931% %
5932% %
5933% %
5934% M a g i c k I d e n t i f y I m a g e %
5935% %
5936% %
5937% %
5938%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5939%
5940% MagickIdentifyImage() identifies an image by printing its attributes to the
5941% file. Attributes include the image width, height, size, and others.
5942%
5943% The format of the MagickIdentifyImage method is:
5944%
5945% const char *MagickIdentifyImage(MagickWand *wand)
5946%
5947% A description of each parameter follows:
5948%
5949% o wand: the magick wand.
5950%
5951*/
5952WandExport char *MagickIdentifyImage(MagickWand *wand)
5953{
5954 char
5955 *description,
5956 filename[MaxTextExtent];
5957
5958 FILE
5959 *file;
5960
5961 int
5962 unique_file;
5963
5964 assert(wand != (MagickWand *) NULL);
5965 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00005966 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00005967 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5968 if (wand->images == (Image *) NULL)
5969 {
5970 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005971 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005972 return((char *) NULL);
5973 }
5974 description=(char *) NULL;
5975 unique_file=AcquireUniqueFileResource(filename);
5976 file=(FILE *) NULL;
5977 if (unique_file != -1)
5978 file=fdopen(unique_file,"wb");
5979 if ((unique_file == -1) || (file == (FILE *) NULL))
5980 {
5981 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005982 "UnableToCreateTemporaryFile","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005983 return((char *) NULL);
5984 }
cristya4037272011-08-28 15:11:39 +00005985 (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005986 (void) fclose(file);
cristy3a5987c2013-11-07 14:18:46 +00005987 description=FileToString(filename,~0UL,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005988 (void) RelinquishUniqueFileResource(filename);
5989 return(description);
5990}
5991
5992/*
5993%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5994% %
5995% %
5996% %
5997% M a g i c k I m p l o d e I m a g e %
5998% %
5999% %
6000% %
6001%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6002%
6003% MagickImplodeImage() creates a new image that is a copy of an existing
6004% one with the image pixels "implode" by the specified percentage. It
6005% allocates the memory necessary for the new Image structure and returns a
6006% pointer to the new image.
6007%
6008% The format of the MagickImplodeImage method is:
6009%
6010% MagickBooleanType MagickImplodeImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +00006011% const double radius,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006012%
6013% A description of each parameter follows:
6014%
6015% o wand: the magick wand.
6016%
6017% o amount: Define the extent of the implosion.
6018%
cristy76f512e2011-09-12 01:26:56 +00006019% o method: the pixel interpolation method.
6020%
cristy3ed852e2009-09-05 21:47:34 +00006021*/
6022WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +00006023 const double amount,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006024{
6025 Image
6026 *implode_image;
6027
6028 assert(wand != (MagickWand *) NULL);
6029 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006030 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006031 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6032 if (wand->images == (Image *) NULL)
6033 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +00006034 implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006035 if (implode_image == (Image *) NULL)
6036 return(MagickFalse);
6037 ReplaceImageInList(&wand->images,implode_image);
6038 return(MagickTrue);
6039}
6040
6041/*
6042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6043% %
6044% %
6045% %
6046% M a g i c k I m p o r t I m a g e P i x e l s %
6047% %
6048% %
6049% %
6050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6051%
6052% MagickImportImagePixels() accepts pixel datand stores it in the image at the
6053% location you specify. The method returns MagickFalse on success otherwise
6054% MagickTrue if an error is encountered. The pixel data can be either char,
cristybb503372010-05-27 20:51:26 +00006055% short int, int, ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00006056%
6057% Suppose your want to upload the first scanline of a 640x480 image from
6058% character data in red-green-blue order:
6059%
6060% MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6061%
6062% The format of the MagickImportImagePixels method is:
6063%
6064% MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006065% const ssize_t x,const ssize_t y,const size_t columns,
6066% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00006067% const void *pixels)
6068%
6069% A description of each parameter follows:
6070%
6071% o wand: the magick wand.
6072%
6073% o x, y, columns, rows: These values define the perimeter of a region
6074% of pixels you want to define.
6075%
6076% o map: This string reflects the expected ordering of the pixel array.
6077% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00006078% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00006079% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6080% P = pad.
6081%
6082% o storage: Define the data type of the pixels. Float and double types are
6083% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
6084% these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6085% or DoublePixel.
6086%
6087% o pixels: This array of values contain the pixel components as defined by
6088% map and type. You must preallocate this array where the expected
6089% length varies depending on the values of width, height, map, and type.
6090%
6091*/
6092WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristy018f07f2011-09-04 21:15:19 +00006093 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6094 const char *map,const StorageType storage,const void *pixels)
cristy3ed852e2009-09-05 21:47:34 +00006095{
6096 MagickBooleanType
6097 status;
6098
6099 assert(wand != (MagickWand *) NULL);
6100 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006101 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006102 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6103 if (wand->images == (Image *) NULL)
6104 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00006105 status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6106 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006107 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006108}
6109
6110/*
6111%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6112% %
6113% %
6114% %
anthonyfd706f92012-01-19 04:22:02 +00006115% M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e %
6116% %
6117% %
6118% %
6119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6120%
6121% MagickInterpolativeResizeImage() resize image using a interpolative
6122% method.
6123%
6124% MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6125% const size_t columns,const size_t rows,
6126% const PixelInterpolateMethod method)
6127%
6128% A description of each parameter follows:
6129%
6130% o wand: the magick wand.
6131%
6132% o columns: the number of columns in the scaled image.
6133%
6134% o rows: the number of rows in the scaled image.
6135%
6136% o interpolate: the pixel interpolation method.
6137%
6138*/
6139WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6140 const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6141{
6142 Image
6143 *resize_image;
6144
6145 assert(wand != (MagickWand *) NULL);
6146 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006147 if (IfMagickTrue(wand->debug))
anthonyfd706f92012-01-19 04:22:02 +00006148 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6149 if (wand->images == (Image *) NULL)
6150 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6151 resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6152 wand->exception);
6153 if (resize_image == (Image *) NULL)
6154 return(MagickFalse);
6155 ReplaceImageInList(&wand->images,resize_image);
6156 return(MagickTrue);
6157}
6158
6159/*
6160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6161% %
6162% %
6163% %
cristy3ed852e2009-09-05 21:47:34 +00006164% 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 %
6165% %
6166% %
6167% %
6168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6169%
6170% MagickInverseFourierTransformImage() implements the inverse discrete
6171% Fourier transform (DFT) of the image either as a magnitude / phase or real /
6172% imaginary image pair.
6173%
6174% The format of the MagickInverseFourierTransformImage method is:
6175%
6176% MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00006177% MagickWand *magnitude_wand,MagickWand *phase_wand,
6178% const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00006179%
6180% A description of each parameter follows:
6181%
cristyc9550792009-11-13 20:05:42 +00006182% o magnitude_wand: the magnitude or real wand.
6183%
6184% o phase_wand: the phase or imaginary wand.
cristy3ed852e2009-09-05 21:47:34 +00006185%
6186% o magnitude: if true, return as magnitude / phase pair otherwise a real /
6187% imaginary image pair.
6188%
6189*/
6190WandExport MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00006191 MagickWand *magnitude_wand,MagickWand *phase_wand,
6192 const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00006193{
6194 Image
6195 *inverse_image;
6196
cristyc9550792009-11-13 20:05:42 +00006197 MagickWand
6198 *wand;
6199
6200 assert(magnitude_wand != (MagickWand *) NULL);
6201 assert(magnitude_wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006202 if (IfMagickTrue(magnitude_wand->debug))
cristyc9550792009-11-13 20:05:42 +00006203 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6204 magnitude_wand->name);
6205 wand=magnitude_wand;
6206 if (magnitude_wand->images == (Image *) NULL)
6207 ThrowWandException(WandError,"ContainsNoImages",
6208 magnitude_wand->name);
6209 assert(phase_wand != (MagickWand *) NULL);
6210 assert(phase_wand->signature == WandSignature);
6211 inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6212 phase_wand->images,magnitude,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006213 if (inverse_image == (Image *) NULL)
6214 return(MagickFalse);
6215 ReplaceImageInList(&wand->images,inverse_image);
6216 return(MagickTrue);
6217}
6218
6219/*
6220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6221% %
6222% %
6223% %
6224% M a g i c k L a b e l I m a g e %
6225% %
6226% %
6227% %
6228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6229%
6230% MagickLabelImage() adds a label to your image.
6231%
6232% The format of the MagickLabelImage method is:
6233%
6234% MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6235%
6236% A description of each parameter follows:
6237%
6238% o wand: the magick wand.
6239%
6240% o label: the image label.
6241%
6242*/
6243WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6244 const char *label)
6245{
6246 MagickBooleanType
6247 status;
6248
6249 assert(wand != (MagickWand *) NULL);
6250 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006251 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006252 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6253 if (wand->images == (Image *) NULL)
6254 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd15e6592011-10-15 00:13:06 +00006255 status=SetImageProperty(wand->images,"label",label,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006256 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006257}
6258
6259/*
6260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6261% %
6262% %
6263% %
6264% M a g i c k L e v e l I m a g e %
6265% %
6266% %
6267% %
6268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6269%
6270% MagickLevelImage() adjusts the levels of an image by scaling the colors
6271% falling between specified white and black points to the full available
6272% quantum range. The parameters provided represent the black, mid, and white
6273% points. The black point specifies the darkest color in the image. Colors
6274% darker than the black point are set to zero. Mid point specifies a gamma
6275% correction to apply to the image. White point specifies the lightest color
6276% in the image. Colors brighter than the white point are set to the maximum
6277% quantum value.
6278%
6279% The format of the MagickLevelImage method is:
6280%
6281% MagickBooleanType MagickLevelImage(MagickWand *wand,
6282% const double black_point,const double gamma,const double white_point)
cristyf89cb1d2011-07-07 01:24:37 +00006283% MagickBooleanType MagickLevelImage(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00006284% const ChannelType channel,const double black_point,const double gamma,
6285% const double white_point)
6286%
6287% A description of each parameter follows:
6288%
6289% o wand: the magick wand.
6290%
cristyd3090f92011-10-18 00:05:15 +00006291% o channel: Identify which channel to level: RedPixelChannel,
6292% GreenPixelChannel, etc.
cristy3ed852e2009-09-05 21:47:34 +00006293%
6294% o black_point: the black point.
6295%
6296% o gamma: the gamma.
6297%
6298% o white_point: the white point.
6299%
6300*/
cristy3ed852e2009-09-05 21:47:34 +00006301WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6302 const double black_point,const double gamma,const double white_point)
6303{
6304 MagickBooleanType
6305 status;
6306
cristy3ed852e2009-09-05 21:47:34 +00006307 assert(wand != (MagickWand *) NULL);
6308 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006309 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006310 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6311 if (wand->images == (Image *) NULL)
6312 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy01e9afd2011-08-10 17:38:41 +00006313 status=LevelImage(wand->images,black_point,white_point,gamma,
cristy5f49bdb2011-10-16 14:28:56 +00006314 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006315 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006316}
6317
6318/*
6319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6320% %
6321% %
6322% %
6323% M a g i c k L i n e a r S t r e t c h I m a g e %
6324% %
6325% %
6326% %
6327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6328%
6329% MagickLinearStretchImage() stretches with saturation the image intensity.
6330%
6331% You can also reduce the influence of a particular channel with a gamma
6332% value of 0.
6333%
6334% The format of the MagickLinearStretchImage method is:
6335%
6336% MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6337% const double black_point,const double white_point)
6338%
6339% A description of each parameter follows:
6340%
6341% o wand: the magick wand.
6342%
6343% o black_point: the black point.
6344%
6345% o white_point: the white point.
6346%
6347*/
6348WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6349 const double black_point,const double white_point)
6350{
6351 MagickBooleanType
6352 status;
6353
6354 assert(wand != (MagickWand *) NULL);
6355 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006356 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006357 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6358 if (wand->images == (Image *) NULL)
6359 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy33bd5152011-08-24 01:42:24 +00006360 status=LinearStretchImage(wand->images,black_point,white_point,
cristy5f49bdb2011-10-16 14:28:56 +00006361 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006362 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006363}
6364
6365/*
6366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6367% %
6368% %
6369% %
6370% M a g i c k L i q u i d R e s c a l e I m a g e %
6371% %
6372% %
6373% %
6374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6375%
6376% MagickLiquidRescaleImage() rescales image with seam carving.
6377%
6378% MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006379% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006380% const double delta_x,const double rigidity)
6381%
6382% A description of each parameter follows:
6383%
6384% o wand: the magick wand.
6385%
6386% o columns: the number of columns in the scaled image.
6387%
6388% o rows: the number of rows in the scaled image.
6389%
6390% o delta_x: maximum seam transversal step (0 means straight seams).
6391%
6392% o rigidity: introduce a bias for non-straight seams (typically 0).
6393%
6394*/
6395WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006396 const size_t columns,const size_t rows,const double delta_x,
cristy3ed852e2009-09-05 21:47:34 +00006397 const double rigidity)
6398{
6399 Image
6400 *rescale_image;
6401
6402 assert(wand != (MagickWand *) NULL);
6403 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006404 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006405 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6406 if (wand->images == (Image *) NULL)
6407 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6408 rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6409 rigidity,wand->exception);
6410 if (rescale_image == (Image *) NULL)
6411 return(MagickFalse);
6412 ReplaceImageInList(&wand->images,rescale_image);
6413 return(MagickTrue);
6414}
6415
6416/*
6417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6418% %
6419% %
6420% %
6421% M a g i c k M a g n i f y I m a g e %
6422% %
6423% %
6424% %
6425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6426%
6427% MagickMagnifyImage() is a convenience method that scales an image
6428% proportionally to twice its original size.
6429%
6430% The format of the MagickMagnifyImage method is:
6431%
6432% MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6433%
6434% A description of each parameter follows:
6435%
6436% o wand: the magick wand.
6437%
6438*/
6439WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6440{
6441 Image
6442 *magnify_image;
6443
6444 assert(wand != (MagickWand *) NULL);
6445 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006446 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006447 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6448 if (wand->images == (Image *) NULL)
6449 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6450 magnify_image=MagnifyImage(wand->images,wand->exception);
6451 if (magnify_image == (Image *) NULL)
6452 return(MagickFalse);
6453 ReplaceImageInList(&wand->images,magnify_image);
6454 return(MagickTrue);
6455}
6456
6457/*
6458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6459% %
6460% %
6461% %
cristy3ed852e2009-09-05 21:47:34 +00006462% M a g i c k M e r g e I m a g e L a y e r s %
6463% %
6464% %
6465% %
6466%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6467%
cristy733678d2011-03-18 21:29:28 +00006468% MagickMergeImageLayers() composes all the image layers from the current
6469% given image onward to produce a single image of the merged layers.
cristy3ed852e2009-09-05 21:47:34 +00006470%
cristya0417062012-09-02 23:34:56 +00006471% The inital canvas's size depends on the given LayerMethod, and is
cristy3ed852e2009-09-05 21:47:34 +00006472% initialized using the first images background color. The images
6473% are then compositied onto that image in sequence using the given
6474% composition that has been assigned to each individual image.
6475%
6476% The format of the MagickMergeImageLayers method is:
6477%
6478% MagickWand *MagickMergeImageLayers(MagickWand *wand,
cristya0417062012-09-02 23:34:56 +00006479% const LayerMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006480%
6481% A description of each parameter follows:
6482%
6483% o wand: the magick wand.
6484%
6485% o method: the method of selecting the size of the initial canvas.
6486%
6487% MergeLayer: Merge all layers onto a canvas just large enough
6488% to hold all the actual images. The virtual canvas of the
6489% first image is preserved but otherwise ignored.
6490%
6491% FlattenLayer: Use the virtual canvas size of first image.
6492% Images which fall outside this canvas is clipped.
6493% This can be used to 'fill out' a given virtual canvas.
6494%
6495% MosaicLayer: Start with the virtual canvas of the first image,
6496% enlarging left and right edges to contain all images.
6497% Images with negative offsets will be clipped.
6498%
6499*/
6500WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
cristya0417062012-09-02 23:34:56 +00006501 const LayerMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006502{
6503 Image
6504 *mosaic_image;
6505
6506 assert(wand != (MagickWand *) NULL);
6507 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006508 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006509 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6510 if (wand->images == (Image *) NULL)
6511 return((MagickWand *) NULL);
6512 mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6513 if (mosaic_image == (Image *) NULL)
6514 return((MagickWand *) NULL);
6515 return(CloneMagickWandFromImages(wand,mosaic_image));
6516}
6517
6518/*
6519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6520% %
6521% %
6522% %
6523% M a g i c k M i n i f y I m a g e %
6524% %
6525% %
6526% %
6527%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6528%
6529% MagickMinifyImage() is a convenience method that scales an image
6530% proportionally to one-half its original size
6531%
6532% The format of the MagickMinifyImage method is:
6533%
6534% MagickBooleanType MagickMinifyImage(MagickWand *wand)
6535%
6536% A description of each parameter follows:
6537%
6538% o wand: the magick wand.
6539%
6540*/
6541WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6542{
6543 Image
6544 *minify_image;
6545
6546 assert(wand != (MagickWand *) NULL);
6547 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006548 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006549 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6550 if (wand->images == (Image *) NULL)
6551 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6552 minify_image=MinifyImage(wand->images,wand->exception);
6553 if (minify_image == (Image *) NULL)
6554 return(MagickFalse);
6555 ReplaceImageInList(&wand->images,minify_image);
6556 return(MagickTrue);
6557}
6558
6559/*
6560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6561% %
6562% %
6563% %
6564% M a g i c k M o d u l a t e I m a g e %
6565% %
6566% %
6567% %
6568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6569%
6570% MagickModulateImage() lets you control the brightness, saturation, and hue
6571% of an image. Hue is the percentage of absolute rotation from the current
6572% position. For example 50 results in a counter-clockwise rotation of 90
6573% degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6574% both resulting in a rotation of 180 degrees.
6575%
6576% To increase the color brightness by 20% and decrease the color saturation by
6577% 10% and leave the hue unchanged, use: 120,90,100.
6578%
6579% The format of the MagickModulateImage method is:
6580%
6581% MagickBooleanType MagickModulateImage(MagickWand *wand,
6582% const double brightness,const double saturation,const double hue)
6583%
6584% A description of each parameter follows:
6585%
6586% o wand: the magick wand.
6587%
6588% o brightness: the percent change in brighness.
6589%
6590% o saturation: the percent change in saturation.
6591%
6592% o hue: the percent change in hue.
6593%
6594*/
6595WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6596 const double brightness,const double saturation,const double hue)
6597{
6598 char
6599 modulate[MaxTextExtent];
6600
6601 MagickBooleanType
6602 status;
6603
6604 assert(wand != (MagickWand *) NULL);
6605 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006606 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006607 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6608 if (wand->images == (Image *) NULL)
6609 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +00006610 (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
cristy8cd5b312010-01-07 01:10:24 +00006611 brightness,saturation,hue);
cristy5f49bdb2011-10-16 14:28:56 +00006612 status=ModulateImage(wand->images,modulate,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006613 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006614}
6615
6616/*
6617%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6618% %
6619% %
6620% %
6621% M a g i c k M o n t a g e I m a g e %
6622% %
6623% %
6624% %
6625%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6626%
6627% MagickMontageImage() creates a composite image by combining several
6628% separate images. The images are tiled on the composite image with the name
6629% of the image optionally appearing just below the individual tile.
6630%
6631% The format of the MagickMontageImage method is:
6632%
6633% MagickWand *MagickMontageImage(MagickWand *wand,
6634% const DrawingWand drawing_wand,const char *tile_geometry,
6635% const char *thumbnail_geometry,const MontageMode mode,
6636% const char *frame)
6637%
6638% A description of each parameter follows:
6639%
6640% o wand: the magick wand.
6641%
6642% o drawing_wand: the drawing wand. The font name, size, and color are
6643% obtained from this wand.
6644%
6645% o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6646%
6647% o thumbnail_geometry: Preferred image size and border size of each
6648% thumbnail (e.g. 120x120+4+3>).
6649%
6650% o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6651%
6652% o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6653% The frame color is that of the thumbnail's matte color.
6654%
6655*/
6656WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6657 const DrawingWand *drawing_wand,const char *tile_geometry,
6658 const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6659{
6660 char
6661 *font;
6662
6663 Image
6664 *montage_image;
6665
6666 MontageInfo
6667 *montage_info;
6668
6669 PixelWand
6670 *pixel_wand;
6671
6672 assert(wand != (MagickWand *) NULL);
6673 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006674 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006675 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6676 if (wand->images == (Image *) NULL)
6677 return((MagickWand *) NULL);
6678 montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6679 switch (mode)
6680 {
6681 case FrameMode:
6682 {
6683 (void) CloneString(&montage_info->frame,"15x15+3+3");
6684 montage_info->shadow=MagickTrue;
6685 break;
6686 }
6687 case UnframeMode:
6688 {
6689 montage_info->frame=(char *) NULL;
6690 montage_info->shadow=MagickFalse;
6691 montage_info->border_width=0;
6692 break;
6693 }
6694 case ConcatenateMode:
6695 {
6696 montage_info->frame=(char *) NULL;
6697 montage_info->shadow=MagickFalse;
6698 (void) CloneString(&montage_info->geometry,"+0+0");
6699 montage_info->border_width=0;
6700 break;
6701 }
6702 default:
6703 break;
6704 }
6705 font=DrawGetFont(drawing_wand);
6706 if (font != (char *) NULL)
6707 (void) CloneString(&montage_info->font,font);
6708 if (frame != (char *) NULL)
6709 (void) CloneString(&montage_info->frame,frame);
6710 montage_info->pointsize=DrawGetFontSize(drawing_wand);
6711 pixel_wand=NewPixelWand();
6712 DrawGetFillColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006713 PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
cristy3ed852e2009-09-05 21:47:34 +00006714 DrawGetStrokeColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006715 PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
cristy3ed852e2009-09-05 21:47:34 +00006716 pixel_wand=DestroyPixelWand(pixel_wand);
6717 if (thumbnail_geometry != (char *) NULL)
6718 (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6719 if (tile_geometry != (char *) NULL)
6720 (void) CloneString(&montage_info->tile,tile_geometry);
6721 montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6722 wand->exception);
6723 montage_info=DestroyMontageInfo(montage_info);
6724 if (montage_image == (Image *) NULL)
6725 return((MagickWand *) NULL);
6726 return(CloneMagickWandFromImages(wand,montage_image));
6727}
6728
6729/*
6730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6731% %
6732% %
6733% %
6734% M a g i c k M o r p h I m a g e s %
6735% %
6736% %
6737% %
6738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6739%
6740% MagickMorphImages() method morphs a set of images. Both the image pixels
6741% and size are linearly interpolated to give the appearance of a
6742% meta-morphosis from one image to the next.
6743%
6744% The format of the MagickMorphImages method is:
6745%
6746% MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006747% const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006748%
6749% A description of each parameter follows:
6750%
6751% o wand: the magick wand.
6752%
6753% o number_frames: the number of in-between images to generate.
6754%
6755*/
6756WandExport MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006757 const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006758{
6759 Image
6760 *morph_image;
6761
6762 assert(wand != (MagickWand *) NULL);
6763 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006764 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006765 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6766 if (wand->images == (Image *) NULL)
6767 return((MagickWand *) NULL);
6768 morph_image=MorphImages(wand->images,number_frames,wand->exception);
6769 if (morph_image == (Image *) NULL)
6770 return((MagickWand *) NULL);
6771 return(CloneMagickWandFromImages(wand,morph_image));
6772}
6773
6774/*
6775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6776% %
6777% %
6778% %
cristya0b81c32010-01-22 02:54:33 +00006779% M a g i c k M o r p h o l o g y I m a g e %
6780% %
6781% %
6782% %
6783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6784%
6785% MagickMorphologyImage() applies a user supplied kernel to the image
6786% according to the given mophology method.
6787%
6788% The format of the MagickMorphologyImage method is:
6789%
6790% MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006791% MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006792%
6793% A description of each parameter follows:
6794%
6795% o wand: the magick wand.
6796%
cristya0b81c32010-01-22 02:54:33 +00006797% o method: the morphology method to be applied.
6798%
6799% o iterations: apply the operation this many times (or no change).
6800% A value of -1 means loop until no change found. How this is applied
6801% may depend on the morphology method. Typically this is a value of 1.
6802%
6803% o kernel: An array of doubles representing the morphology kernel.
6804%
6805*/
cristya0b81c32010-01-22 02:54:33 +00006806WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006807 MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006808{
cristya0b81c32010-01-22 02:54:33 +00006809 Image
6810 *morphology_image;
6811
6812 assert(wand != (MagickWand *) NULL);
6813 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006814 if (IfMagickTrue(wand->debug))
cristya0b81c32010-01-22 02:54:33 +00006815 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6816 if (kernel == (const KernelInfo *) NULL)
6817 return(MagickFalse);
6818 if (wand->images == (Image *) NULL)
6819 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00006820 morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6821 wand->exception);
cristya0b81c32010-01-22 02:54:33 +00006822 if (morphology_image == (Image *) NULL)
6823 return(MagickFalse);
6824 ReplaceImageInList(&wand->images,morphology_image);
6825 return(MagickTrue);
6826}
6827
6828/*
6829%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6830% %
6831% %
6832% %
cristy3ed852e2009-09-05 21:47:34 +00006833% M a g i c k M o t i o n B l u r I m a g e %
6834% %
6835% %
6836% %
6837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6838%
6839% MagickMotionBlurImage() simulates motion blur. We convolve the image with a
6840% Gaussian operator of the given radius and standard deviation (sigma).
6841% For reasonable results, radius should be larger than sigma. Use a
6842% radius of 0 and MotionBlurImage() selects a suitable radius for you.
6843% Angle gives the angle of the blurring motion.
6844%
6845% The format of the MagickMotionBlurImage method is:
6846%
6847% MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00006848% const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +00006849%
6850% A description of each parameter follows:
6851%
6852% o wand: the magick wand.
6853%
cristy3ed852e2009-09-05 21:47:34 +00006854% o radius: the radius of the Gaussian, in pixels, not counting
6855% the center pixel.
6856%
6857% o sigma: the standard deviation of the Gaussian, in pixels.
6858%
cristycee97112010-05-28 00:44:52 +00006859% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00006860%
6861*/
cristy3ed852e2009-09-05 21:47:34 +00006862WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00006863 const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +00006864{
cristy3ed852e2009-09-05 21:47:34 +00006865 Image
6866 *blur_image;
6867
6868 assert(wand != (MagickWand *) NULL);
6869 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006870 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006871 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6872 if (wand->images == (Image *) NULL)
6873 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +00006874 blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006875 if (blur_image == (Image *) NULL)
6876 return(MagickFalse);
6877 ReplaceImageInList(&wand->images,blur_image);
6878 return(MagickTrue);
6879}
6880
6881/*
6882%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6883% %
6884% %
6885% %
6886% M a g i c k N e g a t e I m a g e %
6887% %
6888% %
6889% %
6890%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6891%
6892% MagickNegateImage() negates the colors in the reference image. The
6893% Grayscale option means that only grayscale values within the image are
6894% negated.
6895%
6896% You can also reduce the influence of a particular channel with a gamma
6897% value of 0.
6898%
6899% The format of the MagickNegateImage method is:
6900%
6901% MagickBooleanType MagickNegateImage(MagickWand *wand,
6902% const MagickBooleanType gray)
cristy3ed852e2009-09-05 21:47:34 +00006903%
6904% A description of each parameter follows:
6905%
6906% o wand: the magick wand.
6907%
cristy3ed852e2009-09-05 21:47:34 +00006908% o gray: If MagickTrue, only negate grayscale pixels within the image.
6909%
6910*/
cristy3ed852e2009-09-05 21:47:34 +00006911WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6912 const MagickBooleanType gray)
6913{
6914 MagickBooleanType
6915 status;
6916
cristy3ed852e2009-09-05 21:47:34 +00006917 assert(wand != (MagickWand *) NULL);
6918 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006919 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006920 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6921 if (wand->images == (Image *) NULL)
6922 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00006923 status=NegateImage(wand->images,gray,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006924 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006925}
6926
6927/*
6928%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6929% %
6930% %
6931% %
6932% M a g i c k N e w I m a g e %
6933% %
6934% %
6935% %
6936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6937%
6938% MagickNewImage() adds a blank image canvas of the specified size and
6939% background color to the wand.
6940%
6941% The format of the MagickNewImage method is:
6942%
6943% MagickBooleanType MagickNewImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006944% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006945% const PixelWand *background)
6946%
6947% A description of each parameter follows:
6948%
6949% o wand: the magick wand.
6950%
6951% o width: the image width.
6952%
6953% o height: the image height.
6954%
6955% o background: the image color.
6956%
6957*/
cristy0740a982011-10-13 15:01:01 +00006958WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6959 const size_t height,const PixelWand *background)
cristy3ed852e2009-09-05 21:47:34 +00006960{
6961 Image
6962 *images;
6963
cristy4c08aed2011-07-01 19:47:50 +00006964 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00006965 pixel;
6966
6967 assert(wand != (MagickWand *) NULL);
6968 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00006969 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00006970 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6971 PixelGetMagickColor(background,&pixel);
cristy269c9412011-10-13 23:41:15 +00006972 images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006973 if (images == (Image *) NULL)
6974 return(MagickFalse);
cristy3ed852e2009-09-05 21:47:34 +00006975 return(InsertImageInWand(wand,images));
6976}
6977
6978/*
6979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6980% %
6981% %
6982% %
6983% M a g i c k N e x t I m a g e %
6984% %
6985% %
6986% %
6987%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6988%
anthony45083312012-03-14 14:49:12 +00006989% MagickNextImage() sets the next image in the wand as the current image.
anthonyade6afb2012-03-15 13:24:43 +00006990%
anthonyf93964e2012-03-16 08:25:58 +00006991% It is typically used after MagickResetIterator(), after which its first use
6992% will set the first image as the current image (unless the wand is empty).
6993%
6994% It will return MagickFalse when no more images are left to be returned
6995% which happens when the wand is empty, or the current image is the last
6996% image.
6997%
6998% When the above condition (end of image list) is reached, the iterator is
6999% automaticall set so that you can start using MagickPreviousImage() to
7000% again iterate over the images in the reverse direction, starting with the
7001% last image (again). You can jump to this condition immeditally using
7002% MagickSetLastIterator().
cristy3ed852e2009-09-05 21:47:34 +00007003%
7004% The format of the MagickNextImage method is:
7005%
7006% MagickBooleanType MagickNextImage(MagickWand *wand)
7007%
7008% A description of each parameter follows:
7009%
7010% o wand: the magick wand.
7011%
7012*/
7013WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7014{
7015 assert(wand != (MagickWand *) NULL);
7016 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007017 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007018 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7019 if (wand->images == (Image *) NULL)
7020 ThrowWandException(WandError,"ContainsNoImages",wand->name);
anthony45083312012-03-14 14:49:12 +00007021 wand->insert_before=MagickFalse; /* Inserts is now appended */
cristy5221b602012-10-30 18:02:55 +00007022 if (IfMagickTrue(wand->image_pending))
cristy3ed852e2009-09-05 21:47:34 +00007023 {
anthonya89dd172011-10-04 13:29:35 +00007024 wand->image_pending=MagickFalse;
cristy3ed852e2009-09-05 21:47:34 +00007025 return(MagickTrue);
7026 }
7027 if (GetNextImageInList(wand->images) == (Image *) NULL)
anthony45083312012-03-14 14:49:12 +00007028 {
7029 wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
cristy3ed852e2009-09-05 21:47:34 +00007030 return(MagickFalse);
anthony45083312012-03-14 14:49:12 +00007031 }
cristy3ed852e2009-09-05 21:47:34 +00007032 wand->images=GetNextImageInList(wand->images);
7033 return(MagickTrue);
7034}
7035
7036/*
7037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7038% %
7039% %
7040% %
7041% M a g i c k N o r m a l i z e I m a g e %
7042% %
7043% %
7044% %
7045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7046%
7047% MagickNormalizeImage() enhances the contrast of a color image by adjusting
7048% the pixels color to span the entire range of colors available
7049%
7050% You can also reduce the influence of a particular channel with a gamma
7051% value of 0.
7052%
7053% The format of the MagickNormalizeImage method is:
7054%
7055% MagickBooleanType MagickNormalizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00007056%
7057% A description of each parameter follows:
7058%
7059% o wand: the magick wand.
7060%
cristy3ed852e2009-09-05 21:47:34 +00007061*/
cristy3ed852e2009-09-05 21:47:34 +00007062WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7063{
7064 MagickBooleanType
7065 status;
7066
cristy3ed852e2009-09-05 21:47:34 +00007067 assert(wand != (MagickWand *) NULL);
7068 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007069 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007070 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7071 if (wand->images == (Image *) NULL)
7072 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00007073 status=NormalizeImage(wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007074 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007075}
7076
7077/*
7078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7079% %
7080% %
7081% %
7082% M a g i c k O i l P a i n t I m a g e %
7083% %
7084% %
7085% %
7086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7087%
7088% MagickOilPaintImage() applies a special effect filter that simulates an oil
7089% painting. Each pixel is replaced by the most frequent color occurring
7090% in a circular region defined by radius.
7091%
7092% The format of the MagickOilPaintImage method is:
7093%
7094% MagickBooleanType MagickOilPaintImage(MagickWand *wand,
cristy14973ba2011-08-27 23:48:07 +00007095% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00007096%
7097% A description of each parameter follows:
7098%
7099% o wand: the magick wand.
7100%
7101% o radius: the radius of the circular neighborhood.
7102%
cristy14973ba2011-08-27 23:48:07 +00007103% o sigma: the standard deviation of the Gaussian, in pixels.
7104%
cristy3ed852e2009-09-05 21:47:34 +00007105*/
7106WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
cristy14973ba2011-08-27 23:48:07 +00007107 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00007108{
7109 Image
7110 *paint_image;
7111
7112 assert(wand != (MagickWand *) NULL);
7113 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007114 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007115 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7116 if (wand->images == (Image *) NULL)
7117 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy14973ba2011-08-27 23:48:07 +00007118 paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007119 if (paint_image == (Image *) NULL)
7120 return(MagickFalse);
7121 ReplaceImageInList(&wand->images,paint_image);
7122 return(MagickTrue);
7123}
7124
7125/*
7126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7127% %
7128% %
7129% %
7130% M a g i c k O p a q u e P a i n t I m a g e %
7131% %
7132% %
7133% %
7134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7135%
7136% MagickOpaquePaintImage() changes any pixel that matches color with the color
7137% defined by fill.
7138%
7139% The format of the MagickOpaquePaintImage method is:
7140%
7141% MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7142% const PixelWand *target,const PixelWand *fill,const double fuzz,
7143% const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00007144%
7145% A description of each parameter follows:
7146%
7147% o wand: the magick wand.
7148%
cristy3ed852e2009-09-05 21:47:34 +00007149% o target: Change this target color to the fill color within the image.
7150%
7151% o fill: the fill pixel wand.
7152%
7153% o fuzz: By default target must match a particular pixel color
7154% exactly. However, in many cases two colors may differ by a small amount.
7155% The fuzz member of image defines how much tolerance is acceptable to
7156% consider two colors as the same. For example, set fuzz to 10 and the
7157% color red at intensities of 100 and 102 respectively are now interpreted
7158% as the same color for the purposes of the floodfill.
7159%
7160% o invert: paint any pixel that does not match the target color.
7161%
7162*/
cristy3ed852e2009-09-05 21:47:34 +00007163WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7164 const PixelWand *target,const PixelWand *fill,const double fuzz,
7165 const MagickBooleanType invert)
7166{
7167 MagickBooleanType
7168 status;
7169
cristy4c08aed2011-07-01 19:47:50 +00007170 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00007171 fill_pixel,
7172 target_pixel;
7173
7174 assert(wand != (MagickWand *) NULL);
7175 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007176 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007177 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7178 if (wand->images == (Image *) NULL)
7179 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7180 PixelGetMagickColor(target,&target_pixel);
7181 PixelGetMagickColor(fill,&fill_pixel);
7182 wand->images->fuzz=fuzz;
cristy189e84c2011-08-27 18:08:53 +00007183 status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
cristy5f49bdb2011-10-16 14:28:56 +00007184 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007185 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007186}
7187
7188/*
7189%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7190% %
7191% %
7192% %
7193% 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 %
7194% %
7195% %
7196% %
7197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7198%
7199% MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7200% previous image in the sequence. From this it attempts to select the
7201% smallest cropped image to replace each frame, while preserving the results
7202% of the animation.
7203%
7204% The format of the MagickOptimizeImageLayers method is:
7205%
7206% MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7207%
7208% A description of each parameter follows:
7209%
7210% o wand: the magick wand.
7211%
7212*/
7213WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7214{
7215 Image
7216 *optimize_image;
7217
7218 assert(wand != (MagickWand *) NULL);
7219 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007220 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007221 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7222 if (wand->images == (Image *) NULL)
7223 return((MagickWand *) NULL);
7224 optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7225 if (optimize_image == (Image *) NULL)
7226 return((MagickWand *) NULL);
7227 return(CloneMagickWandFromImages(wand,optimize_image));
7228}
7229
7230/*
7231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7232% %
7233% %
7234% %
cristye6510f62012-07-29 13:58:11 +00007235% M a g i c k O p t i m i z e I m a g e T r a n s p a r e n c y %
7236% %
7237% %
7238% %
7239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7240%
7241% MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7242% compares the overlayed pixels against the disposal image resulting from all
7243% the previous frames in the animation. Any pixel that does not change the
7244% disposal image (and thus does not effect the outcome of an overlay) is made
7245% transparent.
7246%
7247% WARNING: This modifies the current images directly, rather than generate
7248% a new image sequence.
7249% The format of the MagickOptimizeImageTransparency method is:
7250%
7251% MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7252%
7253% A description of each parameter follows:
7254%
7255% o wand: the magick wand.
7256%
7257*/
7258WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7259{
7260 assert(wand != (MagickWand *) NULL);
7261 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007262 if (IfMagickTrue(wand->debug))
cristye6510f62012-07-29 13:58:11 +00007263 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7264 if (wand->images == (Image *) NULL)
7265 return(MagickFalse);
7266 OptimizeImageTransparency(wand->images,wand->exception);
7267 return(MagickTrue);
7268}
7269
7270/*
7271%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7272% %
7273% %
7274% %
cristy3ed852e2009-09-05 21:47:34 +00007275% 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 %
7276% %
7277% %
7278% %
7279%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7280%
7281% MagickOrderedPosterizeImage() performs an ordered dither based on a number
7282% of pre-defined dithering threshold maps, but over multiple intensity levels,
7283% which can be different for different channels, according to the input
7284% arguments.
7285%
7286% The format of the MagickOrderedPosterizeImage method is:
7287%
7288% MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7289% const char *threshold_map)
cristy3ed852e2009-09-05 21:47:34 +00007290%
7291% A description of each parameter follows:
7292%
7293% o image: the image.
7294%
cristy3ed852e2009-09-05 21:47:34 +00007295% o threshold_map: A string containing the name of the threshold dither
7296% map to use, followed by zero or more numbers representing the number of
7297% color levels tho dither between.
7298%
glennrpf0a92fd2011-04-27 13:17:21 +00007299% Any level number less than 2 is equivalent to 2, and means only binary
cristy3ed852e2009-09-05 21:47:34 +00007300% dithering will be applied to each color channel.
7301%
7302% No numbers also means a 2 level (bitmap) dither will be applied to all
7303% channels, while a single number is the number of levels applied to each
7304% channel in sequence. More numbers will be applied in turn to each of
7305% the color channels.
7306%
7307% For example: "o3x3,6" generates a 6 level posterization of the image
7308% with a ordered 3x3 diffused pixel dither being applied between each
7309% level. While checker,8,8,4 will produce a 332 colormaped image with
7310% only a single checkerboard hash pattern (50% grey) between each color
7311% level, to basically double the number of color levels with a bare
7312% minimim of dithering.
7313%
7314*/
cristy3ed852e2009-09-05 21:47:34 +00007315WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7316 const char *threshold_map)
7317{
7318 MagickBooleanType
7319 status;
7320
cristy3ed852e2009-09-05 21:47:34 +00007321 assert(wand != (MagickWand *) NULL);
7322 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007323 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007324 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7325 if (wand->images == (Image *) NULL)
7326 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy13020672011-07-08 02:33:26 +00007327 status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007328 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007329}
7330
7331/*
7332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7333% %
7334% %
7335% %
7336% M a g i c k P i n g I m a g e %
7337% %
7338% %
7339% %
7340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7341%
anthonya89dd172011-10-04 13:29:35 +00007342% MagickPingImage() is the same as MagickReadImage() except the only valid
cristy3ed852e2009-09-05 21:47:34 +00007343% information returned is the image width, height, size, and format. It
7344% is designed to efficiently obtain this information from a file without
7345% reading the entire image sequence into memory.
7346%
7347% The format of the MagickPingImage method is:
7348%
7349% MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7350%
7351% A description of each parameter follows:
7352%
7353% o wand: the magick wand.
7354%
7355% o filename: the image filename.
7356%
7357*/
7358WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7359 const char *filename)
7360{
7361 Image
7362 *images;
7363
7364 ImageInfo
7365 *ping_info;
7366
7367 assert(wand != (MagickWand *) NULL);
7368 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007369 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007370 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7371 ping_info=CloneImageInfo(wand->image_info);
7372 if (filename != (const char *) NULL)
7373 (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7374 images=PingImage(ping_info,wand->exception);
7375 ping_info=DestroyImageInfo(ping_info);
7376 if (images == (Image *) NULL)
7377 return(MagickFalse);
7378 return(InsertImageInWand(wand,images));
7379}
7380
7381/*
7382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7383% %
7384% %
7385% %
7386% M a g i c k P i n g I m a g e B l o b %
7387% %
7388% %
7389% %
7390%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7391%
7392% MagickPingImageBlob() pings an image or image sequence from a blob.
7393%
7394% The format of the MagickPingImageBlob method is:
7395%
7396% MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7397% const void *blob,const size_t length)
7398%
7399% A description of each parameter follows:
7400%
7401% o wand: the magick wand.
7402%
7403% o blob: the blob.
7404%
7405% o length: the blob length.
7406%
7407*/
7408WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7409 const void *blob,const size_t length)
7410{
7411 Image
7412 *images;
7413
7414 ImageInfo
7415 *read_info;
7416
7417 assert(wand != (MagickWand *) NULL);
7418 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007419 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007420 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7421 read_info=CloneImageInfo(wand->image_info);
7422 SetImageInfoBlob(read_info,blob,length);
7423 images=PingImage(read_info,wand->exception);
7424 read_info=DestroyImageInfo(read_info);
7425 if (images == (Image *) NULL)
7426 return(MagickFalse);
7427 return(InsertImageInWand(wand,images));
7428}
7429
7430/*
7431%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7432% %
7433% %
7434% %
7435% M a g i c k P i n g I m a g e F i l e %
7436% %
7437% %
7438% %
7439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7440%
7441% MagickPingImageFile() pings an image or image sequence from an open file
7442% descriptor.
7443%
7444% The format of the MagickPingImageFile method is:
7445%
7446% MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7447%
7448% A description of each parameter follows:
7449%
7450% o wand: the magick wand.
7451%
7452% o file: the file descriptor.
7453%
7454*/
7455WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7456{
7457 Image
7458 *images;
7459
7460 ImageInfo
7461 *read_info;
7462
7463 assert(wand != (MagickWand *) NULL);
7464 assert(wand->signature == WandSignature);
7465 assert(file != (FILE *) NULL);
cristy5221b602012-10-30 18:02:55 +00007466 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007467 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7468 read_info=CloneImageInfo(wand->image_info);
7469 SetImageInfoFile(read_info,file);
7470 images=PingImage(read_info,wand->exception);
7471 read_info=DestroyImageInfo(read_info);
7472 if (images == (Image *) NULL)
7473 return(MagickFalse);
7474 return(InsertImageInWand(wand,images));
7475}
7476
7477/*
7478%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7479% %
7480% %
7481% %
7482% M a g i c k P o l a r o i d I m a g e %
7483% %
7484% %
7485% %
7486%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7487%
7488% MagickPolaroidImage() simulates a Polaroid picture.
7489%
7490% The format of the MagickPolaroidImage method is:
7491%
7492% MagickBooleanType MagickPolaroidImage(MagickWand *wand,
cristye9e3d382011-12-14 01:50:13 +00007493% const DrawingWand *drawing_wand,const char *caption,const double angle,
cristy5c4e2582011-09-11 19:21:03 +00007494% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007495%
7496% A description of each parameter follows:
7497%
7498% o wand: the magick wand.
7499%
7500% o drawing_wand: the draw wand.
7501%
cristye9e3d382011-12-14 01:50:13 +00007502% o caption: the Polaroid caption.
7503%
cristycee97112010-05-28 00:44:52 +00007504% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00007505%
cristy5c4e2582011-09-11 19:21:03 +00007506% o method: the pixel interpolation method.
7507%
cristy3ed852e2009-09-05 21:47:34 +00007508*/
7509WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
cristye9e3d382011-12-14 01:50:13 +00007510 const DrawingWand *drawing_wand,const char *caption,const double angle,
cristy5c4e2582011-09-11 19:21:03 +00007511 const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007512{
7513 DrawInfo
7514 *draw_info;
7515
7516 Image
7517 *polaroid_image;
7518
7519 assert(wand != (MagickWand *) NULL);
7520 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007521 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007522 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7523 if (wand->images == (Image *) NULL)
7524 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7525 draw_info=PeekDrawingWand(drawing_wand);
7526 if (draw_info == (DrawInfo *) NULL)
7527 return(MagickFalse);
cristye9e3d382011-12-14 01:50:13 +00007528 polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
cristy5c4e2582011-09-11 19:21:03 +00007529 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007530 if (polaroid_image == (Image *) NULL)
7531 return(MagickFalse);
7532 ReplaceImageInList(&wand->images,polaroid_image);
7533 return(MagickTrue);
7534}
7535
7536/*
7537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7538% %
7539% %
7540% %
7541% M a g i c k P o s t e r i z e I m a g e %
7542% %
7543% %
7544% %
7545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7546%
7547% MagickPosterizeImage() reduces the image to a limited number of color level.
7548%
7549% The format of the MagickPosterizeImage method is:
7550%
7551% MagickBooleanType MagickPosterizeImage(MagickWand *wand,
cristyd9ecd042012-06-17 18:26:12 +00007552% const size_t levels,const DitherMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007553%
7554% A description of each parameter follows:
7555%
7556% o wand: the magick wand.
7557%
7558% o levels: Number of color levels allowed in each channel. Very low values
7559% (2, 3, or 4) have the most visible effect.
7560%
cristyd9ecd042012-06-17 18:26:12 +00007561% o method: choose the dither method: UndefinedDitherMethod,
7562% NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
cristy3ed852e2009-09-05 21:47:34 +00007563%
7564*/
7565WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
cristyd9ecd042012-06-17 18:26:12 +00007566 const size_t levels,const DitherMethod dither)
cristy3ed852e2009-09-05 21:47:34 +00007567{
7568 MagickBooleanType
7569 status;
7570
7571 assert(wand != (MagickWand *) NULL);
7572 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007573 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007574 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7575 if (wand->images == (Image *) NULL)
7576 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00007577 status=PosterizeImage(wand->images,levels,dither,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007578 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007579}
7580
7581/*
7582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7583% %
7584% %
7585% %
7586% M a g i c k P r e v i e w I m a g e s %
7587% %
7588% %
7589% %
7590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7591%
7592% MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7593% image processing operation applied at varying strengths. This helpful
7594% to quickly pin-point an appropriate parameter for an image processing
7595% operation.
7596%
7597% The format of the MagickPreviewImages method is:
7598%
7599% MagickWand *MagickPreviewImages(MagickWand *wand,
7600% const PreviewType preview)
7601%
7602% A description of each parameter follows:
7603%
7604% o wand: the magick wand.
7605%
7606% o preview: the preview type.
7607%
7608*/
7609WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7610 const PreviewType preview)
7611{
7612 Image
7613 *preview_image;
7614
7615 assert(wand != (MagickWand *) NULL);
7616 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007617 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007618 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7619 if (wand->images == (Image *) NULL)
7620 return((MagickWand *) NULL);
7621 preview_image=PreviewImage(wand->images,preview,wand->exception);
7622 if (preview_image == (Image *) NULL)
7623 return((MagickWand *) NULL);
7624 return(CloneMagickWandFromImages(wand,preview_image));
7625}
7626
7627/*
7628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7629% %
7630% %
7631% %
7632% M a g i c k P r e v i o u s I m a g e %
7633% %
7634% %
7635% %
7636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7637%
anthonyf93964e2012-03-16 08:25:58 +00007638% MagickPreviousImage() sets the previous image in the wand as the current
7639% image.
cristy3ed852e2009-09-05 21:47:34 +00007640%
anthonyf93964e2012-03-16 08:25:58 +00007641% It is typically used after MagickSetLastIterator(), after which its first
7642% use will set the last image as the current image (unless the wand is empty).
7643%
7644% It will return MagickFalse when no more images are left to be returned
7645% which happens when the wand is empty, or the current image is the first
7646% image. At that point the iterator is than reset to again process images in
7647% the forward direction, again starting with the first image in list. Images
7648% added at this point are prepended.
7649%
7650% Also at that point any images added to the wand using MagickAddImages() or
7651% MagickReadImages() will be prepended before the first image. In this sense
7652% the condition is not quite exactly the same as MagickResetIterator().
anthony45083312012-03-14 14:49:12 +00007653%
cristy3ed852e2009-09-05 21:47:34 +00007654% The format of the MagickPreviousImage method is:
7655%
7656% MagickBooleanType MagickPreviousImage(MagickWand *wand)
7657%
7658% A description of each parameter follows:
7659%
7660% o wand: the magick wand.
7661%
7662*/
7663WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7664{
7665 assert(wand != (MagickWand *) NULL);
7666 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007667 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007668 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7669 if (wand->images == (Image *) NULL)
7670 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5221b602012-10-30 18:02:55 +00007671 if (IfMagickTrue(wand->image_pending))
anthony45083312012-03-14 14:49:12 +00007672 {
7673 wand->image_pending=MagickFalse; /* image returned no longer pending */
7674 return(MagickTrue);
7675 }
cristy3ed852e2009-09-05 21:47:34 +00007676 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
anthony45083312012-03-14 14:49:12 +00007677 {
7678 wand->image_pending=MagickTrue; /* Next now re-gets first image */
7679 wand->insert_before=MagickTrue; /* insert/add prepends new images */
cristy3ed852e2009-09-05 21:47:34 +00007680 return(MagickFalse);
anthony45083312012-03-14 14:49:12 +00007681 }
cristy3ed852e2009-09-05 21:47:34 +00007682 wand->images=GetPreviousImageInList(wand->images);
7683 return(MagickTrue);
7684}
7685
7686/*
7687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7688% %
7689% %
7690% %
7691% M a g i c k Q u a n t i z e I m a g e %
7692% %
7693% %
7694% %
7695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7696%
7697% MagickQuantizeImage() analyzes the colors within a reference image and
7698% chooses a fixed number of colors to represent the image. The goal of the
7699% algorithm is to minimize the color difference between the input and output
7700% image while minimizing the processing time.
7701%
7702% The format of the MagickQuantizeImage method is:
7703%
7704% MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007705% const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007706% const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007707% const MagickBooleanType measure_error)
7708%
7709% A description of each parameter follows:
7710%
7711% o wand: the magick wand.
7712%
7713% o number_colors: the number of colors.
7714%
7715% o colorspace: Perform color reduction in this colorspace, typically
7716% RGBColorspace.
7717%
7718% o treedepth: Normally, this integer value is zero or one. A zero or
7719% 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
7720% reference image with the least amount of memory and the fastest
7721% computational speed. In some cases, such as an image with low color
7722% dispersion (a few number of colors), a value other than
7723% Log4(number_colors) is required. To expand the color tree completely,
7724% use a value of 8.
7725%
cristycbda6112012-05-27 20:57:16 +00007726% o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7727% RiemersmaDitherMethod, FloydSteinbergDitherMethod.
cristy3ed852e2009-09-05 21:47:34 +00007728%
7729% o measure_error: A value other than zero measures the difference between
7730% the original and quantized images. This difference is the total
7731% quantization error. The error is computed by summing over all pixels
7732% in an image the distance squared in RGB space between each reference
7733% pixel value and its quantized value.
7734%
7735*/
7736WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007737 const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007738 const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007739 const MagickBooleanType measure_error)
7740{
7741 MagickBooleanType
7742 status;
7743
7744 QuantizeInfo
7745 *quantize_info;
7746
7747 assert(wand != (MagickWand *) NULL);
7748 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007749 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007750 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7751 if (wand->images == (Image *) NULL)
7752 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7753 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7754 quantize_info->number_colors=number_colors;
cristycbda6112012-05-27 20:57:16 +00007755 quantize_info->dither_method=dither_method;
cristy3ed852e2009-09-05 21:47:34 +00007756 quantize_info->tree_depth=treedepth;
7757 quantize_info->colorspace=colorspace;
7758 quantize_info->measure_error=measure_error;
cristy018f07f2011-09-04 21:15:19 +00007759 status=QuantizeImage(quantize_info,wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007760 quantize_info=DestroyQuantizeInfo(quantize_info);
cristy220c4d52013-11-27 19:31:32 +00007761 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007762}
7763
7764/*
7765%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7766% %
7767% %
7768% %
7769% M a g i c k Q u a n t i z e I m a g e s %
7770% %
7771% %
7772% %
7773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7774%
7775% MagickQuantizeImages() analyzes the colors within a sequence of images and
7776% chooses a fixed number of colors to represent the image. The goal of the
7777% algorithm is to minimize the color difference between the input and output
7778% image while minimizing the processing time.
7779%
7780% The format of the MagickQuantizeImages method is:
7781%
7782% MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007783% const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007784% const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007785% const MagickBooleanType measure_error)
7786%
7787% A description of each parameter follows:
7788%
7789% o wand: the magick wand.
7790%
7791% o number_colors: the number of colors.
7792%
7793% o colorspace: Perform color reduction in this colorspace, typically
7794% RGBColorspace.
7795%
7796% o treedepth: Normally, this integer value is zero or one. A zero or
7797% 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
7798% reference image with the least amount of memory and the fastest
7799% computational speed. In some cases, such as an image with low color
7800% dispersion (a few number of colors), a value other than
7801% Log4(number_colors) is required. To expand the color tree completely,
7802% use a value of 8.
7803%
cristycbda6112012-05-27 20:57:16 +00007804% o dither_method: choose from these dither methods: NoDitherMethod,
7805% RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
cristy3ed852e2009-09-05 21:47:34 +00007806%
7807% o measure_error: A value other than zero measures the difference between
7808% the original and quantized images. This difference is the total
7809% quantization error. The error is computed by summing over all pixels
7810% in an image the distance squared in RGB space between each reference
7811% pixel value and its quantized value.
7812%
7813*/
7814WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007815 const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007816 const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007817 const MagickBooleanType measure_error)
7818{
7819 MagickBooleanType
7820 status;
7821
7822 QuantizeInfo
7823 *quantize_info;
7824
7825 assert(wand != (MagickWand *) NULL);
7826 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007827 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007828 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7829 if (wand->images == (Image *) NULL)
7830 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7831 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7832 quantize_info->number_colors=number_colors;
cristycbda6112012-05-27 20:57:16 +00007833 quantize_info->dither_method=dither_method;
cristy3ed852e2009-09-05 21:47:34 +00007834 quantize_info->tree_depth=treedepth;
7835 quantize_info->colorspace=colorspace;
7836 quantize_info->measure_error=measure_error;
cristy018f07f2011-09-04 21:15:19 +00007837 status=QuantizeImages(quantize_info,wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007838 quantize_info=DestroyQuantizeInfo(quantize_info);
cristy220c4d52013-11-27 19:31:32 +00007839 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007840}
7841
7842/*
7843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7844% %
7845% %
7846% %
dirk6d612cf2014-03-13 21:17:23 +00007847% M a g i c k R o t a t i o n a l B l u r I m a g e %
cristy3ed852e2009-09-05 21:47:34 +00007848% %
7849% %
7850% %
7851%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7852%
dirk6d612cf2014-03-13 21:17:23 +00007853% MagickRotationalBlurImage() rotational blurs an image.
cristy3ed852e2009-09-05 21:47:34 +00007854%
dirk6d612cf2014-03-13 21:17:23 +00007855% The format of the MagickRotationalBlurImage method is:
cristy3ed852e2009-09-05 21:47:34 +00007856%
dirk6d612cf2014-03-13 21:17:23 +00007857% MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00007858% const double angle)
cristy3ed852e2009-09-05 21:47:34 +00007859%
7860% A description of each parameter follows:
7861%
7862% o wand: the magick wand.
7863%
cristy3ed852e2009-09-05 21:47:34 +00007864% o angle: the angle of the blur in degrees.
7865%
7866*/
dirk6d612cf2014-03-13 21:17:23 +00007867WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00007868 const double angle)
cristy3ed852e2009-09-05 21:47:34 +00007869{
cristy3ed852e2009-09-05 21:47:34 +00007870 Image
7871 *blur_image;
7872
7873 assert(wand != (MagickWand *) NULL);
7874 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007875 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007876 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7877 if (wand->images == (Image *) NULL)
7878 ThrowWandException(WandError,"ContainsNoImages",wand->name);
dirk6d612cf2014-03-13 21:17:23 +00007879 blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007880 if (blur_image == (Image *) NULL)
7881 return(MagickFalse);
7882 ReplaceImageInList(&wand->images,blur_image);
7883 return(MagickTrue);
7884}
7885
7886/*
7887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7888% %
7889% %
7890% %
7891% M a g i c k R a i s e I m a g e %
7892% %
7893% %
7894% %
7895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7896%
7897% MagickRaiseImage() creates a simulated three-dimensional button-like effect
7898% by lightening and darkening the edges of the image. Members width and
7899% height of raise_info define the width of the vertical and horizontal
7900% edge of the effect.
7901%
7902% The format of the MagickRaiseImage method is:
7903%
7904% MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007905% const size_t width,const size_t height,const ssize_t x,
7906% const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00007907%
7908% A description of each parameter follows:
7909%
7910% o wand: the magick wand.
7911%
7912% o width,height,x,y: Define the dimensions of the area to raise.
7913%
7914% o raise: A value other than zero creates a 3-D raise effect,
7915% otherwise it has a lowered effect.
7916%
7917*/
7918WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007919 const size_t width,const size_t height,const ssize_t x,
7920 const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00007921{
7922 MagickBooleanType
7923 status;
7924
7925 RectangleInfo
7926 raise_info;
7927
7928 assert(wand != (MagickWand *) NULL);
7929 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007930 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007931 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7932 if (wand->images == (Image *) NULL)
7933 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7934 raise_info.width=width;
7935 raise_info.height=height;
7936 raise_info.x=x;
7937 raise_info.y=y;
cristy5f49bdb2011-10-16 14:28:56 +00007938 status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007939 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007940}
7941
7942/*
7943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7944% %
7945% %
7946% %
7947% 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 %
7948% %
7949% %
7950% %
7951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7952%
7953% MagickRandomThresholdImage() changes the value of individual pixels based on
7954% the intensity of each pixel compared to threshold. The result is a
7955% high-contrast, two color image.
7956%
7957% The format of the MagickRandomThresholdImage method is:
7958%
7959% MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7960% const double low,const double high)
cristy3ed852e2009-09-05 21:47:34 +00007961%
7962% A description of each parameter follows:
7963%
7964% o wand: the magick wand.
7965%
cristy3ed852e2009-09-05 21:47:34 +00007966% o low,high: Specify the high and low thresholds. These values range from
7967% 0 to QuantumRange.
7968%
7969*/
cristy3ed852e2009-09-05 21:47:34 +00007970WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7971 const double low,const double high)
7972{
cristy3ed852e2009-09-05 21:47:34 +00007973 char
7974 threshold[MaxTextExtent];
7975
cristy3ed852e2009-09-05 21:47:34 +00007976 assert(wand != (MagickWand *) NULL);
7977 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00007978 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00007979 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7980 if (wand->images == (Image *) NULL)
7981 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +00007982 (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
cristye941a752011-10-15 01:52:48 +00007983 return(RandomThresholdImage(wand->images,threshold,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00007984}
7985
7986/*
7987%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7988% %
7989% %
7990% %
7991% M a g i c k R e a d I m a g e %
7992% %
7993% %
7994% %
7995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7996%
7997% MagickReadImage() reads an image or image sequence. The images are inserted
anthonye8f56492012-02-12 12:39:02 +00007998% jjust before the current image pointer position.
anthonya89dd172011-10-04 13:29:35 +00007999%
8000% Use MagickSetFirstIterator(), to insert new images before all the current
8001% images in the wand, MagickSetLastIterator() to append add to the end,
8002% MagickSetImageIndex() to place images just after the given index.
cristy3ed852e2009-09-05 21:47:34 +00008003%
8004% The format of the MagickReadImage method is:
8005%
8006% MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8007%
8008% A description of each parameter follows:
8009%
8010% o wand: the magick wand.
8011%
8012% o filename: the image filename.
8013%
8014*/
8015WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8016 const char *filename)
8017{
8018 Image
8019 *images;
8020
8021 ImageInfo
8022 *read_info;
8023
8024 assert(wand != (MagickWand *) NULL);
8025 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008026 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008027 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8028 read_info=CloneImageInfo(wand->image_info);
8029 if (filename != (const char *) NULL)
8030 (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8031 images=ReadImage(read_info,wand->exception);
8032 read_info=DestroyImageInfo(read_info);
8033 if (images == (Image *) NULL)
8034 return(MagickFalse);
8035 return(InsertImageInWand(wand,images));
8036}
8037
8038/*
8039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8040% %
8041% %
8042% %
8043% M a g i c k R e a d I m a g e B l o b %
8044% %
8045% %
8046% %
8047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8048%
8049% MagickReadImageBlob() reads an image or image sequence from a blob.
anthonya89dd172011-10-04 13:29:35 +00008050% In all other respects it is like MagickReadImage().
cristy3ed852e2009-09-05 21:47:34 +00008051%
8052% The format of the MagickReadImageBlob method is:
8053%
8054% MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8055% const void *blob,const size_t length)
8056%
8057% A description of each parameter follows:
8058%
8059% o wand: the magick wand.
8060%
8061% o blob: the blob.
8062%
8063% o length: the blob length.
8064%
8065*/
8066WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8067 const void *blob,const size_t length)
8068{
8069 Image
8070 *images;
8071
8072 assert(wand != (MagickWand *) NULL);
8073 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008074 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008075 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8076 images=BlobToImage(wand->image_info,blob,length,wand->exception);
8077 if (images == (Image *) NULL)
8078 return(MagickFalse);
8079 return(InsertImageInWand(wand,images));
8080}
8081
8082/*
8083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8084% %
8085% %
8086% %
8087% M a g i c k R e a d I m a g e F i l e %
8088% %
8089% %
8090% %
8091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8092%
anthonya89dd172011-10-04 13:29:35 +00008093% MagickReadImageFile() reads an image or image sequence from an already
8094% opened file descriptor. Otherwise it is like MagickReadImage().
cristy3ed852e2009-09-05 21:47:34 +00008095%
8096% The format of the MagickReadImageFile method is:
8097%
8098% MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8099%
8100% A description of each parameter follows:
8101%
8102% o wand: the magick wand.
8103%
8104% o file: the file descriptor.
8105%
8106*/
8107WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8108{
8109 Image
8110 *images;
8111
8112 ImageInfo
8113 *read_info;
8114
8115 assert(wand != (MagickWand *) NULL);
8116 assert(wand->signature == WandSignature);
8117 assert(file != (FILE *) NULL);
cristy5221b602012-10-30 18:02:55 +00008118 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008119 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8120 read_info=CloneImageInfo(wand->image_info);
8121 SetImageInfoFile(read_info,file);
8122 images=ReadImage(read_info,wand->exception);
8123 read_info=DestroyImageInfo(read_info);
8124 if (images == (Image *) NULL)
8125 return(MagickFalse);
8126 return(InsertImageInWand(wand,images));
8127}
8128
8129/*
8130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8131% %
8132% %
8133% %
cristy3ed852e2009-09-05 21:47:34 +00008134% M a g i c k R e m a p I m a g e %
8135% %
8136% %
8137% %
8138%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8139%
8140% MagickRemapImage() replaces the colors of an image with the closest color
8141% from a reference image.
8142%
8143% The format of the MagickRemapImage method is:
8144%
8145% MagickBooleanType MagickRemapImage(MagickWand *wand,
8146% const MagickWand *remap_wand,const DitherMethod method)
8147%
8148% A description of each parameter follows:
8149%
8150% o wand: the magick wand.
8151%
8152% o affinity: the affinity wand.
8153%
8154% o method: choose from these dither methods: NoDitherMethod,
8155% RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8156%
8157*/
8158WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
cristycbda6112012-05-27 20:57:16 +00008159 const MagickWand *remap_wand,const DitherMethod dither_method)
cristy3ed852e2009-09-05 21:47:34 +00008160{
8161 MagickBooleanType
8162 status;
8163
8164 QuantizeInfo
8165 *quantize_info;
8166
8167 assert(wand != (MagickWand *) NULL);
8168 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008169 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008170 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8171 if ((wand->images == (Image *) NULL) ||
8172 (remap_wand->images == (Image *) NULL))
8173 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8174 quantize_info=AcquireQuantizeInfo(wand->image_info);
cristycbda6112012-05-27 20:57:16 +00008175 quantize_info->dither_method=dither_method;
cristy018f07f2011-09-04 21:15:19 +00008176 status=RemapImage(quantize_info,wand->images,remap_wand->images,
8177 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008178 quantize_info=DestroyQuantizeInfo(quantize_info);
cristy220c4d52013-11-27 19:31:32 +00008179 return(status);
cristy3ed852e2009-09-05 21:47:34 +00008180}
8181
8182/*
8183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8184% %
8185% %
8186% %
8187% M a g i c k R e m o v e I m a g e %
8188% %
8189% %
8190% %
8191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8192%
8193% MagickRemoveImage() removes an image from the image list.
8194%
8195% The format of the MagickRemoveImage method is:
8196%
8197% MagickBooleanType MagickRemoveImage(MagickWand *wand)
8198%
8199% A description of each parameter follows:
8200%
8201% o wand: the magick wand.
8202%
8203% o insert: the splice wand.
8204%
8205*/
8206WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8207{
8208 assert(wand != (MagickWand *) NULL);
8209 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008210 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008211 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8212 if (wand->images == (Image *) NULL)
8213 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8214 DeleteImageFromList(&wand->images);
8215 return(MagickTrue);
8216}
8217
8218/*
8219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8220% %
8221% %
8222% %
8223% M a g i c k R e s a m p l e I m a g e %
8224% %
8225% %
8226% %
8227%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8228%
8229% MagickResampleImage() resample image to desired resolution.
8230%
8231% Bessel Blackman Box
8232% Catrom Cubic Gaussian
8233% Hanning Hermite Lanczos
8234% Mitchell Point Quandratic
8235% Sinc Triangle
8236%
8237% Most of the filters are FIR (finite impulse response), however, Bessel,
8238% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8239% are windowed (brought down to zero) with the Blackman filter.
8240%
8241% The format of the MagickResampleImage method is:
8242%
8243% MagickBooleanType MagickResampleImage(MagickWand *wand,
8244% const double x_resolution,const double y_resolution,
cristyaa2c16c2012-03-25 22:21:35 +00008245% const FilterTypes filter)
cristy3ed852e2009-09-05 21:47:34 +00008246%
8247% A description of each parameter follows:
8248%
8249% o wand: the magick wand.
8250%
8251% o x_resolution: the new image x resolution.
8252%
8253% o y_resolution: the new image y resolution.
8254%
8255% o filter: Image filter to use.
8256%
cristy3ed852e2009-09-05 21:47:34 +00008257*/
8258WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008259 const double x_resolution,const double y_resolution,const FilterTypes filter)
cristy3ed852e2009-09-05 21:47:34 +00008260{
8261 Image
8262 *resample_image;
8263
8264 assert(wand != (MagickWand *) NULL);
8265 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008266 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008267 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8268 if (wand->images == (Image *) NULL)
8269 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8270 resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
cristyaa2c16c2012-03-25 22:21:35 +00008271 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008272 if (resample_image == (Image *) NULL)
8273 return(MagickFalse);
8274 ReplaceImageInList(&wand->images,resample_image);
8275 return(MagickTrue);
8276}
8277
8278/*
8279%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8280% %
8281% %
8282% %
8283% M a g i c k R e s e t I m a g e P a g e %
8284% %
8285% %
8286% %
8287%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8288%
8289% MagickResetImagePage() resets the Wand page canvas and position.
8290%
8291% The format of the MagickResetImagePage method is:
8292%
8293% MagickBooleanType MagickResetImagePage(MagickWand *wand,
8294% const char *page)
8295%
8296% A description of each parameter follows:
8297%
8298% o wand: the magick wand.
8299%
8300% o page: the relative page specification.
8301%
8302*/
8303WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8304 const char *page)
8305{
8306 assert(wand != (MagickWand *) NULL);
8307 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008308 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008309 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8310 if (wand->images == (Image *) NULL)
8311 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8312 if ((page == (char *) NULL) || (*page == '\0'))
8313 {
8314 (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8315 return(MagickTrue);
8316 }
8317 return(ResetImagePage(wand->images,page));
8318}
8319
8320/*
8321%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8322% %
8323% %
8324% %
8325% M a g i c k R e s i z e I m a g e %
8326% %
8327% %
8328% %
8329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8330%
8331% MagickResizeImage() scales an image to the desired dimensions with one of
8332% these filters:
8333%
8334% Bessel Blackman Box
8335% Catrom Cubic Gaussian
8336% Hanning Hermite Lanczos
8337% Mitchell Point Quandratic
8338% Sinc Triangle
8339%
8340% Most of the filters are FIR (finite impulse response), however, Bessel,
8341% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8342% are windowed (brought down to zero) with the Blackman filter.
8343%
8344% The format of the MagickResizeImage method is:
8345%
8346% MagickBooleanType MagickResizeImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008347% const size_t columns,const size_t rows,const FilterTypes filter)
cristy3ed852e2009-09-05 21:47:34 +00008348%
8349% A description of each parameter follows:
8350%
8351% o wand: the magick wand.
8352%
8353% o columns: the number of columns in the scaled image.
8354%
8355% o rows: the number of rows in the scaled image.
8356%
8357% o filter: Image filter to use.
8358%
cristy3ed852e2009-09-05 21:47:34 +00008359*/
8360WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008361 const size_t columns,const size_t rows,const FilterTypes filter)
cristy3ed852e2009-09-05 21:47:34 +00008362{
8363 Image
8364 *resize_image;
8365
8366 assert(wand != (MagickWand *) NULL);
8367 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008368 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008369 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8370 if (wand->images == (Image *) NULL)
8371 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +00008372 resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008373 if (resize_image == (Image *) NULL)
8374 return(MagickFalse);
8375 ReplaceImageInList(&wand->images,resize_image);
8376 return(MagickTrue);
8377}
8378
8379/*
8380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8381% %
8382% %
8383% %
8384% M a g i c k R o l l I m a g e %
8385% %
8386% %
8387% %
8388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8389%
8390% MagickRollImage() offsets an image as defined by x and y.
8391%
8392% The format of the MagickRollImage method is:
8393%
cristybb503372010-05-27 20:51:26 +00008394% MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8395% const size_t y)
cristy3ed852e2009-09-05 21:47:34 +00008396%
8397% A description of each parameter follows:
8398%
8399% o wand: the magick wand.
8400%
8401% o x: the x offset.
8402%
8403% o y: the y offset.
8404%
8405%
8406*/
8407WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008408 const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00008409{
8410 Image
8411 *roll_image;
8412
8413 assert(wand != (MagickWand *) NULL);
8414 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008415 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008416 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8417 if (wand->images == (Image *) NULL)
8418 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8419 roll_image=RollImage(wand->images,x,y,wand->exception);
8420 if (roll_image == (Image *) NULL)
8421 return(MagickFalse);
8422 ReplaceImageInList(&wand->images,roll_image);
8423 return(MagickTrue);
8424}
8425
8426/*
8427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8428% %
8429% %
8430% %
8431% M a g i c k R o t a t e I m a g e %
8432% %
8433% %
8434% %
8435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8436%
8437% MagickRotateImage() rotates an image the specified number of degrees. Empty
8438% triangles left over from rotating the image are filled with the
8439% background color.
8440%
8441% The format of the MagickRotateImage method is:
8442%
8443% MagickBooleanType MagickRotateImage(MagickWand *wand,
8444% const PixelWand *background,const double degrees)
8445%
8446% A description of each parameter follows:
8447%
8448% o wand: the magick wand.
8449%
8450% o background: the background pixel wand.
8451%
8452% o degrees: the number of degrees to rotate the image.
8453%
8454%
8455*/
8456WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8457 const PixelWand *background,const double degrees)
8458{
8459 Image
8460 *rotate_image;
8461
8462 assert(wand != (MagickWand *) NULL);
8463 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008464 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008465 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8466 if (wand->images == (Image *) NULL)
8467 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008468 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00008469 rotate_image=RotateImage(wand->images,degrees,wand->exception);
8470 if (rotate_image == (Image *) NULL)
8471 return(MagickFalse);
8472 ReplaceImageInList(&wand->images,rotate_image);
8473 return(MagickTrue);
8474}
8475
8476/*
8477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8478% %
8479% %
8480% %
8481% M a g i c k S a m p l e I m a g e %
8482% %
8483% %
8484% %
8485%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8486%
8487% MagickSampleImage() scales an image to the desired dimensions with pixel
8488% sampling. Unlike other scaling methods, this method does not introduce
8489% any additional color into the scaled image.
8490%
8491% The format of the MagickSampleImage method is:
8492%
8493% MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008494% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008495%
8496% A description of each parameter follows:
8497%
8498% o wand: the magick wand.
8499%
8500% o columns: the number of columns in the scaled image.
8501%
8502% o rows: the number of rows in the scaled image.
8503%
8504%
8505*/
8506WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008507 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008508{
8509 Image
8510 *sample_image;
8511
8512 assert(wand != (MagickWand *) NULL);
8513 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008514 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008515 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8516 if (wand->images == (Image *) NULL)
8517 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8518 sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8519 if (sample_image == (Image *) NULL)
8520 return(MagickFalse);
8521 ReplaceImageInList(&wand->images,sample_image);
8522 return(MagickTrue);
8523}
8524
8525/*
8526%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8527% %
8528% %
8529% %
8530% M a g i c k S c a l e I m a g e %
8531% %
8532% %
8533% %
8534%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8535%
8536% MagickScaleImage() scales the size of an image to the given dimensions.
8537%
8538% The format of the MagickScaleImage method is:
8539%
8540% MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008541% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008542%
8543% A description of each parameter follows:
8544%
8545% o wand: the magick wand.
8546%
8547% o columns: the number of columns in the scaled image.
8548%
8549% o rows: the number of rows in the scaled image.
8550%
8551%
8552*/
8553WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008554 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008555{
8556 Image
8557 *scale_image;
8558
8559 assert(wand != (MagickWand *) NULL);
8560 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008561 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008562 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8563 if (wand->images == (Image *) NULL)
8564 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8565 scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8566 if (scale_image == (Image *) NULL)
8567 return(MagickFalse);
8568 ReplaceImageInList(&wand->images,scale_image);
8569 return(MagickTrue);
8570}
8571
8572/*
8573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8574% %
8575% %
8576% %
8577% M a g i c k S e g m e n t I m a g e %
8578% %
8579% %
8580% %
8581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8582%
8583% MagickSegmentImage() segments an image by analyzing the histograms of the
8584% color components and identifying units that are homogeneous with the fuzzy
8585% C-means technique.
8586%
8587% The format of the SegmentImage method is:
8588%
8589% MagickBooleanType MagickSegmentImage(MagickWand *wand,
8590% const ColorspaceType colorspace,const MagickBooleanType verbose,
8591% const double cluster_threshold,const double smooth_threshold)
8592%
8593% A description of each parameter follows.
8594%
8595% o wand: the wand.
8596%
8597% o colorspace: the image colorspace.
8598%
8599% o verbose: Set to MagickTrue to print detailed information about the
8600% identified classes.
8601%
8602% o cluster_threshold: This represents the minimum number of pixels
8603% contained in a hexahedra before it can be considered valid (expressed as
8604% a percentage).
8605%
8606% o smooth_threshold: the smoothing threshold eliminates noise in the second
8607% derivative of the histogram. As the value is increased, you can expect a
8608% smoother second derivative.
8609%
8610*/
8611MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8612 const ColorspaceType colorspace,const MagickBooleanType verbose,
8613 const double cluster_threshold,const double smooth_threshold)
8614{
8615 MagickBooleanType
8616 status;
8617
8618 assert(wand != (MagickWand *) NULL);
8619 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008620 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008621 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8622 if (wand->images == (Image *) NULL)
8623 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8624 status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
cristy018f07f2011-09-04 21:15:19 +00008625 smooth_threshold,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00008626 return(status);
cristy3ed852e2009-09-05 21:47:34 +00008627}
8628
8629/*
8630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8631% %
8632% %
8633% %
8634% M a g i c k S e l e c t i v e B l u r I m a g e %
8635% %
8636% %
8637% %
8638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8639%
8640% MagickSelectiveBlurImage() selectively blur an image within a contrast
8641% threshold. It is similar to the unsharpen mask that sharpens everything with
8642% contrast above a certain threshold.
8643%
8644% The format of the MagickSelectiveBlurImage method is:
8645%
8646% MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008647% const double radius,const double sigma,const double threshold)
cristy3ed852e2009-09-05 21:47:34 +00008648%
8649% A description of each parameter follows:
8650%
8651% o wand: the magick wand.
8652%
cristy3ed852e2009-09-05 21:47:34 +00008653% o radius: the radius of the gaussian, in pixels, not counting the center
8654% pixel.
8655%
8656% o sigma: the standard deviation of the gaussian, in pixels.
8657%
8658% o threshold: only pixels within this contrast threshold are included
cristy6a917d92009-10-06 19:23:54 +00008659% in the blur operation.
cristy3ed852e2009-09-05 21:47:34 +00008660%
8661*/
cristy3ed852e2009-09-05 21:47:34 +00008662WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008663 const double radius,const double sigma,const double threshold)
cristy3ed852e2009-09-05 21:47:34 +00008664{
cristy3ed852e2009-09-05 21:47:34 +00008665 Image
8666 *blur_image;
8667
8668 assert(wand != (MagickWand *) NULL);
8669 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008670 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008671 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8672 if (wand->images == (Image *) NULL)
8673 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +00008674 blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
cristyf4ad9df2011-07-08 16:49:03 +00008675 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008676 if (blur_image == (Image *) NULL)
8677 return(MagickFalse);
8678 ReplaceImageInList(&wand->images,blur_image);
8679 return(MagickTrue);
8680}
8681
8682/*
8683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8684% %
8685% %
8686% %
8687% 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 %
8688% %
8689% %
8690% %
8691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8692%
cristy3139dc22011-07-08 00:11:42 +00008693% MagickSeparateImage() separates a channel from the image and returns a
cristy3ed852e2009-09-05 21:47:34 +00008694% grayscale image. A channel is a particular color component of each pixel
8695% in the image.
8696%
cristy3139dc22011-07-08 00:11:42 +00008697% The format of the MagickSeparateImage method is:
cristy3ed852e2009-09-05 21:47:34 +00008698%
cristyc8d63672012-01-11 13:03:13 +00008699% MagickBooleanType MagickSeparateImage(MagickWand *wand,
8700% const ChannelType channel)
cristy3ed852e2009-09-05 21:47:34 +00008701%
8702% A description of each parameter follows:
8703%
8704% o wand: the magick wand.
8705%
cristyc8d63672012-01-11 13:03:13 +00008706% o channel: the channel.
8707%
cristy3ed852e2009-09-05 21:47:34 +00008708*/
cristyc8d63672012-01-11 13:03:13 +00008709WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8710 const ChannelType channel)
cristy3ed852e2009-09-05 21:47:34 +00008711{
cristyc8d63672012-01-11 13:03:13 +00008712 Image
8713 *separate_image;
8714
cristy3ed852e2009-09-05 21:47:34 +00008715 assert(wand != (MagickWand *) NULL);
8716 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008717 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008718 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8719 if (wand->images == (Image *) NULL)
8720 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyc8d63672012-01-11 13:03:13 +00008721 separate_image=SeparateImage(wand->images,channel,wand->exception);
8722 if (separate_image == (Image *) NULL)
8723 return(MagickFalse);
8724 ReplaceImageInList(&wand->images,separate_image);
8725 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +00008726}
8727
8728/*
8729%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8730% %
8731% %
8732% %
8733% M a g i c k S e p i a T o n e I m a g e %
8734% %
8735% %
8736% %
8737%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8738%
8739% MagickSepiaToneImage() applies a special effect to the image, similar to the
8740% effect achieved in a photo darkroom by sepia toning. Threshold ranges from
8741% 0 to QuantumRange and is a measure of the extent of the sepia toning. A
8742% threshold of 80% is a good starting point for a reasonable tone.
8743%
8744% The format of the MagickSepiaToneImage method is:
8745%
8746% MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8747% const double threshold)
8748%
8749% A description of each parameter follows:
8750%
8751% o wand: the magick wand.
8752%
8753% o threshold: Define the extent of the sepia toning.
8754%
8755*/
8756WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8757 const double threshold)
8758{
8759 Image
8760 *sepia_image;
8761
8762 assert(wand != (MagickWand *) NULL);
8763 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008764 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008765 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8766 if (wand->images == (Image *) NULL)
8767 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8768 sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8769 if (sepia_image == (Image *) NULL)
8770 return(MagickFalse);
8771 ReplaceImageInList(&wand->images,sepia_image);
8772 return(MagickTrue);
8773}
8774
8775/*
8776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8777% %
8778% %
8779% %
8780% M a g i c k S e t I m a g e %
8781% %
8782% %
8783% %
8784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8785%
8786% MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8787% MagickNextImage(), MagickPreviousImage() with the images from the specified
8788% wand.
8789%
8790% The format of the MagickSetImage method is:
8791%
8792% MagickBooleanType MagickSetImage(MagickWand *wand,
8793% const MagickWand *set_wand)
8794%
8795% A description of each parameter follows:
8796%
8797% o wand: the magick wand.
8798%
8799% o set_wand: the set_wand wand.
8800%
8801*/
8802WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8803 const MagickWand *set_wand)
8804{
8805 Image
8806 *images;
8807
8808 assert(wand != (MagickWand *) NULL);
8809 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008810 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008811 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8812 assert(set_wand != (MagickWand *) NULL);
8813 assert(set_wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008814 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008815 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8816 if (set_wand->images == (Image *) NULL)
8817 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8818 images=CloneImageList(set_wand->images,wand->exception);
8819 if (images == (Image *) NULL)
8820 return(MagickFalse);
8821 ReplaceImageInList(&wand->images,images);
8822 return(MagickTrue);
8823}
8824
8825/*
8826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8827% %
8828% %
8829% %
8830% 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 %
8831% %
8832% %
8833% %
8834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8835%
8836% MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8837% alpha channel.
8838%
8839% The format of the MagickSetImageAlphaChannel method is:
8840%
8841% MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
cristyb15b06c2012-08-28 11:36:48 +00008842% const AlphaChannelOption alpha_type)
cristy3ed852e2009-09-05 21:47:34 +00008843%
8844% A description of each parameter follows:
8845%
8846% o wand: the magick wand.
8847%
8848% o alpha_type: the alpha channel type: ActivateAlphaChannel,
8849% DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8850%
8851*/
8852WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
cristyb15b06c2012-08-28 11:36:48 +00008853 const AlphaChannelOption alpha_type)
cristy3ed852e2009-09-05 21:47:34 +00008854{
8855 assert(wand != (MagickWand *) NULL);
8856 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008857 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008858 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8859 if (wand->images == (Image *) NULL)
8860 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00008861 return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00008862}
8863
8864/*
8865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8866% %
8867% %
8868% %
8869% 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 %
8870% %
8871% %
8872% %
8873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8874%
8875% MagickSetImageBackgroundColor() sets the image background color.
8876%
8877% The format of the MagickSetImageBackgroundColor method is:
8878%
8879% MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8880% const PixelWand *background)
8881%
8882% A description of each parameter follows:
8883%
8884% o wand: the magick wand.
8885%
8886% o background: the background pixel wand.
8887%
8888*/
8889WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8890 const PixelWand *background)
8891{
8892 assert(wand != (MagickWand *) NULL);
8893 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008894 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008895 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8896 if (wand->images == (Image *) NULL)
8897 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008898 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00008899 return(MagickTrue);
8900}
8901
8902/*
8903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8904% %
8905% %
8906% %
cristy3ed852e2009-09-05 21:47:34 +00008907% 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 %
8908% %
8909% %
8910% %
8911%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8912%
8913% MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8914%
8915% The format of the MagickSetImageBluePrimary method is:
8916%
8917% MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8918% const double x,const double y)
8919%
8920% A description of each parameter follows:
8921%
8922% o wand: the magick wand.
8923%
8924% o x: the blue primary x-point.
8925%
8926% o y: the blue primary y-point.
8927%
8928*/
8929WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8930 const double x,const double y)
8931{
8932 assert(wand != (MagickWand *) NULL);
8933 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008934 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008935 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8936 if (wand->images == (Image *) NULL)
8937 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8938 wand->images->chromaticity.blue_primary.x=x;
8939 wand->images->chromaticity.blue_primary.y=y;
8940 return(MagickTrue);
8941}
8942
8943/*
8944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8945% %
8946% %
8947% %
8948% 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 %
8949% %
8950% %
8951% %
8952%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8953%
8954% MagickSetImageBorderColor() sets the image border color.
8955%
8956% The format of the MagickSetImageBorderColor method is:
8957%
8958% MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8959% const PixelWand *border)
8960%
8961% A description of each parameter follows:
8962%
8963% o wand: the magick wand.
8964%
8965% o border: the border pixel wand.
8966%
8967*/
8968WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8969 const PixelWand *border)
8970{
8971 assert(wand != (MagickWand *) NULL);
8972 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00008973 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00008974 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8975 if (wand->images == (Image *) NULL)
8976 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008977 PixelGetQuantumPacket(border,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00008978 return(MagickTrue);
8979}
8980
8981/*
8982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8983% %
8984% %
8985% %
cristy3ed852e2009-09-05 21:47:34 +00008986% M a g i c k S e t I m a g e C l i p M a s k %
8987% %
8988% %
8989% %
8990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8991%
cristy10a6c612012-01-29 21:41:05 +00008992% MagickSetImageMask() sets image clip mask.
cristy3ed852e2009-09-05 21:47:34 +00008993%
cristy10a6c612012-01-29 21:41:05 +00008994% The format of the MagickSetImageMask method is:
cristy3ed852e2009-09-05 21:47:34 +00008995%
cristy10a6c612012-01-29 21:41:05 +00008996% MagickBooleanType MagickSetImageMask(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00008997% const MagickWand *clip_mask)
8998%
8999% A description of each parameter follows:
9000%
9001% o wand: the magick wand.
9002%
9003% o clip_mask: the clip_mask wand.
9004%
9005*/
cristy10a6c612012-01-29 21:41:05 +00009006WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00009007 const MagickWand *clip_mask)
9008{
9009 assert(wand != (MagickWand *) NULL);
9010 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009011 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009012 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9013 assert(clip_mask != (MagickWand *) NULL);
9014 assert(clip_mask->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009015 if (IfMagickTrue(clip_mask->debug))
cristy3ed852e2009-09-05 21:47:34 +00009016 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9017 if (clip_mask->images == (Image *) NULL)
cristyee37c102011-10-24 14:39:02 +00009018 ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
cristy10a6c612012-01-29 21:41:05 +00009019 return(SetImageMask(wand->images,clip_mask->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009020}
9021
9022/*
9023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9024% %
9025% %
9026% %
cristya5b77cb2010-05-07 19:34:48 +00009027% M a g i c k S e t I m a g e C o l o r %
9028% %
9029% %
9030% %
9031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9032%
9033% MagickSetImageColor() set the entire wand canvas to the specified color.
9034%
9035% The format of the MagickSetImageColor method is:
9036%
9037% MagickBooleanType MagickSetImageColor(MagickWand *wand,
9038% const PixelWand *color)
9039%
9040% A description of each parameter follows:
9041%
9042% o wand: the magick wand.
9043%
9044% o background: the image color.
9045%
9046*/
9047WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9048 const PixelWand *color)
9049{
cristy4c08aed2011-07-01 19:47:50 +00009050 PixelInfo
cristya5b77cb2010-05-07 19:34:48 +00009051 pixel;
9052
9053 assert(wand != (MagickWand *) NULL);
9054 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009055 if (IfMagickTrue(wand->debug))
cristya5b77cb2010-05-07 19:34:48 +00009056 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9057 PixelGetMagickColor(color,&pixel);
cristye941a752011-10-15 01:52:48 +00009058 return(SetImageColor(wand->images,&pixel,wand->exception));
cristya5b77cb2010-05-07 19:34:48 +00009059}
9060
9061/*
9062%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9063% %
9064% %
9065% %
cristy3ed852e2009-09-05 21:47:34 +00009066% 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 %
9067% %
9068% %
9069% %
9070%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9071%
9072% MagickSetImageColormapColor() sets the color of the specified colormap
9073% index.
9074%
9075% The format of the MagickSetImageColormapColor method is:
9076%
9077% MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009078% const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00009079%
9080% A description of each parameter follows:
9081%
9082% o wand: the magick wand.
9083%
9084% o index: the offset into the image colormap.
9085%
9086% o color: Return the colormap color in this wand.
9087%
9088*/
9089WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009090 const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00009091{
9092 assert(wand != (MagickWand *) NULL);
9093 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009094 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009095 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9096 if (wand->images == (Image *) NULL)
9097 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy101ab702011-10-13 13:06:32 +00009098 if ((wand->images->colormap == (PixelInfo *) NULL) ||
cristy3ed852e2009-09-05 21:47:34 +00009099 (index >= wand->images->colors))
9100 ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009101 PixelGetQuantumPacket(color,wand->images->colormap+index);
cristyea1a8aa2011-10-20 13:24:06 +00009102 return(SyncImage(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009103}
9104
9105/*
9106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9107% %
9108% %
9109% %
9110% M a g i c k S e t I m a g e C o l o r s p a c e %
9111% %
9112% %
9113% %
9114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9115%
anthony43054ce2012-04-24 05:35:44 +00009116% MagickSetImageColorspace() sets the image colorspace. But does not modify
9117% the image data.
cristy3ed852e2009-09-05 21:47:34 +00009118%
9119% The format of the MagickSetImageColorspace method is:
9120%
9121% MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9122% const ColorspaceType colorspace)
9123%
9124% A description of each parameter follows:
9125%
9126% o wand: the magick wand.
9127%
9128% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
9129% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9130% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9131% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9132% HSLColorspace, or HWBColorspace.
9133%
9134*/
9135WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9136 const ColorspaceType colorspace)
9137{
9138 assert(wand != (MagickWand *) NULL);
9139 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009140 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009141 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9142 if (wand->images == (Image *) NULL)
9143 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00009144 return(SetImageColorspace(wand->images,colorspace,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009145}
9146
9147/*
9148%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9149% %
9150% %
9151% %
9152% M a g i c k S e t I m a g e C o m p o s e %
9153% %
9154% %
9155% %
9156%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9157%
9158% MagickSetImageCompose() sets the image composite operator, useful for
9159% specifying how to composite the image thumbnail when using the
9160% MagickMontageImage() method.
9161%
9162% The format of the MagickSetImageCompose method is:
9163%
9164% MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9165% const CompositeOperator compose)
9166%
9167% A description of each parameter follows:
9168%
9169% o wand: the magick wand.
9170%
9171% o compose: the image composite operator.
9172%
9173*/
9174WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9175 const CompositeOperator compose)
9176{
9177 assert(wand != (MagickWand *) NULL);
9178 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009179 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009180 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9181 if (wand->images == (Image *) NULL)
9182 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9183 wand->images->compose=compose;
9184 return(MagickTrue);
9185}
9186
9187/*
9188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9189% %
9190% %
9191% %
9192% M a g i c k S e t I m a g e C o m p r e s s i o n %
9193% %
9194% %
9195% %
9196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9197%
9198% MagickSetImageCompression() sets the image compression.
9199%
9200% The format of the MagickSetImageCompression method is:
9201%
9202% MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9203% const CompressionType compression)
9204%
9205% A description of each parameter follows:
9206%
9207% o wand: the magick wand.
9208%
9209% o compression: the image compression type.
9210%
9211*/
9212WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9213 const CompressionType compression)
9214{
9215 assert(wand != (MagickWand *) NULL);
9216 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009217 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009218 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9219 if (wand->images == (Image *) NULL)
9220 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9221 wand->images->compression=compression;
9222 return(MagickTrue);
9223}
9224
9225/*
9226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9227% %
9228% %
9229% %
9230% 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 %
9231% %
9232% %
9233% %
9234%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9235%
9236% MagickSetImageCompressionQuality() sets the image compression quality.
9237%
9238% The format of the MagickSetImageCompressionQuality method is:
9239%
9240% MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009241% const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009242%
9243% A description of each parameter follows:
9244%
9245% o wand: the magick wand.
9246%
9247% o quality: the image compression tlityype.
9248%
9249*/
9250WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009251 const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009252{
9253 assert(wand != (MagickWand *) NULL);
9254 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009255 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009256 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9257 if (wand->images == (Image *) NULL)
9258 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9259 wand->images->quality=quality;
9260 return(MagickTrue);
9261}
9262
9263/*
9264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9265% %
9266% %
9267% %
9268% M a g i c k S e t I m a g e D e l a y %
9269% %
9270% %
9271% %
9272%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9273%
9274% MagickSetImageDelay() sets the image delay.
9275%
9276% The format of the MagickSetImageDelay method is:
9277%
9278% MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009279% const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009280%
9281% A description of each parameter follows:
9282%
9283% o wand: the magick wand.
9284%
9285% o delay: the image delay in ticks-per-second units.
9286%
9287*/
9288WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009289 const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009290{
9291 assert(wand != (MagickWand *) NULL);
9292 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009293 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009294 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9295 if (wand->images == (Image *) NULL)
9296 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9297 wand->images->delay=delay;
9298 return(MagickTrue);
9299}
9300
9301/*
9302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9303% %
9304% %
9305% %
9306% M a g i c k S e t I m a g e D e p t h %
9307% %
9308% %
9309% %
9310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9311%
9312% MagickSetImageDepth() sets the image depth.
9313%
9314% The format of the MagickSetImageDepth method is:
9315%
9316% MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009317% const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009318%
9319% A description of each parameter follows:
9320%
9321% o wand: the magick wand.
9322%
9323% o depth: the image depth in bits: 8, 16, or 32.
9324%
9325*/
9326WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009327 const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009328{
9329 assert(wand != (MagickWand *) NULL);
9330 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009331 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009332 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9333 if (wand->images == (Image *) NULL)
9334 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy8a11cb12011-10-19 23:53:34 +00009335 return(SetImageDepth(wand->images,depth,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009336}
9337
9338/*
9339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9340% %
9341% %
9342% %
9343% M a g i c k S e t I m a g e D i s p o s e %
9344% %
9345% %
9346% %
9347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9348%
9349% MagickSetImageDispose() sets the image disposal method.
9350%
9351% The format of the MagickSetImageDispose method is:
9352%
9353% MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9354% const DisposeType dispose)
9355%
9356% A description of each parameter follows:
9357%
9358% o wand: the magick wand.
9359%
9360% o dispose: the image disposeal type.
9361%
9362*/
9363WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9364 const DisposeType dispose)
9365{
9366 assert(wand != (MagickWand *) NULL);
9367 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009368 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009369 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9370 if (wand->images == (Image *) NULL)
9371 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9372 wand->images->dispose=dispose;
9373 return(MagickTrue);
9374}
9375
9376/*
9377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9378% %
9379% %
9380% %
cristyd4d100e2012-05-23 11:29:55 +00009381% M a g i c k S e t I m a g e E n d i a n %
9382% %
9383% %
9384% %
9385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9386%
9387% MagickSetImageEndian() sets the image endian method.
9388%
9389% The format of the MagickSetImageEndian method is:
9390%
9391% MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9392% const EndianType endian)
9393%
9394% A description of each parameter follows:
9395%
9396% o wand: the magick wand.
9397%
9398% o endian: the image endian type.
9399%
9400*/
9401WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9402 const EndianType endian)
9403{
9404 assert(wand != (MagickWand *) NULL);
9405 assert(wand->signature == WandSignature);
9406 if (wand->debug != MagickFalse)
9407 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9408 if (wand->images == (Image *) NULL)
9409 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9410 wand->images->endian=endian;
9411 return(MagickTrue);
9412}
9413
9414/*
9415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9416% %
9417% %
9418% %
cristy3ed852e2009-09-05 21:47:34 +00009419% M a g i c k S e t I m a g e E x t e n t %
9420% %
9421% %
9422% %
9423%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9424%
9425% MagickSetImageExtent() sets the image size (i.e. columns & rows).
9426%
9427% The format of the MagickSetImageExtent method is:
9428%
9429% MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009430% const size_t columns,const unsigned rows)
cristy3ed852e2009-09-05 21:47:34 +00009431%
9432% A description of each parameter follows:
9433%
9434% o wand: the magick wand.
9435%
9436% o columns: The image width in pixels.
9437%
9438% o rows: The image height in pixels.
9439%
9440*/
9441WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009442 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009443{
9444 assert(wand != (MagickWand *) NULL);
9445 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009446 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009447 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9448 if (wand->images == (Image *) NULL)
9449 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00009450 return(SetImageExtent(wand->images,columns,rows,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009451}
9452
9453/*
9454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9455% %
9456% %
9457% %
9458% M a g i c k S e t I m a g e F i l e n a m e %
9459% %
9460% %
9461% %
9462%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9463%
9464% MagickSetImageFilename() sets the filename of a particular image in a
9465% sequence.
9466%
9467% The format of the MagickSetImageFilename method is:
9468%
9469% MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9470% const char *filename)
9471%
9472% A description of each parameter follows:
9473%
9474% o wand: the magick wand.
9475%
9476% o filename: the image filename.
9477%
9478*/
9479WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9480 const char *filename)
9481{
9482 assert(wand != (MagickWand *) NULL);
9483 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009484 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009485 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9486 if (wand->images == (Image *) NULL)
9487 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9488 if (filename != (const char *) NULL)
9489 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9490 return(MagickTrue);
9491}
9492
9493/*
9494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9495% %
9496% %
9497% %
9498% M a g i c k S e t I m a g e F o r m a t %
9499% %
9500% %
9501% %
9502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503%
9504% MagickSetImageFormat() sets the format of a particular image in a
9505% sequence.
9506%
9507% The format of the MagickSetImageFormat method is:
9508%
9509% MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9510% const char *format)
9511%
9512% A description of each parameter follows:
9513%
9514% o wand: the magick wand.
9515%
9516% o format: the image format.
9517%
9518*/
9519WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9520 const char *format)
9521{
9522 const MagickInfo
9523 *magick_info;
9524
9525 assert(wand != (MagickWand *) NULL);
9526 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009527 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009528 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9529 if (wand->images == (Image *) NULL)
9530 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9531 if ((format == (char *) NULL) || (*format == '\0'))
9532 {
9533 *wand->images->magick='\0';
9534 return(MagickTrue);
9535 }
9536 magick_info=GetMagickInfo(format,wand->exception);
9537 if (magick_info == (const MagickInfo *) NULL)
9538 return(MagickFalse);
9539 ClearMagickException(wand->exception);
9540 (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9541 return(MagickTrue);
9542}
9543
9544/*
9545%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9546% %
9547% %
9548% %
9549% M a g i c k S e t I m a g e F u z z %
9550% %
9551% %
9552% %
9553%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9554%
9555% MagickSetImageFuzz() sets the image fuzz.
9556%
9557% The format of the MagickSetImageFuzz method is:
9558%
9559% MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9560% const double fuzz)
9561%
9562% A description of each parameter follows:
9563%
9564% o wand: the magick wand.
9565%
9566% o fuzz: the image fuzz.
9567%
9568*/
9569WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9570 const double fuzz)
9571{
9572 assert(wand != (MagickWand *) NULL);
9573 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009574 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009575 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9576 if (wand->images == (Image *) NULL)
9577 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9578 wand->images->fuzz=fuzz;
9579 return(MagickTrue);
9580}
9581
9582/*
9583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9584% %
9585% %
9586% %
9587% M a g i c k S e t I m a g e G a m m a %
9588% %
9589% %
9590% %
9591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9592%
9593% MagickSetImageGamma() sets the image gamma.
9594%
9595% The format of the MagickSetImageGamma method is:
9596%
9597% MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9598% const double gamma)
9599%
9600% A description of each parameter follows:
9601%
9602% o wand: the magick wand.
9603%
9604% o gamma: the image gamma.
9605%
9606*/
9607WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9608 const double gamma)
9609{
9610 assert(wand != (MagickWand *) NULL);
9611 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009612 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009613 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9614 if (wand->images == (Image *) NULL)
9615 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9616 wand->images->gamma=gamma;
9617 return(MagickTrue);
9618}
9619
9620/*
9621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9622% %
9623% %
9624% %
9625% M a g i c k S e t I m a g e G r a v i t y %
9626% %
9627% %
9628% %
9629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9630%
9631% MagickSetImageGravity() sets the image gravity type.
9632%
9633% The format of the MagickSetImageGravity method is:
9634%
9635% MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9636% const GravityType gravity)
9637%
9638% A description of each parameter follows:
9639%
9640% o wand: the magick wand.
9641%
9642% o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9643% PlaneInterlace, PartitionInterlace.
9644%
9645*/
9646WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9647 const GravityType gravity)
9648{
9649 assert(wand != (MagickWand *) NULL);
9650 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009651 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009652 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9653 if (wand->images == (Image *) NULL)
9654 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9655 wand->images->gravity=gravity;
9656 return(MagickTrue);
9657}
9658
9659/*
9660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9661% %
9662% %
9663% %
9664% 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 %
9665% %
9666% %
9667% %
9668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9669%
9670% MagickSetImageGreenPrimary() sets the image chromaticity green primary
9671% point.
9672%
9673% The format of the MagickSetImageGreenPrimary method is:
9674%
9675% MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9676% const double x,const double y)
9677%
9678% A description of each parameter follows:
9679%
9680% o wand: the magick wand.
9681%
9682% o x: the green primary x-point.
9683%
9684% o y: the green primary y-point.
9685%
9686%
9687*/
9688WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9689 const double x,const double y)
9690{
9691 assert(wand != (MagickWand *) NULL);
9692 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009693 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009694 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9695 if (wand->images == (Image *) NULL)
9696 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9697 wand->images->chromaticity.green_primary.x=x;
9698 wand->images->chromaticity.green_primary.y=y;
9699 return(MagickTrue);
9700}
9701
9702/*
9703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9704% %
9705% %
9706% %
9707% 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 %
9708% %
9709% %
9710% %
9711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9712%
9713% MagickSetImageInterlaceScheme() sets the image interlace scheme.
9714%
9715% The format of the MagickSetImageInterlaceScheme method is:
9716%
9717% MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9718% const InterlaceType interlace)
9719%
9720% A description of each parameter follows:
9721%
9722% o wand: the magick wand.
9723%
9724% o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9725% PlaneInterlace, PartitionInterlace.
9726%
9727*/
9728WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9729 const InterlaceType interlace)
9730{
9731 assert(wand != (MagickWand *) NULL);
9732 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009733 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009734 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9735 if (wand->images == (Image *) NULL)
9736 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9737 wand->images->interlace=interlace;
9738 return(MagickTrue);
9739}
9740
9741/*
9742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9743% %
9744% %
9745% %
9746% 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 %
9747% %
9748% %
9749% %
9750%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9751%
cristy5221b602012-10-30 18:02:55 +00009752% MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel
9753% method.
cristy3ed852e2009-09-05 21:47:34 +00009754%
cristy5c4e2582011-09-11 19:21:03 +00009755% The format of the MagickSetImagePixelInterpolateMethod method is:
cristy3ed852e2009-09-05 21:47:34 +00009756%
cristy5c4e2582011-09-11 19:21:03 +00009757% MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9758% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00009759%
9760% A description of each parameter follows:
9761%
9762% o wand: the magick wand.
9763%
9764% o method: the image interpole pixel methods: choose from Undefined,
9765% Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9766%
9767*/
cristy5221b602012-10-30 18:02:55 +00009768WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
9769 MagickWand *wand,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00009770{
9771 assert(wand != (MagickWand *) NULL);
9772 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009773 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009774 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9775 if (wand->images == (Image *) NULL)
9776 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9777 wand->images->interpolate=method;
9778 return(MagickTrue);
9779}
9780
9781/*
9782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9783% %
9784% %
9785% %
9786% M a g i c k S e t I m a g e I t e r a t i o n s %
9787% %
9788% %
9789% %
9790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9791%
9792% MagickSetImageIterations() sets the image iterations.
9793%
9794% The format of the MagickSetImageIterations method is:
9795%
9796% MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009797% const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +00009798%
9799% A description of each parameter follows:
9800%
9801% o wand: the magick wand.
9802%
9803% o delay: the image delay in 1/100th of a second.
9804%
9805*/
9806WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009807 const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +00009808{
9809 assert(wand != (MagickWand *) NULL);
9810 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009811 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009812 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9813 if (wand->images == (Image *) NULL)
9814 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9815 wand->images->iterations=iterations;
9816 return(MagickTrue);
9817}
9818
9819/*
9820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9821% %
9822% %
9823% %
9824% M a g i c k S e t I m a g e M a t t e %
9825% %
9826% %
9827% %
9828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9829%
9830% MagickSetImageMatte() sets the image matte channel.
9831%
9832% The format of the MagickSetImageMatteColor method is:
9833%
9834% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9835% const MagickBooleanType *matte)
9836%
9837% A description of each parameter follows:
9838%
9839% o wand: the magick wand.
9840%
9841% o matte: Set to MagickTrue to enable the image matte channel otherwise
9842% MagickFalse.
9843%
9844*/
9845WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9846 const MagickBooleanType matte)
9847{
9848 assert(wand != (MagickWand *) NULL);
9849 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009850 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009851 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9852 if (wand->images == (Image *) NULL)
9853 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy7d6d3d82014-11-09 17:00:16 +00009854 if ((wand->images->alpha_trait == UndefinedPixelTrait) && IsMagickTrue(matte))
cristye941a752011-10-15 01:52:48 +00009855 (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
cristyb0a657e2012-08-29 00:45:37 +00009856 wand->images->alpha_trait=matte != MagickFalse ? BlendPixelTrait :
9857 UndefinedPixelTrait;
cristy3ed852e2009-09-05 21:47:34 +00009858 return(MagickTrue);
9859}
9860
9861/*
9862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9863% %
9864% %
9865% %
9866% M a g i c k S e t I m a g e M a t t e C o l o r %
9867% %
9868% %
9869% %
9870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9871%
9872% MagickSetImageMatteColor() sets the image matte color.
9873%
9874% The format of the MagickSetImageMatteColor method is:
9875%
9876% MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9877% const PixelWand *matte)
9878%
9879% A description of each parameter follows:
9880%
9881% o wand: the magick wand.
9882%
9883% o matte: the matte pixel wand.
9884%
9885*/
9886WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9887 const PixelWand *matte)
9888{
9889 assert(wand != (MagickWand *) NULL);
9890 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009891 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009892 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9893 if (wand->images == (Image *) NULL)
9894 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009895 PixelGetQuantumPacket(matte,&wand->images->matte_color);
cristy3ed852e2009-09-05 21:47:34 +00009896 return(MagickTrue);
9897}
9898
9899/*
9900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9901% %
9902% %
9903% %
9904% M a g i c k S e t I m a g e O p a c i t y %
9905% %
9906% %
9907% %
9908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9909%
cristyb6a294d2011-10-03 00:55:17 +00009910% MagickSetImageAlpha() sets the image to the specified alpha level.
cristy3ed852e2009-09-05 21:47:34 +00009911%
cristyb6a294d2011-10-03 00:55:17 +00009912% The format of the MagickSetImageAlpha method is:
cristy3ed852e2009-09-05 21:47:34 +00009913%
cristyb6a294d2011-10-03 00:55:17 +00009914% MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00009915% const double alpha)
9916%
9917% A description of each parameter follows:
9918%
9919% o wand: the magick wand.
9920%
9921% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9922% transparent.
9923%
9924*/
cristyb6a294d2011-10-03 00:55:17 +00009925WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00009926 const double alpha)
9927{
9928 MagickBooleanType
9929 status;
9930
9931 assert(wand != (MagickWand *) NULL);
9932 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009933 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009934 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9935 if (wand->images == (Image *) NULL)
9936 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +00009937 status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9938 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00009939 return(status);
cristy3ed852e2009-09-05 21:47:34 +00009940}
9941
9942/*
9943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9944% %
9945% %
9946% %
9947% 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 %
9948% %
9949% %
9950% %
9951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9952%
9953% MagickSetImageOrientation() sets the image orientation.
9954%
9955% The format of the MagickSetImageOrientation method is:
9956%
9957% MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9958% const OrientationType orientation)
9959%
9960% A description of each parameter follows:
9961%
9962% o wand: the magick wand.
9963%
9964% o orientation: the image orientation type.
9965%
9966*/
9967WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9968 const OrientationType orientation)
9969{
9970 assert(wand != (MagickWand *) NULL);
9971 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +00009972 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +00009973 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9974 if (wand->images == (Image *) NULL)
9975 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9976 wand->images->orientation=orientation;
9977 return(MagickTrue);
9978}
9979
9980/*
9981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9982% %
9983% %
9984% %
9985% M a g i c k S e t I m a g e P a g e %
9986% %
9987% %
9988% %
9989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9990%
9991% MagickSetImagePage() sets the page geometry of the image.
9992%
9993% The format of the MagickSetImagePage method is:
9994%
cristy5221b602012-10-30 18:02:55 +00009995% MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,% const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00009996%
9997% A description of each parameter follows:
9998%
9999% o wand: the magick wand.
10000%
10001% o width: the page width.
10002%
10003% o height: the page height.
10004%
10005% o x: the page x-offset.
10006%
10007% o y: the page y-offset.
10008%
10009*/
10010WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010011 const size_t width,const size_t height,const ssize_t x,
10012 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010013{
10014 assert(wand != (MagickWand *) NULL);
10015 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010016 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010017 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10018 if (wand->images == (Image *) NULL)
10019 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10020 wand->images->page.width=width;
10021 wand->images->page.height=height;
10022 wand->images->page.x=x;
10023 wand->images->page.y=y;
10024 return(MagickTrue);
10025}
10026
10027/*
10028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10029% %
10030% %
10031% %
10032% 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 %
10033% %
10034% %
10035% %
10036%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10037%
10038% MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10039% specified method and returns the previous progress monitor if any. The
10040% progress monitor method looks like this:
10041%
10042% MagickBooleanType MagickProgressMonitor(const char *text,
10043% const MagickOffsetType offset,const MagickSizeType span,
10044% void *client_data)
10045%
10046% If the progress monitor returns MagickFalse, the current operation is
10047% interrupted.
10048%
10049% The format of the MagickSetImageProgressMonitor method is:
10050%
10051% MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10052% const MagickProgressMonitor progress_monitor,void *client_data)
10053%
10054% A description of each parameter follows:
10055%
10056% o wand: the magick wand.
10057%
10058% o progress_monitor: Specifies a pointer to a method to monitor progress
10059% of an image operation.
10060%
10061% o client_data: Specifies a pointer to any client data.
10062%
10063*/
10064WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10065 const MagickProgressMonitor progress_monitor,void *client_data)
10066{
10067 MagickProgressMonitor
10068 previous_monitor;
10069
10070 assert(wand != (MagickWand *) NULL);
10071 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010072 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010073 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10074 if (wand->images == (Image *) NULL)
10075 {
10076 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000010077 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000010078 return((MagickProgressMonitor) NULL);
10079 }
10080 previous_monitor=SetImageProgressMonitor(wand->images,
10081 progress_monitor,client_data);
10082 return(previous_monitor);
10083}
10084
10085/*
10086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10087% %
10088% %
10089% %
10090% M a g i c k S e t I m a g e R e d P r i m a r y %
10091% %
10092% %
10093% %
10094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10095%
10096% MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10097%
10098% The format of the MagickSetImageRedPrimary method is:
10099%
10100% MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10101% const double x,const double y)
10102%
10103% A description of each parameter follows:
10104%
10105% o wand: the magick wand.
10106%
10107% o x: the red primary x-point.
10108%
10109% o y: the red primary y-point.
10110%
10111*/
10112WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10113 const double x,const double y)
10114{
10115 assert(wand != (MagickWand *) NULL);
10116 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010117 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010118 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10119 if (wand->images == (Image *) NULL)
10120 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10121 wand->images->chromaticity.red_primary.x=x;
10122 wand->images->chromaticity.red_primary.y=y;
10123 return(MagickTrue);
10124}
10125
10126/*
10127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10128% %
10129% %
10130% %
10131% 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 %
10132% %
10133% %
10134% %
10135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10136%
10137% MagickSetImageRenderingIntent() sets the image rendering intent.
10138%
10139% The format of the MagickSetImageRenderingIntent method is:
10140%
10141% MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10142% const RenderingIntent rendering_intent)
10143%
10144% A description of each parameter follows:
10145%
10146% o wand: the magick wand.
10147%
10148% o rendering_intent: the image rendering intent: UndefinedIntent,
10149% SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10150%
10151*/
10152WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10153 const RenderingIntent rendering_intent)
10154{
10155 assert(wand != (MagickWand *) NULL);
10156 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010157 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010158 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10159 if (wand->images == (Image *) NULL)
10160 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10161 wand->images->rendering_intent=rendering_intent;
10162 return(MagickTrue);
10163}
10164
10165/*
10166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10167% %
10168% %
10169% %
10170% M a g i c k S e t I m a g e R e s o l u t i o n %
10171% %
10172% %
10173% %
10174%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10175%
10176% MagickSetImageResolution() sets the image resolution.
10177%
10178% The format of the MagickSetImageResolution method is:
10179%
10180% MagickBooleanType MagickSetImageResolution(MagickWand *wand,
cristy968b9612012-04-25 20:34:18 +000010181% const double x_resolution,const double y_resolution)
cristy3ed852e2009-09-05 21:47:34 +000010182%
10183% A description of each parameter follows:
10184%
10185% o wand: the magick wand.
10186%
10187% o x_resolution: the image x resolution.
10188%
10189% o y_resolution: the image y resolution.
10190%
10191*/
10192WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10193 const double x_resolution,const double y_resolution)
10194{
10195 assert(wand != (MagickWand *) NULL);
10196 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010197 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010198 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10199 if (wand->images == (Image *) NULL)
10200 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy2a11bef2011-10-28 18:33:11 +000010201 wand->images->resolution.x=x_resolution;
10202 wand->images->resolution.y=y_resolution;
cristy3ed852e2009-09-05 21:47:34 +000010203 return(MagickTrue);
10204}
10205
10206/*
10207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10208% %
10209% %
10210% %
10211% M a g i c k S e t I m a g e S c e n e %
10212% %
10213% %
10214% %
10215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10216%
10217% MagickSetImageScene() sets the image scene.
10218%
10219% The format of the MagickSetImageScene method is:
10220%
10221% MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010222% const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +000010223%
10224% A description of each parameter follows:
10225%
10226% o wand: the magick wand.
10227%
10228% o delay: the image scene number.
10229%
10230*/
10231WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010232 const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +000010233{
10234 assert(wand != (MagickWand *) NULL);
10235 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010236 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010237 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10238 if (wand->images == (Image *) NULL)
10239 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10240 wand->images->scene=scene;
10241 return(MagickTrue);
10242}
10243
10244/*
10245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10246% %
10247% %
10248% %
10249% 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 %
10250% %
10251% %
10252% %
10253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10254%
10255% MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10256%
10257% The format of the MagickSetImageTicksPerSecond method is:
10258%
10259% MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010260% const ssize_t ticks_per-second)
cristy3ed852e2009-09-05 21:47:34 +000010261%
10262% A description of each parameter follows:
10263%
10264% o wand: the magick wand.
10265%
10266% o ticks_per_second: the units to use for the image delay.
10267%
10268*/
10269WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010270 const ssize_t ticks_per_second)
cristy3ed852e2009-09-05 21:47:34 +000010271{
10272 assert(wand != (MagickWand *) NULL);
10273 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010274 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010275 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10276 if (wand->images == (Image *) NULL)
10277 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10278 wand->images->ticks_per_second=ticks_per_second;
10279 return(MagickTrue);
10280}
10281
10282/*
10283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10284% %
10285% %
10286% %
10287% M a g i c k S e t I m a g e T y p e %
10288% %
10289% %
10290% %
10291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10292%
10293% MagickSetImageType() sets the image type.
10294%
10295% The format of the MagickSetImageType method is:
10296%
10297% MagickBooleanType MagickSetImageType(MagickWand *wand,
10298% const ImageType image_type)
10299%
10300% A description of each parameter follows:
10301%
10302% o wand: the magick wand.
10303%
cristy5f1c1ff2010-12-23 21:38:06 +000010304% o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
cristy3ed852e2009-09-05 21:47:34 +000010305% GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10306% TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10307% or OptimizeType.
10308%
10309*/
10310WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10311 const ImageType image_type)
10312{
10313 assert(wand != (MagickWand *) NULL);
10314 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010315 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010316 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10317 if (wand->images == (Image *) NULL)
10318 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +000010319 return(SetImageType(wand->images,image_type,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000010320}
10321
10322/*
10323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10324% %
10325% %
10326% %
10327% M a g i c k S e t I m a g e U n i t s %
10328% %
10329% %
10330% %
10331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10332%
10333% MagickSetImageUnits() sets the image units of resolution.
10334%
10335% The format of the MagickSetImageUnits method is:
10336%
10337% MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10338% const ResolutionType units)
10339%
10340% A description of each parameter follows:
10341%
10342% o wand: the magick wand.
10343%
10344% o units: the image units of resolution : UndefinedResolution,
10345% PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10346%
10347*/
10348WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10349 const ResolutionType units)
10350{
10351 assert(wand != (MagickWand *) NULL);
10352 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010353 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010354 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10355 if (wand->images == (Image *) NULL)
10356 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10357 wand->images->units=units;
10358 return(MagickTrue);
10359}
10360
10361/*
10362%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10363% %
10364% %
10365% %
10366% 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 %
10367% %
10368% %
10369% %
10370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10371%
10372% MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10373%
10374% The format of the MagickSetImageVirtualPixelMethod method is:
10375%
10376% VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10377% const VirtualPixelMethod method)
10378%
10379% A description of each parameter follows:
10380%
10381% o wand: the magick wand.
10382%
10383% o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10384% ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
10385% MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10386%
10387*/
10388WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10389 const VirtualPixelMethod method)
10390{
10391 assert(wand != (MagickWand *) NULL);
10392 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010393 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010394 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10395 if (wand->images == (Image *) NULL)
10396 return(UndefinedVirtualPixelMethod);
cristy387430f2012-02-07 13:09:46 +000010397 return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000010398}
10399
10400/*
10401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10402% %
10403% %
10404% %
10405% M a g i c k S e t I m a g e W h i t e P o i n t %
10406% %
10407% %
10408% %
10409%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10410%
10411% MagickSetImageWhitePoint() sets the image chromaticity white point.
10412%
10413% The format of the MagickSetImageWhitePoint method is:
10414%
10415% MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10416% const double x,const double y)
10417%
10418% A description of each parameter follows:
10419%
10420% o wand: the magick wand.
10421%
10422% o x: the white x-point.
10423%
10424% o y: the white y-point.
10425%
10426*/
10427WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10428 const double x,const double y)
10429{
10430 assert(wand != (MagickWand *) NULL);
10431 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010432 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010433 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10434 if (wand->images == (Image *) NULL)
10435 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10436 wand->images->chromaticity.white_point.x=x;
10437 wand->images->chromaticity.white_point.y=y;
10438 return(MagickTrue);
10439}
10440
10441/*
10442%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10443% %
10444% %
10445% %
10446% M a g i c k S h a d e I m a g e C h a n n e l %
10447% %
10448% %
10449% %
10450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10451%
10452% MagickShadeImage() shines a distant light on an image to create a
10453% three-dimensional effect. You control the positioning of the light with
10454% azimuth and elevation; azimuth is measured in degrees off the x axis
10455% and elevation is measured in pixels above the Z axis.
10456%
10457% The format of the MagickShadeImage method is:
10458%
10459% MagickBooleanType MagickShadeImage(MagickWand *wand,
10460% const MagickBooleanType gray,const double azimuth,
10461% const double elevation)
10462%
10463% A description of each parameter follows:
10464%
10465% o wand: the magick wand.
10466%
10467% o gray: A value other than zero shades the intensity of each pixel.
10468%
10469% o azimuth, elevation: Define the light source direction.
10470%
10471*/
10472WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10473 const MagickBooleanType gray,const double asimuth,const double elevation)
10474{
10475 Image
10476 *shade_image;
10477
10478 assert(wand != (MagickWand *) NULL);
10479 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010480 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010481 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10482 if (wand->images == (Image *) NULL)
10483 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10484 shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10485 if (shade_image == (Image *) NULL)
10486 return(MagickFalse);
10487 ReplaceImageInList(&wand->images,shade_image);
10488 return(MagickTrue);
10489}
10490
10491/*
10492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10493% %
10494% %
10495% %
10496% M a g i c k S h a d o w I m a g e %
10497% %
10498% %
10499% %
10500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10501%
10502% MagickShadowImage() simulates an image shadow.
10503%
10504% The format of the MagickShadowImage method is:
10505%
cristyaa2c16c2012-03-25 22:21:35 +000010506% MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10507% const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010508%
10509% A description of each parameter follows:
10510%
10511% o wand: the magick wand.
10512%
cristyb6a294d2011-10-03 00:55:17 +000010513% o alpha: percentage transparency.
cristy3ed852e2009-09-05 21:47:34 +000010514%
10515% o sigma: the standard deviation of the Gaussian, in pixels.
10516%
10517% o x: the shadow x-offset.
10518%
10519% o y: the shadow y-offset.
10520%
10521*/
10522WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010523 const double alpha,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010524{
10525 Image
10526 *shadow_image;
10527
10528 assert(wand != (MagickWand *) NULL);
10529 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010530 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010531 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10532 if (wand->images == (Image *) NULL)
10533 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000010534 shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010535 if (shadow_image == (Image *) NULL)
10536 return(MagickFalse);
10537 ReplaceImageInList(&wand->images,shadow_image);
10538 return(MagickTrue);
10539}
10540
10541/*
10542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10543% %
10544% %
10545% %
10546% M a g i c k S h a r p e n I m a g e %
10547% %
10548% %
10549% %
10550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10551%
10552% MagickSharpenImage() sharpens an image. We convolve the image with a
10553% Gaussian operator of the given radius and standard deviation (sigma).
10554% For reasonable results, the radius should be larger than sigma. Use a
10555% radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10556%
10557% The format of the MagickSharpenImage method is:
10558%
10559% MagickBooleanType MagickSharpenImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010560% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +000010561%
10562% A description of each parameter follows:
10563%
10564% o wand: the magick wand.
10565%
cristy3ed852e2009-09-05 21:47:34 +000010566% o radius: the radius of the Gaussian, in pixels, not counting the center
10567% pixel.
10568%
10569% o sigma: the standard deviation of the Gaussian, in pixels.
10570%
10571*/
cristy3ed852e2009-09-05 21:47:34 +000010572WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010573 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +000010574{
cristy3ed852e2009-09-05 21:47:34 +000010575 Image
10576 *sharp_image;
10577
10578 assert(wand != (MagickWand *) NULL);
10579 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010580 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010581 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10582 if (wand->images == (Image *) NULL)
10583 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000010584 sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010585 if (sharp_image == (Image *) NULL)
10586 return(MagickFalse);
10587 ReplaceImageInList(&wand->images,sharp_image);
10588 return(MagickTrue);
10589}
10590
10591/*
10592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10593% %
10594% %
10595% %
10596% M a g i c k S h a v e I m a g e %
10597% %
10598% %
10599% %
10600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10601%
10602% MagickShaveImage() shaves pixels from the image edges. It allocates the
10603% memory necessary for the new Image structure and returns a pointer to the
10604% new image.
10605%
10606% The format of the MagickShaveImage method is:
10607%
10608% MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010609% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010610%
10611% A description of each parameter follows:
10612%
10613% o wand: the magick wand.
10614%
10615% o columns: the number of columns in the scaled image.
10616%
10617% o rows: the number of rows in the scaled image.
10618%
10619%
10620*/
10621WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010622 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010623{
10624 Image
10625 *shave_image;
10626
10627 RectangleInfo
10628 shave_info;
10629
10630 assert(wand != (MagickWand *) NULL);
10631 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010632 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010633 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10634 if (wand->images == (Image *) NULL)
10635 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10636 shave_info.width=columns;
10637 shave_info.height=rows;
10638 shave_info.x=0;
10639 shave_info.y=0;
10640 shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10641 if (shave_image == (Image *) NULL)
10642 return(MagickFalse);
10643 ReplaceImageInList(&wand->images,shave_image);
10644 return(MagickTrue);
10645}
10646
10647/*
10648%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10649% %
10650% %
10651% %
10652% M a g i c k S h e a r I m a g e %
10653% %
10654% %
10655% %
10656%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10657%
cristycee97112010-05-28 00:44:52 +000010658% MagickShearImage() slides one edge of an image along the X or Y axis,
10659% creating a parallelogram. An X direction shear slides an edge along the X
10660% axis, while a Y direction shear slides an edge along the Y axis. The amount
cristy3ed852e2009-09-05 21:47:34 +000010661% of the shear is controlled by a shear angle. For X direction shears, x_shear
10662% is measured relative to the Y axis, and similarly, for Y direction shears
10663% y_shear is measured relative to the X axis. Empty triangles left over from
10664% shearing the image are filled with the background color.
10665%
10666% The format of the MagickShearImage method is:
10667%
10668% MagickBooleanType MagickShearImage(MagickWand *wand,
cristy968b9612012-04-25 20:34:18 +000010669% const PixelWand *background,const double x_shear,const double y_shear)
cristy3ed852e2009-09-05 21:47:34 +000010670%
10671% A description of each parameter follows:
10672%
10673% o wand: the magick wand.
10674%
10675% o background: the background pixel wand.
10676%
10677% o x_shear: the number of degrees to shear the image.
10678%
10679% o y_shear: the number of degrees to shear the image.
10680%
10681*/
10682WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10683 const PixelWand *background,const double x_shear,const double y_shear)
10684{
10685 Image
10686 *shear_image;
10687
10688 assert(wand != (MagickWand *) NULL);
10689 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010690 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010691 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10692 if (wand->images == (Image *) NULL)
10693 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +000010694 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +000010695 shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10696 if (shear_image == (Image *) NULL)
10697 return(MagickFalse);
10698 ReplaceImageInList(&wand->images,shear_image);
10699 return(MagickTrue);
10700}
10701
10702/*
10703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10704% %
10705% %
10706% %
10707% 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 %
10708% %
10709% %
10710% %
10711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10712%
10713% MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10714% non-linear sigmoidal contrast algorithm. Increase the contrast of the
10715% image using a sigmoidal transfer function without saturating highlights or
10716% shadows. Contrast indicates how much to increase the contrast (0 is none;
10717% 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10718% the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
10719% sharpen to MagickTrue to increase the image contrast otherwise the contrast
10720% is reduced.
10721%
10722% The format of the MagickSigmoidalContrastImage method is:
10723%
10724% MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10725% const MagickBooleanType sharpen,const double alpha,const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010726%
10727% A description of each parameter follows:
10728%
10729% o wand: the magick wand.
10730%
cristy3ed852e2009-09-05 21:47:34 +000010731% o sharpen: Increase or decrease image contrast.
10732%
cristyfa769582010-09-30 23:30:03 +000010733% o alpha: strength of the contrast, the larger the number the more
10734% 'threshold-like' it becomes.
cristy3ed852e2009-09-05 21:47:34 +000010735%
cristyfa769582010-09-30 23:30:03 +000010736% o beta: midpoint of the function as a color value 0 to QuantumRange.
cristy3ed852e2009-09-05 21:47:34 +000010737%
10738*/
cristy9ee60942011-07-06 14:54:38 +000010739WandExport MagickBooleanType MagickSigmoidalContrastImage(
10740 MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10741 const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010742{
10743 MagickBooleanType
10744 status;
10745
10746 assert(wand != (MagickWand *) NULL);
10747 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010748 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010749 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10750 if (wand->images == (Image *) NULL)
10751 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy33bd5152011-08-24 01:42:24 +000010752 status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
cristy5f49bdb2011-10-16 14:28:56 +000010753 wand->exception);
cristy220c4d52013-11-27 19:31:32 +000010754 return(status);
cristy3ed852e2009-09-05 21:47:34 +000010755}
10756
10757/*
10758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10759% %
10760% %
10761% %
10762% M a g i c k S i m i l a r i t y I m a g e %
10763% %
10764% %
10765% %
10766%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10767%
10768% MagickSimilarityImage() compares the reference image of the image and
10769% returns the best match offset. In addition, it returns a similarity image
10770% such that an exact match location is completely white and if none of the
10771% pixels match, black, otherwise some gray level in-between.
10772%
10773% The format of the MagickSimilarityImage method is:
10774%
10775% MagickWand *MagickSimilarityImage(MagickWand *wand,
cristy09136812011-10-18 15:24:30 +000010776% const MagickWand *reference,const MetricType metric,
cristy4dab3802013-03-15 22:08:15 +000010777% const double similarity_threshold,RectangeInfo *offset,
10778% double *similarity)
cristy3ed852e2009-09-05 21:47:34 +000010779%
10780% A description of each parameter follows:
10781%
10782% o wand: the magick wand.
10783%
10784% o reference: the reference wand.
10785%
cristy09136812011-10-18 15:24:30 +000010786% o metric: the metric.
10787%
cristy4dab3802013-03-15 22:08:15 +000010788% o similarity_threshold: minimum distortion for (sub)image match.
10789%
cristy3ed852e2009-09-05 21:47:34 +000010790% o offset: the best match offset of the reference image within the image.
10791%
10792% o similarity: the computed similarity between the images.
10793%
10794*/
10795WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
cristy4dab3802013-03-15 22:08:15 +000010796 const MagickWand *reference,const MetricType metric,
10797 const double similarity_threshold,RectangleInfo *offset,double *similarity)
cristy3ed852e2009-09-05 21:47:34 +000010798{
10799 Image
10800 *similarity_image;
10801
10802 assert(wand != (MagickWand *) NULL);
10803 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010804 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010805 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10806 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10807 {
10808 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000010809 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000010810 return((MagickWand *) NULL);
10811 }
cristy4dab3802013-03-15 22:08:15 +000010812 similarity_image=SimilarityImage(wand->images,reference->images,metric,
10813 similarity_threshold,offset,similarity,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010814 if (similarity_image == (Image *) NULL)
10815 return((MagickWand *) NULL);
10816 return(CloneMagickWandFromImages(wand,similarity_image));
10817}
10818
10819/*
10820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10821% %
10822% %
10823% %
10824% M a g i c k S k e t c h I m a g e %
10825% %
10826% %
10827% %
10828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10829%
10830% MagickSketchImage() simulates a pencil sketch. We convolve the image with
10831% a Gaussian operator of the given radius and standard deviation (sigma).
10832% For reasonable results, radius should be larger than sigma. Use a
10833% radius of 0 and SketchImage() selects a suitable radius for you.
10834% Angle gives the angle of the blurring motion.
10835%
10836% The format of the MagickSketchImage method is:
10837%
10838% MagickBooleanType MagickSketchImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010839% const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +000010840%
10841% A description of each parameter follows:
10842%
10843% o wand: the magick wand.
10844%
10845% o radius: the radius of the Gaussian, in pixels, not counting
10846% the center pixel.
10847%
10848% o sigma: the standard deviation of the Gaussian, in pixels.
10849%
cristyf7ef0252011-09-09 14:50:06 +000010850% o angle: apply the effect along this angle.
10851%
cristy3ed852e2009-09-05 21:47:34 +000010852*/
10853WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010854 const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +000010855{
10856 Image
10857 *sketch_image;
10858
10859 assert(wand != (MagickWand *) NULL);
10860 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010861 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010862 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10863 if (wand->images == (Image *) NULL)
10864 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000010865 sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010866 if (sketch_image == (Image *) NULL)
10867 return(MagickFalse);
10868 ReplaceImageInList(&wand->images,sketch_image);
10869 return(MagickTrue);
10870}
10871
10872/*
10873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10874% %
10875% %
10876% %
cristy4285d782011-02-09 20:12:28 +000010877% M a g i c k S m u s h I m a g e s %
10878% %
10879% %
10880% %
10881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10882%
10883% MagickSmushImages() takes all images from the current image pointer to the
10884% end of the image list and smushs them to each other top-to-bottom if the
10885% stack parameter is true, otherwise left-to-right.
10886%
10887% The format of the MagickSmushImages method is:
10888%
10889% MagickWand *MagickSmushImages(MagickWand *wand,
10890% const MagickBooleanType stack,const ssize_t offset)
10891%
10892% A description of each parameter follows:
10893%
10894% o wand: the magick wand.
10895%
10896% o stack: By default, images are stacked left-to-right. Set stack to
10897% MagickTrue to stack them top-to-bottom.
10898%
10899% o offset: minimum distance in pixels between images.
10900%
10901*/
10902WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10903 const MagickBooleanType stack,const ssize_t offset)
10904{
10905 Image
10906 *smush_image;
10907
10908 assert(wand != (MagickWand *) NULL);
10909 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010910 if (IfMagickTrue(wand->debug))
cristy4285d782011-02-09 20:12:28 +000010911 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10912 if (wand->images == (Image *) NULL)
10913 return((MagickWand *) NULL);
10914 smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10915 if (smush_image == (Image *) NULL)
10916 return((MagickWand *) NULL);
10917 return(CloneMagickWandFromImages(wand,smush_image));
10918}
10919
10920/*
10921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10922% %
10923% %
10924% %
cristy3ed852e2009-09-05 21:47:34 +000010925% M a g i c k S o l a r i z e I m a g e %
10926% %
10927% %
10928% %
10929%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10930%
10931% MagickSolarizeImage() applies a special effect to the image, similar to the
10932% effect achieved in a photo darkroom by selectively exposing areas of photo
10933% sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
10934% measure of the extent of the solarization.
10935%
10936% The format of the MagickSolarizeImage method is:
10937%
10938% MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10939% const double threshold)
10940%
10941% A description of each parameter follows:
10942%
10943% o wand: the magick wand.
10944%
10945% o threshold: Define the extent of the solarization.
10946%
10947*/
10948WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10949 const double threshold)
10950{
10951 MagickBooleanType
10952 status;
10953
10954 assert(wand != (MagickWand *) NULL);
10955 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000010956 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000010957 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10958 if (wand->images == (Image *) NULL)
10959 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +000010960 status=SolarizeImage(wand->images,threshold,wand->exception);
cristy220c4d52013-11-27 19:31:32 +000010961 return(status);
cristy3ed852e2009-09-05 21:47:34 +000010962}
10963
10964/*
10965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10966% %
10967% %
10968% %
10969% M a g i c k S p a r s e C o l o r I m a g e %
10970% %
10971% %
10972% %
10973%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10974%
10975% MagickSparseColorImage(), given a set of coordinates, interpolates the
10976% colors found at those coordinates, across the whole image, using various
10977% methods.
10978%
10979% The format of the MagickSparseColorImage method is:
10980%
10981% MagickBooleanType MagickSparseColorImage(MagickWand *wand,
cristy3884f692011-07-08 18:00:18 +000010982% const SparseColorMethod method,const size_t number_arguments,
10983% const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000010984%
10985% A description of each parameter follows:
10986%
10987% o image: the image to be sparseed.
10988%
10989% o method: the method of image sparseion.
10990%
10991% ArcSparseColorion will always ignore source image offset, and always
10992% 'bestfit' the destination image with the top left corner offset
10993% relative to the polar mapping center.
10994%
10995% Bilinear has no simple inverse mapping so will not allow 'bestfit'
10996% style of image sparseion.
10997%
10998% Affine, Perspective, and Bilinear, will do least squares fitting of
10999% the distrotion when more than the minimum number of control point
11000% pairs are provided.
11001%
11002% Perspective, and Bilinear, will fall back to a Affine sparseion when
11003% less than 4 control point pairs are provided. While Affine sparseions
11004% will let you use any number of control point pairs, that is Zero pairs
11005% is a No-Op (viewport only) distrotion, one pair is a translation and
11006% two pairs of control points will do a scale-rotate-translate, without
11007% any shearing.
11008%
11009% o number_arguments: the number of arguments given for this sparseion
11010% method.
11011%
11012% o arguments: the arguments for this sparseion method.
11013%
11014*/
11015WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
cristy3884f692011-07-08 18:00:18 +000011016 const SparseColorMethod method,const size_t number_arguments,
11017 const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000011018{
11019 Image
11020 *sparse_image;
11021
11022 assert(wand != (MagickWand *) NULL);
11023 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011024 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011025 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11026 if (wand->images == (Image *) NULL)
11027 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3884f692011-07-08 18:00:18 +000011028 sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11029 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011030 if (sparse_image == (Image *) NULL)
11031 return(MagickFalse);
11032 ReplaceImageInList(&wand->images,sparse_image);
11033 return(MagickTrue);
11034}
11035
11036/*
11037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11038% %
11039% %
11040% %
11041% M a g i c k S p l i c e I m a g e %
11042% %
11043% %
11044% %
11045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11046%
11047% MagickSpliceImage() splices a solid color into the image.
11048%
11049% The format of the MagickSpliceImage method is:
11050%
11051% MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011052% const size_t width,const size_t height,const ssize_t x,
11053% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011054%
11055% A description of each parameter follows:
11056%
11057% o wand: the magick wand.
11058%
11059% o width: the region width.
11060%
11061% o height: the region height.
11062%
11063% o x: the region x offset.
11064%
11065% o y: the region y offset.
11066%
11067*/
11068WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011069 const size_t width,const size_t height,const ssize_t x,
11070 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011071{
11072 Image
11073 *splice_image;
11074
11075 RectangleInfo
11076 splice;
11077
11078 assert(wand != (MagickWand *) NULL);
11079 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011080 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011081 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11082 if (wand->images == (Image *) NULL)
11083 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11084 splice.width=width;
11085 splice.height=height;
11086 splice.x=x;
11087 splice.y=y;
11088 splice_image=SpliceImage(wand->images,&splice,wand->exception);
11089 if (splice_image == (Image *) NULL)
11090 return(MagickFalse);
11091 ReplaceImageInList(&wand->images,splice_image);
11092 return(MagickTrue);
11093}
11094
11095/*
11096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11097% %
11098% %
11099% %
11100% M a g i c k S p r e a d I m a g e %
11101% %
11102% %
11103% %
11104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11105%
11106% MagickSpreadImage() is a special effects method that randomly displaces each
11107% pixel in a block defined by the radius parameter.
11108%
11109% The format of the MagickSpreadImage method is:
11110%
cristy5c4e2582011-09-11 19:21:03 +000011111% MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11112% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011113%
11114% A description of each parameter follows:
11115%
11116% o wand: the magick wand.
11117%
11118% o radius: Choose a random pixel in a neighborhood of this extent.
11119%
cristy5c4e2582011-09-11 19:21:03 +000011120% o method: the pixel interpolation method.
11121%
cristy3ed852e2009-09-05 21:47:34 +000011122*/
11123WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +000011124 const double radius,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011125{
11126 Image
11127 *spread_image;
11128
11129 assert(wand != (MagickWand *) NULL);
11130 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011131 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011132 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11133 if (wand->images == (Image *) NULL)
11134 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +000011135 spread_image=SpreadImage(wand->images,radius,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011136 if (spread_image == (Image *) NULL)
11137 return(MagickFalse);
11138 ReplaceImageInList(&wand->images,spread_image);
11139 return(MagickTrue);
11140}
11141
11142/*
11143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11144% %
11145% %
11146% %
cristy12453682011-03-18 18:45:04 +000011147% M a g i c k S t a t i s t i c I m a g e %
11148% %
11149% %
11150% %
11151%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11152%
11153% MagickStatisticImage() replace each pixel with corresponding statistic from
cristy8d752042011-03-19 01:00:36 +000011154% the neighborhood of the specified width and height.
cristy12453682011-03-18 18:45:04 +000011155%
11156% The format of the MagickStatisticImage method is:
11157%
11158% MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristy95c38342011-03-18 22:39:51 +000011159% const StatisticType type,const double width,const size_t height)
cristy12453682011-03-18 18:45:04 +000011160%
11161% A description of each parameter follows:
11162%
11163% o wand: the magick wand.
11164%
cristy12453682011-03-18 18:45:04 +000011165% o type: the statistic type (e.g. median, mode, etc.).
11166%
cristy8d752042011-03-19 01:00:36 +000011167% o width: the width of the pixel neighborhood.
11168%
11169% o height: the height of the pixel neighborhood.
cristy12453682011-03-18 18:45:04 +000011170%
11171*/
11172WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristyf4ad9df2011-07-08 16:49:03 +000011173 const StatisticType type,const size_t width,const size_t height)
cristy12453682011-03-18 18:45:04 +000011174{
11175 Image
11176 *statistic_image;
11177
11178 assert(wand != (MagickWand *) NULL);
11179 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011180 if (IfMagickTrue(wand->debug))
cristy12453682011-03-18 18:45:04 +000011181 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11182 if (wand->images == (Image *) NULL)
11183 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000011184 statistic_image=StatisticImage(wand->images,type,width,height,
cristy12453682011-03-18 18:45:04 +000011185 wand->exception);
11186 if (statistic_image == (Image *) NULL)
11187 return(MagickFalse);
11188 ReplaceImageInList(&wand->images,statistic_image);
11189 return(MagickTrue);
11190}
11191
11192/*
11193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11194% %
11195% %
11196% %
cristy3ed852e2009-09-05 21:47:34 +000011197% M a g i c k S t e g a n o I m a g e %
11198% %
11199% %
11200% %
11201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11202%
11203% MagickSteganoImage() hides a digital watermark within the image.
11204% Recover the hidden watermark later to prove that the authenticity of
11205% an image. Offset defines the start position within the image to hide
11206% the watermark.
11207%
11208% The format of the MagickSteganoImage method is:
11209%
11210% MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011211% const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000011212%
11213% A description of each parameter follows:
11214%
11215% o wand: the magick wand.
11216%
11217% o watermark_wand: the watermark wand.
11218%
11219% o offset: Start hiding at this offset into the image.
11220%
11221*/
11222WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011223 const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000011224{
11225 Image
11226 *stegano_image;
11227
11228 assert(wand != (MagickWand *) NULL);
11229 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011230 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011231 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11232 if ((wand->images == (Image *) NULL) ||
11233 (watermark_wand->images == (Image *) NULL))
11234 {
11235 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000011236 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000011237 return((MagickWand *) NULL);
11238 }
11239 wand->images->offset=offset;
11240 stegano_image=SteganoImage(wand->images,watermark_wand->images,
11241 wand->exception);
11242 if (stegano_image == (Image *) NULL)
11243 return((MagickWand *) NULL);
11244 return(CloneMagickWandFromImages(wand,stegano_image));
11245}
11246
11247/*
11248%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11249% %
11250% %
11251% %
11252% M a g i c k S t e r e o I m a g e %
11253% %
11254% %
11255% %
11256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11257%
11258% MagickStereoImage() composites two images and produces a single image that
11259% is the composite of a left and right image of a stereo pair
11260%
11261% The format of the MagickStereoImage method is:
11262%
11263% MagickWand *MagickStereoImage(MagickWand *wand,
11264% const MagickWand *offset_wand)
11265%
11266% A description of each parameter follows:
11267%
11268% o wand: the magick wand.
11269%
11270% o offset_wand: Another image wand.
11271%
11272*/
11273WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11274 const MagickWand *offset_wand)
11275{
11276 Image
11277 *stereo_image;
11278
11279 assert(wand != (MagickWand *) NULL);
11280 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011281 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011282 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11283 if ((wand->images == (Image *) NULL) ||
11284 (offset_wand->images == (Image *) NULL))
11285 {
11286 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000011287 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000011288 return((MagickWand *) NULL);
11289 }
11290 stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11291 if (stereo_image == (Image *) NULL)
11292 return((MagickWand *) NULL);
11293 return(CloneMagickWandFromImages(wand,stereo_image));
11294}
11295
11296/*
11297%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11298% %
11299% %
11300% %
11301% M a g i c k S t r i p I m a g e %
11302% %
11303% %
11304% %
11305%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11306%
11307% MagickStripImage() strips an image of all profiles and comments.
11308%
11309% The format of the MagickStripImage method is:
11310%
11311% MagickBooleanType MagickStripImage(MagickWand *wand)
11312%
11313% A description of each parameter follows:
11314%
11315% o wand: the magick wand.
11316%
11317*/
11318WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11319{
cristy3ed852e2009-09-05 21:47:34 +000011320 assert(wand != (MagickWand *) NULL);
11321 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011322 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011323 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11324 if (wand->images == (Image *) NULL)
11325 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +000011326 return(StripImage(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000011327}
11328
11329/*
11330%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11331% %
11332% %
11333% %
11334% M a g i c k S w i r l I m a g e %
11335% %
11336% %
11337% %
11338%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11339%
11340% MagickSwirlImage() swirls the pixels about the center of the image, where
11341% degrees indicates the sweep of the arc through which each pixel is moved.
11342% You get a more dramatic effect as the degrees move from 1 to 360.
11343%
11344% The format of the MagickSwirlImage method is:
11345%
cristy76f512e2011-09-12 01:26:56 +000011346% MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11347% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011348%
11349% A description of each parameter follows:
11350%
11351% o wand: the magick wand.
11352%
11353% o degrees: Define the tightness of the swirling effect.
11354%
cristy76f512e2011-09-12 01:26:56 +000011355% o method: the pixel interpolation method.
11356%
cristy3ed852e2009-09-05 21:47:34 +000011357*/
11358WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +000011359 const double degrees,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011360{
11361 Image
11362 *swirl_image;
11363
11364 assert(wand != (MagickWand *) NULL);
11365 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011366 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011367 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11368 if (wand->images == (Image *) NULL)
11369 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +000011370 swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011371 if (swirl_image == (Image *) NULL)
11372 return(MagickFalse);
11373 ReplaceImageInList(&wand->images,swirl_image);
11374 return(MagickTrue);
11375}
11376
11377/*
11378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11379% %
11380% %
11381% %
11382% M a g i c k T e x t u r e I m a g e %
11383% %
11384% %
11385% %
11386%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11387%
11388% MagickTextureImage() repeatedly tiles the texture image across and down the
11389% image canvas.
11390%
11391% The format of the MagickTextureImage method is:
11392%
11393% MagickWand *MagickTextureImage(MagickWand *wand,
11394% const MagickWand *texture_wand)
11395%
11396% A description of each parameter follows:
11397%
11398% o wand: the magick wand.
11399%
11400% o texture_wand: the texture wand
11401%
11402*/
11403WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11404 const MagickWand *texture_wand)
11405{
11406 Image
11407 *texture_image;
11408
11409 MagickBooleanType
11410 status;
11411
11412 assert(wand != (MagickWand *) NULL);
11413 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011414 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011415 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11416 if ((wand->images == (Image *) NULL) ||
11417 (texture_wand->images == (Image *) NULL))
11418 {
11419 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000011420 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000011421 return((MagickWand *) NULL);
11422 }
11423 texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11424 if (texture_image == (Image *) NULL)
11425 return((MagickWand *) NULL);
cristye941a752011-10-15 01:52:48 +000011426 status=TextureImage(texture_image,texture_wand->images,wand->exception);
cristy5221b602012-10-30 18:02:55 +000011427 if (IfMagickFalse(status))
cristy3ed852e2009-09-05 21:47:34 +000011428 {
cristy3ed852e2009-09-05 21:47:34 +000011429 texture_image=DestroyImage(texture_image);
11430 return((MagickWand *) NULL);
11431 }
11432 return(CloneMagickWandFromImages(wand,texture_image));
11433}
11434
11435/*
11436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11437% %
11438% %
11439% %
11440% M a g i c k T h r e s h o l d I m a g e %
11441% %
11442% %
11443% %
11444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11445%
11446% MagickThresholdImage() changes the value of individual pixels based on
11447% the intensity of each pixel compared to threshold. The result is a
11448% high-contrast, two color image.
11449%
11450% The format of the MagickThresholdImage method is:
11451%
11452% MagickBooleanType MagickThresholdImage(MagickWand *wand,
11453% const double threshold)
11454% MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11455% const ChannelType channel,const double threshold)
11456%
11457% A description of each parameter follows:
11458%
11459% o wand: the magick wand.
11460%
11461% o channel: the image channel(s).
11462%
11463% o threshold: Define the threshold value.
11464%
11465*/
11466WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11467 const double threshold)
11468{
11469 MagickBooleanType
11470 status;
11471
11472 status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
cristy220c4d52013-11-27 19:31:32 +000011473 return(status);
cristy3ed852e2009-09-05 21:47:34 +000011474}
11475
11476WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11477 const ChannelType channel,const double threshold)
11478{
11479 MagickBooleanType
11480 status;
11481
11482 assert(wand != (MagickWand *) NULL);
11483 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011484 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011485 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11486 if (wand->images == (Image *) NULL)
11487 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +000011488 status=BilevelImage(wand->images,threshold,wand->exception);
cristy220c4d52013-11-27 19:31:32 +000011489 return(status);
cristy3ed852e2009-09-05 21:47:34 +000011490}
11491
11492/*
11493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11494% %
11495% %
11496% %
11497% M a g i c k T h u m b n a i l I m a g e %
11498% %
11499% %
11500% %
11501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11502%
11503% MagickThumbnailImage() changes the size of an image to the given dimensions
11504% and removes any associated profiles. The goal is to produce small low cost
11505% thumbnail images suited for display on the Web.
11506%
11507% The format of the MagickThumbnailImage method is:
11508%
11509% MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011510% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011511%
11512% A description of each parameter follows:
11513%
11514% o wand: the magick wand.
11515%
11516% o columns: the number of columns in the scaled image.
11517%
11518% o rows: the number of rows in the scaled image.
11519%
11520*/
11521WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011522 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011523{
11524 Image
11525 *thumbnail_image;
11526
11527 assert(wand != (MagickWand *) NULL);
11528 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011529 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011530 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11531 if (wand->images == (Image *) NULL)
11532 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11533 thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11534 if (thumbnail_image == (Image *) NULL)
11535 return(MagickFalse);
11536 ReplaceImageInList(&wand->images,thumbnail_image);
11537 return(MagickTrue);
11538}
11539
11540/*
11541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11542% %
11543% %
11544% %
11545% M a g i c k T i n t I m a g e %
11546% %
11547% %
11548% %
11549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11550%
11551% MagickTintImage() applies a color vector to each pixel in the image. The
11552% length of the vector is 0 for black and white and at its maximum for the
11553% midtones. The vector weighting function is
11554% f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11555%
11556% The format of the MagickTintImage method is:
11557%
11558% MagickBooleanType MagickTintImage(MagickWand *wand,
cristyb817c3f2011-10-03 14:00:35 +000011559% const PixelWand *tint,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +000011560%
11561% A description of each parameter follows:
11562%
11563% o wand: the magick wand.
11564%
11565% o tint: the tint pixel wand.
11566%
cristyb6a294d2011-10-03 00:55:17 +000011567% o alpha: the alpha pixel wand.
cristy3ed852e2009-09-05 21:47:34 +000011568%
11569*/
11570WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
cristyb817c3f2011-10-03 14:00:35 +000011571 const PixelWand *tint,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +000011572{
11573 char
cristyb817c3f2011-10-03 14:00:35 +000011574 percent_blend[MaxTextExtent];
cristy3ed852e2009-09-05 21:47:34 +000011575
11576 Image
11577 *tint_image;
11578
cristy28474bf2011-09-11 23:32:52 +000011579 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000011580 target;
11581
11582 assert(wand != (MagickWand *) NULL);
11583 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011584 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011585 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11586 if (wand->images == (Image *) NULL)
11587 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +000011588 if (wand->images->colorspace != CMYKColorspace)
cristyb817c3f2011-10-03 14:00:35 +000011589 (void) FormatLocaleString(percent_blend,MaxTextExtent,
cristy76f512e2011-09-12 01:26:56 +000011590 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristyb817c3f2011-10-03 14:00:35 +000011591 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11592 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11593 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11594 PixelGetAlphaQuantum(blend)));
cristy76f512e2011-09-12 01:26:56 +000011595 else
cristyb817c3f2011-10-03 14:00:35 +000011596 (void) FormatLocaleString(percent_blend,MaxTextExtent,
cristy76f512e2011-09-12 01:26:56 +000011597 "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristyb817c3f2011-10-03 14:00:35 +000011598 PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11599 PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11600 PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11601 PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11602 PixelGetAlphaQuantum(blend)));
cristy28474bf2011-09-11 23:32:52 +000011603 target=PixelGetPixel(tint);
cristyb817c3f2011-10-03 14:00:35 +000011604 tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011605 if (tint_image == (Image *) NULL)
11606 return(MagickFalse);
11607 ReplaceImageInList(&wand->images,tint_image);
11608 return(MagickTrue);
11609}
11610
11611/*
11612%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11613% %
11614% %
11615% %
11616% M a g i c k T r a n s f o r m I m a g e %
11617% %
11618% %
11619% %
11620%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11621%
11622% MagickTransformImage() is a convenience method that behaves like
11623% MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11624% information as a region geometry specification. If the operation fails,
11625% a NULL image handle is returned.
11626%
11627% The format of the MagickTransformImage method is:
11628%
11629% MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11630% const char *geometry)
11631%
11632% A description of each parameter follows:
11633%
11634% o wand: the magick wand.
11635%
11636% o crop: A crop geometry string. This geometry defines a subregion of the
11637% image to crop.
11638%
11639% o geometry: An image geometry string. This geometry defines the final
11640% size of the image.
11641%
11642*/
11643WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11644 const char *crop,const char *geometry)
11645{
11646 Image
11647 *transform_image;
11648
11649 MagickBooleanType
11650 status;
11651
11652 assert(wand != (MagickWand *) NULL);
11653 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011654 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011655 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11656 if (wand->images == (Image *) NULL)
11657 return((MagickWand *) NULL);
11658 transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11659 if (transform_image == (Image *) NULL)
11660 return((MagickWand *) NULL);
cristye941a752011-10-15 01:52:48 +000011661 status=TransformImage(&transform_image,crop,geometry,wand->exception);
cristy5221b602012-10-30 18:02:55 +000011662 if (IfMagickFalse(status))
cristy3ed852e2009-09-05 21:47:34 +000011663 {
cristy3ed852e2009-09-05 21:47:34 +000011664 transform_image=DestroyImage(transform_image);
11665 return((MagickWand *) NULL);
11666 }
11667 return(CloneMagickWandFromImages(wand,transform_image));
11668}
11669
11670/*
11671%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11672% %
11673% %
11674% %
11675% 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 %
11676% %
11677% %
11678% %
11679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11680%
anthony43054ce2012-04-24 05:35:44 +000011681% MagickTransformImageColorspace() transform the image colorspace, setting
11682% the images colorspace while transforming the images data to that
11683% colorspace.
cristy3ed852e2009-09-05 21:47:34 +000011684%
11685% The format of the MagickTransformImageColorspace method is:
11686%
11687% MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11688% const ColorspaceType colorspace)
11689%
11690% A description of each parameter follows:
11691%
11692% o wand: the magick wand.
11693%
anthony43054ce2012-04-24 05:35:44 +000011694% o colorspace: the image colorspace: UndefinedColorspace,
11695% sRGBColorspace, RGBColorspace, GRAYColorspace,
11696% OHTAColorspace, XYZColorspace, YCbCrColorspace,
11697% YCCColorspace, YIQColorspace, YPbPrColorspace,
11698% YPbPrColorspace, YUVColorspace, CMYKColorspace,
11699% HSLColorspace, HWBColorspace.
cristy3ed852e2009-09-05 21:47:34 +000011700%
11701*/
11702WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11703 const ColorspaceType colorspace)
11704{
11705 assert(wand != (MagickWand *) NULL);
11706 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011707 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011708 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11709 if (wand->images == (Image *) NULL)
11710 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +000011711 return(TransformImageColorspace(wand->images,colorspace,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000011712}
11713
11714/*
11715%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11716% %
11717% %
11718% %
11719% 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 %
11720% %
11721% %
11722% %
11723%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11724%
11725% MagickTransparentPaintImage() changes any pixel that matches color with the
11726% color defined by fill.
11727%
11728% The format of the MagickTransparentPaintImage method is:
11729%
11730% MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11731% const PixelWand *target,const double alpha,const double fuzz,
11732% const MagickBooleanType invert)
11733%
11734% A description of each parameter follows:
11735%
11736% o wand: the magick wand.
11737%
cristyb6a294d2011-10-03 00:55:17 +000011738% o target: Change this target color to specified alpha value within
cristy3ed852e2009-09-05 21:47:34 +000011739% the image.
11740%
11741% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11742% transparent.
11743%
11744% o fuzz: By default target must match a particular pixel color
11745% exactly. However, in many cases two colors may differ by a small amount.
11746% The fuzz member of image defines how much tolerance is acceptable to
11747% consider two colors as the same. For example, set fuzz to 10 and the
11748% color red at intensities of 100 and 102 respectively are now interpreted
11749% as the same color for the purposes of the floodfill.
11750%
11751% o invert: paint any pixel that does not match the target color.
11752%
11753*/
11754WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11755 const PixelWand *target,const double alpha,const double fuzz,
11756 const MagickBooleanType invert)
11757{
11758 MagickBooleanType
11759 status;
11760
cristy4c08aed2011-07-01 19:47:50 +000011761 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000011762 target_pixel;
11763
11764 assert(wand != (MagickWand *) NULL);
11765 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011766 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011767 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11768 if (wand->images == (Image *) NULL)
11769 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11770 PixelGetMagickColor(target,&target_pixel);
11771 wand->images->fuzz=fuzz;
cristyce70c172010-01-07 17:15:30 +000011772 status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
cristy5f49bdb2011-10-16 14:28:56 +000011773 QuantumRange*alpha),invert,wand->exception);
cristy220c4d52013-11-27 19:31:32 +000011774 return(status);
cristy3ed852e2009-09-05 21:47:34 +000011775}
11776
11777/*
11778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11779% %
11780% %
11781% %
11782% M a g i c k T r a n s p o s e I m a g e %
11783% %
11784% %
11785% %
11786%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11787%
11788% MagickTransposeImage() creates a vertical mirror image by reflecting the
11789% pixels around the central x-axis while rotating them 90-degrees.
11790%
11791% The format of the MagickTransposeImage method is:
11792%
11793% MagickBooleanType MagickTransposeImage(MagickWand *wand)
11794%
11795% A description of each parameter follows:
11796%
11797% o wand: the magick wand.
11798%
11799*/
11800WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11801{
11802 Image
11803 *transpose_image;
11804
11805 assert(wand != (MagickWand *) NULL);
11806 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011807 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011808 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11809 if (wand->images == (Image *) NULL)
11810 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11811 transpose_image=TransposeImage(wand->images,wand->exception);
11812 if (transpose_image == (Image *) NULL)
11813 return(MagickFalse);
11814 ReplaceImageInList(&wand->images,transpose_image);
11815 return(MagickTrue);
11816}
11817
11818/*
11819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11820% %
11821% %
11822% %
11823% M a g i c k T r a n s v e r s e I m a g e %
11824% %
11825% %
11826% %
11827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11828%
11829% MagickTransverseImage() creates a horizontal mirror image by reflecting the
11830% pixels around the central y-axis while rotating them 270-degrees.
11831%
11832% The format of the MagickTransverseImage method is:
11833%
11834% MagickBooleanType MagickTransverseImage(MagickWand *wand)
11835%
11836% A description of each parameter follows:
11837%
11838% o wand: the magick wand.
11839%
11840*/
11841WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11842{
11843 Image
11844 *transverse_image;
11845
11846 assert(wand != (MagickWand *) NULL);
11847 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011848 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011849 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11850 if (wand->images == (Image *) NULL)
11851 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11852 transverse_image=TransverseImage(wand->images,wand->exception);
11853 if (transverse_image == (Image *) NULL)
11854 return(MagickFalse);
11855 ReplaceImageInList(&wand->images,transverse_image);
11856 return(MagickTrue);
11857}
11858
11859/*
11860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11861% %
11862% %
11863% %
11864% M a g i c k T r i m I m a g e %
11865% %
11866% %
11867% %
11868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11869%
11870% MagickTrimImage() remove edges that are the background color from the image.
11871%
11872% The format of the MagickTrimImage method is:
11873%
11874% MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11875%
11876% A description of each parameter follows:
11877%
11878% o wand: the magick wand.
11879%
11880% o fuzz: By default target must match a particular pixel color
11881% exactly. However, in many cases two colors may differ by a small amount.
11882% The fuzz member of image defines how much tolerance is acceptable to
11883% consider two colors as the same. For example, set fuzz to 10 and the
11884% color red at intensities of 100 and 102 respectively are now interpreted
11885% as the same color for the purposes of the floodfill.
11886%
11887*/
11888WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11889{
11890 Image
11891 *trim_image;
11892
11893 assert(wand != (MagickWand *) NULL);
11894 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011895 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011896 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11897 if (wand->images == (Image *) NULL)
11898 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11899 wand->images->fuzz=fuzz;
11900 trim_image=TrimImage(wand->images,wand->exception);
11901 if (trim_image == (Image *) NULL)
11902 return(MagickFalse);
11903 ReplaceImageInList(&wand->images,trim_image);
11904 return(MagickTrue);
11905}
11906
11907/*
11908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11909% %
11910% %
11911% %
11912% M a g i c k U n i q u e I m a g e C o l o r s %
11913% %
11914% %
11915% %
11916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11917%
11918% MagickUniqueImageColors() discards all but one of any pixel color.
11919%
11920% The format of the MagickUniqueImageColors method is:
11921%
11922% MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11923%
11924% A description of each parameter follows:
11925%
11926% o wand: the magick wand.
11927%
11928*/
11929WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11930{
11931 Image
11932 *unique_image;
11933
11934 assert(wand != (MagickWand *) NULL);
11935 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011936 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011937 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11938 if (wand->images == (Image *) NULL)
11939 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11940 unique_image=UniqueImageColors(wand->images,wand->exception);
11941 if (unique_image == (Image *) NULL)
11942 return(MagickFalse);
11943 ReplaceImageInList(&wand->images,unique_image);
11944 return(MagickTrue);
11945}
11946
11947/*
11948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11949% %
11950% %
11951% %
11952% M a g i c k U n s h a r p M a s k I m a g e %
11953% %
11954% %
11955% %
11956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11957%
11958% MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
11959% Gaussian operator of the given radius and standard deviation (sigma).
11960% For reasonable results, radius should be larger than sigma. Use a radius
11961% of 0 and UnsharpMaskImage() selects a suitable radius for you.
11962%
11963% The format of the MagickUnsharpMaskImage method is:
11964%
11965% MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
cristy3afd4012013-03-25 11:30:44 +000011966% const double radius,const double sigma,const double gain,
11967% const double threshold)
cristy3ed852e2009-09-05 21:47:34 +000011968%
11969% A description of each parameter follows:
11970%
11971% o wand: the magick wand.
11972%
cristy3ed852e2009-09-05 21:47:34 +000011973% o radius: the radius of the Gaussian, in pixels, not counting the center
11974% pixel.
11975%
11976% o sigma: the standard deviation of the Gaussian, in pixels.
11977%
cristy7869ee92013-03-23 21:24:49 +000011978% o gain: the percentage of the difference between the original and the
cristy3ed852e2009-09-05 21:47:34 +000011979% blur image that is added back into the original.
11980%
cristy3afd4012013-03-25 11:30:44 +000011981% o threshold: the threshold in pixels needed to apply the diffence gain.
11982%
cristy3ed852e2009-09-05 21:47:34 +000011983*/
cristy3ed852e2009-09-05 21:47:34 +000011984WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
cristy3afd4012013-03-25 11:30:44 +000011985 const double radius,const double sigma,const double gain,
11986 const double threshold)
cristy3ed852e2009-09-05 21:47:34 +000011987{
cristy3ed852e2009-09-05 21:47:34 +000011988 Image
11989 *unsharp_image;
11990
11991 assert(wand != (MagickWand *) NULL);
11992 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000011993 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000011994 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11995 if (wand->images == (Image *) NULL)
11996 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3afd4012013-03-25 11:30:44 +000011997 unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
cristyf4ad9df2011-07-08 16:49:03 +000011998 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011999 if (unsharp_image == (Image *) NULL)
12000 return(MagickFalse);
12001 ReplaceImageInList(&wand->images,unsharp_image);
12002 return(MagickTrue);
12003}
12004
12005/*
12006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12007% %
12008% %
12009% %
12010% M a g i c k V i g n e t t e I m a g e %
12011% %
12012% %
12013% %
12014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12015%
12016% MagickVignetteImage() softens the edges of the image in vignette style.
12017%
12018% The format of the MagickVignetteImage method is:
12019%
12020% MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000012021% const double radius,const double sigma,const ssize_t x,
12022% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000012023%
12024% A description of each parameter follows:
12025%
12026% o wand: the magick wand.
12027%
cristyeb6e6582011-12-09 09:14:23 +000012028% o radius: the radius.
cristy3ed852e2009-09-05 21:47:34 +000012029%
cristyeb6e6582011-12-09 09:14:23 +000012030% o sigma: the sigma.
12031%
cristy3ed852e2009-09-05 21:47:34 +000012032% o x, y: Define the x and y ellipse offset.
12033%
12034*/
12035WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000012036 const double radius,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000012037{
12038 Image
12039 *vignette_image;
12040
12041 assert(wand != (MagickWand *) NULL);
12042 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000012043 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000012044 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12045 if (wand->images == (Image *) NULL)
12046 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000012047 vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012048 if (vignette_image == (Image *) NULL)
12049 return(MagickFalse);
12050 ReplaceImageInList(&wand->images,vignette_image);
12051 return(MagickTrue);
12052}
12053
12054/*
12055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12056% %
12057% %
12058% %
12059% M a g i c k W a v e I m a g e %
12060% %
12061% %
12062% %
12063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12064%
12065% MagickWaveImage() creates a "ripple" effect in the image by shifting
cristycee97112010-05-28 00:44:52 +000012066% the pixels vertically along a sine wave whose amplitude and wavelength
cristy3ed852e2009-09-05 21:47:34 +000012067% is specified by the given parameters.
12068%
12069% The format of the MagickWaveImage method is:
12070%
cristy5c4e2582011-09-11 19:21:03 +000012071% MagickBooleanType MagickWaveImage(MagickWand *wand,
12072% const double amplitude,const double wave_length,
12073% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000012074%
12075% A description of each parameter follows:
12076%
12077% o wand: the magick wand.
12078%
12079% o amplitude, wave_length: Define the amplitude and wave length of the
12080% sine wave.
12081%
cristy5c4e2582011-09-11 19:21:03 +000012082% o method: the pixel interpolation method.
12083%
cristy3ed852e2009-09-05 21:47:34 +000012084*/
12085WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +000012086 const double amplitude,const double wave_length,
12087 const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000012088{
12089 Image
12090 *wave_image;
12091
12092 assert(wand != (MagickWand *) NULL);
12093 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000012094 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000012095 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12096 if (wand->images == (Image *) NULL)
12097 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +000012098 wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12099 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012100 if (wave_image == (Image *) NULL)
12101 return(MagickFalse);
12102 ReplaceImageInList(&wand->images,wave_image);
12103 return(MagickTrue);
12104}
12105
12106/*
12107%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12108% %
12109% %
12110% %
12111% 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 %
12112% %
12113% %
12114% %
12115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12116%
12117% MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
12118% above the threshold into white while leaving all pixels below the threshold
12119% unchanged.
12120%
12121% The format of the MagickWhiteThresholdImage method is:
12122%
12123% MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12124% const PixelWand *threshold)
12125%
12126% A description of each parameter follows:
12127%
12128% o wand: the magick wand.
12129%
12130% o threshold: the pixel wand.
12131%
12132*/
12133WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12134 const PixelWand *threshold)
12135{
12136 char
12137 thresholds[MaxTextExtent];
12138
cristy3ed852e2009-09-05 21:47:34 +000012139 assert(wand != (MagickWand *) NULL);
12140 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000012141 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000012142 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12143 if (wand->images == (Image *) NULL)
12144 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb51dff52011-05-19 16:55:47 +000012145 (void) FormatLocaleString(thresholds,MaxTextExtent,
cristy3ed852e2009-09-05 21:47:34 +000012146 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12147 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
cristyb6a294d2011-10-03 00:55:17 +000012148 PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
cristye941a752011-10-15 01:52:48 +000012149 return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000012150}
12151
12152/*
12153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12154% %
12155% %
12156% %
12157% M a g i c k W r i t e I m a g e %
12158% %
12159% %
12160% %
12161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12162%
12163% MagickWriteImage() writes an image to the specified filename. If the
12164% filename parameter is NULL, the image is written to the filename set
12165% by MagickReadImage() or MagickSetImageFilename().
12166%
12167% The format of the MagickWriteImage method is:
12168%
12169% MagickBooleanType MagickWriteImage(MagickWand *wand,
12170% const char *filename)
12171%
12172% A description of each parameter follows:
12173%
12174% o wand: the magick wand.
12175%
12176% o filename: the image filename.
12177%
12178%
12179*/
12180WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12181 const char *filename)
12182{
12183 Image
12184 *image;
12185
12186 ImageInfo
12187 *write_info;
12188
12189 MagickBooleanType
12190 status;
12191
12192 assert(wand != (MagickWand *) NULL);
12193 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000012194 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000012195 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12196 if (wand->images == (Image *) NULL)
12197 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12198 if (filename != (const char *) NULL)
12199 (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12200 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12201 if (image == (Image *) NULL)
12202 return(MagickFalse);
12203 write_info=CloneImageInfo(wand->image_info);
12204 write_info->adjoin=MagickTrue;
cristye941a752011-10-15 01:52:48 +000012205 status=WriteImage(write_info,image,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012206 image=DestroyImage(image);
12207 write_info=DestroyImageInfo(write_info);
cristy220c4d52013-11-27 19:31:32 +000012208 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012209}
12210
12211/*
12212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12213% %
12214% %
12215% %
12216% M a g i c k W r i t e I m a g e F i l e %
12217% %
12218% %
12219% %
12220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12221%
12222% MagickWriteImageFile() writes an image to an open file descriptor.
12223%
12224% The format of the MagickWriteImageFile method is:
12225%
12226% MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12227%
12228% A description of each parameter follows:
12229%
12230% o wand: the magick wand.
12231%
12232% o file: the file descriptor.
12233%
cristy3ed852e2009-09-05 21:47:34 +000012234*/
12235WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12236{
12237 Image
12238 *image;
12239
12240 ImageInfo
12241 *write_info;
12242
12243 MagickBooleanType
12244 status;
12245
12246 assert(wand != (MagickWand *) NULL);
12247 assert(wand->signature == WandSignature);
12248 assert(file != (FILE *) NULL);
cristy5221b602012-10-30 18:02:55 +000012249 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000012250 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12251 if (wand->images == (Image *) NULL)
12252 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12253 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12254 if (image == (Image *) NULL)
12255 return(MagickFalse);
12256 write_info=CloneImageInfo(wand->image_info);
12257 SetImageInfoFile(write_info,file);
12258 write_info->adjoin=MagickTrue;
cristye941a752011-10-15 01:52:48 +000012259 status=WriteImage(write_info,image,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012260 write_info=DestroyImageInfo(write_info);
cristy3ed852e2009-09-05 21:47:34 +000012261 image=DestroyImage(image);
cristy220c4d52013-11-27 19:31:32 +000012262 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012263}
12264
12265/*
12266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12267% %
12268% %
12269% %
12270% M a g i c k W r i t e I m a g e s %
12271% %
12272% %
12273% %
12274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12275%
12276% MagickWriteImages() writes an image or image sequence.
12277%
12278% The format of the MagickWriteImages method is:
12279%
12280% MagickBooleanType MagickWriteImages(MagickWand *wand,
12281% const char *filename,const MagickBooleanType adjoin)
12282%
12283% A description of each parameter follows:
12284%
12285% o wand: the magick wand.
12286%
12287% o filename: the image filename.
12288%
12289% o adjoin: join images into a single multi-image file.
12290%
12291*/
12292WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12293 const char *filename,const MagickBooleanType adjoin)
12294{
12295 ImageInfo
12296 *write_info;
12297
12298 MagickBooleanType
12299 status;
12300
12301 assert(wand != (MagickWand *) NULL);
12302 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000012303 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000012304 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12305 if (wand->images == (Image *) NULL)
12306 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12307 write_info=CloneImageInfo(wand->image_info);
12308 write_info->adjoin=adjoin;
12309 status=WriteImages(write_info,wand->images,filename,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012310 write_info=DestroyImageInfo(write_info);
cristy220c4d52013-11-27 19:31:32 +000012311 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012312}
12313
12314/*
12315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12316% %
12317% %
12318% %
12319% M a g i c k W r i t e I m a g e s F i l e %
12320% %
12321% %
12322% %
12323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12324%
12325% MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12326%
12327% The format of the MagickWriteImagesFile method is:
12328%
12329% MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12330%
12331% A description of each parameter follows:
12332%
12333% o wand: the magick wand.
12334%
12335% o file: the file descriptor.
12336%
12337*/
12338WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12339{
12340 ImageInfo
12341 *write_info;
12342
12343 MagickBooleanType
12344 status;
12345
12346 assert(wand != (MagickWand *) NULL);
12347 assert(wand->signature == WandSignature);
cristy5221b602012-10-30 18:02:55 +000012348 if (IfMagickTrue(wand->debug))
cristy3ed852e2009-09-05 21:47:34 +000012349 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12350 if (wand->images == (Image *) NULL)
12351 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12352 write_info=CloneImageInfo(wand->image_info);
12353 SetImageInfoFile(write_info,file);
12354 write_info->adjoin=MagickTrue;
12355 status=WriteImages(write_info,wand->images,(const char *) NULL,
12356 wand->exception);
12357 write_info=DestroyImageInfo(write_info);
cristy220c4d52013-11-27 19:31:32 +000012358 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012359}