blob: 738bf3714f60aecba468f437fd43d2b1b33124aa [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% %
Cristy7ce65e72015-12-12 18:03:16 -050026% Copyright 1999-2016 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);
cristye1c94d92015-06-28 12:16:33 +000094 assert(wand->signature == MagickWandSignature);
dirk360b9862016-01-05 15:20:46 +010095 if (wand->debug != MagickFalse)
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();
cristy151b66d2015-04-15 10:50:31 +0000103 (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%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();
cristye1c94d92015-06-28 12:16:33 +0000110 clone_wand->signature=MagickWandSignature;
dirkd0792932016-01-05 15:54:48 +0100111 if (clone_wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000141 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100142 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000193 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100194 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000238 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100239 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000290 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100291 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000341 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100342 if (wand->debug != MagickFalse)
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 */
dirkd0792932016-01-05 15:54:48 +0100401 if (wand->insert_before != MagickFalse)
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 */
dirkd0792932016-01-05 15:54:48 +0100408 if ((wand->insert_before != MagickFalse) &&
cristy5221b602012-10-30 18:02:55 +0000409 (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);
cristye1c94d92015-06-28 12:16:33 +0000443 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100444 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +0000445 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446 assert(add_wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000447 assert(add_wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +0000448 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);
cristye1c94d92015-06-28 12:16:33 +0000494 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100495 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000542 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100543 if (wand->debug != MagickFalse)
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
cristy151b66d2015-04-15 10:50:31 +0000598 geometry[MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +0000599
600 DrawInfo
601 *draw_info;
602
603 MagickBooleanType
604 status;
605
606 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000607 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100608 if (wand->debug != MagickFalse)
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);
cristy151b66d2015-04-15 10:50:31 +0000616 (void) FormatLocaleString(geometry,MagickPathExtent,"%+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);
cristye1c94d92015-06-28 12:16:33 +0000659 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100660 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000706 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100707 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000746 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100747 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000784 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100785 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000823 assert(wand->signature == MagickWandSignature);
dirkcf870d12014-10-03 18:24:06 +0000824 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
cristy151b66d2015-04-15 10:50:31 +0000867 thresholds[MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +0000868
869 MagickBooleanType
870 status;
871
872 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +0000873 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100874 if (wand->debug != MagickFalse)
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);
cristy151b66d2015-04-15 10:50:31 +0000878 (void) FormatLocaleString(thresholds,MagickPathExtent,
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);
cristye1c94d92015-06-28 12:16:33 +0000919 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100920 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +0000969 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +0100970 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001025 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001026 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001079 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001080 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001133 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001134 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001179 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001180 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001236 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001237 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001279 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001280 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001316 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001317 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001364 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001365 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001407 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001408 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001449 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001450 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001510 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001511 if (wand->debug != MagickFalse)
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
cristy151b66d2015-04-15 10:50:31 +00001551 percent_blend[MagickPathExtent];
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);
cristye1c94d92015-06-28 12:16:33 +00001560 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001561 if (wand->debug != MagickFalse)
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)
cristy151b66d2015-04-15 10:50:31 +00001567 (void) FormatLocaleString(percent_blend,MagickPathExtent,
cristyc7e6ff62011-10-03 13:46:11 +00001568 "%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
cristy151b66d2015-04-15 10:50:31 +00001574 (void) FormatLocaleString(percent_blend,MagickPathExtent,
cristyc7e6ff62011-10-03 13:46:11 +00001575 "%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);
cristye1c94d92015-06-28 12:16:33 +00001628 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001629 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001677 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001678 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001720 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001721 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001763 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001764 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001813 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001814 if (wand->debug != MagickFalse)
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);
cristye1c94d92015-06-28 12:16:33 +00001880 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001881 if (wand->debug != MagickFalse)
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% %
dirk675b1c72015-06-28 15:49:28 +00001896% M a g i c k C o m p o s i t e I m a g e G r a v i t y %
1897% %
1898% %
1899% %
1900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901%
1902% MagickCompositeImageGravity() composite one image onto another using the
1903% specified gravity.
1904%
1905% The format of the MagickCompositeImageGravity method is:
1906%
1907% MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1908% const MagickWand *source_wand,const CompositeOperator compose,
1909% const GravityType gravity)
1910%
1911% A description of each parameter follows:
1912%
1913% o wand: the magick wand holding the destination images
1914%
1915% o source_image: the magick wand holding source image.
1916%
1917% o compose: This operator affects how the composite is applied to the
1918% image. The default is Over. These are some of the compose methods
1919% availble.
1920%
1921% OverCompositeOp InCompositeOp OutCompositeOp
1922% AtopCompositeOp XorCompositeOp PlusCompositeOp
1923% MinusCompositeOp AddCompositeOp SubtractCompositeOp
1924% DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp
1925% DisplaceCompositeOp
1926%
1927% o gravity: positioning gravity (NorthWestGravity, NorthGravity,
1928% NorthEastGravity, WestGravity, CenterGravity,
1929% EastGravity, SouthWestGravity, SouthGravity,
1930% SouthEastGravity)
1931%
1932*/
1933WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1934 const MagickWand *source_wand,const CompositeOperator compose,
1935 const GravityType gravity)
1936{
1937 MagickBooleanType
1938 status;
1939
1940 RectangleInfo
1941 geometry;
1942
1943 assert(wand != (MagickWand *) NULL);
1944 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01001945 if (wand->debug != MagickFalse)
dirk675b1c72015-06-28 15:49:28 +00001946 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1947 if ((wand->images == (Image *) NULL) ||
1948 (source_wand->images == (Image *) NULL))
1949 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1950 SetGeometry(source_wand->images,&geometry);
1951 GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
1952 &geometry);
1953 status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
1954 geometry.x,geometry.y,wand->exception);
1955 return(status);
1956}
1957
1958/*
1959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1960% %
1961% %
1962% %
anthonye5840b22012-03-17 12:22:34 +00001963% M a g i c k C o m p o s i t e L a y e r s %
1964% %
1965% %
1966% %
1967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1968%
1969% MagickCompositeLayers() composite the images in the source wand over the
1970% images in the destination wand in sequence, starting with the current
1971% image in both lists.
1972%
1973% Each layer from the two image lists are composted together until the end of
1974% one of the image lists is reached. The offset of each composition is also
1975% adjusted to match the virtual canvas offsets of each layer. As such the
1976% given offset is relative to the virtual canvas, and not the actual image.
1977%
1978% Composition uses given x and y offsets, as the 'origin' location of the
1979% source images virtual canvas (not the real image) allowing you to compose a
1980% list of 'layer images' into the destiantioni images. This makes it well
1981% sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1982% Animations' onto a static or other 'Coaleased Animation' destination image
1983% list. GIF disposal handling is not looked at.
1984%
1985% Special case:- If one of the image sequences is the last image (just a
1986% single image remaining), that image is repeatally composed with all the
1987% images in the other image list. Either the source or destination lists may
1988% be the single image, for this situation.
1989%
1990% In the case of a single destination image (or last image given), that image
1991% will ve cloned to match the number of images remaining in the source image
1992% list.
1993%
1994% This is equivelent to the "-layer Composite" Shell API operator.
1995%
1996% The format of the MagickCompositeLayers method is:
1997%
1998% MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1999% const MagickWand *source_wand, const CompositeOperator compose,
2000% const ssize_t x,const ssize_t y)
2001%
2002% A description of each parameter follows:
2003%
2004% o wand: the magick wand holding destaintion images
2005%
2006% o source_wand: the wand holding the source images
2007%
2008% o compose, x, y: composition arguments
2009%
2010*/
2011WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2012 const MagickWand *source_wand,const CompositeOperator compose,
2013 const ssize_t x,const ssize_t y)
2014{
2015 MagickBooleanType
2016 status;
2017
2018 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002019 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002020 if (wand->debug != MagickFalse)
anthonye5840b22012-03-17 12:22:34 +00002021 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2022 if ((wand->images == (Image *) NULL) ||
2023 (source_wand->images == (Image *) NULL))
2024 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5221b602012-10-30 18:02:55 +00002025 CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
anthonye5840b22012-03-17 12:22:34 +00002026 status=MagickTrue; /* FUTURE: determine status from exceptions */
cristy220c4d52013-11-27 19:31:32 +00002027 return(status);
anthonye5840b22012-03-17 12:22:34 +00002028}
2029
2030/*
2031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2032% %
2033% %
2034% %
cristy3ed852e2009-09-05 21:47:34 +00002035% M a g i c k C o n t r a s t I m a g e %
2036% %
2037% %
2038% %
2039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040%
2041% MagickContrastImage() enhances the intensity differences between the lighter
2042% and darker elements of the image. Set sharpen to a value other than 0 to
2043% increase the image contrast otherwise the contrast is reduced.
2044%
2045% The format of the MagickContrastImage method is:
2046%
2047% MagickBooleanType MagickContrastImage(MagickWand *wand,
2048% const MagickBooleanType sharpen)
2049%
2050% A description of each parameter follows:
2051%
2052% o wand: the magick wand.
2053%
2054% o sharpen: Increase or decrease image contrast.
2055%
2056%
2057*/
2058WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2059 const MagickBooleanType sharpen)
2060{
2061 MagickBooleanType
2062 status;
2063
2064 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002065 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002066 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002067 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2068 if (wand->images == (Image *) NULL)
2069 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002070 status=ContrastImage(wand->images,sharpen,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002071 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002072}
2073
2074/*
2075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2076% %
2077% %
2078% %
2079% 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 %
2080% %
2081% %
2082% %
2083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2084%
2085% MagickContrastStretchImage() enhances the contrast of a color image by
2086% adjusting the pixels color to span the entire range of colors available.
2087% You can also reduce the influence of a particular channel with a gamma
2088% value of 0.
2089%
2090% The format of the MagickContrastStretchImage method is:
2091%
2092% MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2093% const double black_point,const double white_point)
cristy3ed852e2009-09-05 21:47:34 +00002094%
2095% A description of each parameter follows:
2096%
2097% o wand: the magick wand.
2098%
cristy3ed852e2009-09-05 21:47:34 +00002099% o black_point: the black point.
2100%
2101% o white_point: the white point.
2102%
2103*/
cristy3ed852e2009-09-05 21:47:34 +00002104WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2105 const double black_point,const double white_point)
2106{
2107 MagickBooleanType
2108 status;
2109
cristy3ed852e2009-09-05 21:47:34 +00002110 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002111 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002112 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002113 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2114 if (wand->images == (Image *) NULL)
2115 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye23ec9d2011-08-16 18:15:40 +00002116 status=ContrastStretchImage(wand->images,black_point,white_point,
cristy5f49bdb2011-10-16 14:28:56 +00002117 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002118 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002119}
2120
2121/*
2122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123% %
2124% %
2125% %
2126% M a g i c k C o n v o l v e I m a g e %
2127% %
2128% %
2129% %
2130%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2131%
2132% MagickConvolveImage() applies a custom convolution kernel to the image.
2133%
2134% The format of the MagickConvolveImage method is:
2135%
2136% MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00002137% const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00002138%
2139% A description of each parameter follows:
2140%
2141% o wand: the magick wand.
2142%
cristy3ed852e2009-09-05 21:47:34 +00002143% o kernel: An array of doubles representing the convolution kernel.
2144%
2145*/
cristy3ed852e2009-09-05 21:47:34 +00002146WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
cristy5e6be1e2011-07-16 01:23:39 +00002147 const KernelInfo *kernel)
cristy3ed852e2009-09-05 21:47:34 +00002148{
cristy3ed852e2009-09-05 21:47:34 +00002149 Image
cristy5e6be1e2011-07-16 01:23:39 +00002150 *filter_image;
cristy3ed852e2009-09-05 21:47:34 +00002151
2152 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002153 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002154 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002155 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00002156 if (kernel == (const KernelInfo *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00002157 return(MagickFalse);
2158 if (wand->images == (Image *) NULL)
2159 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5e6be1e2011-07-16 01:23:39 +00002160 filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2161 if (filter_image == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00002162 return(MagickFalse);
cristy5e6be1e2011-07-16 01:23:39 +00002163 ReplaceImageInList(&wand->images,filter_image);
cristy3ed852e2009-09-05 21:47:34 +00002164 return(MagickTrue);
2165}
2166
2167/*
2168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2169% %
2170% %
2171% %
2172% M a g i c k C r o p I m a g e %
2173% %
2174% %
2175% %
2176%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2177%
2178% MagickCropImage() extracts a region of the image.
2179%
2180% The format of the MagickCropImage method is:
2181%
2182% MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00002183% const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002184%
2185% A description of each parameter follows:
2186%
2187% o wand: the magick wand.
2188%
2189% o width: the region width.
2190%
2191% o height: the region height.
2192%
2193% o x: the region x-offset.
2194%
2195% o y: the region y-offset.
2196%
2197*/
2198WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
cristy5ed838e2010-05-31 00:05:35 +00002199 const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00002200{
2201 Image
2202 *crop_image;
2203
2204 RectangleInfo
2205 crop;
2206
2207 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002208 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002209 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002210 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2211 if (wand->images == (Image *) NULL)
2212 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2213 crop.width=width;
2214 crop.height=height;
2215 crop.x=x;
2216 crop.y=y;
2217 crop_image=CropImage(wand->images,&crop,wand->exception);
2218 if (crop_image == (Image *) NULL)
2219 return(MagickFalse);
2220 ReplaceImageInList(&wand->images,crop_image);
2221 return(MagickTrue);
2222}
2223
2224/*
2225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2226% %
2227% %
2228% %
2229% M a g i c k C y c l e C o l o r m a p I m a g e %
2230% %
2231% %
2232% %
2233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2234%
2235% MagickCycleColormapImage() displaces an image's colormap by a given number
2236% of positions. If you cycle the colormap a number of times you can produce
2237% a psychodelic effect.
2238%
2239% The format of the MagickCycleColormapImage method is:
2240%
2241% MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002242% const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002243%
2244% A description of each parameter follows:
2245%
2246% o wand: the magick wand.
2247%
2248% o pixel_wand: the pixel wand.
2249%
2250*/
2251WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002252 const ssize_t displace)
cristy3ed852e2009-09-05 21:47:34 +00002253{
2254 MagickBooleanType
2255 status;
2256
2257 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002258 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002259 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002260 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2261 if (wand->images == (Image *) NULL)
2262 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00002263 status=CycleColormapImage(wand->images,displace,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002264 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002265}
2266
2267/*
2268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2269% %
2270% %
2271% %
2272% M a g i c k C o n s t i t u t e I m a g e %
2273% %
2274% %
2275% %
2276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2277%
2278% MagickConstituteImage() adds an image to the wand comprised of the pixel
2279% data you supply. The pixel data must be in scanline order top-to-bottom.
2280% The data can be char, short int, int, float, or double. Float and double
2281% require the pixels to be normalized [0..1], otherwise [0..Max], where Max
2282% is the maximum value the type can accomodate (e.g. 255 for char). For
2283% example, to create a 640x480 image from unsigned red-green-blue character
2284% data, use
2285%
Sebastian Buchwaldad0a89d2015-09-25 14:53:36 +02002286% MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
cristy3ed852e2009-09-05 21:47:34 +00002287%
2288% The format of the MagickConstituteImage method is:
2289%
2290% MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002291% const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002292% const StorageType storage,void *pixels)
2293%
2294% A description of each parameter follows:
2295%
2296% o wand: the magick wand.
2297%
2298% o columns: width in pixels of the image.
2299%
2300% o rows: height in pixels of the image.
2301%
2302% o map: This string reflects the expected ordering of the pixel array.
2303% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00002304% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00002305% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2306% P = pad.
2307%
2308% o storage: Define the data type of the pixels. Float and double types are
2309% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
2310% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2311% LongPixel, QuantumPixel, or ShortPixel.
2312%
2313% o pixels: This array of values contain the pixel components as defined by
2314% map and type. You must preallocate this array where the expected
2315% length varies depending on the values of width, height, map, and type.
2316%
2317%
2318*/
2319WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00002320 const size_t columns,const size_t rows,const char *map,
cristy3ed852e2009-09-05 21:47:34 +00002321 const StorageType storage,const void *pixels)
2322{
2323 Image
2324 *images;
2325
2326 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002327 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002328 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002329 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2330 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2331 if (images == (Image *) NULL)
2332 return(MagickFalse);
2333 return(InsertImageInWand(wand,images));
2334}
2335
2336/*
2337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338% %
2339% %
2340% %
2341% M a g i c k D e c i p h e r I m a g e %
2342% %
2343% %
2344% %
2345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346%
2347% MagickDecipherImage() converts cipher pixels to plain pixels.
2348%
2349% The format of the MagickDecipherImage method is:
2350%
2351% MagickBooleanType MagickDecipherImage(MagickWand *wand,
2352% const char *passphrase)
2353%
2354% A description of each parameter follows:
2355%
2356% o wand: the magick wand.
2357%
2358% o passphrase: the passphrase.
2359%
2360*/
2361WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2362 const char *passphrase)
2363{
2364 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002365 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002366 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002367 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2368 if (wand->images == (Image *) NULL)
2369 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002370 return(DecipherImage(wand->images,passphrase,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00002371}
2372
2373/*
2374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375% %
2376% %
2377% %
2378% M a g i c k D e c o n s t r u c t I m a g e s %
2379% %
2380% %
2381% %
2382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2383%
2384% MagickDeconstructImages() compares each image with the next in a sequence
2385% and returns the maximum bounding region of any pixel differences it
2386% discovers.
2387%
2388% The format of the MagickDeconstructImages method is:
2389%
2390% MagickWand *MagickDeconstructImages(MagickWand *wand)
2391%
2392% A description of each parameter follows:
2393%
2394% o wand: the magick wand.
2395%
2396*/
2397WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2398{
2399 Image
2400 *deconstruct_image;
2401
2402 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002403 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002404 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002405 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2406 if (wand->images == (Image *) NULL)
2407 return((MagickWand *) NULL);
cristy8a9106f2011-07-05 14:39:26 +00002408 deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
cristy4c08aed2011-07-01 19:47:50 +00002409 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002410 if (deconstruct_image == (Image *) NULL)
2411 return((MagickWand *) NULL);
2412 return(CloneMagickWandFromImages(wand,deconstruct_image));
2413}
2414
2415/*
2416%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2417% %
2418% %
2419% %
2420% M a g i c k D e s k e w I m a g e %
2421% %
2422% %
2423% %
2424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2425%
2426% MagickDeskewImage() removes skew from the image. Skew is an artifact that
2427% occurs in scanned images because of the camera being misaligned,
2428% imperfections in the scanning or surface, or simply because the paper was
2429% not placed completely flat when scanned.
2430%
2431% The format of the MagickDeskewImage method is:
2432%
2433% MagickBooleanType MagickDeskewImage(MagickWand *wand,
2434% const double threshold)
2435%
2436% A description of each parameter follows:
2437%
2438% o wand: the magick wand.
2439%
2440% o threshold: separate background from foreground.
2441%
2442*/
2443WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2444 const double threshold)
2445{
2446 Image
2447 *sepia_image;
2448
2449 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002450 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002451 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002452 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2453 if (wand->images == (Image *) NULL)
2454 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2455 sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2456 if (sepia_image == (Image *) NULL)
2457 return(MagickFalse);
2458 ReplaceImageInList(&wand->images,sepia_image);
2459 return(MagickTrue);
2460}
2461
2462/*
2463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2464% %
2465% %
2466% %
2467% M a g i c k D e s p e c k l e I m a g e %
2468% %
2469% %
2470% %
2471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472%
2473% MagickDespeckleImage() reduces the speckle noise in an image while
2474% perserving the edges of the original image.
2475%
2476% The format of the MagickDespeckleImage method is:
2477%
2478% MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2479%
2480% A description of each parameter follows:
2481%
2482% o wand: the magick wand.
2483%
2484*/
2485WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2486{
2487 Image
2488 *despeckle_image;
2489
2490 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002491 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002492 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002493 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2494 if (wand->images == (Image *) NULL)
2495 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2496 despeckle_image=DespeckleImage(wand->images,wand->exception);
2497 if (despeckle_image == (Image *) NULL)
2498 return(MagickFalse);
2499 ReplaceImageInList(&wand->images,despeckle_image);
2500 return(MagickTrue);
2501}
2502
2503/*
2504%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2505% %
2506% %
2507% %
2508% M a g i c k D e s t r o y I m a g e %
2509% %
2510% %
2511% %
2512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2513%
2514% MagickDestroyImage() dereferences an image, deallocating memory associated
2515% with the image if the reference count becomes zero.
2516%
2517% The format of the MagickDestroyImage method is:
2518%
2519% Image *MagickDestroyImage(Image *image)
2520%
2521% A description of each parameter follows:
2522%
2523% o image: the image.
2524%
2525*/
2526WandExport Image *MagickDestroyImage(Image *image)
2527{
2528 return(DestroyImage(image));
2529}
2530
2531/*
2532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2533% %
2534% %
2535% %
2536% M a g i c k D i s p l a y I m a g e %
2537% %
2538% %
2539% %
2540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2541%
2542% MagickDisplayImage() displays an image.
2543%
2544% The format of the MagickDisplayImage method is:
2545%
2546% MagickBooleanType MagickDisplayImage(MagickWand *wand,
2547% const char *server_name)
2548%
2549% A description of each parameter follows:
2550%
2551% o wand: the magick wand.
2552%
2553% o server_name: the X server name.
2554%
2555*/
2556WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2557 const char *server_name)
2558{
2559 Image
2560 *image;
2561
2562 MagickBooleanType
2563 status;
2564
2565 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002566 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002567 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002568 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2569 if (wand->images == (Image *) NULL)
2570 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2571 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2572 if (image == (Image *) NULL)
2573 return(MagickFalse);
2574 (void) CloneString(&wand->image_info->server_name,server_name);
cristy5f49bdb2011-10-16 14:28:56 +00002575 status=DisplayImages(wand->image_info,image,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002576 image=DestroyImage(image);
cristy220c4d52013-11-27 19:31:32 +00002577 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002578}
2579
2580/*
2581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2582% %
2583% %
2584% %
2585% M a g i c k D i s p l a y I m a g e s %
2586% %
2587% %
2588% %
2589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2590%
2591% MagickDisplayImages() displays an image or image sequence.
2592%
2593% The format of the MagickDisplayImages method is:
2594%
2595% MagickBooleanType MagickDisplayImages(MagickWand *wand,
2596% const char *server_name)
2597%
2598% A description of each parameter follows:
2599%
2600% o wand: the magick wand.
2601%
2602% o server_name: the X server name.
2603%
2604*/
2605WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2606 const char *server_name)
2607{
2608 MagickBooleanType
2609 status;
2610
2611 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002612 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002613 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002614 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2615 (void) CloneString(&wand->image_info->server_name,server_name);
cristy5f49bdb2011-10-16 14:28:56 +00002616 status=DisplayImages(wand->image_info,wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00002617 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002618}
2619
2620/*
2621%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2622% %
2623% %
2624% %
2625% M a g i c k D i s t o r t I m a g e %
2626% %
2627% %
2628% %
2629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2630%
2631% MagickDistortImage() distorts an image using various distortion methods, by
2632% mapping color lookups of the source image to a new destination image
2633% usally of the same size as the source image, unless 'bestfit' is set to
2634% true.
2635%
2636% If 'bestfit' is enabled, and distortion allows it, the destination image is
2637% adjusted to ensure the whole source 'image' will just fit within the final
2638% destination image, which will be sized and offset accordingly. Also in
2639% many cases the virtual offset of the source image will be taken into
2640% account in the mapping.
2641%
2642% The format of the MagickDistortImage method is:
2643%
2644% MagickBooleanType MagickDistortImage(MagickWand *wand,
dirk827944d2016-02-01 22:34:39 +01002645% const DistortMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002646% const double *arguments,const MagickBooleanType bestfit)
2647%
2648% A description of each parameter follows:
2649%
2650% o image: the image to be distorted.
2651%
2652% o method: the method of image distortion.
2653%
2654% ArcDistortion always ignores the source image offset, and always
2655% 'bestfit' the destination image with the top left corner offset
2656% relative to the polar mapping center.
2657%
2658% Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2659% style of image distortion.
2660%
2661% Affine, Perspective, and Bilinear, do least squares fitting of the
2662% distortion when more than the minimum number of control point pairs
2663% are provided.
2664%
2665% Perspective, and Bilinear, falls back to a Affine distortion when less
2666% that 4 control point pairs are provided. While Affine distortions let
2667% you use any number of control point pairs, that is Zero pairs is a
2668% no-Op (viewport only) distrotion, one pair is a translation and two
2669% pairs of control points do a scale-rotate-translate, without any
2670% shearing.
2671%
2672% o number_arguments: the number of arguments given for this distortion
2673% method.
2674%
2675% o arguments: the arguments for this distortion method.
2676%
2677% o bestfit: Attempt to resize destination to fit distorted source.
2678%
2679*/
2680WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
dirk827944d2016-02-01 22:34:39 +01002681 const DistortMethod method,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00002682 const double *arguments,const MagickBooleanType bestfit)
2683{
2684 Image
2685 *distort_image;
2686
2687 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002688 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002689 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002690 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2691 if (wand->images == (Image *) NULL)
2692 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2693 distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2694 bestfit,wand->exception);
2695 if (distort_image == (Image *) NULL)
2696 return(MagickFalse);
2697 ReplaceImageInList(&wand->images,distort_image);
2698 return(MagickTrue);
2699}
2700
2701/*
2702%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2703% %
2704% %
2705% %
2706% M a g i c k D r a w I m a g e %
2707% %
2708% %
2709% %
2710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2711%
2712% MagickDrawImage() renders the drawing wand on the current image.
2713%
2714% The format of the MagickDrawImage method is:
2715%
2716% MagickBooleanType MagickDrawImage(MagickWand *wand,
2717% const DrawingWand *drawing_wand)
2718%
2719% A description of each parameter follows:
2720%
2721% o wand: the magick wand.
2722%
2723% o drawing_wand: the draw wand.
2724%
2725*/
2726WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2727 const DrawingWand *drawing_wand)
2728{
2729 char
2730 *primitive;
2731
2732 DrawInfo
2733 *draw_info;
2734
2735 MagickBooleanType
2736 status;
2737
2738 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002739 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002740 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002741 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2742 if (wand->images == (Image *) NULL)
2743 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2744 draw_info=PeekDrawingWand(drawing_wand);
2745 if ((draw_info == (DrawInfo *) NULL) ||
2746 (draw_info->primitive == (char *) NULL))
2747 return(MagickFalse);
2748 primitive=AcquireString(draw_info->primitive);
2749 draw_info=DestroyDrawInfo(draw_info);
2750 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2751 draw_info->primitive=primitive;
cristy018f07f2011-09-04 21:15:19 +00002752 status=DrawImage(wand->images,draw_info,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002753 draw_info=DestroyDrawInfo(draw_info);
cristy220c4d52013-11-27 19:31:32 +00002754 return(status);
cristy3ed852e2009-09-05 21:47:34 +00002755}
2756
2757/*
2758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2759% %
2760% %
2761% %
2762% M a g i c k E d g e I m a g e %
2763% %
2764% %
2765% %
2766%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2767%
2768% MagickEdgeImage() enhance edges within the image with a convolution filter
2769% of the given radius. Use a radius of 0 and Edge() selects a suitable
2770% radius for you.
2771%
2772% The format of the MagickEdgeImage method is:
2773%
cristy9dc4c512013-03-24 01:38:00 +00002774% MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
cristy3ed852e2009-09-05 21:47:34 +00002775%
2776% A description of each parameter follows:
2777%
2778% o wand: the magick wand.
2779%
2780% o radius: the radius of the pixel neighborhood.
2781%
2782*/
2783WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
cristy9dc4c512013-03-24 01:38:00 +00002784 const double radius)
cristy3ed852e2009-09-05 21:47:34 +00002785{
2786 Image
2787 *edge_image;
2788
2789 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002790 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002791 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002792 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2793 if (wand->images == (Image *) NULL)
2794 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy9dc4c512013-03-24 01:38:00 +00002795 edge_image=EdgeImage(wand->images,radius,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00002796 if (edge_image == (Image *) NULL)
2797 return(MagickFalse);
2798 ReplaceImageInList(&wand->images,edge_image);
2799 return(MagickTrue);
2800}
2801
2802/*
2803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2804% %
2805% %
2806% %
2807% M a g i c k E m b o s s I m a g e %
2808% %
2809% %
2810% %
2811%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2812%
2813% MagickEmbossImage() returns a grayscale image with a three-dimensional
2814% effect. We convolve the image with a Gaussian operator of the given radius
2815% and standard deviation (sigma). For reasonable results, radius should be
2816% larger than sigma. Use a radius of 0 and Emboss() selects a suitable
2817% radius for you.
2818%
2819% The format of the MagickEmbossImage method is:
2820%
2821% MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2822% const double sigma)
2823%
2824% A description of each parameter follows:
2825%
2826% o wand: the magick wand.
2827%
2828% o radius: the radius of the Gaussian, in pixels, not counting the center
2829% pixel.
2830%
2831% o sigma: the standard deviation of the Gaussian, in pixels.
2832%
2833*/
2834WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2835 const double radius,const double sigma)
2836{
2837 Image
2838 *emboss_image;
2839
2840 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002841 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002842 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002843 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2844 if (wand->images == (Image *) NULL)
2845 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2846 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2847 if (emboss_image == (Image *) NULL)
2848 return(MagickFalse);
2849 ReplaceImageInList(&wand->images,emboss_image);
2850 return(MagickTrue);
2851}
2852
2853/*
2854%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2855% %
2856% %
2857% %
2858% M a g i c k E n c i p h e r I m a g e %
2859% %
2860% %
2861% %
2862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2863%
2864% MagickEncipherImage() converts plaint pixels to cipher pixels.
2865%
2866% The format of the MagickEncipherImage method is:
2867%
2868% MagickBooleanType MagickEncipherImage(MagickWand *wand,
2869% const char *passphrase)
2870%
2871% A description of each parameter follows:
2872%
2873% o wand: the magick wand.
2874%
2875% o passphrase: the passphrase.
2876%
2877*/
2878WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2879 const char *passphrase)
2880{
2881 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002882 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002883 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002884 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2885 if (wand->images == (Image *) NULL)
2886 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00002887 return(EncipherImage(wand->images,passphrase,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00002888}
2889
2890/*
2891%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2892% %
2893% %
2894% %
2895% M a g i c k E n h a n c e I m a g e %
2896% %
2897% %
2898% %
2899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2900%
2901% MagickEnhanceImage() applies a digital filter that improves the quality of a
2902% noisy image.
2903%
2904% The format of the MagickEnhanceImage method is:
2905%
2906% MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2907%
2908% A description of each parameter follows:
2909%
2910% o wand: the magick wand.
2911%
2912*/
2913WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2914{
2915 Image
2916 *enhance_image;
2917
2918 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002919 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002920 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00002921 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2922 if (wand->images == (Image *) NULL)
2923 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2924 enhance_image=EnhanceImage(wand->images,wand->exception);
2925 if (enhance_image == (Image *) NULL)
2926 return(MagickFalse);
2927 ReplaceImageInList(&wand->images,enhance_image);
2928 return(MagickTrue);
2929}
2930
2931/*
2932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2933% %
2934% %
2935% %
2936% M a g i c k E q u a l i z e I m a g e %
2937% %
2938% %
2939% %
2940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2941%
2942% MagickEqualizeImage() equalizes the image histogram.
2943%
2944% The format of the MagickEqualizeImage method is:
2945%
2946% MagickBooleanType MagickEqualizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00002947%
2948% A description of each parameter follows:
2949%
2950% o wand: the magick wand.
2951%
2952% o channel: the image channel(s).
2953%
2954*/
cristy3ed852e2009-09-05 21:47:34 +00002955WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2956{
2957 MagickBooleanType
2958 status;
2959
cristy3ed852e2009-09-05 21:47:34 +00002960 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00002961 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01002962 if (wand->debug != MagickFalse)
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=EqualizeImage(wand->images,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 v a l u a t e I m a g e %
2976% %
2977% %
2978% %
2979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2980%
2981% MagickEvaluateImage() applys an arithmetic, relational, or logical
2982% expression to an image. Use these operators to lighten or darken an image,
2983% to increase or decrease contrast in an image, or to produce the "negative"
2984% of an image.
2985%
2986% The format of the MagickEvaluateImage method is:
2987%
2988% MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2989% const MagickEvaluateOperator operator,const double value)
cristyd18ae7c2010-03-07 17:39:52 +00002990% MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2991% const MagickEvaluateOperator operator)
cristy3ed852e2009-09-05 21:47:34 +00002992%
2993% A description of each parameter follows:
2994%
2995% o wand: the magick wand.
2996%
cristy3ed852e2009-09-05 21:47:34 +00002997% o op: A channel operator.
2998%
2999% o value: A value value.
3000%
3001*/
3002
cristyd18ae7c2010-03-07 17:39:52 +00003003WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3004 const MagickEvaluateOperator op)
3005{
3006 Image
3007 *evaluate_image;
3008
3009 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003010 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003011 if (wand->debug != MagickFalse)
cristyd18ae7c2010-03-07 17:39:52 +00003012 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3013 if (wand->images == (Image *) NULL)
3014 return((MagickWand *) NULL);
3015 evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3016 if (evaluate_image == (Image *) NULL)
3017 return((MagickWand *) NULL);
3018 return(CloneMagickWandFromImages(wand,evaluate_image));
3019}
3020
cristyd42d9952011-07-08 14:21:50 +00003021WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3022 const MagickEvaluateOperator op,const double value)
cristy3ed852e2009-09-05 21:47:34 +00003023{
3024 MagickBooleanType
3025 status;
3026
3027 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003028 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003029 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003030 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3031 if (wand->images == (Image *) NULL)
3032 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00003033 status=EvaluateImage(wand->images,op,value,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003034 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003035}
3036
3037/*
3038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3039% %
3040% %
3041% %
3042% M a g i c k E x p o r t I m a g e P i x e l s %
3043% %
3044% %
3045% %
3046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3047%
3048% MagickExportImagePixels() extracts pixel data from an image and returns it
3049% to you. The method returns MagickTrue on success otherwise MagickFalse if
3050% an error is encountered. The data is returned as char, short int, int,
cristybb503372010-05-27 20:51:26 +00003051% ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00003052%
3053% Suppose you want to extract the first scanline of a 640x480 image as
3054% character data in red-green-blue order:
3055%
3056% MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3057%
3058% The format of the MagickExportImagePixels method is:
3059%
3060% MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003061% const ssize_t x,const ssize_t y,const size_t columns,
3062% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00003063% void *pixels)
3064%
3065% A description of each parameter follows:
3066%
3067% o wand: the magick wand.
3068%
3069% o x, y, columns, rows: These values define the perimeter
3070% of a region of pixels you want to extract.
3071%
3072% o map: This string reflects the expected ordering of the pixel array.
3073% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00003074% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00003075% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3076% P = pad.
3077%
3078% o storage: Define the data type of the pixels. Float and double types are
3079% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
3080% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3081% LongPixel, QuantumPixel, or ShortPixel.
3082%
3083% o pixels: This array of values contain the pixel components as defined by
3084% map and type. You must preallocate this array where the expected
3085% length varies depending on the values of width, height, map, and type.
3086%
3087*/
3088WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003089 const ssize_t x,const ssize_t y,const size_t columns,
3090 const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00003091 void *pixels)
3092{
3093 MagickBooleanType
3094 status;
3095
3096 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003097 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003098 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003099 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3100 if (wand->images == (Image *) NULL)
3101 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3102 status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3103 storage,pixels,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003104 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003105}
3106
3107/*
3108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3109% %
3110% %
3111% %
3112% M a g i c k E x t e n t I m a g e %
3113% %
3114% %
3115% %
3116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3117%
3118% MagickExtentImage() extends the image as defined by the geometry, gravity,
3119% and wand background color. Set the (x,y) offset of the geometry to move
3120% the original wand relative to the extended wand.
3121%
3122% The format of the MagickExtentImage method is:
3123%
cristy01299f02012-01-12 01:11:04 +00003124% MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3125% const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00003126%
3127% A description of each parameter follows:
3128%
3129% o wand: the magick wand.
3130%
3131% o width: the region width.
3132%
3133% o height: the region height.
3134%
3135% o x: the region x offset.
3136%
3137% o y: the region y offset.
3138%
3139*/
3140WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
cristy27cb26f2012-01-12 01:09:25 +00003141 const size_t width,const size_t height,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00003142{
3143 Image
3144 *extent_image;
3145
3146 RectangleInfo
3147 extent;
3148
3149 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003150 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003151 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003152 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3153 if (wand->images == (Image *) NULL)
3154 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3155 extent.width=width;
3156 extent.height=height;
3157 extent.x=x;
3158 extent.y=y;
3159 extent_image=ExtentImage(wand->images,&extent,wand->exception);
3160 if (extent_image == (Image *) NULL)
3161 return(MagickFalse);
3162 ReplaceImageInList(&wand->images,extent_image);
3163 return(MagickTrue);
3164}
3165
3166/*
3167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3168% %
3169% %
3170% %
3171% M a g i c k F l i p I m a g e %
3172% %
3173% %
3174% %
3175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3176%
3177% MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3178% around the central x-axis.
3179%
3180% The format of the MagickFlipImage method is:
3181%
3182% MagickBooleanType MagickFlipImage(MagickWand *wand)
3183%
3184% A description of each parameter follows:
3185%
3186% o wand: the magick wand.
3187%
3188*/
3189WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3190{
3191 Image
3192 *flip_image;
3193
3194 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003195 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003196 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003197 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3198 if (wand->images == (Image *) NULL)
3199 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3200 flip_image=FlipImage(wand->images,wand->exception);
3201 if (flip_image == (Image *) NULL)
3202 return(MagickFalse);
3203 ReplaceImageInList(&wand->images,flip_image);
3204 return(MagickTrue);
3205}
3206
3207/*
3208%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3209% %
3210% %
3211% %
3212% 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 %
3213% %
3214% %
3215% %
3216%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3217%
3218% MagickFloodfillPaintImage() changes the color value of any pixel that matches
3219% target and is an immediate neighbor. If the method FillToBorderMethod is
3220% specified, the color value is changed for any neighbor pixel that does not
3221% match the bordercolor member of image.
3222%
3223% The format of the MagickFloodfillPaintImage method is:
3224%
3225% MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00003226% const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3227% const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00003228%
3229% A description of each parameter follows:
3230%
3231% o wand: the magick wand.
3232%
cristy3ed852e2009-09-05 21:47:34 +00003233% o fill: the floodfill color pixel wand.
3234%
3235% o fuzz: By default target must match a particular pixel color
3236% exactly. However, in many cases two colors may differ by a small amount.
3237% The fuzz member of image defines how much tolerance is acceptable to
3238% consider two colors as the same. For example, set fuzz to 10 and the
3239% color red at intensities of 100 and 102 respectively are now interpreted
3240% as the same color for the purposes of the floodfill.
3241%
3242% o bordercolor: the border color pixel wand.
3243%
3244% o x,y: the starting location of the operation.
3245%
3246% o invert: paint any pixel that does not match the target color.
3247%
3248*/
3249WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
cristyd42d9952011-07-08 14:21:50 +00003250 const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3251 const ssize_t x,const ssize_t y,const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00003252{
3253 DrawInfo
3254 *draw_info;
3255
3256 MagickBooleanType
3257 status;
3258
cristy4c08aed2011-07-01 19:47:50 +00003259 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00003260 target;
3261
3262 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003263 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003264 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003265 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3266 if (wand->images == (Image *) NULL)
3267 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3268 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
cristy4c08aed2011-07-01 19:47:50 +00003269 PixelGetQuantumPacket(fill,&draw_info->fill);
cristy3aa93752011-12-18 15:54:24 +00003270 (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
cristy52010022011-10-21 18:07:37 +00003271 wand->images->columns,y % wand->images->rows,&target,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003272 if (bordercolor != (PixelWand *) NULL)
3273 PixelGetMagickColor(bordercolor,&target);
3274 wand->images->fuzz=fuzz;
cristy189e84c2011-08-27 18:08:53 +00003275 status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
cristy5f49bdb2011-10-16 14:28:56 +00003276 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003277 draw_info=DestroyDrawInfo(draw_info);
cristy220c4d52013-11-27 19:31:32 +00003278 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003279}
3280
3281/*
3282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3283% %
3284% %
3285% %
3286% M a g i c k F l o p I m a g e %
3287% %
3288% %
3289% %
3290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3291%
3292% MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3293% around the central y-axis.
3294%
3295% The format of the MagickFlopImage method is:
3296%
3297% MagickBooleanType MagickFlopImage(MagickWand *wand)
3298%
3299% A description of each parameter follows:
3300%
3301% o wand: the magick wand.
3302%
3303*/
3304WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3305{
3306 Image
3307 *flop_image;
3308
3309 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003310 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003311 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003312 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3313 if (wand->images == (Image *) NULL)
3314 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3315 flop_image=FlopImage(wand->images,wand->exception);
3316 if (flop_image == (Image *) NULL)
3317 return(MagickFalse);
3318 ReplaceImageInList(&wand->images,flop_image);
3319 return(MagickTrue);
3320}
3321
3322/*
3323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3324% %
3325% %
3326% %
3327% 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 %
3328% %
3329% %
3330% %
3331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3332%
3333% MagickForwardFourierTransformImage() implements the discrete Fourier
3334% transform (DFT) of the image either as a magnitude / phase or real /
3335% imaginary image pair.
3336%
3337% The format of the MagickForwardFourierTransformImage method is:
3338%
3339% MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3340% const MagickBooleanType magnitude)
3341%
3342% A description of each parameter follows:
3343%
3344% o wand: the magick wand.
3345%
3346% o magnitude: if true, return as magnitude / phase pair otherwise a real /
3347% imaginary image pair.
3348%
3349*/
3350WandExport MagickBooleanType MagickForwardFourierTransformImage(
3351 MagickWand *wand,const MagickBooleanType magnitude)
3352{
3353 Image
3354 *forward_image;
3355
3356 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003357 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003358 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003359 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3360 if (wand->images == (Image *) NULL)
3361 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3362 forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3363 wand->exception);
3364 if (forward_image == (Image *) NULL)
3365 return(MagickFalse);
3366 ReplaceImageInList(&wand->images,forward_image);
3367 return(MagickTrue);
3368}
3369
3370/*
3371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3372% %
3373% %
3374% %
3375% M a g i c k F r a m e I m a g e %
3376% %
3377% %
3378% %
3379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3380%
3381% MagickFrameImage() adds a simulated three-dimensional border around the
3382% image. The width and height specify the border width of the vertical and
3383% horizontal sides of the frame. The inner and outer bevels indicate the
3384% width of the inner and outer shadows of the frame.
3385%
3386% The format of the MagickFrameImage method is:
3387%
3388% MagickBooleanType MagickFrameImage(MagickWand *wand,
dirkb797b2c2016-02-01 22:20:32 +01003389% const PixelWand *alpha_color,const size_t width,
cristybb503372010-05-27 20:51:26 +00003390% const size_t height,const ssize_t inner_bevel,
cristy633f0c62011-09-15 13:27:36 +00003391% const ssize_t outer_bevel,const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00003392%
3393% A description of each parameter follows:
3394%
3395% o wand: the magick wand.
3396%
dirkb797b2c2016-02-01 22:20:32 +01003397% o alpha_color: the frame color pixel wand.
cristy3ed852e2009-09-05 21:47:34 +00003398%
3399% o width: the border width.
3400%
3401% o height: the border height.
3402%
3403% o inner_bevel: the inner bevel width.
3404%
3405% o outer_bevel: the outer bevel width.
3406%
cristy633f0c62011-09-15 13:27:36 +00003407% o compose: the composite operator.
3408%
cristy3ed852e2009-09-05 21:47:34 +00003409*/
3410WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
dirkb797b2c2016-02-01 22:20:32 +01003411 const PixelWand *alpha_color,const size_t width,const size_t height,
cristy633f0c62011-09-15 13:27:36 +00003412 const ssize_t inner_bevel,const ssize_t outer_bevel,
3413 const CompositeOperator compose)
cristy3ed852e2009-09-05 21:47:34 +00003414{
3415 Image
3416 *frame_image;
3417
3418 FrameInfo
3419 frame_info;
3420
3421 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003422 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003423 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003424 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3425 if (wand->images == (Image *) NULL)
3426 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3427 (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3428 frame_info.width=wand->images->columns+2*width;
3429 frame_info.height=wand->images->rows+2*height;
cristybb503372010-05-27 20:51:26 +00003430 frame_info.x=(ssize_t) width;
3431 frame_info.y=(ssize_t) height;
cristy3ed852e2009-09-05 21:47:34 +00003432 frame_info.inner_bevel=inner_bevel;
3433 frame_info.outer_bevel=outer_bevel;
dirkb797b2c2016-02-01 22:20:32 +01003434 PixelGetQuantumPacket(alpha_color,&wand->images->alpha_color);
cristy633f0c62011-09-15 13:27:36 +00003435 frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003436 if (frame_image == (Image *) NULL)
3437 return(MagickFalse);
3438 ReplaceImageInList(&wand->images,frame_image);
3439 return(MagickTrue);
3440}
3441
3442/*
3443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3444% %
3445% %
3446% %
3447% M a g i c k F u n c t i o n I m a g e %
3448% %
3449% %
3450% %
3451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3452%
3453% MagickFunctionImage() applys an arithmetic, relational, or logical
3454% expression to an image. Use these operators to lighten or darken an image,
3455% to increase or decrease contrast in an image, or to produce the "negative"
3456% of an image.
3457%
3458% The format of the MagickFunctionImage method is:
3459%
3460% MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003461% const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003462% const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +00003463%
3464% A description of each parameter follows:
3465%
3466% o wand: the magick wand.
3467%
cristy3ed852e2009-09-05 21:47:34 +00003468% o function: the image function.
3469%
3470% o number_arguments: the number of function arguments.
3471%
3472% o arguments: the function arguments.
3473%
3474*/
cristy3ed852e2009-09-05 21:47:34 +00003475WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00003476 const MagickFunction function,const size_t number_arguments,
cristy3ed852e2009-09-05 21:47:34 +00003477 const double *arguments)
3478{
3479 MagickBooleanType
3480 status;
3481
3482 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003483 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003484 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003485 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3486 if (wand->images == (Image *) NULL)
3487 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3488 status=FunctionImage(wand->images,function,number_arguments,arguments,
cristy5f49bdb2011-10-16 14:28:56 +00003489 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003490 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003491}
3492
3493/*
3494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3495% %
3496% %
3497% %
3498% M a g i c k F x I m a g e %
3499% %
3500% %
3501% %
3502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3503%
3504% MagickFxImage() evaluate expression for each pixel in the image.
3505%
3506% The format of the MagickFxImage method is:
3507%
3508% MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
cristy3ed852e2009-09-05 21:47:34 +00003509%
3510% A description of each parameter follows:
3511%
3512% o wand: the magick wand.
3513%
cristy3ed852e2009-09-05 21:47:34 +00003514% o expression: the expression.
3515%
3516*/
cristy3ed852e2009-09-05 21:47:34 +00003517WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3518{
cristy3ed852e2009-09-05 21:47:34 +00003519 Image
3520 *fx_image;
3521
3522 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003523 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003524 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003525 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3526 if (wand->images == (Image *) NULL)
3527 return((MagickWand *) NULL);
cristy490408a2011-07-07 14:42:05 +00003528 fx_image=FxImage(wand->images,expression,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003529 if (fx_image == (Image *) NULL)
3530 return((MagickWand *) NULL);
3531 return(CloneMagickWandFromImages(wand,fx_image));
3532}
3533
3534/*
3535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3536% %
3537% %
3538% %
3539% M a g i c k G a m m a I m a g e %
3540% %
3541% %
3542% %
3543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3544%
3545% MagickGammaImage() gamma-corrects an image. The same image viewed on
3546% different devices will have perceptual differences in the way the image's
3547% intensities are represented on the screen. Specify individual gamma levels
3548% for the red, green, and blue channels, or adjust all three with the gamma
3549% parameter. Values typically range from 0.8 to 2.3.
3550%
3551% You can also reduce the influence of a particular channel with a gamma
3552% value of 0.
3553%
3554% The format of the MagickGammaImage method is:
3555%
3556% MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
cristy3ed852e2009-09-05 21:47:34 +00003557%
3558% A description of each parameter follows:
3559%
3560% o wand: the magick wand.
3561%
cristy3ed852e2009-09-05 21:47:34 +00003562% o level: Define the level of gamma correction.
3563%
3564*/
cristy3ed852e2009-09-05 21:47:34 +00003565WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3566 const double gamma)
3567{
3568 MagickBooleanType
3569 status;
3570
cristy3ed852e2009-09-05 21:47:34 +00003571 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003572 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003573 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003574 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3575 if (wand->images == (Image *) NULL)
3576 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00003577 status=GammaImage(wand->images,gamma,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00003578 return(status);
cristy3ed852e2009-09-05 21:47:34 +00003579}
3580
3581/*
3582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3583% %
3584% %
3585% %
3586% M a g i c k G a u s s i a n B l u r I m a g e %
3587% %
3588% %
3589% %
3590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3591%
3592% MagickGaussianBlurImage() blurs an image. We convolve the image with a
3593% Gaussian operator of the given radius and standard deviation (sigma).
3594% For reasonable results, the radius should be larger than sigma. Use a
3595% radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3596%
3597% The format of the MagickGaussianBlurImage method is:
3598%
3599% MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
cristyd89705a2012-01-20 02:52:24 +00003600% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00003601%
3602% A description of each parameter follows:
3603%
3604% o wand: the magick wand.
3605%
cristy3ed852e2009-09-05 21:47:34 +00003606% o radius: the radius of the Gaussian, in pixels, not counting the center
3607% pixel.
3608%
3609% o sigma: the standard deviation of the Gaussian, in pixels.
3610%
3611*/
cristy3ed852e2009-09-05 21:47:34 +00003612WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
cristyd89705a2012-01-20 02:52:24 +00003613 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00003614{
cristy3ed852e2009-09-05 21:47:34 +00003615 Image
3616 *blur_image;
3617
3618 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003619 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003620 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003621 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3622 if (wand->images == (Image *) NULL)
3623 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd89705a2012-01-20 02:52:24 +00003624 blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003625 if (blur_image == (Image *) NULL)
3626 return(MagickFalse);
3627 ReplaceImageInList(&wand->images,blur_image);
3628 return(MagickTrue);
3629}
3630
3631/*
3632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633% %
3634% %
3635% %
3636% M a g i c k G e t I m a g e %
3637% %
3638% %
3639% %
3640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641%
3642% MagickGetImage() gets the image at the current image index.
3643%
3644% The format of the MagickGetImage method is:
3645%
3646% MagickWand *MagickGetImage(MagickWand *wand)
3647%
3648% A description of each parameter follows:
3649%
3650% o wand: the magick wand.
3651%
3652*/
3653WandExport MagickWand *MagickGetImage(MagickWand *wand)
3654{
3655 Image
3656 *image;
3657
3658 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003659 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003660 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003661 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3662 if (wand->images == (Image *) NULL)
3663 {
3664 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003665 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003666 return((MagickWand *) NULL);
3667 }
3668 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3669 if (image == (Image *) NULL)
3670 return((MagickWand *) NULL);
3671 return(CloneMagickWandFromImages(wand,image));
3672}
3673
3674/*
3675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3676% %
3677% %
3678% %
3679% 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 %
3680% %
3681% %
3682% %
3683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3684%
3685% MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3686% is not activated. That is, the image is RGB rather than RGBA or CMYK rather
3687% than CMYKA.
3688%
3689% The format of the MagickGetImageAlphaChannel method is:
3690%
cristye9b51cf2015-04-10 01:54:22 +00003691% MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003692%
3693% A description of each parameter follows:
3694%
3695% o wand: the magick wand.
3696%
3697*/
3698WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3699{
3700 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003701 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003702 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003703 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3704 if (wand->images == (Image *) NULL)
3705 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3706 return(GetImageAlphaChannel(wand->images));
3707}
dirkb797b2c2016-02-01 22:20:32 +01003708
3709/*
3710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3711% %
3712% %
3713% %
3714% M a g i c k G e t I m a g e A l p h a C o l o r %
3715% %
3716% %
3717% %
3718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3719%
3720% MagickGetImageAlhpaColor() returns the image alpha color.
3721%
3722% The format of the MagickGetImageAlhpaColor method is:
3723%
3724% MagickBooleanType MagickGetImageAlhpaColor(MagickWand *wand,
3725% PixelWand *alpha_color)
3726%
3727% A description of each parameter follows:
3728%
3729% o wand: the magick wand.
3730%
3731% o alpha_color: return the alpha color.
3732%
3733*/
3734WandExport MagickBooleanType MagickGetImageAlhpaColor(MagickWand *wand,
3735 PixelWand *alpha_color)
3736{
3737 assert(wand != (MagickWand *)NULL);
3738 assert(wand->signature == MagickWandSignature);
3739 if (wand->debug != MagickFalse)
3740 (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
3741 if (wand->images == (Image *)NULL)
3742 ThrowWandException(WandError, "ContainsNoImages", wand->name);
3743 PixelSetPixelColor(alpha_color, &wand->images->alpha_color);
3744 return(MagickTrue);
3745}
cristy3ed852e2009-09-05 21:47:34 +00003746
3747/*
3748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3749% %
3750% %
3751% %
3752% M a g i c k G e t I m a g e C l i p M a s k %
3753% %
3754% %
3755% %
3756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3757%
cristy10a6c612012-01-29 21:41:05 +00003758% MagickGetImageMask() gets the image clip mask at the current image index.
cristy3ed852e2009-09-05 21:47:34 +00003759%
cristy10a6c612012-01-29 21:41:05 +00003760% The format of the MagickGetImageMask method is:
cristy3ed852e2009-09-05 21:47:34 +00003761%
cristy10a6c612012-01-29 21:41:05 +00003762% MagickWand *MagickGetImageMask(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00003763%
3764% A description of each parameter follows:
3765%
3766% o wand: the magick wand.
3767%
dirkaf131f12016-01-10 01:29:22 +01003768% o type: type of mask, ReadPixelMask or WritePixelMask.
3769%
cristy3ed852e2009-09-05 21:47:34 +00003770*/
dirkaf131f12016-01-10 01:29:22 +01003771WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
3772 const PixelMask type)
cristy3ed852e2009-09-05 21:47:34 +00003773{
3774 Image
3775 *image;
3776
3777 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003778 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003779 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003780 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3781 if (wand->images == (Image *) NULL)
3782 {
3783 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003784 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003785 return((MagickWand *) NULL);
3786 }
dirkaf131f12016-01-10 01:29:22 +01003787 image=GetImageMask(wand->images,type,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003788 if (image == (Image *) NULL)
3789 return((MagickWand *) NULL);
3790 return(CloneMagickWandFromImages(wand,image));
3791}
3792
3793/*
3794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3795% %
3796% %
3797% %
3798% 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 %
3799% %
3800% %
3801% %
3802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3803%
3804% MagickGetImageBackgroundColor() returns the image background color.
3805%
3806% The format of the MagickGetImageBackgroundColor method is:
3807%
3808% MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3809% PixelWand *background_color)
3810%
3811% A description of each parameter follows:
3812%
3813% o wand: the magick wand.
3814%
3815% o background_color: Return the background color.
3816%
3817*/
3818WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3819 PixelWand *background_color)
3820{
3821 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003822 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003823 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003824 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3825 if (wand->images == (Image *) NULL)
3826 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf82c4a02011-12-15 02:43:44 +00003827 PixelSetPixelColor(background_color,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00003828 return(MagickTrue);
3829}
3830
3831/*
3832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3833% %
3834% %
3835% %
3836% M a g i c k G e t I m a g e B l o b %
3837% %
3838% %
3839% %
3840%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3841%
cristy1a1b5622011-02-15 02:40:42 +00003842% MagickGetImageBlob() implements direct to memory image formats. It returns
3843% the image as a blob (a formatted "file" in memory) and its length, starting
anthonya89dd172011-10-04 13:29:35 +00003844% from the current position in the image sequence. Use MagickSetImageFormat()
cristy1a1b5622011-02-15 02:40:42 +00003845% to set the format to write to the blob (GIF, JPEG, PNG, etc.).
3846%
3847% Utilize MagickResetIterator() to ensure the write is from the beginning of
3848% the image sequence.
cristy3ed852e2009-09-05 21:47:34 +00003849%
3850% Use MagickRelinquishMemory() to free the blob when you are done with it.
3851%
3852% The format of the MagickGetImageBlob method is:
3853%
3854% unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3855%
3856% A description of each parameter follows:
3857%
3858% o wand: the magick wand.
3859%
3860% o length: the length of the blob.
3861%
3862*/
3863WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3864{
cristyb3f97ae2015-05-18 12:29:32 +00003865 unsigned char
3866 *blob;
3867
cristy3ed852e2009-09-05 21:47:34 +00003868 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003869 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003870 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003871 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3872 if (wand->images == (Image *) NULL)
3873 {
3874 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003875 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003876 return((unsigned char *) NULL);
3877 }
cristyb3f97ae2015-05-18 12:29:32 +00003878 blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
3879 wand->exception);
3880 return(blob);
cristy3ed852e2009-09-05 21:47:34 +00003881}
3882
3883/*
3884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3885% %
3886% %
3887% %
3888% M a g i c k G e t I m a g e s B l o b %
3889% %
3890% %
3891% %
3892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3893%
3894% MagickGetImageBlob() implements direct to memory image formats. It
3895% returns the image sequence as a blob and its length. The format of the image
3896% determines the format of the returned blob (GIF, JPEG, PNG, etc.). To
3897% return a different image format, use MagickSetImageFormat().
3898%
3899% Note, some image formats do not permit multiple images to the same image
3900% stream (e.g. JPEG). in this instance, just the first image of the
3901% sequence is returned as a blob.
3902%
3903% The format of the MagickGetImagesBlob method is:
3904%
3905% unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3906%
3907% A description of each parameter follows:
3908%
3909% o wand: the magick wand.
3910%
3911% o length: the length of the blob.
3912%
3913*/
3914WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3915{
3916 unsigned char
3917 *blob;
3918
3919 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003920 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003921 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003922 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3923 if (wand->images == (Image *) NULL)
3924 {
3925 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00003926 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00003927 return((unsigned char *) NULL);
3928 }
cristyb3f97ae2015-05-18 12:29:32 +00003929 blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
3930 wand->images),length,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00003931 return(blob);
3932}
3933
3934/*
3935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3936% %
3937% %
3938% %
3939% 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 %
3940% %
3941% %
3942% %
3943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3944%
3945% MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3946% image.
3947%
3948% The format of the MagickGetImageBluePrimary method is:
3949%
3950% MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
dirk98e4a9a2016-01-15 11:49:10 +01003951% double *y,double *z)
cristy3ed852e2009-09-05 21:47:34 +00003952%
3953% A description of each parameter follows:
3954%
3955% o wand: the magick wand.
3956%
3957% o x: the chromaticity blue primary x-point.
3958%
3959% o y: the chromaticity blue primary y-point.
3960%
dirk98e4a9a2016-01-15 11:49:10 +01003961% o z: the chromaticity blue primary z-point.
3962%
cristy3ed852e2009-09-05 21:47:34 +00003963*/
3964WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01003965 double *x,double *y,double *z)
cristy3ed852e2009-09-05 21:47:34 +00003966{
3967 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00003968 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01003969 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00003970 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3971 if (wand->images == (Image *) NULL)
3972 ThrowWandException(WandError,"ContainsNoImages",wand->name);
3973 *x=wand->images->chromaticity.blue_primary.x;
3974 *y=wand->images->chromaticity.blue_primary.y;
dirk98e4a9a2016-01-15 11:49:10 +01003975 *z=wand->images->chromaticity.blue_primary.z;
cristy3ed852e2009-09-05 21:47:34 +00003976 return(MagickTrue);
3977}
3978
3979/*
3980%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3981% %
3982% %
3983% %
3984% 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 %
3985% %
3986% %
3987% %
3988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3989%
3990% MagickGetImageBorderColor() returns the image border color.
3991%
3992% The format of the MagickGetImageBorderColor method is:
3993%
3994% MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3995% PixelWand *border_color)
3996%
3997% A description of each parameter follows:
3998%
3999% o wand: the magick wand.
4000%
4001% o border_color: Return the border color.
4002%
4003*/
4004WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4005 PixelWand *border_color)
4006{
4007 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004008 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004009 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004010 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4011 if (wand->images == (Image *) NULL)
4012 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf82c4a02011-12-15 02:43:44 +00004013 PixelSetPixelColor(border_color,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00004014 return(MagickTrue);
4015}
4016
4017/*
4018%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4019% %
4020% %
4021% %
cristyd42d9952011-07-08 14:21:50 +00004022% 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 +00004023% %
4024% %
4025% %
4026%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4027%
cristy490408a2011-07-07 14:42:05 +00004028% MagickGetImageFeatures() returns features for each channel in the
cristy7396d882010-01-27 02:37:56 +00004029% image in each of four directions (horizontal, vertical, left and right
4030% diagonals) for the specified distance. The features include the angular
4031% second moment, contrast, correlation, sum of squares: variance, inverse
4032% difference moment, sum average, sum varience, sum entropy, entropy,
4033% difference variance, difference entropy, information measures of
4034% correlation 1, information measures of correlation 2, and maximum
4035% correlation coefficient. You can access the red channel contrast, for
4036% example, like this:
cristy3ed852e2009-09-05 21:47:34 +00004037%
cristy490408a2011-07-07 14:42:05 +00004038% channel_features=MagickGetImageFeatures(wand,1);
cristyd3090f92011-10-18 00:05:15 +00004039% contrast=channel_features[RedPixelChannel].contrast[0];
cristy3ed852e2009-09-05 21:47:34 +00004040%
cristy549a37e2010-01-26 15:24:15 +00004041% Use MagickRelinquishMemory() to free the statistics buffer.
4042%
cristy490408a2011-07-07 14:42:05 +00004043% The format of the MagickGetImageFeatures method is:
cristy549a37e2010-01-26 15:24:15 +00004044%
cristy490408a2011-07-07 14:42:05 +00004045% ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004046% const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00004047%
4048% A description of each parameter follows:
4049%
4050% o wand: the magick wand.
4051%
cristy549a37e2010-01-26 15:24:15 +00004052% o distance: the distance.
cristy3ed852e2009-09-05 21:47:34 +00004053%
4054*/
cristy490408a2011-07-07 14:42:05 +00004055WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004056 const size_t distance)
cristy3ed852e2009-09-05 21:47:34 +00004057{
cristy3ed852e2009-09-05 21:47:34 +00004058 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004059 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004060 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004061 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4062 if (wand->images == (Image *) NULL)
cristy549a37e2010-01-26 15:24:15 +00004063 {
4064 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004065 "ContainsNoImages","`%s'",wand->name);
cristy549a37e2010-01-26 15:24:15 +00004066 return((ChannelFeatures *) NULL);
4067 }
cristy490408a2011-07-07 14:42:05 +00004068 return(GetImageFeatures(wand->images,distance,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00004069}
4070
4071/*
4072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4073% %
4074% %
4075% %
cristyd42d9952011-07-08 14:21:50 +00004076% 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 +00004077% %
4078% %
4079% %
4080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081%
cristyd42d9952011-07-08 14:21:50 +00004082% MagickGetImageKurtosis() gets the kurtosis and skewness of one or
cristy3ed852e2009-09-05 21:47:34 +00004083% more image channels.
4084%
cristyd42d9952011-07-08 14:21:50 +00004085% The format of the MagickGetImageKurtosis method is:
cristy3ed852e2009-09-05 21:47:34 +00004086%
cristyd42d9952011-07-08 14:21:50 +00004087% MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4088% double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00004089%
4090% A description of each parameter follows:
4091%
4092% o wand: the magick wand.
4093%
cristy3ed852e2009-09-05 21:47:34 +00004094% o kurtosis: The kurtosis for the specified channel(s).
4095%
4096% o skewness: The skewness for the specified channel(s).
4097%
4098*/
cristyd42d9952011-07-08 14:21:50 +00004099WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4100 double *kurtosis,double *skewness)
cristy3ed852e2009-09-05 21:47:34 +00004101{
4102 MagickBooleanType
4103 status;
4104
4105 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004106 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004107 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004108 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4109 if (wand->images == (Image *) NULL)
4110 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00004111 status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00004112 return(status);
cristy3ed852e2009-09-05 21:47:34 +00004113}
cristy549a37e2010-01-26 15:24:15 +00004114
4115/*
4116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4117% %
4118% %
4119% %
cristyd42d9952011-07-08 14:21:50 +00004120% M a g i c k G e t I m a g e M e a n %
cristy549a37e2010-01-26 15:24:15 +00004121% %
4122% %
4123% %
4124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4125%
cristyd42d9952011-07-08 14:21:50 +00004126% MagickGetImageMean() gets the mean and standard deviation of one or more
4127% image channels.
cristy549a37e2010-01-26 15:24:15 +00004128%
cristyd42d9952011-07-08 14:21:50 +00004129% The format of the MagickGetImageMean method is:
cristy549a37e2010-01-26 15:24:15 +00004130%
cristyd42d9952011-07-08 14:21:50 +00004131% MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4132% double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00004133%
4134% A description of each parameter follows:
4135%
4136% o wand: the magick wand.
4137%
4138% o channel: the image channel(s).
4139%
4140% o mean: The mean pixel value for the specified channel(s).
4141%
4142% o standard_deviation: The standard deviation for the specified channel(s).
4143%
4144*/
cristyd42d9952011-07-08 14:21:50 +00004145WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4146 double *standard_deviation)
cristy549a37e2010-01-26 15:24:15 +00004147{
4148 MagickBooleanType
4149 status;
cristy3ed852e2009-09-05 21:47:34 +00004150
cristy549a37e2010-01-26 15:24:15 +00004151 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004152 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004153 if (wand->debug != MagickFalse)
cristy549a37e2010-01-26 15:24:15 +00004154 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4155 if (wand->images == (Image *) NULL)
4156 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00004157 status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00004158 return(status);
cristy549a37e2010-01-26 15:24:15 +00004159}
4160
cristy3ed852e2009-09-05 21:47:34 +00004161/*
4162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4163% %
4164% %
4165% %
cristyd42d9952011-07-08 14:21:50 +00004166% 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 +00004167% %
4168% %
4169% %
4170%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4171%
cristyd42d9952011-07-08 14:21:50 +00004172% MagickGetImageRange() gets the range for one or more image channels.
cristy3ed852e2009-09-05 21:47:34 +00004173%
cristyd42d9952011-07-08 14:21:50 +00004174% The format of the MagickGetImageRange method is:
cristy3ed852e2009-09-05 21:47:34 +00004175%
cristyd42d9952011-07-08 14:21:50 +00004176% MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4177% double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00004178%
4179% A description of each parameter follows:
4180%
4181% o wand: the magick wand.
4182%
cristy3ed852e2009-09-05 21:47:34 +00004183% o minima: The minimum pixel value for the specified channel(s).
4184%
4185% o maxima: The maximum pixel value for the specified channel(s).
4186%
4187*/
cristyd42d9952011-07-08 14:21:50 +00004188WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4189 double *minima,double *maxima)
cristy3ed852e2009-09-05 21:47:34 +00004190{
4191 MagickBooleanType
4192 status;
4193
4194 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004195 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004196 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004197 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4198 if (wand->images == (Image *) NULL)
4199 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd42d9952011-07-08 14:21:50 +00004200 status=GetImageRange(wand->images,minima,maxima,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00004201 return(status);
cristy3ed852e2009-09-05 21:47:34 +00004202}
4203
4204/*
4205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4206% %
4207% %
4208% %
cristyd42d9952011-07-08 14:21:50 +00004209% 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 +00004210% %
4211% %
4212% %
4213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4214%
cristyd42d9952011-07-08 14:21:50 +00004215% MagickGetImageStatistics() returns statistics for each channel in the
cristy3ed852e2009-09-05 21:47:34 +00004216% image. The statistics include the channel depth, its minima and
4217% maxima, the mean, the standard deviation, the kurtosis and the skewness.
4218% You can access the red channel mean, for example, like this:
4219%
cristyd42d9952011-07-08 14:21:50 +00004220% channel_statistics=MagickGetImageStatistics(wand);
cristyd3090f92011-10-18 00:05:15 +00004221% red_mean=channel_statistics[RedPixelChannel].mean;
cristy3ed852e2009-09-05 21:47:34 +00004222%
4223% Use MagickRelinquishMemory() to free the statistics buffer.
4224%
cristyd42d9952011-07-08 14:21:50 +00004225% The format of the MagickGetImageStatistics method is:
cristy3ed852e2009-09-05 21:47:34 +00004226%
cristyd42d9952011-07-08 14:21:50 +00004227% ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004228%
4229% A description of each parameter follows:
4230%
4231% o wand: the magick wand.
4232%
4233*/
cristyd42d9952011-07-08 14:21:50 +00004234WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004235{
4236 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004237 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004238 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004239 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4240 if (wand->images == (Image *) NULL)
4241 {
4242 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004243 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004244 return((ChannelStatistics *) NULL);
4245 }
cristyd42d9952011-07-08 14:21:50 +00004246 return(GetImageStatistics(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00004247}
4248
4249/*
4250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4251% %
4252% %
4253% %
4254% 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 %
4255% %
4256% %
4257% %
4258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4259%
4260% MagickGetImageColormapColor() returns the color of the specified colormap
4261% index.
4262%
4263% The format of the MagickGetImageColormapColor method is:
4264%
4265% MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004266% const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004267%
4268% A description of each parameter follows:
4269%
4270% o wand: the magick wand.
4271%
4272% o index: the offset into the image colormap.
4273%
4274% o color: Return the colormap color in this wand.
4275%
4276*/
4277WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00004278 const size_t index,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00004279{
4280 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004281 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004282 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004283 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4284 if (wand->images == (Image *) NULL)
4285 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy101ab702011-10-13 13:06:32 +00004286 if ((wand->images->colormap == (PixelInfo *) NULL) ||
cristy3ed852e2009-09-05 21:47:34 +00004287 (index >= wand->images->colors))
4288 {
4289 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004290 "InvalidColormapIndex","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004291 return(MagickFalse);
4292 }
cristyf82c4a02011-12-15 02:43:44 +00004293 PixelSetPixelColor(color,wand->images->colormap+index);
cristy3ed852e2009-09-05 21:47:34 +00004294 return(MagickTrue);
4295}
4296
4297/*
4298%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4299% %
4300% %
4301% %
4302% M a g i c k G e t I m a g e C o l o r s %
4303% %
4304% %
4305% %
4306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4307%
4308% MagickGetImageColors() gets the number of unique colors in the image.
4309%
4310% The format of the MagickGetImageColors method is:
4311%
cristybb503372010-05-27 20:51:26 +00004312% size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004313%
4314% A description of each parameter follows:
4315%
4316% o wand: the magick wand.
4317%
4318*/
cristybb503372010-05-27 20:51:26 +00004319WandExport size_t MagickGetImageColors(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004320{
4321 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004322 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004323 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004324 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4325 if (wand->images == (Image *) NULL)
4326 {
4327 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004328 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004329 return(0);
4330 }
4331 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4332}
4333
4334/*
4335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4336% %
4337% %
4338% %
4339% M a g i c k G e t I m a g e C o l o r s p a c e %
4340% %
4341% %
4342% %
4343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4344%
4345% MagickGetImageColorspace() gets the image colorspace.
4346%
4347% The format of the MagickGetImageColorspace method is:
4348%
4349% ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4350%
4351% A description of each parameter follows:
4352%
4353% o wand: the magick wand.
4354%
4355*/
4356WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4357{
4358 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004359 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004360 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004361 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4362 if (wand->images == (Image *) NULL)
4363 {
4364 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004365 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004366 return(UndefinedColorspace);
4367 }
4368 return(wand->images->colorspace);
4369}
4370
4371/*
4372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4373% %
4374% %
4375% %
4376% M a g i c k G e t I m a g e C o m p o s e %
4377% %
4378% %
4379% %
4380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4381%
4382% MagickGetImageCompose() returns the composite operator associated with the
4383% image.
4384%
4385% The format of the MagickGetImageCompose method is:
4386%
4387% CompositeOperator MagickGetImageCompose(MagickWand *wand)
4388%
4389% A description of each parameter follows:
4390%
4391% o wand: the magick wand.
4392%
4393*/
4394WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4395{
4396 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004397 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004398 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004399 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4400 if (wand->images == (Image *) NULL)
4401 {
4402 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004403 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004404 return(UndefinedCompositeOp);
4405 }
4406 return(wand->images->compose);
4407}
4408
4409/*
4410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4411% %
4412% %
4413% %
4414% 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 %
4415% %
4416% %
4417% %
4418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4419%
4420% MagickGetImageCompression() gets the image compression.
4421%
4422% The format of the MagickGetImageCompression method is:
4423%
4424% CompressionType MagickGetImageCompression(MagickWand *wand)
4425%
4426% A description of each parameter follows:
4427%
4428% o wand: the magick wand.
4429%
4430*/
4431WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4432{
4433 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004434 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004435 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004436 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4437 if (wand->images == (Image *) NULL)
4438 {
4439 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004440 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004441 return(UndefinedCompression);
4442 }
4443 return(wand->images->compression);
4444}
4445
4446/*
4447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4448% %
4449% %
4450% %
4451% 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 %
4452% %
4453% %
4454% %
4455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4456%
cristyaf5ee052012-04-25 16:45:39 +00004457% MagickGetImageCompressionQuality() gets the image compression quality.
cristy3ed852e2009-09-05 21:47:34 +00004458%
cristyaf5ee052012-04-25 16:45:39 +00004459% The format of the MagickGetImageCompressionQuality method is:
cristy3ed852e2009-09-05 21:47:34 +00004460%
cristyaf5ee052012-04-25 16:45:39 +00004461% size_t MagickGetImageCompressionQuality(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004462%
4463% A description of each parameter follows:
4464%
4465% o wand: the magick wand.
4466%
4467*/
cristybb503372010-05-27 20:51:26 +00004468WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004469{
4470 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004471 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004472 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004473 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4474 if (wand->images == (Image *) NULL)
4475 {
4476 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004477 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004478 return(0UL);
4479 }
4480 return(wand->images->quality);
4481}
4482
4483/*
4484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4485% %
4486% %
4487% %
4488% M a g i c k G e t I m a g e D e l a y %
4489% %
4490% %
4491% %
4492%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4493%
4494% MagickGetImageDelay() gets the image delay.
4495%
4496% The format of the MagickGetImageDelay method is:
4497%
cristybb503372010-05-27 20:51:26 +00004498% size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004499%
4500% A description of each parameter follows:
4501%
4502% o wand: the magick wand.
4503%
4504*/
cristybb503372010-05-27 20:51:26 +00004505WandExport size_t MagickGetImageDelay(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004506{
4507 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004508 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004509 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004510 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4511 if (wand->images == (Image *) NULL)
4512 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4513 return(wand->images->delay);
4514}
4515
4516/*
4517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4518% %
4519% %
4520% %
4521% M a g i c k G e t I m a g e D e p t h %
4522% %
4523% %
4524% %
4525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4526%
4527% MagickGetImageDepth() gets the image depth.
4528%
4529% The format of the MagickGetImageDepth method is:
4530%
cristybb503372010-05-27 20:51:26 +00004531% size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004532%
4533% A description of each parameter follows:
4534%
4535% o wand: the magick wand.
4536%
4537*/
cristybb503372010-05-27 20:51:26 +00004538WandExport size_t MagickGetImageDepth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004539{
4540 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004541 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004542 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004543 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4544 if (wand->images == (Image *) NULL)
4545 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy6970a7e2011-12-13 01:54:01 +00004546 return(wand->images->depth);
cristy3ed852e2009-09-05 21:47:34 +00004547}
4548
4549/*
4550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4551% %
4552% %
4553% %
cristy8a9106f2011-07-05 14:39:26 +00004554% M a g i c k G e t I m a g e D i s p o s e %
4555% %
4556% %
4557% %
4558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4559%
4560% MagickGetImageDispose() gets the image disposal method.
4561%
4562% The format of the MagickGetImageDispose method is:
4563%
4564% DisposeType MagickGetImageDispose(MagickWand *wand)
4565%
4566% A description of each parameter follows:
4567%
4568% o wand: the magick wand.
4569%
4570*/
4571WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4572{
4573 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004574 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004575 if (wand->debug != MagickFalse)
cristy8a9106f2011-07-05 14:39:26 +00004576 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4577 if (wand->images == (Image *) NULL)
4578 {
4579 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004580 "ContainsNoImages","`%s'",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004581 return(UndefinedDispose);
4582 }
4583 return((DisposeType) wand->images->dispose);
4584}
4585
4586/*
4587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4588% %
4589% %
4590% %
cristy3ed852e2009-09-05 21:47:34 +00004591% M a g i c k G e t I m a g e D i s t o r t i o n %
4592% %
4593% %
4594% %
4595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4596%
4597% MagickGetImageDistortion() compares an image to a reconstructed image and
4598% returns the specified distortion metric.
4599%
4600% The format of the MagickGetImageDistortion method is:
4601%
4602% MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4603% const MagickWand *reference,const MetricType metric,
4604% double *distortion)
4605%
4606% A description of each parameter follows:
4607%
4608% o wand: the magick wand.
4609%
4610% o reference: the reference wand.
4611%
4612% o metric: the metric.
4613%
4614% o distortion: the computed distortion between the images.
4615%
4616*/
4617WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4618 const MagickWand *reference,const MetricType metric,double *distortion)
4619{
4620 MagickBooleanType
4621 status;
4622
cristy3ed852e2009-09-05 21:47:34 +00004623 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004624 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004625 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004626 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4627 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4628 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4629 status=GetImageDistortion(wand->images,reference->images,metric,distortion,
cristy5f49bdb2011-10-16 14:28:56 +00004630 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00004631 return(status);
cristy3ed852e2009-09-05 21:47:34 +00004632}
4633
4634/*
4635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4636% %
4637% %
4638% %
cristy8a9106f2011-07-05 14:39:26 +00004639% 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 +00004640% %
4641% %
4642% %
4643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4644%
cristy8a9106f2011-07-05 14:39:26 +00004645% MagickGetImageDistortions() compares one or more pixel channels of an
4646% image to a reconstructed image and returns the specified distortion metrics.
cristy3ed852e2009-09-05 21:47:34 +00004647%
cristy8a9106f2011-07-05 14:39:26 +00004648% Use MagickRelinquishMemory() to free the metrics when you are done with them.
cristy3ed852e2009-09-05 21:47:34 +00004649%
cristy8a9106f2011-07-05 14:39:26 +00004650% The format of the MagickGetImageDistortion method is:
4651%
4652% double *MagickGetImageDistortion(MagickWand *wand,
4653% const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004654%
4655% A description of each parameter follows:
4656%
4657% o wand: the magick wand.
4658%
cristy8a9106f2011-07-05 14:39:26 +00004659% o reference: the reference wand.
4660%
4661% o metric: the metric.
4662%
cristy3ed852e2009-09-05 21:47:34 +00004663*/
cristy8a9106f2011-07-05 14:39:26 +00004664WandExport double *MagickGetImageDistortions(MagickWand *wand,
4665 const MagickWand *reference,const MetricType metric)
cristy3ed852e2009-09-05 21:47:34 +00004666{
cristy8a9106f2011-07-05 14:39:26 +00004667 double
4668 *channel_distortion;
4669
cristy3ed852e2009-09-05 21:47:34 +00004670 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004671 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004672 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004673 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004674 assert(reference != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004675 assert(reference->signature == MagickWandSignature);
cristy8a9106f2011-07-05 14:39:26 +00004676 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
cristy3ed852e2009-09-05 21:47:34 +00004677 {
4678 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004679 "ContainsNoImages","`%s'",wand->name);
cristy8a9106f2011-07-05 14:39:26 +00004680 return((double *) NULL);
cristy3ed852e2009-09-05 21:47:34 +00004681 }
cristy8a9106f2011-07-05 14:39:26 +00004682 channel_distortion=GetImageDistortions(wand->images,reference->images,
cristy5f49bdb2011-10-16 14:28:56 +00004683 metric,wand->exception);
cristy8a9106f2011-07-05 14:39:26 +00004684 return(channel_distortion);
cristy3ed852e2009-09-05 21:47:34 +00004685}
4686
4687/*
4688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4689% %
4690% %
4691% %
cristy0ae397c2012-06-02 12:49:12 +00004692% M a g i c k G e t I m a g e E n d i a n %
4693% %
4694% %
4695% %
4696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4697%
4698% MagickGetImageEndian() gets the image endian.
4699%
4700% The format of the MagickGetImageEndian method is:
4701%
4702% EndianType MagickGetImageEndian(MagickWand *wand)
4703%
4704% A description of each parameter follows:
4705%
4706% o wand: the magick wand.
4707%
4708*/
4709WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4710{
4711 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004712 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004713 if (wand->debug != MagickFalse)
cristy0ae397c2012-06-02 12:49:12 +00004714 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
cristy0ae397c2012-06-02 12:49:12 +00004715 if (wand->images == (Image *) NULL)
4716 {
4717 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004718 "ContainsNoImages","`%s'",wand->name);
cristy0ae397c2012-06-02 12:49:12 +00004719 return(UndefinedEndian);
4720 }
4721 return(wand->images->endian);
4722}
4723
4724/*
4725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4726% %
4727% %
4728% %
cristy3ed852e2009-09-05 21:47:34 +00004729% M a g i c k G e t I m a g e F i l e n a m e %
4730% %
4731% %
4732% %
4733%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4734%
4735% MagickGetImageFilename() returns the filename of a particular image in a
4736% sequence.
4737%
4738% The format of the MagickGetImageFilename method is:
4739%
4740% char *MagickGetImageFilename(MagickWand *wand)
4741%
4742% A description of each parameter follows:
4743%
4744% o wand: the magick wand.
4745%
4746*/
4747WandExport char *MagickGetImageFilename(MagickWand *wand)
4748{
4749 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004750 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004751 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004752 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4753 if (wand->images == (Image *) NULL)
4754 {
4755 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004756 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004757 return((char *) NULL);
4758 }
4759 return(AcquireString(wand->images->filename));
4760}
4761
4762/*
4763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4764% %
4765% %
4766% %
4767% M a g i c k G e t I m a g e F o r m a t %
4768% %
4769% %
4770% %
4771%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4772%
4773% MagickGetImageFormat() returns the format of a particular image in a
4774% sequence.
4775%
4776% The format of the MagickGetImageFormat method is:
4777%
cristy03e23ab2012-08-23 12:25:01 +00004778% char *MagickGetImageFormat(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004779%
4780% A description of each parameter follows:
4781%
4782% o wand: the magick wand.
4783%
4784*/
4785WandExport char *MagickGetImageFormat(MagickWand *wand)
4786{
4787 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004788 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004789 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004790 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4791 if (wand->images == (Image *) NULL)
4792 {
4793 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004794 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004795 return((char *) NULL);
4796 }
4797 return(AcquireString(wand->images->magick));
4798}
4799
4800/*
4801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4802% %
4803% %
4804% %
4805% M a g i c k G e t I m a g e F u z z %
4806% %
4807% %
4808% %
4809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4810%
4811% MagickGetImageFuzz() gets the image fuzz.
4812%
4813% The format of the MagickGetImageFuzz method is:
4814%
4815% double MagickGetImageFuzz(MagickWand *wand)
4816%
4817% A description of each parameter follows:
4818%
4819% o wand: the magick wand.
4820%
4821*/
4822WandExport double MagickGetImageFuzz(MagickWand *wand)
4823{
4824 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004825 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004826 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004827 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4828 if (wand->images == (Image *) NULL)
4829 {
4830 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004831 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004832 return(0.0);
4833 }
4834 return(wand->images->fuzz);
4835}
4836
4837/*
4838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4839% %
4840% %
4841% %
4842% M a g i c k G e t I m a g e G a m m a %
4843% %
4844% %
4845% %
4846%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4847%
4848% MagickGetImageGamma() gets the image gamma.
4849%
4850% The format of the MagickGetImageGamma method is:
4851%
4852% double MagickGetImageGamma(MagickWand *wand)
4853%
4854% A description of each parameter follows:
4855%
4856% o wand: the magick wand.
4857%
4858*/
4859WandExport double MagickGetImageGamma(MagickWand *wand)
4860{
4861 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004862 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004863 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004864 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4865 if (wand->images == (Image *) NULL)
4866 {
4867 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004868 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004869 return(0.0);
4870 }
4871 return(wand->images->gamma);
4872}
4873
4874/*
4875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4876% %
4877% %
4878% %
cristy0ae397c2012-06-02 12:49:12 +00004879% 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 +00004880% %
4881% %
4882% %
4883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4884%
4885% MagickGetImageGravity() gets the image gravity.
4886%
4887% The format of the MagickGetImageGravity method is:
4888%
4889% GravityType MagickGetImageGravity(MagickWand *wand)
4890%
4891% A description of each parameter follows:
4892%
4893% o wand: the magick wand.
4894%
4895*/
4896WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4897{
4898 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004899 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004900 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004901 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4902 if (wand->images == (Image *) NULL)
4903 {
4904 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00004905 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00004906 return(UndefinedGravity);
4907 }
4908 return(wand->images->gravity);
4909}
4910
4911/*
4912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4913% %
4914% %
4915% %
4916% 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 %
4917% %
4918% %
4919% %
4920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4921%
4922% MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4923%
4924% The format of the MagickGetImageGreenPrimary method is:
4925%
4926% MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
dirk98e4a9a2016-01-15 11:49:10 +01004927% double *y,double *z)
cristy3ed852e2009-09-05 21:47:34 +00004928%
4929% A description of each parameter follows:
4930%
4931% o wand: the magick wand.
4932%
4933% o x: the chromaticity green primary x-point.
4934%
4935% o y: the chromaticity green primary y-point.
4936%
dirk98e4a9a2016-01-15 11:49:10 +01004937% o z: the chromaticity green primary z-point.
4938%
cristy3ed852e2009-09-05 21:47:34 +00004939*/
4940WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01004941 double *x,double *y,double *z)
cristy3ed852e2009-09-05 21:47:34 +00004942{
4943 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004944 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004945 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004946 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4947 if (wand->images == (Image *) NULL)
4948 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4949 *x=wand->images->chromaticity.green_primary.x;
4950 *y=wand->images->chromaticity.green_primary.y;
dirk98e4a9a2016-01-15 11:49:10 +01004951 *z=wand->images->chromaticity.green_primary.z;
cristy3ed852e2009-09-05 21:47:34 +00004952 return(MagickTrue);
4953}
4954
4955/*
4956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4957% %
4958% %
4959% %
4960% M a g i c k G e t I m a g e H e i g h t %
4961% %
4962% %
4963% %
4964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4965%
4966% MagickGetImageHeight() returns the image height.
4967%
4968% The format of the MagickGetImageHeight method is:
4969%
cristybb503372010-05-27 20:51:26 +00004970% size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004971%
4972% A description of each parameter follows:
4973%
4974% o wand: the magick wand.
4975%
4976*/
cristybb503372010-05-27 20:51:26 +00004977WandExport size_t MagickGetImageHeight(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00004978{
4979 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00004980 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01004981 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00004982 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4983 if (wand->images == (Image *) NULL)
4984 ThrowWandException(WandError,"ContainsNoImages",wand->name);
4985 return(wand->images->rows);
4986}
4987
4988/*
4989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4990% %
4991% %
4992% %
4993% M a g i c k G e t I m a g e H i s t o g r a m %
4994% %
4995% %
4996% %
4997%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4998%
4999% MagickGetImageHistogram() returns the image histogram as an array of
5000% PixelWand wands.
5001%
5002% The format of the MagickGetImageHistogram method is:
5003%
5004% PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005005% size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00005006%
5007% A description of each parameter follows:
5008%
5009% o wand: the magick wand.
5010%
5011% o number_colors: the number of unique colors in the image and the number
5012% of pixel wands returned.
5013%
5014*/
5015WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005016 size_t *number_colors)
cristy3ed852e2009-09-05 21:47:34 +00005017{
cristy101ab702011-10-13 13:06:32 +00005018 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00005019 *histogram;
5020
5021 PixelWand
5022 **pixel_wands;
5023
cristybb503372010-05-27 20:51:26 +00005024 register ssize_t
cristy3ed852e2009-09-05 21:47:34 +00005025 i;
5026
5027 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005028 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005029 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005030 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5031 if (wand->images == (Image *) NULL)
5032 {
5033 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005034 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005035 return((PixelWand **) NULL);
5036 }
5037 histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
cristy101ab702011-10-13 13:06:32 +00005038 if (histogram == (PixelInfo *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00005039 return((PixelWand **) NULL);
5040 pixel_wands=NewPixelWands(*number_colors);
cristybb503372010-05-27 20:51:26 +00005041 for (i=0; i < (ssize_t) *number_colors; i++)
cristy3ed852e2009-09-05 21:47:34 +00005042 {
cristyf82c4a02011-12-15 02:43:44 +00005043 PixelSetPixelColor(pixel_wands[i],&histogram[i]);
cristybb503372010-05-27 20:51:26 +00005044 PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
cristy3ed852e2009-09-05 21:47:34 +00005045 }
cristy101ab702011-10-13 13:06:32 +00005046 histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
cristy3ed852e2009-09-05 21:47:34 +00005047 return(pixel_wands);
5048}
5049
5050/*
5051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5052% %
5053% %
5054% %
5055% 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 %
5056% %
5057% %
5058% %
5059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5060%
5061% MagickGetImageInterlaceScheme() gets the image interlace scheme.
5062%
5063% The format of the MagickGetImageInterlaceScheme method is:
5064%
5065% InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5066%
5067% A description of each parameter follows:
5068%
5069% o wand: the magick wand.
5070%
5071*/
5072WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5073{
5074 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005075 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005076 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005077 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5078 if (wand->images == (Image *) NULL)
5079 {
5080 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005081 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005082 return(UndefinedInterlace);
5083 }
5084 return(wand->images->interlace);
5085}
5086
5087/*
5088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5089% %
5090% %
5091% %
5092% 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 %
5093% %
5094% %
5095% %
5096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5097%
5098% MagickGetImageInterpolateMethod() returns the interpolation method for the
5099% sepcified image.
5100%
5101% The format of the MagickGetImageInterpolateMethod method is:
5102%
Cristy968a8392016-05-01 18:47:05 -04005103% PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005104%
5105% A description of each parameter follows:
5106%
5107% o wand: the magick wand.
5108%
5109*/
cristy5c4e2582011-09-11 19:21:03 +00005110WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
cristy3ed852e2009-09-05 21:47:34 +00005111 MagickWand *wand)
5112{
5113 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005114 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005115 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005116 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5117 if (wand->images == (Image *) NULL)
5118 {
5119 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005120 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005121 return(UndefinedInterpolatePixel);
5122 }
5123 return(wand->images->interpolate);
5124}
5125
5126/*
5127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5128% %
5129% %
5130% %
5131% M a g i c k G e t I m a g e I t e r a t i o n s %
5132% %
5133% %
5134% %
5135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5136%
5137% MagickGetImageIterations() gets the image iterations.
5138%
5139% The format of the MagickGetImageIterations method is:
5140%
cristybb503372010-05-27 20:51:26 +00005141% size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005142%
5143% A description of each parameter follows:
5144%
5145% o wand: the magick wand.
5146%
5147*/
cristybb503372010-05-27 20:51:26 +00005148WandExport size_t MagickGetImageIterations(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005149{
5150 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005151 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005152 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005153 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5154 if (wand->images == (Image *) NULL)
5155 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5156 return(wand->images->iterations);
5157}
5158
5159/*
5160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5161% %
5162% %
5163% %
5164% M a g i c k G e t I m a g e L e n g t h %
5165% %
5166% %
5167% %
5168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5169%
5170% MagickGetImageLength() returns the image length in bytes.
5171%
5172% The format of the MagickGetImageLength method is:
5173%
5174% MagickBooleanType MagickGetImageLength(MagickWand *wand,
5175% MagickSizeType *length)
5176%
5177% A description of each parameter follows:
5178%
5179% o wand: the magick wand.
5180%
5181% o length: the image length in bytes.
5182%
5183*/
5184WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5185 MagickSizeType *length)
5186{
5187 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005188 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005189 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005190 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5191 if (wand->images == (Image *) NULL)
5192 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5193 *length=GetBlobSize(wand->images);
5194 return(MagickTrue);
5195}
5196
5197/*
5198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5199% %
5200% %
5201% %
cristy3ed852e2009-09-05 21:47:34 +00005202% 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 %
5203% %
5204% %
5205% %
5206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5207%
5208% MagickGetImageOrientation() returns the image orientation.
5209%
5210% The format of the MagickGetImageOrientation method is:
5211%
5212% OrientationType MagickGetImageOrientation(MagickWand *wand)
5213%
5214% A description of each parameter follows:
5215%
5216% o wand: the magick wand.
5217%
5218*/
5219WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5220{
5221 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005222 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005223 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005224 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5225 if (wand->images == (Image *) NULL)
5226 {
5227 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005228 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005229 return(UndefinedOrientation);
5230 }
5231 return(wand->images->orientation);
5232}
5233
5234/*
5235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5236% %
5237% %
5238% %
5239% M a g i c k G e t I m a g e P a g e %
5240% %
5241% %
5242% %
5243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5244%
5245% MagickGetImagePage() returns the page geometry associated with the image.
5246%
5247% The format of the MagickGetImagePage method is:
5248%
5249% MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005250% size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00005251%
5252% A description of each parameter follows:
5253%
5254% o wand: the magick wand.
5255%
5256% o width: the page width.
5257%
5258% o height: the page height.
5259%
5260% o x: the page x-offset.
5261%
5262% o y: the page y-offset.
5263%
5264*/
5265WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005266 size_t *width,size_t *height,ssize_t *x,ssize_t *y)
cristy3ed852e2009-09-05 21:47:34 +00005267{
5268 assert(wand != (const MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005269 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005270 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005271 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5272 if (wand->images == (Image *) NULL)
5273 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5274 *width=wand->images->page.width;
5275 *height=wand->images->page.height;
5276 *x=wand->images->page.x;
5277 *y=wand->images->page.y;
5278 return(MagickTrue);
5279}
5280
5281/*
5282%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5283% %
5284% %
5285% %
5286% M a g i c k G e t I m a g e P i x e l C o l o r %
5287% %
5288% %
5289% %
5290%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5291%
5292% MagickGetImagePixelColor() returns the color of the specified pixel.
5293%
5294% The format of the MagickGetImagePixelColor method is:
5295%
5296% MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005297% const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005298%
5299% A description of each parameter follows:
5300%
5301% o wand: the magick wand.
5302%
5303% o x,y: the pixel offset into the image.
5304%
5305% o color: Return the colormap color in this wand.
5306%
5307*/
5308WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005309 const ssize_t x,const ssize_t y,PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00005310{
cristy4c08aed2011-07-01 19:47:50 +00005311 register const Quantum
cristy3ed852e2009-09-05 21:47:34 +00005312 *p;
5313
5314 CacheView
5315 *image_view;
5316
5317 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005318 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005319 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005320 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5321 if (wand->images == (Image *) NULL)
5322 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy46ff2672012-12-14 15:32:26 +00005323 image_view=AcquireVirtualCacheView(wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00005324 p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
cristy4c08aed2011-07-01 19:47:50 +00005325 if (p == (const Quantum *) NULL)
cristy3ed852e2009-09-05 21:47:34 +00005326 {
5327 image_view=DestroyCacheView(image_view);
5328 return(MagickFalse);
5329 }
cristy4c08aed2011-07-01 19:47:50 +00005330 PixelSetQuantumPixel(wand->images,p,color);
cristy3ed852e2009-09-05 21:47:34 +00005331 image_view=DestroyCacheView(image_view);
5332 return(MagickTrue);
5333}
5334
5335/*
5336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5337% %
5338% %
5339% %
cristy3ed852e2009-09-05 21:47:34 +00005340% M a g i c k G e t I m a g e R e d P r i m a r y %
5341% %
5342% %
5343% %
5344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5345%
5346% MagickGetImageRedPrimary() returns the chromaticy red primary point.
5347%
5348% The format of the MagickGetImageRedPrimary method is:
5349%
5350% MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
dirk98e4a9a2016-01-15 11:49:10 +01005351% double *y, double *z)
cristy3ed852e2009-09-05 21:47:34 +00005352%
5353% A description of each parameter follows:
5354%
5355% o wand: the magick wand.
5356%
5357% o x: the chromaticity red primary x-point.
5358%
5359% o y: the chromaticity red primary y-point.
5360%
dirk98e4a9a2016-01-15 11:49:10 +01005361% o z: the chromaticity red primary z-point.
5362%
cristy3ed852e2009-09-05 21:47:34 +00005363*/
5364WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01005365 double *x,double *y,double *z)
cristy3ed852e2009-09-05 21:47:34 +00005366{
5367 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005368 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005369 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005370 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5371 if (wand->images == (Image *) NULL)
5372 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5373 *x=wand->images->chromaticity.red_primary.x;
5374 *y=wand->images->chromaticity.red_primary.y;
dirk98e4a9a2016-01-15 11:49:10 +01005375 *z=wand->images->chromaticity.red_primary.z;
cristy3ed852e2009-09-05 21:47:34 +00005376 return(MagickTrue);
5377}
5378
5379/*
5380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5381% %
5382% %
5383% %
5384% M a g i c k G e t I m a g e R e g i o n %
5385% %
5386% %
5387% %
5388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5389%
5390% MagickGetImageRegion() extracts a region of the image and returns it as a
5391% a new wand.
5392%
5393% The format of the MagickGetImageRegion method is:
5394%
5395% MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005396% const size_t width,const size_t height,const ssize_t x,
5397% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005398%
5399% A description of each parameter follows:
5400%
5401% o wand: the magick wand.
5402%
5403% o width: the region width.
5404%
5405% o height: the region height.
5406%
5407% o x: the region x offset.
5408%
5409% o y: the region y offset.
5410%
5411*/
5412WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00005413 const size_t width,const size_t height,const ssize_t x,
5414 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00005415{
5416 Image
5417 *region_image;
5418
5419 RectangleInfo
5420 region;
5421
5422 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005423 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005424 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005425 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5426 if (wand->images == (Image *) NULL)
5427 return((MagickWand *) NULL);
5428 region.width=width;
5429 region.height=height;
5430 region.x=x;
5431 region.y=y;
5432 region_image=CropImage(wand->images,&region,wand->exception);
5433 if (region_image == (Image *) NULL)
5434 return((MagickWand *) NULL);
5435 return(CloneMagickWandFromImages(wand,region_image));
5436}
5437
5438/*
5439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5440% %
5441% %
5442% %
5443% 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 %
5444% %
5445% %
5446% %
5447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5448%
5449% MagickGetImageRenderingIntent() gets the image rendering intent.
5450%
5451% The format of the MagickGetImageRenderingIntent method is:
5452%
5453% RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5454%
5455% A description of each parameter follows:
5456%
5457% o wand: the magick wand.
5458%
5459*/
5460WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5461{
5462 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005463 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005464 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005465 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5466 if (wand->images == (Image *) NULL)
5467 {
5468 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005469 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005470 return(UndefinedIntent);
5471 }
5472 return((RenderingIntent) wand->images->rendering_intent);
5473}
5474
5475/*
5476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5477% %
5478% %
5479% %
5480% M a g i c k G e t I m a g e R e s o l u t i o n %
5481% %
5482% %
5483% %
5484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5485%
5486% MagickGetImageResolution() gets the image X and Y resolution.
5487%
5488% The format of the MagickGetImageResolution method is:
5489%
5490% MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5491% double *y)
5492%
5493% A description of each parameter follows:
5494%
5495% o wand: the magick wand.
5496%
5497% o x: the image x-resolution.
5498%
5499% o y: the image y-resolution.
5500%
5501*/
5502WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5503 double *x,double *y)
5504{
5505 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005506 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005507 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005508 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5509 if (wand->images == (Image *) NULL)
5510 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy2a11bef2011-10-28 18:33:11 +00005511 *x=wand->images->resolution.x;
5512 *y=wand->images->resolution.y;
cristy3ed852e2009-09-05 21:47:34 +00005513 return(MagickTrue);
5514}
5515
5516/*
5517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5518% %
5519% %
5520% %
5521% M a g i c k G e t I m a g e S c e n e %
5522% %
5523% %
5524% %
5525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5526%
5527% MagickGetImageScene() gets the image scene.
5528%
5529% The format of the MagickGetImageScene method is:
5530%
cristybb503372010-05-27 20:51:26 +00005531% size_t MagickGetImageScene(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 MagickGetImageScene(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005539{
5540 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005541 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005542 if (wand->debug != MagickFalse)
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);
5546 return(wand->images->scene);
5547}
5548
5549/*
5550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5551% %
5552% %
5553% %
5554% M a g i c k G e t I m a g e S i g n a t u r e %
5555% %
5556% %
5557% %
5558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5559%
5560% MagickGetImageSignature() generates an SHA-256 message digest for the image
5561% pixel stream.
5562%
5563% The format of the MagickGetImageSignature method is:
5564%
cristy3a0daa42012-04-25 16:59:57 +00005565% char *MagickGetImageSignature(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005566%
5567% A description of each parameter follows:
5568%
5569% o wand: the magick wand.
5570%
5571*/
5572WandExport char *MagickGetImageSignature(MagickWand *wand)
5573{
5574 const char
5575 *value;
5576
5577 MagickBooleanType
5578 status;
5579
5580 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005581 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005582 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005583 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5584 if (wand->images == (Image *) NULL)
5585 {
5586 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005587 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005588 return((char *) NULL);
5589 }
cristy018f07f2011-09-04 21:15:19 +00005590 status=SignatureImage(wand->images,wand->exception);
dirk5d0a4412016-01-05 22:28:51 +01005591 if (status == MagickFalse)
cristy018f07f2011-09-04 21:15:19 +00005592 return((char *) NULL);
cristyd15e6592011-10-15 00:13:06 +00005593 value=GetImageProperty(wand->images,"signature",wand->exception);
cristy018f07f2011-09-04 21:15:19 +00005594 if (value == (const char *) NULL)
5595 return((char *) NULL);
5596 return(AcquireString(value));
cristy3ed852e2009-09-05 21:47:34 +00005597}
5598
5599/*
5600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601% %
5602% %
5603% %
5604% 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 %
5605% %
5606% %
5607% %
5608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609%
5610% MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5611%
5612% The format of the MagickGetImageTicksPerSecond method is:
5613%
cristybb503372010-05-27 20:51:26 +00005614% size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005615%
5616% A description of each parameter follows:
5617%
5618% o wand: the magick wand.
5619%
5620*/
cristybb503372010-05-27 20:51:26 +00005621WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005622{
5623 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005624 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005625 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005626 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5627 if (wand->images == (Image *) NULL)
5628 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristybb503372010-05-27 20:51:26 +00005629 return((size_t) wand->images->ticks_per_second);
cristy3ed852e2009-09-05 21:47:34 +00005630}
5631
5632/*
5633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634% %
5635% %
5636% %
5637% M a g i c k G e t I m a g e T y p e %
5638% %
5639% %
5640% %
5641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5642%
5643% MagickGetImageType() gets the potential image type:
5644%
5645% Bilevel Grayscale GrayscaleMatte
5646% Palette PaletteMatte TrueColor
5647% TrueColorMatte ColorSeparation ColorSeparationMatte
5648%
cristy3ed852e2009-09-05 21:47:34 +00005649% The format of the MagickGetImageType method is:
5650%
5651% ImageType MagickGetImageType(MagickWand *wand)
5652%
5653% A description of each parameter follows:
5654%
5655% o wand: the magick wand.
5656%
5657*/
5658WandExport ImageType MagickGetImageType(MagickWand *wand)
5659{
5660 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005661 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005662 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005663 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5664 if (wand->images == (Image *) NULL)
5665 {
5666 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005667 "ContainsNoImages","`%s'",wand->name);
cristy5f1c1ff2010-12-23 21:38:06 +00005668 return(UndefinedType);
cristy3ed852e2009-09-05 21:47:34 +00005669 }
dirkab4f0bb2015-07-25 11:46:32 +00005670 return(GetImageType(wand->images));
cristy3ed852e2009-09-05 21:47:34 +00005671}
5672
5673/*
5674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5675% %
5676% %
5677% %
5678% M a g i c k G e t I m a g e U n i t s %
5679% %
5680% %
5681% %
5682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5683%
5684% MagickGetImageUnits() gets the image units of resolution.
5685%
5686% The format of the MagickGetImageUnits method is:
5687%
5688% ResolutionType MagickGetImageUnits(MagickWand *wand)
5689%
5690% A description of each parameter follows:
5691%
5692% o wand: the magick wand.
5693%
5694*/
5695WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5696{
5697 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005698 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005699 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005700 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5701 if (wand->images == (Image *) NULL)
5702 {
5703 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005704 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005705 return(UndefinedResolution);
5706 }
5707 return(wand->images->units);
5708}
5709
5710/*
5711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5712% %
5713% %
5714% %
5715% 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 %
5716% %
5717% %
5718% %
5719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5720%
5721% MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5722% sepcified image.
5723%
5724% The format of the MagickGetImageVirtualPixelMethod method is:
5725%
5726% VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5727%
5728% A description of each parameter follows:
5729%
5730% o wand: the magick wand.
5731%
5732*/
5733WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5734{
5735 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005736 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005737 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005738 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5739 if (wand->images == (Image *) NULL)
5740 {
5741 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005742 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005743 return(UndefinedVirtualPixelMethod);
5744 }
5745 return(GetImageVirtualPixelMethod(wand->images));
5746}
5747
5748/*
5749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5750% %
5751% %
5752% %
5753% M a g i c k G e t I m a g e W h i t e P o i n t %
5754% %
5755% %
5756% %
5757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5758%
5759% MagickGetImageWhitePoint() returns the chromaticy white point.
5760%
5761% The format of the MagickGetImageWhitePoint method is:
5762%
5763% MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
dirk98e4a9a2016-01-15 11:49:10 +01005764% double *y,double *z)
cristy3ed852e2009-09-05 21:47:34 +00005765%
5766% A description of each parameter follows:
5767%
5768% o wand: the magick wand.
5769%
5770% o x: the chromaticity white x-point.
5771%
5772% o y: the chromaticity white y-point.
5773%
dirk98e4a9a2016-01-15 11:49:10 +01005774% o z: the chromaticity white z-point.
5775%
cristy3ed852e2009-09-05 21:47:34 +00005776*/
5777WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01005778 double *x,double *y,double *z)
cristy3ed852e2009-09-05 21:47:34 +00005779{
5780 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005781 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005782 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005783 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5784 if (wand->images == (Image *) NULL)
5785 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5786 *x=wand->images->chromaticity.white_point.x;
5787 *y=wand->images->chromaticity.white_point.y;
dirk98e4a9a2016-01-15 11:49:10 +01005788 *z=wand->images->chromaticity.white_point.z;
cristy3ed852e2009-09-05 21:47:34 +00005789 return(MagickTrue);
5790}
5791
5792/*
5793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5794% %
5795% %
5796% %
5797% M a g i c k G e t I m a g e W i d t h %
5798% %
5799% %
5800% %
5801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5802%
5803% MagickGetImageWidth() returns the image width.
5804%
5805% The format of the MagickGetImageWidth method is:
5806%
cristybb503372010-05-27 20:51:26 +00005807% size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005808%
5809% A description of each parameter follows:
5810%
5811% o wand: the magick wand.
5812%
5813*/
cristybb503372010-05-27 20:51:26 +00005814WandExport size_t MagickGetImageWidth(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005815{
5816 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005817 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005818 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005819 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5820 if (wand->images == (Image *) NULL)
5821 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5822 return(wand->images->columns);
5823}
5824
5825/*
5826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5827% %
5828% %
5829% %
5830% M a g i c k G e t N u m b e r I m a g e s %
5831% %
5832% %
5833% %
5834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5835%
5836% MagickGetNumberImages() returns the number of images associated with a
5837% magick wand.
5838%
5839% The format of the MagickGetNumberImages method is:
5840%
cristybb503372010-05-27 20:51:26 +00005841% size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005842%
5843% A description of each parameter follows:
5844%
5845% o wand: the magick wand.
5846%
5847*/
cristybb503372010-05-27 20:51:26 +00005848WandExport size_t MagickGetNumberImages(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00005849{
5850 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005851 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005852 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005853 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5854 return(GetImageListLength(wand->images));
5855}
5856
5857/*
5858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5859% %
5860% %
5861% %
5862% 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 %
5863% %
5864% %
5865% %
5866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5867%
5868% MagickGetImageTotalInkDensity() gets the image total ink density.
5869%
5870% The format of the MagickGetImageTotalInkDensity method is:
5871%
5872% double MagickGetImageTotalInkDensity(MagickWand *wand)
5873%
5874% A description of each parameter follows:
5875%
5876% o wand: the magick wand.
5877%
5878*/
5879WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5880{
5881 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005882 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005883 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005884 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5885 if (wand->images == (Image *) NULL)
5886 {
5887 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00005888 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00005889 return(0.0);
5890 }
cristy7c3af952011-10-20 16:04:16 +00005891 return(GetImageTotalInkDensity(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00005892}
5893
5894/*
5895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5896% %
5897% %
5898% %
5899% M a g i c k H a l d C l u t I m a g e %
5900% %
5901% %
5902% %
5903%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5904%
5905% MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5906% table. A Hald color lookup table is a 3-dimensional color cube mapped to 2
5907% dimensions. Create it with the HALD coder. You can apply any color
5908% transformation to the Hald image and then use this method to apply the
5909% transform to the image.
5910%
5911% The format of the MagickHaldClutImage method is:
5912%
5913% MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5914% const MagickWand *hald_wand)
cristy3ed852e2009-09-05 21:47:34 +00005915%
5916% A description of each parameter follows:
5917%
5918% o wand: the magick wand.
5919%
5920% o hald_image: the hald CLUT image.
5921%
5922*/
cristy3ed852e2009-09-05 21:47:34 +00005923WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5924 const MagickWand *hald_wand)
5925{
5926 MagickBooleanType
5927 status;
5928
cristy3ed852e2009-09-05 21:47:34 +00005929 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005930 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005931 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005932 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5933 if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5934 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00005935 status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00005936 return(status);
cristy3ed852e2009-09-05 21:47:34 +00005937}
5938
5939/*
5940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5941% %
5942% %
5943% %
5944% M a g i c k H a s N e x t I m a g e %
5945% %
5946% %
5947% %
5948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5949%
5950% MagickHasNextImage() returns MagickTrue if the wand has more images when
5951% traversing the list in the forward direction
5952%
5953% The format of the MagickHasNextImage method is:
5954%
5955% MagickBooleanType MagickHasNextImage(MagickWand *wand)
5956%
5957% A description of each parameter follows:
5958%
5959% o wand: the magick wand.
5960%
5961*/
5962WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5963{
5964 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00005965 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01005966 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00005967 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5968 if (wand->images == (Image *) NULL)
5969 ThrowWandException(WandError,"ContainsNoImages",wand->name);
5970 if (GetNextImageInList(wand->images) == (Image *) NULL)
5971 return(MagickFalse);
5972 return(MagickTrue);
5973}
5974
5975/*
5976%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5977% %
5978% %
5979% %
5980% M a g i c k H a s P r e v i o u s I m a g e %
5981% %
5982% %
5983% %
5984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5985%
5986% MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5987% traversing the list in the reverse direction
5988%
5989% The format of the MagickHasPreviousImage method is:
5990%
5991% MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5992%
5993% A description of each parameter follows:
5994%
5995% o wand: the magick wand.
5996%
5997*/
5998WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5999{
6000 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006001 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006002 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006003 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6004 if (wand->images == (Image *) NULL)
6005 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6006 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6007 return(MagickFalse);
6008 return(MagickTrue);
6009}
6010
6011/*
6012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6013% %
6014% %
6015% %
6016% M a g i c k I d e n t i f y I m a g e %
6017% %
6018% %
6019% %
6020%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6021%
6022% MagickIdentifyImage() identifies an image by printing its attributes to the
6023% file. Attributes include the image width, height, size, and others.
6024%
6025% The format of the MagickIdentifyImage method is:
6026%
6027% const char *MagickIdentifyImage(MagickWand *wand)
6028%
6029% A description of each parameter follows:
6030%
6031% o wand: the magick wand.
6032%
6033*/
6034WandExport char *MagickIdentifyImage(MagickWand *wand)
6035{
6036 char
6037 *description,
cristy151b66d2015-04-15 10:50:31 +00006038 filename[MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +00006039
6040 FILE
6041 *file;
6042
6043 int
6044 unique_file;
6045
6046 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006047 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006048 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006049 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6050 if (wand->images == (Image *) NULL)
6051 {
6052 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00006053 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00006054 return((char *) NULL);
6055 }
6056 description=(char *) NULL;
6057 unique_file=AcquireUniqueFileResource(filename);
6058 file=(FILE *) NULL;
6059 if (unique_file != -1)
6060 file=fdopen(unique_file,"wb");
6061 if ((unique_file == -1) || (file == (FILE *) NULL))
6062 {
6063 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +00006064 "UnableToCreateTemporaryFile","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +00006065 return((char *) NULL);
6066 }
cristya4037272011-08-28 15:11:39 +00006067 (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006068 (void) fclose(file);
cristy3a5987c2013-11-07 14:18:46 +00006069 description=FileToString(filename,~0UL,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006070 (void) RelinquishUniqueFileResource(filename);
6071 return(description);
6072}
dirkab4f0bb2015-07-25 11:46:32 +00006073
6074/*
6075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6076% %
6077% %
6078% %
6079% M a g i c k I d e n t i f y I m a g e T y p e %
6080% %
6081% %
6082% %
6083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6084%
6085% MagickIdentifyImageType() gets the potential image type:
6086%
6087% Bilevel Grayscale GrayscaleMatte
6088% Palette PaletteMatte TrueColor
6089% TrueColorMatte ColorSeparation ColorSeparationMatte
6090%
6091% To ensure the image type matches its potential, use MagickSetImageType():
6092%
6093% (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6094%
6095% The format of the MagickIdentifyImageType method is:
6096%
6097% ImageType MagickIdentifyImageType(MagickWand *wand)
6098%
6099% A description of each parameter follows:
6100%
6101% o wand: the magick wand.
6102%
6103*/
6104WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6105{
6106 assert(wand != (MagickWand *) NULL);
6107 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006108 if (wand->debug != MagickFalse)
dirkab4f0bb2015-07-25 11:46:32 +00006109 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6110 if (wand->images == (Image *) NULL)
6111 {
6112 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6113 "ContainsNoImages","`%s'",wand->name);
6114 return(UndefinedType);
6115 }
6116 return(IdentifyImageType(wand->images,wand->exception));
6117}
6118
cristy3ed852e2009-09-05 21:47:34 +00006119/*
6120%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6121% %
6122% %
6123% %
6124% M a g i c k I m p l o d e I m a g e %
6125% %
6126% %
6127% %
6128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6129%
6130% MagickImplodeImage() creates a new image that is a copy of an existing
6131% one with the image pixels "implode" by the specified percentage. It
6132% allocates the memory necessary for the new Image structure and returns a
6133% pointer to the new image.
6134%
6135% The format of the MagickImplodeImage method is:
6136%
6137% MagickBooleanType MagickImplodeImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +00006138% const double radius,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006139%
6140% A description of each parameter follows:
6141%
6142% o wand: the magick wand.
6143%
6144% o amount: Define the extent of the implosion.
6145%
cristy76f512e2011-09-12 01:26:56 +00006146% o method: the pixel interpolation method.
6147%
cristy3ed852e2009-09-05 21:47:34 +00006148*/
6149WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +00006150 const double amount,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006151{
6152 Image
6153 *implode_image;
6154
6155 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006156 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006157 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006158 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6159 if (wand->images == (Image *) NULL)
6160 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +00006161 implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006162 if (implode_image == (Image *) NULL)
6163 return(MagickFalse);
6164 ReplaceImageInList(&wand->images,implode_image);
6165 return(MagickTrue);
6166}
6167
6168/*
6169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6170% %
6171% %
6172% %
6173% M a g i c k I m p o r t I m a g e P i x e l s %
6174% %
6175% %
6176% %
6177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6178%
6179% MagickImportImagePixels() accepts pixel datand stores it in the image at the
6180% location you specify. The method returns MagickFalse on success otherwise
6181% MagickTrue if an error is encountered. The pixel data can be either char,
cristybb503372010-05-27 20:51:26 +00006182% short int, int, ssize_t, float, or double in the order specified by map.
cristy3ed852e2009-09-05 21:47:34 +00006183%
6184% Suppose your want to upload the first scanline of a 640x480 image from
6185% character data in red-green-blue order:
6186%
6187% MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6188%
6189% The format of the MagickImportImagePixels method is:
6190%
6191% MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006192% const ssize_t x,const ssize_t y,const size_t columns,
6193% const size_t rows,const char *map,const StorageType storage,
cristy3ed852e2009-09-05 21:47:34 +00006194% const void *pixels)
6195%
6196% A description of each parameter follows:
6197%
6198% o wand: the magick wand.
6199%
6200% o x, y, columns, rows: These values define the perimeter of a region
6201% of pixels you want to define.
6202%
6203% o map: This string reflects the expected ordering of the pixel array.
6204% It can be any combination or order of R = red, G = green, B = blue,
cristyb6a294d2011-10-03 00:55:17 +00006205% A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
cristy3ed852e2009-09-05 21:47:34 +00006206% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6207% P = pad.
6208%
6209% o storage: Define the data type of the pixels. Float and double types are
6210% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
6211% these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6212% or DoublePixel.
6213%
6214% o pixels: This array of values contain the pixel components as defined by
6215% map and type. You must preallocate this array where the expected
6216% length varies depending on the values of width, height, map, and type.
6217%
6218*/
6219WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
cristy018f07f2011-09-04 21:15:19 +00006220 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6221 const char *map,const StorageType storage,const void *pixels)
cristy3ed852e2009-09-05 21:47:34 +00006222{
6223 MagickBooleanType
6224 status;
6225
6226 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006227 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006228 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006229 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6230 if (wand->images == (Image *) NULL)
6231 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +00006232 status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6233 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006234 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006235}
6236
6237/*
6238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6239% %
6240% %
6241% %
anthonyfd706f92012-01-19 04:22:02 +00006242% 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 %
6243% %
6244% %
6245% %
6246%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6247%
6248% MagickInterpolativeResizeImage() resize image using a interpolative
6249% method.
6250%
6251% MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6252% const size_t columns,const size_t rows,
6253% const PixelInterpolateMethod method)
6254%
6255% A description of each parameter follows:
6256%
6257% o wand: the magick wand.
6258%
6259% o columns: the number of columns in the scaled image.
6260%
6261% o rows: the number of rows in the scaled image.
6262%
6263% o interpolate: the pixel interpolation method.
6264%
6265*/
6266WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6267 const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6268{
6269 Image
6270 *resize_image;
6271
6272 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006273 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006274 if (wand->debug != MagickFalse)
anthonyfd706f92012-01-19 04:22:02 +00006275 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6276 if (wand->images == (Image *) NULL)
6277 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6278 resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6279 wand->exception);
6280 if (resize_image == (Image *) NULL)
6281 return(MagickFalse);
6282 ReplaceImageInList(&wand->images,resize_image);
6283 return(MagickTrue);
6284}
6285
6286/*
6287%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6288% %
6289% %
6290% %
cristy3ed852e2009-09-05 21:47:34 +00006291% 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 %
6292% %
6293% %
6294% %
6295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6296%
6297% MagickInverseFourierTransformImage() implements the inverse discrete
6298% Fourier transform (DFT) of the image either as a magnitude / phase or real /
6299% imaginary image pair.
6300%
6301% The format of the MagickInverseFourierTransformImage method is:
6302%
6303% MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00006304% MagickWand *magnitude_wand,MagickWand *phase_wand,
6305% const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00006306%
6307% A description of each parameter follows:
6308%
cristyc9550792009-11-13 20:05:42 +00006309% o magnitude_wand: the magnitude or real wand.
6310%
6311% o phase_wand: the phase or imaginary wand.
cristy3ed852e2009-09-05 21:47:34 +00006312%
6313% o magnitude: if true, return as magnitude / phase pair otherwise a real /
6314% imaginary image pair.
6315%
6316*/
6317WandExport MagickBooleanType MagickInverseFourierTransformImage(
cristyc9550792009-11-13 20:05:42 +00006318 MagickWand *magnitude_wand,MagickWand *phase_wand,
6319 const MagickBooleanType magnitude)
cristy3ed852e2009-09-05 21:47:34 +00006320{
6321 Image
6322 *inverse_image;
6323
cristyc9550792009-11-13 20:05:42 +00006324 MagickWand
6325 *wand;
6326
6327 assert(magnitude_wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006328 assert(magnitude_wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006329 if (magnitude_wand->debug != MagickFalse)
cristyc9550792009-11-13 20:05:42 +00006330 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6331 magnitude_wand->name);
6332 wand=magnitude_wand;
6333 if (magnitude_wand->images == (Image *) NULL)
6334 ThrowWandException(WandError,"ContainsNoImages",
6335 magnitude_wand->name);
6336 assert(phase_wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006337 assert(phase_wand->signature == MagickWandSignature);
cristyc9550792009-11-13 20:05:42 +00006338 inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6339 phase_wand->images,magnitude,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00006340 if (inverse_image == (Image *) NULL)
6341 return(MagickFalse);
6342 ReplaceImageInList(&wand->images,inverse_image);
6343 return(MagickTrue);
6344}
6345
6346/*
6347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6348% %
6349% %
6350% %
6351% M a g i c k L a b e l I m a g e %
6352% %
6353% %
6354% %
6355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6356%
6357% MagickLabelImage() adds a label to your image.
6358%
6359% The format of the MagickLabelImage method is:
6360%
6361% MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6362%
6363% A description of each parameter follows:
6364%
6365% o wand: the magick wand.
6366%
6367% o label: the image label.
6368%
6369*/
6370WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6371 const char *label)
6372{
6373 MagickBooleanType
6374 status;
6375
6376 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006377 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006378 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006379 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6380 if (wand->images == (Image *) NULL)
6381 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyd15e6592011-10-15 00:13:06 +00006382 status=SetImageProperty(wand->images,"label",label,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006383 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006384}
6385
6386/*
6387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6388% %
6389% %
6390% %
6391% M a g i c k L e v e l I m a g e %
6392% %
6393% %
6394% %
6395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6396%
6397% MagickLevelImage() adjusts the levels of an image by scaling the colors
6398% falling between specified white and black points to the full available
6399% quantum range. The parameters provided represent the black, mid, and white
6400% points. The black point specifies the darkest color in the image. Colors
6401% darker than the black point are set to zero. Mid point specifies a gamma
6402% correction to apply to the image. White point specifies the lightest color
6403% in the image. Colors brighter than the white point are set to the maximum
6404% quantum value.
6405%
6406% The format of the MagickLevelImage method is:
6407%
6408% MagickBooleanType MagickLevelImage(MagickWand *wand,
6409% const double black_point,const double gamma,const double white_point)
cristyf89cb1d2011-07-07 01:24:37 +00006410% MagickBooleanType MagickLevelImage(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00006411% const ChannelType channel,const double black_point,const double gamma,
6412% const double white_point)
6413%
6414% A description of each parameter follows:
6415%
6416% o wand: the magick wand.
6417%
cristyd3090f92011-10-18 00:05:15 +00006418% o channel: Identify which channel to level: RedPixelChannel,
6419% GreenPixelChannel, etc.
cristy3ed852e2009-09-05 21:47:34 +00006420%
6421% o black_point: the black point.
6422%
6423% o gamma: the gamma.
6424%
6425% o white_point: the white point.
6426%
6427*/
cristy3ed852e2009-09-05 21:47:34 +00006428WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6429 const double black_point,const double gamma,const double white_point)
6430{
6431 MagickBooleanType
6432 status;
6433
cristy3ed852e2009-09-05 21:47:34 +00006434 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006435 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006436 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006437 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6438 if (wand->images == (Image *) NULL)
6439 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy01e9afd2011-08-10 17:38:41 +00006440 status=LevelImage(wand->images,black_point,white_point,gamma,
cristy5f49bdb2011-10-16 14:28:56 +00006441 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006442 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006443}
6444
6445/*
6446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6447% %
6448% %
6449% %
6450% M a g i c k L i n e a r S t r e t c h I m a g e %
6451% %
6452% %
6453% %
6454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6455%
6456% MagickLinearStretchImage() stretches with saturation the image intensity.
6457%
6458% You can also reduce the influence of a particular channel with a gamma
6459% value of 0.
6460%
6461% The format of the MagickLinearStretchImage method is:
6462%
6463% MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6464% const double black_point,const double white_point)
6465%
6466% A description of each parameter follows:
6467%
6468% o wand: the magick wand.
6469%
6470% o black_point: the black point.
6471%
6472% o white_point: the white point.
6473%
6474*/
6475WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6476 const double black_point,const double white_point)
6477{
6478 MagickBooleanType
6479 status;
6480
6481 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006482 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006483 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006484 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6485 if (wand->images == (Image *) NULL)
6486 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy33bd5152011-08-24 01:42:24 +00006487 status=LinearStretchImage(wand->images,black_point,white_point,
cristy5f49bdb2011-10-16 14:28:56 +00006488 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006489 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006490}
6491
6492/*
6493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6494% %
6495% %
6496% %
6497% M a g i c k L i q u i d R e s c a l e I m a g e %
6498% %
6499% %
6500% %
6501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6502%
6503% MagickLiquidRescaleImage() rescales image with seam carving.
6504%
6505% MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006506% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00006507% const double delta_x,const double rigidity)
6508%
6509% A description of each parameter follows:
6510%
6511% o wand: the magick wand.
6512%
6513% o columns: the number of columns in the scaled image.
6514%
6515% o rows: the number of rows in the scaled image.
6516%
6517% o delta_x: maximum seam transversal step (0 means straight seams).
6518%
6519% o rigidity: introduce a bias for non-straight seams (typically 0).
6520%
6521*/
6522WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006523 const size_t columns,const size_t rows,const double delta_x,
cristy3ed852e2009-09-05 21:47:34 +00006524 const double rigidity)
6525{
6526 Image
6527 *rescale_image;
6528
6529 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006530 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006531 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006532 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6533 if (wand->images == (Image *) NULL)
6534 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6535 rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6536 rigidity,wand->exception);
6537 if (rescale_image == (Image *) NULL)
6538 return(MagickFalse);
6539 ReplaceImageInList(&wand->images,rescale_image);
6540 return(MagickTrue);
6541}
dirkbe804602015-11-03 22:36:30 +01006542
6543/*
6544%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6545% %
6546% %
6547% %
6548% M a g i c k L o c a l C o n t r a s t I m a g e %
6549% %
6550% %
6551% %
6552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6553%
6554% MagickLocalContrastImage() attempts to increase the appearance of
6555% large-scale light-dark transitions. Local contrast enhancement works
6556% similarly to sharpening with an unsharp mask, however the mask is instead
6557% created using an image with a greater blur distance.
6558%
6559% MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6560% const double radius,const double strength)
6561%
6562% A description of each parameter follows:
6563%
6564% o image: the image.
6565%
6566% o radius: the radius of the Gaussian, in pixels, not counting
6567% the center pixel.
6568%
6569% o strength: the strength of the blur mask in percentage.
6570%
6571*/
6572WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6573 const double radius, const double strength)
6574{
6575 Image
6576 *contrast_image;
6577
6578 assert(wand != (MagickWand *)NULL);
6579 assert(wand->signature == MagickWandSignature);
6580 if (wand->debug != MagickFalse)
6581 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
6582 if (wand->images == (Image *)NULL)
6583 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6584 contrast_image=LocalContrastImage(wand->images,radius,strength,
6585 wand->exception);
6586 if (contrast_image == (Image *)NULL)
6587 return(MagickFalse);
6588 ReplaceImageInList(&wand->images,contrast_image);
6589 return(MagickTrue);
6590}
cristy3ed852e2009-09-05 21:47:34 +00006591
6592/*
6593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6594% %
6595% %
6596% %
6597% M a g i c k M a g n i f y I m a g e %
6598% %
6599% %
6600% %
6601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6602%
6603% MagickMagnifyImage() is a convenience method that scales an image
6604% proportionally to twice its original size.
6605%
6606% The format of the MagickMagnifyImage method is:
6607%
6608% MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6609%
6610% A description of each parameter follows:
6611%
6612% o wand: the magick wand.
6613%
6614*/
6615WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6616{
6617 Image
6618 *magnify_image;
6619
6620 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006621 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006622 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006623 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6624 if (wand->images == (Image *) NULL)
6625 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6626 magnify_image=MagnifyImage(wand->images,wand->exception);
6627 if (magnify_image == (Image *) NULL)
6628 return(MagickFalse);
6629 ReplaceImageInList(&wand->images,magnify_image);
6630 return(MagickTrue);
6631}
6632
6633/*
6634%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6635% %
6636% %
6637% %
cristy3ed852e2009-09-05 21:47:34 +00006638% M a g i c k M e r g e I m a g e L a y e r s %
6639% %
6640% %
6641% %
6642%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6643%
cristy733678d2011-03-18 21:29:28 +00006644% MagickMergeImageLayers() composes all the image layers from the current
6645% given image onward to produce a single image of the merged layers.
cristy3ed852e2009-09-05 21:47:34 +00006646%
cristya0417062012-09-02 23:34:56 +00006647% The inital canvas's size depends on the given LayerMethod, and is
cristy3ed852e2009-09-05 21:47:34 +00006648% initialized using the first images background color. The images
6649% are then compositied onto that image in sequence using the given
6650% composition that has been assigned to each individual image.
6651%
6652% The format of the MagickMergeImageLayers method is:
6653%
6654% MagickWand *MagickMergeImageLayers(MagickWand *wand,
cristya0417062012-09-02 23:34:56 +00006655% const LayerMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006656%
6657% A description of each parameter follows:
6658%
6659% o wand: the magick wand.
6660%
6661% o method: the method of selecting the size of the initial canvas.
6662%
6663% MergeLayer: Merge all layers onto a canvas just large enough
6664% to hold all the actual images. The virtual canvas of the
6665% first image is preserved but otherwise ignored.
6666%
6667% FlattenLayer: Use the virtual canvas size of first image.
6668% Images which fall outside this canvas is clipped.
6669% This can be used to 'fill out' a given virtual canvas.
6670%
6671% MosaicLayer: Start with the virtual canvas of the first image,
6672% enlarging left and right edges to contain all images.
6673% Images with negative offsets will be clipped.
6674%
6675*/
6676WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
cristya0417062012-09-02 23:34:56 +00006677 const LayerMethod method)
cristy3ed852e2009-09-05 21:47:34 +00006678{
6679 Image
6680 *mosaic_image;
6681
6682 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006683 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006684 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006685 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6686 if (wand->images == (Image *) NULL)
6687 return((MagickWand *) NULL);
6688 mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6689 if (mosaic_image == (Image *) NULL)
6690 return((MagickWand *) NULL);
6691 return(CloneMagickWandFromImages(wand,mosaic_image));
6692}
6693
6694/*
6695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6696% %
6697% %
6698% %
6699% M a g i c k M i n i f y I m a g e %
6700% %
6701% %
6702% %
6703%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6704%
6705% MagickMinifyImage() is a convenience method that scales an image
6706% proportionally to one-half its original size
6707%
6708% The format of the MagickMinifyImage method is:
6709%
6710% MagickBooleanType MagickMinifyImage(MagickWand *wand)
6711%
6712% A description of each parameter follows:
6713%
6714% o wand: the magick wand.
6715%
6716*/
6717WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6718{
6719 Image
6720 *minify_image;
6721
6722 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006723 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006724 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006725 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6726 if (wand->images == (Image *) NULL)
6727 ThrowWandException(WandError,"ContainsNoImages",wand->name);
6728 minify_image=MinifyImage(wand->images,wand->exception);
6729 if (minify_image == (Image *) NULL)
6730 return(MagickFalse);
6731 ReplaceImageInList(&wand->images,minify_image);
6732 return(MagickTrue);
6733}
6734
6735/*
6736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6737% %
6738% %
6739% %
6740% M a g i c k M o d u l a t e I m a g e %
6741% %
6742% %
6743% %
6744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6745%
6746% MagickModulateImage() lets you control the brightness, saturation, and hue
6747% of an image. Hue is the percentage of absolute rotation from the current
6748% position. For example 50 results in a counter-clockwise rotation of 90
6749% degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6750% both resulting in a rotation of 180 degrees.
6751%
6752% To increase the color brightness by 20% and decrease the color saturation by
6753% 10% and leave the hue unchanged, use: 120,90,100.
6754%
6755% The format of the MagickModulateImage method is:
6756%
6757% MagickBooleanType MagickModulateImage(MagickWand *wand,
6758% const double brightness,const double saturation,const double hue)
6759%
6760% A description of each parameter follows:
6761%
6762% o wand: the magick wand.
6763%
6764% o brightness: the percent change in brighness.
6765%
6766% o saturation: the percent change in saturation.
6767%
6768% o hue: the percent change in hue.
6769%
6770*/
6771WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6772 const double brightness,const double saturation,const double hue)
6773{
6774 char
cristy151b66d2015-04-15 10:50:31 +00006775 modulate[MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +00006776
6777 MagickBooleanType
6778 status;
6779
6780 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006781 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006782 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006783 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6784 if (wand->images == (Image *) NULL)
6785 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy151b66d2015-04-15 10:50:31 +00006786 (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
cristy8cd5b312010-01-07 01:10:24 +00006787 brightness,saturation,hue);
cristy5f49bdb2011-10-16 14:28:56 +00006788 status=ModulateImage(wand->images,modulate,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00006789 return(status);
cristy3ed852e2009-09-05 21:47:34 +00006790}
6791
6792/*
6793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6794% %
6795% %
6796% %
6797% M a g i c k M o n t a g e I m a g e %
6798% %
6799% %
6800% %
6801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6802%
6803% MagickMontageImage() creates a composite image by combining several
6804% separate images. The images are tiled on the composite image with the name
6805% of the image optionally appearing just below the individual tile.
6806%
6807% The format of the MagickMontageImage method is:
6808%
6809% MagickWand *MagickMontageImage(MagickWand *wand,
6810% const DrawingWand drawing_wand,const char *tile_geometry,
6811% const char *thumbnail_geometry,const MontageMode mode,
6812% const char *frame)
6813%
6814% A description of each parameter follows:
6815%
6816% o wand: the magick wand.
6817%
6818% o drawing_wand: the drawing wand. The font name, size, and color are
6819% obtained from this wand.
6820%
6821% o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6822%
6823% o thumbnail_geometry: Preferred image size and border size of each
6824% thumbnail (e.g. 120x120+4+3>).
6825%
6826% o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6827%
6828% o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6829% The frame color is that of the thumbnail's matte color.
6830%
6831*/
6832WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6833 const DrawingWand *drawing_wand,const char *tile_geometry,
6834 const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6835{
6836 char
6837 *font;
6838
6839 Image
6840 *montage_image;
6841
6842 MontageInfo
6843 *montage_info;
6844
6845 PixelWand
6846 *pixel_wand;
6847
6848 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006849 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006850 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006851 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6852 if (wand->images == (Image *) NULL)
6853 return((MagickWand *) NULL);
6854 montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6855 switch (mode)
6856 {
6857 case FrameMode:
6858 {
6859 (void) CloneString(&montage_info->frame,"15x15+3+3");
6860 montage_info->shadow=MagickTrue;
6861 break;
6862 }
6863 case UnframeMode:
6864 {
6865 montage_info->frame=(char *) NULL;
6866 montage_info->shadow=MagickFalse;
6867 montage_info->border_width=0;
6868 break;
6869 }
6870 case ConcatenateMode:
6871 {
6872 montage_info->frame=(char *) NULL;
6873 montage_info->shadow=MagickFalse;
6874 (void) CloneString(&montage_info->geometry,"+0+0");
6875 montage_info->border_width=0;
6876 break;
6877 }
6878 default:
6879 break;
6880 }
6881 font=DrawGetFont(drawing_wand);
6882 if (font != (char *) NULL)
6883 (void) CloneString(&montage_info->font,font);
6884 if (frame != (char *) NULL)
6885 (void) CloneString(&montage_info->frame,frame);
6886 montage_info->pointsize=DrawGetFontSize(drawing_wand);
6887 pixel_wand=NewPixelWand();
6888 DrawGetFillColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006889 PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
cristy3ed852e2009-09-05 21:47:34 +00006890 DrawGetStrokeColor(drawing_wand,pixel_wand);
cristy4c08aed2011-07-01 19:47:50 +00006891 PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
cristy3ed852e2009-09-05 21:47:34 +00006892 pixel_wand=DestroyPixelWand(pixel_wand);
6893 if (thumbnail_geometry != (char *) NULL)
6894 (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6895 if (tile_geometry != (char *) NULL)
6896 (void) CloneString(&montage_info->tile,tile_geometry);
6897 montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6898 wand->exception);
6899 montage_info=DestroyMontageInfo(montage_info);
6900 if (montage_image == (Image *) NULL)
6901 return((MagickWand *) NULL);
6902 return(CloneMagickWandFromImages(wand,montage_image));
6903}
6904
6905/*
6906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6907% %
6908% %
6909% %
6910% M a g i c k M o r p h I m a g e s %
6911% %
6912% %
6913% %
6914%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6915%
6916% MagickMorphImages() method morphs a set of images. Both the image pixels
6917% and size are linearly interpolated to give the appearance of a
6918% meta-morphosis from one image to the next.
6919%
6920% The format of the MagickMorphImages method is:
6921%
6922% MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006923% const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006924%
6925% A description of each parameter follows:
6926%
6927% o wand: the magick wand.
6928%
6929% o number_frames: the number of in-between images to generate.
6930%
6931*/
6932WandExport MagickWand *MagickMorphImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006933 const size_t number_frames)
cristy3ed852e2009-09-05 21:47:34 +00006934{
6935 Image
6936 *morph_image;
6937
6938 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006939 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006940 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00006941 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6942 if (wand->images == (Image *) NULL)
6943 return((MagickWand *) NULL);
6944 morph_image=MorphImages(wand->images,number_frames,wand->exception);
6945 if (morph_image == (Image *) NULL)
6946 return((MagickWand *) NULL);
6947 return(CloneMagickWandFromImages(wand,morph_image));
6948}
6949
6950/*
6951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6952% %
6953% %
6954% %
cristya0b81c32010-01-22 02:54:33 +00006955% M a g i c k M o r p h o l o g y I m a g e %
6956% %
6957% %
6958% %
6959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6960%
6961% MagickMorphologyImage() applies a user supplied kernel to the image
6962% according to the given mophology method.
6963%
6964% The format of the MagickMorphologyImage method is:
6965%
6966% MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006967% MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006968%
6969% A description of each parameter follows:
6970%
6971% o wand: the magick wand.
6972%
cristya0b81c32010-01-22 02:54:33 +00006973% o method: the morphology method to be applied.
6974%
6975% o iterations: apply the operation this many times (or no change).
6976% A value of -1 means loop until no change found. How this is applied
6977% may depend on the morphology method. Typically this is a value of 1.
6978%
6979% o kernel: An array of doubles representing the morphology kernel.
6980%
6981*/
cristya0b81c32010-01-22 02:54:33 +00006982WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00006983 MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
cristya0b81c32010-01-22 02:54:33 +00006984{
cristya0b81c32010-01-22 02:54:33 +00006985 Image
6986 *morphology_image;
6987
6988 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00006989 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01006990 if (wand->debug != MagickFalse)
cristya0b81c32010-01-22 02:54:33 +00006991 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6992 if (kernel == (const KernelInfo *) NULL)
6993 return(MagickFalse);
6994 if (wand->images == (Image *) NULL)
6995 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +00006996 morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6997 wand->exception);
cristya0b81c32010-01-22 02:54:33 +00006998 if (morphology_image == (Image *) NULL)
6999 return(MagickFalse);
7000 ReplaceImageInList(&wand->images,morphology_image);
7001 return(MagickTrue);
7002}
7003
7004/*
7005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7006% %
7007% %
7008% %
cristy3ed852e2009-09-05 21:47:34 +00007009% M a g i c k M o t i o n B l u r I m a g e %
7010% %
7011% %
7012% %
7013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7014%
7015% MagickMotionBlurImage() simulates motion blur. We convolve the image with a
7016% Gaussian operator of the given radius and standard deviation (sigma).
7017% For reasonable results, radius should be larger than sigma. Use a
7018% radius of 0 and MotionBlurImage() selects a suitable radius for you.
7019% Angle gives the angle of the blurring motion.
7020%
7021% The format of the MagickMotionBlurImage method is:
7022%
7023% MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00007024% const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +00007025%
7026% A description of each parameter follows:
7027%
7028% o wand: the magick wand.
7029%
cristy3ed852e2009-09-05 21:47:34 +00007030% o radius: the radius of the Gaussian, in pixels, not counting
7031% the center pixel.
7032%
7033% o sigma: the standard deviation of the Gaussian, in pixels.
7034%
cristycee97112010-05-28 00:44:52 +00007035% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00007036%
7037*/
cristy3ed852e2009-09-05 21:47:34 +00007038WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00007039 const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +00007040{
cristy3ed852e2009-09-05 21:47:34 +00007041 Image
7042 *blur_image;
7043
7044 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007045 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007046 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007047 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7048 if (wand->images == (Image *) NULL)
7049 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +00007050 blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007051 if (blur_image == (Image *) NULL)
7052 return(MagickFalse);
7053 ReplaceImageInList(&wand->images,blur_image);
7054 return(MagickTrue);
7055}
7056
7057/*
7058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7059% %
7060% %
7061% %
7062% M a g i c k N e g a t e I m a g e %
7063% %
7064% %
7065% %
7066%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7067%
7068% MagickNegateImage() negates the colors in the reference image. The
7069% Grayscale option means that only grayscale values within the image are
7070% negated.
7071%
7072% You can also reduce the influence of a particular channel with a gamma
7073% value of 0.
7074%
7075% The format of the MagickNegateImage method is:
7076%
7077% MagickBooleanType MagickNegateImage(MagickWand *wand,
7078% const MagickBooleanType gray)
cristy3ed852e2009-09-05 21:47:34 +00007079%
7080% A description of each parameter follows:
7081%
7082% o wand: the magick wand.
7083%
cristy3ed852e2009-09-05 21:47:34 +00007084% o gray: If MagickTrue, only negate grayscale pixels within the image.
7085%
7086*/
cristy3ed852e2009-09-05 21:47:34 +00007087WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7088 const MagickBooleanType gray)
7089{
7090 MagickBooleanType
7091 status;
7092
cristy3ed852e2009-09-05 21:47:34 +00007093 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007094 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007095 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007096 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7097 if (wand->images == (Image *) NULL)
7098 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyb3e7c6c2011-07-24 01:43:55 +00007099 status=NegateImage(wand->images,gray,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007100 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007101}
7102
7103/*
7104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7105% %
7106% %
7107% %
7108% M a g i c k N e w I m a g e %
7109% %
7110% %
7111% %
7112%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7113%
7114% MagickNewImage() adds a blank image canvas of the specified size and
7115% background color to the wand.
7116%
7117% The format of the MagickNewImage method is:
7118%
7119% MagickBooleanType MagickNewImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007120% const size_t columns,const size_t rows,
cristy3ed852e2009-09-05 21:47:34 +00007121% const PixelWand *background)
7122%
7123% A description of each parameter follows:
7124%
7125% o wand: the magick wand.
7126%
7127% o width: the image width.
7128%
7129% o height: the image height.
7130%
7131% o background: the image color.
7132%
7133*/
cristy0740a982011-10-13 15:01:01 +00007134WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7135 const size_t height,const PixelWand *background)
cristy3ed852e2009-09-05 21:47:34 +00007136{
7137 Image
7138 *images;
7139
cristy4c08aed2011-07-01 19:47:50 +00007140 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00007141 pixel;
7142
7143 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007144 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007145 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007146 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7147 PixelGetMagickColor(background,&pixel);
cristy269c9412011-10-13 23:41:15 +00007148 images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007149 if (images == (Image *) NULL)
7150 return(MagickFalse);
cristy3ed852e2009-09-05 21:47:34 +00007151 return(InsertImageInWand(wand,images));
7152}
7153
7154/*
7155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7156% %
7157% %
7158% %
7159% M a g i c k N e x t I m a g e %
7160% %
7161% %
7162% %
7163%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7164%
anthony45083312012-03-14 14:49:12 +00007165% MagickNextImage() sets the next image in the wand as the current image.
anthonyade6afb2012-03-15 13:24:43 +00007166%
anthonyf93964e2012-03-16 08:25:58 +00007167% It is typically used after MagickResetIterator(), after which its first use
7168% will set the first image as the current image (unless the wand is empty).
7169%
7170% It will return MagickFalse when no more images are left to be returned
7171% which happens when the wand is empty, or the current image is the last
7172% image.
7173%
7174% When the above condition (end of image list) is reached, the iterator is
7175% automaticall set so that you can start using MagickPreviousImage() to
7176% again iterate over the images in the reverse direction, starting with the
7177% last image (again). You can jump to this condition immeditally using
7178% MagickSetLastIterator().
cristy3ed852e2009-09-05 21:47:34 +00007179%
7180% The format of the MagickNextImage method is:
7181%
7182% MagickBooleanType MagickNextImage(MagickWand *wand)
7183%
7184% A description of each parameter follows:
7185%
7186% o wand: the magick wand.
7187%
7188*/
7189WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7190{
7191 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007192 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007193 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007194 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7195 if (wand->images == (Image *) NULL)
7196 ThrowWandException(WandError,"ContainsNoImages",wand->name);
anthony45083312012-03-14 14:49:12 +00007197 wand->insert_before=MagickFalse; /* Inserts is now appended */
dirkd0792932016-01-05 15:54:48 +01007198 if (wand->image_pending != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007199 {
anthonya89dd172011-10-04 13:29:35 +00007200 wand->image_pending=MagickFalse;
cristy3ed852e2009-09-05 21:47:34 +00007201 return(MagickTrue);
7202 }
7203 if (GetNextImageInList(wand->images) == (Image *) NULL)
anthony45083312012-03-14 14:49:12 +00007204 {
7205 wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
cristy3ed852e2009-09-05 21:47:34 +00007206 return(MagickFalse);
anthony45083312012-03-14 14:49:12 +00007207 }
cristy3ed852e2009-09-05 21:47:34 +00007208 wand->images=GetNextImageInList(wand->images);
7209 return(MagickTrue);
7210}
7211
7212/*
7213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7214% %
7215% %
7216% %
7217% M a g i c k N o r m a l i z e I m a g e %
7218% %
7219% %
7220% %
7221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7222%
7223% MagickNormalizeImage() enhances the contrast of a color image by adjusting
7224% the pixels color to span the entire range of colors available
7225%
7226% You can also reduce the influence of a particular channel with a gamma
7227% value of 0.
7228%
7229% The format of the MagickNormalizeImage method is:
7230%
7231% MagickBooleanType MagickNormalizeImage(MagickWand *wand)
cristy3ed852e2009-09-05 21:47:34 +00007232%
7233% A description of each parameter follows:
7234%
7235% o wand: the magick wand.
7236%
cristy3ed852e2009-09-05 21:47:34 +00007237*/
cristy3ed852e2009-09-05 21:47:34 +00007238WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7239{
7240 MagickBooleanType
7241 status;
7242
cristy3ed852e2009-09-05 21:47:34 +00007243 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007244 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007245 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007246 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7247 if (wand->images == (Image *) NULL)
7248 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00007249 status=NormalizeImage(wand->images,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007250 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007251}
7252
7253/*
7254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7255% %
7256% %
7257% %
7258% M a g i c k O i l P a i n t I m a g e %
7259% %
7260% %
7261% %
7262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7263%
7264% MagickOilPaintImage() applies a special effect filter that simulates an oil
7265% painting. Each pixel is replaced by the most frequent color occurring
7266% in a circular region defined by radius.
7267%
7268% The format of the MagickOilPaintImage method is:
7269%
7270% MagickBooleanType MagickOilPaintImage(MagickWand *wand,
cristy14973ba2011-08-27 23:48:07 +00007271% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00007272%
7273% A description of each parameter follows:
7274%
7275% o wand: the magick wand.
7276%
7277% o radius: the radius of the circular neighborhood.
7278%
cristy14973ba2011-08-27 23:48:07 +00007279% o sigma: the standard deviation of the Gaussian, in pixels.
7280%
cristy3ed852e2009-09-05 21:47:34 +00007281*/
7282WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
cristy14973ba2011-08-27 23:48:07 +00007283 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +00007284{
7285 Image
7286 *paint_image;
7287
7288 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007289 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007290 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007291 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7292 if (wand->images == (Image *) NULL)
7293 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy14973ba2011-08-27 23:48:07 +00007294 paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007295 if (paint_image == (Image *) NULL)
7296 return(MagickFalse);
7297 ReplaceImageInList(&wand->images,paint_image);
7298 return(MagickTrue);
7299}
7300
7301/*
7302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7303% %
7304% %
7305% %
7306% M a g i c k O p a q u e P a i n t I m a g e %
7307% %
7308% %
7309% %
7310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7311%
7312% MagickOpaquePaintImage() changes any pixel that matches color with the color
7313% defined by fill.
7314%
7315% The format of the MagickOpaquePaintImage method is:
7316%
7317% MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7318% const PixelWand *target,const PixelWand *fill,const double fuzz,
7319% const MagickBooleanType invert)
cristy3ed852e2009-09-05 21:47:34 +00007320%
7321% A description of each parameter follows:
7322%
7323% o wand: the magick wand.
7324%
cristy3ed852e2009-09-05 21:47:34 +00007325% o target: Change this target color to the fill color within the image.
7326%
7327% o fill: the fill pixel wand.
7328%
7329% o fuzz: By default target must match a particular pixel color
7330% exactly. However, in many cases two colors may differ by a small amount.
7331% The fuzz member of image defines how much tolerance is acceptable to
7332% consider two colors as the same. For example, set fuzz to 10 and the
7333% color red at intensities of 100 and 102 respectively are now interpreted
7334% as the same color for the purposes of the floodfill.
7335%
7336% o invert: paint any pixel that does not match the target color.
7337%
7338*/
cristy3ed852e2009-09-05 21:47:34 +00007339WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7340 const PixelWand *target,const PixelWand *fill,const double fuzz,
7341 const MagickBooleanType invert)
7342{
7343 MagickBooleanType
7344 status;
7345
cristy4c08aed2011-07-01 19:47:50 +00007346 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +00007347 fill_pixel,
7348 target_pixel;
7349
7350 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007351 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007352 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007353 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7354 if (wand->images == (Image *) NULL)
7355 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7356 PixelGetMagickColor(target,&target_pixel);
7357 PixelGetMagickColor(fill,&fill_pixel);
7358 wand->images->fuzz=fuzz;
cristy189e84c2011-08-27 18:08:53 +00007359 status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
cristy5f49bdb2011-10-16 14:28:56 +00007360 wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007361 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007362}
7363
7364/*
7365%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7366% %
7367% %
7368% %
7369% 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 %
7370% %
7371% %
7372% %
7373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7374%
7375% MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7376% previous image in the sequence. From this it attempts to select the
7377% smallest cropped image to replace each frame, while preserving the results
7378% of the animation.
7379%
7380% The format of the MagickOptimizeImageLayers method is:
7381%
7382% MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7383%
7384% A description of each parameter follows:
7385%
7386% o wand: the magick wand.
7387%
7388*/
7389WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7390{
7391 Image
7392 *optimize_image;
7393
7394 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007395 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007396 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007397 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7398 if (wand->images == (Image *) NULL)
7399 return((MagickWand *) NULL);
7400 optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7401 if (optimize_image == (Image *) NULL)
7402 return((MagickWand *) NULL);
7403 return(CloneMagickWandFromImages(wand,optimize_image));
7404}
7405
7406/*
7407%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7408% %
7409% %
7410% %
cristye6510f62012-07-29 13:58:11 +00007411% 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 %
7412% %
7413% %
7414% %
7415%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7416%
7417% MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7418% compares the overlayed pixels against the disposal image resulting from all
7419% the previous frames in the animation. Any pixel that does not change the
7420% disposal image (and thus does not effect the outcome of an overlay) is made
7421% transparent.
7422%
7423% WARNING: This modifies the current images directly, rather than generate
7424% a new image sequence.
7425% The format of the MagickOptimizeImageTransparency method is:
7426%
7427% MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7428%
7429% A description of each parameter follows:
7430%
7431% o wand: the magick wand.
7432%
7433*/
7434WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7435{
7436 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007437 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007438 if (wand->debug != MagickFalse)
cristye6510f62012-07-29 13:58:11 +00007439 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7440 if (wand->images == (Image *) NULL)
7441 return(MagickFalse);
7442 OptimizeImageTransparency(wand->images,wand->exception);
7443 return(MagickTrue);
7444}
7445
7446/*
7447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7448% %
7449% %
7450% %
dirkcd69a2d2016-02-01 22:44:38 +01007451% M a g i c k O r d e r e d D i t h e r I m a g e %
cristy3ed852e2009-09-05 21:47:34 +00007452% %
7453% %
7454% %
7455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7456%
dirkcd69a2d2016-02-01 22:44:38 +01007457% MagickOrderedDitherImage() performs an ordered dither based on a number
cristy3ed852e2009-09-05 21:47:34 +00007458% of pre-defined dithering threshold maps, but over multiple intensity levels,
7459% which can be different for different channels, according to the input
7460% arguments.
7461%
dirkcd69a2d2016-02-01 22:44:38 +01007462% The format of the MagickOrderedDitherImage method is:
cristy3ed852e2009-09-05 21:47:34 +00007463%
dirkcd69a2d2016-02-01 22:44:38 +01007464% MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00007465% const char *threshold_map)
cristy3ed852e2009-09-05 21:47:34 +00007466%
7467% A description of each parameter follows:
7468%
7469% o image: the image.
7470%
cristy3ed852e2009-09-05 21:47:34 +00007471% o threshold_map: A string containing the name of the threshold dither
7472% map to use, followed by zero or more numbers representing the number of
7473% color levels tho dither between.
7474%
glennrpf0a92fd2011-04-27 13:17:21 +00007475% Any level number less than 2 is equivalent to 2, and means only binary
cristy3ed852e2009-09-05 21:47:34 +00007476% dithering will be applied to each color channel.
7477%
7478% No numbers also means a 2 level (bitmap) dither will be applied to all
7479% channels, while a single number is the number of levels applied to each
7480% channel in sequence. More numbers will be applied in turn to each of
7481% the color channels.
7482%
7483% For example: "o3x3,6" generates a 6 level posterization of the image
7484% with a ordered 3x3 diffused pixel dither being applied between each
7485% level. While checker,8,8,4 will produce a 332 colormaped image with
7486% only a single checkerboard hash pattern (50% grey) between each color
7487% level, to basically double the number of color levels with a bare
7488% minimim of dithering.
7489%
7490*/
dirkcd69a2d2016-02-01 22:44:38 +01007491WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +00007492 const char *threshold_map)
7493{
7494 MagickBooleanType
7495 status;
7496
cristy3ed852e2009-09-05 21:47:34 +00007497 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007498 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007499 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007500 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7501 if (wand->images == (Image *) NULL)
7502 ThrowWandException(WandError,"ContainsNoImages",wand->name);
dirkcd69a2d2016-02-01 22:44:38 +01007503 status=OrderedDitherImage(wand->images,threshold_map,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007504 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007505}
7506
7507/*
7508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7509% %
7510% %
7511% %
7512% M a g i c k P i n g I m a g e %
7513% %
7514% %
7515% %
7516%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7517%
anthonya89dd172011-10-04 13:29:35 +00007518% MagickPingImage() is the same as MagickReadImage() except the only valid
cristy3ed852e2009-09-05 21:47:34 +00007519% information returned is the image width, height, size, and format. It
7520% is designed to efficiently obtain this information from a file without
7521% reading the entire image sequence into memory.
7522%
7523% The format of the MagickPingImage method is:
7524%
7525% MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7526%
7527% A description of each parameter follows:
7528%
7529% o wand: the magick wand.
7530%
7531% o filename: the image filename.
7532%
7533*/
7534WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7535 const char *filename)
7536{
7537 Image
7538 *images;
7539
7540 ImageInfo
7541 *ping_info;
7542
7543 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007544 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007545 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007546 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7547 ping_info=CloneImageInfo(wand->image_info);
7548 if (filename != (const char *) NULL)
cristy151b66d2015-04-15 10:50:31 +00007549 (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +00007550 images=PingImage(ping_info,wand->exception);
7551 ping_info=DestroyImageInfo(ping_info);
7552 if (images == (Image *) NULL)
7553 return(MagickFalse);
7554 return(InsertImageInWand(wand,images));
7555}
7556
7557/*
7558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7559% %
7560% %
7561% %
7562% M a g i c k P i n g I m a g e B l o b %
7563% %
7564% %
7565% %
7566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7567%
7568% MagickPingImageBlob() pings an image or image sequence from a blob.
7569%
7570% The format of the MagickPingImageBlob method is:
7571%
7572% MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7573% const void *blob,const size_t length)
7574%
7575% A description of each parameter follows:
7576%
7577% o wand: the magick wand.
7578%
7579% o blob: the blob.
7580%
7581% o length: the blob length.
7582%
7583*/
7584WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7585 const void *blob,const size_t length)
7586{
7587 Image
7588 *images;
7589
7590 ImageInfo
7591 *read_info;
7592
7593 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007594 assert(wand->signature == MagickWandSignature);
cristy20160f32015-05-02 23:19:58 +00007595 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007596 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7597 read_info=CloneImageInfo(wand->image_info);
cristy30a333a2015-05-02 23:23:59 +00007598 SetImageInfoBlob(read_info,blob,length);
cristy3ed852e2009-09-05 21:47:34 +00007599 images=PingImage(read_info,wand->exception);
7600 read_info=DestroyImageInfo(read_info);
7601 if (images == (Image *) NULL)
7602 return(MagickFalse);
7603 return(InsertImageInWand(wand,images));
7604}
7605
7606/*
7607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7608% %
7609% %
7610% %
7611% M a g i c k P i n g I m a g e F i l e %
7612% %
7613% %
7614% %
7615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7616%
7617% MagickPingImageFile() pings an image or image sequence from an open file
7618% descriptor.
7619%
7620% The format of the MagickPingImageFile method is:
7621%
7622% MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7623%
7624% A description of each parameter follows:
7625%
7626% o wand: the magick wand.
7627%
7628% o file: the file descriptor.
7629%
7630*/
7631WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7632{
7633 Image
7634 *images;
7635
7636 ImageInfo
7637 *read_info;
7638
7639 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007640 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00007641 assert(file != (FILE *) NULL);
dirkd0792932016-01-05 15:54:48 +01007642 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007643 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7644 read_info=CloneImageInfo(wand->image_info);
7645 SetImageInfoFile(read_info,file);
7646 images=PingImage(read_info,wand->exception);
7647 read_info=DestroyImageInfo(read_info);
7648 if (images == (Image *) NULL)
7649 return(MagickFalse);
7650 return(InsertImageInWand(wand,images));
7651}
7652
7653/*
7654%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7655% %
7656% %
7657% %
7658% M a g i c k P o l a r o i d I m a g e %
7659% %
7660% %
7661% %
7662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7663%
7664% MagickPolaroidImage() simulates a Polaroid picture.
7665%
7666% The format of the MagickPolaroidImage method is:
7667%
7668% MagickBooleanType MagickPolaroidImage(MagickWand *wand,
cristye9e3d382011-12-14 01:50:13 +00007669% const DrawingWand *drawing_wand,const char *caption,const double angle,
cristy5c4e2582011-09-11 19:21:03 +00007670% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007671%
7672% A description of each parameter follows:
7673%
7674% o wand: the magick wand.
7675%
7676% o drawing_wand: the draw wand.
7677%
cristye9e3d382011-12-14 01:50:13 +00007678% o caption: the Polaroid caption.
7679%
cristycee97112010-05-28 00:44:52 +00007680% o angle: Apply the effect along this angle.
cristy3ed852e2009-09-05 21:47:34 +00007681%
cristy5c4e2582011-09-11 19:21:03 +00007682% o method: the pixel interpolation method.
7683%
cristy3ed852e2009-09-05 21:47:34 +00007684*/
7685WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
cristye9e3d382011-12-14 01:50:13 +00007686 const DrawingWand *drawing_wand,const char *caption,const double angle,
cristy5c4e2582011-09-11 19:21:03 +00007687 const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007688{
7689 DrawInfo
7690 *draw_info;
7691
7692 Image
7693 *polaroid_image;
7694
7695 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007696 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007697 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007698 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7699 if (wand->images == (Image *) NULL)
7700 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7701 draw_info=PeekDrawingWand(drawing_wand);
7702 if (draw_info == (DrawInfo *) NULL)
7703 return(MagickFalse);
cristye9e3d382011-12-14 01:50:13 +00007704 polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
cristy5c4e2582011-09-11 19:21:03 +00007705 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007706 if (polaroid_image == (Image *) NULL)
7707 return(MagickFalse);
7708 ReplaceImageInList(&wand->images,polaroid_image);
7709 return(MagickTrue);
7710}
7711
7712/*
7713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7714% %
7715% %
7716% %
7717% M a g i c k P o s t e r i z e I m a g e %
7718% %
7719% %
7720% %
7721%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7722%
7723% MagickPosterizeImage() reduces the image to a limited number of color level.
7724%
7725% The format of the MagickPosterizeImage method is:
7726%
7727% MagickBooleanType MagickPosterizeImage(MagickWand *wand,
cristyd9ecd042012-06-17 18:26:12 +00007728% const size_t levels,const DitherMethod method)
cristy3ed852e2009-09-05 21:47:34 +00007729%
7730% A description of each parameter follows:
7731%
7732% o wand: the magick wand.
7733%
7734% o levels: Number of color levels allowed in each channel. Very low values
7735% (2, 3, or 4) have the most visible effect.
7736%
cristyd9ecd042012-06-17 18:26:12 +00007737% o method: choose the dither method: UndefinedDitherMethod,
7738% NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
cristy3ed852e2009-09-05 21:47:34 +00007739%
7740*/
7741WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
cristyd9ecd042012-06-17 18:26:12 +00007742 const size_t levels,const DitherMethod dither)
cristy3ed852e2009-09-05 21:47:34 +00007743{
7744 MagickBooleanType
7745 status;
7746
7747 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007748 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007749 if (wand->debug != MagickFalse)
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);
cristy018f07f2011-09-04 21:15:19 +00007753 status=PosterizeImage(wand->images,levels,dither,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00007754 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007755}
7756
7757/*
7758%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7759% %
7760% %
7761% %
7762% M a g i c k P r e v i e w I m a g e s %
7763% %
7764% %
7765% %
7766%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7767%
7768% MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7769% image processing operation applied at varying strengths. This helpful
7770% to quickly pin-point an appropriate parameter for an image processing
7771% operation.
7772%
7773% The format of the MagickPreviewImages method is:
7774%
7775% MagickWand *MagickPreviewImages(MagickWand *wand,
7776% const PreviewType preview)
7777%
7778% A description of each parameter follows:
7779%
7780% o wand: the magick wand.
7781%
7782% o preview: the preview type.
7783%
7784*/
7785WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7786 const PreviewType preview)
7787{
7788 Image
7789 *preview_image;
7790
7791 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007792 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007793 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007794 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7795 if (wand->images == (Image *) NULL)
7796 return((MagickWand *) NULL);
7797 preview_image=PreviewImage(wand->images,preview,wand->exception);
7798 if (preview_image == (Image *) NULL)
7799 return((MagickWand *) NULL);
7800 return(CloneMagickWandFromImages(wand,preview_image));
7801}
7802
7803/*
7804%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7805% %
7806% %
7807% %
7808% M a g i c k P r e v i o u s I m a g e %
7809% %
7810% %
7811% %
7812%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7813%
anthonyf93964e2012-03-16 08:25:58 +00007814% MagickPreviousImage() sets the previous image in the wand as the current
7815% image.
cristy3ed852e2009-09-05 21:47:34 +00007816%
anthonyf93964e2012-03-16 08:25:58 +00007817% It is typically used after MagickSetLastIterator(), after which its first
7818% use will set the last image as the current image (unless the wand is empty).
7819%
7820% It will return MagickFalse when no more images are left to be returned
7821% which happens when the wand is empty, or the current image is the first
7822% image. At that point the iterator is than reset to again process images in
7823% the forward direction, again starting with the first image in list. Images
7824% added at this point are prepended.
7825%
7826% Also at that point any images added to the wand using MagickAddImages() or
7827% MagickReadImages() will be prepended before the first image. In this sense
7828% the condition is not quite exactly the same as MagickResetIterator().
anthony45083312012-03-14 14:49:12 +00007829%
cristy3ed852e2009-09-05 21:47:34 +00007830% The format of the MagickPreviousImage method is:
7831%
7832% MagickBooleanType MagickPreviousImage(MagickWand *wand)
7833%
7834% A description of each parameter follows:
7835%
7836% o wand: the magick wand.
7837%
7838*/
7839WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7840{
7841 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007842 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007843 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007844 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7845 if (wand->images == (Image *) NULL)
7846 ThrowWandException(WandError,"ContainsNoImages",wand->name);
dirkd0792932016-01-05 15:54:48 +01007847 if (wand->image_pending != MagickFalse)
anthony45083312012-03-14 14:49:12 +00007848 {
7849 wand->image_pending=MagickFalse; /* image returned no longer pending */
7850 return(MagickTrue);
7851 }
cristy3ed852e2009-09-05 21:47:34 +00007852 if (GetPreviousImageInList(wand->images) == (Image *) NULL)
anthony45083312012-03-14 14:49:12 +00007853 {
7854 wand->image_pending=MagickTrue; /* Next now re-gets first image */
7855 wand->insert_before=MagickTrue; /* insert/add prepends new images */
cristy3ed852e2009-09-05 21:47:34 +00007856 return(MagickFalse);
anthony45083312012-03-14 14:49:12 +00007857 }
cristy3ed852e2009-09-05 21:47:34 +00007858 wand->images=GetPreviousImageInList(wand->images);
7859 return(MagickTrue);
7860}
7861
7862/*
7863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7864% %
7865% %
7866% %
7867% M a g i c k Q u a n t i z e I m a g e %
7868% %
7869% %
7870% %
7871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7872%
7873% MagickQuantizeImage() analyzes the colors within a reference image and
7874% chooses a fixed number of colors to represent the image. The goal of the
7875% algorithm is to minimize the color difference between the input and output
7876% image while minimizing the processing time.
7877%
7878% The format of the MagickQuantizeImage method is:
7879%
7880% MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007881% const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007882% const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007883% const MagickBooleanType measure_error)
7884%
7885% A description of each parameter follows:
7886%
7887% o wand: the magick wand.
7888%
7889% o number_colors: the number of colors.
7890%
7891% o colorspace: Perform color reduction in this colorspace, typically
7892% RGBColorspace.
7893%
7894% o treedepth: Normally, this integer value is zero or one. A zero or
7895% 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
7896% reference image with the least amount of memory and the fastest
7897% computational speed. In some cases, such as an image with low color
7898% dispersion (a few number of colors), a value other than
7899% Log4(number_colors) is required. To expand the color tree completely,
7900% use a value of 8.
7901%
cristycbda6112012-05-27 20:57:16 +00007902% o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7903% RiemersmaDitherMethod, FloydSteinbergDitherMethod.
cristy3ed852e2009-09-05 21:47:34 +00007904%
7905% o measure_error: A value other than zero measures the difference between
7906% the original and quantized images. This difference is the total
7907% quantization error. The error is computed by summing over all pixels
7908% in an image the distance squared in RGB space between each reference
7909% pixel value and its quantized value.
7910%
7911*/
7912WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007913 const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007914 const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007915 const MagickBooleanType measure_error)
7916{
7917 MagickBooleanType
7918 status;
7919
7920 QuantizeInfo
7921 *quantize_info;
7922
7923 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00007924 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01007925 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00007926 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7927 if (wand->images == (Image *) NULL)
7928 ThrowWandException(WandError,"ContainsNoImages",wand->name);
7929 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7930 quantize_info->number_colors=number_colors;
cristycbda6112012-05-27 20:57:16 +00007931 quantize_info->dither_method=dither_method;
cristy3ed852e2009-09-05 21:47:34 +00007932 quantize_info->tree_depth=treedepth;
7933 quantize_info->colorspace=colorspace;
7934 quantize_info->measure_error=measure_error;
cristy018f07f2011-09-04 21:15:19 +00007935 status=QuantizeImage(quantize_info,wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00007936 quantize_info=DestroyQuantizeInfo(quantize_info);
cristy220c4d52013-11-27 19:31:32 +00007937 return(status);
cristy3ed852e2009-09-05 21:47:34 +00007938}
7939
7940/*
7941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7942% %
7943% %
7944% %
7945% M a g i c k Q u a n t i z e I m a g e s %
7946% %
7947% %
7948% %
7949%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7950%
7951% MagickQuantizeImages() analyzes the colors within a sequence of images and
7952% chooses a fixed number of colors to represent the image. The goal of the
7953% algorithm is to minimize the color difference between the input and output
7954% image while minimizing the processing time.
7955%
7956% The format of the MagickQuantizeImages method is:
7957%
7958% MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007959% const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007960% const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007961% const MagickBooleanType measure_error)
7962%
7963% A description of each parameter follows:
7964%
7965% o wand: the magick wand.
7966%
7967% o number_colors: the number of colors.
7968%
7969% o colorspace: Perform color reduction in this colorspace, typically
7970% RGBColorspace.
7971%
7972% o treedepth: Normally, this integer value is zero or one. A zero or
7973% 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
7974% reference image with the least amount of memory and the fastest
7975% computational speed. In some cases, such as an image with low color
7976% dispersion (a few number of colors), a value other than
7977% Log4(number_colors) is required. To expand the color tree completely,
7978% use a value of 8.
7979%
cristycbda6112012-05-27 20:57:16 +00007980% o dither_method: choose from these dither methods: NoDitherMethod,
7981% RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
cristy3ed852e2009-09-05 21:47:34 +00007982%
7983% o measure_error: A value other than zero measures the difference between
7984% the original and quantized images. This difference is the total
7985% quantization error. The error is computed by summing over all pixels
7986% in an image the distance squared in RGB space between each reference
7987% pixel value and its quantized value.
7988%
7989*/
7990WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00007991 const size_t number_colors,const ColorspaceType colorspace,
cristycbda6112012-05-27 20:57:16 +00007992 const size_t treedepth,const DitherMethod dither_method,
cristy3ed852e2009-09-05 21:47:34 +00007993 const MagickBooleanType measure_error)
7994{
7995 MagickBooleanType
7996 status;
7997
7998 QuantizeInfo
7999 *quantize_info;
8000
8001 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008002 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008003 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008004 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8005 if (wand->images == (Image *) NULL)
8006 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8007 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8008 quantize_info->number_colors=number_colors;
cristycbda6112012-05-27 20:57:16 +00008009 quantize_info->dither_method=dither_method;
cristy3ed852e2009-09-05 21:47:34 +00008010 quantize_info->tree_depth=treedepth;
8011 quantize_info->colorspace=colorspace;
8012 quantize_info->measure_error=measure_error;
cristy018f07f2011-09-04 21:15:19 +00008013 status=QuantizeImages(quantize_info,wand->images,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008014 quantize_info=DestroyQuantizeInfo(quantize_info);
cristy220c4d52013-11-27 19:31:32 +00008015 return(status);
cristy3ed852e2009-09-05 21:47:34 +00008016}
8017
8018/*
8019%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8020% %
8021% %
8022% %
dirk6d612cf2014-03-13 21:17:23 +00008023% 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 +00008024% %
8025% %
8026% %
8027%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8028%
dirk6d612cf2014-03-13 21:17:23 +00008029% MagickRotationalBlurImage() rotational blurs an image.
cristy3ed852e2009-09-05 21:47:34 +00008030%
dirk6d612cf2014-03-13 21:17:23 +00008031% The format of the MagickRotationalBlurImage method is:
cristy3ed852e2009-09-05 21:47:34 +00008032%
dirk6d612cf2014-03-13 21:17:23 +00008033% MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008034% const double angle)
cristy3ed852e2009-09-05 21:47:34 +00008035%
8036% A description of each parameter follows:
8037%
8038% o wand: the magick wand.
8039%
cristy3ed852e2009-09-05 21:47:34 +00008040% o angle: the angle of the blur in degrees.
8041%
8042*/
dirk6d612cf2014-03-13 21:17:23 +00008043WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008044 const double angle)
cristy3ed852e2009-09-05 21:47:34 +00008045{
cristy3ed852e2009-09-05 21:47:34 +00008046 Image
8047 *blur_image;
8048
8049 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008050 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008051 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008052 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8053 if (wand->images == (Image *) NULL)
8054 ThrowWandException(WandError,"ContainsNoImages",wand->name);
dirk6d612cf2014-03-13 21:17:23 +00008055 blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008056 if (blur_image == (Image *) NULL)
8057 return(MagickFalse);
8058 ReplaceImageInList(&wand->images,blur_image);
8059 return(MagickTrue);
8060}
8061
8062/*
8063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8064% %
8065% %
8066% %
8067% M a g i c k R a i s e I m a g e %
8068% %
8069% %
8070% %
8071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8072%
8073% MagickRaiseImage() creates a simulated three-dimensional button-like effect
8074% by lightening and darkening the edges of the image. Members width and
8075% height of raise_info define the width of the vertical and horizontal
8076% edge of the effect.
8077%
8078% The format of the MagickRaiseImage method is:
8079%
8080% MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008081% const size_t width,const size_t height,const ssize_t x,
8082% const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00008083%
8084% A description of each parameter follows:
8085%
8086% o wand: the magick wand.
8087%
8088% o width,height,x,y: Define the dimensions of the area to raise.
8089%
8090% o raise: A value other than zero creates a 3-D raise effect,
8091% otherwise it has a lowered effect.
8092%
8093*/
8094WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008095 const size_t width,const size_t height,const ssize_t x,
8096 const ssize_t y,const MagickBooleanType raise)
cristy3ed852e2009-09-05 21:47:34 +00008097{
8098 MagickBooleanType
8099 status;
8100
8101 RectangleInfo
8102 raise_info;
8103
8104 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008105 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008106 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008107 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8108 if (wand->images == (Image *) NULL)
8109 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8110 raise_info.width=width;
8111 raise_info.height=height;
8112 raise_info.x=x;
8113 raise_info.y=y;
cristy5f49bdb2011-10-16 14:28:56 +00008114 status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00008115 return(status);
cristy3ed852e2009-09-05 21:47:34 +00008116}
8117
8118/*
8119%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8120% %
8121% %
8122% %
8123% 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 %
8124% %
8125% %
8126% %
8127%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8128%
8129% MagickRandomThresholdImage() changes the value of individual pixels based on
8130% the intensity of each pixel compared to threshold. The result is a
8131% high-contrast, two color image.
8132%
8133% The format of the MagickRandomThresholdImage method is:
8134%
8135% MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8136% const double low,const double high)
cristy3ed852e2009-09-05 21:47:34 +00008137%
8138% A description of each parameter follows:
8139%
8140% o wand: the magick wand.
8141%
dirk8352b502016-02-01 23:14:34 +01008142% o low,high: Specify the high and low thresholds. These values range from
cristy3ed852e2009-09-05 21:47:34 +00008143% 0 to QuantumRange.
8144%
8145*/
cristy3ed852e2009-09-05 21:47:34 +00008146WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8147 const double low,const double high)
8148{
cristy3ed852e2009-09-05 21:47:34 +00008149 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008150 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008151 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008152 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8153 if (wand->images == (Image *) NULL)
8154 ThrowWandException(WandError,"ContainsNoImages",wand->name);
dirk8352b502016-02-01 23:14:34 +01008155 return(RandomThresholdImage(wand->images,low,high,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00008156}
8157
8158/*
8159%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8160% %
8161% %
8162% %
8163% M a g i c k R e a d I m a g e %
8164% %
8165% %
8166% %
8167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8168%
8169% MagickReadImage() reads an image or image sequence. The images are inserted
anthonye8f56492012-02-12 12:39:02 +00008170% jjust before the current image pointer position.
anthonya89dd172011-10-04 13:29:35 +00008171%
8172% Use MagickSetFirstIterator(), to insert new images before all the current
8173% images in the wand, MagickSetLastIterator() to append add to the end,
cristya99d9fe2015-06-11 16:11:09 +00008174% MagickSetIteratorIndex() to place images just after the given index.
cristy3ed852e2009-09-05 21:47:34 +00008175%
8176% The format of the MagickReadImage method is:
8177%
8178% MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8179%
8180% A description of each parameter follows:
8181%
8182% o wand: the magick wand.
8183%
8184% o filename: the image filename.
8185%
8186*/
8187WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8188 const char *filename)
8189{
8190 Image
8191 *images;
8192
8193 ImageInfo
8194 *read_info;
8195
8196 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008197 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008198 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008199 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8200 read_info=CloneImageInfo(wand->image_info);
8201 if (filename != (const char *) NULL)
cristy151b66d2015-04-15 10:50:31 +00008202 (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +00008203 images=ReadImage(read_info,wand->exception);
8204 read_info=DestroyImageInfo(read_info);
8205 if (images == (Image *) NULL)
8206 return(MagickFalse);
8207 return(InsertImageInWand(wand,images));
8208}
8209
8210/*
8211%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8212% %
8213% %
8214% %
8215% M a g i c k R e a d I m a g e B l o b %
8216% %
8217% %
8218% %
8219%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8220%
8221% MagickReadImageBlob() reads an image or image sequence from a blob.
anthonya89dd172011-10-04 13:29:35 +00008222% In all other respects it is like MagickReadImage().
cristy3ed852e2009-09-05 21:47:34 +00008223%
8224% The format of the MagickReadImageBlob method is:
8225%
8226% MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8227% const void *blob,const size_t length)
8228%
8229% A description of each parameter follows:
8230%
8231% o wand: the magick wand.
8232%
8233% o blob: the blob.
8234%
8235% o length: the blob length.
8236%
8237*/
8238WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8239 const void *blob,const size_t length)
8240{
8241 Image
8242 *images;
8243
8244 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008245 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008246 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008247 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8248 images=BlobToImage(wand->image_info,blob,length,wand->exception);
8249 if (images == (Image *) NULL)
8250 return(MagickFalse);
8251 return(InsertImageInWand(wand,images));
8252}
8253
8254/*
8255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8256% %
8257% %
8258% %
8259% M a g i c k R e a d I m a g e F i l e %
8260% %
8261% %
8262% %
8263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8264%
anthonya89dd172011-10-04 13:29:35 +00008265% MagickReadImageFile() reads an image or image sequence from an already
8266% opened file descriptor. Otherwise it is like MagickReadImage().
cristy3ed852e2009-09-05 21:47:34 +00008267%
8268% The format of the MagickReadImageFile method is:
8269%
8270% MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8271%
8272% A description of each parameter follows:
8273%
8274% o wand: the magick wand.
8275%
8276% o file: the file descriptor.
8277%
8278*/
8279WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8280{
8281 Image
8282 *images;
8283
8284 ImageInfo
8285 *read_info;
8286
8287 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008288 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +00008289 assert(file != (FILE *) NULL);
dirkd0792932016-01-05 15:54:48 +01008290 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008291 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8292 read_info=CloneImageInfo(wand->image_info);
8293 SetImageInfoFile(read_info,file);
8294 images=ReadImage(read_info,wand->exception);
8295 read_info=DestroyImageInfo(read_info);
8296 if (images == (Image *) NULL)
8297 return(MagickFalse);
8298 return(InsertImageInWand(wand,images));
8299}
8300
8301/*
8302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8303% %
8304% %
8305% %
cristy3ed852e2009-09-05 21:47:34 +00008306% M a g i c k R e m a p I m a g e %
8307% %
8308% %
8309% %
8310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8311%
8312% MagickRemapImage() replaces the colors of an image with the closest color
8313% from a reference image.
8314%
8315% The format of the MagickRemapImage method is:
8316%
8317% MagickBooleanType MagickRemapImage(MagickWand *wand,
8318% const MagickWand *remap_wand,const DitherMethod method)
8319%
8320% A description of each parameter follows:
8321%
8322% o wand: the magick wand.
8323%
8324% o affinity: the affinity wand.
8325%
8326% o method: choose from these dither methods: NoDitherMethod,
8327% RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8328%
8329*/
8330WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
cristycbda6112012-05-27 20:57:16 +00008331 const MagickWand *remap_wand,const DitherMethod dither_method)
cristy3ed852e2009-09-05 21:47:34 +00008332{
8333 MagickBooleanType
8334 status;
8335
8336 QuantizeInfo
8337 *quantize_info;
8338
8339 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008340 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008341 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008342 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8343 if ((wand->images == (Image *) NULL) ||
8344 (remap_wand->images == (Image *) NULL))
8345 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8346 quantize_info=AcquireQuantizeInfo(wand->image_info);
cristycbda6112012-05-27 20:57:16 +00008347 quantize_info->dither_method=dither_method;
cristy018f07f2011-09-04 21:15:19 +00008348 status=RemapImage(quantize_info,wand->images,remap_wand->images,
8349 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008350 quantize_info=DestroyQuantizeInfo(quantize_info);
cristy220c4d52013-11-27 19:31:32 +00008351 return(status);
cristy3ed852e2009-09-05 21:47:34 +00008352}
8353
8354/*
8355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8356% %
8357% %
8358% %
8359% M a g i c k R e m o v e I m a g e %
8360% %
8361% %
8362% %
8363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8364%
8365% MagickRemoveImage() removes an image from the image list.
8366%
8367% The format of the MagickRemoveImage method is:
8368%
8369% MagickBooleanType MagickRemoveImage(MagickWand *wand)
8370%
8371% A description of each parameter follows:
8372%
8373% o wand: the magick wand.
8374%
8375% o insert: the splice wand.
8376%
8377*/
8378WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8379{
8380 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008381 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008382 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008383 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8384 if (wand->images == (Image *) NULL)
8385 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8386 DeleteImageFromList(&wand->images);
8387 return(MagickTrue);
8388}
8389
8390/*
8391%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8392% %
8393% %
8394% %
8395% M a g i c k R e s a m p l e I m a g e %
8396% %
8397% %
8398% %
8399%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8400%
8401% MagickResampleImage() resample image to desired resolution.
8402%
8403% Bessel Blackman Box
8404% Catrom Cubic Gaussian
8405% Hanning Hermite Lanczos
8406% Mitchell Point Quandratic
8407% Sinc Triangle
8408%
8409% Most of the filters are FIR (finite impulse response), however, Bessel,
8410% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8411% are windowed (brought down to zero) with the Blackman filter.
8412%
8413% The format of the MagickResampleImage method is:
8414%
8415% MagickBooleanType MagickResampleImage(MagickWand *wand,
8416% const double x_resolution,const double y_resolution,
dirk8b9f21c2016-02-01 22:30:19 +01008417% const FilterType filter)
cristy3ed852e2009-09-05 21:47:34 +00008418%
8419% A description of each parameter follows:
8420%
8421% o wand: the magick wand.
8422%
8423% o x_resolution: the new image x resolution.
8424%
8425% o y_resolution: the new image y resolution.
8426%
8427% o filter: Image filter to use.
8428%
cristy3ed852e2009-09-05 21:47:34 +00008429*/
8430WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
dirk8b9f21c2016-02-01 22:30:19 +01008431 const double x_resolution,const double y_resolution,const FilterType filter)
cristy3ed852e2009-09-05 21:47:34 +00008432{
8433 Image
8434 *resample_image;
8435
8436 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008437 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008438 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008439 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8440 if (wand->images == (Image *) NULL)
8441 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8442 resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
cristyaa2c16c2012-03-25 22:21:35 +00008443 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008444 if (resample_image == (Image *) NULL)
8445 return(MagickFalse);
8446 ReplaceImageInList(&wand->images,resample_image);
8447 return(MagickTrue);
8448}
8449
8450/*
8451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8452% %
8453% %
8454% %
8455% M a g i c k R e s e t I m a g e P a g e %
8456% %
8457% %
8458% %
8459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8460%
8461% MagickResetImagePage() resets the Wand page canvas and position.
8462%
8463% The format of the MagickResetImagePage method is:
8464%
8465% MagickBooleanType MagickResetImagePage(MagickWand *wand,
8466% const char *page)
8467%
8468% A description of each parameter follows:
8469%
8470% o wand: the magick wand.
8471%
8472% o page: the relative page specification.
8473%
8474*/
8475WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8476 const char *page)
8477{
8478 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008479 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008480 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008481 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8482 if (wand->images == (Image *) NULL)
8483 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8484 if ((page == (char *) NULL) || (*page == '\0'))
8485 {
8486 (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8487 return(MagickTrue);
8488 }
8489 return(ResetImagePage(wand->images,page));
8490}
8491
8492/*
8493%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8494% %
8495% %
8496% %
8497% M a g i c k R e s i z e I m a g e %
8498% %
8499% %
8500% %
8501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8502%
8503% MagickResizeImage() scales an image to the desired dimensions with one of
8504% these filters:
8505%
8506% Bessel Blackman Box
8507% Catrom Cubic Gaussian
8508% Hanning Hermite Lanczos
8509% Mitchell Point Quandratic
8510% Sinc Triangle
8511%
8512% Most of the filters are FIR (finite impulse response), however, Bessel,
8513% Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
8514% are windowed (brought down to zero) with the Blackman filter.
8515%
8516% The format of the MagickResizeImage method is:
8517%
8518% MagickBooleanType MagickResizeImage(MagickWand *wand,
dirk8b9f21c2016-02-01 22:30:19 +01008519% const size_t columns,const size_t rows,const FilterType filter)
cristy3ed852e2009-09-05 21:47:34 +00008520%
8521% A description of each parameter follows:
8522%
8523% o wand: the magick wand.
8524%
8525% o columns: the number of columns in the scaled image.
8526%
8527% o rows: the number of rows in the scaled image.
8528%
8529% o filter: Image filter to use.
8530%
cristy3ed852e2009-09-05 21:47:34 +00008531*/
8532WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
dirk8b9f21c2016-02-01 22:30:19 +01008533 const size_t columns,const size_t rows,const FilterType filter)
cristy3ed852e2009-09-05 21:47:34 +00008534{
8535 Image
8536 *resize_image;
8537
8538 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008539 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008540 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008541 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8542 if (wand->images == (Image *) NULL)
8543 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +00008544 resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008545 if (resize_image == (Image *) NULL)
8546 return(MagickFalse);
8547 ReplaceImageInList(&wand->images,resize_image);
8548 return(MagickTrue);
8549}
8550
8551/*
8552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8553% %
8554% %
8555% %
8556% M a g i c k R o l l I m a g e %
8557% %
8558% %
8559% %
8560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8561%
8562% MagickRollImage() offsets an image as defined by x and y.
8563%
8564% The format of the MagickRollImage method is:
8565%
cristybb503372010-05-27 20:51:26 +00008566% MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8567% const size_t y)
cristy3ed852e2009-09-05 21:47:34 +00008568%
8569% A description of each parameter follows:
8570%
8571% o wand: the magick wand.
8572%
8573% o x: the x offset.
8574%
8575% o y: the y offset.
8576%
8577%
8578*/
8579WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008580 const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +00008581{
8582 Image
8583 *roll_image;
8584
8585 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008586 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008587 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008588 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8589 if (wand->images == (Image *) NULL)
8590 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8591 roll_image=RollImage(wand->images,x,y,wand->exception);
8592 if (roll_image == (Image *) NULL)
8593 return(MagickFalse);
8594 ReplaceImageInList(&wand->images,roll_image);
8595 return(MagickTrue);
8596}
8597
8598/*
8599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8600% %
8601% %
8602% %
8603% M a g i c k R o t a t e I m a g e %
8604% %
8605% %
8606% %
8607%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8608%
8609% MagickRotateImage() rotates an image the specified number of degrees. Empty
8610% triangles left over from rotating the image are filled with the
8611% background color.
8612%
8613% The format of the MagickRotateImage method is:
8614%
8615% MagickBooleanType MagickRotateImage(MagickWand *wand,
8616% const PixelWand *background,const double degrees)
8617%
8618% A description of each parameter follows:
8619%
8620% o wand: the magick wand.
8621%
8622% o background: the background pixel wand.
8623%
8624% o degrees: the number of degrees to rotate the image.
8625%
8626%
8627*/
8628WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8629 const PixelWand *background,const double degrees)
8630{
8631 Image
8632 *rotate_image;
8633
8634 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008635 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008636 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008637 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8638 if (wand->images == (Image *) NULL)
8639 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00008640 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00008641 rotate_image=RotateImage(wand->images,degrees,wand->exception);
8642 if (rotate_image == (Image *) NULL)
8643 return(MagickFalse);
8644 ReplaceImageInList(&wand->images,rotate_image);
8645 return(MagickTrue);
8646}
8647
8648/*
8649%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8650% %
8651% %
8652% %
8653% M a g i c k S a m p l e I m a g e %
8654% %
8655% %
8656% %
8657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8658%
8659% MagickSampleImage() scales an image to the desired dimensions with pixel
8660% sampling. Unlike other scaling methods, this method does not introduce
8661% any additional color into the scaled image.
8662%
8663% The format of the MagickSampleImage method is:
8664%
8665% MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008666% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008667%
8668% A description of each parameter follows:
8669%
8670% o wand: the magick wand.
8671%
8672% o columns: the number of columns in the scaled image.
8673%
8674% o rows: the number of rows in the scaled image.
8675%
8676%
8677*/
8678WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008679 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008680{
8681 Image
8682 *sample_image;
8683
8684 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008685 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008686 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008687 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8688 if (wand->images == (Image *) NULL)
8689 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8690 sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8691 if (sample_image == (Image *) NULL)
8692 return(MagickFalse);
8693 ReplaceImageInList(&wand->images,sample_image);
8694 return(MagickTrue);
8695}
8696
8697/*
8698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8699% %
8700% %
8701% %
8702% M a g i c k S c a l e I m a g e %
8703% %
8704% %
8705% %
8706%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8707%
8708% MagickScaleImage() scales the size of an image to the given dimensions.
8709%
8710% The format of the MagickScaleImage method is:
8711%
8712% MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008713% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008714%
8715% A description of each parameter follows:
8716%
8717% o wand: the magick wand.
8718%
8719% o columns: the number of columns in the scaled image.
8720%
8721% o rows: the number of rows in the scaled image.
8722%
8723%
8724*/
8725WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00008726 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00008727{
8728 Image
8729 *scale_image;
8730
8731 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008732 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008733 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008734 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8735 if (wand->images == (Image *) NULL)
8736 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8737 scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8738 if (scale_image == (Image *) NULL)
8739 return(MagickFalse);
8740 ReplaceImageInList(&wand->images,scale_image);
8741 return(MagickTrue);
8742}
8743
8744/*
8745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8746% %
8747% %
8748% %
8749% M a g i c k S e g m e n t I m a g e %
8750% %
8751% %
8752% %
8753%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8754%
8755% MagickSegmentImage() segments an image by analyzing the histograms of the
8756% color components and identifying units that are homogeneous with the fuzzy
8757% C-means technique.
8758%
8759% The format of the SegmentImage method is:
8760%
8761% MagickBooleanType MagickSegmentImage(MagickWand *wand,
8762% const ColorspaceType colorspace,const MagickBooleanType verbose,
8763% const double cluster_threshold,const double smooth_threshold)
8764%
8765% A description of each parameter follows.
8766%
8767% o wand: the wand.
8768%
8769% o colorspace: the image colorspace.
8770%
8771% o verbose: Set to MagickTrue to print detailed information about the
8772% identified classes.
8773%
8774% o cluster_threshold: This represents the minimum number of pixels
8775% contained in a hexahedra before it can be considered valid (expressed as
8776% a percentage).
8777%
8778% o smooth_threshold: the smoothing threshold eliminates noise in the second
8779% derivative of the histogram. As the value is increased, you can expect a
8780% smoother second derivative.
8781%
8782*/
8783MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8784 const ColorspaceType colorspace,const MagickBooleanType verbose,
8785 const double cluster_threshold,const double smooth_threshold)
8786{
8787 MagickBooleanType
8788 status;
8789
8790 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008791 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008792 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008793 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8794 if (wand->images == (Image *) NULL)
8795 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8796 status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
cristy018f07f2011-09-04 21:15:19 +00008797 smooth_threshold,wand->exception);
cristy220c4d52013-11-27 19:31:32 +00008798 return(status);
cristy3ed852e2009-09-05 21:47:34 +00008799}
8800
8801/*
8802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8803% %
8804% %
8805% %
8806% M a g i c k S e l e c t i v e B l u r I m a g e %
8807% %
8808% %
8809% %
8810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8811%
8812% MagickSelectiveBlurImage() selectively blur an image within a contrast
8813% threshold. It is similar to the unsharpen mask that sharpens everything with
8814% contrast above a certain threshold.
8815%
8816% The format of the MagickSelectiveBlurImage method is:
8817%
8818% MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008819% const double radius,const double sigma,const double threshold)
cristy3ed852e2009-09-05 21:47:34 +00008820%
8821% A description of each parameter follows:
8822%
8823% o wand: the magick wand.
8824%
cristy3ed852e2009-09-05 21:47:34 +00008825% o radius: the radius of the gaussian, in pixels, not counting the center
8826% pixel.
8827%
8828% o sigma: the standard deviation of the gaussian, in pixels.
8829%
8830% o threshold: only pixels within this contrast threshold are included
cristy6a917d92009-10-06 19:23:54 +00008831% in the blur operation.
cristy3ed852e2009-09-05 21:47:34 +00008832%
8833*/
cristy3ed852e2009-09-05 21:47:34 +00008834WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +00008835 const double radius,const double sigma,const double threshold)
cristy3ed852e2009-09-05 21:47:34 +00008836{
cristy3ed852e2009-09-05 21:47:34 +00008837 Image
8838 *blur_image;
8839
8840 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008841 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008842 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008843 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8844 if (wand->images == (Image *) NULL)
8845 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +00008846 blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
cristyf4ad9df2011-07-08 16:49:03 +00008847 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +00008848 if (blur_image == (Image *) NULL)
8849 return(MagickFalse);
8850 ReplaceImageInList(&wand->images,blur_image);
8851 return(MagickTrue);
8852}
8853
8854/*
8855%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8856% %
8857% %
8858% %
8859% 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 %
8860% %
8861% %
8862% %
8863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8864%
cristy3139dc22011-07-08 00:11:42 +00008865% MagickSeparateImage() separates a channel from the image and returns a
cristy3ed852e2009-09-05 21:47:34 +00008866% grayscale image. A channel is a particular color component of each pixel
8867% in the image.
8868%
cristy3139dc22011-07-08 00:11:42 +00008869% The format of the MagickSeparateImage method is:
cristy3ed852e2009-09-05 21:47:34 +00008870%
cristyc8d63672012-01-11 13:03:13 +00008871% MagickBooleanType MagickSeparateImage(MagickWand *wand,
8872% const ChannelType channel)
cristy3ed852e2009-09-05 21:47:34 +00008873%
8874% A description of each parameter follows:
8875%
8876% o wand: the magick wand.
8877%
cristyc8d63672012-01-11 13:03:13 +00008878% o channel: the channel.
8879%
cristy3ed852e2009-09-05 21:47:34 +00008880*/
cristyc8d63672012-01-11 13:03:13 +00008881WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8882 const ChannelType channel)
cristy3ed852e2009-09-05 21:47:34 +00008883{
cristyc8d63672012-01-11 13:03:13 +00008884 Image
8885 *separate_image;
8886
cristy3ed852e2009-09-05 21:47:34 +00008887 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008888 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008889 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008890 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8891 if (wand->images == (Image *) NULL)
8892 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyc8d63672012-01-11 13:03:13 +00008893 separate_image=SeparateImage(wand->images,channel,wand->exception);
8894 if (separate_image == (Image *) NULL)
8895 return(MagickFalse);
8896 ReplaceImageInList(&wand->images,separate_image);
8897 return(MagickTrue);
cristy3ed852e2009-09-05 21:47:34 +00008898}
8899
8900/*
8901%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8902% %
8903% %
8904% %
8905% M a g i c k S e p i a T o n e I m a g e %
8906% %
8907% %
8908% %
8909%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8910%
8911% MagickSepiaToneImage() applies a special effect to the image, similar to the
8912% effect achieved in a photo darkroom by sepia toning. Threshold ranges from
8913% 0 to QuantumRange and is a measure of the extent of the sepia toning. A
8914% threshold of 80% is a good starting point for a reasonable tone.
8915%
8916% The format of the MagickSepiaToneImage method is:
8917%
8918% MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8919% const double threshold)
8920%
8921% A description of each parameter follows:
8922%
8923% o wand: the magick wand.
8924%
8925% o threshold: Define the extent of the sepia toning.
8926%
8927*/
8928WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8929 const double threshold)
8930{
8931 Image
8932 *sepia_image;
8933
8934 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008935 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008936 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008937 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8938 if (wand->images == (Image *) NULL)
8939 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8940 sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8941 if (sepia_image == (Image *) NULL)
8942 return(MagickFalse);
8943 ReplaceImageInList(&wand->images,sepia_image);
8944 return(MagickTrue);
8945}
8946
8947/*
8948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8949% %
8950% %
8951% %
8952% M a g i c k S e t I m a g e %
8953% %
8954% %
8955% %
8956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8957%
cristya99d9fe2015-06-11 16:11:09 +00008958% MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
cristy3ed852e2009-09-05 21:47:34 +00008959% MagickNextImage(), MagickPreviousImage() with the images from the specified
8960% wand.
8961%
8962% The format of the MagickSetImage method is:
8963%
8964% MagickBooleanType MagickSetImage(MagickWand *wand,
8965% const MagickWand *set_wand)
8966%
8967% A description of each parameter follows:
8968%
8969% o wand: the magick wand.
8970%
8971% o set_wand: the set_wand wand.
8972%
8973*/
8974WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8975 const MagickWand *set_wand)
8976{
8977 Image
8978 *images;
8979
8980 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008981 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008982 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008983 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8984 assert(set_wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00008985 assert(set_wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01008986 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00008987 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8988 if (set_wand->images == (Image *) NULL)
8989 ThrowWandException(WandError,"ContainsNoImages",wand->name);
8990 images=CloneImageList(set_wand->images,wand->exception);
8991 if (images == (Image *) NULL)
8992 return(MagickFalse);
8993 ReplaceImageInList(&wand->images,images);
8994 return(MagickTrue);
8995}
8996
8997/*
8998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8999% %
9000% %
9001% %
9002% 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 %
9003% %
9004% %
9005% %
9006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9007%
9008% MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9009% alpha channel.
9010%
9011% The format of the MagickSetImageAlphaChannel method is:
9012%
9013% MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
cristyb15b06c2012-08-28 11:36:48 +00009014% const AlphaChannelOption alpha_type)
cristy3ed852e2009-09-05 21:47:34 +00009015%
9016% A description of each parameter follows:
9017%
9018% o wand: the magick wand.
9019%
9020% o alpha_type: the alpha channel type: ActivateAlphaChannel,
9021% DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9022%
9023*/
9024WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
cristyb15b06c2012-08-28 11:36:48 +00009025 const AlphaChannelOption alpha_type)
cristy3ed852e2009-09-05 21:47:34 +00009026{
9027 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009028 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009029 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009030 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9031 if (wand->images == (Image *) NULL)
9032 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00009033 return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009034}
dirkb797b2c2016-02-01 22:20:32 +01009035
9036/*
9037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9038% %
9039% %
9040% %
9041% M a g i c k S e t I m a g e A l p h a C o l o r %
9042% %
9043% %
9044% %
9045%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9046%
9047% MagickSetImageAlphaColor() sets the image alpha color.
9048%
9049% The format of the MagickSetImageAlphaColor method is:
9050%
9051% MagickBooleanType MagickSetImageAlphaColor(MagickWand *wand,
9052% const PixelWand *matte)
9053%
9054% A description of each parameter follows:
9055%
9056% o wand: the magick wand.
9057%
9058% o matte: the alpha pixel wand.
9059%
9060*/
9061WandExport MagickBooleanType MagickSetImageAlphaColor(MagickWand *wand,
9062 const PixelWand *alpha)
9063{
9064 assert(wand != (MagickWand *)NULL);
9065 assert(wand->signature == MagickWandSignature);
9066 if (wand->debug != MagickFalse)
9067 (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
9068 if (wand->images == (Image *)NULL)
9069 ThrowWandException(WandError, "ContainsNoImages", wand->name);
9070 PixelGetQuantumPacket(alpha, &wand->images->alpha_color);
9071 return(MagickTrue);
9072}
cristy3ed852e2009-09-05 21:47:34 +00009073
9074/*
9075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9076% %
9077% %
9078% %
9079% 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 %
9080% %
9081% %
9082% %
9083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9084%
9085% MagickSetImageBackgroundColor() sets the image background color.
9086%
9087% The format of the MagickSetImageBackgroundColor method is:
9088%
9089% MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9090% const PixelWand *background)
9091%
9092% A description of each parameter follows:
9093%
9094% o wand: the magick wand.
9095%
9096% o background: the background pixel wand.
9097%
9098*/
9099WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9100 const PixelWand *background)
9101{
9102 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009103 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009104 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009105 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9106 if (wand->images == (Image *) NULL)
9107 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009108 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +00009109 return(MagickTrue);
9110}
9111
9112/*
9113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9114% %
9115% %
9116% %
cristy3ed852e2009-09-05 21:47:34 +00009117% 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 %
9118% %
9119% %
9120% %
9121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9122%
9123% MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9124%
9125% The format of the MagickSetImageBluePrimary method is:
9126%
9127% MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01009128% const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +00009129%
9130% A description of each parameter follows:
9131%
9132% o wand: the magick wand.
9133%
9134% o x: the blue primary x-point.
9135%
9136% o y: the blue primary y-point.
9137%
dirk98e4a9a2016-01-15 11:49:10 +01009138% o z: the blue primary z-point.
9139%
cristy3ed852e2009-09-05 21:47:34 +00009140*/
9141WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01009142 const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +00009143{
9144 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009145 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009146 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009147 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9148 if (wand->images == (Image *) NULL)
9149 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9150 wand->images->chromaticity.blue_primary.x=x;
9151 wand->images->chromaticity.blue_primary.y=y;
dirk98e4a9a2016-01-15 11:49:10 +01009152 wand->images->chromaticity.blue_primary.z=z;
cristy3ed852e2009-09-05 21:47:34 +00009153 return(MagickTrue);
9154}
9155
9156/*
9157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9158% %
9159% %
9160% %
9161% 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 %
9162% %
9163% %
9164% %
9165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9166%
9167% MagickSetImageBorderColor() sets the image border color.
9168%
9169% The format of the MagickSetImageBorderColor method is:
9170%
9171% MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9172% const PixelWand *border)
9173%
9174% A description of each parameter follows:
9175%
9176% o wand: the magick wand.
9177%
9178% o border: the border pixel wand.
9179%
9180*/
9181WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9182 const PixelWand *border)
9183{
9184 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009185 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009186 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009187 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9188 if (wand->images == (Image *) NULL)
9189 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009190 PixelGetQuantumPacket(border,&wand->images->border_color);
cristy3ed852e2009-09-05 21:47:34 +00009191 return(MagickTrue);
9192}
9193
9194/*
9195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9196% %
9197% %
9198% %
cristybcd59342015-06-07 14:07:19 +00009199% M a g i c k S e t I m a g e C h a n n e l M a s k %
9200% %
9201% %
9202% %
9203%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9204%
9205% MagickSetImageChannelMask() sets image channel mask.
9206%
9207% The format of the MagickSetImageChannelMask method is:
9208%
9209% ChannelType MagickSetImageChannelMask(MagickWand *wand,
9210% const ChannelType channel_mask)
9211%
9212% A description of each parameter follows:
9213%
9214% o wand: the magick wand.
9215%
9216% o channel_mask: the channel_mask wand.
9217%
9218*/
9219WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9220 const ChannelType channel_mask)
9221{
9222 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009223 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009224 if (wand->debug != MagickFalse)
cristybcd59342015-06-07 14:07:19 +00009225 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9226 return(SetImageChannelMask(wand->images,channel_mask));
9227}
9228
9229/*
9230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9231% %
9232% %
9233% %
9234% M a g i c k S e t I m a g e M a s k %
cristy3ed852e2009-09-05 21:47:34 +00009235% %
9236% %
9237% %
9238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9239%
cristy10a6c612012-01-29 21:41:05 +00009240% MagickSetImageMask() sets image clip mask.
cristy3ed852e2009-09-05 21:47:34 +00009241%
cristy10a6c612012-01-29 21:41:05 +00009242% The format of the MagickSetImageMask method is:
cristy3ed852e2009-09-05 21:47:34 +00009243%
cristy10a6c612012-01-29 21:41:05 +00009244% MagickBooleanType MagickSetImageMask(MagickWand *wand,
cristyacd0d4c2015-07-25 16:12:33 +00009245% const PixelMask type,const MagickWand *clip_mask)
cristy3ed852e2009-09-05 21:47:34 +00009246%
9247% A description of each parameter follows:
9248%
9249% o wand: the magick wand.
9250%
cristyacd0d4c2015-07-25 16:12:33 +00009251% o type: type of mask, ReadPixelMask or WritePixelMask.
9252%
cristy3ed852e2009-09-05 21:47:34 +00009253% o clip_mask: the clip_mask wand.
9254%
9255*/
cristy10a6c612012-01-29 21:41:05 +00009256WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
cristyacd0d4c2015-07-25 16:12:33 +00009257 const PixelMask type,const MagickWand *clip_mask)
cristy3ed852e2009-09-05 21:47:34 +00009258{
9259 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009260 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009261 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009262 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9263 assert(clip_mask != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009264 assert(clip_mask->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009265 if (clip_mask->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009266 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9267 if (clip_mask->images == (Image *) NULL)
cristyee37c102011-10-24 14:39:02 +00009268 ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
cristyacd0d4c2015-07-25 16:12:33 +00009269 return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009270}
9271
9272/*
9273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9274% %
9275% %
9276% %
cristya5b77cb2010-05-07 19:34:48 +00009277% M a g i c k S e t I m a g e C o l o r %
9278% %
9279% %
9280% %
9281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9282%
9283% MagickSetImageColor() set the entire wand canvas to the specified color.
9284%
9285% The format of the MagickSetImageColor method is:
9286%
9287% MagickBooleanType MagickSetImageColor(MagickWand *wand,
9288% const PixelWand *color)
9289%
9290% A description of each parameter follows:
9291%
9292% o wand: the magick wand.
9293%
9294% o background: the image color.
9295%
9296*/
9297WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9298 const PixelWand *color)
9299{
cristy4c08aed2011-07-01 19:47:50 +00009300 PixelInfo
cristya5b77cb2010-05-07 19:34:48 +00009301 pixel;
9302
9303 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009304 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009305 if (wand->debug != MagickFalse)
cristya5b77cb2010-05-07 19:34:48 +00009306 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9307 PixelGetMagickColor(color,&pixel);
cristye941a752011-10-15 01:52:48 +00009308 return(SetImageColor(wand->images,&pixel,wand->exception));
cristya5b77cb2010-05-07 19:34:48 +00009309}
9310
9311/*
9312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9313% %
9314% %
9315% %
cristy3ed852e2009-09-05 21:47:34 +00009316% 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 %
9317% %
9318% %
9319% %
9320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9321%
9322% MagickSetImageColormapColor() sets the color of the specified colormap
9323% index.
9324%
9325% The format of the MagickSetImageColormapColor method is:
9326%
9327% MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009328% const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00009329%
9330% A description of each parameter follows:
9331%
9332% o wand: the magick wand.
9333%
9334% o index: the offset into the image colormap.
9335%
9336% o color: Return the colormap color in this wand.
9337%
9338*/
9339WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009340 const size_t index,const PixelWand *color)
cristy3ed852e2009-09-05 21:47:34 +00009341{
9342 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009343 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009344 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009345 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9346 if (wand->images == (Image *) NULL)
9347 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy101ab702011-10-13 13:06:32 +00009348 if ((wand->images->colormap == (PixelInfo *) NULL) ||
cristy3ed852e2009-09-05 21:47:34 +00009349 (index >= wand->images->colors))
9350 ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
cristy4c08aed2011-07-01 19:47:50 +00009351 PixelGetQuantumPacket(color,wand->images->colormap+index);
cristyea1a8aa2011-10-20 13:24:06 +00009352 return(SyncImage(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009353}
9354
9355/*
9356%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9357% %
9358% %
9359% %
9360% M a g i c k S e t I m a g e C o l o r s p a c e %
9361% %
9362% %
9363% %
9364%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9365%
anthony43054ce2012-04-24 05:35:44 +00009366% MagickSetImageColorspace() sets the image colorspace. But does not modify
9367% the image data.
cristy3ed852e2009-09-05 21:47:34 +00009368%
9369% The format of the MagickSetImageColorspace method is:
9370%
9371% MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9372% const ColorspaceType colorspace)
9373%
9374% A description of each parameter follows:
9375%
9376% o wand: the magick wand.
9377%
9378% o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
9379% GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9380% YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9381% YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9382% HSLColorspace, or HWBColorspace.
9383%
9384*/
9385WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9386 const ColorspaceType colorspace)
9387{
9388 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009389 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009390 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009391 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9392 if (wand->images == (Image *) NULL)
9393 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00009394 return(SetImageColorspace(wand->images,colorspace,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009395}
9396
9397/*
9398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9399% %
9400% %
9401% %
9402% M a g i c k S e t I m a g e C o m p o s e %
9403% %
9404% %
9405% %
9406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9407%
9408% MagickSetImageCompose() sets the image composite operator, useful for
9409% specifying how to composite the image thumbnail when using the
9410% MagickMontageImage() method.
9411%
9412% The format of the MagickSetImageCompose method is:
9413%
9414% MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9415% const CompositeOperator compose)
9416%
9417% A description of each parameter follows:
9418%
9419% o wand: the magick wand.
9420%
9421% o compose: the image composite operator.
9422%
9423*/
9424WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9425 const CompositeOperator compose)
9426{
9427 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009428 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009429 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009430 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9431 if (wand->images == (Image *) NULL)
9432 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9433 wand->images->compose=compose;
9434 return(MagickTrue);
9435}
9436
9437/*
9438%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9439% %
9440% %
9441% %
9442% 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 %
9443% %
9444% %
9445% %
9446%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9447%
9448% MagickSetImageCompression() sets the image compression.
9449%
9450% The format of the MagickSetImageCompression method is:
9451%
9452% MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9453% const CompressionType compression)
9454%
9455% A description of each parameter follows:
9456%
9457% o wand: the magick wand.
9458%
9459% o compression: the image compression type.
9460%
9461*/
9462WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9463 const CompressionType compression)
9464{
9465 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009466 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009467 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009468 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9469 if (wand->images == (Image *) NULL)
9470 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9471 wand->images->compression=compression;
9472 return(MagickTrue);
9473}
9474
9475/*
9476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9477% %
9478% %
9479% %
9480% 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 %
9481% %
9482% %
9483% %
9484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9485%
9486% MagickSetImageCompressionQuality() sets the image compression quality.
9487%
9488% The format of the MagickSetImageCompressionQuality method is:
9489%
9490% MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009491% const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009492%
9493% A description of each parameter follows:
9494%
9495% o wand: the magick wand.
9496%
9497% o quality: the image compression tlityype.
9498%
9499*/
9500WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009501 const size_t quality)
cristy3ed852e2009-09-05 21:47:34 +00009502{
9503 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009504 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009505 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009506 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9507 if (wand->images == (Image *) NULL)
9508 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9509 wand->images->quality=quality;
9510 return(MagickTrue);
9511}
9512
9513/*
9514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9515% %
9516% %
9517% %
9518% M a g i c k S e t I m a g e D e l a y %
9519% %
9520% %
9521% %
9522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9523%
9524% MagickSetImageDelay() sets the image delay.
9525%
9526% The format of the MagickSetImageDelay method is:
9527%
9528% MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009529% const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009530%
9531% A description of each parameter follows:
9532%
9533% o wand: the magick wand.
9534%
9535% o delay: the image delay in ticks-per-second units.
9536%
9537*/
9538WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009539 const size_t delay)
cristy3ed852e2009-09-05 21:47:34 +00009540{
9541 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009542 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009543 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009544 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9545 if (wand->images == (Image *) NULL)
9546 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9547 wand->images->delay=delay;
9548 return(MagickTrue);
9549}
9550
9551/*
9552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9553% %
9554% %
9555% %
9556% M a g i c k S e t I m a g e D e p t h %
9557% %
9558% %
9559% %
9560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9561%
9562% MagickSetImageDepth() sets the image depth.
9563%
9564% The format of the MagickSetImageDepth method is:
9565%
9566% MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009567% const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009568%
9569% A description of each parameter follows:
9570%
9571% o wand: the magick wand.
9572%
9573% o depth: the image depth in bits: 8, 16, or 32.
9574%
9575*/
9576WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009577 const size_t depth)
cristy3ed852e2009-09-05 21:47:34 +00009578{
9579 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009580 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009581 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009582 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9583 if (wand->images == (Image *) NULL)
9584 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy8a11cb12011-10-19 23:53:34 +00009585 return(SetImageDepth(wand->images,depth,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009586}
9587
9588/*
9589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9590% %
9591% %
9592% %
9593% M a g i c k S e t I m a g e D i s p o s e %
9594% %
9595% %
9596% %
9597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9598%
9599% MagickSetImageDispose() sets the image disposal method.
9600%
9601% The format of the MagickSetImageDispose method is:
9602%
9603% MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9604% const DisposeType dispose)
9605%
9606% A description of each parameter follows:
9607%
9608% o wand: the magick wand.
9609%
9610% o dispose: the image disposeal type.
9611%
9612*/
9613WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9614 const DisposeType dispose)
9615{
9616 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009617 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009618 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009619 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9620 if (wand->images == (Image *) NULL)
9621 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9622 wand->images->dispose=dispose;
9623 return(MagickTrue);
9624}
9625
9626/*
9627%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9628% %
9629% %
9630% %
cristyd4d100e2012-05-23 11:29:55 +00009631% M a g i c k S e t I m a g e E n d i a n %
9632% %
9633% %
9634% %
9635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9636%
9637% MagickSetImageEndian() sets the image endian method.
9638%
9639% The format of the MagickSetImageEndian method is:
9640%
9641% MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9642% const EndianType endian)
9643%
9644% A description of each parameter follows:
9645%
9646% o wand: the magick wand.
9647%
9648% o endian: the image endian type.
9649%
9650*/
9651WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9652 const EndianType endian)
9653{
9654 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009655 assert(wand->signature == MagickWandSignature);
cristyd4d100e2012-05-23 11:29:55 +00009656 if (wand->debug != MagickFalse)
9657 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9658 if (wand->images == (Image *) NULL)
9659 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9660 wand->images->endian=endian;
9661 return(MagickTrue);
9662}
9663
9664/*
9665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9666% %
9667% %
9668% %
cristy3ed852e2009-09-05 21:47:34 +00009669% M a g i c k S e t I m a g e E x t e n t %
9670% %
9671% %
9672% %
9673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9674%
9675% MagickSetImageExtent() sets the image size (i.e. columns & rows).
9676%
9677% The format of the MagickSetImageExtent method is:
9678%
9679% MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009680% const size_t columns,const unsigned rows)
cristy3ed852e2009-09-05 21:47:34 +00009681%
9682% A description of each parameter follows:
9683%
9684% o wand: the magick wand.
9685%
9686% o columns: The image width in pixels.
9687%
9688% o rows: The image height in pixels.
9689%
9690*/
9691WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +00009692 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +00009693{
9694 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009695 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009696 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009697 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9698 if (wand->images == (Image *) NULL)
9699 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +00009700 return(SetImageExtent(wand->images,columns,rows,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +00009701}
9702
9703/*
9704%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9705% %
9706% %
9707% %
9708% M a g i c k S e t I m a g e F i l e n a m e %
9709% %
9710% %
9711% %
9712%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9713%
9714% MagickSetImageFilename() sets the filename of a particular image in a
9715% sequence.
9716%
9717% The format of the MagickSetImageFilename method is:
9718%
9719% MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9720% const char *filename)
9721%
9722% A description of each parameter follows:
9723%
9724% o wand: the magick wand.
9725%
9726% o filename: the image filename.
9727%
9728*/
9729WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9730 const char *filename)
9731{
9732 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009733 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009734 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009735 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9736 if (wand->images == (Image *) NULL)
9737 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9738 if (filename != (const char *) NULL)
cristy151b66d2015-04-15 10:50:31 +00009739 (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +00009740 return(MagickTrue);
9741}
9742
9743/*
9744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9745% %
9746% %
9747% %
9748% M a g i c k S e t I m a g e F o r m a t %
9749% %
9750% %
9751% %
9752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9753%
9754% MagickSetImageFormat() sets the format of a particular image in a
9755% sequence.
9756%
9757% The format of the MagickSetImageFormat method is:
9758%
9759% MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9760% const char *format)
9761%
9762% A description of each parameter follows:
9763%
9764% o wand: the magick wand.
9765%
9766% o format: the image format.
9767%
9768*/
9769WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9770 const char *format)
9771{
9772 const MagickInfo
9773 *magick_info;
9774
9775 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009776 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009777 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009778 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9779 if (wand->images == (Image *) NULL)
9780 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9781 if ((format == (char *) NULL) || (*format == '\0'))
9782 {
9783 *wand->images->magick='\0';
9784 return(MagickTrue);
9785 }
9786 magick_info=GetMagickInfo(format,wand->exception);
9787 if (magick_info == (const MagickInfo *) NULL)
9788 return(MagickFalse);
9789 ClearMagickException(wand->exception);
cristy151b66d2015-04-15 10:50:31 +00009790 (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +00009791 return(MagickTrue);
9792}
9793
9794/*
9795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9796% %
9797% %
9798% %
9799% M a g i c k S e t I m a g e F u z z %
9800% %
9801% %
9802% %
9803%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9804%
9805% MagickSetImageFuzz() sets the image fuzz.
9806%
9807% The format of the MagickSetImageFuzz method is:
9808%
9809% MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9810% const double fuzz)
9811%
9812% A description of each parameter follows:
9813%
9814% o wand: the magick wand.
9815%
9816% o fuzz: the image fuzz.
9817%
9818*/
9819WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9820 const double fuzz)
9821{
9822 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009823 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009824 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009825 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9826 if (wand->images == (Image *) NULL)
9827 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9828 wand->images->fuzz=fuzz;
9829 return(MagickTrue);
9830}
9831
9832/*
9833%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9834% %
9835% %
9836% %
9837% M a g i c k S e t I m a g e G a m m a %
9838% %
9839% %
9840% %
9841%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9842%
9843% MagickSetImageGamma() sets the image gamma.
9844%
9845% The format of the MagickSetImageGamma method is:
9846%
9847% MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9848% const double gamma)
9849%
9850% A description of each parameter follows:
9851%
9852% o wand: the magick wand.
9853%
9854% o gamma: the image gamma.
9855%
9856*/
9857WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9858 const double gamma)
9859{
9860 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009861 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009862 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009863 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9864 if (wand->images == (Image *) NULL)
9865 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9866 wand->images->gamma=gamma;
9867 return(MagickTrue);
9868}
9869
9870/*
9871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9872% %
9873% %
9874% %
9875% M a g i c k S e t I m a g e G r a v i t y %
9876% %
9877% %
9878% %
9879%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9880%
9881% MagickSetImageGravity() sets the image gravity type.
9882%
9883% The format of the MagickSetImageGravity method is:
9884%
9885% MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9886% const GravityType gravity)
9887%
9888% A description of each parameter follows:
9889%
9890% o wand: the magick wand.
9891%
dirk675b1c72015-06-28 15:49:28 +00009892% o gravity: positioning gravity (NorthWestGravity, NorthGravity,
9893% NorthEastGravity, WestGravity, CenterGravity,
9894% EastGravity, SouthWestGravity, SouthGravity,
9895% SouthEastGravity)
cristy3ed852e2009-09-05 21:47:34 +00009896%
9897*/
9898WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9899 const GravityType gravity)
9900{
9901 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009902 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009903 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009904 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9905 if (wand->images == (Image *) NULL)
9906 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9907 wand->images->gravity=gravity;
9908 return(MagickTrue);
9909}
9910
9911/*
9912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9913% %
9914% %
9915% %
9916% 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 %
9917% %
9918% %
9919% %
9920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9921%
9922% MagickSetImageGreenPrimary() sets the image chromaticity green primary
9923% point.
9924%
9925% The format of the MagickSetImageGreenPrimary method is:
9926%
9927% MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01009928% const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +00009929%
9930% A description of each parameter follows:
9931%
9932% o wand: the magick wand.
9933%
9934% o x: the green primary x-point.
9935%
9936% o y: the green primary y-point.
9937%
dirk98e4a9a2016-01-15 11:49:10 +01009938% o z: the green primary z-point.
cristy3ed852e2009-09-05 21:47:34 +00009939%
9940*/
9941WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +01009942 const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +00009943{
9944 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009945 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009946 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009947 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9948 if (wand->images == (Image *) NULL)
9949 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9950 wand->images->chromaticity.green_primary.x=x;
9951 wand->images->chromaticity.green_primary.y=y;
dirk98e4a9a2016-01-15 11:49:10 +01009952 wand->images->chromaticity.green_primary.z=z;
cristy3ed852e2009-09-05 21:47:34 +00009953 return(MagickTrue);
9954}
9955
9956/*
9957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9958% %
9959% %
9960% %
9961% 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 %
9962% %
9963% %
9964% %
9965%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9966%
9967% MagickSetImageInterlaceScheme() sets the image interlace scheme.
9968%
9969% The format of the MagickSetImageInterlaceScheme method is:
9970%
9971% MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9972% const InterlaceType interlace)
9973%
9974% A description of each parameter follows:
9975%
9976% o wand: the magick wand.
9977%
9978% o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9979% PlaneInterlace, PartitionInterlace.
9980%
9981*/
9982WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9983 const InterlaceType interlace)
9984{
9985 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +00009986 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +01009987 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +00009988 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9989 if (wand->images == (Image *) NULL)
9990 ThrowWandException(WandError,"ContainsNoImages",wand->name);
9991 wand->images->interlace=interlace;
9992 return(MagickTrue);
9993}
9994
9995/*
9996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9997% %
9998% %
9999% %
10000% 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 %
10001% %
10002% %
10003% %
10004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10005%
Cristy1b5ce092016-05-01 20:11:24 -040010006% MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
cristy3ed852e2009-09-05 21:47:34 +000010007%
Cristy1b5ce092016-05-01 20:11:24 -040010008% The format of the MagickSetImageInterpolateMethod method is:
cristy3ed852e2009-09-05 21:47:34 +000010009%
Cristy1b5ce092016-05-01 20:11:24 -040010010% MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +000010011% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000010012%
10013% A description of each parameter follows:
10014%
10015% o wand: the magick wand.
10016%
10017% o method: the image interpole pixel methods: choose from Undefined,
10018% Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10019%
10020*/
Cristy1b5ce092016-05-01 20:11:24 -040010021
cristy5221b602012-10-30 18:02:55 +000010022WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
10023 MagickWand *wand,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000010024{
Cristy32bdefd2016-05-02 10:32:58 -040010025 return(MagickSetImageInterpolateMethod(wand,method));
Cristy1b5ce092016-05-01 20:11:24 -040010026}
10027
10028WandExport MagickBooleanType MagickSetImageInterpolateMethod(
10029 MagickWand *wand,const PixelInterpolateMethod method)
10030{
cristy3ed852e2009-09-05 21:47:34 +000010031 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010032 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010033 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010034 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10035 if (wand->images == (Image *) NULL)
10036 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10037 wand->images->interpolate=method;
10038 return(MagickTrue);
10039}
10040
10041/*
10042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10043% %
10044% %
10045% %
10046% M a g i c k S e t I m a g e I t e r a t i o n s %
10047% %
10048% %
10049% %
10050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10051%
10052% MagickSetImageIterations() sets the image iterations.
10053%
10054% The format of the MagickSetImageIterations method is:
10055%
10056% MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010057% const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +000010058%
10059% A description of each parameter follows:
10060%
10061% o wand: the magick wand.
10062%
10063% o delay: the image delay in 1/100th of a second.
10064%
10065*/
10066WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010067 const size_t iterations)
cristy3ed852e2009-09-05 21:47:34 +000010068{
10069 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010070 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010071 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010072 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10073 if (wand->images == (Image *) NULL)
10074 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10075 wand->images->iterations=iterations;
10076 return(MagickTrue);
10077}
10078
10079/*
10080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10081% %
10082% %
10083% %
10084% M a g i c k S e t I m a g e M a t t e %
10085% %
10086% %
10087% %
10088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10089%
10090% MagickSetImageMatte() sets the image matte channel.
10091%
dirkb797b2c2016-02-01 22:20:32 +010010092% The format of the MagickSetImageMatte method is:
cristy3ed852e2009-09-05 21:47:34 +000010093%
dirkb797b2c2016-02-01 22:20:32 +010010094% MagickBooleanType MagickSetImageMatte(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +000010095% const MagickBooleanType *matte)
10096%
10097% A description of each parameter follows:
10098%
10099% o wand: the magick wand.
10100%
10101% o matte: Set to MagickTrue to enable the image matte channel otherwise
10102% MagickFalse.
10103%
10104*/
10105WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10106 const MagickBooleanType matte)
10107{
10108 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010109 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010110 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010111 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10112 if (wand->images == (Image *) NULL)
10113 ThrowWandException(WandError,"ContainsNoImages",wand->name);
dirkb9dbc292015-07-26 09:50:00 +000010114 if (matte == MagickFalse)
10115 wand->images->alpha_trait=UndefinedPixelTrait;
10116 else
10117 {
10118 if (wand->images->alpha_trait == UndefinedPixelTrait)
10119 (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10120 wand->images->alpha_trait=BlendPixelTrait;
10121 }
cristy3ed852e2009-09-05 21:47:34 +000010122 return(MagickTrue);
10123}
10124
10125/*
10126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10127% %
10128% %
10129% %
cristy3ed852e2009-09-05 21:47:34 +000010130% M a g i c k S e t I m a g e O p a c i t y %
10131% %
10132% %
10133% %
10134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10135%
cristyb6a294d2011-10-03 00:55:17 +000010136% MagickSetImageAlpha() sets the image to the specified alpha level.
cristy3ed852e2009-09-05 21:47:34 +000010137%
cristyb6a294d2011-10-03 00:55:17 +000010138% The format of the MagickSetImageAlpha method is:
cristy3ed852e2009-09-05 21:47:34 +000010139%
cristyb6a294d2011-10-03 00:55:17 +000010140% MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +000010141% const double alpha)
10142%
10143% A description of each parameter follows:
10144%
10145% o wand: the magick wand.
10146%
10147% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10148% transparent.
10149%
10150*/
cristyb6a294d2011-10-03 00:55:17 +000010151WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
cristy3ed852e2009-09-05 21:47:34 +000010152 const double alpha)
10153{
10154 MagickBooleanType
10155 status;
10156
10157 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010158 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010159 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010160 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10161 if (wand->images == (Image *) NULL)
10162 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +000010163 status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10164 wand->exception);
cristy220c4d52013-11-27 19:31:32 +000010165 return(status);
cristy3ed852e2009-09-05 21:47:34 +000010166}
10167
10168/*
10169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10170% %
10171% %
10172% %
10173% 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 %
10174% %
10175% %
10176% %
10177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10178%
10179% MagickSetImageOrientation() sets the image orientation.
10180%
10181% The format of the MagickSetImageOrientation method is:
10182%
10183% MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10184% const OrientationType orientation)
10185%
10186% A description of each parameter follows:
10187%
10188% o wand: the magick wand.
10189%
10190% o orientation: the image orientation type.
10191%
10192*/
10193WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10194 const OrientationType orientation)
10195{
10196 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010197 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010198 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010199 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10200 if (wand->images == (Image *) NULL)
10201 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10202 wand->images->orientation=orientation;
10203 return(MagickTrue);
10204}
10205
10206/*
10207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10208% %
10209% %
10210% %
10211% M a g i c k S e t I m a g e P a g e %
10212% %
10213% %
10214% %
10215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10216%
10217% MagickSetImagePage() sets the page geometry of the image.
10218%
10219% The format of the MagickSetImagePage method is:
10220%
cristy5221b602012-10-30 18:02:55 +000010221% 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 +000010222%
10223% A description of each parameter follows:
10224%
10225% o wand: the magick wand.
10226%
10227% o width: the page width.
10228%
10229% o height: the page height.
10230%
10231% o x: the page x-offset.
10232%
10233% o y: the page y-offset.
10234%
10235*/
10236WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010237 const size_t width,const size_t height,const ssize_t x,
10238 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010239{
10240 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010241 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010242 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010243 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10244 if (wand->images == (Image *) NULL)
10245 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10246 wand->images->page.width=width;
10247 wand->images->page.height=height;
10248 wand->images->page.x=x;
10249 wand->images->page.y=y;
10250 return(MagickTrue);
10251}
10252
10253/*
10254%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10255% %
10256% %
10257% %
10258% 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 %
10259% %
10260% %
10261% %
10262%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10263%
10264% MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10265% specified method and returns the previous progress monitor if any. The
10266% progress monitor method looks like this:
10267%
10268% MagickBooleanType MagickProgressMonitor(const char *text,
10269% const MagickOffsetType offset,const MagickSizeType span,
10270% void *client_data)
10271%
10272% If the progress monitor returns MagickFalse, the current operation is
10273% interrupted.
10274%
10275% The format of the MagickSetImageProgressMonitor method is:
10276%
10277% MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10278% const MagickProgressMonitor progress_monitor,void *client_data)
10279%
10280% A description of each parameter follows:
10281%
10282% o wand: the magick wand.
10283%
10284% o progress_monitor: Specifies a pointer to a method to monitor progress
10285% of an image operation.
10286%
10287% o client_data: Specifies a pointer to any client data.
10288%
10289*/
10290WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10291 const MagickProgressMonitor progress_monitor,void *client_data)
10292{
10293 MagickProgressMonitor
10294 previous_monitor;
10295
10296 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010297 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010298 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010299 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10300 if (wand->images == (Image *) NULL)
10301 {
10302 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000010303 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000010304 return((MagickProgressMonitor) NULL);
10305 }
10306 previous_monitor=SetImageProgressMonitor(wand->images,
10307 progress_monitor,client_data);
10308 return(previous_monitor);
10309}
10310
10311/*
10312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10313% %
10314% %
10315% %
10316% M a g i c k S e t I m a g e R e d P r i m a r y %
10317% %
10318% %
10319% %
10320%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10321%
10322% MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10323%
10324% The format of the MagickSetImageRedPrimary method is:
10325%
10326% MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +010010327% const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +000010328%
10329% A description of each parameter follows:
10330%
10331% o wand: the magick wand.
10332%
10333% o x: the red primary x-point.
10334%
10335% o y: the red primary y-point.
10336%
dirk98e4a9a2016-01-15 11:49:10 +010010337% o z: the red primary z-point.
10338%
cristy3ed852e2009-09-05 21:47:34 +000010339*/
10340WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +010010341 const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +000010342{
10343 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010344 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010345 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010346 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10347 if (wand->images == (Image *) NULL)
10348 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10349 wand->images->chromaticity.red_primary.x=x;
10350 wand->images->chromaticity.red_primary.y=y;
dirk98e4a9a2016-01-15 11:49:10 +010010351 wand->images->chromaticity.red_primary.z=z;
cristy3ed852e2009-09-05 21:47:34 +000010352 return(MagickTrue);
10353}
10354
10355/*
10356%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10357% %
10358% %
10359% %
10360% 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 %
10361% %
10362% %
10363% %
10364%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10365%
10366% MagickSetImageRenderingIntent() sets the image rendering intent.
10367%
10368% The format of the MagickSetImageRenderingIntent method is:
10369%
10370% MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10371% const RenderingIntent rendering_intent)
10372%
10373% A description of each parameter follows:
10374%
10375% o wand: the magick wand.
10376%
10377% o rendering_intent: the image rendering intent: UndefinedIntent,
10378% SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10379%
10380*/
10381WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10382 const RenderingIntent rendering_intent)
10383{
10384 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010385 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010386 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010387 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10388 if (wand->images == (Image *) NULL)
10389 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10390 wand->images->rendering_intent=rendering_intent;
10391 return(MagickTrue);
10392}
10393
10394/*
10395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10396% %
10397% %
10398% %
10399% M a g i c k S e t I m a g e R e s o l u t i o n %
10400% %
10401% %
10402% %
10403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10404%
10405% MagickSetImageResolution() sets the image resolution.
10406%
10407% The format of the MagickSetImageResolution method is:
10408%
10409% MagickBooleanType MagickSetImageResolution(MagickWand *wand,
cristy968b9612012-04-25 20:34:18 +000010410% const double x_resolution,const double y_resolution)
cristy3ed852e2009-09-05 21:47:34 +000010411%
10412% A description of each parameter follows:
10413%
10414% o wand: the magick wand.
10415%
10416% o x_resolution: the image x resolution.
10417%
10418% o y_resolution: the image y resolution.
10419%
10420*/
10421WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10422 const double x_resolution,const double y_resolution)
10423{
10424 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010425 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010426 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010427 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10428 if (wand->images == (Image *) NULL)
10429 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy2a11bef2011-10-28 18:33:11 +000010430 wand->images->resolution.x=x_resolution;
10431 wand->images->resolution.y=y_resolution;
cristy3ed852e2009-09-05 21:47:34 +000010432 return(MagickTrue);
10433}
10434
10435/*
10436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10437% %
10438% %
10439% %
10440% M a g i c k S e t I m a g e S c e n e %
10441% %
10442% %
10443% %
10444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10445%
10446% MagickSetImageScene() sets the image scene.
10447%
10448% The format of the MagickSetImageScene method is:
10449%
10450% MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010451% const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +000010452%
10453% A description of each parameter follows:
10454%
10455% o wand: the magick wand.
10456%
10457% o delay: the image scene number.
10458%
10459*/
10460WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010461 const size_t scene)
cristy3ed852e2009-09-05 21:47:34 +000010462{
10463 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010464 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010465 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010466 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10467 if (wand->images == (Image *) NULL)
10468 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10469 wand->images->scene=scene;
10470 return(MagickTrue);
10471}
10472
10473/*
10474%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10475% %
10476% %
10477% %
10478% 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 %
10479% %
10480% %
10481% %
10482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10483%
10484% MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10485%
10486% The format of the MagickSetImageTicksPerSecond method is:
10487%
10488% MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010489% const ssize_t ticks_per-second)
cristy3ed852e2009-09-05 21:47:34 +000010490%
10491% A description of each parameter follows:
10492%
10493% o wand: the magick wand.
10494%
10495% o ticks_per_second: the units to use for the image delay.
10496%
10497*/
10498WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010499 const ssize_t ticks_per_second)
cristy3ed852e2009-09-05 21:47:34 +000010500{
10501 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010502 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010503 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010504 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10505 if (wand->images == (Image *) NULL)
10506 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10507 wand->images->ticks_per_second=ticks_per_second;
10508 return(MagickTrue);
10509}
10510
10511/*
10512%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10513% %
10514% %
10515% %
10516% M a g i c k S e t I m a g e T y p e %
10517% %
10518% %
10519% %
10520%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10521%
10522% MagickSetImageType() sets the image type.
10523%
10524% The format of the MagickSetImageType method is:
10525%
10526% MagickBooleanType MagickSetImageType(MagickWand *wand,
10527% const ImageType image_type)
10528%
10529% A description of each parameter follows:
10530%
10531% o wand: the magick wand.
10532%
cristy5f1c1ff2010-12-23 21:38:06 +000010533% o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
cristydef23e52015-01-22 11:52:01 +000010534% GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
10535% TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
cristy3ed852e2009-09-05 21:47:34 +000010536% or OptimizeType.
10537%
10538*/
10539WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10540 const ImageType image_type)
10541{
10542 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010543 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010544 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010545 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10546 if (wand->images == (Image *) NULL)
10547 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy018f07f2011-09-04 21:15:19 +000010548 return(SetImageType(wand->images,image_type,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000010549}
10550
10551/*
10552%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10553% %
10554% %
10555% %
10556% M a g i c k S e t I m a g e U n i t s %
10557% %
10558% %
10559% %
10560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10561%
10562% MagickSetImageUnits() sets the image units of resolution.
10563%
10564% The format of the MagickSetImageUnits method is:
10565%
10566% MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10567% const ResolutionType units)
10568%
10569% A description of each parameter follows:
10570%
10571% o wand: the magick wand.
10572%
10573% o units: the image units of resolution : UndefinedResolution,
10574% PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10575%
10576*/
10577WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10578 const ResolutionType units)
10579{
10580 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010581 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010582 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010583 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10584 if (wand->images == (Image *) NULL)
10585 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10586 wand->images->units=units;
10587 return(MagickTrue);
10588}
10589
10590/*
10591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10592% %
10593% %
10594% %
10595% 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 %
10596% %
10597% %
10598% %
10599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10600%
10601% MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10602%
10603% The format of the MagickSetImageVirtualPixelMethod method is:
10604%
10605% VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10606% const VirtualPixelMethod method)
10607%
10608% A description of each parameter follows:
10609%
10610% o wand: the magick wand.
10611%
10612% o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10613% ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
10614% MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10615%
10616*/
10617WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10618 const VirtualPixelMethod method)
10619{
10620 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010621 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010622 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010623 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10624 if (wand->images == (Image *) NULL)
10625 return(UndefinedVirtualPixelMethod);
cristy387430f2012-02-07 13:09:46 +000010626 return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000010627}
10628
10629/*
10630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10631% %
10632% %
10633% %
10634% M a g i c k S e t I m a g e W h i t e P o i n t %
10635% %
10636% %
10637% %
10638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10639%
10640% MagickSetImageWhitePoint() sets the image chromaticity white point.
10641%
10642% The format of the MagickSetImageWhitePoint method is:
10643%
10644% MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +010010645% const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +000010646%
10647% A description of each parameter follows:
10648%
10649% o wand: the magick wand.
10650%
10651% o x: the white x-point.
10652%
10653% o y: the white y-point.
10654%
dirk98e4a9a2016-01-15 11:49:10 +010010655% o z: the white z-point.
10656%
cristy3ed852e2009-09-05 21:47:34 +000010657*/
10658WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
dirk98e4a9a2016-01-15 11:49:10 +010010659 const double x,const double y,const double z)
cristy3ed852e2009-09-05 21:47:34 +000010660{
10661 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010662 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010663 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010664 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10665 if (wand->images == (Image *) NULL)
10666 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10667 wand->images->chromaticity.white_point.x=x;
10668 wand->images->chromaticity.white_point.y=y;
dirk98e4a9a2016-01-15 11:49:10 +010010669 wand->images->chromaticity.white_point.z=z;
cristy3ed852e2009-09-05 21:47:34 +000010670 return(MagickTrue);
10671}
10672
10673/*
10674%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10675% %
10676% %
10677% %
10678% M a g i c k S h a d e I m a g e C h a n n e l %
10679% %
10680% %
10681% %
10682%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10683%
10684% MagickShadeImage() shines a distant light on an image to create a
10685% three-dimensional effect. You control the positioning of the light with
10686% azimuth and elevation; azimuth is measured in degrees off the x axis
10687% and elevation is measured in pixels above the Z axis.
10688%
10689% The format of the MagickShadeImage method is:
10690%
10691% MagickBooleanType MagickShadeImage(MagickWand *wand,
10692% const MagickBooleanType gray,const double azimuth,
10693% const double elevation)
10694%
10695% A description of each parameter follows:
10696%
10697% o wand: the magick wand.
10698%
10699% o gray: A value other than zero shades the intensity of each pixel.
10700%
10701% o azimuth, elevation: Define the light source direction.
10702%
10703*/
10704WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10705 const MagickBooleanType gray,const double asimuth,const double elevation)
10706{
10707 Image
10708 *shade_image;
10709
10710 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010711 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010712 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010713 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10714 if (wand->images == (Image *) NULL)
10715 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10716 shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10717 if (shade_image == (Image *) NULL)
10718 return(MagickFalse);
10719 ReplaceImageInList(&wand->images,shade_image);
10720 return(MagickTrue);
10721}
10722
10723/*
10724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10725% %
10726% %
10727% %
10728% M a g i c k S h a d o w I m a g e %
10729% %
10730% %
10731% %
10732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10733%
10734% MagickShadowImage() simulates an image shadow.
10735%
10736% The format of the MagickShadowImage method is:
10737%
cristyaa2c16c2012-03-25 22:21:35 +000010738% MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10739% const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010740%
10741% A description of each parameter follows:
10742%
10743% o wand: the magick wand.
10744%
cristyb6a294d2011-10-03 00:55:17 +000010745% o alpha: percentage transparency.
cristy3ed852e2009-09-05 21:47:34 +000010746%
10747% o sigma: the standard deviation of the Gaussian, in pixels.
10748%
10749% o x: the shadow x-offset.
10750%
10751% o y: the shadow y-offset.
10752%
10753*/
10754WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010755 const double alpha,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000010756{
10757 Image
10758 *shadow_image;
10759
10760 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010761 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010762 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010763 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10764 if (wand->images == (Image *) NULL)
10765 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000010766 shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010767 if (shadow_image == (Image *) NULL)
10768 return(MagickFalse);
10769 ReplaceImageInList(&wand->images,shadow_image);
10770 return(MagickTrue);
10771}
10772
10773/*
10774%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10775% %
10776% %
10777% %
10778% M a g i c k S h a r p e n I m a g e %
10779% %
10780% %
10781% %
10782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10783%
10784% MagickSharpenImage() sharpens an image. We convolve the image with a
10785% Gaussian operator of the given radius and standard deviation (sigma).
10786% For reasonable results, the radius should be larger than sigma. Use a
10787% radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10788%
10789% The format of the MagickSharpenImage method is:
10790%
10791% MagickBooleanType MagickSharpenImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010792% const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +000010793%
10794% A description of each parameter follows:
10795%
10796% o wand: the magick wand.
10797%
cristy3ed852e2009-09-05 21:47:34 +000010798% o radius: the radius of the Gaussian, in pixels, not counting the center
10799% pixel.
10800%
10801% o sigma: the standard deviation of the Gaussian, in pixels.
10802%
10803*/
cristy3ed852e2009-09-05 21:47:34 +000010804WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000010805 const double radius,const double sigma)
cristy3ed852e2009-09-05 21:47:34 +000010806{
cristy3ed852e2009-09-05 21:47:34 +000010807 Image
10808 *sharp_image;
10809
10810 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010811 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010812 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010813 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10814 if (wand->images == (Image *) NULL)
10815 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000010816 sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000010817 if (sharp_image == (Image *) NULL)
10818 return(MagickFalse);
10819 ReplaceImageInList(&wand->images,sharp_image);
10820 return(MagickTrue);
10821}
10822
10823/*
10824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10825% %
10826% %
10827% %
10828% M a g i c k S h a v e I m a g e %
10829% %
10830% %
10831% %
10832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10833%
10834% MagickShaveImage() shaves pixels from the image edges. It allocates the
10835% memory necessary for the new Image structure and returns a pointer to the
10836% new image.
10837%
10838% The format of the MagickShaveImage method is:
10839%
10840% MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010841% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010842%
10843% A description of each parameter follows:
10844%
10845% o wand: the magick wand.
10846%
10847% o columns: the number of columns in the scaled image.
10848%
10849% o rows: the number of rows in the scaled image.
10850%
10851%
10852*/
10853WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000010854 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000010855{
10856 Image
10857 *shave_image;
10858
10859 RectangleInfo
10860 shave_info;
10861
10862 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010863 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010864 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010865 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10866 if (wand->images == (Image *) NULL)
10867 ThrowWandException(WandError,"ContainsNoImages",wand->name);
10868 shave_info.width=columns;
10869 shave_info.height=rows;
10870 shave_info.x=0;
10871 shave_info.y=0;
10872 shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10873 if (shave_image == (Image *) NULL)
10874 return(MagickFalse);
10875 ReplaceImageInList(&wand->images,shave_image);
10876 return(MagickTrue);
10877}
10878
10879/*
10880%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10881% %
10882% %
10883% %
10884% M a g i c k S h e a r I m a g e %
10885% %
10886% %
10887% %
10888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10889%
cristycee97112010-05-28 00:44:52 +000010890% MagickShearImage() slides one edge of an image along the X or Y axis,
10891% creating a parallelogram. An X direction shear slides an edge along the X
10892% axis, while a Y direction shear slides an edge along the Y axis. The amount
cristy3ed852e2009-09-05 21:47:34 +000010893% of the shear is controlled by a shear angle. For X direction shears, x_shear
10894% is measured relative to the Y axis, and similarly, for Y direction shears
10895% y_shear is measured relative to the X axis. Empty triangles left over from
10896% shearing the image are filled with the background color.
10897%
10898% The format of the MagickShearImage method is:
10899%
10900% MagickBooleanType MagickShearImage(MagickWand *wand,
cristy968b9612012-04-25 20:34:18 +000010901% const PixelWand *background,const double x_shear,const double y_shear)
cristy3ed852e2009-09-05 21:47:34 +000010902%
10903% A description of each parameter follows:
10904%
10905% o wand: the magick wand.
10906%
10907% o background: the background pixel wand.
10908%
10909% o x_shear: the number of degrees to shear the image.
10910%
10911% o y_shear: the number of degrees to shear the image.
10912%
10913*/
10914WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10915 const PixelWand *background,const double x_shear,const double y_shear)
10916{
10917 Image
10918 *shear_image;
10919
10920 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010921 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010922 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010923 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10924 if (wand->images == (Image *) NULL)
10925 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy4c08aed2011-07-01 19:47:50 +000010926 PixelGetQuantumPacket(background,&wand->images->background_color);
cristy3ed852e2009-09-05 21:47:34 +000010927 shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10928 if (shear_image == (Image *) NULL)
10929 return(MagickFalse);
10930 ReplaceImageInList(&wand->images,shear_image);
10931 return(MagickTrue);
10932}
10933
10934/*
10935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10936% %
10937% %
10938% %
10939% 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 %
10940% %
10941% %
10942% %
10943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10944%
10945% MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10946% non-linear sigmoidal contrast algorithm. Increase the contrast of the
10947% image using a sigmoidal transfer function without saturating highlights or
10948% shadows. Contrast indicates how much to increase the contrast (0 is none;
10949% 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10950% the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
10951% sharpen to MagickTrue to increase the image contrast otherwise the contrast
10952% is reduced.
10953%
10954% The format of the MagickSigmoidalContrastImage method is:
10955%
10956% MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10957% const MagickBooleanType sharpen,const double alpha,const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010958%
10959% A description of each parameter follows:
10960%
10961% o wand: the magick wand.
10962%
cristy3ed852e2009-09-05 21:47:34 +000010963% o sharpen: Increase or decrease image contrast.
10964%
cristyfa769582010-09-30 23:30:03 +000010965% o alpha: strength of the contrast, the larger the number the more
10966% 'threshold-like' it becomes.
cristy3ed852e2009-09-05 21:47:34 +000010967%
cristyfa769582010-09-30 23:30:03 +000010968% o beta: midpoint of the function as a color value 0 to QuantumRange.
cristy3ed852e2009-09-05 21:47:34 +000010969%
10970*/
cristy9ee60942011-07-06 14:54:38 +000010971WandExport MagickBooleanType MagickSigmoidalContrastImage(
10972 MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10973 const double beta)
cristy3ed852e2009-09-05 21:47:34 +000010974{
10975 MagickBooleanType
10976 status;
10977
10978 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000010979 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010010980 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000010981 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10982 if (wand->images == (Image *) NULL)
10983 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy33bd5152011-08-24 01:42:24 +000010984 status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
cristy5f49bdb2011-10-16 14:28:56 +000010985 wand->exception);
cristy220c4d52013-11-27 19:31:32 +000010986 return(status);
cristy3ed852e2009-09-05 21:47:34 +000010987}
10988
10989/*
10990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10991% %
10992% %
10993% %
10994% M a g i c k S i m i l a r i t y I m a g e %
10995% %
10996% %
10997% %
10998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10999%
11000% MagickSimilarityImage() compares the reference image of the image and
11001% returns the best match offset. In addition, it returns a similarity image
11002% such that an exact match location is completely white and if none of the
11003% pixels match, black, otherwise some gray level in-between.
11004%
11005% The format of the MagickSimilarityImage method is:
11006%
11007% MagickWand *MagickSimilarityImage(MagickWand *wand,
cristy09136812011-10-18 15:24:30 +000011008% const MagickWand *reference,const MetricType metric,
cristy4dab3802013-03-15 22:08:15 +000011009% const double similarity_threshold,RectangeInfo *offset,
11010% double *similarity)
cristy3ed852e2009-09-05 21:47:34 +000011011%
11012% A description of each parameter follows:
11013%
11014% o wand: the magick wand.
11015%
11016% o reference: the reference wand.
11017%
cristy09136812011-10-18 15:24:30 +000011018% o metric: the metric.
11019%
cristy4dab3802013-03-15 22:08:15 +000011020% o similarity_threshold: minimum distortion for (sub)image match.
11021%
cristy3ed852e2009-09-05 21:47:34 +000011022% o offset: the best match offset of the reference image within the image.
11023%
11024% o similarity: the computed similarity between the images.
11025%
11026*/
11027WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
cristy4dab3802013-03-15 22:08:15 +000011028 const MagickWand *reference,const MetricType metric,
11029 const double similarity_threshold,RectangleInfo *offset,double *similarity)
cristy3ed852e2009-09-05 21:47:34 +000011030{
11031 Image
11032 *similarity_image;
11033
11034 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011035 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011036 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011037 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11038 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11039 {
11040 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000011041 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000011042 return((MagickWand *) NULL);
11043 }
cristy4dab3802013-03-15 22:08:15 +000011044 similarity_image=SimilarityImage(wand->images,reference->images,metric,
11045 similarity_threshold,offset,similarity,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011046 if (similarity_image == (Image *) NULL)
11047 return((MagickWand *) NULL);
11048 return(CloneMagickWandFromImages(wand,similarity_image));
11049}
11050
11051/*
11052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11053% %
11054% %
11055% %
11056% M a g i c k S k e t c h I m a g e %
11057% %
11058% %
11059% %
11060%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11061%
11062% MagickSketchImage() simulates a pencil sketch. We convolve the image with
11063% a Gaussian operator of the given radius and standard deviation (sigma).
11064% For reasonable results, radius should be larger than sigma. Use a
11065% radius of 0 and SketchImage() selects a suitable radius for you.
11066% Angle gives the angle of the blurring motion.
11067%
11068% The format of the MagickSketchImage method is:
11069%
11070% MagickBooleanType MagickSketchImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000011071% const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +000011072%
11073% A description of each parameter follows:
11074%
11075% o wand: the magick wand.
11076%
11077% o radius: the radius of the Gaussian, in pixels, not counting
11078% the center pixel.
11079%
11080% o sigma: the standard deviation of the Gaussian, in pixels.
11081%
cristyf7ef0252011-09-09 14:50:06 +000011082% o angle: apply the effect along this angle.
11083%
cristy3ed852e2009-09-05 21:47:34 +000011084*/
11085WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000011086 const double radius,const double sigma,const double angle)
cristy3ed852e2009-09-05 21:47:34 +000011087{
11088 Image
11089 *sketch_image;
11090
11091 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011092 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011093 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011094 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11095 if (wand->images == (Image *) NULL)
11096 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000011097 sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011098 if (sketch_image == (Image *) NULL)
11099 return(MagickFalse);
11100 ReplaceImageInList(&wand->images,sketch_image);
11101 return(MagickTrue);
11102}
11103
11104/*
11105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11106% %
11107% %
11108% %
cristy4285d782011-02-09 20:12:28 +000011109% M a g i c k S m u s h I m a g e s %
11110% %
11111% %
11112% %
11113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11114%
11115% MagickSmushImages() takes all images from the current image pointer to the
11116% end of the image list and smushs them to each other top-to-bottom if the
11117% stack parameter is true, otherwise left-to-right.
11118%
11119% The format of the MagickSmushImages method is:
11120%
11121% MagickWand *MagickSmushImages(MagickWand *wand,
11122% const MagickBooleanType stack,const ssize_t offset)
11123%
11124% A description of each parameter follows:
11125%
11126% o wand: the magick wand.
11127%
11128% o stack: By default, images are stacked left-to-right. Set stack to
11129% MagickTrue to stack them top-to-bottom.
11130%
11131% o offset: minimum distance in pixels between images.
11132%
11133*/
11134WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11135 const MagickBooleanType stack,const ssize_t offset)
11136{
11137 Image
11138 *smush_image;
11139
11140 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011141 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011142 if (wand->debug != MagickFalse)
cristy4285d782011-02-09 20:12:28 +000011143 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11144 if (wand->images == (Image *) NULL)
11145 return((MagickWand *) NULL);
11146 smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11147 if (smush_image == (Image *) NULL)
11148 return((MagickWand *) NULL);
11149 return(CloneMagickWandFromImages(wand,smush_image));
11150}
11151
11152/*
11153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11154% %
11155% %
11156% %
cristy3ed852e2009-09-05 21:47:34 +000011157% M a g i c k S o l a r i z e I m a g e %
11158% %
11159% %
11160% %
11161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11162%
11163% MagickSolarizeImage() applies a special effect to the image, similar to the
11164% effect achieved in a photo darkroom by selectively exposing areas of photo
11165% sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
11166% measure of the extent of the solarization.
11167%
11168% The format of the MagickSolarizeImage method is:
11169%
11170% MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11171% const double threshold)
11172%
11173% A description of each parameter follows:
11174%
11175% o wand: the magick wand.
11176%
11177% o threshold: Define the extent of the solarization.
11178%
11179*/
11180WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11181 const double threshold)
11182{
11183 MagickBooleanType
11184 status;
11185
11186 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011187 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011188 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011189 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11190 if (wand->images == (Image *) NULL)
11191 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5f49bdb2011-10-16 14:28:56 +000011192 status=SolarizeImage(wand->images,threshold,wand->exception);
cristy220c4d52013-11-27 19:31:32 +000011193 return(status);
cristy3ed852e2009-09-05 21:47:34 +000011194}
11195
11196/*
11197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11198% %
11199% %
11200% %
11201% M a g i c k S p a r s e C o l o r I m a g e %
11202% %
11203% %
11204% %
11205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11206%
11207% MagickSparseColorImage(), given a set of coordinates, interpolates the
11208% colors found at those coordinates, across the whole image, using various
11209% methods.
11210%
11211% The format of the MagickSparseColorImage method is:
11212%
11213% MagickBooleanType MagickSparseColorImage(MagickWand *wand,
cristy3884f692011-07-08 18:00:18 +000011214% const SparseColorMethod method,const size_t number_arguments,
11215% const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000011216%
11217% A description of each parameter follows:
11218%
11219% o image: the image to be sparseed.
11220%
11221% o method: the method of image sparseion.
11222%
11223% ArcSparseColorion will always ignore source image offset, and always
11224% 'bestfit' the destination image with the top left corner offset
11225% relative to the polar mapping center.
11226%
11227% Bilinear has no simple inverse mapping so will not allow 'bestfit'
11228% style of image sparseion.
11229%
11230% Affine, Perspective, and Bilinear, will do least squares fitting of
11231% the distrotion when more than the minimum number of control point
11232% pairs are provided.
11233%
11234% Perspective, and Bilinear, will fall back to a Affine sparseion when
11235% less than 4 control point pairs are provided. While Affine sparseions
11236% will let you use any number of control point pairs, that is Zero pairs
11237% is a No-Op (viewport only) distrotion, one pair is a translation and
11238% two pairs of control points will do a scale-rotate-translate, without
11239% any shearing.
11240%
11241% o number_arguments: the number of arguments given for this sparseion
11242% method.
11243%
11244% o arguments: the arguments for this sparseion method.
11245%
11246*/
11247WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
cristy3884f692011-07-08 18:00:18 +000011248 const SparseColorMethod method,const size_t number_arguments,
11249 const double *arguments)
cristy3ed852e2009-09-05 21:47:34 +000011250{
11251 Image
11252 *sparse_image;
11253
11254 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011255 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011256 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011257 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11258 if (wand->images == (Image *) NULL)
11259 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3884f692011-07-08 18:00:18 +000011260 sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11261 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011262 if (sparse_image == (Image *) NULL)
11263 return(MagickFalse);
11264 ReplaceImageInList(&wand->images,sparse_image);
11265 return(MagickTrue);
11266}
11267
11268/*
11269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11270% %
11271% %
11272% %
11273% M a g i c k S p l i c e I m a g e %
11274% %
11275% %
11276% %
11277%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11278%
11279% MagickSpliceImage() splices a solid color into the image.
11280%
11281% The format of the MagickSpliceImage method is:
11282%
11283% MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011284% const size_t width,const size_t height,const ssize_t x,
11285% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011286%
11287% A description of each parameter follows:
11288%
11289% o wand: the magick wand.
11290%
11291% o width: the region width.
11292%
11293% o height: the region height.
11294%
11295% o x: the region x offset.
11296%
11297% o y: the region y offset.
11298%
11299*/
11300WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011301 const size_t width,const size_t height,const ssize_t x,
11302 const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000011303{
11304 Image
11305 *splice_image;
11306
11307 RectangleInfo
11308 splice;
11309
11310 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011311 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011312 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011313 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11314 if (wand->images == (Image *) NULL)
11315 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11316 splice.width=width;
11317 splice.height=height;
11318 splice.x=x;
11319 splice.y=y;
11320 splice_image=SpliceImage(wand->images,&splice,wand->exception);
11321 if (splice_image == (Image *) NULL)
11322 return(MagickFalse);
11323 ReplaceImageInList(&wand->images,splice_image);
11324 return(MagickTrue);
11325}
11326
11327/*
11328%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11329% %
11330% %
11331% %
11332% M a g i c k S p r e a d I m a g e %
11333% %
11334% %
11335% %
11336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11337%
11338% MagickSpreadImage() is a special effects method that randomly displaces each
11339% pixel in a block defined by the radius parameter.
11340%
11341% The format of the MagickSpreadImage method is:
11342%
Cristybe4c4f12015-08-25 07:12:38 -040011343% MagickBooleanType MagickSpreadImage(MagickWand *wand,
11344% const PixelInterpolateMethod method,const double radius)
Cristycc332e32015-08-09 12:15:50 -040011345%
cristy3ed852e2009-09-05 21:47:34 +000011346% A description of each parameter follows:
11347%
11348% o wand: the magick wand.
11349%
Cristybe4c4f12015-08-25 07:12:38 -040011350% o method: intepolation method.
11351%
cristy3ed852e2009-09-05 21:47:34 +000011352% o radius: Choose a random pixel in a neighborhood of this extent.
11353%
11354*/
11355WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
Cristybe4c4f12015-08-25 07:12:38 -040011356 const PixelInterpolateMethod method,const double radius)
cristy3ed852e2009-09-05 21:47:34 +000011357{
11358 Image
11359 *spread_image;
11360
11361 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011362 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011363 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011364 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11365 if (wand->images == (Image *) NULL)
11366 ThrowWandException(WandError,"ContainsNoImages",wand->name);
Cristybe4c4f12015-08-25 07:12:38 -040011367 spread_image=SpreadImage(wand->images,method,radius,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011368 if (spread_image == (Image *) NULL)
11369 return(MagickFalse);
11370 ReplaceImageInList(&wand->images,spread_image);
11371 return(MagickTrue);
11372}
11373
11374/*
11375%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11376% %
11377% %
11378% %
cristy12453682011-03-18 18:45:04 +000011379% M a g i c k S t a t i s t i c I m a g e %
11380% %
11381% %
11382% %
11383%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11384%
11385% MagickStatisticImage() replace each pixel with corresponding statistic from
cristy8d752042011-03-19 01:00:36 +000011386% the neighborhood of the specified width and height.
cristy12453682011-03-18 18:45:04 +000011387%
11388% The format of the MagickStatisticImage method is:
11389%
11390% MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristy95c38342011-03-18 22:39:51 +000011391% const StatisticType type,const double width,const size_t height)
cristy12453682011-03-18 18:45:04 +000011392%
11393% A description of each parameter follows:
11394%
11395% o wand: the magick wand.
11396%
cristy12453682011-03-18 18:45:04 +000011397% o type: the statistic type (e.g. median, mode, etc.).
11398%
cristy8d752042011-03-19 01:00:36 +000011399% o width: the width of the pixel neighborhood.
11400%
11401% o height: the height of the pixel neighborhood.
cristy12453682011-03-18 18:45:04 +000011402%
11403*/
11404WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
cristyf4ad9df2011-07-08 16:49:03 +000011405 const StatisticType type,const size_t width,const size_t height)
cristy12453682011-03-18 18:45:04 +000011406{
11407 Image
11408 *statistic_image;
11409
11410 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011411 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011412 if (wand->debug != MagickFalse)
cristy12453682011-03-18 18:45:04 +000011413 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11414 if (wand->images == (Image *) NULL)
11415 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyf4ad9df2011-07-08 16:49:03 +000011416 statistic_image=StatisticImage(wand->images,type,width,height,
cristy12453682011-03-18 18:45:04 +000011417 wand->exception);
11418 if (statistic_image == (Image *) NULL)
11419 return(MagickFalse);
11420 ReplaceImageInList(&wand->images,statistic_image);
11421 return(MagickTrue);
11422}
11423
11424/*
11425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11426% %
11427% %
11428% %
cristy3ed852e2009-09-05 21:47:34 +000011429% M a g i c k S t e g a n o I m a g e %
11430% %
11431% %
11432% %
11433%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11434%
11435% MagickSteganoImage() hides a digital watermark within the image.
11436% Recover the hidden watermark later to prove that the authenticity of
11437% an image. Offset defines the start position within the image to hide
11438% the watermark.
11439%
11440% The format of the MagickSteganoImage method is:
11441%
11442% MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011443% const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000011444%
11445% A description of each parameter follows:
11446%
11447% o wand: the magick wand.
11448%
11449% o watermark_wand: the watermark wand.
11450%
11451% o offset: Start hiding at this offset into the image.
11452%
11453*/
11454WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011455 const MagickWand *watermark_wand,const ssize_t offset)
cristy3ed852e2009-09-05 21:47:34 +000011456{
11457 Image
11458 *stegano_image;
11459
11460 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011461 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011462 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011463 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11464 if ((wand->images == (Image *) NULL) ||
11465 (watermark_wand->images == (Image *) NULL))
11466 {
11467 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000011468 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000011469 return((MagickWand *) NULL);
11470 }
11471 wand->images->offset=offset;
11472 stegano_image=SteganoImage(wand->images,watermark_wand->images,
11473 wand->exception);
11474 if (stegano_image == (Image *) NULL)
11475 return((MagickWand *) NULL);
11476 return(CloneMagickWandFromImages(wand,stegano_image));
11477}
11478
11479/*
11480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11481% %
11482% %
11483% %
11484% M a g i c k S t e r e o I m a g e %
11485% %
11486% %
11487% %
11488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11489%
11490% MagickStereoImage() composites two images and produces a single image that
11491% is the composite of a left and right image of a stereo pair
11492%
11493% The format of the MagickStereoImage method is:
11494%
11495% MagickWand *MagickStereoImage(MagickWand *wand,
11496% const MagickWand *offset_wand)
11497%
11498% A description of each parameter follows:
11499%
11500% o wand: the magick wand.
11501%
11502% o offset_wand: Another image wand.
11503%
11504*/
11505WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11506 const MagickWand *offset_wand)
11507{
11508 Image
11509 *stereo_image;
11510
11511 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011512 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011513 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011514 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11515 if ((wand->images == (Image *) NULL) ||
11516 (offset_wand->images == (Image *) NULL))
11517 {
11518 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000011519 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000011520 return((MagickWand *) NULL);
11521 }
11522 stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11523 if (stereo_image == (Image *) NULL)
11524 return((MagickWand *) NULL);
11525 return(CloneMagickWandFromImages(wand,stereo_image));
11526}
11527
11528/*
11529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11530% %
11531% %
11532% %
11533% M a g i c k S t r i p I m a g e %
11534% %
11535% %
11536% %
11537%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11538%
11539% MagickStripImage() strips an image of all profiles and comments.
11540%
11541% The format of the MagickStripImage method is:
11542%
11543% MagickBooleanType MagickStripImage(MagickWand *wand)
11544%
11545% A description of each parameter follows:
11546%
11547% o wand: the magick wand.
11548%
11549*/
11550WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11551{
cristy3ed852e2009-09-05 21:47:34 +000011552 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011553 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011554 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011555 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11556 if (wand->images == (Image *) NULL)
11557 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +000011558 return(StripImage(wand->images,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000011559}
11560
11561/*
11562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11563% %
11564% %
11565% %
11566% M a g i c k S w i r l I m a g e %
11567% %
11568% %
11569% %
11570%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11571%
11572% MagickSwirlImage() swirls the pixels about the center of the image, where
11573% degrees indicates the sweep of the arc through which each pixel is moved.
11574% You get a more dramatic effect as the degrees move from 1 to 360.
11575%
11576% The format of the MagickSwirlImage method is:
11577%
cristy76f512e2011-09-12 01:26:56 +000011578% MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11579% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011580%
11581% A description of each parameter follows:
11582%
11583% o wand: the magick wand.
11584%
11585% o degrees: Define the tightness of the swirling effect.
11586%
cristy76f512e2011-09-12 01:26:56 +000011587% o method: the pixel interpolation method.
11588%
cristy3ed852e2009-09-05 21:47:34 +000011589*/
11590WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
cristy76f512e2011-09-12 01:26:56 +000011591 const double degrees,const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000011592{
11593 Image
11594 *swirl_image;
11595
11596 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011597 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011598 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011599 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11600 if (wand->images == (Image *) NULL)
11601 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +000011602 swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011603 if (swirl_image == (Image *) NULL)
11604 return(MagickFalse);
11605 ReplaceImageInList(&wand->images,swirl_image);
11606 return(MagickTrue);
11607}
11608
11609/*
11610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11611% %
11612% %
11613% %
11614% M a g i c k T e x t u r e I m a g e %
11615% %
11616% %
11617% %
11618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11619%
11620% MagickTextureImage() repeatedly tiles the texture image across and down the
11621% image canvas.
11622%
11623% The format of the MagickTextureImage method is:
11624%
11625% MagickWand *MagickTextureImage(MagickWand *wand,
11626% const MagickWand *texture_wand)
11627%
11628% A description of each parameter follows:
11629%
11630% o wand: the magick wand.
11631%
11632% o texture_wand: the texture wand
11633%
11634*/
11635WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11636 const MagickWand *texture_wand)
11637{
11638 Image
11639 *texture_image;
11640
11641 MagickBooleanType
11642 status;
11643
11644 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011645 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011646 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011647 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11648 if ((wand->images == (Image *) NULL) ||
11649 (texture_wand->images == (Image *) NULL))
11650 {
11651 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
cristyefe601c2013-01-05 17:51:12 +000011652 "ContainsNoImages","`%s'",wand->name);
cristy3ed852e2009-09-05 21:47:34 +000011653 return((MagickWand *) NULL);
11654 }
11655 texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11656 if (texture_image == (Image *) NULL)
11657 return((MagickWand *) NULL);
cristye941a752011-10-15 01:52:48 +000011658 status=TextureImage(texture_image,texture_wand->images,wand->exception);
dirk5d0a4412016-01-05 22:28:51 +010011659 if (status == MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011660 {
cristy3ed852e2009-09-05 21:47:34 +000011661 texture_image=DestroyImage(texture_image);
11662 return((MagickWand *) NULL);
11663 }
11664 return(CloneMagickWandFromImages(wand,texture_image));
11665}
11666
11667/*
11668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11669% %
11670% %
11671% %
11672% M a g i c k T h r e s h o l d I m a g e %
11673% %
11674% %
11675% %
11676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11677%
11678% MagickThresholdImage() changes the value of individual pixels based on
11679% the intensity of each pixel compared to threshold. The result is a
11680% high-contrast, two color image.
11681%
11682% The format of the MagickThresholdImage method is:
11683%
11684% MagickBooleanType MagickThresholdImage(MagickWand *wand,
11685% const double threshold)
11686% MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11687% const ChannelType channel,const double threshold)
11688%
11689% A description of each parameter follows:
11690%
11691% o wand: the magick wand.
11692%
11693% o channel: the image channel(s).
11694%
11695% o threshold: Define the threshold value.
11696%
11697*/
11698WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11699 const double threshold)
11700{
11701 MagickBooleanType
11702 status;
11703
11704 status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
cristy220c4d52013-11-27 19:31:32 +000011705 return(status);
cristy3ed852e2009-09-05 21:47:34 +000011706}
11707
11708WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11709 const ChannelType channel,const double threshold)
11710{
11711 MagickBooleanType
11712 status;
11713
11714 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011715 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011716 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011717 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11718 if (wand->images == (Image *) NULL)
11719 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +000011720 status=BilevelImage(wand->images,threshold,wand->exception);
cristy220c4d52013-11-27 19:31:32 +000011721 return(status);
cristy3ed852e2009-09-05 21:47:34 +000011722}
11723
11724/*
11725%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11726% %
11727% %
11728% %
11729% M a g i c k T h u m b n a i l I m a g e %
11730% %
11731% %
11732% %
11733%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11734%
11735% MagickThumbnailImage() changes the size of an image to the given dimensions
11736% and removes any associated profiles. The goal is to produce small low cost
11737% thumbnail images suited for display on the Web.
11738%
11739% The format of the MagickThumbnailImage method is:
11740%
11741% MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011742% const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011743%
11744% A description of each parameter follows:
11745%
11746% o wand: the magick wand.
11747%
11748% o columns: the number of columns in the scaled image.
11749%
11750% o rows: the number of rows in the scaled image.
11751%
11752*/
11753WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
cristybb503372010-05-27 20:51:26 +000011754 const size_t columns,const size_t rows)
cristy3ed852e2009-09-05 21:47:34 +000011755{
11756 Image
11757 *thumbnail_image;
11758
11759 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011760 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011761 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011762 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11763 if (wand->images == (Image *) NULL)
11764 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11765 thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11766 if (thumbnail_image == (Image *) NULL)
11767 return(MagickFalse);
11768 ReplaceImageInList(&wand->images,thumbnail_image);
11769 return(MagickTrue);
11770}
11771
11772/*
11773%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11774% %
11775% %
11776% %
11777% M a g i c k T i n t I m a g e %
11778% %
11779% %
11780% %
11781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11782%
11783% MagickTintImage() applies a color vector to each pixel in the image. The
11784% length of the vector is 0 for black and white and at its maximum for the
11785% midtones. The vector weighting function is
11786% f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11787%
11788% The format of the MagickTintImage method is:
11789%
11790% MagickBooleanType MagickTintImage(MagickWand *wand,
cristyb817c3f2011-10-03 14:00:35 +000011791% const PixelWand *tint,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +000011792%
11793% A description of each parameter follows:
11794%
11795% o wand: the magick wand.
11796%
11797% o tint: the tint pixel wand.
11798%
cristyb6a294d2011-10-03 00:55:17 +000011799% o alpha: the alpha pixel wand.
cristy3ed852e2009-09-05 21:47:34 +000011800%
11801*/
11802WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
cristyb817c3f2011-10-03 14:00:35 +000011803 const PixelWand *tint,const PixelWand *blend)
cristy3ed852e2009-09-05 21:47:34 +000011804{
11805 char
cristy151b66d2015-04-15 10:50:31 +000011806 percent_blend[MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +000011807
11808 Image
11809 *tint_image;
11810
cristy28474bf2011-09-11 23:32:52 +000011811 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000011812 target;
11813
11814 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011815 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011816 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011817 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11818 if (wand->images == (Image *) NULL)
11819 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy76f512e2011-09-12 01:26:56 +000011820 if (wand->images->colorspace != CMYKColorspace)
cristy151b66d2015-04-15 10:50:31 +000011821 (void) FormatLocaleString(percent_blend,MagickPathExtent,
cristy76f512e2011-09-12 01:26:56 +000011822 "%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristyb817c3f2011-10-03 14:00:35 +000011823 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11824 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11825 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11826 PixelGetAlphaQuantum(blend)));
cristy76f512e2011-09-12 01:26:56 +000011827 else
cristy151b66d2015-04-15 10:50:31 +000011828 (void) FormatLocaleString(percent_blend,MagickPathExtent,
cristy76f512e2011-09-12 01:26:56 +000011829 "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
cristyb817c3f2011-10-03 14:00:35 +000011830 PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11831 PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11832 PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11833 PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11834 PixelGetAlphaQuantum(blend)));
cristy28474bf2011-09-11 23:32:52 +000011835 target=PixelGetPixel(tint);
cristyb817c3f2011-10-03 14:00:35 +000011836 tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000011837 if (tint_image == (Image *) NULL)
11838 return(MagickFalse);
11839 ReplaceImageInList(&wand->images,tint_image);
11840 return(MagickTrue);
11841}
11842
11843/*
11844%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11845% %
11846% %
11847% %
cristy3ed852e2009-09-05 21:47:34 +000011848% 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 %
11849% %
11850% %
11851% %
11852%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11853%
anthony43054ce2012-04-24 05:35:44 +000011854% MagickTransformImageColorspace() transform the image colorspace, setting
11855% the images colorspace while transforming the images data to that
11856% colorspace.
cristy3ed852e2009-09-05 21:47:34 +000011857%
11858% The format of the MagickTransformImageColorspace method is:
11859%
11860% MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11861% const ColorspaceType colorspace)
11862%
11863% A description of each parameter follows:
11864%
11865% o wand: the magick wand.
11866%
anthony43054ce2012-04-24 05:35:44 +000011867% o colorspace: the image colorspace: UndefinedColorspace,
11868% sRGBColorspace, RGBColorspace, GRAYColorspace,
11869% OHTAColorspace, XYZColorspace, YCbCrColorspace,
11870% YCCColorspace, YIQColorspace, YPbPrColorspace,
11871% YPbPrColorspace, YUVColorspace, CMYKColorspace,
11872% HSLColorspace, HWBColorspace.
cristy3ed852e2009-09-05 21:47:34 +000011873%
11874*/
11875WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11876 const ColorspaceType colorspace)
11877{
11878 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011879 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011880 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011881 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11882 if (wand->images == (Image *) NULL)
11883 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristye941a752011-10-15 01:52:48 +000011884 return(TransformImageColorspace(wand->images,colorspace,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000011885}
11886
11887/*
11888%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11889% %
11890% %
11891% %
11892% 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 %
11893% %
11894% %
11895% %
11896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11897%
11898% MagickTransparentPaintImage() changes any pixel that matches color with the
11899% color defined by fill.
11900%
11901% The format of the MagickTransparentPaintImage method is:
11902%
11903% MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11904% const PixelWand *target,const double alpha,const double fuzz,
11905% const MagickBooleanType invert)
11906%
11907% A description of each parameter follows:
11908%
11909% o wand: the magick wand.
11910%
cristyb6a294d2011-10-03 00:55:17 +000011911% o target: Change this target color to specified alpha value within
cristy3ed852e2009-09-05 21:47:34 +000011912% the image.
11913%
11914% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11915% transparent.
11916%
11917% o fuzz: By default target must match a particular pixel color
11918% exactly. However, in many cases two colors may differ by a small amount.
11919% The fuzz member of image defines how much tolerance is acceptable to
11920% consider two colors as the same. For example, set fuzz to 10 and the
11921% color red at intensities of 100 and 102 respectively are now interpreted
11922% as the same color for the purposes of the floodfill.
11923%
11924% o invert: paint any pixel that does not match the target color.
11925%
11926*/
11927WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11928 const PixelWand *target,const double alpha,const double fuzz,
11929 const MagickBooleanType invert)
11930{
11931 MagickBooleanType
11932 status;
11933
cristy4c08aed2011-07-01 19:47:50 +000011934 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +000011935 target_pixel;
11936
11937 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011938 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011939 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011940 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11941 if (wand->images == (Image *) NULL)
11942 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11943 PixelGetMagickColor(target,&target_pixel);
11944 wand->images->fuzz=fuzz;
cristyce70c172010-01-07 17:15:30 +000011945 status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
cristy5f49bdb2011-10-16 14:28:56 +000011946 QuantumRange*alpha),invert,wand->exception);
cristy220c4d52013-11-27 19:31:32 +000011947 return(status);
cristy3ed852e2009-09-05 21:47:34 +000011948}
11949
11950/*
11951%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11952% %
11953% %
11954% %
11955% M a g i c k T r a n s p o s e I m a g e %
11956% %
11957% %
11958% %
11959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11960%
11961% MagickTransposeImage() creates a vertical mirror image by reflecting the
11962% pixels around the central x-axis while rotating them 90-degrees.
11963%
11964% The format of the MagickTransposeImage method is:
11965%
11966% MagickBooleanType MagickTransposeImage(MagickWand *wand)
11967%
11968% A description of each parameter follows:
11969%
11970% o wand: the magick wand.
11971%
11972*/
11973WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11974{
11975 Image
11976 *transpose_image;
11977
11978 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000011979 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010011980 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000011981 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11982 if (wand->images == (Image *) NULL)
11983 ThrowWandException(WandError,"ContainsNoImages",wand->name);
11984 transpose_image=TransposeImage(wand->images,wand->exception);
11985 if (transpose_image == (Image *) NULL)
11986 return(MagickFalse);
11987 ReplaceImageInList(&wand->images,transpose_image);
11988 return(MagickTrue);
11989}
11990
11991/*
11992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11993% %
11994% %
11995% %
11996% M a g i c k T r a n s v e r s e I m a g e %
11997% %
11998% %
11999% %
12000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12001%
12002% MagickTransverseImage() creates a horizontal mirror image by reflecting the
12003% pixels around the central y-axis while rotating them 270-degrees.
12004%
12005% The format of the MagickTransverseImage method is:
12006%
12007% MagickBooleanType MagickTransverseImage(MagickWand *wand)
12008%
12009% A description of each parameter follows:
12010%
12011% o wand: the magick wand.
12012%
12013*/
12014WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12015{
12016 Image
12017 *transverse_image;
12018
12019 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012020 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012021 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012022 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12023 if (wand->images == (Image *) NULL)
12024 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12025 transverse_image=TransverseImage(wand->images,wand->exception);
12026 if (transverse_image == (Image *) NULL)
12027 return(MagickFalse);
12028 ReplaceImageInList(&wand->images,transverse_image);
12029 return(MagickTrue);
12030}
12031
12032/*
12033%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12034% %
12035% %
12036% %
12037% M a g i c k T r i m I m a g e %
12038% %
12039% %
12040% %
12041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12042%
12043% MagickTrimImage() remove edges that are the background color from the image.
12044%
12045% The format of the MagickTrimImage method is:
12046%
12047% MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12048%
12049% A description of each parameter follows:
12050%
12051% o wand: the magick wand.
12052%
12053% o fuzz: By default target must match a particular pixel color
12054% exactly. However, in many cases two colors may differ by a small amount.
12055% The fuzz member of image defines how much tolerance is acceptable to
12056% consider two colors as the same. For example, set fuzz to 10 and the
12057% color red at intensities of 100 and 102 respectively are now interpreted
12058% as the same color for the purposes of the floodfill.
12059%
12060*/
12061WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12062{
12063 Image
12064 *trim_image;
12065
12066 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012067 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012068 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012069 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12070 if (wand->images == (Image *) NULL)
12071 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12072 wand->images->fuzz=fuzz;
12073 trim_image=TrimImage(wand->images,wand->exception);
12074 if (trim_image == (Image *) NULL)
12075 return(MagickFalse);
12076 ReplaceImageInList(&wand->images,trim_image);
12077 return(MagickTrue);
12078}
12079
12080/*
12081%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12082% %
12083% %
12084% %
12085% M a g i c k U n i q u e I m a g e C o l o r s %
12086% %
12087% %
12088% %
12089%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12090%
12091% MagickUniqueImageColors() discards all but one of any pixel color.
12092%
12093% The format of the MagickUniqueImageColors method is:
12094%
12095% MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12096%
12097% A description of each parameter follows:
12098%
12099% o wand: the magick wand.
12100%
12101*/
12102WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12103{
12104 Image
12105 *unique_image;
12106
12107 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012108 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012109 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012110 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12111 if (wand->images == (Image *) NULL)
12112 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12113 unique_image=UniqueImageColors(wand->images,wand->exception);
12114 if (unique_image == (Image *) NULL)
12115 return(MagickFalse);
12116 ReplaceImageInList(&wand->images,unique_image);
12117 return(MagickTrue);
12118}
12119
12120/*
12121%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12122% %
12123% %
12124% %
12125% M a g i c k U n s h a r p M a s k I m a g e %
12126% %
12127% %
12128% %
12129%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12130%
12131% MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
12132% Gaussian operator of the given radius and standard deviation (sigma).
12133% For reasonable results, radius should be larger than sigma. Use a radius
12134% of 0 and UnsharpMaskImage() selects a suitable radius for you.
12135%
12136% The format of the MagickUnsharpMaskImage method is:
12137%
12138% MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
cristy3afd4012013-03-25 11:30:44 +000012139% const double radius,const double sigma,const double gain,
12140% const double threshold)
cristy3ed852e2009-09-05 21:47:34 +000012141%
12142% A description of each parameter follows:
12143%
12144% o wand: the magick wand.
12145%
cristy3ed852e2009-09-05 21:47:34 +000012146% o radius: the radius of the Gaussian, in pixels, not counting the center
12147% pixel.
12148%
12149% o sigma: the standard deviation of the Gaussian, in pixels.
12150%
cristy7869ee92013-03-23 21:24:49 +000012151% o gain: the percentage of the difference between the original and the
cristy3ed852e2009-09-05 21:47:34 +000012152% blur image that is added back into the original.
12153%
cristy3afd4012013-03-25 11:30:44 +000012154% o threshold: the threshold in pixels needed to apply the diffence gain.
12155%
cristy3ed852e2009-09-05 21:47:34 +000012156*/
cristy3ed852e2009-09-05 21:47:34 +000012157WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
cristy3afd4012013-03-25 11:30:44 +000012158 const double radius,const double sigma,const double gain,
12159 const double threshold)
cristy3ed852e2009-09-05 21:47:34 +000012160{
cristy3ed852e2009-09-05 21:47:34 +000012161 Image
12162 *unsharp_image;
12163
12164 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012165 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012166 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012167 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12168 if (wand->images == (Image *) NULL)
12169 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy3afd4012013-03-25 11:30:44 +000012170 unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
cristyf4ad9df2011-07-08 16:49:03 +000012171 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012172 if (unsharp_image == (Image *) NULL)
12173 return(MagickFalse);
12174 ReplaceImageInList(&wand->images,unsharp_image);
12175 return(MagickTrue);
12176}
12177
12178/*
12179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12180% %
12181% %
12182% %
12183% M a g i c k V i g n e t t e I m a g e %
12184% %
12185% %
12186% %
12187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12188%
12189% MagickVignetteImage() softens the edges of the image in vignette style.
12190%
12191% The format of the MagickVignetteImage method is:
12192%
12193% MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000012194% const double radius,const double sigma,const ssize_t x,
12195% const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000012196%
12197% A description of each parameter follows:
12198%
12199% o wand: the magick wand.
12200%
cristyeb6e6582011-12-09 09:14:23 +000012201% o radius: the radius.
cristy3ed852e2009-09-05 21:47:34 +000012202%
cristyeb6e6582011-12-09 09:14:23 +000012203% o sigma: the sigma.
12204%
cristy3ed852e2009-09-05 21:47:34 +000012205% o x, y: Define the x and y ellipse offset.
12206%
12207*/
12208WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
cristyaa2c16c2012-03-25 22:21:35 +000012209 const double radius,const double sigma,const ssize_t x,const ssize_t y)
cristy3ed852e2009-09-05 21:47:34 +000012210{
12211 Image
12212 *vignette_image;
12213
12214 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012215 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012216 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012217 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12218 if (wand->images == (Image *) NULL)
12219 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristyaa2c16c2012-03-25 22:21:35 +000012220 vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012221 if (vignette_image == (Image *) NULL)
12222 return(MagickFalse);
12223 ReplaceImageInList(&wand->images,vignette_image);
12224 return(MagickTrue);
12225}
12226
12227/*
12228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12229% %
12230% %
12231% %
12232% M a g i c k W a v e I m a g e %
12233% %
12234% %
12235% %
12236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12237%
12238% MagickWaveImage() creates a "ripple" effect in the image by shifting
cristycee97112010-05-28 00:44:52 +000012239% the pixels vertically along a sine wave whose amplitude and wavelength
cristy3ed852e2009-09-05 21:47:34 +000012240% is specified by the given parameters.
12241%
12242% The format of the MagickWaveImage method is:
12243%
cristy5c4e2582011-09-11 19:21:03 +000012244% MagickBooleanType MagickWaveImage(MagickWand *wand,
12245% const double amplitude,const double wave_length,
12246% const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000012247%
12248% A description of each parameter follows:
12249%
12250% o wand: the magick wand.
12251%
12252% o amplitude, wave_length: Define the amplitude and wave length of the
12253% sine wave.
12254%
cristy5c4e2582011-09-11 19:21:03 +000012255% o method: the pixel interpolation method.
12256%
cristy3ed852e2009-09-05 21:47:34 +000012257*/
12258WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
cristy5c4e2582011-09-11 19:21:03 +000012259 const double amplitude,const double wave_length,
12260 const PixelInterpolateMethod method)
cristy3ed852e2009-09-05 21:47:34 +000012261{
12262 Image
12263 *wave_image;
12264
12265 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012266 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012267 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012268 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12269 if (wand->images == (Image *) NULL)
12270 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy5c4e2582011-09-11 19:21:03 +000012271 wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12272 wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012273 if (wave_image == (Image *) NULL)
12274 return(MagickFalse);
12275 ReplaceImageInList(&wand->images,wave_image);
12276 return(MagickTrue);
12277}
12278
12279/*
12280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12281% %
12282% %
12283% %
12284% 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 %
12285% %
12286% %
12287% %
12288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12289%
12290% MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
12291% above the threshold into white while leaving all pixels below the threshold
12292% unchanged.
12293%
12294% The format of the MagickWhiteThresholdImage method is:
12295%
12296% MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12297% const PixelWand *threshold)
12298%
12299% A description of each parameter follows:
12300%
12301% o wand: the magick wand.
12302%
12303% o threshold: the pixel wand.
12304%
12305*/
12306WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12307 const PixelWand *threshold)
12308{
12309 char
cristy151b66d2015-04-15 10:50:31 +000012310 thresholds[MagickPathExtent];
cristy3ed852e2009-09-05 21:47:34 +000012311
cristy3ed852e2009-09-05 21:47:34 +000012312 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012313 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012314 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012315 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12316 if (wand->images == (Image *) NULL)
12317 ThrowWandException(WandError,"ContainsNoImages",wand->name);
cristy151b66d2015-04-15 10:50:31 +000012318 (void) FormatLocaleString(thresholds,MagickPathExtent,
cristy3ed852e2009-09-05 21:47:34 +000012319 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12320 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
cristyb6a294d2011-10-03 00:55:17 +000012321 PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
cristye941a752011-10-15 01:52:48 +000012322 return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
cristy3ed852e2009-09-05 21:47:34 +000012323}
12324
12325/*
12326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12327% %
12328% %
12329% %
12330% M a g i c k W r i t e I m a g e %
12331% %
12332% %
12333% %
12334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12335%
12336% MagickWriteImage() writes an image to the specified filename. If the
12337% filename parameter is NULL, the image is written to the filename set
12338% by MagickReadImage() or MagickSetImageFilename().
12339%
12340% The format of the MagickWriteImage method is:
12341%
12342% MagickBooleanType MagickWriteImage(MagickWand *wand,
12343% const char *filename)
12344%
12345% A description of each parameter follows:
12346%
12347% o wand: the magick wand.
12348%
12349% o filename: the image filename.
12350%
12351%
12352*/
12353WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12354 const char *filename)
12355{
12356 Image
12357 *image;
12358
12359 ImageInfo
12360 *write_info;
12361
12362 MagickBooleanType
12363 status;
12364
12365 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012366 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012367 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012368 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12369 if (wand->images == (Image *) NULL)
12370 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12371 if (filename != (const char *) NULL)
cristy151b66d2015-04-15 10:50:31 +000012372 (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
cristy3ed852e2009-09-05 21:47:34 +000012373 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12374 if (image == (Image *) NULL)
12375 return(MagickFalse);
12376 write_info=CloneImageInfo(wand->image_info);
12377 write_info->adjoin=MagickTrue;
cristye941a752011-10-15 01:52:48 +000012378 status=WriteImage(write_info,image,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012379 image=DestroyImage(image);
12380 write_info=DestroyImageInfo(write_info);
cristy220c4d52013-11-27 19:31:32 +000012381 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012382}
12383
12384/*
12385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12386% %
12387% %
12388% %
12389% M a g i c k W r i t e I m a g e F i l e %
12390% %
12391% %
12392% %
12393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12394%
12395% MagickWriteImageFile() writes an image to an open file descriptor.
12396%
12397% The format of the MagickWriteImageFile method is:
12398%
12399% MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12400%
12401% A description of each parameter follows:
12402%
12403% o wand: the magick wand.
12404%
12405% o file: the file descriptor.
12406%
cristy3ed852e2009-09-05 21:47:34 +000012407*/
12408WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12409{
12410 Image
12411 *image;
12412
12413 ImageInfo
12414 *write_info;
12415
12416 MagickBooleanType
12417 status;
12418
12419 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012420 assert(wand->signature == MagickWandSignature);
cristy3ed852e2009-09-05 21:47:34 +000012421 assert(file != (FILE *) NULL);
dirkd0792932016-01-05 15:54:48 +010012422 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012423 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12424 if (wand->images == (Image *) NULL)
12425 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12426 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12427 if (image == (Image *) NULL)
12428 return(MagickFalse);
12429 write_info=CloneImageInfo(wand->image_info);
12430 SetImageInfoFile(write_info,file);
12431 write_info->adjoin=MagickTrue;
cristye941a752011-10-15 01:52:48 +000012432 status=WriteImage(write_info,image,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012433 write_info=DestroyImageInfo(write_info);
cristy3ed852e2009-09-05 21:47:34 +000012434 image=DestroyImage(image);
cristy220c4d52013-11-27 19:31:32 +000012435 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012436}
12437
12438/*
12439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12440% %
12441% %
12442% %
12443% M a g i c k W r i t e I m a g e s %
12444% %
12445% %
12446% %
12447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12448%
12449% MagickWriteImages() writes an image or image sequence.
12450%
12451% The format of the MagickWriteImages method is:
12452%
12453% MagickBooleanType MagickWriteImages(MagickWand *wand,
12454% const char *filename,const MagickBooleanType adjoin)
12455%
12456% A description of each parameter follows:
12457%
12458% o wand: the magick wand.
12459%
12460% o filename: the image filename.
12461%
12462% o adjoin: join images into a single multi-image file.
12463%
12464*/
12465WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12466 const char *filename,const MagickBooleanType adjoin)
12467{
12468 ImageInfo
12469 *write_info;
12470
12471 MagickBooleanType
12472 status;
12473
12474 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012475 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012476 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012477 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12478 if (wand->images == (Image *) NULL)
12479 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12480 write_info=CloneImageInfo(wand->image_info);
12481 write_info->adjoin=adjoin;
12482 status=WriteImages(write_info,wand->images,filename,wand->exception);
cristy3ed852e2009-09-05 21:47:34 +000012483 write_info=DestroyImageInfo(write_info);
cristy220c4d52013-11-27 19:31:32 +000012484 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012485}
12486
12487/*
12488%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12489% %
12490% %
12491% %
12492% M a g i c k W r i t e I m a g e s F i l e %
12493% %
12494% %
12495% %
12496%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12497%
12498% MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12499%
12500% The format of the MagickWriteImagesFile method is:
12501%
12502% MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12503%
12504% A description of each parameter follows:
12505%
12506% o wand: the magick wand.
12507%
12508% o file: the file descriptor.
12509%
12510*/
12511WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12512{
12513 ImageInfo
12514 *write_info;
12515
12516 MagickBooleanType
12517 status;
12518
12519 assert(wand != (MagickWand *) NULL);
cristye1c94d92015-06-28 12:16:33 +000012520 assert(wand->signature == MagickWandSignature);
dirkd0792932016-01-05 15:54:48 +010012521 if (wand->debug != MagickFalse)
cristy3ed852e2009-09-05 21:47:34 +000012522 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12523 if (wand->images == (Image *) NULL)
12524 ThrowWandException(WandError,"ContainsNoImages",wand->name);
12525 write_info=CloneImageInfo(wand->image_info);
12526 SetImageInfoFile(write_info,file);
12527 write_info->adjoin=MagickTrue;
12528 status=WriteImages(write_info,wand->images,(const char *) NULL,
12529 wand->exception);
12530 write_info=DestroyImageInfo(write_info);
cristy220c4d52013-11-27 19:31:32 +000012531 return(status);
cristy3ed852e2009-09-05 21:47:34 +000012532}