• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13 %                       I    MM MM  A   A  G      E                           %
14 %                       I    M M M  AAAAA  G  GG  EEE                         %
15 %                       I    M   M  A   A  G   G  E                           %
16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17 %                                                                             %
18 %                                                                             %
19 %                          MagickWand Image Methods                           %
20 %                                                                             %
21 %                               Software Design                               %
22 %                                    Cristy                                   %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization      %
27 %  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 %    https://imagemagick.org/script/license.php                               %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 
46 /*
47   Include declarations.
48 */
49 #include "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"
54 #include "MagickCore/image-private.h"
55 
56 /*
57   Define declarations.
58 */
59 #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 */
CloneMagickWandFromImages(const MagickWand * wand,Image * images)87 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88   Image *images)
89 {
90   MagickWand
91     *clone_wand;
92 
93   assert(wand != (MagickWand *) NULL);
94   assert(wand->signature == MagickWandSignature);
95   if (wand->debug != MagickFalse)
96     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
97   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
98   if (clone_wand == (MagickWand *) NULL)
99     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
100       images->filename);
101   (void) memset(clone_wand,0,sizeof(*clone_wand));
102   clone_wand->id=AcquireWandId();
103   (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
104     MagickWandId,(double) clone_wand->id);
105   clone_wand->exception=AcquireExceptionInfo();
106   InheritException(clone_wand->exception,wand->exception);
107   clone_wand->image_info=CloneImageInfo(wand->image_info);
108   clone_wand->images=images;
109   clone_wand->debug=IsEventLogging();
110   clone_wand->signature=MagickWandSignature;
111   if (clone_wand->debug != MagickFalse)
112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
113   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 */
GetImageFromMagickWand(const MagickWand * wand)138 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
139 {
140   assert(wand != (MagickWand *) NULL);
141   assert(wand->signature == MagickWandSignature);
142   if (wand->debug != MagickFalse)
143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
144   if (wand->images == (Image *) NULL)
145     {
146       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
147         "ContainsNoImages","`%s'",wand->name);
148       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,
174 %        const double radius,const double sigma)
175 %
176 %  A description of each parameter follows:
177 %
178 %    o wand: the magick wand.
179 %
180 %    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 */
MagickAdaptiveBlurImage(MagickWand * wand,const double radius,const double sigma)186 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
187   const double radius,const double sigma)
188 {
189   Image
190     *sharp_image;
191 
192   assert(wand != (MagickWand *) NULL);
193   assert(wand->signature == MagickWandSignature);
194   if (wand->debug != MagickFalse)
195     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
196   if (wand->images == (Image *) NULL)
197     ThrowWandException(WandError,"ContainsNoImages",wand->name);
198   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
199   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,
220 %        const size_t columns,const size_t rows)
221 %
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 */
MagickAdaptiveResizeImage(MagickWand * wand,const size_t columns,const size_t rows)231 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
232   const size_t columns,const size_t rows)
233 {
234   Image
235     *resize_image;
236 
237   assert(wand != (MagickWand *) NULL);
238   assert(wand->signature == MagickWandSignature);
239   if (wand->debug != MagickFalse)
240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
241   if (wand->images == (Image *) NULL)
242     ThrowWandException(WandError,"ContainsNoImages",wand->name);
243   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
244   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,
271 %        const double radius,const double sigma)
272 %
273 %  A description of each parameter follows:
274 %
275 %    o wand: the magick wand.
276 %
277 %    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 */
MagickAdaptiveSharpenImage(MagickWand * wand,const double radius,const double sigma)283 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
284   const double radius,const double sigma)
285 {
286   Image
287     *sharp_image;
288 
289   assert(wand != (MagickWand *) NULL);
290   assert(wand->signature == MagickWandSignature);
291   if (wand->debug != MagickFalse)
292     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
293   if (wand->images == (Image *) NULL)
294     ThrowWandException(WandError,"ContainsNoImages",wand->name);
295   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
296   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,
321 %        const size_t width,const size_t height,const double bias)
322 %
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 %
331 %    o offset: the mean bias.
332 %
333 */
MagickAdaptiveThresholdImage(MagickWand * wand,const size_t width,const size_t height,const double bias)334 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
335   const size_t width,const size_t height,const double bias)
336 {
337   Image
338     *threshold_image;
339 
340   assert(wand != (MagickWand *) NULL);
341   assert(wand->signature == MagickWandSignature);
342   if (wand->debug != MagickFalse)
343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
344   if (wand->images == (Image *) NULL)
345     ThrowWandException(WandError,"ContainsNoImages",wand->name);
346   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
347     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 %
365 %  MagickAddImage() adds a clone of the images from the second wand and
366 %  inserts them into the first wand.
367 %
368 %  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 %
372 %  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.
375 %
376 %  Otherwise the new images will be inserted just after the current image,
377 %  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.
380 %
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 %
390 %    o add_wand: A wand that contains the image list to be added
391 %
392 */
InsertImageInWand(MagickWand * wand,Image * images)393 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
394   Image *images)
395 {
396   if (wand->images == (Image *) NULL)
397     {
398       /*
399         No images in wand, just add them, set current as appropriate.
400       */
401       if (wand->insert_before != MagickFalse)
402         wand->images=GetFirstImageInList(images);
403       else
404         wand->images=GetLastImageInList(images);
405       return(MagickTrue);
406     }
407   /* user jumped to first image, so prepend new images - remain active */
408   if ((wand->insert_before != MagickFalse) &&
409        (wand->images->previous == (Image *) NULL))
410     {
411       PrependImageToList(&wand->images,images);
412       wand->images=GetFirstImageInList(images);
413       return(MagickTrue);
414     }
415   /*
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   */
420   if (wand->images->next == (Image *) NULL)
421     {
422       /*
423         At last image, append new images.
424       */
425       InsertImageInList(&wand->images,images);
426       wand->images=GetLastImageInList(images);
427       return(MagickTrue);
428     }
429   /*
430     Insert new images, just after the current image.
431   */
432   InsertImageInList(&wand->images,images);
433   return(MagickTrue);
434 }
435 
MagickAddImage(MagickWand * wand,const MagickWand * add_wand)436 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437   const MagickWand *add_wand)
438 {
439   Image
440     *images;
441 
442   assert(wand != (MagickWand *) NULL);
443   assert(wand->signature == MagickWandSignature);
444   if (wand->debug != MagickFalse)
445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446   assert(add_wand != (MagickWand *) NULL);
447   assert(add_wand->signature == MagickWandSignature);
448   if (add_wand->images == (Image *) NULL)
449     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
450   /*
451     Clone images in second wand, and insert into first.
452   */
453   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,
475 %        const NoiseType noise_type,const double attenuate)
476 %
477 %  A description of each parameter follows:
478 %
479 %    o wand: the magick wand.
480 %
481 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
482 %      Impulse, Laplacian, or Poisson.
483 %
484 %    o attenuate:  attenuate the random distribution.
485 %
486 */
MagickAddNoiseImage(MagickWand * wand,const NoiseType noise_type,const double attenuate)487 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
488   const NoiseType noise_type,const double attenuate)
489 {
490   Image
491     *noise_image;
492 
493   assert(wand != (MagickWand *) NULL);
494   assert(wand->signature == MagickWandSignature);
495   if (wand->debug != MagickFalse)
496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497   if (wand->images == (Image *) NULL)
498     ThrowWandException(WandError,"ContainsNoImages",wand->name);
499   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
500   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 */
MagickAffineTransformImage(MagickWand * wand,const DrawingWand * drawing_wand)532 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
533   const DrawingWand *drawing_wand)
534 {
535   DrawInfo
536     *draw_info;
537 
538   Image
539     *affine_image;
540 
541   assert(wand != (MagickWand *) NULL);
542   assert(wand->signature == MagickWandSignature);
543   if (wand->debug != MagickFalse)
544     (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 */
MagickAnnotateImage(MagickWand * wand,const DrawingWand * drawing_wand,const double x,const double y,const double angle,const char * text)593 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594   const DrawingWand *drawing_wand,const double x,const double y,
595   const double angle,const char *text)
596 {
597   char
598     geometry[MagickPathExtent];
599 
600   DrawInfo
601     *draw_info;
602 
603   MagickBooleanType
604     status;
605 
606   assert(wand != (MagickWand *) NULL);
607   assert(wand->signature == MagickWandSignature);
608   if (wand->debug != MagickFalse)
609     (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);
616   (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
617   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)));
621   (void) CloneString(&draw_info->geometry,geometry);
622   status=AnnotateImage(wand->images,draw_info,wand->exception);
623   draw_info=DestroyDrawInfo(draw_info);
624   return(status);
625 }
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 */
MagickAnimateImages(MagickWand * wand,const char * server_name)652 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653   const char *server_name)
654 {
655   MagickBooleanType
656     status;
657 
658   assert(wand != (MagickWand *) NULL);
659   assert(wand->signature == MagickWandSignature);
660   if (wand->debug != MagickFalse)
661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662   (void) CloneString(&wand->image_info->server_name,server_name);
663   status=AnimateImages(wand->image_info,wand->images,wand->exception);
664   return(status);
665 }
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 %
678 %  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.
685 %
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 */
MagickAppendImages(MagickWand * wand,const MagickBooleanType stack)699 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
700   const MagickBooleanType stack)
701 {
702   Image
703     *append_image;
704 
705   assert(wand != (MagickWand *) NULL);
706   assert(wand->signature == MagickWandSignature);
707   if (wand->debug != MagickFalse)
708     (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)
734 %
735 %  A description of each parameter follows:
736 %
737 %    o wand: the magick wand.
738 %
739 */
MagickAutoGammaImage(MagickWand * wand)740 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
741 {
742   MagickBooleanType
743     status;
744 
745   assert(wand != (MagickWand *) NULL);
746   assert(wand->signature == MagickWandSignature);
747   if (wand->debug != MagickFalse)
748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749   if (wand->images == (Image *) NULL)
750     ThrowWandException(WandError,"ContainsNoImages",wand->name);
751   status=AutoGammaImage(wand->images,wand->exception);
752   return(status);
753 }
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)
772 %
773 %  A description of each parameter follows:
774 %
775 %    o wand: the magick wand.
776 %
777 */
MagickAutoLevelImage(MagickWand * wand)778 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
779 {
780   MagickBooleanType
781     status;
782 
783   assert(wand != (MagickWand *) NULL);
784   assert(wand->signature == MagickWandSignature);
785   if (wand->debug != MagickFalse)
786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787   if (wand->images == (Image *) NULL)
788     ThrowWandException(WandError,"ContainsNoImages",wand->name);
789   status=AutoLevelImage(wand->images,wand->exception);
790   return(status);
791 }
792 
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 */
MagickAutoOrientImage(MagickWand * wand)816 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
817 {
818 
819   Image
820     *orient_image;
821 
822   assert(wand != (MagickWand *) NULL);
823   assert(wand->signature == MagickWandSignature);
824   if (wand->debug != MagickFalse)
825     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826   if (wand->images == (Image *) NULL)
827     ThrowWandException(WandError,"ContainsNoImages",wand->name);
828   orient_image=AutoOrientImage(wand->images,wand->images->orientation,
829     wand->exception);
830   if (orient_image == (Image *) NULL)
831     return(MagickFalse);
832   ReplaceImageInList(&wand->images,orient_image);
833   return(MagickTrue);
834 }
835 
836 /*
837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838 %                                                                             %
839 %                                                                             %
840 %                                                                             %
841 %   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 */
MagickBlackThresholdImage(MagickWand * wand,const PixelWand * threshold)863 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
864   const PixelWand *threshold)
865 {
866   char
867     thresholds[MagickPathExtent];
868 
869   MagickBooleanType
870     status;
871 
872   assert(wand != (MagickWand *) NULL);
873   assert(wand->signature == MagickWandSignature);
874   if (wand->debug != MagickFalse)
875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
876   if (wand->images == (Image *) NULL)
877     ThrowWandException(WandError,"ContainsNoImages",wand->name);
878   (void) FormatLocaleString(thresholds,MagickPathExtent,
879     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
880     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
881     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
882   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
883   return(status);
884 }
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 */
MagickBlueShiftImage(MagickWand * wand,const double factor)912 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
913   const double factor)
914 {
915   Image
916     *shift_image;
917 
918   assert(wand != (MagickWand *) NULL);
919   assert(wand->signature == MagickWandSignature);
920   if (wand->debug != MagickFalse)
921     (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,
950 %        const double sigma)
951 %
952 %  A description of each parameter follows:
953 %
954 %    o wand: the magick wand.
955 %
956 %    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 */
MagickBlurImage(MagickWand * wand,const double radius,const double sigma)962 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
963   const double radius,const double sigma)
964 {
965   Image
966     *blur_image;
967 
968   assert(wand != (MagickWand *) NULL);
969   assert(wand->signature == MagickWandSignature);
970   if (wand->debug != MagickFalse)
971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
972   if (wand->images == (Image *) NULL)
973     ThrowWandException(WandError,"ContainsNoImages",wand->name);
974   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
975   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,
998 %        const PixelWand *bordercolor,const size_t width,
999 %        const size_t height,const CompositeOperator compose)
1000 %
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 %
1011 %    o compose: the composite operator.
1012 %
1013 */
MagickBorderImage(MagickWand * wand,const PixelWand * bordercolor,const size_t width,const size_t height,const CompositeOperator compose)1014 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1015   const PixelWand *bordercolor,const size_t width,const size_t height,
1016   const CompositeOperator compose)
1017 {
1018   Image
1019     *border_image;
1020 
1021   RectangleInfo
1022     border_info;
1023 
1024   assert(wand != (MagickWand *) NULL);
1025   assert(wand->signature == MagickWandSignature);
1026   if (wand->debug != MagickFalse)
1027     (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;
1034   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1035   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1036   if (border_image == (Image *) NULL)
1037     return(MagickFalse);
1038   ReplaceImageInList(&wand->images,border_image);
1039   return(MagickTrue);
1040 }
1041 
1042 /*
1043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044 %                                                                             %
1045 %                                                                             %
1046 %                                                                             %
1047 %   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)
1062 %
1063 %  A description of each parameter follows:
1064 %
1065 %    o wand: the magick wand.
1066 %
1067 %    o brightness: the brightness percent (-100 .. 100).
1068 %
1069 %    o contrast: the contrast percent (-100 .. 100).
1070 %
1071 */
MagickBrightnessContrastImage(MagickWand * wand,const double brightness,const double contrast)1072 WandExport MagickBooleanType MagickBrightnessContrastImage(
1073   MagickWand *wand,const double brightness,const double contrast)
1074 {
1075   MagickBooleanType
1076     status;
1077 
1078   assert(wand != (MagickWand *) NULL);
1079   assert(wand->signature == MagickWandSignature);
1080   if (wand->debug != MagickFalse)
1081     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1082   if (wand->images == (Image *) NULL)
1083     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1084   status=BrightnessContrastImage(wand->images,brightness,contrast,
1085     wand->exception);
1086   return(status);
1087 }
1088 
1089 /*
1090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1091 %                                                                             %
1092 %                                                                             %
1093 %                                                                             %
1094 %   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 */
MagickChannelFxImage(MagickWand * wand,const char * expression)1126 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1127   const char *expression)
1128 {
1129   Image
1130     *fx_image;
1131 
1132   assert(wand != (MagickWand *) NULL);
1133   assert(wand->signature == MagickWandSignature);
1134   if (wand->debug != MagickFalse)
1135     (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 %                                                                             %
1149 %   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,
1160 %        const double radius,const double sigma)
1161 %
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 */
MagickCharcoalImage(MagickWand * wand,const double radius,const double sigma)1172 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1173   const double radius,const double sigma)
1174 {
1175   Image
1176     *charcoal_image;
1177 
1178   assert(wand != (MagickWand *) NULL);
1179   assert(wand->signature == MagickWandSignature);
1180   if (wand->debug != MagickFalse)
1181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182   if (wand->images == (Image *) NULL)
1183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1184   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1185   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,
1208 %        const size_t width,const size_t height,const ssize_t x,
1209 %        const ssize_t y)
1210 %
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 */
MagickChopImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)1225 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1226   const size_t width,const size_t height,const ssize_t x,
1227   const ssize_t y)
1228 {
1229   Image
1230     *chop_image;
1231 
1232   RectangleInfo
1233     chop;
1234 
1235   assert(wand != (MagickWand *) NULL);
1236   assert(wand->signature == MagickWandSignature);
1237   if (wand->debug != MagickFalse)
1238     (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 %                                                                             %
1257 %   M a g i c k C L A H E I m a g e                                           %
1258 %                                                                             %
1259 %                                                                             %
1260 %                                                                             %
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262 %
1263 %  MagickCLAHEImage() selects an individual threshold for each pixel
1264 %  based on the range of intensity values in its local neighborhood.  This
1265 %  allows for thresholding of an image whose global intensity histogram
1266 %  doesn't contain distinctive peaks.
1267 %
1268 %  The format of the CLAHEImage method is:
1269 %
1270 %      MagickBooleanType MagickCLAHEImage(MagickWand *wand,const size_t width,
1271 %        const size_t height,const double bias,const double sans)
1272 %
1273 %  A description of each parameter follows:
1274 %
1275 %    o wand: the magick wand.
1276 %
1277 %    o width: the width of the local neighborhood.
1278 %
1279 %    o height: the height of the local neighborhood.
1280 %
1281 %    o offset: the mean bias.
1282 %
1283 %    o sans: not used.
1284 %
1285 */
MagickCLAHEImage(MagickWand * wand,const size_t width,const size_t height,const double bias,const double sans)1286 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand,
1287   const size_t width,const size_t height,const double bias,const double sans)
1288 {
1289   MagickBooleanType
1290     status;
1291 
1292   assert(wand != (MagickWand *) NULL);
1293   assert(wand->signature == MagickWandSignature);
1294   if (wand->debug != MagickFalse)
1295     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1296   if (wand->images == (Image *) NULL)
1297     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1298   status=CLAHEImage(wand->images,width,height,bias,sans,wand->exception);
1299   return(status);
1300 }
1301 
1302 /*
1303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1304 %                                                                             %
1305 %                                                                             %
1306 %                                                                             %
1307 %   M a g i c k C l a m p I m a g e                                           %
1308 %                                                                             %
1309 %                                                                             %
1310 %                                                                             %
1311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1312 %
1313 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1314 %
1315 %  The format of the MagickClampImage method is:
1316 %
1317 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1318 %
1319 %  A description of each parameter follows:
1320 %
1321 %    o wand: the magick wand.
1322 %
1323 %    o channel: the channel.
1324 %
1325 */
MagickClampImage(MagickWand * wand)1326 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1327 {
1328   assert(wand != (MagickWand *) NULL);
1329   assert(wand->signature == MagickWandSignature);
1330   if (wand->debug != MagickFalse)
1331     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1332   if (wand->images == (Image *) NULL)
1333     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1334   return(ClampImage(wand->images,wand->exception));
1335 }
1336 
1337 /*
1338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1339 %                                                                             %
1340 %                                                                             %
1341 %                                                                             %
1342 %   M a g i c k C l i p I m a g e                                             %
1343 %                                                                             %
1344 %                                                                             %
1345 %                                                                             %
1346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1347 %
1348 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1349 %  present.
1350 %
1351 %  The format of the MagickClipImage method is:
1352 %
1353 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1354 %
1355 %  A description of each parameter follows:
1356 %
1357 %    o wand: the magick wand.
1358 %
1359 */
MagickClipImage(MagickWand * wand)1360 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1361 {
1362   MagickBooleanType
1363     status;
1364 
1365   assert(wand != (MagickWand *) NULL);
1366   assert(wand->signature == MagickWandSignature);
1367   if (wand->debug != MagickFalse)
1368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1369   if (wand->images == (Image *) NULL)
1370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1371   status=ClipImage(wand->images,wand->exception);
1372   return(status);
1373 }
1374 
1375 /*
1376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1377 %                                                                             %
1378 %                                                                             %
1379 %                                                                             %
1380 %   M a g i c k C l i p I m a g e P a t h                                     %
1381 %                                                                             %
1382 %                                                                             %
1383 %                                                                             %
1384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1385 %
1386 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1387 %  present. Later operations take effect inside the path.  Id may be a number
1388 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1389 %  path.
1390 %
1391 %  The format of the MagickClipImagePath method is:
1392 %
1393 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1394 %        const char *pathname,const MagickBooleanType inside)
1395 %
1396 %  A description of each parameter follows:
1397 %
1398 %    o wand: the magick wand.
1399 %
1400 %    o pathname: name of clipping path resource. If name is preceded by #, use
1401 %      clipping path numbered by name.
1402 %
1403 %    o inside: if non-zero, later operations take effect inside clipping path.
1404 %      Otherwise later operations take effect outside clipping path.
1405 %
1406 */
MagickClipImagePath(MagickWand * wand,const char * pathname,const MagickBooleanType inside)1407 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1408   const char *pathname,const MagickBooleanType inside)
1409 {
1410   MagickBooleanType
1411     status;
1412 
1413   assert(wand != (MagickWand *) NULL);
1414   assert(wand->signature == MagickWandSignature);
1415   if (wand->debug != MagickFalse)
1416     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1417   if (wand->images == (Image *) NULL)
1418     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1419   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1420   return(status);
1421 }
1422 
1423 /*
1424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1425 %                                                                             %
1426 %                                                                             %
1427 %                                                                             %
1428 %   M a g i c k C l u t I m a g e                                             %
1429 %                                                                             %
1430 %                                                                             %
1431 %                                                                             %
1432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1433 %
1434 %  MagickClutImage() replaces colors in the image from a color lookup table.
1435 %
1436 %  The format of the MagickClutImage method is:
1437 %
1438 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1439 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1440 %
1441 %  A description of each parameter follows:
1442 %
1443 %    o wand: the magick wand.
1444 %
1445 %    o clut_image: the clut image.
1446 %
1447 %    o method: the pixel interpolation method.
1448 %
1449 */
MagickClutImage(MagickWand * wand,const MagickWand * clut_wand,const PixelInterpolateMethod method)1450 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1451   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1452 {
1453   MagickBooleanType
1454     status;
1455 
1456   assert(wand != (MagickWand *) NULL);
1457   assert(wand->signature == MagickWandSignature);
1458   if (wand->debug != MagickFalse)
1459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1460   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1461     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1462   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1463   return(status);
1464 }
1465 
1466 /*
1467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1468 %                                                                             %
1469 %                                                                             %
1470 %                                                                             %
1471 %   M a g i c k C o a l e s c e I m a g e s                                   %
1472 %                                                                             %
1473 %                                                                             %
1474 %                                                                             %
1475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1476 %
1477 %  MagickCoalesceImages() composites a set of images while respecting any page
1478 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1479 %  typically start with an image background and each subsequent image
1480 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1481 %  where each image in the sequence is the same size as the first and
1482 %  composited with the next image in the sequence.
1483 %
1484 %  The format of the MagickCoalesceImages method is:
1485 %
1486 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1487 %
1488 %  A description of each parameter follows:
1489 %
1490 %    o wand: the magick wand.
1491 %
1492 */
MagickCoalesceImages(MagickWand * wand)1493 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1494 {
1495   Image
1496     *coalesce_image;
1497 
1498   assert(wand != (MagickWand *) NULL);
1499   assert(wand->signature == MagickWandSignature);
1500   if (wand->debug != MagickFalse)
1501     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1502   if (wand->images == (Image *) NULL)
1503     return((MagickWand *) NULL);
1504   coalesce_image=CoalesceImages(wand->images,wand->exception);
1505   if (coalesce_image == (Image *) NULL)
1506     return((MagickWand *) NULL);
1507   return(CloneMagickWandFromImages(wand,coalesce_image));
1508 }
1509 
1510 /*
1511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1512 %                                                                             %
1513 %                                                                             %
1514 %                                                                             %
1515 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1516 %                                                                             %
1517 %                                                                             %
1518 %                                                                             %
1519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520 %
1521 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1522 %  Collection (CCC) file which solely contains one or more color corrections
1523 %  and applies the color correction to the image.  Here is a sample CCC file:
1524 %
1525 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1526 %          <ColorCorrection id="cc03345">
1527 %                <SOPNode>
1528 %                     <Slope> 0.9 1.2 0.5 </Slope>
1529 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1530 %                     <Power> 1.0 0.8 1.5 </Power>
1531 %                </SOPNode>
1532 %                <SATNode>
1533 %                     <Saturation> 0.85 </Saturation>
1534 %                </SATNode>
1535 %          </ColorCorrection>
1536 %    </ColorCorrectionCollection>
1537 %
1538 %  which includes the offset, slope, and power for each of the RGB channels
1539 %  as well as the saturation.
1540 %
1541 %  The format of the MagickColorDecisionListImage method is:
1542 %
1543 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1544 %        const char *color_correction_collection)
1545 %
1546 %  A description of each parameter follows:
1547 %
1548 %    o wand: the magick wand.
1549 %
1550 %    o color_correction_collection: the color correction collection in XML.
1551 %
1552 */
MagickColorDecisionListImage(MagickWand * wand,const char * color_correction_collection)1553 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1554   const char *color_correction_collection)
1555 {
1556   MagickBooleanType
1557     status;
1558 
1559   assert(wand != (MagickWand *) NULL);
1560   assert(wand->signature == MagickWandSignature);
1561   if (wand->debug != MagickFalse)
1562     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1563   if (wand->images == (Image *) NULL)
1564     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1565   status=ColorDecisionListImage(wand->images,color_correction_collection,
1566     wand->exception);
1567   return(status);
1568 }
1569 
1570 /*
1571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572 %                                                                             %
1573 %                                                                             %
1574 %                                                                             %
1575 %   M a g i c k C o l o r i z e I m a g e                                     %
1576 %                                                                             %
1577 %                                                                             %
1578 %                                                                             %
1579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1580 %
1581 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1582 %
1583 %  The format of the MagickColorizeImage method is:
1584 %
1585 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1586 %        const PixelWand *colorize,const PixelWand *blend)
1587 %
1588 %  A description of each parameter follows:
1589 %
1590 %    o wand: the magick wand.
1591 %
1592 %    o colorize: the colorize pixel wand.
1593 %
1594 %    o alpha: the alpha pixel wand.
1595 %
1596 */
MagickColorizeImage(MagickWand * wand,const PixelWand * colorize,const PixelWand * blend)1597 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1598   const PixelWand *colorize,const PixelWand *blend)
1599 {
1600   char
1601     percent_blend[MagickPathExtent];
1602 
1603   Image
1604     *colorize_image;
1605 
1606   PixelInfo
1607     target;
1608 
1609   assert(wand != (MagickWand *) NULL);
1610   assert(wand->signature == MagickWandSignature);
1611   if (wand->debug != MagickFalse)
1612     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1613   if (wand->images == (Image *) NULL)
1614     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1615   GetPixelInfo(wand->images,&target);
1616   if (target.colorspace != CMYKColorspace)
1617     (void) FormatLocaleString(percent_blend,MagickPathExtent,
1618       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1619       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1620       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1621       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1622       PixelGetAlphaQuantum(blend)));
1623   else
1624     (void) FormatLocaleString(percent_blend,MagickPathExtent,
1625       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1626       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1627       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1628       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1629       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1630       PixelGetAlphaQuantum(blend)));
1631   target=PixelGetPixel(colorize);
1632   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1633     wand->exception);
1634   if (colorize_image == (Image *) NULL)
1635     return(MagickFalse);
1636   ReplaceImageInList(&wand->images,colorize_image);
1637   return(MagickTrue);
1638 }
1639 
1640 /*
1641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1642 %                                                                             %
1643 %                                                                             %
1644 %                                                                             %
1645 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1646 %                                                                             %
1647 %                                                                             %
1648 %                                                                             %
1649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1650 %
1651 %  MagickColorMatrixImage() apply color transformation to an image. The method
1652 %  permits saturation changes, hue rotation, luminance to alpha, and various
1653 %  other effects.  Although variable-sized transformation matrices can be used,
1654 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1655 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1656 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1657 %  and offsets are normalized (divide Flash offset by 255).
1658 %
1659 %  The format of the MagickColorMatrixImage method is:
1660 %
1661 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1662 %        const KernelInfo *color_matrix)
1663 %
1664 %  A description of each parameter follows:
1665 %
1666 %    o wand: the magick wand.
1667 %
1668 %    o color_matrix:  the color matrix.
1669 %
1670 */
MagickColorMatrixImage(MagickWand * wand,const KernelInfo * color_matrix)1671 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1672   const KernelInfo *color_matrix)
1673 {
1674   Image
1675     *color_image;
1676 
1677   assert(wand != (MagickWand *) NULL);
1678   assert(wand->signature == MagickWandSignature);
1679   if (wand->debug != MagickFalse)
1680     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1681   if (color_matrix == (const KernelInfo *) NULL)
1682     return(MagickFalse);
1683   if (wand->images == (Image *) NULL)
1684     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1685   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1686   if (color_image == (Image *) NULL)
1687     return(MagickFalse);
1688   ReplaceImageInList(&wand->images,color_image);
1689   return(MagickTrue);
1690 }
1691 
1692 /*
1693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1694 %                                                                             %
1695 %                                                                             %
1696 %                                                                             %
1697 %   M a g i c k C o m b i n e I m a g e s                                     %
1698 %                                                                             %
1699 %                                                                             %
1700 %                                                                             %
1701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1702 %
1703 %  MagickCombineImages() combines one or more images into a single image.  The
1704 %  grayscale value of the pixels of each image in the sequence is assigned in
1705 %  order to the specified  hannels of the combined image.   The typical
1706 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1707 %
1708 %  The format of the MagickCombineImages method is:
1709 %
1710 %      MagickWand *MagickCombineImages(MagickWand *wand,
1711 %        const ColorspaceType colorspace)
1712 %
1713 %  A description of each parameter follows:
1714 %
1715 %    o wand: the magick wand.
1716 %
1717 %    o colorspace: the colorspace.
1718 %
1719 */
MagickCombineImages(MagickWand * wand,const ColorspaceType colorspace)1720 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1721   const ColorspaceType colorspace)
1722 {
1723   Image
1724     *combine_image;
1725 
1726   assert(wand != (MagickWand *) NULL);
1727   assert(wand->signature == MagickWandSignature);
1728   if (wand->debug != MagickFalse)
1729     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1730   if (wand->images == (Image *) NULL)
1731     return((MagickWand *) NULL);
1732   combine_image=CombineImages(wand->images,colorspace,wand->exception);
1733   if (combine_image == (Image *) NULL)
1734     return((MagickWand *) NULL);
1735   return(CloneMagickWandFromImages(wand,combine_image));
1736 }
1737 
1738 /*
1739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1740 %                                                                             %
1741 %                                                                             %
1742 %                                                                             %
1743 %   M a g i c k C o m m e n t I m a g e                                       %
1744 %                                                                             %
1745 %                                                                             %
1746 %                                                                             %
1747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1748 %
1749 %  MagickCommentImage() adds a comment to your image.
1750 %
1751 %  The format of the MagickCommentImage method is:
1752 %
1753 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1754 %        const char *comment)
1755 %
1756 %  A description of each parameter follows:
1757 %
1758 %    o wand: the magick wand.
1759 %
1760 %    o comment: the image comment.
1761 %
1762 */
MagickCommentImage(MagickWand * wand,const char * comment)1763 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1764   const char *comment)
1765 {
1766   MagickBooleanType
1767     status;
1768 
1769   assert(wand != (MagickWand *) NULL);
1770   assert(wand->signature == MagickWandSignature);
1771   if (wand->debug != MagickFalse)
1772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1773   if (wand->images == (Image *) NULL)
1774     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1775   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1776   return(status);
1777 }
1778 
1779 /*
1780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1781 %                                                                             %
1782 %                                                                             %
1783 %                                                                             %
1784 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1785 %                                                                             %
1786 %                                                                             %
1787 %                                                                             %
1788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1789 %
1790 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1791 %  and returns the maximum bounding region of any pixel differences it
1792 %  discovers.
1793 %
1794 %  The format of the MagickCompareImagesLayers method is:
1795 %
1796 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1797 %        const LayerMethod method)
1798 %
1799 %  A description of each parameter follows:
1800 %
1801 %    o wand: the magick wand.
1802 %
1803 %    o method: the compare method.
1804 %
1805 */
MagickCompareImagesLayers(MagickWand * wand,const LayerMethod method)1806 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1807   const LayerMethod method)
1808 {
1809   Image
1810     *layers_image;
1811 
1812   assert(wand != (MagickWand *) NULL);
1813   assert(wand->signature == MagickWandSignature);
1814   if (wand->debug != MagickFalse)
1815     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1816   if (wand->images == (Image *) NULL)
1817     return((MagickWand *) NULL);
1818   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1819   if (layers_image == (Image *) NULL)
1820     return((MagickWand *) NULL);
1821   return(CloneMagickWandFromImages(wand,layers_image));
1822 }
1823 
1824 /*
1825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1826 %                                                                             %
1827 %                                                                             %
1828 %                                                                             %
1829 %   M a g i c k C o m p a r e I m a g e s                                     %
1830 %                                                                             %
1831 %                                                                             %
1832 %                                                                             %
1833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1834 %
1835 %  MagickCompareImages() compares an image to a reconstructed image and returns
1836 %  the specified difference image.
1837 %
1838 %  The format of the MagickCompareImages method is:
1839 %
1840 %      MagickWand *MagickCompareImages(MagickWand *wand,
1841 %        const MagickWand *reference,const MetricType metric,
1842 %        double *distortion)
1843 %
1844 %  A description of each parameter follows:
1845 %
1846 %    o wand: the magick wand.
1847 %
1848 %    o reference: the reference wand.
1849 %
1850 %    o metric: the metric.
1851 %
1852 %    o distortion: the computed distortion between the images.
1853 %
1854 */
MagickCompareImages(MagickWand * wand,const MagickWand * reference,const MetricType metric,double * distortion)1855 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1856   const MagickWand *reference,const MetricType metric,double *distortion)
1857 {
1858   Image
1859     *compare_image;
1860 
1861 
1862   assert(wand != (MagickWand *) NULL);
1863   assert(wand->signature == MagickWandSignature);
1864   if (wand->debug != MagickFalse)
1865     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1866   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1867     {
1868       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1869         "ContainsNoImages","`%s'",wand->name);
1870       return((MagickWand *) NULL);
1871     }
1872   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1873     wand->exception);
1874   if (compare_image == (Image *) NULL)
1875     return((MagickWand *) NULL);
1876   return(CloneMagickWandFromImages(wand,compare_image));
1877 }
1878 
1879 /*
1880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1881 %                                                                             %
1882 %                                                                             %
1883 %                                                                             %
1884 %   M a g i c k C o m p o s i t e I m a g e                                   %
1885 %                                                                             %
1886 %                                                                             %
1887 %                                                                             %
1888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1889 %
1890 %  MagickCompositeImage() composite one image onto another at the specified
1891 %  offset.
1892 %
1893 %  The format of the MagickCompositeImage method is:
1894 %
1895 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1896 %        const MagickWand *source_wand,const CompositeOperator compose,
1897 %        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1898 %
1899 %  A description of each parameter follows:
1900 %
1901 %    o wand: the magick wand holding the destination images
1902 %
1903 %    o source_image: the magick wand holding source image.
1904 %
1905 %    o compose: This operator affects how the composite is applied to the
1906 %      image.  The default is Over.  These are some of the compose methods
1907 %      availble.
1908 %
1909 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1910 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1911 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1912 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1913 %        DisplaceCompositeOp
1914 %
1915 %    o clip_to_self: set to MagickTrue to limit composition to area composed.
1916 %
1917 %    o x: the column offset of the composited image.
1918 %
1919 %    o y: the row offset of the composited image.
1920 %
1921 */
MagickCompositeImage(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)1922 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1923   const MagickWand *source_wand,const CompositeOperator compose,
1924   const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1925 {
1926   MagickBooleanType
1927     status;
1928 
1929   assert(wand != (MagickWand *) NULL);
1930   assert(wand->signature == MagickWandSignature);
1931   if (wand->debug != MagickFalse)
1932     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1933   if ((wand->images == (Image *) NULL) ||
1934       (source_wand->images == (Image *) NULL))
1935     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1936   status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1937     x,y,wand->exception);
1938   return(status);
1939 }
1940 
1941 /*
1942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1943 %                                                                             %
1944 %                                                                             %
1945 %                                                                             %
1946 %   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                     %
1947 %                                                                             %
1948 %                                                                             %
1949 %                                                                             %
1950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1951 %
1952 %  MagickCompositeImageGravity() composite one image onto another using the
1953 %  specified gravity.
1954 %
1955 %  The format of the MagickCompositeImageGravity method is:
1956 %
1957 %      MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1958 %        const MagickWand *source_wand,const CompositeOperator compose,
1959 %        const GravityType gravity)
1960 %
1961 %  A description of each parameter follows:
1962 %
1963 %    o wand: the magick wand holding the destination images
1964 %
1965 %    o source_image: the magick wand holding source image.
1966 %
1967 %    o compose: This operator affects how the composite is applied to the
1968 %      image.  The default is Over.  These are some of the compose methods
1969 %      availble.
1970 %
1971 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1972 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1973 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1974 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1975 %        DisplaceCompositeOp
1976 %
1977 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
1978 %               NorthEastGravity, WestGravity, CenterGravity,
1979 %               EastGravity, SouthWestGravity, SouthGravity,
1980 %               SouthEastGravity)
1981 %
1982 */
MagickCompositeImageGravity(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const GravityType gravity)1983 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1984   const MagickWand *source_wand,const CompositeOperator compose,
1985   const GravityType gravity)
1986 {
1987   MagickBooleanType
1988     status;
1989 
1990   RectangleInfo
1991     geometry;
1992 
1993   assert(wand != (MagickWand *) NULL);
1994   assert(wand->signature == MagickWandSignature);
1995   if (wand->debug != MagickFalse)
1996     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1997   if ((wand->images == (Image *) NULL) ||
1998       (source_wand->images == (Image *) NULL))
1999     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2000   SetGeometry(source_wand->images,&geometry);
2001   GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
2002     &geometry);
2003   status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
2004     geometry.x,geometry.y,wand->exception);
2005   return(status);
2006 }
2007 
2008 /*
2009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010 %                                                                             %
2011 %                                                                             %
2012 %                                                                             %
2013 %   M a g i c k C o m p o s i t e L a y e r s                                 %
2014 %                                                                             %
2015 %                                                                             %
2016 %                                                                             %
2017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018 %
2019 %  MagickCompositeLayers() composite the images in the source wand over the
2020 %  images in the destination wand in sequence, starting with the current
2021 %  image in both lists.
2022 %
2023 %  Each layer from the two image lists are composted together until the end of
2024 %  one of the image lists is reached.  The offset of each composition is also
2025 %  adjusted to match the virtual canvas offsets of each layer. As such the
2026 %  given offset is relative to the virtual canvas, and not the actual image.
2027 %
2028 %  Composition uses given x and y offsets, as the 'origin' location of the
2029 %  source images virtual canvas (not the real image) allowing you to compose a
2030 %  list of 'layer images' into the destiantioni images.  This makes it well
2031 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
2032 %  Animations' onto a static or other 'Coaleased Animation' destination image
2033 %  list.  GIF disposal handling is not looked at.
2034 %
2035 %  Special case:- If one of the image sequences is the last image (just a
2036 %  single image remaining), that image is repeatally composed with all the
2037 %  images in the other image list.  Either the source or destination lists may
2038 %  be the single image, for this situation.
2039 %
2040 %  In the case of a single destination image (or last image given), that image
2041 %  will ve cloned to match the number of images remaining in the source image
2042 %  list.
2043 %
2044 %  This is equivelent to the "-layer Composite" Shell API operator.
2045 %
2046 %  The format of the MagickCompositeLayers method is:
2047 %
2048 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2049 %        const MagickWand *source_wand, const CompositeOperator compose,
2050 %        const ssize_t x,const ssize_t y)
2051 %
2052 %  A description of each parameter follows:
2053 %
2054 %    o wand: the magick wand holding destaintion images
2055 %
2056 %    o source_wand: the wand holding the source images
2057 %
2058 %    o compose, x, y:  composition arguments
2059 %
2060 */
MagickCompositeLayers(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const ssize_t x,const ssize_t y)2061 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2062   const MagickWand *source_wand,const CompositeOperator compose,
2063   const ssize_t x,const ssize_t y)
2064 {
2065   MagickBooleanType
2066     status;
2067 
2068   assert(wand != (MagickWand *) NULL);
2069   assert(wand->signature == MagickWandSignature);
2070   if (wand->debug != MagickFalse)
2071     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2072   if ((wand->images == (Image *) NULL) ||
2073       (source_wand->images == (Image *) NULL))
2074     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2075   CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2076   status=MagickTrue;  /* FUTURE: determine status from exceptions */
2077   return(status);
2078 }
2079 
2080 /*
2081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2082 %                                                                             %
2083 %                                                                             %
2084 %                                                                             %
2085 %   M a g i c k C o n t r a s t I m a g e                                     %
2086 %                                                                             %
2087 %                                                                             %
2088 %                                                                             %
2089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2090 %
2091 %  MagickContrastImage() enhances the intensity differences between the lighter
2092 %  and darker elements of the image.  Set sharpen to a value other than 0 to
2093 %  increase the image contrast otherwise the contrast is reduced.
2094 %
2095 %  The format of the MagickContrastImage method is:
2096 %
2097 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
2098 %        const MagickBooleanType sharpen)
2099 %
2100 %  A description of each parameter follows:
2101 %
2102 %    o wand: the magick wand.
2103 %
2104 %    o sharpen: Increase or decrease image contrast.
2105 %
2106 %
2107 */
MagickContrastImage(MagickWand * wand,const MagickBooleanType sharpen)2108 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2109   const MagickBooleanType sharpen)
2110 {
2111   MagickBooleanType
2112     status;
2113 
2114   assert(wand != (MagickWand *) NULL);
2115   assert(wand->signature == MagickWandSignature);
2116   if (wand->debug != MagickFalse)
2117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2118   if (wand->images == (Image *) NULL)
2119     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2120   status=ContrastImage(wand->images,sharpen,wand->exception);
2121   return(status);
2122 }
2123 
2124 /*
2125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2126 %                                                                             %
2127 %                                                                             %
2128 %                                                                             %
2129 %   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                       %
2130 %                                                                             %
2131 %                                                                             %
2132 %                                                                             %
2133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2134 %
2135 %  MagickContrastStretchImage() enhances the contrast of a color image by
2136 %  adjusting the pixels color to span the entire range of colors available.
2137 %  You can also reduce the influence of a particular channel with a gamma
2138 %  value of 0.
2139 %
2140 %  The format of the MagickContrastStretchImage method is:
2141 %
2142 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2143 %        const double black_point,const double white_point)
2144 %
2145 %  A description of each parameter follows:
2146 %
2147 %    o wand: the magick wand.
2148 %
2149 %    o black_point: the black point.
2150 %
2151 %    o white_point: the white point.
2152 %
2153 */
MagickContrastStretchImage(MagickWand * wand,const double black_point,const double white_point)2154 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2155   const double black_point,const double white_point)
2156 {
2157   MagickBooleanType
2158     status;
2159 
2160   assert(wand != (MagickWand *) NULL);
2161   assert(wand->signature == MagickWandSignature);
2162   if (wand->debug != MagickFalse)
2163     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2164   if (wand->images == (Image *) NULL)
2165     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2166   status=ContrastStretchImage(wand->images,black_point,white_point,
2167     wand->exception);
2168   return(status);
2169 }
2170 
2171 /*
2172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2173 %                                                                             %
2174 %                                                                             %
2175 %                                                                             %
2176 %   M a g i c k C o n v o l v e I m a g e                                     %
2177 %                                                                             %
2178 %                                                                             %
2179 %                                                                             %
2180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2181 %
2182 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2183 %
2184 %  The format of the MagickConvolveImage method is:
2185 %
2186 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2187 %        const KernelInfo *kernel)
2188 %
2189 %  A description of each parameter follows:
2190 %
2191 %    o wand: the magick wand.
2192 %
2193 %    o kernel: An array of doubles representing the convolution kernel.
2194 %
2195 */
MagickConvolveImage(MagickWand * wand,const KernelInfo * kernel)2196 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2197   const KernelInfo *kernel)
2198 {
2199   Image
2200     *filter_image;
2201 
2202   assert(wand != (MagickWand *) NULL);
2203   assert(wand->signature == MagickWandSignature);
2204   if (wand->debug != MagickFalse)
2205     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2206   if (kernel == (const KernelInfo *) NULL)
2207     return(MagickFalse);
2208   if (wand->images == (Image *) NULL)
2209     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2210   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2211   if (filter_image == (Image *) NULL)
2212     return(MagickFalse);
2213   ReplaceImageInList(&wand->images,filter_image);
2214   return(MagickTrue);
2215 }
2216 
2217 /*
2218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2219 %                                                                             %
2220 %                                                                             %
2221 %                                                                             %
2222 %   M a g i c k C r o p I m a g e                                             %
2223 %                                                                             %
2224 %                                                                             %
2225 %                                                                             %
2226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2227 %
2228 %  MagickCropImage() extracts a region of the image.
2229 %
2230 %  The format of the MagickCropImage method is:
2231 %
2232 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2233 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2234 %
2235 %  A description of each parameter follows:
2236 %
2237 %    o wand: the magick wand.
2238 %
2239 %    o width: the region width.
2240 %
2241 %    o height: the region height.
2242 %
2243 %    o x: the region x-offset.
2244 %
2245 %    o y: the region y-offset.
2246 %
2247 */
MagickCropImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)2248 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2249   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2250 {
2251   Image
2252     *crop_image;
2253 
2254   RectangleInfo
2255     crop;
2256 
2257   assert(wand != (MagickWand *) NULL);
2258   assert(wand->signature == MagickWandSignature);
2259   if (wand->debug != MagickFalse)
2260     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2261   if (wand->images == (Image *) NULL)
2262     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2263   crop.width=width;
2264   crop.height=height;
2265   crop.x=x;
2266   crop.y=y;
2267   crop_image=CropImage(wand->images,&crop,wand->exception);
2268   if (crop_image == (Image *) NULL)
2269     return(MagickFalse);
2270   ReplaceImageInList(&wand->images,crop_image);
2271   return(MagickTrue);
2272 }
2273 
2274 /*
2275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2276 %                                                                             %
2277 %                                                                             %
2278 %                                                                             %
2279 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2280 %                                                                             %
2281 %                                                                             %
2282 %                                                                             %
2283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2284 %
2285 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2286 %  of positions.  If you cycle the colormap a number of times you can produce
2287 %  a psychodelic effect.
2288 %
2289 %  The format of the MagickCycleColormapImage method is:
2290 %
2291 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2292 %        const ssize_t displace)
2293 %
2294 %  A description of each parameter follows:
2295 %
2296 %    o wand: the magick wand.
2297 %
2298 %    o pixel_wand: the pixel wand.
2299 %
2300 */
MagickCycleColormapImage(MagickWand * wand,const ssize_t displace)2301 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2302   const ssize_t displace)
2303 {
2304   MagickBooleanType
2305     status;
2306 
2307   assert(wand != (MagickWand *) NULL);
2308   assert(wand->signature == MagickWandSignature);
2309   if (wand->debug != MagickFalse)
2310     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2311   if (wand->images == (Image *) NULL)
2312     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2313   status=CycleColormapImage(wand->images,displace,wand->exception);
2314   return(status);
2315 }
2316 
2317 /*
2318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2319 %                                                                             %
2320 %                                                                             %
2321 %                                                                             %
2322 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2323 %                                                                             %
2324 %                                                                             %
2325 %                                                                             %
2326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2327 %
2328 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2329 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2330 %  The data can be char, short int, int, float, or double.  Float and double
2331 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2332 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2333 %  example, to create a 640x480 image from unsigned red-green-blue character
2334 %  data, use
2335 %
2336 %      MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2337 %
2338 %  The format of the MagickConstituteImage method is:
2339 %
2340 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2341 %        const size_t columns,const size_t rows,const char *map,
2342 %        const StorageType storage,void *pixels)
2343 %
2344 %  A description of each parameter follows:
2345 %
2346 %    o wand: the magick wand.
2347 %
2348 %    o columns: width in pixels of the image.
2349 %
2350 %    o rows: height in pixels of the image.
2351 %
2352 %    o map:  This string reflects the expected ordering of the pixel array.
2353 %      It can be any combination or order of R = red, G = green, B = blue,
2354 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2355 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2356 %      P = pad.
2357 %
2358 %    o storage: Define the data type of the pixels.  Float and double types are
2359 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2360 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2361 %      LongPixel, QuantumPixel, or ShortPixel.
2362 %
2363 %    o pixels: This array of values contain the pixel components as defined by
2364 %      map and type.  You must preallocate this array where the expected
2365 %      length varies depending on the values of width, height, map, and type.
2366 %
2367 %
2368 */
MagickConstituteImage(MagickWand * wand,const size_t columns,const size_t rows,const char * map,const StorageType storage,const void * pixels)2369 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2370   const size_t columns,const size_t rows,const char *map,
2371   const StorageType storage,const void *pixels)
2372 {
2373   Image
2374     *images;
2375 
2376   assert(wand != (MagickWand *) NULL);
2377   assert(wand->signature == MagickWandSignature);
2378   if (wand->debug != MagickFalse)
2379     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2380   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2381   if (images == (Image *) NULL)
2382     return(MagickFalse);
2383   return(InsertImageInWand(wand,images));
2384 }
2385 
2386 /*
2387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2388 %                                                                             %
2389 %                                                                             %
2390 %                                                                             %
2391 %   M a g i c k D e c i p h e r I m a g e                                     %
2392 %                                                                             %
2393 %                                                                             %
2394 %                                                                             %
2395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2396 %
2397 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2398 %
2399 %  The format of the MagickDecipherImage method is:
2400 %
2401 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2402 %        const char *passphrase)
2403 %
2404 %  A description of each parameter follows:
2405 %
2406 %    o wand: the magick wand.
2407 %
2408 %    o passphrase: the passphrase.
2409 %
2410 */
MagickDecipherImage(MagickWand * wand,const char * passphrase)2411 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2412   const char *passphrase)
2413 {
2414   assert(wand != (MagickWand *) NULL);
2415   assert(wand->signature == MagickWandSignature);
2416   if (wand->debug != MagickFalse)
2417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2418   if (wand->images == (Image *) NULL)
2419     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2420   return(DecipherImage(wand->images,passphrase,wand->exception));
2421 }
2422 
2423 /*
2424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2425 %                                                                             %
2426 %                                                                             %
2427 %                                                                             %
2428 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2429 %                                                                             %
2430 %                                                                             %
2431 %                                                                             %
2432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2433 %
2434 %  MagickDeconstructImages() compares each image with the next in a sequence
2435 %  and returns the maximum bounding region of any pixel differences it
2436 %  discovers.
2437 %
2438 %  The format of the MagickDeconstructImages method is:
2439 %
2440 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2441 %
2442 %  A description of each parameter follows:
2443 %
2444 %    o wand: the magick wand.
2445 %
2446 */
MagickDeconstructImages(MagickWand * wand)2447 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2448 {
2449   Image
2450     *deconstruct_image;
2451 
2452   assert(wand != (MagickWand *) NULL);
2453   assert(wand->signature == MagickWandSignature);
2454   if (wand->debug != MagickFalse)
2455     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2456   if (wand->images == (Image *) NULL)
2457     return((MagickWand *) NULL);
2458   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2459     wand->exception);
2460   if (deconstruct_image == (Image *) NULL)
2461     return((MagickWand *) NULL);
2462   return(CloneMagickWandFromImages(wand,deconstruct_image));
2463 }
2464 
2465 /*
2466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2467 %                                                                             %
2468 %                                                                             %
2469 %                                                                             %
2470 %     M a g i c k D e s k e w I m a g e                                       %
2471 %                                                                             %
2472 %                                                                             %
2473 %                                                                             %
2474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2475 %
2476 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2477 %  occurs in scanned images because of the camera being misaligned,
2478 %  imperfections in the scanning or surface, or simply because the paper was
2479 %  not placed completely flat when scanned.
2480 %
2481 %  The format of the MagickDeskewImage method is:
2482 %
2483 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2484 %        const double threshold)
2485 %
2486 %  A description of each parameter follows:
2487 %
2488 %    o wand: the magick wand.
2489 %
2490 %    o threshold: separate background from foreground.
2491 %
2492 */
MagickDeskewImage(MagickWand * wand,const double threshold)2493 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2494   const double threshold)
2495 {
2496   Image
2497     *sepia_image;
2498 
2499   assert(wand != (MagickWand *) NULL);
2500   assert(wand->signature == MagickWandSignature);
2501   if (wand->debug != MagickFalse)
2502     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2503   if (wand->images == (Image *) NULL)
2504     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2505   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2506   if (sepia_image == (Image *) NULL)
2507     return(MagickFalse);
2508   ReplaceImageInList(&wand->images,sepia_image);
2509   return(MagickTrue);
2510 }
2511 
2512 /*
2513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2514 %                                                                             %
2515 %                                                                             %
2516 %                                                                             %
2517 %     M a g i c k D e s p e c k l e I m a g e                                 %
2518 %                                                                             %
2519 %                                                                             %
2520 %                                                                             %
2521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2522 %
2523 %  MagickDespeckleImage() reduces the speckle noise in an image while
2524 %  perserving the edges of the original image.
2525 %
2526 %  The format of the MagickDespeckleImage method is:
2527 %
2528 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2529 %
2530 %  A description of each parameter follows:
2531 %
2532 %    o wand: the magick wand.
2533 %
2534 */
MagickDespeckleImage(MagickWand * wand)2535 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2536 {
2537   Image
2538     *despeckle_image;
2539 
2540   assert(wand != (MagickWand *) NULL);
2541   assert(wand->signature == MagickWandSignature);
2542   if (wand->debug != MagickFalse)
2543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2544   if (wand->images == (Image *) NULL)
2545     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2546   despeckle_image=DespeckleImage(wand->images,wand->exception);
2547   if (despeckle_image == (Image *) NULL)
2548     return(MagickFalse);
2549   ReplaceImageInList(&wand->images,despeckle_image);
2550   return(MagickTrue);
2551 }
2552 
2553 /*
2554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555 %                                                                             %
2556 %                                                                             %
2557 %                                                                             %
2558 %   M a g i c k D e s t r o y I m a g e                                       %
2559 %                                                                             %
2560 %                                                                             %
2561 %                                                                             %
2562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563 %
2564 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2565 %  with the image if the reference count becomes zero.
2566 %
2567 %  The format of the MagickDestroyImage method is:
2568 %
2569 %      Image *MagickDestroyImage(Image *image)
2570 %
2571 %  A description of each parameter follows:
2572 %
2573 %    o image: the image.
2574 %
2575 */
MagickDestroyImage(Image * image)2576 WandExport Image *MagickDestroyImage(Image *image)
2577 {
2578   return(DestroyImage(image));
2579 }
2580 
2581 /*
2582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2583 %                                                                             %
2584 %                                                                             %
2585 %                                                                             %
2586 %   M a g i c k D i s p l a y I m a g e                                       %
2587 %                                                                             %
2588 %                                                                             %
2589 %                                                                             %
2590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2591 %
2592 %  MagickDisplayImage() displays an image.
2593 %
2594 %  The format of the MagickDisplayImage method is:
2595 %
2596 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2597 %        const char *server_name)
2598 %
2599 %  A description of each parameter follows:
2600 %
2601 %    o wand: the magick wand.
2602 %
2603 %    o server_name: the X server name.
2604 %
2605 */
MagickDisplayImage(MagickWand * wand,const char * server_name)2606 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2607   const char *server_name)
2608 {
2609   Image
2610     *image;
2611 
2612   MagickBooleanType
2613     status;
2614 
2615   assert(wand != (MagickWand *) NULL);
2616   assert(wand->signature == MagickWandSignature);
2617   if (wand->debug != MagickFalse)
2618     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2619   if (wand->images == (Image *) NULL)
2620     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2621   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2622   if (image == (Image *) NULL)
2623     return(MagickFalse);
2624   (void) CloneString(&wand->image_info->server_name,server_name);
2625   status=DisplayImages(wand->image_info,image,wand->exception);
2626   image=DestroyImage(image);
2627   return(status);
2628 }
2629 
2630 /*
2631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2632 %                                                                             %
2633 %                                                                             %
2634 %                                                                             %
2635 %   M a g i c k D i s p l a y I m a g e s                                     %
2636 %                                                                             %
2637 %                                                                             %
2638 %                                                                             %
2639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2640 %
2641 %  MagickDisplayImages() displays an image or image sequence.
2642 %
2643 %  The format of the MagickDisplayImages method is:
2644 %
2645 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2646 %        const char *server_name)
2647 %
2648 %  A description of each parameter follows:
2649 %
2650 %    o wand: the magick wand.
2651 %
2652 %    o server_name: the X server name.
2653 %
2654 */
MagickDisplayImages(MagickWand * wand,const char * server_name)2655 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2656   const char *server_name)
2657 {
2658   MagickBooleanType
2659     status;
2660 
2661   assert(wand != (MagickWand *) NULL);
2662   assert(wand->signature == MagickWandSignature);
2663   if (wand->debug != MagickFalse)
2664     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2665   (void) CloneString(&wand->image_info->server_name,server_name);
2666   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2667   return(status);
2668 }
2669 
2670 /*
2671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2672 %                                                                             %
2673 %                                                                             %
2674 %                                                                             %
2675 %   M a g i c k D i s t o r t I m a g e                                       %
2676 %                                                                             %
2677 %                                                                             %
2678 %                                                                             %
2679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2680 %
2681 %  MagickDistortImage() distorts an image using various distortion methods, by
2682 %  mapping color lookups of the source image to a new destination image
2683 %  usally of the same size as the source image, unless 'bestfit' is set to
2684 %  true.
2685 %
2686 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2687 %  adjusted to ensure the whole source 'image' will just fit within the final
2688 %  destination image, which will be sized and offset accordingly.  Also in
2689 %  many cases the virtual offset of the source image will be taken into
2690 %  account in the mapping.
2691 %
2692 %  The format of the MagickDistortImage method is:
2693 %
2694 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2695 %        const DistortMethod method,const size_t number_arguments,
2696 %        const double *arguments,const MagickBooleanType bestfit)
2697 %
2698 %  A description of each parameter follows:
2699 %
2700 %    o image: the image to be distorted.
2701 %
2702 %    o method: the method of image distortion.
2703 %
2704 %        ArcDistortion always ignores the source image offset, and always
2705 %        'bestfit' the destination image with the top left corner offset
2706 %        relative to the polar mapping center.
2707 %
2708 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2709 %        style of image distortion.
2710 %
2711 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2712 %        distortion when more than the minimum number of control point pairs
2713 %        are provided.
2714 %
2715 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2716 %        that 4 control point pairs are provided. While Affine distortions let
2717 %        you use any number of control point pairs, that is Zero pairs is a
2718 %        no-Op (viewport only) distrotion, one pair is a translation and two
2719 %        pairs of control points do a scale-rotate-translate, without any
2720 %        shearing.
2721 %
2722 %    o number_arguments: the number of arguments given for this distortion
2723 %      method.
2724 %
2725 %    o arguments: the arguments for this distortion method.
2726 %
2727 %    o bestfit: Attempt to resize destination to fit distorted source.
2728 %
2729 */
MagickDistortImage(MagickWand * wand,const DistortMethod method,const size_t number_arguments,const double * arguments,const MagickBooleanType bestfit)2730 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2731   const DistortMethod method,const size_t number_arguments,
2732   const double *arguments,const MagickBooleanType bestfit)
2733 {
2734   Image
2735     *distort_image;
2736 
2737   assert(wand != (MagickWand *) NULL);
2738   assert(wand->signature == MagickWandSignature);
2739   if (wand->debug != MagickFalse)
2740     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2741   if (wand->images == (Image *) NULL)
2742     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2743   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2744     bestfit,wand->exception);
2745   if (distort_image == (Image *) NULL)
2746     return(MagickFalse);
2747   ReplaceImageInList(&wand->images,distort_image);
2748   return(MagickTrue);
2749 }
2750 
2751 /*
2752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2753 %                                                                             %
2754 %                                                                             %
2755 %                                                                             %
2756 %   M a g i c k D r a w I m a g e                                             %
2757 %                                                                             %
2758 %                                                                             %
2759 %                                                                             %
2760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2761 %
2762 %  MagickDrawImage() renders the drawing wand on the current image.
2763 %
2764 %  The format of the MagickDrawImage method is:
2765 %
2766 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2767 %        const DrawingWand *drawing_wand)
2768 %
2769 %  A description of each parameter follows:
2770 %
2771 %    o wand: the magick wand.
2772 %
2773 %    o drawing_wand: the draw wand.
2774 %
2775 */
MagickDrawImage(MagickWand * wand,const DrawingWand * drawing_wand)2776 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2777   const DrawingWand *drawing_wand)
2778 {
2779   char
2780     *primitive;
2781 
2782   DrawInfo
2783     *draw_info;
2784 
2785   MagickBooleanType
2786     status;
2787 
2788   assert(wand != (MagickWand *) NULL);
2789   assert(wand->signature == MagickWandSignature);
2790   if (wand->debug != MagickFalse)
2791     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2792   if (wand->images == (Image *) NULL)
2793     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2794   draw_info=PeekDrawingWand(drawing_wand);
2795   if ((draw_info == (DrawInfo *) NULL) ||
2796       (draw_info->primitive == (char *) NULL))
2797     return(MagickFalse);
2798   primitive=AcquireString(draw_info->primitive);
2799   draw_info=DestroyDrawInfo(draw_info);
2800   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2801   draw_info->primitive=primitive;
2802   status=DrawImage(wand->images,draw_info,wand->exception);
2803   draw_info=DestroyDrawInfo(draw_info);
2804   return(status);
2805 }
2806 
2807 /*
2808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2809 %                                                                             %
2810 %                                                                             %
2811 %                                                                             %
2812 %   M a g i c k E d g e I m a g e                                             %
2813 %                                                                             %
2814 %                                                                             %
2815 %                                                                             %
2816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2817 %
2818 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2819 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2820 %  radius for you.
2821 %
2822 %  The format of the MagickEdgeImage method is:
2823 %
2824 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2825 %
2826 %  A description of each parameter follows:
2827 %
2828 %    o wand: the magick wand.
2829 %
2830 %    o radius: the radius of the pixel neighborhood.
2831 %
2832 */
MagickEdgeImage(MagickWand * wand,const double radius)2833 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2834   const double radius)
2835 {
2836   Image
2837     *edge_image;
2838 
2839   assert(wand != (MagickWand *) NULL);
2840   assert(wand->signature == MagickWandSignature);
2841   if (wand->debug != MagickFalse)
2842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2843   if (wand->images == (Image *) NULL)
2844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2845   edge_image=EdgeImage(wand->images,radius,wand->exception);
2846   if (edge_image == (Image *) NULL)
2847     return(MagickFalse);
2848   ReplaceImageInList(&wand->images,edge_image);
2849   return(MagickTrue);
2850 }
2851 
2852 /*
2853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2854 %                                                                             %
2855 %                                                                             %
2856 %                                                                             %
2857 %   M a g i c k E m b o s s I m a g e                                         %
2858 %                                                                             %
2859 %                                                                             %
2860 %                                                                             %
2861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2862 %
2863 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2864 %  effect.  We convolve the image with a Gaussian operator of the given radius
2865 %  and standard deviation (sigma).  For reasonable results, radius should be
2866 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2867 %  radius for you.
2868 %
2869 %  The format of the MagickEmbossImage method is:
2870 %
2871 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2872 %        const double sigma)
2873 %
2874 %  A description of each parameter follows:
2875 %
2876 %    o wand: the magick wand.
2877 %
2878 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2879 %      pixel.
2880 %
2881 %    o sigma: the standard deviation of the Gaussian, in pixels.
2882 %
2883 */
MagickEmbossImage(MagickWand * wand,const double radius,const double sigma)2884 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2885   const double radius,const double sigma)
2886 {
2887   Image
2888     *emboss_image;
2889 
2890   assert(wand != (MagickWand *) NULL);
2891   assert(wand->signature == MagickWandSignature);
2892   if (wand->debug != MagickFalse)
2893     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2894   if (wand->images == (Image *) NULL)
2895     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2896   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2897   if (emboss_image == (Image *) NULL)
2898     return(MagickFalse);
2899   ReplaceImageInList(&wand->images,emboss_image);
2900   return(MagickTrue);
2901 }
2902 
2903 /*
2904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2905 %                                                                             %
2906 %                                                                             %
2907 %                                                                             %
2908 %   M a g i c k E n c i p h e r I m a g e                                     %
2909 %                                                                             %
2910 %                                                                             %
2911 %                                                                             %
2912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2913 %
2914 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2915 %
2916 %  The format of the MagickEncipherImage method is:
2917 %
2918 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2919 %        const char *passphrase)
2920 %
2921 %  A description of each parameter follows:
2922 %
2923 %    o wand: the magick wand.
2924 %
2925 %    o passphrase: the passphrase.
2926 %
2927 */
MagickEncipherImage(MagickWand * wand,const char * passphrase)2928 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2929   const char *passphrase)
2930 {
2931   assert(wand != (MagickWand *) NULL);
2932   assert(wand->signature == MagickWandSignature);
2933   if (wand->debug != MagickFalse)
2934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2935   if (wand->images == (Image *) NULL)
2936     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2937   return(EncipherImage(wand->images,passphrase,wand->exception));
2938 }
2939 
2940 /*
2941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2942 %                                                                             %
2943 %                                                                             %
2944 %                                                                             %
2945 %   M a g i c k E n h a n c e I m a g e                                       %
2946 %                                                                             %
2947 %                                                                             %
2948 %                                                                             %
2949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2950 %
2951 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2952 %  noisy image.
2953 %
2954 %  The format of the MagickEnhanceImage method is:
2955 %
2956 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2957 %
2958 %  A description of each parameter follows:
2959 %
2960 %    o wand: the magick wand.
2961 %
2962 */
MagickEnhanceImage(MagickWand * wand)2963 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2964 {
2965   Image
2966     *enhance_image;
2967 
2968   assert(wand != (MagickWand *) NULL);
2969   assert(wand->signature == MagickWandSignature);
2970   if (wand->debug != MagickFalse)
2971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2972   if (wand->images == (Image *) NULL)
2973     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2974   enhance_image=EnhanceImage(wand->images,wand->exception);
2975   if (enhance_image == (Image *) NULL)
2976     return(MagickFalse);
2977   ReplaceImageInList(&wand->images,enhance_image);
2978   return(MagickTrue);
2979 }
2980 
2981 /*
2982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2983 %                                                                             %
2984 %                                                                             %
2985 %                                                                             %
2986 %   M a g i c k E q u a l i z e I m a g e                                     %
2987 %                                                                             %
2988 %                                                                             %
2989 %                                                                             %
2990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2991 %
2992 %  MagickEqualizeImage() equalizes the image histogram.
2993 %
2994 %  The format of the MagickEqualizeImage method is:
2995 %
2996 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2997 %
2998 %  A description of each parameter follows:
2999 %
3000 %    o wand: the magick wand.
3001 %
3002 %    o channel: the image channel(s).
3003 %
3004 */
MagickEqualizeImage(MagickWand * wand)3005 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3006 {
3007   MagickBooleanType
3008     status;
3009 
3010   assert(wand != (MagickWand *) NULL);
3011   assert(wand->signature == MagickWandSignature);
3012   if (wand->debug != MagickFalse)
3013     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3014   if (wand->images == (Image *) NULL)
3015     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3016   status=EqualizeImage(wand->images,wand->exception);
3017   return(status);
3018 }
3019 
3020 /*
3021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3022 %                                                                             %
3023 %                                                                             %
3024 %                                                                             %
3025 %   M a g i c k E v a l u a t e I m a g e                                     %
3026 %                                                                             %
3027 %                                                                             %
3028 %                                                                             %
3029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3030 %
3031 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
3032 %  expression to an image.  Use these operators to lighten or darken an image,
3033 %  to increase or decrease contrast in an image, or to produce the "negative"
3034 %  of an image.
3035 %
3036 %  The format of the MagickEvaluateImage method is:
3037 %
3038 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3039 %        const MagickEvaluateOperator operator,const double value)
3040 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3041 %        const MagickEvaluateOperator operator)
3042 %
3043 %  A description of each parameter follows:
3044 %
3045 %    o wand: the magick wand.
3046 %
3047 %    o op: A channel operator.
3048 %
3049 %    o value: A value value.
3050 %
3051 */
3052 
MagickEvaluateImages(MagickWand * wand,const MagickEvaluateOperator op)3053 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3054   const MagickEvaluateOperator op)
3055 {
3056   Image
3057     *evaluate_image;
3058 
3059   assert(wand != (MagickWand *) NULL);
3060   assert(wand->signature == MagickWandSignature);
3061   if (wand->debug != MagickFalse)
3062     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3063   if (wand->images == (Image *) NULL)
3064     return((MagickWand *) NULL);
3065   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3066   if (evaluate_image == (Image *) NULL)
3067     return((MagickWand *) NULL);
3068   return(CloneMagickWandFromImages(wand,evaluate_image));
3069 }
3070 
MagickEvaluateImage(MagickWand * wand,const MagickEvaluateOperator op,const double value)3071 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3072   const MagickEvaluateOperator op,const double value)
3073 {
3074   MagickBooleanType
3075     status;
3076 
3077   assert(wand != (MagickWand *) NULL);
3078   assert(wand->signature == MagickWandSignature);
3079   if (wand->debug != MagickFalse)
3080     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3081   if (wand->images == (Image *) NULL)
3082     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3083   status=EvaluateImage(wand->images,op,value,wand->exception);
3084   return(status);
3085 }
3086 
3087 /*
3088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3089 %                                                                             %
3090 %                                                                             %
3091 %                                                                             %
3092 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
3093 %                                                                             %
3094 %                                                                             %
3095 %                                                                             %
3096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3097 %
3098 %  MagickExportImagePixels() extracts pixel data from an image and returns it
3099 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3100 %  an error is encountered.  The data is returned as char, short int, int,
3101 %  ssize_t, float, or double in the order specified by map.
3102 %
3103 %  Suppose you want to extract the first scanline of a 640x480 image as
3104 %  character data in red-green-blue order:
3105 %
3106 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3107 %
3108 %  The format of the MagickExportImagePixels method is:
3109 %
3110 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3111 %        const ssize_t x,const ssize_t y,const size_t columns,
3112 %        const size_t rows,const char *map,const StorageType storage,
3113 %        void *pixels)
3114 %
3115 %  A description of each parameter follows:
3116 %
3117 %    o wand: the magick wand.
3118 %
3119 %    o x, y, columns, rows:  These values define the perimeter
3120 %      of a region of pixels you want to extract.
3121 %
3122 %    o map:  This string reflects the expected ordering of the pixel array.
3123 %      It can be any combination or order of R = red, G = green, B = blue,
3124 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3125 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3126 %      P = pad.
3127 %
3128 %    o storage: Define the data type of the pixels.  Float and double types are
3129 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3130 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3131 %      LongPixel, QuantumPixel, or ShortPixel.
3132 %
3133 %    o pixels: This array of values contain the pixel components as defined by
3134 %      map and type.  You must preallocate this array where the expected
3135 %      length varies depending on the values of width, height, map, and type.
3136 %
3137 */
MagickExportImagePixels(MagickWand * wand,const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,const char * map,const StorageType storage,void * pixels)3138 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3139   const ssize_t x,const ssize_t y,const size_t columns,
3140   const size_t rows,const char *map,const StorageType storage,
3141   void *pixels)
3142 {
3143   MagickBooleanType
3144     status;
3145 
3146   assert(wand != (MagickWand *) NULL);
3147   assert(wand->signature == MagickWandSignature);
3148   if (wand->debug != MagickFalse)
3149     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3150   if (wand->images == (Image *) NULL)
3151     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3152   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3153     storage,pixels,wand->exception);
3154   return(status);
3155 }
3156 
3157 /*
3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3159 %                                                                             %
3160 %                                                                             %
3161 %                                                                             %
3162 %   M a g i c k E x t e n t I m a g e                                         %
3163 %                                                                             %
3164 %                                                                             %
3165 %                                                                             %
3166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3167 %
3168 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3169 %  and wand background color.  Set the (x,y) offset of the geometry to move
3170 %  the original wand relative to the extended wand.
3171 %
3172 %  The format of the MagickExtentImage method is:
3173 %
3174 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3175 %        const size_t height,const ssize_t x,const ssize_t y)
3176 %
3177 %  A description of each parameter follows:
3178 %
3179 %    o wand: the magick wand.
3180 %
3181 %    o width: the region width.
3182 %
3183 %    o height: the region height.
3184 %
3185 %    o x: the region x offset.
3186 %
3187 %    o y: the region y offset.
3188 %
3189 */
MagickExtentImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)3190 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3191   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3192 {
3193   Image
3194     *extent_image;
3195 
3196   RectangleInfo
3197     extent;
3198 
3199   assert(wand != (MagickWand *) NULL);
3200   assert(wand->signature == MagickWandSignature);
3201   if (wand->debug != MagickFalse)
3202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3203   if (wand->images == (Image *) NULL)
3204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3205   extent.width=width;
3206   extent.height=height;
3207   extent.x=x;
3208   extent.y=y;
3209   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3210   if (extent_image == (Image *) NULL)
3211     return(MagickFalse);
3212   ReplaceImageInList(&wand->images,extent_image);
3213   return(MagickTrue);
3214 }
3215 
3216 /*
3217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3218 %                                                                             %
3219 %                                                                             %
3220 %                                                                             %
3221 %   M a g i c k F l i p I m a g e                                             %
3222 %                                                                             %
3223 %                                                                             %
3224 %                                                                             %
3225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3226 %
3227 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3228 %  around the central x-axis.
3229 %
3230 %  The format of the MagickFlipImage method is:
3231 %
3232 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3233 %
3234 %  A description of each parameter follows:
3235 %
3236 %    o wand: the magick wand.
3237 %
3238 */
MagickFlipImage(MagickWand * wand)3239 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3240 {
3241   Image
3242     *flip_image;
3243 
3244   assert(wand != (MagickWand *) NULL);
3245   assert(wand->signature == MagickWandSignature);
3246   if (wand->debug != MagickFalse)
3247     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3248   if (wand->images == (Image *) NULL)
3249     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3250   flip_image=FlipImage(wand->images,wand->exception);
3251   if (flip_image == (Image *) NULL)
3252     return(MagickFalse);
3253   ReplaceImageInList(&wand->images,flip_image);
3254   return(MagickTrue);
3255 }
3256 
3257 /*
3258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3259 %                                                                             %
3260 %                                                                             %
3261 %                                                                             %
3262 %   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                         %
3263 %                                                                             %
3264 %                                                                             %
3265 %                                                                             %
3266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3267 %
3268 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3269 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3270 %  specified, the color value is changed for any neighbor pixel that does not
3271 %  match the bordercolor member of image.
3272 %
3273 %  The format of the MagickFloodfillPaintImage method is:
3274 %
3275 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3276 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3277 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3278 %
3279 %  A description of each parameter follows:
3280 %
3281 %    o wand: the magick wand.
3282 %
3283 %    o fill: the floodfill color pixel wand.
3284 %
3285 %    o fuzz: By default target must match a particular pixel color
3286 %      exactly.  However, in many cases two colors may differ by a small amount.
3287 %      The fuzz member of image defines how much tolerance is acceptable to
3288 %      consider two colors as the same.  For example, set fuzz to 10 and the
3289 %      color red at intensities of 100 and 102 respectively are now interpreted
3290 %      as the same color for the purposes of the floodfill.
3291 %
3292 %    o bordercolor: the border color pixel wand.
3293 %
3294 %    o x,y: the starting location of the operation.
3295 %
3296 %    o invert: paint any pixel that does not match the target color.
3297 %
3298 */
MagickFloodfillPaintImage(MagickWand * wand,const PixelWand * fill,const double fuzz,const PixelWand * bordercolor,const ssize_t x,const ssize_t y,const MagickBooleanType invert)3299 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3300   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3301   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3302 {
3303   DrawInfo
3304     *draw_info;
3305 
3306   MagickBooleanType
3307     status;
3308 
3309   PixelInfo
3310     target;
3311 
3312   assert(wand != (MagickWand *) NULL);
3313   assert(wand->signature == MagickWandSignature);
3314   if (wand->debug != MagickFalse)
3315     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3316   if (wand->images == (Image *) NULL)
3317     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3318   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3319   PixelGetQuantumPacket(fill,&draw_info->fill);
3320   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3321     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3322   if (bordercolor != (PixelWand *) NULL)
3323     PixelGetMagickColor(bordercolor,&target);
3324   wand->images->fuzz=fuzz;
3325   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3326     wand->exception);
3327   draw_info=DestroyDrawInfo(draw_info);
3328   return(status);
3329 }
3330 
3331 /*
3332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3333 %                                                                             %
3334 %                                                                             %
3335 %                                                                             %
3336 %   M a g i c k F l o p I m a g e                                             %
3337 %                                                                             %
3338 %                                                                             %
3339 %                                                                             %
3340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3341 %
3342 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3343 %  around the central y-axis.
3344 %
3345 %  The format of the MagickFlopImage method is:
3346 %
3347 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3348 %
3349 %  A description of each parameter follows:
3350 %
3351 %    o wand: the magick wand.
3352 %
3353 */
MagickFlopImage(MagickWand * wand)3354 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3355 {
3356   Image
3357     *flop_image;
3358 
3359   assert(wand != (MagickWand *) NULL);
3360   assert(wand->signature == MagickWandSignature);
3361   if (wand->debug != MagickFalse)
3362     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3363   if (wand->images == (Image *) NULL)
3364     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3365   flop_image=FlopImage(wand->images,wand->exception);
3366   if (flop_image == (Image *) NULL)
3367     return(MagickFalse);
3368   ReplaceImageInList(&wand->images,flop_image);
3369   return(MagickTrue);
3370 }
3371 
3372 /*
3373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3374 %                                                                             %
3375 %                                                                             %
3376 %                                                                             %
3377 %   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                     %
3378 %                                                                             %
3379 %                                                                             %
3380 %                                                                             %
3381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3382 %
3383 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3384 %  transform (DFT) of the image either as a magnitude / phase or real /
3385 %  imaginary image pair.
3386 %
3387 %  The format of the MagickForwardFourierTransformImage method is:
3388 %
3389 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3390 %        const MagickBooleanType magnitude)
3391 %
3392 %  A description of each parameter follows:
3393 %
3394 %    o wand: the magick wand.
3395 %
3396 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3397 %      imaginary image pair.
3398 %
3399 */
MagickForwardFourierTransformImage(MagickWand * wand,const MagickBooleanType magnitude)3400 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3401   MagickWand *wand,const MagickBooleanType magnitude)
3402 {
3403   Image
3404     *forward_image;
3405 
3406   assert(wand != (MagickWand *) NULL);
3407   assert(wand->signature == MagickWandSignature);
3408   if (wand->debug != MagickFalse)
3409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3410   if (wand->images == (Image *) NULL)
3411     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3412   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3413     wand->exception);
3414   if (forward_image == (Image *) NULL)
3415     return(MagickFalse);
3416   ReplaceImageInList(&wand->images,forward_image);
3417   return(MagickTrue);
3418 }
3419 
3420 /*
3421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3422 %                                                                             %
3423 %                                                                             %
3424 %                                                                             %
3425 %   M a g i c k F r a m e I m a g e                                           %
3426 %                                                                             %
3427 %                                                                             %
3428 %                                                                             %
3429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3430 %
3431 %  MagickFrameImage() adds a simulated three-dimensional border around the
3432 %  image.  The width and height specify the border width of the vertical and
3433 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3434 %  width of the inner and outer shadows of the frame.
3435 %
3436 %  The format of the MagickFrameImage method is:
3437 %
3438 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3439 %        const PixelWand *matte_color,const size_t width,
3440 %        const size_t height,const ssize_t inner_bevel,
3441 %        const ssize_t outer_bevel,const CompositeOperator compose)
3442 %
3443 %  A description of each parameter follows:
3444 %
3445 %    o wand: the magick wand.
3446 %
3447 %    o matte_color: the frame color pixel wand.
3448 %
3449 %    o width: the border width.
3450 %
3451 %    o height: the border height.
3452 %
3453 %    o inner_bevel: the inner bevel width.
3454 %
3455 %    o outer_bevel: the outer bevel width.
3456 %
3457 %    o compose: the composite operator.
3458 %
3459 */
MagickFrameImage(MagickWand * wand,const PixelWand * matte_color,const size_t width,const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel,const CompositeOperator compose)3460 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3461   const PixelWand *matte_color,const size_t width,const size_t height,
3462   const ssize_t inner_bevel,const ssize_t outer_bevel,
3463   const CompositeOperator compose)
3464 {
3465   Image
3466     *frame_image;
3467 
3468   FrameInfo
3469     frame_info;
3470 
3471   assert(wand != (MagickWand *) NULL);
3472   assert(wand->signature == MagickWandSignature);
3473   if (wand->debug != MagickFalse)
3474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3475   if (wand->images == (Image *) NULL)
3476     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3477   (void) memset(&frame_info,0,sizeof(frame_info));
3478   frame_info.width=wand->images->columns+2*width;
3479   frame_info.height=wand->images->rows+2*height;
3480   frame_info.x=(ssize_t) width;
3481   frame_info.y=(ssize_t) height;
3482   frame_info.inner_bevel=inner_bevel;
3483   frame_info.outer_bevel=outer_bevel;
3484   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3485   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3486   if (frame_image == (Image *) NULL)
3487     return(MagickFalse);
3488   ReplaceImageInList(&wand->images,frame_image);
3489   return(MagickTrue);
3490 }
3491 
3492 /*
3493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3494 %                                                                             %
3495 %                                                                             %
3496 %                                                                             %
3497 %   M a g i c k F u n c t i o n I m a g e                                     %
3498 %                                                                             %
3499 %                                                                             %
3500 %                                                                             %
3501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3502 %
3503 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3504 %  expression to an image.  Use these operators to lighten or darken an image,
3505 %  to increase or decrease contrast in an image, or to produce the "negative"
3506 %  of an image.
3507 %
3508 %  The format of the MagickFunctionImage method is:
3509 %
3510 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3511 %        const MagickFunction function,const size_t number_arguments,
3512 %        const double *arguments)
3513 %
3514 %  A description of each parameter follows:
3515 %
3516 %    o wand: the magick wand.
3517 %
3518 %    o function: the image function.
3519 %
3520 %    o number_arguments: the number of function arguments.
3521 %
3522 %    o arguments: the function arguments.
3523 %
3524 */
MagickFunctionImage(MagickWand * wand,const MagickFunction function,const size_t number_arguments,const double * arguments)3525 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3526   const MagickFunction function,const size_t number_arguments,
3527   const double *arguments)
3528 {
3529   MagickBooleanType
3530     status;
3531 
3532   assert(wand != (MagickWand *) NULL);
3533   assert(wand->signature == MagickWandSignature);
3534   if (wand->debug != MagickFalse)
3535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3536   if (wand->images == (Image *) NULL)
3537     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3538   status=FunctionImage(wand->images,function,number_arguments,arguments,
3539     wand->exception);
3540   return(status);
3541 }
3542 
3543 /*
3544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3545 %                                                                             %
3546 %                                                                             %
3547 %                                                                             %
3548 %   M a g i c k F x I m a g e                                                 %
3549 %                                                                             %
3550 %                                                                             %
3551 %                                                                             %
3552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3553 %
3554 %  MagickFxImage() evaluate expression for each pixel in the image.
3555 %
3556 %  The format of the MagickFxImage method is:
3557 %
3558 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3559 %
3560 %  A description of each parameter follows:
3561 %
3562 %    o wand: the magick wand.
3563 %
3564 %    o expression: the expression.
3565 %
3566 */
MagickFxImage(MagickWand * wand,const char * expression)3567 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3568 {
3569   Image
3570     *fx_image;
3571 
3572   assert(wand != (MagickWand *) NULL);
3573   assert(wand->signature == MagickWandSignature);
3574   if (wand->debug != MagickFalse)
3575     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3576   if (wand->images == (Image *) NULL)
3577     return((MagickWand *) NULL);
3578   fx_image=FxImage(wand->images,expression,wand->exception);
3579   if (fx_image == (Image *) NULL)
3580     return((MagickWand *) NULL);
3581   return(CloneMagickWandFromImages(wand,fx_image));
3582 }
3583 
3584 /*
3585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3586 %                                                                             %
3587 %                                                                             %
3588 %                                                                             %
3589 %   M a g i c k G a m m a I m a g e                                           %
3590 %                                                                             %
3591 %                                                                             %
3592 %                                                                             %
3593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3594 %
3595 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3596 %  different devices will have perceptual differences in the way the image's
3597 %  intensities are represented on the screen.  Specify individual gamma levels
3598 %  for the red, green, and blue channels, or adjust all three with the gamma
3599 %  parameter.  Values typically range from 0.8 to 2.3.
3600 %
3601 %  You can also reduce the influence of a particular channel with a gamma
3602 %  value of 0.
3603 %
3604 %  The format of the MagickGammaImage method is:
3605 %
3606 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3607 %
3608 %  A description of each parameter follows:
3609 %
3610 %    o wand: the magick wand.
3611 %
3612 %    o level: Define the level of gamma correction.
3613 %
3614 */
MagickGammaImage(MagickWand * wand,const double gamma)3615 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3616   const double gamma)
3617 {
3618   MagickBooleanType
3619     status;
3620 
3621   assert(wand != (MagickWand *) NULL);
3622   assert(wand->signature == MagickWandSignature);
3623   if (wand->debug != MagickFalse)
3624     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3625   if (wand->images == (Image *) NULL)
3626     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3627   status=GammaImage(wand->images,gamma,wand->exception);
3628   return(status);
3629 }
3630 
3631 /*
3632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633 %                                                                             %
3634 %                                                                             %
3635 %                                                                             %
3636 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3637 %                                                                             %
3638 %                                                                             %
3639 %                                                                             %
3640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641 %
3642 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3643 %  Gaussian operator of the given radius and standard deviation (sigma).
3644 %  For reasonable results, the radius should be larger than sigma.  Use a
3645 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3646 %
3647 %  The format of the MagickGaussianBlurImage method is:
3648 %
3649 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3650 %        const double radius,const double sigma)
3651 %
3652 %  A description of each parameter follows:
3653 %
3654 %    o wand: the magick wand.
3655 %
3656 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3657 %      pixel.
3658 %
3659 %    o sigma: the standard deviation of the Gaussian, in pixels.
3660 %
3661 */
MagickGaussianBlurImage(MagickWand * wand,const double radius,const double sigma)3662 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3663   const double radius,const double sigma)
3664 {
3665   Image
3666     *blur_image;
3667 
3668   assert(wand != (MagickWand *) NULL);
3669   assert(wand->signature == MagickWandSignature);
3670   if (wand->debug != MagickFalse)
3671     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3672   if (wand->images == (Image *) NULL)
3673     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3674   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3675   if (blur_image == (Image *) NULL)
3676     return(MagickFalse);
3677   ReplaceImageInList(&wand->images,blur_image);
3678   return(MagickTrue);
3679 }
3680 
3681 /*
3682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3683 %                                                                             %
3684 %                                                                             %
3685 %                                                                             %
3686 %   M a g i c k G e t I m a g e                                               %
3687 %                                                                             %
3688 %                                                                             %
3689 %                                                                             %
3690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3691 %
3692 %  MagickGetImage() gets the image at the current image index.
3693 %
3694 %  The format of the MagickGetImage method is:
3695 %
3696 %      MagickWand *MagickGetImage(MagickWand *wand)
3697 %
3698 %  A description of each parameter follows:
3699 %
3700 %    o wand: the magick wand.
3701 %
3702 */
MagickGetImage(MagickWand * wand)3703 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3704 {
3705   Image
3706     *image;
3707 
3708   assert(wand != (MagickWand *) NULL);
3709   assert(wand->signature == MagickWandSignature);
3710   if (wand->debug != MagickFalse)
3711     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3712   if (wand->images == (Image *) NULL)
3713     {
3714       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3715         "ContainsNoImages","`%s'",wand->name);
3716       return((MagickWand *) NULL);
3717     }
3718   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3719   if (image == (Image *) NULL)
3720     return((MagickWand *) NULL);
3721   return(CloneMagickWandFromImages(wand,image));
3722 }
3723 
3724 /*
3725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3726 %                                                                             %
3727 %                                                                             %
3728 %                                                                             %
3729 %   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                       %
3730 %                                                                             %
3731 %                                                                             %
3732 %                                                                             %
3733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3734 %
3735 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3736 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3737 %  than CMYKA.
3738 %
3739 %  The format of the MagickGetImageAlphaChannel method is:
3740 %
3741 %      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3742 %
3743 %  A description of each parameter follows:
3744 %
3745 %    o wand: the magick wand.
3746 %
3747 */
MagickGetImageAlphaChannel(MagickWand * wand)3748 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3749 {
3750   assert(wand != (MagickWand *) NULL);
3751   assert(wand->signature == MagickWandSignature);
3752   if (wand->debug != MagickFalse)
3753     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3754   if (wand->images == (Image *) NULL)
3755     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3756   return(GetImageAlphaChannel(wand->images));
3757 }
3758 
3759 /*
3760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3761 %                                                                             %
3762 %                                                                             %
3763 %                                                                             %
3764 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3765 %                                                                             %
3766 %                                                                             %
3767 %                                                                             %
3768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3769 %
3770 %  MagickGetImageMask() gets the image clip mask at the current image index.
3771 %
3772 %  The format of the MagickGetImageMask method is:
3773 %
3774 %      MagickWand *MagickGetImageMask(MagickWand *wand)
3775 %
3776 %  A description of each parameter follows:
3777 %
3778 %    o wand: the magick wand.
3779 %
3780 %    o type: type of mask, ReadPixelMask or WritePixelMask.
3781 %
3782 */
MagickGetImageMask(MagickWand * wand,const PixelMask type)3783 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
3784   const PixelMask type)
3785 {
3786   Image
3787     *image;
3788 
3789   assert(wand != (MagickWand *) NULL);
3790   assert(wand->signature == MagickWandSignature);
3791   if (wand->debug != MagickFalse)
3792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3793   if (wand->images == (Image *) NULL)
3794     {
3795       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3796         "ContainsNoImages","`%s'",wand->name);
3797       return((MagickWand *) NULL);
3798     }
3799   image=GetImageMask(wand->images,type,wand->exception);
3800   if (image == (Image *) NULL)
3801     return((MagickWand *) NULL);
3802   return(CloneMagickWandFromImages(wand,image));
3803 }
3804 
3805 /*
3806 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3807 %                                                                             %
3808 %                                                                             %
3809 %                                                                             %
3810 %   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                 %
3811 %                                                                             %
3812 %                                                                             %
3813 %                                                                             %
3814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3815 %
3816 %  MagickGetImageBackgroundColor() returns the image background color.
3817 %
3818 %  The format of the MagickGetImageBackgroundColor method is:
3819 %
3820 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3821 %        PixelWand *background_color)
3822 %
3823 %  A description of each parameter follows:
3824 %
3825 %    o wand: the magick wand.
3826 %
3827 %    o background_color: Return the background color.
3828 %
3829 */
MagickGetImageBackgroundColor(MagickWand * wand,PixelWand * background_color)3830 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3831   PixelWand *background_color)
3832 {
3833   assert(wand != (MagickWand *) NULL);
3834   assert(wand->signature == MagickWandSignature);
3835   if (wand->debug != MagickFalse)
3836     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3837   if (wand->images == (Image *) NULL)
3838     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3839   PixelSetPixelColor(background_color,&wand->images->background_color);
3840   return(MagickTrue);
3841 }
3842 
3843 /*
3844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3845 %                                                                             %
3846 %                                                                             %
3847 %                                                                             %
3848 %   M a g i c k G e t I m a g e B l o b                                       %
3849 %                                                                             %
3850 %                                                                             %
3851 %                                                                             %
3852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3853 %
3854 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3855 %  the image as a blob (a formatted "file" in memory) and its length, starting
3856 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3857 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3858 %
3859 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3860 %  the image sequence.
3861 %
3862 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3863 %
3864 %  The format of the MagickGetImageBlob method is:
3865 %
3866 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3867 %
3868 %  A description of each parameter follows:
3869 %
3870 %    o wand: the magick wand.
3871 %
3872 %    o length: the length of the blob.
3873 %
3874 */
MagickGetImageBlob(MagickWand * wand,size_t * length)3875 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3876 {
3877   unsigned char
3878     *blob;
3879 
3880   assert(wand != (MagickWand *) NULL);
3881   assert(wand->signature == MagickWandSignature);
3882   if (wand->debug != MagickFalse)
3883     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3884   if (wand->images == (Image *) NULL)
3885     {
3886       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3887         "ContainsNoImages","`%s'",wand->name);
3888       return((unsigned char *) NULL);
3889     }
3890   blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
3891     wand->exception);
3892   return(blob);
3893 }
3894 
3895 /*
3896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3897 %                                                                             %
3898 %                                                                             %
3899 %                                                                             %
3900 %   M a g i c k G e t I m a g e s B l o b                                     %
3901 %                                                                             %
3902 %                                                                             %
3903 %                                                                             %
3904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3905 %
3906 %  MagickGetImagesBlob() implements direct to memory image formats.  It
3907 %  returns the image sequence as a blob and its length.  The format of the image
3908 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3909 %  return a different image format, use MagickSetImageFormat().
3910 %
3911 %  Note, some image formats do not permit multiple images to the same image
3912 %  stream (e.g. JPEG).  in this instance, just the first image of the
3913 %  sequence is returned as a blob.
3914 %
3915 %  The format of the MagickGetImagesBlob method is:
3916 %
3917 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3918 %
3919 %  A description of each parameter follows:
3920 %
3921 %    o wand: the magick wand.
3922 %
3923 %    o length: the length of the blob.
3924 %
3925 */
MagickGetImagesBlob(MagickWand * wand,size_t * length)3926 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3927 {
3928   unsigned char
3929     *blob;
3930 
3931   assert(wand != (MagickWand *) NULL);
3932   assert(wand->signature == MagickWandSignature);
3933   if (wand->debug != MagickFalse)
3934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3935   if (wand->images == (Image *) NULL)
3936     {
3937       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3938         "ContainsNoImages","`%s'",wand->name);
3939       return((unsigned char *) NULL);
3940     }
3941   blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
3942     wand->images),length,wand->exception);
3943   return(blob);
3944 }
3945 
3946 /*
3947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3948 %                                                                             %
3949 %                                                                             %
3950 %                                                                             %
3951 %   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                         %
3952 %                                                                             %
3953 %                                                                             %
3954 %                                                                             %
3955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3956 %
3957 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3958 %  image.
3959 %
3960 %  The format of the MagickGetImageBluePrimary method is:
3961 %
3962 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3963 %        double *y,double *z)
3964 %
3965 %  A description of each parameter follows:
3966 %
3967 %    o wand: the magick wand.
3968 %
3969 %    o x: the chromaticity blue primary x-point.
3970 %
3971 %    o y: the chromaticity blue primary y-point.
3972 %
3973 %    o z: the chromaticity blue primary z-point.
3974 %
3975 */
MagickGetImageBluePrimary(MagickWand * wand,double * x,double * y,double * z)3976 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3977   double *x,double *y,double *z)
3978 {
3979   assert(wand != (MagickWand *) NULL);
3980   assert(wand->signature == MagickWandSignature);
3981   if (wand->debug != MagickFalse)
3982     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3983   if (wand->images == (Image *) NULL)
3984     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3985   *x=wand->images->chromaticity.blue_primary.x;
3986   *y=wand->images->chromaticity.blue_primary.y;
3987   *z=wand->images->chromaticity.blue_primary.z;
3988   return(MagickTrue);
3989 }
3990 
3991 /*
3992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3993 %                                                                             %
3994 %                                                                             %
3995 %                                                                             %
3996 %   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                         %
3997 %                                                                             %
3998 %                                                                             %
3999 %                                                                             %
4000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4001 %
4002 %  MagickGetImageBorderColor() returns the image border color.
4003 %
4004 %  The format of the MagickGetImageBorderColor method is:
4005 %
4006 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4007 %        PixelWand *border_color)
4008 %
4009 %  A description of each parameter follows:
4010 %
4011 %    o wand: the magick wand.
4012 %
4013 %    o border_color: Return the border color.
4014 %
4015 */
MagickGetImageBorderColor(MagickWand * wand,PixelWand * border_color)4016 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4017   PixelWand *border_color)
4018 {
4019   assert(wand != (MagickWand *) NULL);
4020   assert(wand->signature == MagickWandSignature);
4021   if (wand->debug != MagickFalse)
4022     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4023   if (wand->images == (Image *) NULL)
4024     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4025   PixelSetPixelColor(border_color,&wand->images->border_color);
4026   return(MagickTrue);
4027 }
4028 
4029 /*
4030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4031 %                                                                             %
4032 %                                                                             %
4033 %                                                                             %
4034 %   M a g i c k G e t I m a g e F e a t u r e s                               %
4035 %                                                                             %
4036 %                                                                             %
4037 %                                                                             %
4038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4039 %
4040 %  MagickGetImageFeatures() returns features for each channel in the
4041 %  image in each of four directions (horizontal, vertical, left and right
4042 %  diagonals) for the specified distance.  The features include the angular
4043 %  second moment, contrast, correlation, sum of squares: variance, inverse
4044 %  difference moment, sum average, sum varience, sum entropy, entropy,
4045 %  difference variance, difference entropy, information measures of
4046 %  correlation 1, information measures of correlation 2, and maximum
4047 %  correlation coefficient.  You can access the red channel contrast, for
4048 %  example, like this:
4049 %
4050 %      channel_features=MagickGetImageFeatures(wand,1);
4051 %      contrast=channel_features[RedPixelChannel].contrast[0];
4052 %
4053 %  Use MagickRelinquishMemory() to free the statistics buffer.
4054 %
4055 %  The format of the MagickGetImageFeatures method is:
4056 %
4057 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4058 %        const size_t distance)
4059 %
4060 %  A description of each parameter follows:
4061 %
4062 %    o wand: the magick wand.
4063 %
4064 %    o distance: the distance.
4065 %
4066 */
MagickGetImageFeatures(MagickWand * wand,const size_t distance)4067 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4068   const size_t distance)
4069 {
4070   assert(wand != (MagickWand *) NULL);
4071   assert(wand->signature == MagickWandSignature);
4072   if (wand->debug != MagickFalse)
4073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4074   if (wand->images == (Image *) NULL)
4075     {
4076       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4077         "ContainsNoImages","`%s'",wand->name);
4078       return((ChannelFeatures *) NULL);
4079     }
4080   return(GetImageFeatures(wand->images,distance,wand->exception));
4081 }
4082 
4083 /*
4084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4085 %                                                                             %
4086 %                                                                             %
4087 %                                                                             %
4088 %   M a g i c k G e t I m a g e K u r t o s i s                               %
4089 %                                                                             %
4090 %                                                                             %
4091 %                                                                             %
4092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4093 %
4094 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4095 %  more image channels.
4096 %
4097 %  The format of the MagickGetImageKurtosis method is:
4098 %
4099 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4100 %        double *kurtosis,double *skewness)
4101 %
4102 %  A description of each parameter follows:
4103 %
4104 %    o wand: the magick wand.
4105 %
4106 %    o kurtosis:  The kurtosis for the specified channel(s).
4107 %
4108 %    o skewness:  The skewness for the specified channel(s).
4109 %
4110 */
MagickGetImageKurtosis(MagickWand * wand,double * kurtosis,double * skewness)4111 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4112   double *kurtosis,double *skewness)
4113 {
4114   MagickBooleanType
4115     status;
4116 
4117   assert(wand != (MagickWand *) NULL);
4118   assert(wand->signature == MagickWandSignature);
4119   if (wand->debug != MagickFalse)
4120     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4121   if (wand->images == (Image *) NULL)
4122     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4123   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4124   return(status);
4125 }
4126 
4127 /*
4128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4129 %                                                                             %
4130 %                                                                             %
4131 %                                                                             %
4132 %   M a g i c k G e t I m a g e M e a n                                       %
4133 %                                                                             %
4134 %                                                                             %
4135 %                                                                             %
4136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4137 %
4138 %  MagickGetImageMean() gets the mean and standard deviation of one or more
4139 %  image channels.
4140 %
4141 %  The format of the MagickGetImageMean method is:
4142 %
4143 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4144 %        double *standard_deviation)
4145 %
4146 %  A description of each parameter follows:
4147 %
4148 %    o wand: the magick wand.
4149 %
4150 %    o channel: the image channel(s).
4151 %
4152 %    o mean:  The mean pixel value for the specified channel(s).
4153 %
4154 %    o standard_deviation:  The standard deviation for the specified channel(s).
4155 %
4156 */
MagickGetImageMean(MagickWand * wand,double * mean,double * standard_deviation)4157 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4158   double *standard_deviation)
4159 {
4160   MagickBooleanType
4161     status;
4162 
4163   assert(wand != (MagickWand *) NULL);
4164   assert(wand->signature == MagickWandSignature);
4165   if (wand->debug != MagickFalse)
4166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4167   if (wand->images == (Image *) NULL)
4168     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4169   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4170   return(status);
4171 }
4172 
4173 /*
4174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4175 %                                                                             %
4176 %                                                                             %
4177 %                                                                             %
4178 %   M a g i c k G e t I m a g e R a n g e                                     %
4179 %                                                                             %
4180 %                                                                             %
4181 %                                                                             %
4182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4183 %
4184 %  MagickGetImageRange() gets the range for one or more image channels.
4185 %
4186 %  The format of the MagickGetImageRange method is:
4187 %
4188 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4189 %        double *maxima)
4190 %
4191 %  A description of each parameter follows:
4192 %
4193 %    o wand: the magick wand.
4194 %
4195 %    o minima:  The minimum pixel value for the specified channel(s).
4196 %
4197 %    o maxima:  The maximum pixel value for the specified channel(s).
4198 %
4199 */
MagickGetImageRange(MagickWand * wand,double * minima,double * maxima)4200 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4201   double *minima,double *maxima)
4202 {
4203   MagickBooleanType
4204     status;
4205 
4206   assert(wand != (MagickWand *) NULL);
4207   assert(wand->signature == MagickWandSignature);
4208   if (wand->debug != MagickFalse)
4209     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4210   if (wand->images == (Image *) NULL)
4211     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4212   status=GetImageRange(wand->images,minima,maxima,wand->exception);
4213   return(status);
4214 }
4215 
4216 /*
4217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4218 %                                                                             %
4219 %                                                                             %
4220 %                                                                             %
4221 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4222 %                                                                             %
4223 %                                                                             %
4224 %                                                                             %
4225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4226 %
4227 %  MagickGetImageStatistics() returns statistics for each channel in the
4228 %  image.  The statistics include the channel depth, its minima and
4229 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4230 %  You can access the red channel mean, for example, like this:
4231 %
4232 %      channel_statistics=MagickGetImageStatistics(wand);
4233 %      red_mean=channel_statistics[RedPixelChannel].mean;
4234 %
4235 %  Use MagickRelinquishMemory() to free the statistics buffer.
4236 %
4237 %  The format of the MagickGetImageStatistics method is:
4238 %
4239 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4240 %
4241 %  A description of each parameter follows:
4242 %
4243 %    o wand: the magick wand.
4244 %
4245 */
MagickGetImageStatistics(MagickWand * wand)4246 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4247 {
4248   assert(wand != (MagickWand *) NULL);
4249   assert(wand->signature == MagickWandSignature);
4250   if (wand->debug != MagickFalse)
4251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4252   if (wand->images == (Image *) NULL)
4253     {
4254       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4255         "ContainsNoImages","`%s'",wand->name);
4256       return((ChannelStatistics *) NULL);
4257     }
4258   return(GetImageStatistics(wand->images,wand->exception));
4259 }
4260 
4261 /*
4262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4263 %                                                                             %
4264 %                                                                             %
4265 %                                                                             %
4266 %   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                     %
4267 %                                                                             %
4268 %                                                                             %
4269 %                                                                             %
4270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4271 %
4272 %  MagickGetImageColormapColor() returns the color of the specified colormap
4273 %  index.
4274 %
4275 %  The format of the MagickGetImageColormapColor method is:
4276 %
4277 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4278 %        const size_t index,PixelWand *color)
4279 %
4280 %  A description of each parameter follows:
4281 %
4282 %    o wand: the magick wand.
4283 %
4284 %    o index: the offset into the image colormap.
4285 %
4286 %    o color: Return the colormap color in this wand.
4287 %
4288 */
MagickGetImageColormapColor(MagickWand * wand,const size_t index,PixelWand * color)4289 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4290   const size_t index,PixelWand *color)
4291 {
4292   assert(wand != (MagickWand *) NULL);
4293   assert(wand->signature == MagickWandSignature);
4294   if (wand->debug != MagickFalse)
4295     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4296   if (wand->images == (Image *) NULL)
4297     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4298   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4299       (index >= wand->images->colors))
4300     {
4301       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4302         "InvalidColormapIndex","`%s'",wand->name);
4303       return(MagickFalse);
4304     }
4305   PixelSetPixelColor(color,wand->images->colormap+index);
4306   return(MagickTrue);
4307 }
4308 
4309 /*
4310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4311 %                                                                             %
4312 %                                                                             %
4313 %                                                                             %
4314 %   M a g i c k G e t I m a g e C o l o r s                                   %
4315 %                                                                             %
4316 %                                                                             %
4317 %                                                                             %
4318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4319 %
4320 %  MagickGetImageColors() gets the number of unique colors in the image.
4321 %
4322 %  The format of the MagickGetImageColors method is:
4323 %
4324 %      size_t MagickGetImageColors(MagickWand *wand)
4325 %
4326 %  A description of each parameter follows:
4327 %
4328 %    o wand: the magick wand.
4329 %
4330 */
MagickGetImageColors(MagickWand * wand)4331 WandExport size_t MagickGetImageColors(MagickWand *wand)
4332 {
4333   assert(wand != (MagickWand *) NULL);
4334   assert(wand->signature == MagickWandSignature);
4335   if (wand->debug != MagickFalse)
4336     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4337   if (wand->images == (Image *) NULL)
4338     {
4339       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4340         "ContainsNoImages","`%s'",wand->name);
4341       return(0);
4342     }
4343   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4344 }
4345 
4346 /*
4347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4348 %                                                                             %
4349 %                                                                             %
4350 %                                                                             %
4351 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4352 %                                                                             %
4353 %                                                                             %
4354 %                                                                             %
4355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4356 %
4357 %  MagickGetImageColorspace() gets the image colorspace.
4358 %
4359 %  The format of the MagickGetImageColorspace method is:
4360 %
4361 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4362 %
4363 %  A description of each parameter follows:
4364 %
4365 %    o wand: the magick wand.
4366 %
4367 */
MagickGetImageColorspace(MagickWand * wand)4368 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4369 {
4370   assert(wand != (MagickWand *) NULL);
4371   assert(wand->signature == MagickWandSignature);
4372   if (wand->debug != MagickFalse)
4373     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4374   if (wand->images == (Image *) NULL)
4375     {
4376       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4377         "ContainsNoImages","`%s'",wand->name);
4378       return(UndefinedColorspace);
4379     }
4380   return(wand->images->colorspace);
4381 }
4382 
4383 /*
4384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4385 %                                                                             %
4386 %                                                                             %
4387 %                                                                             %
4388 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4389 %                                                                             %
4390 %                                                                             %
4391 %                                                                             %
4392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4393 %
4394 %  MagickGetImageCompose() returns the composite operator associated with the
4395 %  image.
4396 %
4397 %  The format of the MagickGetImageCompose method is:
4398 %
4399 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4400 %
4401 %  A description of each parameter follows:
4402 %
4403 %    o wand: the magick wand.
4404 %
4405 */
MagickGetImageCompose(MagickWand * wand)4406 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4407 {
4408   assert(wand != (MagickWand *) NULL);
4409   assert(wand->signature == MagickWandSignature);
4410   if (wand->debug != MagickFalse)
4411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4412   if (wand->images == (Image *) NULL)
4413     {
4414       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4415         "ContainsNoImages","`%s'",wand->name);
4416       return(UndefinedCompositeOp);
4417     }
4418   return(wand->images->compose);
4419 }
4420 
4421 /*
4422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4423 %                                                                             %
4424 %                                                                             %
4425 %                                                                             %
4426 %   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                         %
4427 %                                                                             %
4428 %                                                                             %
4429 %                                                                             %
4430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4431 %
4432 %  MagickGetImageCompression() gets the image compression.
4433 %
4434 %  The format of the MagickGetImageCompression method is:
4435 %
4436 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4437 %
4438 %  A description of each parameter follows:
4439 %
4440 %    o wand: the magick wand.
4441 %
4442 */
MagickGetImageCompression(MagickWand * wand)4443 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4444 {
4445   assert(wand != (MagickWand *) NULL);
4446   assert(wand->signature == MagickWandSignature);
4447   if (wand->debug != MagickFalse)
4448     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4449   if (wand->images == (Image *) NULL)
4450     {
4451       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4452         "ContainsNoImages","`%s'",wand->name);
4453       return(UndefinedCompression);
4454     }
4455   return(wand->images->compression);
4456 }
4457 
4458 /*
4459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4460 %                                                                             %
4461 %                                                                             %
4462 %                                                                             %
4463 %   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           %
4464 %                                                                             %
4465 %                                                                             %
4466 %                                                                             %
4467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4468 %
4469 %  MagickGetImageCompressionQuality() gets the image compression quality.
4470 %
4471 %  The format of the MagickGetImageCompressionQuality method is:
4472 %
4473 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4474 %
4475 %  A description of each parameter follows:
4476 %
4477 %    o wand: the magick wand.
4478 %
4479 */
MagickGetImageCompressionQuality(MagickWand * wand)4480 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4481 {
4482   assert(wand != (MagickWand *) NULL);
4483   assert(wand->signature == MagickWandSignature);
4484   if (wand->debug != MagickFalse)
4485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4486   if (wand->images == (Image *) NULL)
4487     {
4488       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4489         "ContainsNoImages","`%s'",wand->name);
4490       return(0UL);
4491     }
4492   return(wand->images->quality);
4493 }
4494 
4495 /*
4496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4497 %                                                                             %
4498 %                                                                             %
4499 %                                                                             %
4500 %   M a g i c k G e t I m a g e D e l a y                                     %
4501 %                                                                             %
4502 %                                                                             %
4503 %                                                                             %
4504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4505 %
4506 %  MagickGetImageDelay() gets the image delay.
4507 %
4508 %  The format of the MagickGetImageDelay method is:
4509 %
4510 %      size_t MagickGetImageDelay(MagickWand *wand)
4511 %
4512 %  A description of each parameter follows:
4513 %
4514 %    o wand: the magick wand.
4515 %
4516 */
MagickGetImageDelay(MagickWand * wand)4517 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4518 {
4519   assert(wand != (MagickWand *) NULL);
4520   assert(wand->signature == MagickWandSignature);
4521   if (wand->debug != MagickFalse)
4522     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4523   if (wand->images == (Image *) NULL)
4524     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4525   return(wand->images->delay);
4526 }
4527 
4528 /*
4529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4530 %                                                                             %
4531 %                                                                             %
4532 %                                                                             %
4533 %   M a g i c k G e t I m a g e D e p t h                                     %
4534 %                                                                             %
4535 %                                                                             %
4536 %                                                                             %
4537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4538 %
4539 %  MagickGetImageDepth() gets the image depth.
4540 %
4541 %  The format of the MagickGetImageDepth method is:
4542 %
4543 %      size_t MagickGetImageDepth(MagickWand *wand)
4544 %
4545 %  A description of each parameter follows:
4546 %
4547 %    o wand: the magick wand.
4548 %
4549 */
MagickGetImageDepth(MagickWand * wand)4550 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4551 {
4552   assert(wand != (MagickWand *) NULL);
4553   assert(wand->signature == MagickWandSignature);
4554   if (wand->debug != MagickFalse)
4555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556   if (wand->images == (Image *) NULL)
4557     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4558   return(wand->images->depth);
4559 }
4560 
4561 /*
4562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4563 %                                                                             %
4564 %                                                                             %
4565 %                                                                             %
4566 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4567 %                                                                             %
4568 %                                                                             %
4569 %                                                                             %
4570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4571 %
4572 %  MagickGetImageDispose() gets the image disposal method.
4573 %
4574 %  The format of the MagickGetImageDispose method is:
4575 %
4576 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4577 %
4578 %  A description of each parameter follows:
4579 %
4580 %    o wand: the magick wand.
4581 %
4582 */
MagickGetImageDispose(MagickWand * wand)4583 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4584 {
4585   assert(wand != (MagickWand *) NULL);
4586   assert(wand->signature == MagickWandSignature);
4587   if (wand->debug != MagickFalse)
4588     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4589   if (wand->images == (Image *) NULL)
4590     {
4591       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4592         "ContainsNoImages","`%s'",wand->name);
4593       return(UndefinedDispose);
4594     }
4595   return((DisposeType) wand->images->dispose);
4596 }
4597 
4598 /*
4599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4600 %                                                                             %
4601 %                                                                             %
4602 %                                                                             %
4603 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4604 %                                                                             %
4605 %                                                                             %
4606 %                                                                             %
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4608 %
4609 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4610 %  returns the specified distortion metric.
4611 %
4612 %  The format of the MagickGetImageDistortion method is:
4613 %
4614 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4615 %        const MagickWand *reference,const MetricType metric,
4616 %        double *distortion)
4617 %
4618 %  A description of each parameter follows:
4619 %
4620 %    o wand: the magick wand.
4621 %
4622 %    o reference: the reference wand.
4623 %
4624 %    o metric: the metric.
4625 %
4626 %    o distortion: the computed distortion between the images.
4627 %
4628 */
MagickGetImageDistortion(MagickWand * wand,const MagickWand * reference,const MetricType metric,double * distortion)4629 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4630   const MagickWand *reference,const MetricType metric,double *distortion)
4631 {
4632   MagickBooleanType
4633     status;
4634 
4635   assert(wand != (MagickWand *) NULL);
4636   assert(wand->signature == MagickWandSignature);
4637   if (wand->debug != MagickFalse)
4638     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4639   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4640     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4641   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4642     wand->exception);
4643   return(status);
4644 }
4645 
4646 /*
4647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4648 %                                                                             %
4649 %                                                                             %
4650 %                                                                             %
4651 %   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                         %
4652 %                                                                             %
4653 %                                                                             %
4654 %                                                                             %
4655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656 %
4657 %  MagickGetImageDistortions() compares one or more pixel channels of an
4658 %  image to a reconstructed image and returns the specified distortion metrics.
4659 %
4660 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4661 %
4662 %  The format of the MagickGetImageDistortion method is:
4663 %
4664 %      double *MagickGetImageDistortion(MagickWand *wand,
4665 %        const MagickWand *reference,const MetricType metric)
4666 %
4667 %  A description of each parameter follows:
4668 %
4669 %    o wand: the magick wand.
4670 %
4671 %    o reference: the reference wand.
4672 %
4673 %    o metric: the metric.
4674 %
4675 */
MagickGetImageDistortions(MagickWand * wand,const MagickWand * reference,const MetricType metric)4676 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4677   const MagickWand *reference,const MetricType metric)
4678 {
4679   double
4680     *channel_distortion;
4681 
4682   assert(wand != (MagickWand *) NULL);
4683   assert(wand->signature == MagickWandSignature);
4684   if (wand->debug != MagickFalse)
4685     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4686   assert(reference != (MagickWand *) NULL);
4687   assert(reference->signature == MagickWandSignature);
4688   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4689     {
4690       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4691         "ContainsNoImages","`%s'",wand->name);
4692       return((double *) NULL);
4693     }
4694   channel_distortion=GetImageDistortions(wand->images,reference->images,
4695     metric,wand->exception);
4696   return(channel_distortion);
4697 }
4698 
4699 /*
4700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4701 %                                                                             %
4702 %                                                                             %
4703 %                                                                             %
4704 %   M a g i c k G e t I m a g e E n d i a n                                   %
4705 %                                                                             %
4706 %                                                                             %
4707 %                                                                             %
4708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4709 %
4710 %  MagickGetImageEndian() gets the image endian.
4711 %
4712 %  The format of the MagickGetImageEndian method is:
4713 %
4714 %      EndianType MagickGetImageEndian(MagickWand *wand)
4715 %
4716 %  A description of each parameter follows:
4717 %
4718 %    o wand: the magick wand.
4719 %
4720 */
MagickGetImageEndian(MagickWand * wand)4721 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4722 {
4723   assert(wand != (MagickWand *) NULL);
4724   assert(wand->signature == MagickWandSignature);
4725   if (wand->debug != MagickFalse)
4726     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4727   if (wand->images == (Image *) NULL)
4728     {
4729       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4730         "ContainsNoImages","`%s'",wand->name);
4731       return(UndefinedEndian);
4732     }
4733   return(wand->images->endian);
4734 }
4735 
4736 /*
4737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4738 %                                                                             %
4739 %                                                                             %
4740 %                                                                             %
4741 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4742 %                                                                             %
4743 %                                                                             %
4744 %                                                                             %
4745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4746 %
4747 %  MagickGetImageFilename() returns the filename of a particular image in a
4748 %  sequence.
4749 %
4750 %  The format of the MagickGetImageFilename method is:
4751 %
4752 %      char *MagickGetImageFilename(MagickWand *wand)
4753 %
4754 %  A description of each parameter follows:
4755 %
4756 %    o wand: the magick wand.
4757 %
4758 */
MagickGetImageFilename(MagickWand * wand)4759 WandExport char *MagickGetImageFilename(MagickWand *wand)
4760 {
4761   assert(wand != (MagickWand *) NULL);
4762   assert(wand->signature == MagickWandSignature);
4763   if (wand->debug != MagickFalse)
4764     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4765   if (wand->images == (Image *) NULL)
4766     {
4767       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4768         "ContainsNoImages","`%s'",wand->name);
4769       return((char *) NULL);
4770     }
4771   return(AcquireString(wand->images->filename));
4772 }
4773 
4774 /*
4775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4776 %                                                                             %
4777 %                                                                             %
4778 %                                                                             %
4779 %   M a g i c k G e t I m a g e F o r m a t                                   %
4780 %                                                                             %
4781 %                                                                             %
4782 %                                                                             %
4783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4784 %
4785 %  MagickGetImageFormat() returns the format of a particular image in a
4786 %  sequence.
4787 %
4788 %  The format of the MagickGetImageFormat method is:
4789 %
4790 %      char *MagickGetImageFormat(MagickWand *wand)
4791 %
4792 %  A description of each parameter follows:
4793 %
4794 %    o wand: the magick wand.
4795 %
4796 */
MagickGetImageFormat(MagickWand * wand)4797 WandExport char *MagickGetImageFormat(MagickWand *wand)
4798 {
4799   assert(wand != (MagickWand *) NULL);
4800   assert(wand->signature == MagickWandSignature);
4801   if (wand->debug != MagickFalse)
4802     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4803   if (wand->images == (Image *) NULL)
4804     {
4805       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4806         "ContainsNoImages","`%s'",wand->name);
4807       return((char *) NULL);
4808     }
4809   return(AcquireString(wand->images->magick));
4810 }
4811 
4812 /*
4813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4814 %                                                                             %
4815 %                                                                             %
4816 %                                                                             %
4817 %   M a g i c k G e t I m a g e F u z z                                       %
4818 %                                                                             %
4819 %                                                                             %
4820 %                                                                             %
4821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4822 %
4823 %  MagickGetImageFuzz() gets the image fuzz.
4824 %
4825 %  The format of the MagickGetImageFuzz method is:
4826 %
4827 %      double MagickGetImageFuzz(MagickWand *wand)
4828 %
4829 %  A description of each parameter follows:
4830 %
4831 %    o wand: the magick wand.
4832 %
4833 */
MagickGetImageFuzz(MagickWand * wand)4834 WandExport double MagickGetImageFuzz(MagickWand *wand)
4835 {
4836   assert(wand != (MagickWand *) NULL);
4837   assert(wand->signature == MagickWandSignature);
4838   if (wand->debug != MagickFalse)
4839     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4840   if (wand->images == (Image *) NULL)
4841     {
4842       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4843         "ContainsNoImages","`%s'",wand->name);
4844       return(0.0);
4845     }
4846   return(wand->images->fuzz);
4847 }
4848 
4849 /*
4850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4851 %                                                                             %
4852 %                                                                             %
4853 %                                                                             %
4854 %   M a g i c k G e t I m a g e G a m m a                                     %
4855 %                                                                             %
4856 %                                                                             %
4857 %                                                                             %
4858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4859 %
4860 %  MagickGetImageGamma() gets the image gamma.
4861 %
4862 %  The format of the MagickGetImageGamma method is:
4863 %
4864 %      double MagickGetImageGamma(MagickWand *wand)
4865 %
4866 %  A description of each parameter follows:
4867 %
4868 %    o wand: the magick wand.
4869 %
4870 */
MagickGetImageGamma(MagickWand * wand)4871 WandExport double MagickGetImageGamma(MagickWand *wand)
4872 {
4873   assert(wand != (MagickWand *) NULL);
4874   assert(wand->signature == MagickWandSignature);
4875   if (wand->debug != MagickFalse)
4876     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4877   if (wand->images == (Image *) NULL)
4878     {
4879       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4880         "ContainsNoImages","`%s'",wand->name);
4881       return(0.0);
4882     }
4883   return(wand->images->gamma);
4884 }
4885 
4886 /*
4887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4888 %                                                                             %
4889 %                                                                             %
4890 %                                                                             %
4891 %   M a g i c k G e t I m a g e G r a v i t y                                 %
4892 %                                                                             %
4893 %                                                                             %
4894 %                                                                             %
4895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4896 %
4897 %  MagickGetImageGravity() gets the image gravity.
4898 %
4899 %  The format of the MagickGetImageGravity method is:
4900 %
4901 %      GravityType MagickGetImageGravity(MagickWand *wand)
4902 %
4903 %  A description of each parameter follows:
4904 %
4905 %    o wand: the magick wand.
4906 %
4907 */
MagickGetImageGravity(MagickWand * wand)4908 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4909 {
4910   assert(wand != (MagickWand *) NULL);
4911   assert(wand->signature == MagickWandSignature);
4912   if (wand->debug != MagickFalse)
4913     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4914   if (wand->images == (Image *) NULL)
4915     {
4916       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4917         "ContainsNoImages","`%s'",wand->name);
4918       return(UndefinedGravity);
4919     }
4920   return(wand->images->gravity);
4921 }
4922 
4923 /*
4924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4925 %                                                                             %
4926 %                                                                             %
4927 %                                                                             %
4928 %   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                       %
4929 %                                                                             %
4930 %                                                                             %
4931 %                                                                             %
4932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4933 %
4934 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4935 %
4936 %  The format of the MagickGetImageGreenPrimary method is:
4937 %
4938 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4939 %        double *y,double *z)
4940 %
4941 %  A description of each parameter follows:
4942 %
4943 %    o wand: the magick wand.
4944 %
4945 %    o x: the chromaticity green primary x-point.
4946 %
4947 %    o y: the chromaticity green primary y-point.
4948 %
4949 %    o z: the chromaticity green primary z-point.
4950 %
4951 */
MagickGetImageGreenPrimary(MagickWand * wand,double * x,double * y,double * z)4952 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4953   double *x,double *y,double *z)
4954 {
4955   assert(wand != (MagickWand *) NULL);
4956   assert(wand->signature == MagickWandSignature);
4957   if (wand->debug != MagickFalse)
4958     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4959   if (wand->images == (Image *) NULL)
4960     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4961   *x=wand->images->chromaticity.green_primary.x;
4962   *y=wand->images->chromaticity.green_primary.y;
4963   *z=wand->images->chromaticity.green_primary.z;
4964   return(MagickTrue);
4965 }
4966 
4967 /*
4968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4969 %                                                                             %
4970 %                                                                             %
4971 %                                                                             %
4972 %   M a g i c k G e t I m a g e H e i g h t                                   %
4973 %                                                                             %
4974 %                                                                             %
4975 %                                                                             %
4976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4977 %
4978 %  MagickGetImageHeight() returns the image height.
4979 %
4980 %  The format of the MagickGetImageHeight method is:
4981 %
4982 %      size_t MagickGetImageHeight(MagickWand *wand)
4983 %
4984 %  A description of each parameter follows:
4985 %
4986 %    o wand: the magick wand.
4987 %
4988 */
MagickGetImageHeight(MagickWand * wand)4989 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4990 {
4991   assert(wand != (MagickWand *) NULL);
4992   assert(wand->signature == MagickWandSignature);
4993   if (wand->debug != MagickFalse)
4994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4995   if (wand->images == (Image *) NULL)
4996     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4997   return(wand->images->rows);
4998 }
4999 
5000 /*
5001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5002 %                                                                             %
5003 %                                                                             %
5004 %                                                                             %
5005 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
5006 %                                                                             %
5007 %                                                                             %
5008 %                                                                             %
5009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5010 %
5011 %  MagickGetImageHistogram() returns the image histogram as an array of
5012 %  PixelWand wands.
5013 %
5014 %  The format of the MagickGetImageHistogram method is:
5015 %
5016 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5017 %        size_t *number_colors)
5018 %
5019 %  A description of each parameter follows:
5020 %
5021 %    o wand: the magick wand.
5022 %
5023 %    o number_colors: the number of unique colors in the image and the number
5024 %      of pixel wands returned.
5025 %
5026 */
MagickGetImageHistogram(MagickWand * wand,size_t * number_colors)5027 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5028   size_t *number_colors)
5029 {
5030   PixelInfo
5031     *histogram;
5032 
5033   PixelWand
5034     **pixel_wands;
5035 
5036   register ssize_t
5037     i;
5038 
5039   assert(wand != (MagickWand *) NULL);
5040   assert(wand->signature == MagickWandSignature);
5041   if (wand->debug != MagickFalse)
5042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5043   if (wand->images == (Image *) NULL)
5044     {
5045       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5046         "ContainsNoImages","`%s'",wand->name);
5047       return((PixelWand **) NULL);
5048     }
5049   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5050   if (histogram == (PixelInfo *) NULL)
5051     return((PixelWand **) NULL);
5052   pixel_wands=NewPixelWands(*number_colors);
5053   for (i=0; i < (ssize_t) *number_colors; i++)
5054   {
5055     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5056     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5057   }
5058   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5059   return(pixel_wands);
5060 }
5061 
5062 /*
5063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5064 %                                                                             %
5065 %                                                                             %
5066 %                                                                             %
5067 %   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                 %
5068 %                                                                             %
5069 %                                                                             %
5070 %                                                                             %
5071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5072 %
5073 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5074 %
5075 %  The format of the MagickGetImageInterlaceScheme method is:
5076 %
5077 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5078 %
5079 %  A description of each parameter follows:
5080 %
5081 %    o wand: the magick wand.
5082 %
5083 */
MagickGetImageInterlaceScheme(MagickWand * wand)5084 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5085 {
5086   assert(wand != (MagickWand *) NULL);
5087   assert(wand->signature == MagickWandSignature);
5088   if (wand->debug != MagickFalse)
5089     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5090   if (wand->images == (Image *) NULL)
5091     {
5092       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5093         "ContainsNoImages","`%s'",wand->name);
5094       return(UndefinedInterlace);
5095     }
5096   return(wand->images->interlace);
5097 }
5098 
5099 /*
5100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5101 %                                                                             %
5102 %                                                                             %
5103 %                                                                             %
5104 %   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             %
5105 %                                                                             %
5106 %                                                                             %
5107 %                                                                             %
5108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5109 %
5110 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5111 %  sepcified image.
5112 %
5113 %  The format of the MagickGetImageInterpolateMethod method is:
5114 %
5115 %      PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5116 %
5117 %  A description of each parameter follows:
5118 %
5119 %    o wand: the magick wand.
5120 %
5121 */
MagickGetImageInterpolateMethod(MagickWand * wand)5122 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5123   MagickWand *wand)
5124 {
5125   assert(wand != (MagickWand *) NULL);
5126   assert(wand->signature == MagickWandSignature);
5127   if (wand->debug != MagickFalse)
5128     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5129   if (wand->images == (Image *) NULL)
5130     {
5131       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5132         "ContainsNoImages","`%s'",wand->name);
5133       return(UndefinedInterpolatePixel);
5134     }
5135   return(wand->images->interpolate);
5136 }
5137 
5138 /*
5139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5140 %                                                                             %
5141 %                                                                             %
5142 %                                                                             %
5143 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5144 %                                                                             %
5145 %                                                                             %
5146 %                                                                             %
5147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5148 %
5149 %  MagickGetImageIterations() gets the image iterations.
5150 %
5151 %  The format of the MagickGetImageIterations method is:
5152 %
5153 %      size_t MagickGetImageIterations(MagickWand *wand)
5154 %
5155 %  A description of each parameter follows:
5156 %
5157 %    o wand: the magick wand.
5158 %
5159 */
MagickGetImageIterations(MagickWand * wand)5160 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5161 {
5162   assert(wand != (MagickWand *) NULL);
5163   assert(wand->signature == MagickWandSignature);
5164   if (wand->debug != MagickFalse)
5165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5166   if (wand->images == (Image *) NULL)
5167     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5168   return(wand->images->iterations);
5169 }
5170 
5171 /*
5172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5173 %                                                                             %
5174 %                                                                             %
5175 %                                                                             %
5176 %   M a g i c k G e t I m a g e L e n g t h                                   %
5177 %                                                                             %
5178 %                                                                             %
5179 %                                                                             %
5180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5181 %
5182 %  MagickGetImageLength() returns the image length in bytes.
5183 %
5184 %  The format of the MagickGetImageLength method is:
5185 %
5186 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5187 %        MagickSizeType *length)
5188 %
5189 %  A description of each parameter follows:
5190 %
5191 %    o wand: the magick wand.
5192 %
5193 %    o length: the image length in bytes.
5194 %
5195 */
MagickGetImageLength(MagickWand * wand,MagickSizeType * length)5196 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5197   MagickSizeType *length)
5198 {
5199   assert(wand != (MagickWand *) NULL);
5200   assert(wand->signature == MagickWandSignature);
5201   if (wand->debug != MagickFalse)
5202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5203   if (wand->images == (Image *) NULL)
5204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5205   *length=GetBlobSize(wand->images);
5206   return(MagickTrue);
5207 }
5208 
5209 /*
5210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5211 %                                                                             %
5212 %                                                                             %
5213 %                                                                             %
5214 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5215 %                                                                             %
5216 %                                                                             %
5217 %                                                                             %
5218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5219 %
5220 %  MagickGetImageMatteColor() returns the image matte color.
5221 %
5222 %  The format of the MagickGetImageMatteColor method is:
5223 %
5224 %      MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5225 %        PixelWand *matte_color)
5226 %
5227 %  A description of each parameter follows:
5228 %
5229 %    o wand: the magick wand.
5230 %
5231 %    o matte_color: return the alpha color.
5232 %
5233 */
MagickGetImageMatteColor(MagickWand * wand,PixelWand * matte_color)5234 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5235   PixelWand *matte_color)
5236 {
5237   assert(wand != (MagickWand *)NULL);
5238   assert(wand->signature == MagickWandSignature);
5239   if (wand->debug != MagickFalse)
5240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5241   if (wand->images == (Image *)NULL)
5242     ThrowWandException(WandError, "ContainsNoImages", wand->name);
5243   PixelSetPixelColor(matte_color,&wand->images->matte_color);
5244   return(MagickTrue);
5245 }
5246 
5247 /*
5248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5249 %                                                                             %
5250 %                                                                             %
5251 %                                                                             %
5252 %   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                         %
5253 %                                                                             %
5254 %                                                                             %
5255 %                                                                             %
5256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5257 %
5258 %  MagickGetImageOrientation() returns the image orientation.
5259 %
5260 %  The format of the MagickGetImageOrientation method is:
5261 %
5262 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5263 %
5264 %  A description of each parameter follows:
5265 %
5266 %    o wand: the magick wand.
5267 %
5268 */
MagickGetImageOrientation(MagickWand * wand)5269 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5270 {
5271   assert(wand != (MagickWand *) NULL);
5272   assert(wand->signature == MagickWandSignature);
5273   if (wand->debug != MagickFalse)
5274     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5275   if (wand->images == (Image *) NULL)
5276     {
5277       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5278         "ContainsNoImages","`%s'",wand->name);
5279       return(UndefinedOrientation);
5280     }
5281   return(wand->images->orientation);
5282 }
5283 
5284 /*
5285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5286 %                                                                             %
5287 %                                                                             %
5288 %                                                                             %
5289 %   M a g i c k G e t I m a g e P a g e                                       %
5290 %                                                                             %
5291 %                                                                             %
5292 %                                                                             %
5293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5294 %
5295 %  MagickGetImagePage() returns the page geometry associated with the image.
5296 %
5297 %  The format of the MagickGetImagePage method is:
5298 %
5299 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5300 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5301 %
5302 %  A description of each parameter follows:
5303 %
5304 %    o wand: the magick wand.
5305 %
5306 %    o width: the page width.
5307 %
5308 %    o height: the page height.
5309 %
5310 %    o x: the page x-offset.
5311 %
5312 %    o y: the page y-offset.
5313 %
5314 */
MagickGetImagePage(MagickWand * wand,size_t * width,size_t * height,ssize_t * x,ssize_t * y)5315 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5316   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5317 {
5318   assert(wand != (const MagickWand *) NULL);
5319   assert(wand->signature == MagickWandSignature);
5320   if (wand->debug != MagickFalse)
5321     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5322   if (wand->images == (Image *) NULL)
5323     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5324   *width=wand->images->page.width;
5325   *height=wand->images->page.height;
5326   *x=wand->images->page.x;
5327   *y=wand->images->page.y;
5328   return(MagickTrue);
5329 }
5330 
5331 /*
5332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5333 %                                                                             %
5334 %                                                                             %
5335 %                                                                             %
5336 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5337 %                                                                             %
5338 %                                                                             %
5339 %                                                                             %
5340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5341 %
5342 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5343 %
5344 %  The format of the MagickGetImagePixelColor method is:
5345 %
5346 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5347 %        const ssize_t x,const ssize_t y,PixelWand *color)
5348 %
5349 %  A description of each parameter follows:
5350 %
5351 %    o wand: the magick wand.
5352 %
5353 %    o x,y: the pixel offset into the image.
5354 %
5355 %    o color: Return the colormap color in this wand.
5356 %
5357 */
MagickGetImagePixelColor(MagickWand * wand,const ssize_t x,const ssize_t y,PixelWand * color)5358 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5359   const ssize_t x,const ssize_t y,PixelWand *color)
5360 {
5361   register const Quantum
5362     *p;
5363 
5364   CacheView
5365     *image_view;
5366 
5367   assert(wand != (MagickWand *) NULL);
5368   assert(wand->signature == MagickWandSignature);
5369   if (wand->debug != MagickFalse)
5370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5371   if (wand->images == (Image *) NULL)
5372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5373   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5374   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5375   if (p == (const Quantum *) NULL)
5376     {
5377       image_view=DestroyCacheView(image_view);
5378       return(MagickFalse);
5379     }
5380   PixelSetQuantumPixel(wand->images,p,color);
5381   image_view=DestroyCacheView(image_view);
5382   return(MagickTrue);
5383 }
5384 
5385 /*
5386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5387 %                                                                             %
5388 %                                                                             %
5389 %                                                                             %
5390 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5391 %                                                                             %
5392 %                                                                             %
5393 %                                                                             %
5394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5395 %
5396 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5397 %
5398 %  The format of the MagickGetImageRedPrimary method is:
5399 %
5400 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5401 %        double *y, double *z)
5402 %
5403 %  A description of each parameter follows:
5404 %
5405 %    o wand: the magick wand.
5406 %
5407 %    o x: the chromaticity red primary x-point.
5408 %
5409 %    o y: the chromaticity red primary y-point.
5410 %
5411 %    o z: the chromaticity red primary z-point.
5412 %
5413 */
MagickGetImageRedPrimary(MagickWand * wand,double * x,double * y,double * z)5414 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5415   double *x,double *y,double *z)
5416 {
5417   assert(wand != (MagickWand *) NULL);
5418   assert(wand->signature == MagickWandSignature);
5419   if (wand->debug != MagickFalse)
5420     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5421   if (wand->images == (Image *) NULL)
5422     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5423   *x=wand->images->chromaticity.red_primary.x;
5424   *y=wand->images->chromaticity.red_primary.y;
5425   *z=wand->images->chromaticity.red_primary.z;
5426   return(MagickTrue);
5427 }
5428 
5429 /*
5430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5431 %                                                                             %
5432 %                                                                             %
5433 %                                                                             %
5434 %   M a g i c k G e t I m a g e R e g i o n                                   %
5435 %                                                                             %
5436 %                                                                             %
5437 %                                                                             %
5438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5439 %
5440 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5441 %  a new wand.
5442 %
5443 %  The format of the MagickGetImageRegion method is:
5444 %
5445 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5446 %        const size_t width,const size_t height,const ssize_t x,
5447 %        const ssize_t y)
5448 %
5449 %  A description of each parameter follows:
5450 %
5451 %    o wand: the magick wand.
5452 %
5453 %    o width: the region width.
5454 %
5455 %    o height: the region height.
5456 %
5457 %    o x: the region x offset.
5458 %
5459 %    o y: the region y offset.
5460 %
5461 */
MagickGetImageRegion(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)5462 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5463   const size_t width,const size_t height,const ssize_t x,
5464   const ssize_t y)
5465 {
5466   Image
5467     *region_image;
5468 
5469   RectangleInfo
5470     region;
5471 
5472   assert(wand != (MagickWand *) NULL);
5473   assert(wand->signature == MagickWandSignature);
5474   if (wand->debug != MagickFalse)
5475     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5476   if (wand->images == (Image *) NULL)
5477     return((MagickWand *) NULL);
5478   region.width=width;
5479   region.height=height;
5480   region.x=x;
5481   region.y=y;
5482   region_image=CropImage(wand->images,&region,wand->exception);
5483   if (region_image == (Image *) NULL)
5484     return((MagickWand *) NULL);
5485   return(CloneMagickWandFromImages(wand,region_image));
5486 }
5487 
5488 /*
5489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5490 %                                                                             %
5491 %                                                                             %
5492 %                                                                             %
5493 %   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                 %
5494 %                                                                             %
5495 %                                                                             %
5496 %                                                                             %
5497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5498 %
5499 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5500 %
5501 %  The format of the MagickGetImageRenderingIntent method is:
5502 %
5503 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5504 %
5505 %  A description of each parameter follows:
5506 %
5507 %    o wand: the magick wand.
5508 %
5509 */
MagickGetImageRenderingIntent(MagickWand * wand)5510 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5511 {
5512   assert(wand != (MagickWand *) NULL);
5513   assert(wand->signature == MagickWandSignature);
5514   if (wand->debug != MagickFalse)
5515     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5516   if (wand->images == (Image *) NULL)
5517     {
5518       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5519         "ContainsNoImages","`%s'",wand->name);
5520       return(UndefinedIntent);
5521     }
5522   return((RenderingIntent) wand->images->rendering_intent);
5523 }
5524 
5525 /*
5526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5527 %                                                                             %
5528 %                                                                             %
5529 %                                                                             %
5530 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5531 %                                                                             %
5532 %                                                                             %
5533 %                                                                             %
5534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5535 %
5536 %  MagickGetImageResolution() gets the image X and Y resolution.
5537 %
5538 %  The format of the MagickGetImageResolution method is:
5539 %
5540 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5541 %        double *y)
5542 %
5543 %  A description of each parameter follows:
5544 %
5545 %    o wand: the magick wand.
5546 %
5547 %    o x: the image x-resolution.
5548 %
5549 %    o y: the image y-resolution.
5550 %
5551 */
MagickGetImageResolution(MagickWand * wand,double * x,double * y)5552 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5553   double *x,double *y)
5554 {
5555   assert(wand != (MagickWand *) NULL);
5556   assert(wand->signature == MagickWandSignature);
5557   if (wand->debug != MagickFalse)
5558     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5559   if (wand->images == (Image *) NULL)
5560     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5561   *x=wand->images->resolution.x;
5562   *y=wand->images->resolution.y;
5563   return(MagickTrue);
5564 }
5565 
5566 /*
5567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5568 %                                                                             %
5569 %                                                                             %
5570 %                                                                             %
5571 %   M a g i c k G e t I m a g e S c e n e                                     %
5572 %                                                                             %
5573 %                                                                             %
5574 %                                                                             %
5575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5576 %
5577 %  MagickGetImageScene() gets the image scene.
5578 %
5579 %  The format of the MagickGetImageScene method is:
5580 %
5581 %      size_t MagickGetImageScene(MagickWand *wand)
5582 %
5583 %  A description of each parameter follows:
5584 %
5585 %    o wand: the magick wand.
5586 %
5587 */
MagickGetImageScene(MagickWand * wand)5588 WandExport size_t MagickGetImageScene(MagickWand *wand)
5589 {
5590   assert(wand != (MagickWand *) NULL);
5591   assert(wand->signature == MagickWandSignature);
5592   if (wand->debug != MagickFalse)
5593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5594   if (wand->images == (Image *) NULL)
5595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5596   return(wand->images->scene);
5597 }
5598 
5599 /*
5600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601 %                                                                             %
5602 %                                                                             %
5603 %                                                                             %
5604 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5605 %                                                                             %
5606 %                                                                             %
5607 %                                                                             %
5608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609 %
5610 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5611 %  pixel stream.
5612 %
5613 %  The format of the MagickGetImageSignature method is:
5614 %
5615 %      char *MagickGetImageSignature(MagickWand *wand)
5616 %
5617 %  A description of each parameter follows:
5618 %
5619 %    o wand: the magick wand.
5620 %
5621 */
MagickGetImageSignature(MagickWand * wand)5622 WandExport char *MagickGetImageSignature(MagickWand *wand)
5623 {
5624   const char
5625     *value;
5626 
5627   MagickBooleanType
5628     status;
5629 
5630   assert(wand != (MagickWand *) NULL);
5631   assert(wand->signature == MagickWandSignature);
5632   if (wand->debug != MagickFalse)
5633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5634   if (wand->images == (Image *) NULL)
5635     {
5636       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5637         "ContainsNoImages","`%s'",wand->name);
5638       return((char *) NULL);
5639     }
5640   status=SignatureImage(wand->images,wand->exception);
5641   if (status == MagickFalse)
5642     return((char *) NULL);
5643   value=GetImageProperty(wand->images,"signature",wand->exception);
5644   if (value == (const char *) NULL)
5645     return((char *) NULL);
5646   return(AcquireString(value));
5647 }
5648 
5649 /*
5650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5651 %                                                                             %
5652 %                                                                             %
5653 %                                                                             %
5654 %   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                   %
5655 %                                                                             %
5656 %                                                                             %
5657 %                                                                             %
5658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5659 %
5660 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5661 %
5662 %  The format of the MagickGetImageTicksPerSecond method is:
5663 %
5664 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5665 %
5666 %  A description of each parameter follows:
5667 %
5668 %    o wand: the magick wand.
5669 %
5670 */
MagickGetImageTicksPerSecond(MagickWand * wand)5671 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5672 {
5673   assert(wand != (MagickWand *) NULL);
5674   assert(wand->signature == MagickWandSignature);
5675   if (wand->debug != MagickFalse)
5676     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5677   if (wand->images == (Image *) NULL)
5678     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5679   return((size_t) wand->images->ticks_per_second);
5680 }
5681 
5682 /*
5683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5684 %                                                                             %
5685 %                                                                             %
5686 %                                                                             %
5687 %   M a g i c k G e t I m a g e T y p e                                       %
5688 %                                                                             %
5689 %                                                                             %
5690 %                                                                             %
5691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5692 %
5693 %  MagickGetImageType() gets the potential image type:
5694 %
5695 %        Bilevel        Grayscale       GrayscaleMatte
5696 %        Palette        PaletteMatte    TrueColor
5697 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5698 %
5699 %  The format of the MagickGetImageType method is:
5700 %
5701 %      ImageType MagickGetImageType(MagickWand *wand)
5702 %
5703 %  A description of each parameter follows:
5704 %
5705 %    o wand: the magick wand.
5706 %
5707 */
MagickGetImageType(MagickWand * wand)5708 WandExport ImageType MagickGetImageType(MagickWand *wand)
5709 {
5710   assert(wand != (MagickWand *) NULL);
5711   assert(wand->signature == MagickWandSignature);
5712   if (wand->debug != MagickFalse)
5713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5714   if (wand->images == (Image *) NULL)
5715     {
5716       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5717         "ContainsNoImages","`%s'",wand->name);
5718       return(UndefinedType);
5719     }
5720   return(GetImageType(wand->images));
5721 }
5722 
5723 /*
5724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5725 %                                                                             %
5726 %                                                                             %
5727 %                                                                             %
5728 %   M a g i c k G e t I m a g e U n i t s                                     %
5729 %                                                                             %
5730 %                                                                             %
5731 %                                                                             %
5732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5733 %
5734 %  MagickGetImageUnits() gets the image units of resolution.
5735 %
5736 %  The format of the MagickGetImageUnits method is:
5737 %
5738 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5739 %
5740 %  A description of each parameter follows:
5741 %
5742 %    o wand: the magick wand.
5743 %
5744 */
MagickGetImageUnits(MagickWand * wand)5745 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5746 {
5747   assert(wand != (MagickWand *) NULL);
5748   assert(wand->signature == MagickWandSignature);
5749   if (wand->debug != MagickFalse)
5750     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5751   if (wand->images == (Image *) NULL)
5752     {
5753       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5754         "ContainsNoImages","`%s'",wand->name);
5755       return(UndefinedResolution);
5756     }
5757   return(wand->images->units);
5758 }
5759 
5760 /*
5761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5762 %                                                                             %
5763 %                                                                             %
5764 %                                                                             %
5765 %   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           %
5766 %                                                                             %
5767 %                                                                             %
5768 %                                                                             %
5769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5770 %
5771 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5772 %  sepcified image.
5773 %
5774 %  The format of the MagickGetImageVirtualPixelMethod method is:
5775 %
5776 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5777 %
5778 %  A description of each parameter follows:
5779 %
5780 %    o wand: the magick wand.
5781 %
5782 */
MagickGetImageVirtualPixelMethod(MagickWand * wand)5783 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5784 {
5785   assert(wand != (MagickWand *) NULL);
5786   assert(wand->signature == MagickWandSignature);
5787   if (wand->debug != MagickFalse)
5788     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5789   if (wand->images == (Image *) NULL)
5790     {
5791       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5792         "ContainsNoImages","`%s'",wand->name);
5793       return(UndefinedVirtualPixelMethod);
5794     }
5795   return(GetImageVirtualPixelMethod(wand->images));
5796 }
5797 
5798 /*
5799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5800 %                                                                             %
5801 %                                                                             %
5802 %                                                                             %
5803 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5804 %                                                                             %
5805 %                                                                             %
5806 %                                                                             %
5807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5808 %
5809 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5810 %
5811 %  The format of the MagickGetImageWhitePoint method is:
5812 %
5813 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5814 %        double *y,double *z)
5815 %
5816 %  A description of each parameter follows:
5817 %
5818 %    o wand: the magick wand.
5819 %
5820 %    o x: the chromaticity white x-point.
5821 %
5822 %    o y: the chromaticity white y-point.
5823 %
5824 %    o z: the chromaticity white z-point.
5825 %
5826 */
MagickGetImageWhitePoint(MagickWand * wand,double * x,double * y,double * z)5827 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5828   double *x,double *y,double *z)
5829 {
5830   assert(wand != (MagickWand *) NULL);
5831   assert(wand->signature == MagickWandSignature);
5832   if (wand->debug != MagickFalse)
5833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5834   if (wand->images == (Image *) NULL)
5835     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5836   *x=wand->images->chromaticity.white_point.x;
5837   *y=wand->images->chromaticity.white_point.y;
5838   *z=wand->images->chromaticity.white_point.z;
5839   return(MagickTrue);
5840 }
5841 
5842 /*
5843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5844 %                                                                             %
5845 %                                                                             %
5846 %                                                                             %
5847 %   M a g i c k G e t I m a g e W i d t h                                     %
5848 %                                                                             %
5849 %                                                                             %
5850 %                                                                             %
5851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5852 %
5853 %  MagickGetImageWidth() returns the image width.
5854 %
5855 %  The format of the MagickGetImageWidth method is:
5856 %
5857 %      size_t MagickGetImageWidth(MagickWand *wand)
5858 %
5859 %  A description of each parameter follows:
5860 %
5861 %    o wand: the magick wand.
5862 %
5863 */
MagickGetImageWidth(MagickWand * wand)5864 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5865 {
5866   assert(wand != (MagickWand *) NULL);
5867   assert(wand->signature == MagickWandSignature);
5868   if (wand->debug != MagickFalse)
5869     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5870   if (wand->images == (Image *) NULL)
5871     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5872   return(wand->images->columns);
5873 }
5874 
5875 /*
5876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5877 %                                                                             %
5878 %                                                                             %
5879 %                                                                             %
5880 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5881 %                                                                             %
5882 %                                                                             %
5883 %                                                                             %
5884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5885 %
5886 %  MagickGetNumberImages() returns the number of images associated with a
5887 %  magick wand.
5888 %
5889 %  The format of the MagickGetNumberImages method is:
5890 %
5891 %      size_t MagickGetNumberImages(MagickWand *wand)
5892 %
5893 %  A description of each parameter follows:
5894 %
5895 %    o wand: the magick wand.
5896 %
5897 */
MagickGetNumberImages(MagickWand * wand)5898 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5899 {
5900   assert(wand != (MagickWand *) NULL);
5901   assert(wand->signature == MagickWandSignature);
5902   if (wand->debug != MagickFalse)
5903     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5904   return(GetImageListLength(wand->images));
5905 }
5906 
5907 /*
5908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5909 %                                                                             %
5910 %                                                                             %
5911 %                                                                             %
5912 %   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                 %
5913 %                                                                             %
5914 %                                                                             %
5915 %                                                                             %
5916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5917 %
5918 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5919 %
5920 %  The format of the MagickGetImageTotalInkDensity method is:
5921 %
5922 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5923 %
5924 %  A description of each parameter follows:
5925 %
5926 %    o wand: the magick wand.
5927 %
5928 */
MagickGetImageTotalInkDensity(MagickWand * wand)5929 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5930 {
5931   assert(wand != (MagickWand *) NULL);
5932   assert(wand->signature == MagickWandSignature);
5933   if (wand->debug != MagickFalse)
5934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5935   if (wand->images == (Image *) NULL)
5936     {
5937       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5938         "ContainsNoImages","`%s'",wand->name);
5939       return(0.0);
5940     }
5941   return(GetImageTotalInkDensity(wand->images,wand->exception));
5942 }
5943 
5944 /*
5945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5946 %                                                                             %
5947 %                                                                             %
5948 %                                                                             %
5949 %   M a g i c k H a l d C l u t I m a g e                                     %
5950 %                                                                             %
5951 %                                                                             %
5952 %                                                                             %
5953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5954 %
5955 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5956 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5957 %  dimensions.  Create it with the HALD coder.  You can apply any color
5958 %  transformation to the Hald image and then use this method to apply the
5959 %  transform to the image.
5960 %
5961 %  The format of the MagickHaldClutImage method is:
5962 %
5963 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5964 %        const MagickWand *hald_wand)
5965 %
5966 %  A description of each parameter follows:
5967 %
5968 %    o wand: the magick wand.
5969 %
5970 %    o hald_image: the hald CLUT image.
5971 %
5972 */
MagickHaldClutImage(MagickWand * wand,const MagickWand * hald_wand)5973 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5974   const MagickWand *hald_wand)
5975 {
5976   MagickBooleanType
5977     status;
5978 
5979   assert(wand != (MagickWand *) NULL);
5980   assert(wand->signature == MagickWandSignature);
5981   if (wand->debug != MagickFalse)
5982     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5983   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5984     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5985   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5986   return(status);
5987 }
5988 
5989 /*
5990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5991 %                                                                             %
5992 %                                                                             %
5993 %                                                                             %
5994 %   M a g i c k H a s N e x t I m a g e                                       %
5995 %                                                                             %
5996 %                                                                             %
5997 %                                                                             %
5998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5999 %
6000 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
6001 %  traversing the list in the forward direction
6002 %
6003 %  The format of the MagickHasNextImage method is:
6004 %
6005 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6006 %
6007 %  A description of each parameter follows:
6008 %
6009 %    o wand: the magick wand.
6010 %
6011 */
MagickHasNextImage(MagickWand * wand)6012 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6013 {
6014   assert(wand != (MagickWand *) NULL);
6015   assert(wand->signature == MagickWandSignature);
6016   if (wand->debug != MagickFalse)
6017     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6018   if (wand->images == (Image *) NULL)
6019     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6020   if (GetNextImageInList(wand->images) == (Image *) NULL)
6021     return(MagickFalse);
6022   return(MagickTrue);
6023 }
6024 
6025 /*
6026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6027 %                                                                             %
6028 %                                                                             %
6029 %                                                                             %
6030 %   M a g i c k H a s P r e v i o u s I m a g e                               %
6031 %                                                                             %
6032 %                                                                             %
6033 %                                                                             %
6034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6035 %
6036 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6037 %  traversing the list in the reverse direction
6038 %
6039 %  The format of the MagickHasPreviousImage method is:
6040 %
6041 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6042 %
6043 %  A description of each parameter follows:
6044 %
6045 %    o wand: the magick wand.
6046 %
6047 */
MagickHasPreviousImage(MagickWand * wand)6048 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6049 {
6050   assert(wand != (MagickWand *) NULL);
6051   assert(wand->signature == MagickWandSignature);
6052   if (wand->debug != MagickFalse)
6053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6054   if (wand->images == (Image *) NULL)
6055     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6056   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6057     return(MagickFalse);
6058   return(MagickTrue);
6059 }
6060 
6061 /*
6062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6063 %                                                                             %
6064 %                                                                             %
6065 %                                                                             %
6066 %   M a g i c k I d e n t i f y I m a g e                                     %
6067 %                                                                             %
6068 %                                                                             %
6069 %                                                                             %
6070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6071 %
6072 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6073 %  file.  Attributes include the image width, height, size, and others.
6074 %
6075 %  The format of the MagickIdentifyImage method is:
6076 %
6077 %      const char *MagickIdentifyImage(MagickWand *wand)
6078 %
6079 %  A description of each parameter follows:
6080 %
6081 %    o wand: the magick wand.
6082 %
6083 */
MagickIdentifyImage(MagickWand * wand)6084 WandExport char *MagickIdentifyImage(MagickWand *wand)
6085 {
6086   char
6087     *description,
6088     filename[MagickPathExtent];
6089 
6090   FILE
6091     *file;
6092 
6093   int
6094     unique_file;
6095 
6096   assert(wand != (MagickWand *) NULL);
6097   assert(wand->signature == MagickWandSignature);
6098   if (wand->debug != MagickFalse)
6099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6100   if (wand->images == (Image *) NULL)
6101     {
6102       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6103         "ContainsNoImages","`%s'",wand->name);
6104       return((char *) NULL);
6105     }
6106   description=(char *) NULL;
6107   unique_file=AcquireUniqueFileResource(filename);
6108   file=(FILE *) NULL;
6109   if (unique_file != -1)
6110     file=fdopen(unique_file,"wb");
6111   if ((unique_file == -1) || (file == (FILE *) NULL))
6112     {
6113       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6114         "UnableToCreateTemporaryFile","`%s'",wand->name);
6115       return((char *) NULL);
6116     }
6117   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6118   (void) fclose(file);
6119   description=FileToString(filename,~0UL,wand->exception);
6120   (void) RelinquishUniqueFileResource(filename);
6121   return(description);
6122 }
6123 
6124 /*
6125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6126 %                                                                             %
6127 %                                                                             %
6128 %                                                                             %
6129 %   M a g i c k I d e n t i f y I m a g e T y p e                             %
6130 %                                                                             %
6131 %                                                                             %
6132 %                                                                             %
6133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6134 %
6135 %  MagickIdentifyImageType() gets the potential image type:
6136 %
6137 %        Bilevel        Grayscale       GrayscaleMatte
6138 %        Palette        PaletteMatte    TrueColor
6139 %        TrueColorMatte ColorSeparation ColorSeparationMatte
6140 %
6141 %  To ensure the image type matches its potential, use MagickSetImageType():
6142 %
6143 %    (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6144 %
6145 %  The format of the MagickIdentifyImageType method is:
6146 %
6147 %      ImageType MagickIdentifyImageType(MagickWand *wand)
6148 %
6149 %  A description of each parameter follows:
6150 %
6151 %    o wand: the magick wand.
6152 %
6153 */
MagickIdentifyImageType(MagickWand * wand)6154 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6155 {
6156   assert(wand != (MagickWand *) NULL);
6157   assert(wand->signature == MagickWandSignature);
6158   if (wand->debug != MagickFalse)
6159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6160   if (wand->images == (Image *) NULL)
6161     {
6162       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6163         "ContainsNoImages","`%s'",wand->name);
6164       return(UndefinedType);
6165     }
6166   return(IdentifyImageType(wand->images,wand->exception));
6167 }
6168 
6169 /*
6170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6171 %                                                                             %
6172 %                                                                             %
6173 %                                                                             %
6174 %   M a g i c k I m p l o d e I m a g e                                       %
6175 %                                                                             %
6176 %                                                                             %
6177 %                                                                             %
6178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6179 %
6180 %  MagickImplodeImage() creates a new image that is a copy of an existing
6181 %  one with the image pixels "implode" by the specified percentage.  It
6182 %  allocates the memory necessary for the new Image structure and returns a
6183 %  pointer to the new image.
6184 %
6185 %  The format of the MagickImplodeImage method is:
6186 %
6187 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6188 %        const double radius,const PixelInterpolateMethod method)
6189 %
6190 %  A description of each parameter follows:
6191 %
6192 %    o wand: the magick wand.
6193 %
6194 %    o amount: Define the extent of the implosion.
6195 %
6196 %    o method: the pixel interpolation method.
6197 %
6198 */
MagickImplodeImage(MagickWand * wand,const double amount,const PixelInterpolateMethod method)6199 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6200   const double amount,const PixelInterpolateMethod method)
6201 {
6202   Image
6203     *implode_image;
6204 
6205   assert(wand != (MagickWand *) NULL);
6206   assert(wand->signature == MagickWandSignature);
6207   if (wand->debug != MagickFalse)
6208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6209   if (wand->images == (Image *) NULL)
6210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6211   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6212   if (implode_image == (Image *) NULL)
6213     return(MagickFalse);
6214   ReplaceImageInList(&wand->images,implode_image);
6215   return(MagickTrue);
6216 }
6217 
6218 /*
6219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6220 %                                                                             %
6221 %                                                                             %
6222 %                                                                             %
6223 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6224 %                                                                             %
6225 %                                                                             %
6226 %                                                                             %
6227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6228 %
6229 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6230 %  location you specify.  The method returns MagickFalse on success otherwise
6231 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6232 %  short int, int, ssize_t, float, or double in the order specified by map.
6233 %
6234 %  Suppose your want to upload the first scanline of a 640x480 image from
6235 %  character data in red-green-blue order:
6236 %
6237 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6238 %
6239 %  The format of the MagickImportImagePixels method is:
6240 %
6241 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6242 %        const ssize_t x,const ssize_t y,const size_t columns,
6243 %        const size_t rows,const char *map,const StorageType storage,
6244 %        const void *pixels)
6245 %
6246 %  A description of each parameter follows:
6247 %
6248 %    o wand: the magick wand.
6249 %
6250 %    o x, y, columns, rows:  These values define the perimeter of a region
6251 %      of pixels you want to define.
6252 %
6253 %    o map:  This string reflects the expected ordering of the pixel array.
6254 %      It can be any combination or order of R = red, G = green, B = blue,
6255 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6256 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6257 %      P = pad.
6258 %
6259 %    o storage: Define the data type of the pixels.  Float and double types are
6260 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6261 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6262 %      or DoublePixel.
6263 %
6264 %    o pixels: This array of values contain the pixel components as defined by
6265 %      map and type.  You must preallocate this array where the expected
6266 %      length varies depending on the values of width, height, map, and type.
6267 %
6268 */
MagickImportImagePixels(MagickWand * wand,const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,const char * map,const StorageType storage,const void * pixels)6269 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6270   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6271   const char *map,const StorageType storage,const void *pixels)
6272 {
6273   MagickBooleanType
6274     status;
6275 
6276   assert(wand != (MagickWand *) NULL);
6277   assert(wand->signature == MagickWandSignature);
6278   if (wand->debug != MagickFalse)
6279     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6280   if (wand->images == (Image *) NULL)
6281     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6282   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6283     wand->exception);
6284   return(status);
6285 }
6286 
6287 /*
6288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6289 %                                                                             %
6290 %                                                                             %
6291 %                                                                             %
6292 %   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               %
6293 %                                                                             %
6294 %                                                                             %
6295 %                                                                             %
6296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6297 %
6298 %  MagickInterpolativeResizeImage() resize image using a interpolative
6299 %  method.
6300 %
6301 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6302 %        const size_t columns,const size_t rows,
6303 %        const PixelInterpolateMethod method)
6304 %
6305 %  A description of each parameter follows:
6306 %
6307 %    o wand: the magick wand.
6308 %
6309 %    o columns: the number of columns in the scaled image.
6310 %
6311 %    o rows: the number of rows in the scaled image.
6312 %
6313 %    o interpolate: the pixel interpolation method.
6314 %
6315 */
MagickInterpolativeResizeImage(MagickWand * wand,const size_t columns,const size_t rows,const PixelInterpolateMethod method)6316 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6317   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6318 {
6319   Image
6320     *resize_image;
6321 
6322   assert(wand != (MagickWand *) NULL);
6323   assert(wand->signature == MagickWandSignature);
6324   if (wand->debug != MagickFalse)
6325     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6326   if (wand->images == (Image *) NULL)
6327     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6328   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6329     wand->exception);
6330   if (resize_image == (Image *) NULL)
6331     return(MagickFalse);
6332   ReplaceImageInList(&wand->images,resize_image);
6333   return(MagickTrue);
6334 }
6335 
6336 /*
6337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6338 %                                                                             %
6339 %                                                                             %
6340 %                                                                             %
6341 %   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       %
6342 %                                                                             %
6343 %                                                                             %
6344 %                                                                             %
6345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6346 %
6347 %  MagickInverseFourierTransformImage() implements the inverse discrete
6348 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6349 %  imaginary image pair.
6350 %
6351 %  The format of the MagickInverseFourierTransformImage method is:
6352 %
6353 %      MagickBooleanType MagickInverseFourierTransformImage(
6354 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6355 %        const MagickBooleanType magnitude)
6356 %
6357 %  A description of each parameter follows:
6358 %
6359 %    o magnitude_wand: the magnitude or real wand.
6360 %
6361 %    o phase_wand: the phase or imaginary wand.
6362 %
6363 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6364 %      imaginary image pair.
6365 %
6366 */
MagickInverseFourierTransformImage(MagickWand * magnitude_wand,MagickWand * phase_wand,const MagickBooleanType magnitude)6367 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6368   MagickWand *magnitude_wand,MagickWand *phase_wand,
6369   const MagickBooleanType magnitude)
6370 {
6371   Image
6372     *inverse_image;
6373 
6374   MagickWand
6375     *wand;
6376 
6377   assert(magnitude_wand != (MagickWand *) NULL);
6378   assert(magnitude_wand->signature == MagickWandSignature);
6379   if (magnitude_wand->debug != MagickFalse)
6380     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6381       magnitude_wand->name);
6382   wand=magnitude_wand;
6383   if (magnitude_wand->images == (Image *) NULL)
6384     ThrowWandException(WandError,"ContainsNoImages",
6385       magnitude_wand->name);
6386   assert(phase_wand != (MagickWand *) NULL);
6387   assert(phase_wand->signature == MagickWandSignature);
6388   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6389     phase_wand->images,magnitude,wand->exception);
6390   if (inverse_image == (Image *) NULL)
6391     return(MagickFalse);
6392   ReplaceImageInList(&wand->images,inverse_image);
6393   return(MagickTrue);
6394 }
6395 
6396 /*
6397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6398 %                                                                             %
6399 %                                                                             %
6400 %                                                                             %
6401 %   M a g i c k L a b e l I m a g e                                           %
6402 %                                                                             %
6403 %                                                                             %
6404 %                                                                             %
6405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6406 %
6407 %  MagickLabelImage() adds a label to your image.
6408 %
6409 %  The format of the MagickLabelImage method is:
6410 %
6411 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6412 %
6413 %  A description of each parameter follows:
6414 %
6415 %    o wand: the magick wand.
6416 %
6417 %    o label: the image label.
6418 %
6419 */
MagickLabelImage(MagickWand * wand,const char * label)6420 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6421   const char *label)
6422 {
6423   MagickBooleanType
6424     status;
6425 
6426   assert(wand != (MagickWand *) NULL);
6427   assert(wand->signature == MagickWandSignature);
6428   if (wand->debug != MagickFalse)
6429     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6430   if (wand->images == (Image *) NULL)
6431     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6432   status=SetImageProperty(wand->images,"label",label,wand->exception);
6433   return(status);
6434 }
6435 
6436 /*
6437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6438 %                                                                             %
6439 %                                                                             %
6440 %                                                                             %
6441 %   M a g i c k L e v e l I m a g e                                           %
6442 %                                                                             %
6443 %                                                                             %
6444 %                                                                             %
6445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6446 %
6447 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6448 %  falling between specified white and black points to the full available
6449 %  quantum range. The parameters provided represent the black, mid, and white
6450 %  points. The black point specifies the darkest color in the image. Colors
6451 %  darker than the black point are set to zero. Mid point specifies a gamma
6452 %  correction to apply to the image.  White point specifies the lightest color
6453 %  in the image. Colors brighter than the white point are set to the maximum
6454 %  quantum value.
6455 %
6456 %  The format of the MagickLevelImage method is:
6457 %
6458 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6459 %        const double black_point,const double gamma,const double white_point)
6460 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6461 %        const ChannelType channel,const double black_point,const double gamma,
6462 %        const double white_point)
6463 %
6464 %  A description of each parameter follows:
6465 %
6466 %    o wand: the magick wand.
6467 %
6468 %    o channel: Identify which channel to level: RedPixelChannel,
6469 %      GreenPixelChannel, etc.
6470 %
6471 %    o black_point: the black point.
6472 %
6473 %    o gamma: the gamma.
6474 %
6475 %    o white_point: the white point.
6476 %
6477 */
MagickLevelImage(MagickWand * wand,const double black_point,const double gamma,const double white_point)6478 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6479   const double black_point,const double gamma,const double white_point)
6480 {
6481   MagickBooleanType
6482     status;
6483 
6484   assert(wand != (MagickWand *) NULL);
6485   assert(wand->signature == MagickWandSignature);
6486   if (wand->debug != MagickFalse)
6487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6488   if (wand->images == (Image *) NULL)
6489     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6490   status=LevelImage(wand->images,black_point,white_point,gamma,
6491     wand->exception);
6492   return(status);
6493 }
6494 
6495 /*
6496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6497 %                                                                             %
6498 %                                                                             %
6499 %                                                                             %
6500 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6501 %                                                                             %
6502 %                                                                             %
6503 %                                                                             %
6504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6505 %
6506 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6507 %
6508 %  You can also reduce the influence of a particular channel with a gamma
6509 %  value of 0.
6510 %
6511 %  The format of the MagickLinearStretchImage method is:
6512 %
6513 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6514 %        const double black_point,const double white_point)
6515 %
6516 %  A description of each parameter follows:
6517 %
6518 %    o wand: the magick wand.
6519 %
6520 %    o black_point: the black point.
6521 %
6522 %    o white_point: the white point.
6523 %
6524 */
MagickLinearStretchImage(MagickWand * wand,const double black_point,const double white_point)6525 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6526   const double black_point,const double white_point)
6527 {
6528   MagickBooleanType
6529     status;
6530 
6531   assert(wand != (MagickWand *) NULL);
6532   assert(wand->signature == MagickWandSignature);
6533   if (wand->debug != MagickFalse)
6534     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6535   if (wand->images == (Image *) NULL)
6536     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6537   status=LinearStretchImage(wand->images,black_point,white_point,
6538     wand->exception);
6539   return(status);
6540 }
6541 
6542 /*
6543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6544 %                                                                             %
6545 %                                                                             %
6546 %                                                                             %
6547 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6548 %                                                                             %
6549 %                                                                             %
6550 %                                                                             %
6551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6552 %
6553 %  MagickLiquidRescaleImage() rescales image with seam carving.
6554 %
6555 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6556 %        const size_t columns,const size_t rows,
6557 %        const double delta_x,const double rigidity)
6558 %
6559 %  A description of each parameter follows:
6560 %
6561 %    o wand: the magick wand.
6562 %
6563 %    o columns: the number of columns in the scaled image.
6564 %
6565 %    o rows: the number of rows in the scaled image.
6566 %
6567 %    o delta_x: maximum seam transversal step (0 means straight seams).
6568 %
6569 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6570 %
6571 */
MagickLiquidRescaleImage(MagickWand * wand,const size_t columns,const size_t rows,const double delta_x,const double rigidity)6572 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6573   const size_t columns,const size_t rows,const double delta_x,
6574   const double rigidity)
6575 {
6576   Image
6577     *rescale_image;
6578 
6579   assert(wand != (MagickWand *) NULL);
6580   assert(wand->signature == MagickWandSignature);
6581   if (wand->debug != MagickFalse)
6582     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6583   if (wand->images == (Image *) NULL)
6584     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6585   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6586     rigidity,wand->exception);
6587   if (rescale_image == (Image *) NULL)
6588     return(MagickFalse);
6589   ReplaceImageInList(&wand->images,rescale_image);
6590   return(MagickTrue);
6591 }
6592 
6593 /*
6594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6595 %                                                                             %
6596 %                                                                             %
6597 %                                                                             %
6598 %     M a g i c k L o c a l C o n t r a s t I m a g e                         %
6599 %                                                                             %
6600 %                                                                             %
6601 %                                                                             %
6602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6603 %
6604 %  MagickLocalContrastImage() attempts to increase the appearance of
6605 %  large-scale light-dark transitions. Local contrast enhancement works
6606 %  similarly to sharpening with an unsharp mask, however the mask is instead
6607 %  created using an image with a greater blur distance.
6608 %
6609 %      MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6610 %        const double radius,const double strength)
6611 %
6612 %  A description of each parameter follows:
6613 %
6614 %    o image: the image.
6615 %
6616 %    o radius: the radius of the Gaussian, in pixels, not counting
6617 %      the center pixel.
6618 %
6619 %    o strength: the strength of the blur mask in percentage.
6620 %
6621 */
MagickLocalContrastImage(MagickWand * wand,const double radius,const double strength)6622 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6623   const double radius, const double strength)
6624 {
6625   Image
6626     *contrast_image;
6627 
6628   assert(wand != (MagickWand *)NULL);
6629   assert(wand->signature == MagickWandSignature);
6630   if (wand->debug != MagickFalse)
6631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
6632   if (wand->images == (Image *)NULL)
6633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6634   contrast_image=LocalContrastImage(wand->images,radius,strength,
6635     wand->exception);
6636   if (contrast_image == (Image *)NULL)
6637     return(MagickFalse);
6638   ReplaceImageInList(&wand->images,contrast_image);
6639   return(MagickTrue);
6640 }
6641 
6642 /*
6643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6644 %                                                                             %
6645 %                                                                             %
6646 %                                                                             %
6647 %   M a g i c k M a g n i f y I m a g e                                       %
6648 %                                                                             %
6649 %                                                                             %
6650 %                                                                             %
6651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6652 %
6653 %  MagickMagnifyImage() is a convenience method that scales an image
6654 %  proportionally to twice its original size.
6655 %
6656 %  The format of the MagickMagnifyImage method is:
6657 %
6658 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6659 %
6660 %  A description of each parameter follows:
6661 %
6662 %    o wand: the magick wand.
6663 %
6664 */
MagickMagnifyImage(MagickWand * wand)6665 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6666 {
6667   Image
6668     *magnify_image;
6669 
6670   assert(wand != (MagickWand *) NULL);
6671   assert(wand->signature == MagickWandSignature);
6672   if (wand->debug != MagickFalse)
6673     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6674   if (wand->images == (Image *) NULL)
6675     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6676   magnify_image=MagnifyImage(wand->images,wand->exception);
6677   if (magnify_image == (Image *) NULL)
6678     return(MagickFalse);
6679   ReplaceImageInList(&wand->images,magnify_image);
6680   return(MagickTrue);
6681 }
6682 
6683 /*
6684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6685 %                                                                             %
6686 %                                                                             %
6687 %                                                                             %
6688 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6689 %                                                                             %
6690 %                                                                             %
6691 %                                                                             %
6692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6693 %
6694 %  MagickMergeImageLayers() composes all the image layers from the current
6695 %  given image onward to produce a single image of the merged layers.
6696 %
6697 %  The inital canvas's size depends on the given LayerMethod, and is
6698 %  initialized using the first images background color.  The images
6699 %  are then compositied onto that image in sequence using the given
6700 %  composition that has been assigned to each individual image.
6701 %
6702 %  The format of the MagickMergeImageLayers method is:
6703 %
6704 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6705 %        const LayerMethod method)
6706 %
6707 %  A description of each parameter follows:
6708 %
6709 %    o wand: the magick wand.
6710 %
6711 %    o method: the method of selecting the size of the initial canvas.
6712 %
6713 %        MergeLayer: Merge all layers onto a canvas just large enough
6714 %           to hold all the actual images. The virtual canvas of the
6715 %           first image is preserved but otherwise ignored.
6716 %
6717 %        FlattenLayer: Use the virtual canvas size of first image.
6718 %           Images which fall outside this canvas is clipped.
6719 %           This can be used to 'fill out' a given virtual canvas.
6720 %
6721 %        MosaicLayer: Start with the virtual canvas of the first image,
6722 %           enlarging left and right edges to contain all images.
6723 %           Images with negative offsets will be clipped.
6724 %
6725 */
MagickMergeImageLayers(MagickWand * wand,const LayerMethod method)6726 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6727   const LayerMethod method)
6728 {
6729   Image
6730     *mosaic_image;
6731 
6732   assert(wand != (MagickWand *) NULL);
6733   assert(wand->signature == MagickWandSignature);
6734   if (wand->debug != MagickFalse)
6735     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6736   if (wand->images == (Image *) NULL)
6737     return((MagickWand *) NULL);
6738   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6739   if (mosaic_image == (Image *) NULL)
6740     return((MagickWand *) NULL);
6741   return(CloneMagickWandFromImages(wand,mosaic_image));
6742 }
6743 
6744 /*
6745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6746 %                                                                             %
6747 %                                                                             %
6748 %                                                                             %
6749 %   M a g i c k M i n i f y I m a g e                                         %
6750 %                                                                             %
6751 %                                                                             %
6752 %                                                                             %
6753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6754 %
6755 %  MagickMinifyImage() is a convenience method that scales an image
6756 %  proportionally to one-half its original size
6757 %
6758 %  The format of the MagickMinifyImage method is:
6759 %
6760 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6761 %
6762 %  A description of each parameter follows:
6763 %
6764 %    o wand: the magick wand.
6765 %
6766 */
MagickMinifyImage(MagickWand * wand)6767 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6768 {
6769   Image
6770     *minify_image;
6771 
6772   assert(wand != (MagickWand *) NULL);
6773   assert(wand->signature == MagickWandSignature);
6774   if (wand->debug != MagickFalse)
6775     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6776   if (wand->images == (Image *) NULL)
6777     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6778   minify_image=MinifyImage(wand->images,wand->exception);
6779   if (minify_image == (Image *) NULL)
6780     return(MagickFalse);
6781   ReplaceImageInList(&wand->images,minify_image);
6782   return(MagickTrue);
6783 }
6784 
6785 /*
6786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6787 %                                                                             %
6788 %                                                                             %
6789 %                                                                             %
6790 %   M a g i c k M o d u l a t e I m a g e                                     %
6791 %                                                                             %
6792 %                                                                             %
6793 %                                                                             %
6794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6795 %
6796 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6797 %  of an image.  Hue is the percentage of absolute rotation from the current
6798 %  position.  For example 50 results in a counter-clockwise rotation of 90
6799 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6800 %  both resulting in a rotation of 180 degrees.
6801 %
6802 %  To increase the color brightness by 20% and decrease the color saturation by
6803 %  10% and leave the hue unchanged, use: 120,90,100.
6804 %
6805 %  The format of the MagickModulateImage method is:
6806 %
6807 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6808 %        const double brightness,const double saturation,const double hue)
6809 %
6810 %  A description of each parameter follows:
6811 %
6812 %    o wand: the magick wand.
6813 %
6814 %    o brightness: the percent change in brighness.
6815 %
6816 %    o saturation: the percent change in saturation.
6817 %
6818 %    o hue: the percent change in hue.
6819 %
6820 */
MagickModulateImage(MagickWand * wand,const double brightness,const double saturation,const double hue)6821 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6822   const double brightness,const double saturation,const double hue)
6823 {
6824   char
6825     modulate[MagickPathExtent];
6826 
6827   MagickBooleanType
6828     status;
6829 
6830   assert(wand != (MagickWand *) NULL);
6831   assert(wand->signature == MagickWandSignature);
6832   if (wand->debug != MagickFalse)
6833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6834   if (wand->images == (Image *) NULL)
6835     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6836   (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
6837     brightness,saturation,hue);
6838   status=ModulateImage(wand->images,modulate,wand->exception);
6839   return(status);
6840 }
6841 
6842 /*
6843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6844 %                                                                             %
6845 %                                                                             %
6846 %                                                                             %
6847 %   M a g i c k M o n t a g e I m a g e                                       %
6848 %                                                                             %
6849 %                                                                             %
6850 %                                                                             %
6851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6852 %
6853 %  MagickMontageImage() creates a composite image by combining several
6854 %  separate images. The images are tiled on the composite image with the name
6855 %  of the image optionally appearing just below the individual tile.
6856 %
6857 %  The format of the MagickMontageImage method is:
6858 %
6859 %      MagickWand *MagickMontageImage(MagickWand *wand,
6860 %        const DrawingWand drawing_wand,const char *tile_geometry,
6861 %        const char *thumbnail_geometry,const MontageMode mode,
6862 %        const char *frame)
6863 %
6864 %  A description of each parameter follows:
6865 %
6866 %    o wand: the magick wand.
6867 %
6868 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6869 %      obtained from this wand.
6870 %
6871 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6872 %
6873 %    o thumbnail_geometry: Preferred image size and border size of each
6874 %      thumbnail (e.g. 120x120+4+3>).
6875 %
6876 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6877 %
6878 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6879 %      The frame color is that of the thumbnail's matte color.
6880 %
6881 */
MagickMontageImage(MagickWand * wand,const DrawingWand * drawing_wand,const char * tile_geometry,const char * thumbnail_geometry,const MontageMode mode,const char * frame)6882 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6883   const DrawingWand *drawing_wand,const char *tile_geometry,
6884   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6885 {
6886   char
6887     *font;
6888 
6889   Image
6890     *montage_image;
6891 
6892   MontageInfo
6893     *montage_info;
6894 
6895   PixelWand
6896     *pixel_wand;
6897 
6898   assert(wand != (MagickWand *) NULL);
6899   assert(wand->signature == MagickWandSignature);
6900   if (wand->debug != MagickFalse)
6901     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6902   if (wand->images == (Image *) NULL)
6903     return((MagickWand *) NULL);
6904   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6905   switch (mode)
6906   {
6907     case FrameMode:
6908     {
6909       (void) CloneString(&montage_info->frame,"15x15+3+3");
6910       montage_info->shadow=MagickTrue;
6911       break;
6912     }
6913     case UnframeMode:
6914     {
6915       montage_info->frame=(char *) NULL;
6916       montage_info->shadow=MagickFalse;
6917       montage_info->border_width=0;
6918       break;
6919     }
6920     case ConcatenateMode:
6921     {
6922       montage_info->frame=(char *) NULL;
6923       montage_info->shadow=MagickFalse;
6924       (void) CloneString(&montage_info->geometry,"+0+0");
6925       montage_info->border_width=0;
6926       break;
6927     }
6928     default:
6929       break;
6930   }
6931   font=DrawGetFont(drawing_wand);
6932   if (font != (char *) NULL)
6933     (void) CloneString(&montage_info->font,font);
6934   if (frame != (char *) NULL)
6935     (void) CloneString(&montage_info->frame,frame);
6936   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6937   pixel_wand=NewPixelWand();
6938   DrawGetFillColor(drawing_wand,pixel_wand);
6939   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6940   DrawGetStrokeColor(drawing_wand,pixel_wand);
6941   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6942   pixel_wand=DestroyPixelWand(pixel_wand);
6943   if (thumbnail_geometry != (char *) NULL)
6944     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6945   if (tile_geometry != (char *) NULL)
6946     (void) CloneString(&montage_info->tile,tile_geometry);
6947   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6948     wand->exception);
6949   montage_info=DestroyMontageInfo(montage_info);
6950   if (montage_image == (Image *) NULL)
6951     return((MagickWand *) NULL);
6952   return(CloneMagickWandFromImages(wand,montage_image));
6953 }
6954 
6955 /*
6956 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6957 %                                                                             %
6958 %                                                                             %
6959 %                                                                             %
6960 %   M a g i c k M o r p h I m a g e s                                         %
6961 %                                                                             %
6962 %                                                                             %
6963 %                                                                             %
6964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6965 %
6966 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6967 %  and size are linearly interpolated to give the appearance of a
6968 %  meta-morphosis from one image to the next.
6969 %
6970 %  The format of the MagickMorphImages method is:
6971 %
6972 %      MagickWand *MagickMorphImages(MagickWand *wand,
6973 %        const size_t number_frames)
6974 %
6975 %  A description of each parameter follows:
6976 %
6977 %    o wand: the magick wand.
6978 %
6979 %    o number_frames: the number of in-between images to generate.
6980 %
6981 */
MagickMorphImages(MagickWand * wand,const size_t number_frames)6982 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6983   const size_t number_frames)
6984 {
6985   Image
6986     *morph_image;
6987 
6988   assert(wand != (MagickWand *) NULL);
6989   assert(wand->signature == MagickWandSignature);
6990   if (wand->debug != MagickFalse)
6991     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6992   if (wand->images == (Image *) NULL)
6993     return((MagickWand *) NULL);
6994   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6995   if (morph_image == (Image *) NULL)
6996     return((MagickWand *) NULL);
6997   return(CloneMagickWandFromImages(wand,morph_image));
6998 }
6999 
7000 /*
7001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7002 %                                                                             %
7003 %                                                                             %
7004 %                                                                             %
7005 %   M a g i c k M o r p h o l o g y I m a g e                                 %
7006 %                                                                             %
7007 %                                                                             %
7008 %                                                                             %
7009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7010 %
7011 %  MagickMorphologyImage() applies a user supplied kernel to the image
7012 %  according to the given mophology method.
7013 %
7014 %  The format of the MagickMorphologyImage method is:
7015 %
7016 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7017 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7018 %
7019 %  A description of each parameter follows:
7020 %
7021 %    o wand: the magick wand.
7022 %
7023 %    o method: the morphology method to be applied.
7024 %
7025 %    o iterations: apply the operation this many times (or no change).
7026 %      A value of -1 means loop until no change found.  How this is applied
7027 %      may depend on the morphology method.  Typically this is a value of 1.
7028 %
7029 %    o kernel: An array of doubles representing the morphology kernel.
7030 %
7031 */
MagickMorphologyImage(MagickWand * wand,MorphologyMethod method,const ssize_t iterations,KernelInfo * kernel)7032 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7033   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7034 {
7035   Image
7036     *morphology_image;
7037 
7038   assert(wand != (MagickWand *) NULL);
7039   assert(wand->signature == MagickWandSignature);
7040   if (wand->debug != MagickFalse)
7041     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7042   if (kernel == (const KernelInfo *) NULL)
7043     return(MagickFalse);
7044   if (wand->images == (Image *) NULL)
7045     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7046   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
7047     wand->exception);
7048   if (morphology_image == (Image *) NULL)
7049     return(MagickFalse);
7050   ReplaceImageInList(&wand->images,morphology_image);
7051   return(MagickTrue);
7052 }
7053 
7054 /*
7055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7056 %                                                                             %
7057 %                                                                             %
7058 %                                                                             %
7059 %   M a g i c k M o t i o n B l u r I m a g e                                 %
7060 %                                                                             %
7061 %                                                                             %
7062 %                                                                             %
7063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7064 %
7065 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7066 %  Gaussian operator of the given radius and standard deviation (sigma).
7067 %  For reasonable results, radius should be larger than sigma.  Use a
7068 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7069 %  Angle gives the angle of the blurring motion.
7070 %
7071 %  The format of the MagickMotionBlurImage method is:
7072 %
7073 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7074 %        const double radius,const double sigma,const double angle)
7075 %
7076 %  A description of each parameter follows:
7077 %
7078 %    o wand: the magick wand.
7079 %
7080 %    o radius: the radius of the Gaussian, in pixels, not counting
7081 %      the center pixel.
7082 %
7083 %    o sigma: the standard deviation of the Gaussian, in pixels.
7084 %
7085 %    o angle: Apply the effect along this angle.
7086 %
7087 */
MagickMotionBlurImage(MagickWand * wand,const double radius,const double sigma,const double angle)7088 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7089   const double radius,const double sigma,const double angle)
7090 {
7091   Image
7092     *blur_image;
7093 
7094   assert(wand != (MagickWand *) NULL);
7095   assert(wand->signature == MagickWandSignature);
7096   if (wand->debug != MagickFalse)
7097     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7098   if (wand->images == (Image *) NULL)
7099     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7100   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
7101   if (blur_image == (Image *) NULL)
7102     return(MagickFalse);
7103   ReplaceImageInList(&wand->images,blur_image);
7104   return(MagickTrue);
7105 }
7106 
7107 /*
7108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7109 %                                                                             %
7110 %                                                                             %
7111 %                                                                             %
7112 %   M a g i c k N e g a t e I m a g e                                         %
7113 %                                                                             %
7114 %                                                                             %
7115 %                                                                             %
7116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7117 %
7118 %  MagickNegateImage() negates the colors in the reference image.  The
7119 %  Grayscale option means that only grayscale values within the image are
7120 %  negated.
7121 %
7122 %  You can also reduce the influence of a particular channel with a gamma
7123 %  value of 0.
7124 %
7125 %  The format of the MagickNegateImage method is:
7126 %
7127 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7128 %        const MagickBooleanType gray)
7129 %
7130 %  A description of each parameter follows:
7131 %
7132 %    o wand: the magick wand.
7133 %
7134 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7135 %
7136 */
MagickNegateImage(MagickWand * wand,const MagickBooleanType gray)7137 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7138   const MagickBooleanType gray)
7139 {
7140   MagickBooleanType
7141     status;
7142 
7143   assert(wand != (MagickWand *) NULL);
7144   assert(wand->signature == MagickWandSignature);
7145   if (wand->debug != MagickFalse)
7146     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7147   if (wand->images == (Image *) NULL)
7148     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7149   status=NegateImage(wand->images,gray,wand->exception);
7150   return(status);
7151 }
7152 
7153 /*
7154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7155 %                                                                             %
7156 %                                                                             %
7157 %                                                                             %
7158 %   M a g i c k N e w I m a g e                                               %
7159 %                                                                             %
7160 %                                                                             %
7161 %                                                                             %
7162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7163 %
7164 %  MagickNewImage() adds a blank image canvas of the specified size and
7165 %  background color to the wand.
7166 %
7167 %  The format of the MagickNewImage method is:
7168 %
7169 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7170 %        const size_t columns,const size_t rows,
7171 %        const PixelWand *background)
7172 %
7173 %  A description of each parameter follows:
7174 %
7175 %    o wand: the magick wand.
7176 %
7177 %    o width: the image width.
7178 %
7179 %    o height: the image height.
7180 %
7181 %    o background: the image color.
7182 %
7183 */
MagickNewImage(MagickWand * wand,const size_t width,const size_t height,const PixelWand * background)7184 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7185   const size_t height,const PixelWand *background)
7186 {
7187   Image
7188     *images;
7189 
7190   PixelInfo
7191     pixel;
7192 
7193   assert(wand != (MagickWand *) NULL);
7194   assert(wand->signature == MagickWandSignature);
7195   if (wand->debug != MagickFalse)
7196     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7197   PixelGetMagickColor(background,&pixel);
7198   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7199   if (images == (Image *) NULL)
7200     return(MagickFalse);
7201   return(InsertImageInWand(wand,images));
7202 }
7203 
7204 /*
7205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7206 %                                                                             %
7207 %                                                                             %
7208 %                                                                             %
7209 %   M a g i c k N e x t I m a g e                                             %
7210 %                                                                             %
7211 %                                                                             %
7212 %                                                                             %
7213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7214 %
7215 %  MagickNextImage() sets the next image in the wand as the current image.
7216 %
7217 %  It is typically used after MagickResetIterator(), after which its first use
7218 %  will set the first image as the current image (unless the wand is empty).
7219 %
7220 %  It will return MagickFalse when no more images are left to be returned
7221 %  which happens when the wand is empty, or the current image is the last
7222 %  image.
7223 %
7224 %  When the above condition (end of image list) is reached, the iterator is
7225 %  automaticall set so that you can start using MagickPreviousImage() to
7226 %  again iterate over the images in the reverse direction, starting with the
7227 %  last image (again).  You can jump to this condition immeditally using
7228 %  MagickSetLastIterator().
7229 %
7230 %  The format of the MagickNextImage method is:
7231 %
7232 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7233 %
7234 %  A description of each parameter follows:
7235 %
7236 %    o wand: the magick wand.
7237 %
7238 */
MagickNextImage(MagickWand * wand)7239 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7240 {
7241   assert(wand != (MagickWand *) NULL);
7242   assert(wand->signature == MagickWandSignature);
7243   if (wand->debug != MagickFalse)
7244     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7245   if (wand->images == (Image *) NULL)
7246     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7247   wand->insert_before=MagickFalse; /* Inserts is now appended */
7248   if (wand->image_pending != MagickFalse)
7249     {
7250       wand->image_pending=MagickFalse;
7251       return(MagickTrue);
7252     }
7253   if (GetNextImageInList(wand->images) == (Image *) NULL)
7254     {
7255       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7256       return(MagickFalse);
7257     }
7258   wand->images=GetNextImageInList(wand->images);
7259   return(MagickTrue);
7260 }
7261 
7262 /*
7263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7264 %                                                                             %
7265 %                                                                             %
7266 %                                                                             %
7267 %   M a g i c k N o r m a l i z e I m a g e                                   %
7268 %                                                                             %
7269 %                                                                             %
7270 %                                                                             %
7271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7272 %
7273 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7274 %  the pixels color to span the entire range of colors available
7275 %
7276 %  You can also reduce the influence of a particular channel with a gamma
7277 %  value of 0.
7278 %
7279 %  The format of the MagickNormalizeImage method is:
7280 %
7281 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7282 %
7283 %  A description of each parameter follows:
7284 %
7285 %    o wand: the magick wand.
7286 %
7287 */
MagickNormalizeImage(MagickWand * wand)7288 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7289 {
7290   MagickBooleanType
7291     status;
7292 
7293   assert(wand != (MagickWand *) NULL);
7294   assert(wand->signature == MagickWandSignature);
7295   if (wand->debug != MagickFalse)
7296     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7297   if (wand->images == (Image *) NULL)
7298     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7299   status=NormalizeImage(wand->images,wand->exception);
7300   return(status);
7301 }
7302 
7303 /*
7304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7305 %                                                                             %
7306 %                                                                             %
7307 %                                                                             %
7308 %   M a g i c k O i l P a i n t I m a g e                                     %
7309 %                                                                             %
7310 %                                                                             %
7311 %                                                                             %
7312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7313 %
7314 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7315 %  painting.  Each pixel is replaced by the most frequent color occurring
7316 %  in a circular region defined by radius.
7317 %
7318 %  The format of the MagickOilPaintImage method is:
7319 %
7320 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7321 %        const double radius,const double sigma)
7322 %
7323 %  A description of each parameter follows:
7324 %
7325 %    o wand: the magick wand.
7326 %
7327 %    o radius: the radius of the circular neighborhood.
7328 %
7329 %    o sigma: the standard deviation of the Gaussian, in pixels.
7330 %
7331 */
MagickOilPaintImage(MagickWand * wand,const double radius,const double sigma)7332 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7333   const double radius,const double sigma)
7334 {
7335   Image
7336     *paint_image;
7337 
7338   assert(wand != (MagickWand *) NULL);
7339   assert(wand->signature == MagickWandSignature);
7340   if (wand->debug != MagickFalse)
7341     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7342   if (wand->images == (Image *) NULL)
7343     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7344   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7345   if (paint_image == (Image *) NULL)
7346     return(MagickFalse);
7347   ReplaceImageInList(&wand->images,paint_image);
7348   return(MagickTrue);
7349 }
7350 
7351 /*
7352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7353 %                                                                             %
7354 %                                                                             %
7355 %                                                                             %
7356 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7357 %                                                                             %
7358 %                                                                             %
7359 %                                                                             %
7360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7361 %
7362 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7363 %  defined by fill.
7364 %
7365 %  The format of the MagickOpaquePaintImage method is:
7366 %
7367 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7368 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7369 %        const MagickBooleanType invert)
7370 %
7371 %  A description of each parameter follows:
7372 %
7373 %    o wand: the magick wand.
7374 %
7375 %    o target: Change this target color to the fill color within the image.
7376 %
7377 %    o fill: the fill pixel wand.
7378 %
7379 %    o fuzz: By default target must match a particular pixel color
7380 %      exactly.  However, in many cases two colors may differ by a small amount.
7381 %      The fuzz member of image defines how much tolerance is acceptable to
7382 %      consider two colors as the same.  For example, set fuzz to 10 and the
7383 %      color red at intensities of 100 and 102 respectively are now interpreted
7384 %      as the same color for the purposes of the floodfill.
7385 %
7386 %    o invert: paint any pixel that does not match the target color.
7387 %
7388 */
MagickOpaquePaintImage(MagickWand * wand,const PixelWand * target,const PixelWand * fill,const double fuzz,const MagickBooleanType invert)7389 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7390   const PixelWand *target,const PixelWand *fill,const double fuzz,
7391   const MagickBooleanType invert)
7392 {
7393   MagickBooleanType
7394     status;
7395 
7396   PixelInfo
7397     fill_pixel,
7398     target_pixel;
7399 
7400   assert(wand != (MagickWand *) NULL);
7401   assert(wand->signature == MagickWandSignature);
7402   if (wand->debug != MagickFalse)
7403     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7404   if (wand->images == (Image *) NULL)
7405     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7406   PixelGetMagickColor(target,&target_pixel);
7407   PixelGetMagickColor(fill,&fill_pixel);
7408   wand->images->fuzz=fuzz;
7409   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7410     wand->exception);
7411   return(status);
7412 }
7413 
7414 /*
7415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7416 %                                                                             %
7417 %                                                                             %
7418 %                                                                             %
7419 %   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                         %
7420 %                                                                             %
7421 %                                                                             %
7422 %                                                                             %
7423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7424 %
7425 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7426 %  previous image in the sequence.  From this it attempts to select the
7427 %  smallest cropped image to replace each frame, while preserving the results
7428 %  of the animation.
7429 %
7430 %  The format of the MagickOptimizeImageLayers method is:
7431 %
7432 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7433 %
7434 %  A description of each parameter follows:
7435 %
7436 %    o wand: the magick wand.
7437 %
7438 */
MagickOptimizeImageLayers(MagickWand * wand)7439 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7440 {
7441   Image
7442     *optimize_image;
7443 
7444   assert(wand != (MagickWand *) NULL);
7445   assert(wand->signature == MagickWandSignature);
7446   if (wand->debug != MagickFalse)
7447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7448   if (wand->images == (Image *) NULL)
7449     return((MagickWand *) NULL);
7450   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7451   if (optimize_image == (Image *) NULL)
7452     return((MagickWand *) NULL);
7453   return(CloneMagickWandFromImages(wand,optimize_image));
7454 }
7455 
7456 /*
7457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7458 %                                                                             %
7459 %                                                                             %
7460 %                                                                             %
7461 %   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             %
7462 %                                                                             %
7463 %                                                                             %
7464 %                                                                             %
7465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7466 %
7467 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7468 %  compares the overlayed pixels against the disposal image resulting from all
7469 %  the previous frames in the animation.  Any pixel that does not change the
7470 %  disposal image (and thus does not effect the outcome of an overlay) is made
7471 %  transparent.
7472 %
7473 %  WARNING: This modifies the current images directly, rather than generate
7474 %  a new image sequence.
7475 %  The format of the MagickOptimizeImageTransparency method is:
7476 %
7477 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7478 %
7479 %  A description of each parameter follows:
7480 %
7481 %    o wand: the magick wand.
7482 %
7483 */
MagickOptimizeImageTransparency(MagickWand * wand)7484 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7485 {
7486   assert(wand != (MagickWand *) NULL);
7487   assert(wand->signature == MagickWandSignature);
7488   if (wand->debug != MagickFalse)
7489     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7490   if (wand->images == (Image *) NULL)
7491     return(MagickFalse);
7492   OptimizeImageTransparency(wand->images,wand->exception);
7493   return(MagickTrue);
7494 }
7495 
7496 /*
7497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7498 %                                                                             %
7499 %                                                                             %
7500 %                                                                             %
7501 %     M a g i c k O r d e r e d D i t h e r I m a g e                         %
7502 %                                                                             %
7503 %                                                                             %
7504 %                                                                             %
7505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7506 %
7507 %  MagickOrderedDitherImage() performs an ordered dither based on a number
7508 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7509 %  which can be different for different channels, according to the input
7510 %  arguments.
7511 %
7512 %  The format of the MagickOrderedDitherImage method is:
7513 %
7514 %      MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
7515 %        const char *threshold_map)
7516 %
7517 %  A description of each parameter follows:
7518 %
7519 %    o image: the image.
7520 %
7521 %    o threshold_map: A string containing the name of the threshold dither
7522 %      map to use, followed by zero or more numbers representing the number of
7523 %      color levels tho dither between.
7524 %
7525 %      Any level number less than 2 is equivalent to 2, and means only binary
7526 %      dithering will be applied to each color channel.
7527 %
7528 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7529 %      channels, while a single number is the number of levels applied to each
7530 %      channel in sequence.  More numbers will be applied in turn to each of
7531 %      the color channels.
7532 %
7533 %      For example: "o3x3,6" generates a 6 level posterization of the image
7534 %      with a ordered 3x3 diffused pixel dither being applied between each
7535 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7536 %      only a single checkerboard hash pattern (50% grey) between each color
7537 %      level, to basically double the number of color levels with a bare
7538 %      minimim of dithering.
7539 %
7540 */
MagickOrderedDitherImage(MagickWand * wand,const char * threshold_map)7541 WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
7542   const char *threshold_map)
7543 {
7544   MagickBooleanType
7545     status;
7546 
7547   assert(wand != (MagickWand *) NULL);
7548   assert(wand->signature == MagickWandSignature);
7549   if (wand->debug != MagickFalse)
7550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7551   if (wand->images == (Image *) NULL)
7552     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7553   status=OrderedDitherImage(wand->images,threshold_map,wand->exception);
7554   return(status);
7555 }
7556 
7557 /*
7558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7559 %                                                                             %
7560 %                                                                             %
7561 %                                                                             %
7562 %   M a g i c k P i n g I m a g e                                             %
7563 %                                                                             %
7564 %                                                                             %
7565 %                                                                             %
7566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7567 %
7568 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7569 %  information returned is the image width, height, size, and format.  It
7570 %  is designed to efficiently obtain this information from a file without
7571 %  reading the entire image sequence into memory.
7572 %
7573 %  The format of the MagickPingImage method is:
7574 %
7575 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7576 %
7577 %  A description of each parameter follows:
7578 %
7579 %    o wand: the magick wand.
7580 %
7581 %    o filename: the image filename.
7582 %
7583 */
MagickPingImage(MagickWand * wand,const char * filename)7584 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7585   const char *filename)
7586 {
7587   Image
7588     *images;
7589 
7590   ImageInfo
7591     *ping_info;
7592 
7593   assert(wand != (MagickWand *) NULL);
7594   assert(wand->signature == MagickWandSignature);
7595   if (wand->debug != MagickFalse)
7596     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7597   ping_info=CloneImageInfo(wand->image_info);
7598   if (filename != (const char *) NULL)
7599     (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
7600   images=PingImage(ping_info,wand->exception);
7601   ping_info=DestroyImageInfo(ping_info);
7602   if (images == (Image *) NULL)
7603     return(MagickFalse);
7604   return(InsertImageInWand(wand,images));
7605 }
7606 
7607 /*
7608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7609 %                                                                             %
7610 %                                                                             %
7611 %                                                                             %
7612 %   M a g i c k P i n g I m a g e B l o b                                     %
7613 %                                                                             %
7614 %                                                                             %
7615 %                                                                             %
7616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7617 %
7618 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7619 %
7620 %  The format of the MagickPingImageBlob method is:
7621 %
7622 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7623 %        const void *blob,const size_t length)
7624 %
7625 %  A description of each parameter follows:
7626 %
7627 %    o wand: the magick wand.
7628 %
7629 %    o blob: the blob.
7630 %
7631 %    o length: the blob length.
7632 %
7633 */
MagickPingImageBlob(MagickWand * wand,const void * blob,const size_t length)7634 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7635   const void *blob,const size_t length)
7636 {
7637   Image
7638     *images;
7639 
7640   ImageInfo
7641     *read_info;
7642 
7643   assert(wand != (MagickWand *) NULL);
7644   assert(wand->signature == MagickWandSignature);
7645   if (wand->debug != MagickFalse)
7646     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7647   read_info=CloneImageInfo(wand->image_info);
7648   SetImageInfoBlob(read_info,blob,length);
7649   images=PingImage(read_info,wand->exception);
7650   read_info=DestroyImageInfo(read_info);
7651   if (images == (Image *) NULL)
7652     return(MagickFalse);
7653   return(InsertImageInWand(wand,images));
7654 }
7655 
7656 /*
7657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7658 %                                                                             %
7659 %                                                                             %
7660 %                                                                             %
7661 %   M a g i c k P i n g I m a g e F i l e                                     %
7662 %                                                                             %
7663 %                                                                             %
7664 %                                                                             %
7665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7666 %
7667 %  MagickPingImageFile() pings an image or image sequence from an open file
7668 %  descriptor.
7669 %
7670 %  The format of the MagickPingImageFile method is:
7671 %
7672 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7673 %
7674 %  A description of each parameter follows:
7675 %
7676 %    o wand: the magick wand.
7677 %
7678 %    o file: the file descriptor.
7679 %
7680 */
MagickPingImageFile(MagickWand * wand,FILE * file)7681 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7682 {
7683   Image
7684     *images;
7685 
7686   ImageInfo
7687     *read_info;
7688 
7689   assert(wand != (MagickWand *) NULL);
7690   assert(wand->signature == MagickWandSignature);
7691   assert(file != (FILE *) NULL);
7692   if (wand->debug != MagickFalse)
7693     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7694   read_info=CloneImageInfo(wand->image_info);
7695   SetImageInfoFile(read_info,file);
7696   images=PingImage(read_info,wand->exception);
7697   read_info=DestroyImageInfo(read_info);
7698   if (images == (Image *) NULL)
7699     return(MagickFalse);
7700   return(InsertImageInWand(wand,images));
7701 }
7702 
7703 /*
7704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7705 %                                                                             %
7706 %                                                                             %
7707 %                                                                             %
7708 %   M a g i c k P o l a r o i d I m a g e                                     %
7709 %                                                                             %
7710 %                                                                             %
7711 %                                                                             %
7712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7713 %
7714 %  MagickPolaroidImage() simulates a Polaroid picture.
7715 %
7716 %  The format of the MagickPolaroidImage method is:
7717 %
7718 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7719 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
7720 %        const PixelInterpolateMethod method)
7721 %
7722 %  A description of each parameter follows:
7723 %
7724 %    o wand: the magick wand.
7725 %
7726 %    o drawing_wand: the draw wand.
7727 %
7728 %    o caption: the Polaroid caption.
7729 %
7730 %    o angle: Apply the effect along this angle.
7731 %
7732 %    o method: the pixel interpolation method.
7733 %
7734 */
MagickPolaroidImage(MagickWand * wand,const DrawingWand * drawing_wand,const char * caption,const double angle,const PixelInterpolateMethod method)7735 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7736   const DrawingWand *drawing_wand,const char *caption,const double angle,
7737   const PixelInterpolateMethod method)
7738 {
7739   DrawInfo
7740     *draw_info;
7741 
7742   Image
7743     *polaroid_image;
7744 
7745   assert(wand != (MagickWand *) NULL);
7746   assert(wand->signature == MagickWandSignature);
7747   if (wand->debug != MagickFalse)
7748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7749   if (wand->images == (Image *) NULL)
7750     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7751   draw_info=PeekDrawingWand(drawing_wand);
7752   if (draw_info == (DrawInfo *) NULL)
7753     return(MagickFalse);
7754   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7755     wand->exception);
7756   if (polaroid_image == (Image *) NULL)
7757     return(MagickFalse);
7758   ReplaceImageInList(&wand->images,polaroid_image);
7759   return(MagickTrue);
7760 }
7761 
7762 /*
7763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7764 %                                                                             %
7765 %                                                                             %
7766 %                                                                             %
7767 %   M a g i c k P o s t e r i z e I m a g e                                   %
7768 %                                                                             %
7769 %                                                                             %
7770 %                                                                             %
7771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7772 %
7773 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7774 %
7775 %  The format of the MagickPosterizeImage method is:
7776 %
7777 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7778 %        const size_t levels,const DitherMethod method)
7779 %
7780 %  A description of each parameter follows:
7781 %
7782 %    o wand: the magick wand.
7783 %
7784 %    o levels: Number of color levels allowed in each channel.  Very low values
7785 %      (2, 3, or 4) have the most visible effect.
7786 %
7787 %    o method: choose the dither method: UndefinedDitherMethod,
7788 %      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7789 %
7790 */
MagickPosterizeImage(MagickWand * wand,const size_t levels,const DitherMethod dither)7791 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7792   const size_t levels,const DitherMethod dither)
7793 {
7794   MagickBooleanType
7795     status;
7796 
7797   assert(wand != (MagickWand *) NULL);
7798   assert(wand->signature == MagickWandSignature);
7799   if (wand->debug != MagickFalse)
7800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7801   if (wand->images == (Image *) NULL)
7802     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7803   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7804   return(status);
7805 }
7806 
7807 /*
7808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7809 %                                                                             %
7810 %                                                                             %
7811 %                                                                             %
7812 %   M a g i c k P r e v i e w I m a g e s                                     %
7813 %                                                                             %
7814 %                                                                             %
7815 %                                                                             %
7816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7817 %
7818 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7819 %  image processing operation applied at varying strengths.  This helpful
7820 %  to quickly pin-point an appropriate parameter for an image processing
7821 %  operation.
7822 %
7823 %  The format of the MagickPreviewImages method is:
7824 %
7825 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7826 %        const PreviewType preview)
7827 %
7828 %  A description of each parameter follows:
7829 %
7830 %    o wand: the magick wand.
7831 %
7832 %    o preview: the preview type.
7833 %
7834 */
MagickPreviewImages(MagickWand * wand,const PreviewType preview)7835 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7836   const PreviewType preview)
7837 {
7838   Image
7839     *preview_image;
7840 
7841   assert(wand != (MagickWand *) NULL);
7842   assert(wand->signature == MagickWandSignature);
7843   if (wand->debug != MagickFalse)
7844     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7845   if (wand->images == (Image *) NULL)
7846     return((MagickWand *) NULL);
7847   preview_image=PreviewImage(wand->images,preview,wand->exception);
7848   if (preview_image == (Image *) NULL)
7849     return((MagickWand *) NULL);
7850   return(CloneMagickWandFromImages(wand,preview_image));
7851 }
7852 
7853 /*
7854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7855 %                                                                             %
7856 %                                                                             %
7857 %                                                                             %
7858 %   M a g i c k P r e v i o u s I m a g e                                     %
7859 %                                                                             %
7860 %                                                                             %
7861 %                                                                             %
7862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7863 %
7864 %  MagickPreviousImage() sets the previous image in the wand as the current
7865 %  image.
7866 %
7867 %  It is typically used after MagickSetLastIterator(), after which its first
7868 %  use will set the last image as the current image (unless the wand is empty).
7869 %
7870 %  It will return MagickFalse when no more images are left to be returned
7871 %  which happens when the wand is empty, or the current image is the first
7872 %  image.  At that point the iterator is than reset to again process images in
7873 %  the forward direction, again starting with the first image in list. Images
7874 %  added at this point are prepended.
7875 %
7876 %  Also at that point any images added to the wand using MagickAddImages() or
7877 %  MagickReadImages() will be prepended before the first image. In this sense
7878 %  the condition is not quite exactly the same as MagickResetIterator().
7879 %
7880 %  The format of the MagickPreviousImage method is:
7881 %
7882 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7883 %
7884 %  A description of each parameter follows:
7885 %
7886 %    o wand: the magick wand.
7887 %
7888 */
MagickPreviousImage(MagickWand * wand)7889 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7890 {
7891   assert(wand != (MagickWand *) NULL);
7892   assert(wand->signature == MagickWandSignature);
7893   if (wand->debug != MagickFalse)
7894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7895   if (wand->images == (Image *) NULL)
7896     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7897   if (wand->image_pending != MagickFalse)
7898     {
7899       wand->image_pending=MagickFalse;  /* image returned no longer pending */
7900       return(MagickTrue);
7901     }
7902   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7903     {
7904       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7905       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7906       return(MagickFalse);
7907     }
7908   wand->images=GetPreviousImageInList(wand->images);
7909   return(MagickTrue);
7910 }
7911 
7912 /*
7913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7914 %                                                                             %
7915 %                                                                             %
7916 %                                                                             %
7917 %   M a g i c k Q u a n t i z e I m a g e                                     %
7918 %                                                                             %
7919 %                                                                             %
7920 %                                                                             %
7921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7922 %
7923 %  MagickQuantizeImage() analyzes the colors within a reference image and
7924 %  chooses a fixed number of colors to represent the image.  The goal of the
7925 %  algorithm is to minimize the color difference between the input and output
7926 %  image while minimizing the processing time.
7927 %
7928 %  The format of the MagickQuantizeImage method is:
7929 %
7930 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7931 %        const size_t number_colors,const ColorspaceType colorspace,
7932 %        const size_t treedepth,const DitherMethod dither_method,
7933 %        const MagickBooleanType measure_error)
7934 %
7935 %  A description of each parameter follows:
7936 %
7937 %    o wand: the magick wand.
7938 %
7939 %    o number_colors: the number of colors.
7940 %
7941 %    o colorspace: Perform color reduction in this colorspace, typically
7942 %      RGBColorspace.
7943 %
7944 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7945 %      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
7946 %      reference image with the least amount of memory and the fastest
7947 %      computational speed.  In some cases, such as an image with low color
7948 %      dispersion (a few number of colors), a value other than
7949 %      Log4(number_colors) is required.  To expand the color tree completely,
7950 %      use a value of 8.
7951 %
7952 %    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7953 %      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7954 %
7955 %    o measure_error: A value other than zero measures the difference between
7956 %      the original and quantized images.  This difference is the total
7957 %      quantization error.  The error is computed by summing over all pixels
7958 %      in an image the distance squared in RGB space between each reference
7959 %      pixel value and its quantized value.
7960 %
7961 */
MagickQuantizeImage(MagickWand * wand,const size_t number_colors,const ColorspaceType colorspace,const size_t treedepth,const DitherMethod dither_method,const MagickBooleanType measure_error)7962 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7963   const size_t number_colors,const ColorspaceType colorspace,
7964   const size_t treedepth,const DitherMethod dither_method,
7965   const MagickBooleanType measure_error)
7966 {
7967   MagickBooleanType
7968     status;
7969 
7970   QuantizeInfo
7971     *quantize_info;
7972 
7973   assert(wand != (MagickWand *) NULL);
7974   assert(wand->signature == MagickWandSignature);
7975   if (wand->debug != MagickFalse)
7976     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7977   if (wand->images == (Image *) NULL)
7978     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7979   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7980   quantize_info->number_colors=number_colors;
7981   quantize_info->dither_method=dither_method;
7982   quantize_info->tree_depth=treedepth;
7983   quantize_info->colorspace=colorspace;
7984   quantize_info->measure_error=measure_error;
7985   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7986   quantize_info=DestroyQuantizeInfo(quantize_info);
7987   return(status);
7988 }
7989 
7990 /*
7991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7992 %                                                                             %
7993 %                                                                             %
7994 %                                                                             %
7995 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7996 %                                                                             %
7997 %                                                                             %
7998 %                                                                             %
7999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8000 %
8001 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
8002 %  chooses a fixed number of colors to represent the image.  The goal of the
8003 %  algorithm is to minimize the color difference between the input and output
8004 %  image while minimizing the processing time.
8005 %
8006 %  The format of the MagickQuantizeImages method is:
8007 %
8008 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8009 %        const size_t number_colors,const ColorspaceType colorspace,
8010 %        const size_t treedepth,const DitherMethod dither_method,
8011 %        const MagickBooleanType measure_error)
8012 %
8013 %  A description of each parameter follows:
8014 %
8015 %    o wand: the magick wand.
8016 %
8017 %    o number_colors: the number of colors.
8018 %
8019 %    o colorspace: Perform color reduction in this colorspace, typically
8020 %      RGBColorspace.
8021 %
8022 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8023 %      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
8024 %      reference image with the least amount of memory and the fastest
8025 %      computational speed.  In some cases, such as an image with low color
8026 %      dispersion (a few number of colors), a value other than
8027 %      Log4(number_colors) is required.  To expand the color tree completely,
8028 %      use a value of 8.
8029 %
8030 %    o dither_method: choose from these dither methods: NoDitherMethod,
8031 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8032 %
8033 %    o measure_error: A value other than zero measures the difference between
8034 %      the original and quantized images.  This difference is the total
8035 %      quantization error.  The error is computed by summing over all pixels
8036 %      in an image the distance squared in RGB space between each reference
8037 %      pixel value and its quantized value.
8038 %
8039 */
MagickQuantizeImages(MagickWand * wand,const size_t number_colors,const ColorspaceType colorspace,const size_t treedepth,const DitherMethod dither_method,const MagickBooleanType measure_error)8040 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8041   const size_t number_colors,const ColorspaceType colorspace,
8042   const size_t treedepth,const DitherMethod dither_method,
8043   const MagickBooleanType measure_error)
8044 {
8045   MagickBooleanType
8046     status;
8047 
8048   QuantizeInfo
8049     *quantize_info;
8050 
8051   assert(wand != (MagickWand *) NULL);
8052   assert(wand->signature == MagickWandSignature);
8053   if (wand->debug != MagickFalse)
8054     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8055   if (wand->images == (Image *) NULL)
8056     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8057   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8058   quantize_info->number_colors=number_colors;
8059   quantize_info->dither_method=dither_method;
8060   quantize_info->tree_depth=treedepth;
8061   quantize_info->colorspace=colorspace;
8062   quantize_info->measure_error=measure_error;
8063   status=QuantizeImages(quantize_info,wand->images,wand->exception);
8064   quantize_info=DestroyQuantizeInfo(quantize_info);
8065   return(status);
8066 }
8067 
8068 /*
8069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8070 %                                                                             %
8071 %                                                                             %
8072 %                                                                             %
8073 %   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                         %
8074 %                                                                             %
8075 %                                                                             %
8076 %                                                                             %
8077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8078 %
8079 %  MagickRotationalBlurImage() rotational blurs an image.
8080 %
8081 %  The format of the MagickRotationalBlurImage method is:
8082 %
8083 %      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8084 %        const double angle)
8085 %
8086 %  A description of each parameter follows:
8087 %
8088 %    o wand: the magick wand.
8089 %
8090 %    o angle: the angle of the blur in degrees.
8091 %
8092 */
MagickRotationalBlurImage(MagickWand * wand,const double angle)8093 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8094   const double angle)
8095 {
8096   Image
8097     *blur_image;
8098 
8099   assert(wand != (MagickWand *) NULL);
8100   assert(wand->signature == MagickWandSignature);
8101   if (wand->debug != MagickFalse)
8102     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8103   if (wand->images == (Image *) NULL)
8104     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8105   blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
8106   if (blur_image == (Image *) NULL)
8107     return(MagickFalse);
8108   ReplaceImageInList(&wand->images,blur_image);
8109   return(MagickTrue);
8110 }
8111 
8112 /*
8113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8114 %                                                                             %
8115 %                                                                             %
8116 %                                                                             %
8117 %   M a g i c k R a i s e I m a g e                                           %
8118 %                                                                             %
8119 %                                                                             %
8120 %                                                                             %
8121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8122 %
8123 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8124 %  by lightening and darkening the edges of the image.  Members width and
8125 %  height of raise_info define the width of the vertical and horizontal
8126 %  edge of the effect.
8127 %
8128 %  The format of the MagickRaiseImage method is:
8129 %
8130 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8131 %        const size_t width,const size_t height,const ssize_t x,
8132 %        const ssize_t y,const MagickBooleanType raise)
8133 %
8134 %  A description of each parameter follows:
8135 %
8136 %    o wand: the magick wand.
8137 %
8138 %    o width,height,x,y:  Define the dimensions of the area to raise.
8139 %
8140 %    o raise: A value other than zero creates a 3-D raise effect,
8141 %      otherwise it has a lowered effect.
8142 %
8143 */
MagickRaiseImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y,const MagickBooleanType raise)8144 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8145   const size_t width,const size_t height,const ssize_t x,
8146   const ssize_t y,const MagickBooleanType raise)
8147 {
8148   MagickBooleanType
8149     status;
8150 
8151   RectangleInfo
8152     raise_info;
8153 
8154   assert(wand != (MagickWand *) NULL);
8155   assert(wand->signature == MagickWandSignature);
8156   if (wand->debug != MagickFalse)
8157     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8158   if (wand->images == (Image *) NULL)
8159     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8160   raise_info.width=width;
8161   raise_info.height=height;
8162   raise_info.x=x;
8163   raise_info.y=y;
8164   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8165   return(status);
8166 }
8167 
8168 /*
8169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8170 %                                                                             %
8171 %                                                                             %
8172 %                                                                             %
8173 %   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                       %
8174 %                                                                             %
8175 %                                                                             %
8176 %                                                                             %
8177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8178 %
8179 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8180 %  the intensity of each pixel compared to threshold.  The result is a
8181 %  high-contrast, two color image.
8182 %
8183 %  The format of the MagickRandomThresholdImage method is:
8184 %
8185 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8186 %        const double low,const double high)
8187 %
8188 %  A description of each parameter follows:
8189 %
8190 %    o wand: the magick wand.
8191 %
8192 %    o low,high: Specify the high and low thresholds. These values range from
8193 %      0 to QuantumRange.
8194 %
8195 */
MagickRandomThresholdImage(MagickWand * wand,const double low,const double high)8196 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8197   const double low,const double high)
8198 {
8199   assert(wand != (MagickWand *) NULL);
8200   assert(wand->signature == MagickWandSignature);
8201   if (wand->debug != MagickFalse)
8202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8203   if (wand->images == (Image *) NULL)
8204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8205   return(RandomThresholdImage(wand->images,low,high,wand->exception));
8206 }
8207 
8208 /*
8209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8210 %                                                                             %
8211 %                                                                             %
8212 %                                                                             %
8213 %   M a g i c k R e a d I m a g e                                             %
8214 %                                                                             %
8215 %                                                                             %
8216 %                                                                             %
8217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8218 %
8219 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8220 %  jjust before the current image pointer position.
8221 %
8222 %  Use MagickSetFirstIterator(), to insert new images before all the current
8223 %  images in the wand, MagickSetLastIterator() to append add to the end,
8224 %  MagickSetIteratorIndex() to place images just after the given index.
8225 %
8226 %  The format of the MagickReadImage method is:
8227 %
8228 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8229 %
8230 %  A description of each parameter follows:
8231 %
8232 %    o wand: the magick wand.
8233 %
8234 %    o filename: the image filename.
8235 %
8236 */
MagickReadImage(MagickWand * wand,const char * filename)8237 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8238   const char *filename)
8239 {
8240   Image
8241     *images;
8242 
8243   ImageInfo
8244     *read_info;
8245 
8246   assert(wand != (MagickWand *) NULL);
8247   assert(wand->signature == MagickWandSignature);
8248   if (wand->debug != MagickFalse)
8249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8250   read_info=CloneImageInfo(wand->image_info);
8251   if (filename != (const char *) NULL)
8252     (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
8253   images=ReadImage(read_info,wand->exception);
8254   read_info=DestroyImageInfo(read_info);
8255   if (images == (Image *) NULL)
8256     return(MagickFalse);
8257   return(InsertImageInWand(wand,images));
8258 }
8259 
8260 /*
8261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8262 %                                                                             %
8263 %                                                                             %
8264 %                                                                             %
8265 %   M a g i c k R e a d I m a g e B l o b                                     %
8266 %                                                                             %
8267 %                                                                             %
8268 %                                                                             %
8269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8270 %
8271 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8272 %  In all other respects it is like MagickReadImage().
8273 %
8274 %  The format of the MagickReadImageBlob method is:
8275 %
8276 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8277 %        const void *blob,const size_t length)
8278 %
8279 %  A description of each parameter follows:
8280 %
8281 %    o wand: the magick wand.
8282 %
8283 %    o blob: the blob.
8284 %
8285 %    o length: the blob length.
8286 %
8287 */
MagickReadImageBlob(MagickWand * wand,const void * blob,const size_t length)8288 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8289   const void *blob,const size_t length)
8290 {
8291   Image
8292     *images;
8293 
8294   assert(wand != (MagickWand *) NULL);
8295   assert(wand->signature == MagickWandSignature);
8296   if (wand->debug != MagickFalse)
8297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8298   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8299   if (images == (Image *) NULL)
8300     return(MagickFalse);
8301   return(InsertImageInWand(wand,images));
8302 }
8303 
8304 /*
8305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8306 %                                                                             %
8307 %                                                                             %
8308 %                                                                             %
8309 %   M a g i c k R e a d I m a g e F i l e                                     %
8310 %                                                                             %
8311 %                                                                             %
8312 %                                                                             %
8313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8314 %
8315 %  MagickReadImageFile() reads an image or image sequence from an already
8316 %  opened file descriptor.  Otherwise it is like MagickReadImage().
8317 %
8318 %  The format of the MagickReadImageFile method is:
8319 %
8320 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8321 %
8322 %  A description of each parameter follows:
8323 %
8324 %    o wand: the magick wand.
8325 %
8326 %    o file: the file descriptor.
8327 %
8328 */
MagickReadImageFile(MagickWand * wand,FILE * file)8329 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8330 {
8331   Image
8332     *images;
8333 
8334   ImageInfo
8335     *read_info;
8336 
8337   assert(wand != (MagickWand *) NULL);
8338   assert(wand->signature == MagickWandSignature);
8339   assert(file != (FILE *) NULL);
8340   if (wand->debug != MagickFalse)
8341     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8342   read_info=CloneImageInfo(wand->image_info);
8343   SetImageInfoFile(read_info,file);
8344   images=ReadImage(read_info,wand->exception);
8345   read_info=DestroyImageInfo(read_info);
8346   if (images == (Image *) NULL)
8347     return(MagickFalse);
8348   return(InsertImageInWand(wand,images));
8349 }
8350 
8351 /*
8352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8353 %                                                                             %
8354 %                                                                             %
8355 %                                                                             %
8356 %   M a g i c k R e m a p I m a g e                                           %
8357 %                                                                             %
8358 %                                                                             %
8359 %                                                                             %
8360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8361 %
8362 %  MagickRemapImage() replaces the colors of an image with the closest color
8363 %  from a reference image.
8364 %
8365 %  The format of the MagickRemapImage method is:
8366 %
8367 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8368 %        const MagickWand *remap_wand,const DitherMethod method)
8369 %
8370 %  A description of each parameter follows:
8371 %
8372 %    o wand: the magick wand.
8373 %
8374 %    o affinity: the affinity wand.
8375 %
8376 %    o method: choose from these dither methods: NoDitherMethod,
8377 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8378 %
8379 */
MagickRemapImage(MagickWand * wand,const MagickWand * remap_wand,const DitherMethod dither_method)8380 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8381   const MagickWand *remap_wand,const DitherMethod dither_method)
8382 {
8383   MagickBooleanType
8384     status;
8385 
8386   QuantizeInfo
8387     *quantize_info;
8388 
8389   assert(wand != (MagickWand *) NULL);
8390   assert(wand->signature == MagickWandSignature);
8391   if (wand->debug != MagickFalse)
8392     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8393   if ((wand->images == (Image *) NULL) ||
8394       (remap_wand->images == (Image *) NULL))
8395     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8396   quantize_info=AcquireQuantizeInfo(wand->image_info);
8397   quantize_info->dither_method=dither_method;
8398   status=RemapImage(quantize_info,wand->images,remap_wand->images,
8399     wand->exception);
8400   quantize_info=DestroyQuantizeInfo(quantize_info);
8401   return(status);
8402 }
8403 
8404 /*
8405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8406 %                                                                             %
8407 %                                                                             %
8408 %                                                                             %
8409 %   M a g i c k R e m o v e I m a g e                                         %
8410 %                                                                             %
8411 %                                                                             %
8412 %                                                                             %
8413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8414 %
8415 %  MagickRemoveImage() removes an image from the image list.
8416 %
8417 %  The format of the MagickRemoveImage method is:
8418 %
8419 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8420 %
8421 %  A description of each parameter follows:
8422 %
8423 %    o wand: the magick wand.
8424 %
8425 %    o insert: the splice wand.
8426 %
8427 */
MagickRemoveImage(MagickWand * wand)8428 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8429 {
8430   assert(wand != (MagickWand *) NULL);
8431   assert(wand->signature == MagickWandSignature);
8432   if (wand->debug != MagickFalse)
8433     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8434   if (wand->images == (Image *) NULL)
8435     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8436   DeleteImageFromList(&wand->images);
8437   return(MagickTrue);
8438 }
8439 
8440 /*
8441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8442 %                                                                             %
8443 %                                                                             %
8444 %                                                                             %
8445 %   M a g i c k R e s a m p l e I m a g e                                     %
8446 %                                                                             %
8447 %                                                                             %
8448 %                                                                             %
8449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8450 %
8451 %  MagickResampleImage() resample image to desired resolution.
8452 %
8453 %    Bessel   Blackman   Box
8454 %    Catrom   Cubic      Gaussian
8455 %    Hanning  Hermite    Lanczos
8456 %    Mitchell Point      Quandratic
8457 %    Sinc     Triangle
8458 %
8459 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8460 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8461 %  are windowed (brought down to zero) with the Blackman filter.
8462 %
8463 %  The format of the MagickResampleImage method is:
8464 %
8465 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8466 %        const double x_resolution,const double y_resolution,
8467 %        const FilterType filter)
8468 %
8469 %  A description of each parameter follows:
8470 %
8471 %    o wand: the magick wand.
8472 %
8473 %    o x_resolution: the new image x resolution.
8474 %
8475 %    o y_resolution: the new image y resolution.
8476 %
8477 %    o filter: Image filter to use.
8478 %
8479 */
MagickResampleImage(MagickWand * wand,const double x_resolution,const double y_resolution,const FilterType filter)8480 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8481   const double x_resolution,const double y_resolution,const FilterType filter)
8482 {
8483   Image
8484     *resample_image;
8485 
8486   assert(wand != (MagickWand *) NULL);
8487   assert(wand->signature == MagickWandSignature);
8488   if (wand->debug != MagickFalse)
8489     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8490   if (wand->images == (Image *) NULL)
8491     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8492   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8493     wand->exception);
8494   if (resample_image == (Image *) NULL)
8495     return(MagickFalse);
8496   ReplaceImageInList(&wand->images,resample_image);
8497   return(MagickTrue);
8498 }
8499 
8500 /*
8501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8502 %                                                                             %
8503 %                                                                             %
8504 %                                                                             %
8505 %   M a g i c k R e s e t I m a g e P a g e                                   %
8506 %                                                                             %
8507 %                                                                             %
8508 %                                                                             %
8509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8510 %
8511 %  MagickResetImagePage() resets the Wand page canvas and position.
8512 %
8513 %  The format of the MagickResetImagePage method is:
8514 %
8515 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8516 %        const char *page)
8517 %
8518 %  A description of each parameter follows:
8519 %
8520 %    o wand: the magick wand.
8521 %
8522 %    o page: the relative page specification.
8523 %
8524 */
MagickResetImagePage(MagickWand * wand,const char * page)8525 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8526   const char *page)
8527 {
8528   assert(wand != (MagickWand *) NULL);
8529   assert(wand->signature == MagickWandSignature);
8530   if (wand->debug != MagickFalse)
8531     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8532   if (wand->images == (Image *) NULL)
8533     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8534   if ((page == (char *) NULL) || (*page == '\0'))
8535     {
8536       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8537       return(MagickTrue);
8538     }
8539   return(ResetImagePage(wand->images,page));
8540 }
8541 
8542 /*
8543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8544 %                                                                             %
8545 %                                                                             %
8546 %                                                                             %
8547 %   M a g i c k R e s i z e I m a g e                                         %
8548 %                                                                             %
8549 %                                                                             %
8550 %                                                                             %
8551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8552 %
8553 %  MagickResizeImage() scales an image to the desired dimensions with one of
8554 %  these filters:
8555 %
8556 %    Bessel   Blackman   Box
8557 %    Catrom   Cubic      Gaussian
8558 %    Hanning  Hermite    Lanczos
8559 %    Mitchell Point      Quandratic
8560 %    Sinc     Triangle
8561 %
8562 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8563 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8564 %  are windowed (brought down to zero) with the Blackman filter.
8565 %
8566 %  The format of the MagickResizeImage method is:
8567 %
8568 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8569 %        const size_t columns,const size_t rows,const FilterType filter)
8570 %
8571 %  A description of each parameter follows:
8572 %
8573 %    o wand: the magick wand.
8574 %
8575 %    o columns: the number of columns in the scaled image.
8576 %
8577 %    o rows: the number of rows in the scaled image.
8578 %
8579 %    o filter: Image filter to use.
8580 %
8581 */
MagickResizeImage(MagickWand * wand,const size_t columns,const size_t rows,const FilterType filter)8582 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8583   const size_t columns,const size_t rows,const FilterType filter)
8584 {
8585   Image
8586     *resize_image;
8587 
8588   assert(wand != (MagickWand *) NULL);
8589   assert(wand->signature == MagickWandSignature);
8590   if (wand->debug != MagickFalse)
8591     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8592   if (wand->images == (Image *) NULL)
8593     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8594   resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8595   if (resize_image == (Image *) NULL)
8596     return(MagickFalse);
8597   ReplaceImageInList(&wand->images,resize_image);
8598   return(MagickTrue);
8599 }
8600 
8601 /*
8602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8603 %                                                                             %
8604 %                                                                             %
8605 %                                                                             %
8606 %   M a g i c k R o l l I m a g e                                             %
8607 %                                                                             %
8608 %                                                                             %
8609 %                                                                             %
8610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8611 %
8612 %  MagickRollImage() offsets an image as defined by x and y.
8613 %
8614 %  The format of the MagickRollImage method is:
8615 %
8616 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8617 %        const size_t y)
8618 %
8619 %  A description of each parameter follows:
8620 %
8621 %    o wand: the magick wand.
8622 %
8623 %    o x: the x offset.
8624 %
8625 %    o y: the y offset.
8626 %
8627 %
8628 */
MagickRollImage(MagickWand * wand,const ssize_t x,const ssize_t y)8629 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8630   const ssize_t x,const ssize_t y)
8631 {
8632   Image
8633     *roll_image;
8634 
8635   assert(wand != (MagickWand *) NULL);
8636   assert(wand->signature == MagickWandSignature);
8637   if (wand->debug != MagickFalse)
8638     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8639   if (wand->images == (Image *) NULL)
8640     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8641   roll_image=RollImage(wand->images,x,y,wand->exception);
8642   if (roll_image == (Image *) NULL)
8643     return(MagickFalse);
8644   ReplaceImageInList(&wand->images,roll_image);
8645   return(MagickTrue);
8646 }
8647 
8648 /*
8649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8650 %                                                                             %
8651 %                                                                             %
8652 %                                                                             %
8653 %   M a g i c k R o t a t e I m a g e                                         %
8654 %                                                                             %
8655 %                                                                             %
8656 %                                                                             %
8657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8658 %
8659 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8660 %  triangles left over from rotating the image are filled with the
8661 %  background color.
8662 %
8663 %  The format of the MagickRotateImage method is:
8664 %
8665 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8666 %        const PixelWand *background,const double degrees)
8667 %
8668 %  A description of each parameter follows:
8669 %
8670 %    o wand: the magick wand.
8671 %
8672 %    o background: the background pixel wand.
8673 %
8674 %    o degrees: the number of degrees to rotate the image.
8675 %
8676 %
8677 */
MagickRotateImage(MagickWand * wand,const PixelWand * background,const double degrees)8678 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8679   const PixelWand *background,const double degrees)
8680 {
8681   Image
8682     *rotate_image;
8683 
8684   assert(wand != (MagickWand *) NULL);
8685   assert(wand->signature == MagickWandSignature);
8686   if (wand->debug != MagickFalse)
8687     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8688   if (wand->images == (Image *) NULL)
8689     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8690   PixelGetQuantumPacket(background,&wand->images->background_color);
8691   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8692   if (rotate_image == (Image *) NULL)
8693     return(MagickFalse);
8694   ReplaceImageInList(&wand->images,rotate_image);
8695   return(MagickTrue);
8696 }
8697 
8698 /*
8699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8700 %                                                                             %
8701 %                                                                             %
8702 %                                                                             %
8703 %   M a g i c k S a m p l e I m a g e                                         %
8704 %                                                                             %
8705 %                                                                             %
8706 %                                                                             %
8707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8708 %
8709 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8710 %  sampling.  Unlike other scaling methods, this method does not introduce
8711 %  any additional color into the scaled image.
8712 %
8713 %  The format of the MagickSampleImage method is:
8714 %
8715 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8716 %        const size_t columns,const size_t rows)
8717 %
8718 %  A description of each parameter follows:
8719 %
8720 %    o wand: the magick wand.
8721 %
8722 %    o columns: the number of columns in the scaled image.
8723 %
8724 %    o rows: the number of rows in the scaled image.
8725 %
8726 %
8727 */
MagickSampleImage(MagickWand * wand,const size_t columns,const size_t rows)8728 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8729   const size_t columns,const size_t rows)
8730 {
8731   Image
8732     *sample_image;
8733 
8734   assert(wand != (MagickWand *) NULL);
8735   assert(wand->signature == MagickWandSignature);
8736   if (wand->debug != MagickFalse)
8737     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8738   if (wand->images == (Image *) NULL)
8739     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8740   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8741   if (sample_image == (Image *) NULL)
8742     return(MagickFalse);
8743   ReplaceImageInList(&wand->images,sample_image);
8744   return(MagickTrue);
8745 }
8746 
8747 /*
8748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8749 %                                                                             %
8750 %                                                                             %
8751 %                                                                             %
8752 %   M a g i c k S c a l e I m a g e                                           %
8753 %                                                                             %
8754 %                                                                             %
8755 %                                                                             %
8756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8757 %
8758 %  MagickScaleImage() scales the size of an image to the given dimensions.
8759 %
8760 %  The format of the MagickScaleImage method is:
8761 %
8762 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8763 %        const size_t columns,const size_t rows)
8764 %
8765 %  A description of each parameter follows:
8766 %
8767 %    o wand: the magick wand.
8768 %
8769 %    o columns: the number of columns in the scaled image.
8770 %
8771 %    o rows: the number of rows in the scaled image.
8772 %
8773 %
8774 */
MagickScaleImage(MagickWand * wand,const size_t columns,const size_t rows)8775 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8776   const size_t columns,const size_t rows)
8777 {
8778   Image
8779     *scale_image;
8780 
8781   assert(wand != (MagickWand *) NULL);
8782   assert(wand->signature == MagickWandSignature);
8783   if (wand->debug != MagickFalse)
8784     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8785   if (wand->images == (Image *) NULL)
8786     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8787   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8788   if (scale_image == (Image *) NULL)
8789     return(MagickFalse);
8790   ReplaceImageInList(&wand->images,scale_image);
8791   return(MagickTrue);
8792 }
8793 
8794 /*
8795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8796 %                                                                             %
8797 %                                                                             %
8798 %                                                                             %
8799 %   M a g i c k S e g m e n t I m a g e                                       %
8800 %                                                                             %
8801 %                                                                             %
8802 %                                                                             %
8803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8804 %
8805 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8806 %  color components and identifying units that are homogeneous with the fuzzy
8807 %  C-means technique.
8808 %
8809 %  The format of the SegmentImage method is:
8810 %
8811 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8812 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8813 %        const double cluster_threshold,const double smooth_threshold)
8814 %
8815 %  A description of each parameter follows.
8816 %
8817 %    o wand: the wand.
8818 %
8819 %    o colorspace: the image colorspace.
8820 %
8821 %    o verbose:  Set to MagickTrue to print detailed information about the
8822 %      identified classes.
8823 %
8824 %    o cluster_threshold:  This represents the minimum number of pixels
8825 %      contained in a hexahedra before it can be considered valid (expressed as
8826 %      a percentage).
8827 %
8828 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8829 %      derivative of the histogram.  As the value is increased, you can expect a
8830 %      smoother second derivative.
8831 %
8832 */
MagickSegmentImage(MagickWand * wand,const ColorspaceType colorspace,const MagickBooleanType verbose,const double cluster_threshold,const double smooth_threshold)8833 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8834   const ColorspaceType colorspace,const MagickBooleanType verbose,
8835   const double cluster_threshold,const double smooth_threshold)
8836 {
8837   MagickBooleanType
8838     status;
8839 
8840   assert(wand != (MagickWand *) NULL);
8841   assert(wand->signature == MagickWandSignature);
8842   if (wand->debug != MagickFalse)
8843     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8844   if (wand->images == (Image *) NULL)
8845     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8846   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8847     smooth_threshold,wand->exception);
8848   return(status);
8849 }
8850 
8851 /*
8852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8853 %                                                                             %
8854 %                                                                             %
8855 %                                                                             %
8856 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8857 %                                                                             %
8858 %                                                                             %
8859 %                                                                             %
8860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8861 %
8862 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8863 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8864 %  contrast above a certain threshold.
8865 %
8866 %  The format of the MagickSelectiveBlurImage method is:
8867 %
8868 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8869 %        const double radius,const double sigma,const double threshold)
8870 %
8871 %  A description of each parameter follows:
8872 %
8873 %    o wand: the magick wand.
8874 %
8875 %    o radius: the radius of the gaussian, in pixels, not counting the center
8876 %      pixel.
8877 %
8878 %    o sigma: the standard deviation of the gaussian, in pixels.
8879 %
8880 %    o threshold: only pixels within this contrast threshold are included
8881 %      in the blur operation.
8882 %
8883 */
MagickSelectiveBlurImage(MagickWand * wand,const double radius,const double sigma,const double threshold)8884 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8885   const double radius,const double sigma,const double threshold)
8886 {
8887   Image
8888     *blur_image;
8889 
8890   assert(wand != (MagickWand *) NULL);
8891   assert(wand->signature == MagickWandSignature);
8892   if (wand->debug != MagickFalse)
8893     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8894   if (wand->images == (Image *) NULL)
8895     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8896   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8897     wand->exception);
8898   if (blur_image == (Image *) NULL)
8899     return(MagickFalse);
8900   ReplaceImageInList(&wand->images,blur_image);
8901   return(MagickTrue);
8902 }
8903 
8904 /*
8905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8906 %                                                                             %
8907 %                                                                             %
8908 %                                                                             %
8909 %   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                       %
8910 %                                                                             %
8911 %                                                                             %
8912 %                                                                             %
8913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8914 %
8915 %  MagickSeparateImage() separates a channel from the image and returns a
8916 %  grayscale image.  A channel is a particular color component of each pixel
8917 %  in the image.
8918 %
8919 %  The format of the MagickSeparateImage method is:
8920 %
8921 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8922 %        const ChannelType channel)
8923 %
8924 %  A description of each parameter follows:
8925 %
8926 %    o wand: the magick wand.
8927 %
8928 %    o channel: the channel.
8929 %
8930 */
MagickSeparateImage(MagickWand * wand,const ChannelType channel)8931 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8932   const ChannelType channel)
8933 {
8934   Image
8935     *separate_image;
8936 
8937   assert(wand != (MagickWand *) NULL);
8938   assert(wand->signature == MagickWandSignature);
8939   if (wand->debug != MagickFalse)
8940     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8941   if (wand->images == (Image *) NULL)
8942     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8943   separate_image=SeparateImage(wand->images,channel,wand->exception);
8944   if (separate_image == (Image *) NULL)
8945     return(MagickFalse);
8946   ReplaceImageInList(&wand->images,separate_image);
8947   return(MagickTrue);
8948 }
8949 
8950 /*
8951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8952 %                                                                             %
8953 %                                                                             %
8954 %                                                                             %
8955 %     M a g i c k S e p i a T o n e I m a g e                                 %
8956 %                                                                             %
8957 %                                                                             %
8958 %                                                                             %
8959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8960 %
8961 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8962 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8963 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8964 %  threshold of 80% is a good starting point for a reasonable tone.
8965 %
8966 %  The format of the MagickSepiaToneImage method is:
8967 %
8968 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8969 %        const double threshold)
8970 %
8971 %  A description of each parameter follows:
8972 %
8973 %    o wand: the magick wand.
8974 %
8975 %    o threshold:  Define the extent of the sepia toning.
8976 %
8977 */
MagickSepiaToneImage(MagickWand * wand,const double threshold)8978 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8979   const double threshold)
8980 {
8981   Image
8982     *sepia_image;
8983 
8984   assert(wand != (MagickWand *) NULL);
8985   assert(wand->signature == MagickWandSignature);
8986   if (wand->debug != MagickFalse)
8987     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8988   if (wand->images == (Image *) NULL)
8989     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8990   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8991   if (sepia_image == (Image *) NULL)
8992     return(MagickFalse);
8993   ReplaceImageInList(&wand->images,sepia_image);
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                                               %
9003 %                                                                             %
9004 %                                                                             %
9005 %                                                                             %
9006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9007 %
9008 %  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
9009 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
9010 %  wand.
9011 %
9012 %  The format of the MagickSetImage method is:
9013 %
9014 %      MagickBooleanType MagickSetImage(MagickWand *wand,
9015 %        const MagickWand *set_wand)
9016 %
9017 %  A description of each parameter follows:
9018 %
9019 %    o wand: the magick wand.
9020 %
9021 %    o set_wand: the set_wand wand.
9022 %
9023 */
MagickSetImage(MagickWand * wand,const MagickWand * set_wand)9024 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9025   const MagickWand *set_wand)
9026 {
9027   Image
9028     *images;
9029 
9030   assert(wand != (MagickWand *) NULL);
9031   assert(wand->signature == MagickWandSignature);
9032   if (wand->debug != MagickFalse)
9033     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9034   assert(set_wand != (MagickWand *) NULL);
9035   assert(set_wand->signature == MagickWandSignature);
9036   if (wand->debug != MagickFalse)
9037     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9038   if (set_wand->images == (Image *) NULL)
9039     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9040   images=CloneImageList(set_wand->images,wand->exception);
9041   if (images == (Image *) NULL)
9042     return(MagickFalse);
9043   ReplaceImageInList(&wand->images,images);
9044   return(MagickTrue);
9045 }
9046 
9047 /*
9048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9049 %                                                                             %
9050 %                                                                             %
9051 %                                                                             %
9052 %   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                       %
9053 %                                                                             %
9054 %                                                                             %
9055 %                                                                             %
9056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9057 %
9058 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9059 %  alpha channel.
9060 %
9061 %  The format of the MagickSetImageAlphaChannel method is:
9062 %
9063 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9064 %        const AlphaChannelOption alpha_type)
9065 %
9066 %  A description of each parameter follows:
9067 %
9068 %    o wand: the magick wand.
9069 %
9070 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9071 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9072 %
9073 */
MagickSetImageAlphaChannel(MagickWand * wand,const AlphaChannelOption alpha_type)9074 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9075   const AlphaChannelOption alpha_type)
9076 {
9077   assert(wand != (MagickWand *) NULL);
9078   assert(wand->signature == MagickWandSignature);
9079   if (wand->debug != MagickFalse)
9080     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9081   if (wand->images == (Image *) NULL)
9082     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9083   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9084 }
9085 
9086 /*
9087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9088 %                                                                             %
9089 %                                                                             %
9090 %                                                                             %
9091 %   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                 %
9092 %                                                                             %
9093 %                                                                             %
9094 %                                                                             %
9095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9096 %
9097 %  MagickSetImageBackgroundColor() sets the image background color.
9098 %
9099 %  The format of the MagickSetImageBackgroundColor method is:
9100 %
9101 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9102 %        const PixelWand *background)
9103 %
9104 %  A description of each parameter follows:
9105 %
9106 %    o wand: the magick wand.
9107 %
9108 %    o background: the background pixel wand.
9109 %
9110 */
MagickSetImageBackgroundColor(MagickWand * wand,const PixelWand * background)9111 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9112   const PixelWand *background)
9113 {
9114   assert(wand != (MagickWand *) NULL);
9115   assert(wand->signature == MagickWandSignature);
9116   if (wand->debug != MagickFalse)
9117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9118   if (wand->images == (Image *) NULL)
9119     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9120   PixelGetQuantumPacket(background,&wand->images->background_color);
9121   return(MagickTrue);
9122 }
9123 
9124 /*
9125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9126 %                                                                             %
9127 %                                                                             %
9128 %                                                                             %
9129 %   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                         %
9130 %                                                                             %
9131 %                                                                             %
9132 %                                                                             %
9133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9134 %
9135 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9136 %
9137 %  The format of the MagickSetImageBluePrimary method is:
9138 %
9139 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9140 %        const double x,const double y,const double z)
9141 %
9142 %  A description of each parameter follows:
9143 %
9144 %    o wand: the magick wand.
9145 %
9146 %    o x: the blue primary x-point.
9147 %
9148 %    o y: the blue primary y-point.
9149 %
9150 %    o z: the blue primary z-point.
9151 %
9152 */
MagickSetImageBluePrimary(MagickWand * wand,const double x,const double y,const double z)9153 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9154   const double x,const double y,const double z)
9155 {
9156   assert(wand != (MagickWand *) NULL);
9157   assert(wand->signature == MagickWandSignature);
9158   if (wand->debug != MagickFalse)
9159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9160   if (wand->images == (Image *) NULL)
9161     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9162   wand->images->chromaticity.blue_primary.x=x;
9163   wand->images->chromaticity.blue_primary.y=y;
9164   wand->images->chromaticity.blue_primary.z=z;
9165   return(MagickTrue);
9166 }
9167 
9168 /*
9169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9170 %                                                                             %
9171 %                                                                             %
9172 %                                                                             %
9173 %   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                         %
9174 %                                                                             %
9175 %                                                                             %
9176 %                                                                             %
9177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9178 %
9179 %  MagickSetImageBorderColor() sets the image border color.
9180 %
9181 %  The format of the MagickSetImageBorderColor method is:
9182 %
9183 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9184 %        const PixelWand *border)
9185 %
9186 %  A description of each parameter follows:
9187 %
9188 %    o wand: the magick wand.
9189 %
9190 %    o border: the border pixel wand.
9191 %
9192 */
MagickSetImageBorderColor(MagickWand * wand,const PixelWand * border)9193 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9194   const PixelWand *border)
9195 {
9196   assert(wand != (MagickWand *) NULL);
9197   assert(wand->signature == MagickWandSignature);
9198   if (wand->debug != MagickFalse)
9199     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9200   if (wand->images == (Image *) NULL)
9201     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9202   PixelGetQuantumPacket(border,&wand->images->border_color);
9203   return(MagickTrue);
9204 }
9205 
9206 /*
9207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9208 %                                                                             %
9209 %                                                                             %
9210 %                                                                             %
9211 %   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                         %
9212 %                                                                             %
9213 %                                                                             %
9214 %                                                                             %
9215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9216 %
9217 %  MagickSetImageChannelMask() sets image channel mask.
9218 %
9219 %  The format of the MagickSetImageChannelMask method is:
9220 %
9221 %      ChannelType MagickSetImageChannelMask(MagickWand *wand,
9222 %        const ChannelType channel_mask)
9223 %
9224 %  A description of each parameter follows:
9225 %
9226 %    o wand: the magick wand.
9227 %
9228 %    o channel_mask: the channel_mask wand.
9229 %
9230 */
MagickSetImageChannelMask(MagickWand * wand,const ChannelType channel_mask)9231 WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9232   const ChannelType channel_mask)
9233 {
9234   assert(wand != (MagickWand *) NULL);
9235   assert(wand->signature == MagickWandSignature);
9236   if (wand->debug != MagickFalse)
9237     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9238   return(SetImageChannelMask(wand->images,channel_mask));
9239 }
9240 
9241 /*
9242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9243 %                                                                             %
9244 %                                                                             %
9245 %                                                                             %
9246 %   M a g i c k S e t I m a g e M a s k                                       %
9247 %                                                                             %
9248 %                                                                             %
9249 %                                                                             %
9250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9251 %
9252 %  MagickSetImageMask() sets image clip mask.
9253 %
9254 %  The format of the MagickSetImageMask method is:
9255 %
9256 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9257 %        const PixelMask type,const MagickWand *clip_mask)
9258 %
9259 %  A description of each parameter follows:
9260 %
9261 %    o wand: the magick wand.
9262 %
9263 %    o type: type of mask, ReadPixelMask or WritePixelMask.
9264 %
9265 %    o clip_mask: the clip_mask wand.
9266 %
9267 */
MagickSetImageMask(MagickWand * wand,const PixelMask type,const MagickWand * clip_mask)9268 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9269   const PixelMask type,const MagickWand *clip_mask)
9270 {
9271   assert(wand != (MagickWand *) NULL);
9272   assert(wand->signature == MagickWandSignature);
9273   if (wand->debug != MagickFalse)
9274     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9275   assert(clip_mask != (MagickWand *) NULL);
9276   assert(clip_mask->signature == MagickWandSignature);
9277   if (clip_mask->debug != MagickFalse)
9278     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9279   if (clip_mask->images == (Image *) NULL)
9280     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9281   return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
9282 }
9283 
9284 /*
9285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9286 %                                                                             %
9287 %                                                                             %
9288 %                                                                             %
9289 %   M a g i c k S e t I m a g e C o l o r                                     %
9290 %                                                                             %
9291 %                                                                             %
9292 %                                                                             %
9293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9294 %
9295 %  MagickSetImageColor() set the entire wand canvas to the specified color.
9296 %
9297 %  The format of the MagickSetImageColor method is:
9298 %
9299 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9300 %        const PixelWand *color)
9301 %
9302 %  A description of each parameter follows:
9303 %
9304 %    o wand: the magick wand.
9305 %
9306 %    o background: the image color.
9307 %
9308 */
MagickSetImageColor(MagickWand * wand,const PixelWand * color)9309 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9310   const PixelWand *color)
9311 {
9312   PixelInfo
9313     pixel;
9314 
9315   assert(wand != (MagickWand *) NULL);
9316   assert(wand->signature == MagickWandSignature);
9317   if (wand->debug != MagickFalse)
9318     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9319   PixelGetMagickColor(color,&pixel);
9320   return(SetImageColor(wand->images,&pixel,wand->exception));
9321 }
9322 
9323 /*
9324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9325 %                                                                             %
9326 %                                                                             %
9327 %                                                                             %
9328 %   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                     %
9329 %                                                                             %
9330 %                                                                             %
9331 %                                                                             %
9332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9333 %
9334 %  MagickSetImageColormapColor() sets the color of the specified colormap
9335 %  index.
9336 %
9337 %  The format of the MagickSetImageColormapColor method is:
9338 %
9339 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9340 %        const size_t index,const PixelWand *color)
9341 %
9342 %  A description of each parameter follows:
9343 %
9344 %    o wand: the magick wand.
9345 %
9346 %    o index: the offset into the image colormap.
9347 %
9348 %    o color: Return the colormap color in this wand.
9349 %
9350 */
MagickSetImageColormapColor(MagickWand * wand,const size_t index,const PixelWand * color)9351 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9352   const size_t index,const PixelWand *color)
9353 {
9354   assert(wand != (MagickWand *) NULL);
9355   assert(wand->signature == MagickWandSignature);
9356   if (wand->debug != MagickFalse)
9357     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9358   if (wand->images == (Image *) NULL)
9359     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9360   if ((wand->images->colormap == (PixelInfo *) NULL) ||
9361       (index >= wand->images->colors))
9362     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9363   PixelGetQuantumPacket(color,wand->images->colormap+index);
9364   return(SyncImage(wand->images,wand->exception));
9365 }
9366 
9367 /*
9368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9369 %                                                                             %
9370 %                                                                             %
9371 %                                                                             %
9372 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9373 %                                                                             %
9374 %                                                                             %
9375 %                                                                             %
9376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9377 %
9378 %  MagickSetImageColorspace() sets the image colorspace. But does not modify
9379 %  the image data.
9380 %
9381 %  The format of the MagickSetImageColorspace method is:
9382 %
9383 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9384 %        const ColorspaceType colorspace)
9385 %
9386 %  A description of each parameter follows:
9387 %
9388 %    o wand: the magick wand.
9389 %
9390 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9391 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9392 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9393 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9394 %      HSLColorspace, or HWBColorspace.
9395 %
9396 */
MagickSetImageColorspace(MagickWand * wand,const ColorspaceType colorspace)9397 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9398   const ColorspaceType colorspace)
9399 {
9400   assert(wand != (MagickWand *) NULL);
9401   assert(wand->signature == MagickWandSignature);
9402   if (wand->debug != MagickFalse)
9403     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9404   if (wand->images == (Image *) NULL)
9405     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9406   return(SetImageColorspace(wand->images,colorspace,wand->exception));
9407 }
9408 
9409 /*
9410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9411 %                                                                             %
9412 %                                                                             %
9413 %                                                                             %
9414 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9415 %                                                                             %
9416 %                                                                             %
9417 %                                                                             %
9418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9419 %
9420 %  MagickSetImageCompose() sets the image composite operator, useful for
9421 %  specifying how to composite the image thumbnail when using the
9422 %  MagickMontageImage() method.
9423 %
9424 %  The format of the MagickSetImageCompose method is:
9425 %
9426 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9427 %        const CompositeOperator compose)
9428 %
9429 %  A description of each parameter follows:
9430 %
9431 %    o wand: the magick wand.
9432 %
9433 %    o compose: the image composite operator.
9434 %
9435 */
MagickSetImageCompose(MagickWand * wand,const CompositeOperator compose)9436 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9437   const CompositeOperator compose)
9438 {
9439   assert(wand != (MagickWand *) NULL);
9440   assert(wand->signature == MagickWandSignature);
9441   if (wand->debug != MagickFalse)
9442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9443   if (wand->images == (Image *) NULL)
9444     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9445   wand->images->compose=compose;
9446   return(MagickTrue);
9447 }
9448 
9449 /*
9450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9451 %                                                                             %
9452 %                                                                             %
9453 %                                                                             %
9454 %   M a g i c k S e t I m a g e C o m p r e s s i o n                         %
9455 %                                                                             %
9456 %                                                                             %
9457 %                                                                             %
9458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9459 %
9460 %  MagickSetImageCompression() sets the image compression.
9461 %
9462 %  The format of the MagickSetImageCompression method is:
9463 %
9464 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9465 %        const CompressionType compression)
9466 %
9467 %  A description of each parameter follows:
9468 %
9469 %    o wand: the magick wand.
9470 %
9471 %    o compression: the image compression type.
9472 %
9473 */
MagickSetImageCompression(MagickWand * wand,const CompressionType compression)9474 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9475   const CompressionType compression)
9476 {
9477   assert(wand != (MagickWand *) NULL);
9478   assert(wand->signature == MagickWandSignature);
9479   if (wand->debug != MagickFalse)
9480     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9481   if (wand->images == (Image *) NULL)
9482     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9483   wand->images->compression=compression;
9484   return(MagickTrue);
9485 }
9486 
9487 /*
9488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9489 %                                                                             %
9490 %                                                                             %
9491 %                                                                             %
9492 %   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           %
9493 %                                                                             %
9494 %                                                                             %
9495 %                                                                             %
9496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9497 %
9498 %  MagickSetImageCompressionQuality() sets the image compression quality.
9499 %
9500 %  The format of the MagickSetImageCompressionQuality method is:
9501 %
9502 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9503 %        const size_t quality)
9504 %
9505 %  A description of each parameter follows:
9506 %
9507 %    o wand: the magick wand.
9508 %
9509 %    o quality: the image compression tlityype.
9510 %
9511 */
MagickSetImageCompressionQuality(MagickWand * wand,const size_t quality)9512 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9513   const size_t quality)
9514 {
9515   assert(wand != (MagickWand *) NULL);
9516   assert(wand->signature == MagickWandSignature);
9517   if (wand->debug != MagickFalse)
9518     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9519   if (wand->images == (Image *) NULL)
9520     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9521   wand->images->quality=quality;
9522   return(MagickTrue);
9523 }
9524 
9525 /*
9526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9527 %                                                                             %
9528 %                                                                             %
9529 %                                                                             %
9530 %   M a g i c k S e t I m a g e D e l a y                                     %
9531 %                                                                             %
9532 %                                                                             %
9533 %                                                                             %
9534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9535 %
9536 %  MagickSetImageDelay() sets the image delay.
9537 %
9538 %  The format of the MagickSetImageDelay method is:
9539 %
9540 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9541 %        const size_t delay)
9542 %
9543 %  A description of each parameter follows:
9544 %
9545 %    o wand: the magick wand.
9546 %
9547 %    o delay: the image delay in ticks-per-second units.
9548 %
9549 */
MagickSetImageDelay(MagickWand * wand,const size_t delay)9550 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9551   const size_t delay)
9552 {
9553   assert(wand != (MagickWand *) NULL);
9554   assert(wand->signature == MagickWandSignature);
9555   if (wand->debug != MagickFalse)
9556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9557   if (wand->images == (Image *) NULL)
9558     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9559   wand->images->delay=delay;
9560   return(MagickTrue);
9561 }
9562 
9563 /*
9564 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9565 %                                                                             %
9566 %                                                                             %
9567 %                                                                             %
9568 %   M a g i c k S e t I m a g e D e p t h                                     %
9569 %                                                                             %
9570 %                                                                             %
9571 %                                                                             %
9572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9573 %
9574 %  MagickSetImageDepth() sets the image depth.
9575 %
9576 %  The format of the MagickSetImageDepth method is:
9577 %
9578 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9579 %        const size_t depth)
9580 %
9581 %  A description of each parameter follows:
9582 %
9583 %    o wand: the magick wand.
9584 %
9585 %    o depth: the image depth in bits: 8, 16, or 32.
9586 %
9587 */
MagickSetImageDepth(MagickWand * wand,const size_t depth)9588 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9589   const size_t depth)
9590 {
9591   assert(wand != (MagickWand *) NULL);
9592   assert(wand->signature == MagickWandSignature);
9593   if (wand->debug != MagickFalse)
9594     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9595   if (wand->images == (Image *) NULL)
9596     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9597   return(SetImageDepth(wand->images,depth,wand->exception));
9598 }
9599 
9600 /*
9601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9602 %                                                                             %
9603 %                                                                             %
9604 %                                                                             %
9605 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9606 %                                                                             %
9607 %                                                                             %
9608 %                                                                             %
9609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9610 %
9611 %  MagickSetImageDispose() sets the image disposal method.
9612 %
9613 %  The format of the MagickSetImageDispose method is:
9614 %
9615 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9616 %        const DisposeType dispose)
9617 %
9618 %  A description of each parameter follows:
9619 %
9620 %    o wand: the magick wand.
9621 %
9622 %    o dispose: the image disposeal type.
9623 %
9624 */
MagickSetImageDispose(MagickWand * wand,const DisposeType dispose)9625 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9626   const DisposeType dispose)
9627 {
9628   assert(wand != (MagickWand *) NULL);
9629   assert(wand->signature == MagickWandSignature);
9630   if (wand->debug != MagickFalse)
9631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9632   if (wand->images == (Image *) NULL)
9633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9634   wand->images->dispose=dispose;
9635   return(MagickTrue);
9636 }
9637 
9638 /*
9639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9640 %                                                                             %
9641 %                                                                             %
9642 %                                                                             %
9643 %   M a g i c k S e t I m a g e E n d i a n                                   %
9644 %                                                                             %
9645 %                                                                             %
9646 %                                                                             %
9647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9648 %
9649 %  MagickSetImageEndian() sets the image endian method.
9650 %
9651 %  The format of the MagickSetImageEndian method is:
9652 %
9653 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9654 %        const EndianType endian)
9655 %
9656 %  A description of each parameter follows:
9657 %
9658 %    o wand: the magick wand.
9659 %
9660 %    o endian: the image endian type.
9661 %
9662 */
MagickSetImageEndian(MagickWand * wand,const EndianType endian)9663 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9664   const EndianType endian)
9665 {
9666   assert(wand != (MagickWand *) NULL);
9667   assert(wand->signature == MagickWandSignature);
9668   if (wand->debug != MagickFalse)
9669     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9670   if (wand->images == (Image *) NULL)
9671     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9672   wand->images->endian=endian;
9673   return(MagickTrue);
9674 }
9675 
9676 /*
9677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9678 %                                                                             %
9679 %                                                                             %
9680 %                                                                             %
9681 %   M a g i c k S e t I m a g e E x t e n t                                   %
9682 %                                                                             %
9683 %                                                                             %
9684 %                                                                             %
9685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9686 %
9687 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9688 %
9689 %  The format of the MagickSetImageExtent method is:
9690 %
9691 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9692 %        const size_t columns,const unsigned rows)
9693 %
9694 %  A description of each parameter follows:
9695 %
9696 %    o wand: the magick wand.
9697 %
9698 %    o columns:  The image width in pixels.
9699 %
9700 %    o rows:  The image height in pixels.
9701 %
9702 */
MagickSetImageExtent(MagickWand * wand,const size_t columns,const size_t rows)9703 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9704   const size_t columns,const size_t rows)
9705 {
9706   assert(wand != (MagickWand *) NULL);
9707   assert(wand->signature == MagickWandSignature);
9708   if (wand->debug != MagickFalse)
9709     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9710   if (wand->images == (Image *) NULL)
9711     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9712   return(SetImageExtent(wand->images,columns,rows,wand->exception));
9713 }
9714 
9715 /*
9716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9717 %                                                                             %
9718 %                                                                             %
9719 %                                                                             %
9720 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9721 %                                                                             %
9722 %                                                                             %
9723 %                                                                             %
9724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9725 %
9726 %  MagickSetImageFilename() sets the filename of a particular image in a
9727 %  sequence.
9728 %
9729 %  The format of the MagickSetImageFilename method is:
9730 %
9731 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9732 %        const char *filename)
9733 %
9734 %  A description of each parameter follows:
9735 %
9736 %    o wand: the magick wand.
9737 %
9738 %    o filename: the image filename.
9739 %
9740 */
MagickSetImageFilename(MagickWand * wand,const char * filename)9741 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9742   const char *filename)
9743 {
9744   assert(wand != (MagickWand *) NULL);
9745   assert(wand->signature == MagickWandSignature);
9746   if (wand->debug != MagickFalse)
9747     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9748   if (wand->images == (Image *) NULL)
9749     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9750   if (filename != (const char *) NULL)
9751     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
9752   return(MagickTrue);
9753 }
9754 
9755 /*
9756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9757 %                                                                             %
9758 %                                                                             %
9759 %                                                                             %
9760 %   M a g i c k S e t I m a g e F o r m a t                                   %
9761 %                                                                             %
9762 %                                                                             %
9763 %                                                                             %
9764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9765 %
9766 %  MagickSetImageFormat() sets the format of a particular image in a
9767 %  sequence.
9768 %
9769 %  The format of the MagickSetImageFormat method is:
9770 %
9771 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9772 %        const char *format)
9773 %
9774 %  A description of each parameter follows:
9775 %
9776 %    o wand: the magick wand.
9777 %
9778 %    o format: the image format.
9779 %
9780 */
MagickSetImageFormat(MagickWand * wand,const char * format)9781 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9782   const char *format)
9783 {
9784   const MagickInfo
9785     *magick_info;
9786 
9787   assert(wand != (MagickWand *) NULL);
9788   assert(wand->signature == MagickWandSignature);
9789   if (wand->debug != MagickFalse)
9790     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9791   if (wand->images == (Image *) NULL)
9792     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9793   if ((format == (char *) NULL) || (*format == '\0'))
9794     {
9795       *wand->images->magick='\0';
9796       return(MagickTrue);
9797     }
9798   magick_info=GetMagickInfo(format,wand->exception);
9799   if (magick_info == (const MagickInfo *) NULL)
9800     return(MagickFalse);
9801   ClearMagickException(wand->exception);
9802   (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
9803   return(MagickTrue);
9804 }
9805 
9806 /*
9807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9808 %                                                                             %
9809 %                                                                             %
9810 %                                                                             %
9811 %   M a g i c k S e t I m a g e F u z z                                       %
9812 %                                                                             %
9813 %                                                                             %
9814 %                                                                             %
9815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9816 %
9817 %  MagickSetImageFuzz() sets the image fuzz.
9818 %
9819 %  The format of the MagickSetImageFuzz method is:
9820 %
9821 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9822 %        const double fuzz)
9823 %
9824 %  A description of each parameter follows:
9825 %
9826 %    o wand: the magick wand.
9827 %
9828 %    o fuzz: the image fuzz.
9829 %
9830 */
MagickSetImageFuzz(MagickWand * wand,const double fuzz)9831 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9832   const double fuzz)
9833 {
9834   assert(wand != (MagickWand *) NULL);
9835   assert(wand->signature == MagickWandSignature);
9836   if (wand->debug != MagickFalse)
9837     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9838   if (wand->images == (Image *) NULL)
9839     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9840   wand->images->fuzz=fuzz;
9841   return(MagickTrue);
9842 }
9843 
9844 /*
9845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9846 %                                                                             %
9847 %                                                                             %
9848 %                                                                             %
9849 %   M a g i c k S e t I m a g e G a m m a                                     %
9850 %                                                                             %
9851 %                                                                             %
9852 %                                                                             %
9853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9854 %
9855 %  MagickSetImageGamma() sets the image gamma.
9856 %
9857 %  The format of the MagickSetImageGamma method is:
9858 %
9859 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9860 %        const double gamma)
9861 %
9862 %  A description of each parameter follows:
9863 %
9864 %    o wand: the magick wand.
9865 %
9866 %    o gamma: the image gamma.
9867 %
9868 */
MagickSetImageGamma(MagickWand * wand,const double gamma)9869 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9870   const double gamma)
9871 {
9872   assert(wand != (MagickWand *) NULL);
9873   assert(wand->signature == MagickWandSignature);
9874   if (wand->debug != MagickFalse)
9875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9876   if (wand->images == (Image *) NULL)
9877     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9878   wand->images->gamma=gamma;
9879   return(MagickTrue);
9880 }
9881 
9882 /*
9883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9884 %                                                                             %
9885 %                                                                             %
9886 %                                                                             %
9887 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9888 %                                                                             %
9889 %                                                                             %
9890 %                                                                             %
9891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9892 %
9893 %  MagickSetImageGravity() sets the image gravity type.
9894 %
9895 %  The format of the MagickSetImageGravity method is:
9896 %
9897 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9898 %        const GravityType gravity)
9899 %
9900 %  A description of each parameter follows:
9901 %
9902 %    o wand: the magick wand.
9903 %
9904 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
9905 %               NorthEastGravity, WestGravity, CenterGravity,
9906 %               EastGravity, SouthWestGravity, SouthGravity,
9907 %               SouthEastGravity)
9908 %
9909 */
MagickSetImageGravity(MagickWand * wand,const GravityType gravity)9910 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9911   const GravityType gravity)
9912 {
9913   assert(wand != (MagickWand *) NULL);
9914   assert(wand->signature == MagickWandSignature);
9915   if (wand->debug != MagickFalse)
9916     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9917   if (wand->images == (Image *) NULL)
9918     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9919   wand->images->gravity=gravity;
9920   return(MagickTrue);
9921 }
9922 
9923 /*
9924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9925 %                                                                             %
9926 %                                                                             %
9927 %                                                                             %
9928 %   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                       %
9929 %                                                                             %
9930 %                                                                             %
9931 %                                                                             %
9932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9933 %
9934 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9935 %  point.
9936 %
9937 %  The format of the MagickSetImageGreenPrimary method is:
9938 %
9939 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9940 %        const double x,const double y,const double z)
9941 %
9942 %  A description of each parameter follows:
9943 %
9944 %    o wand: the magick wand.
9945 %
9946 %    o x: the green primary x-point.
9947 %
9948 %    o y: the green primary y-point.
9949 %
9950 %    o z: the green primary z-point.
9951 %
9952 */
MagickSetImageGreenPrimary(MagickWand * wand,const double x,const double y,const double z)9953 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9954   const double x,const double y,const double z)
9955 {
9956   assert(wand != (MagickWand *) NULL);
9957   assert(wand->signature == MagickWandSignature);
9958   if (wand->debug != MagickFalse)
9959     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9960   if (wand->images == (Image *) NULL)
9961     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9962   wand->images->chromaticity.green_primary.x=x;
9963   wand->images->chromaticity.green_primary.y=y;
9964   wand->images->chromaticity.green_primary.z=z;
9965   return(MagickTrue);
9966 }
9967 
9968 /*
9969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9970 %                                                                             %
9971 %                                                                             %
9972 %                                                                             %
9973 %   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                 %
9974 %                                                                             %
9975 %                                                                             %
9976 %                                                                             %
9977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9978 %
9979 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9980 %
9981 %  The format of the MagickSetImageInterlaceScheme method is:
9982 %
9983 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9984 %        const InterlaceType interlace)
9985 %
9986 %  A description of each parameter follows:
9987 %
9988 %    o wand: the magick wand.
9989 %
9990 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9991 %      PlaneInterlace, PartitionInterlace.
9992 %
9993 */
MagickSetImageInterlaceScheme(MagickWand * wand,const InterlaceType interlace)9994 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9995   const InterlaceType interlace)
9996 {
9997   assert(wand != (MagickWand *) NULL);
9998   assert(wand->signature == MagickWandSignature);
9999   if (wand->debug != MagickFalse)
10000     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10001   if (wand->images == (Image *) NULL)
10002     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10003   wand->images->interlace=interlace;
10004   return(MagickTrue);
10005 }
10006 
10007 /*
10008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10009 %                                                                             %
10010 %                                                                             %
10011 %                                                                             %
10012 %   M a g i c k S e t I m a g e I n t e r p o l a t e M e t h o d             %
10013 %                                                                             %
10014 %                                                                             %
10015 %                                                                             %
10016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10017 %
10018 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10019 %
10020 %  The format of the MagickSetImageInterpolateMethod method is:
10021 %
10022 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10023 %        const PixelInterpolateMethod method)
10024 %
10025 %  A description of each parameter follows:
10026 %
10027 %    o wand: the magick wand.
10028 %
10029 %    o method: the image interpole pixel methods: choose from Undefined,
10030 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10031 %
10032 */
10033 
MagickSetImagePixelInterpolateMethod(MagickWand * wand,const PixelInterpolateMethod method)10034 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
10035   MagickWand *wand,const PixelInterpolateMethod method)
10036 {
10037   return(MagickSetImageInterpolateMethod(wand,method));
10038 }
10039 
MagickSetImageInterpolateMethod(MagickWand * wand,const PixelInterpolateMethod method)10040 WandExport MagickBooleanType MagickSetImageInterpolateMethod(
10041   MagickWand *wand,const PixelInterpolateMethod method)
10042 {
10043   assert(wand != (MagickWand *) NULL);
10044   assert(wand->signature == MagickWandSignature);
10045   if (wand->debug != MagickFalse)
10046     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10047   if (wand->images == (Image *) NULL)
10048     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10049   wand->images->interpolate=method;
10050   return(MagickTrue);
10051 }
10052 
10053 /*
10054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10055 %                                                                             %
10056 %                                                                             %
10057 %                                                                             %
10058 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10059 %                                                                             %
10060 %                                                                             %
10061 %                                                                             %
10062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10063 %
10064 %  MagickSetImageIterations() sets the image iterations.
10065 %
10066 %  The format of the MagickSetImageIterations method is:
10067 %
10068 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10069 %        const size_t iterations)
10070 %
10071 %  A description of each parameter follows:
10072 %
10073 %    o wand: the magick wand.
10074 %
10075 %    o delay: the image delay in 1/100th of a second.
10076 %
10077 */
MagickSetImageIterations(MagickWand * wand,const size_t iterations)10078 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10079   const size_t iterations)
10080 {
10081   assert(wand != (MagickWand *) NULL);
10082   assert(wand->signature == MagickWandSignature);
10083   if (wand->debug != MagickFalse)
10084     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10085   if (wand->images == (Image *) NULL)
10086     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10087   wand->images->iterations=iterations;
10088   return(MagickTrue);
10089 }
10090 
10091 /*
10092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093 %                                                                             %
10094 %                                                                             %
10095 %                                                                             %
10096 %   M a g i c k S e t I m a g e M a t t e                                     %
10097 %                                                                             %
10098 %                                                                             %
10099 %                                                                             %
10100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10101 %
10102 %  MagickSetImageMatte() sets the image matte channel.
10103 %
10104 %  The format of the MagickSetImageMatte method is:
10105 %
10106 %      MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10107 %        const MagickBooleanType *matte)
10108 %
10109 %  A description of each parameter follows:
10110 %
10111 %    o wand: the magick wand.
10112 %
10113 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10114 %      MagickFalse.
10115 %
10116 */
MagickSetImageMatte(MagickWand * wand,const MagickBooleanType matte)10117 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10118   const MagickBooleanType matte)
10119 {
10120   assert(wand != (MagickWand *) NULL);
10121   assert(wand->signature == MagickWandSignature);
10122   if (wand->debug != MagickFalse)
10123     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10124   if (wand->images == (Image *) NULL)
10125     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10126   if (matte == MagickFalse)
10127     wand->images->alpha_trait=UndefinedPixelTrait;
10128   else
10129     {
10130       if (wand->images->alpha_trait == UndefinedPixelTrait)
10131         (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10132       wand->images->alpha_trait=BlendPixelTrait;
10133     }
10134   return(MagickTrue);
10135 }
10136 
10137 /*
10138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10139 %                                                                             %
10140 %                                                                             %
10141 %                                                                             %
10142 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10143 %                                                                             %
10144 %                                                                             %
10145 %                                                                             %
10146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10147 %
10148 %  MagickSetImageMatteColor() sets the image alpha color.
10149 %
10150 %  The format of the MagickSetImageMatteColor method is:
10151 %
10152 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10153 %        const PixelWand *matte)
10154 %
10155 %  A description of each parameter follows:
10156 %
10157 %    o wand: the magick wand.
10158 %
10159 %    o matte: the alpha pixel wand.
10160 %
10161 */
MagickSetImageMatteColor(MagickWand * wand,const PixelWand * alpha)10162 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10163   const PixelWand *alpha)
10164 {
10165   assert(wand != (MagickWand *)NULL);
10166   assert(wand->signature == MagickWandSignature);
10167   if (wand->debug != MagickFalse)
10168     (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
10169   if (wand->images == (Image *)NULL)
10170     ThrowWandException(WandError, "ContainsNoImages", wand->name);
10171   PixelGetQuantumPacket(alpha,&wand->images->matte_color);
10172   return(MagickTrue);
10173 }
10174 
10175 /*
10176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10177 %                                                                             %
10178 %                                                                             %
10179 %                                                                             %
10180 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10181 %                                                                             %
10182 %                                                                             %
10183 %                                                                             %
10184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10185 %
10186 %  MagickSetImageAlpha() sets the image to the specified alpha level.
10187 %
10188 %  The format of the MagickSetImageAlpha method is:
10189 %
10190 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10191 %        const double alpha)
10192 %
10193 %  A description of each parameter follows:
10194 %
10195 %    o wand: the magick wand.
10196 %
10197 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10198 %      transparent.
10199 %
10200 */
MagickSetImageAlpha(MagickWand * wand,const double alpha)10201 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10202   const double alpha)
10203 {
10204   MagickBooleanType
10205     status;
10206 
10207   assert(wand != (MagickWand *) NULL);
10208   assert(wand->signature == MagickWandSignature);
10209   if (wand->debug != MagickFalse)
10210     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10211   if (wand->images == (Image *) NULL)
10212     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10213   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10214     wand->exception);
10215   return(status);
10216 }
10217 
10218 /*
10219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10220 %                                                                             %
10221 %                                                                             %
10222 %                                                                             %
10223 %   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                         %
10224 %                                                                             %
10225 %                                                                             %
10226 %                                                                             %
10227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10228 %
10229 %  MagickSetImageOrientation() sets the image orientation.
10230 %
10231 %  The format of the MagickSetImageOrientation method is:
10232 %
10233 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10234 %        const OrientationType orientation)
10235 %
10236 %  A description of each parameter follows:
10237 %
10238 %    o wand: the magick wand.
10239 %
10240 %    o orientation: the image orientation type.
10241 %
10242 */
MagickSetImageOrientation(MagickWand * wand,const OrientationType orientation)10243 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10244   const OrientationType orientation)
10245 {
10246   assert(wand != (MagickWand *) NULL);
10247   assert(wand->signature == MagickWandSignature);
10248   if (wand->debug != MagickFalse)
10249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10250   if (wand->images == (Image *) NULL)
10251     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10252   wand->images->orientation=orientation;
10253   return(MagickTrue);
10254 }
10255 
10256 /*
10257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10258 %                                                                             %
10259 %                                                                             %
10260 %                                                                             %
10261 %   M a g i c k S e t I m a g e P a g e                                       %
10262 %                                                                             %
10263 %                                                                             %
10264 %                                                                             %
10265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10266 %
10267 %  MagickSetImagePage() sets the page geometry of the image.
10268 %
10269 %  The format of the MagickSetImagePage method is:
10270 %
10271 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
10272 %
10273 %  A description of each parameter follows:
10274 %
10275 %    o wand: the magick wand.
10276 %
10277 %    o width: the page width.
10278 %
10279 %    o height: the page height.
10280 %
10281 %    o x: the page x-offset.
10282 %
10283 %    o y: the page y-offset.
10284 %
10285 */
MagickSetImagePage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)10286 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10287   const size_t width,const size_t height,const ssize_t x,
10288   const ssize_t y)
10289 {
10290   assert(wand != (MagickWand *) NULL);
10291   assert(wand->signature == MagickWandSignature);
10292   if (wand->debug != MagickFalse)
10293     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10294   if (wand->images == (Image *) NULL)
10295     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10296   wand->images->page.width=width;
10297   wand->images->page.height=height;
10298   wand->images->page.x=x;
10299   wand->images->page.y=y;
10300   return(MagickTrue);
10301 }
10302 
10303 /*
10304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10305 %                                                                             %
10306 %                                                                             %
10307 %                                                                             %
10308 %   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                 %
10309 %                                                                             %
10310 %                                                                             %
10311 %                                                                             %
10312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10313 %
10314 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10315 %  specified method and returns the previous progress monitor if any.  The
10316 %  progress monitor method looks like this:
10317 %
10318 %    MagickBooleanType MagickProgressMonitor(const char *text,
10319 %      const MagickOffsetType offset,const MagickSizeType span,
10320 %      void *client_data)
10321 %
10322 %  If the progress monitor returns MagickFalse, the current operation is
10323 %  interrupted.
10324 %
10325 %  The format of the MagickSetImageProgressMonitor method is:
10326 %
10327 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10328 %        const MagickProgressMonitor progress_monitor,void *client_data)
10329 %
10330 %  A description of each parameter follows:
10331 %
10332 %    o wand: the magick wand.
10333 %
10334 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10335 %      of an image operation.
10336 %
10337 %    o client_data: Specifies a pointer to any client data.
10338 %
10339 */
MagickSetImageProgressMonitor(MagickWand * wand,const MagickProgressMonitor progress_monitor,void * client_data)10340 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10341   const MagickProgressMonitor progress_monitor,void *client_data)
10342 {
10343   MagickProgressMonitor
10344     previous_monitor;
10345 
10346   assert(wand != (MagickWand *) NULL);
10347   assert(wand->signature == MagickWandSignature);
10348   if (wand->debug != MagickFalse)
10349     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10350   if (wand->images == (Image *) NULL)
10351     {
10352       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10353         "ContainsNoImages","`%s'",wand->name);
10354       return((MagickProgressMonitor) NULL);
10355     }
10356   previous_monitor=SetImageProgressMonitor(wand->images,
10357     progress_monitor,client_data);
10358   return(previous_monitor);
10359 }
10360 
10361 /*
10362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10363 %                                                                             %
10364 %                                                                             %
10365 %                                                                             %
10366 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10367 %                                                                             %
10368 %                                                                             %
10369 %                                                                             %
10370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10371 %
10372 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10373 %
10374 %  The format of the MagickSetImageRedPrimary method is:
10375 %
10376 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10377 %        const double x,const double y,const double z)
10378 %
10379 %  A description of each parameter follows:
10380 %
10381 %    o wand: the magick wand.
10382 %
10383 %    o x: the red primary x-point.
10384 %
10385 %    o y: the red primary y-point.
10386 %
10387 %    o z: the red primary z-point.
10388 %
10389 */
MagickSetImageRedPrimary(MagickWand * wand,const double x,const double y,const double z)10390 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10391   const double x,const double y,const double z)
10392 {
10393   assert(wand != (MagickWand *) NULL);
10394   assert(wand->signature == MagickWandSignature);
10395   if (wand->debug != MagickFalse)
10396     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10397   if (wand->images == (Image *) NULL)
10398     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10399   wand->images->chromaticity.red_primary.x=x;
10400   wand->images->chromaticity.red_primary.y=y;
10401   wand->images->chromaticity.red_primary.z=z;
10402   return(MagickTrue);
10403 }
10404 
10405 /*
10406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10407 %                                                                             %
10408 %                                                                             %
10409 %                                                                             %
10410 %   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                 %
10411 %                                                                             %
10412 %                                                                             %
10413 %                                                                             %
10414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10415 %
10416 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10417 %
10418 %  The format of the MagickSetImageRenderingIntent method is:
10419 %
10420 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10421 %        const RenderingIntent rendering_intent)
10422 %
10423 %  A description of each parameter follows:
10424 %
10425 %    o wand: the magick wand.
10426 %
10427 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10428 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10429 %
10430 */
MagickSetImageRenderingIntent(MagickWand * wand,const RenderingIntent rendering_intent)10431 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10432   const RenderingIntent rendering_intent)
10433 {
10434   assert(wand != (MagickWand *) NULL);
10435   assert(wand->signature == MagickWandSignature);
10436   if (wand->debug != MagickFalse)
10437     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10438   if (wand->images == (Image *) NULL)
10439     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10440   wand->images->rendering_intent=rendering_intent;
10441   return(MagickTrue);
10442 }
10443 
10444 /*
10445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10446 %                                                                             %
10447 %                                                                             %
10448 %                                                                             %
10449 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10450 %                                                                             %
10451 %                                                                             %
10452 %                                                                             %
10453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10454 %
10455 %  MagickSetImageResolution() sets the image resolution.
10456 %
10457 %  The format of the MagickSetImageResolution method is:
10458 %
10459 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10460 %        const double x_resolution,const double y_resolution)
10461 %
10462 %  A description of each parameter follows:
10463 %
10464 %    o wand: the magick wand.
10465 %
10466 %    o x_resolution: the image x resolution.
10467 %
10468 %    o y_resolution: the image y resolution.
10469 %
10470 */
MagickSetImageResolution(MagickWand * wand,const double x_resolution,const double y_resolution)10471 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10472   const double x_resolution,const double y_resolution)
10473 {
10474   assert(wand != (MagickWand *) NULL);
10475   assert(wand->signature == MagickWandSignature);
10476   if (wand->debug != MagickFalse)
10477     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10478   if (wand->images == (Image *) NULL)
10479     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10480   wand->images->resolution.x=x_resolution;
10481   wand->images->resolution.y=y_resolution;
10482   return(MagickTrue);
10483 }
10484 
10485 /*
10486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10487 %                                                                             %
10488 %                                                                             %
10489 %                                                                             %
10490 %   M a g i c k S e t I m a g e S c e n e                                     %
10491 %                                                                             %
10492 %                                                                             %
10493 %                                                                             %
10494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10495 %
10496 %  MagickSetImageScene() sets the image scene.
10497 %
10498 %  The format of the MagickSetImageScene method is:
10499 %
10500 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10501 %        const size_t scene)
10502 %
10503 %  A description of each parameter follows:
10504 %
10505 %    o wand: the magick wand.
10506 %
10507 %    o delay: the image scene number.
10508 %
10509 */
MagickSetImageScene(MagickWand * wand,const size_t scene)10510 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10511   const size_t scene)
10512 {
10513   assert(wand != (MagickWand *) NULL);
10514   assert(wand->signature == MagickWandSignature);
10515   if (wand->debug != MagickFalse)
10516     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10517   if (wand->images == (Image *) NULL)
10518     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10519   wand->images->scene=scene;
10520   return(MagickTrue);
10521 }
10522 
10523 /*
10524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10525 %                                                                             %
10526 %                                                                             %
10527 %                                                                             %
10528 %   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                   %
10529 %                                                                             %
10530 %                                                                             %
10531 %                                                                             %
10532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10533 %
10534 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10535 %
10536 %  The format of the MagickSetImageTicksPerSecond method is:
10537 %
10538 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10539 %        const ssize_t ticks_per-second)
10540 %
10541 %  A description of each parameter follows:
10542 %
10543 %    o wand: the magick wand.
10544 %
10545 %    o ticks_per_second: the units to use for the image delay.
10546 %
10547 */
MagickSetImageTicksPerSecond(MagickWand * wand,const ssize_t ticks_per_second)10548 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10549   const ssize_t ticks_per_second)
10550 {
10551   assert(wand != (MagickWand *) NULL);
10552   assert(wand->signature == MagickWandSignature);
10553   if (wand->debug != MagickFalse)
10554     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10555   if (wand->images == (Image *) NULL)
10556     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10557   wand->images->ticks_per_second=ticks_per_second;
10558   return(MagickTrue);
10559 }
10560 
10561 /*
10562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10563 %                                                                             %
10564 %                                                                             %
10565 %                                                                             %
10566 %   M a g i c k S e t I m a g e T y p e                                       %
10567 %                                                                             %
10568 %                                                                             %
10569 %                                                                             %
10570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10571 %
10572 %  MagickSetImageType() sets the image type.
10573 %
10574 %  The format of the MagickSetImageType method is:
10575 %
10576 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10577 %        const ImageType image_type)
10578 %
10579 %  A description of each parameter follows:
10580 %
10581 %    o wand: the magick wand.
10582 %
10583 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10584 %      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
10585 %      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
10586 %      or OptimizeType.
10587 %
10588 */
MagickSetImageType(MagickWand * wand,const ImageType image_type)10589 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10590   const ImageType image_type)
10591 {
10592   assert(wand != (MagickWand *) NULL);
10593   assert(wand->signature == MagickWandSignature);
10594   if (wand->debug != MagickFalse)
10595     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10596   if (wand->images == (Image *) NULL)
10597     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10598   return(SetImageType(wand->images,image_type,wand->exception));
10599 }
10600 
10601 /*
10602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10603 %                                                                             %
10604 %                                                                             %
10605 %                                                                             %
10606 %   M a g i c k S e t I m a g e U n i t s                                     %
10607 %                                                                             %
10608 %                                                                             %
10609 %                                                                             %
10610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10611 %
10612 %  MagickSetImageUnits() sets the image units of resolution.
10613 %
10614 %  The format of the MagickSetImageUnits method is:
10615 %
10616 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10617 %        const ResolutionType units)
10618 %
10619 %  A description of each parameter follows:
10620 %
10621 %    o wand: the magick wand.
10622 %
10623 %    o units: the image units of resolution : UndefinedResolution,
10624 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10625 %
10626 */
MagickSetImageUnits(MagickWand * wand,const ResolutionType units)10627 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10628   const ResolutionType units)
10629 {
10630   assert(wand != (MagickWand *) NULL);
10631   assert(wand->signature == MagickWandSignature);
10632   if (wand->debug != MagickFalse)
10633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10634   if (wand->images == (Image *) NULL)
10635     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10636   wand->images->units=units;
10637   return(MagickTrue);
10638 }
10639 
10640 /*
10641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10642 %                                                                             %
10643 %                                                                             %
10644 %                                                                             %
10645 %   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           %
10646 %                                                                             %
10647 %                                                                             %
10648 %                                                                             %
10649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10650 %
10651 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10652 %
10653 %  The format of the MagickSetImageVirtualPixelMethod method is:
10654 %
10655 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10656 %        const VirtualPixelMethod method)
10657 %
10658 %  A description of each parameter follows:
10659 %
10660 %    o wand: the magick wand.
10661 %
10662 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10663 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10664 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10665 %
10666 */
MagickSetImageVirtualPixelMethod(MagickWand * wand,const VirtualPixelMethod method)10667 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10668   const VirtualPixelMethod method)
10669 {
10670   assert(wand != (MagickWand *) NULL);
10671   assert(wand->signature == MagickWandSignature);
10672   if (wand->debug != MagickFalse)
10673     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10674   if (wand->images == (Image *) NULL)
10675     return(UndefinedVirtualPixelMethod);
10676   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10677 }
10678 
10679 /*
10680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10681 %                                                                             %
10682 %                                                                             %
10683 %                                                                             %
10684 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10685 %                                                                             %
10686 %                                                                             %
10687 %                                                                             %
10688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10689 %
10690 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10691 %
10692 %  The format of the MagickSetImageWhitePoint method is:
10693 %
10694 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10695 %        const double x,const double y,const double z)
10696 %
10697 %  A description of each parameter follows:
10698 %
10699 %    o wand: the magick wand.
10700 %
10701 %    o x: the white x-point.
10702 %
10703 %    o y: the white y-point.
10704 %
10705 %    o z: the white z-point.
10706 %
10707 */
MagickSetImageWhitePoint(MagickWand * wand,const double x,const double y,const double z)10708 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10709   const double x,const double y,const double z)
10710 {
10711   assert(wand != (MagickWand *) NULL);
10712   assert(wand->signature == MagickWandSignature);
10713   if (wand->debug != MagickFalse)
10714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10715   if (wand->images == (Image *) NULL)
10716     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10717   wand->images->chromaticity.white_point.x=x;
10718   wand->images->chromaticity.white_point.y=y;
10719   wand->images->chromaticity.white_point.z=z;
10720   return(MagickTrue);
10721 }
10722 
10723 /*
10724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10725 %                                                                             %
10726 %                                                                             %
10727 %                                                                             %
10728 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10729 %                                                                             %
10730 %                                                                             %
10731 %                                                                             %
10732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10733 %
10734 %  MagickShadeImage() shines a distant light on an image to create a
10735 %  three-dimensional effect. You control the positioning of the light with
10736 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10737 %  and elevation is measured in pixels above the Z axis.
10738 %
10739 %  The format of the MagickShadeImage method is:
10740 %
10741 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10742 %        const MagickBooleanType gray,const double azimuth,
10743 %        const double elevation)
10744 %
10745 %  A description of each parameter follows:
10746 %
10747 %    o wand: the magick wand.
10748 %
10749 %    o gray: A value other than zero shades the intensity of each pixel.
10750 %
10751 %    o azimuth, elevation:  Define the light source direction.
10752 %
10753 */
MagickShadeImage(MagickWand * wand,const MagickBooleanType gray,const double asimuth,const double elevation)10754 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10755   const MagickBooleanType gray,const double asimuth,const double elevation)
10756 {
10757   Image
10758     *shade_image;
10759 
10760   assert(wand != (MagickWand *) NULL);
10761   assert(wand->signature == MagickWandSignature);
10762   if (wand->debug != MagickFalse)
10763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10764   if (wand->images == (Image *) NULL)
10765     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10766   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10767   if (shade_image == (Image *) NULL)
10768     return(MagickFalse);
10769   ReplaceImageInList(&wand->images,shade_image);
10770   return(MagickTrue);
10771 }
10772 
10773 /*
10774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10775 %                                                                             %
10776 %                                                                             %
10777 %                                                                             %
10778 %   M a g i c k S h a d o w I m a g e                                         %
10779 %                                                                             %
10780 %                                                                             %
10781 %                                                                             %
10782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10783 %
10784 %  MagickShadowImage() simulates an image shadow.
10785 %
10786 %  The format of the MagickShadowImage method is:
10787 %
10788 %      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10789 %        const double sigma,const ssize_t x,const ssize_t y)
10790 %
10791 %  A description of each parameter follows:
10792 %
10793 %    o wand: the magick wand.
10794 %
10795 %    o alpha: percentage transparency.
10796 %
10797 %    o sigma: the standard deviation of the Gaussian, in pixels.
10798 %
10799 %    o x: the shadow x-offset.
10800 %
10801 %    o y: the shadow y-offset.
10802 %
10803 */
MagickShadowImage(MagickWand * wand,const double alpha,const double sigma,const ssize_t x,const ssize_t y)10804 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10805   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10806 {
10807   Image
10808     *shadow_image;
10809 
10810   assert(wand != (MagickWand *) NULL);
10811   assert(wand->signature == MagickWandSignature);
10812   if (wand->debug != MagickFalse)
10813     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10814   if (wand->images == (Image *) NULL)
10815     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10816   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10817   if (shadow_image == (Image *) NULL)
10818     return(MagickFalse);
10819   ReplaceImageInList(&wand->images,shadow_image);
10820   return(MagickTrue);
10821 }
10822 
10823 /*
10824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10825 %                                                                             %
10826 %                                                                             %
10827 %                                                                             %
10828 %   M a g i c k S h a r p e n I m a g e                                       %
10829 %                                                                             %
10830 %                                                                             %
10831 %                                                                             %
10832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10833 %
10834 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10835 %  Gaussian operator of the given radius and standard deviation (sigma).
10836 %  For reasonable results, the radius should be larger than sigma.  Use a
10837 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10838 %
10839 %  The format of the MagickSharpenImage method is:
10840 %
10841 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10842 %        const double radius,const double sigma)
10843 %
10844 %  A description of each parameter follows:
10845 %
10846 %    o wand: the magick wand.
10847 %
10848 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10849 %      pixel.
10850 %
10851 %    o sigma: the standard deviation of the Gaussian, in pixels.
10852 %
10853 */
MagickSharpenImage(MagickWand * wand,const double radius,const double sigma)10854 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10855   const double radius,const double sigma)
10856 {
10857   Image
10858     *sharp_image;
10859 
10860   assert(wand != (MagickWand *) NULL);
10861   assert(wand->signature == MagickWandSignature);
10862   if (wand->debug != MagickFalse)
10863     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10864   if (wand->images == (Image *) NULL)
10865     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10866   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10867   if (sharp_image == (Image *) NULL)
10868     return(MagickFalse);
10869   ReplaceImageInList(&wand->images,sharp_image);
10870   return(MagickTrue);
10871 }
10872 
10873 /*
10874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10875 %                                                                             %
10876 %                                                                             %
10877 %                                                                             %
10878 %   M a g i c k S h a v e I m a g e                                           %
10879 %                                                                             %
10880 %                                                                             %
10881 %                                                                             %
10882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10883 %
10884 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10885 %  memory necessary for the new Image structure and returns a pointer to the
10886 %  new image.
10887 %
10888 %  The format of the MagickShaveImage method is:
10889 %
10890 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10891 %        const size_t columns,const size_t rows)
10892 %
10893 %  A description of each parameter follows:
10894 %
10895 %    o wand: the magick wand.
10896 %
10897 %    o columns: the number of columns in the scaled image.
10898 %
10899 %    o rows: the number of rows in the scaled image.
10900 %
10901 %
10902 */
MagickShaveImage(MagickWand * wand,const size_t columns,const size_t rows)10903 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10904   const size_t columns,const size_t rows)
10905 {
10906   Image
10907     *shave_image;
10908 
10909   RectangleInfo
10910     shave_info;
10911 
10912   assert(wand != (MagickWand *) NULL);
10913   assert(wand->signature == MagickWandSignature);
10914   if (wand->debug != MagickFalse)
10915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10916   if (wand->images == (Image *) NULL)
10917     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10918   shave_info.width=columns;
10919   shave_info.height=rows;
10920   shave_info.x=0;
10921   shave_info.y=0;
10922   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10923   if (shave_image == (Image *) NULL)
10924     return(MagickFalse);
10925   ReplaceImageInList(&wand->images,shave_image);
10926   return(MagickTrue);
10927 }
10928 
10929 /*
10930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10931 %                                                                             %
10932 %                                                                             %
10933 %                                                                             %
10934 %   M a g i c k S h e a r I m a g e                                           %
10935 %                                                                             %
10936 %                                                                             %
10937 %                                                                             %
10938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10939 %
10940 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10941 %  creating a parallelogram.  An X direction shear slides an edge along the X
10942 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10943 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10944 %  is measured relative to the Y axis, and similarly, for Y direction shears
10945 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10946 %  shearing the image are filled with the background color.
10947 %
10948 %  The format of the MagickShearImage method is:
10949 %
10950 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10951 %        const PixelWand *background,const double x_shear,const double y_shear)
10952 %
10953 %  A description of each parameter follows:
10954 %
10955 %    o wand: the magick wand.
10956 %
10957 %    o background: the background pixel wand.
10958 %
10959 %    o x_shear: the number of degrees to shear the image.
10960 %
10961 %    o y_shear: the number of degrees to shear the image.
10962 %
10963 */
MagickShearImage(MagickWand * wand,const PixelWand * background,const double x_shear,const double y_shear)10964 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10965   const PixelWand *background,const double x_shear,const double y_shear)
10966 {
10967   Image
10968     *shear_image;
10969 
10970   assert(wand != (MagickWand *) NULL);
10971   assert(wand->signature == MagickWandSignature);
10972   if (wand->debug != MagickFalse)
10973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10974   if (wand->images == (Image *) NULL)
10975     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10976   PixelGetQuantumPacket(background,&wand->images->background_color);
10977   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10978   if (shear_image == (Image *) NULL)
10979     return(MagickFalse);
10980   ReplaceImageInList(&wand->images,shear_image);
10981   return(MagickTrue);
10982 }
10983 
10984 /*
10985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10986 %                                                                             %
10987 %                                                                             %
10988 %                                                                             %
10989 %   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                   %
10990 %                                                                             %
10991 %                                                                             %
10992 %                                                                             %
10993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10994 %
10995 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10996 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10997 %  image using a sigmoidal transfer function without saturating highlights or
10998 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10999 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11000 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11001 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11002 %  is reduced.
11003 %
11004 %  The format of the MagickSigmoidalContrastImage method is:
11005 %
11006 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11007 %        const MagickBooleanType sharpen,const double alpha,const double beta)
11008 %
11009 %  A description of each parameter follows:
11010 %
11011 %    o wand: the magick wand.
11012 %
11013 %    o sharpen: Increase or decrease image contrast.
11014 %
11015 %    o alpha: strength of the contrast, the larger the number the more
11016 %      'threshold-like' it becomes.
11017 %
11018 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
11019 %
11020 */
MagickSigmoidalContrastImage(MagickWand * wand,const MagickBooleanType sharpen,const double alpha,const double beta)11021 WandExport MagickBooleanType MagickSigmoidalContrastImage(
11022   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
11023   const double beta)
11024 {
11025   MagickBooleanType
11026     status;
11027 
11028   assert(wand != (MagickWand *) NULL);
11029   assert(wand->signature == MagickWandSignature);
11030   if (wand->debug != MagickFalse)
11031     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11032   if (wand->images == (Image *) NULL)
11033     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11034   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
11035     wand->exception);
11036   return(status);
11037 }
11038 
11039 /*
11040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11041 %                                                                             %
11042 %                                                                             %
11043 %                                                                             %
11044 %   M a g i c k S i m i l a r i t y I m a g e                                 %
11045 %                                                                             %
11046 %                                                                             %
11047 %                                                                             %
11048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11049 %
11050 %  MagickSimilarityImage() compares the reference image of the image and
11051 %  returns the best match offset.  In addition, it returns a similarity image
11052 %  such that an exact match location is completely white and if none of the
11053 %  pixels match, black, otherwise some gray level in-between.
11054 %
11055 %  The format of the MagickSimilarityImage method is:
11056 %
11057 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
11058 %        const MagickWand *reference,const MetricType metric,
11059 %        const double similarity_threshold,RectangeInfo *offset,
11060 %        double *similarity)
11061 %
11062 %  A description of each parameter follows:
11063 %
11064 %    o wand: the magick wand.
11065 %
11066 %    o reference: the reference wand.
11067 %
11068 %    o metric: the metric.
11069 %
11070 %    o similarity_threshold: minimum distortion for (sub)image match.
11071 %
11072 %    o offset: the best match offset of the reference image within the image.
11073 %
11074 %    o similarity: the computed similarity between the images.
11075 %
11076 */
MagickSimilarityImage(MagickWand * wand,const MagickWand * reference,const MetricType metric,const double similarity_threshold,RectangleInfo * offset,double * similarity)11077 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11078   const MagickWand *reference,const MetricType metric,
11079   const double similarity_threshold,RectangleInfo *offset,double *similarity)
11080 {
11081   Image
11082     *similarity_image;
11083 
11084   assert(wand != (MagickWand *) NULL);
11085   assert(wand->signature == MagickWandSignature);
11086   if (wand->debug != MagickFalse)
11087     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11088   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11089     {
11090       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11091         "ContainsNoImages","`%s'",wand->name);
11092       return((MagickWand *) NULL);
11093     }
11094   similarity_image=SimilarityImage(wand->images,reference->images,metric,
11095     similarity_threshold,offset,similarity,wand->exception);
11096   if (similarity_image == (Image *) NULL)
11097     return((MagickWand *) NULL);
11098   return(CloneMagickWandFromImages(wand,similarity_image));
11099 }
11100 
11101 /*
11102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11103 %                                                                             %
11104 %                                                                             %
11105 %                                                                             %
11106 %   M a g i c k S k e t c h I m a g e                                         %
11107 %                                                                             %
11108 %                                                                             %
11109 %                                                                             %
11110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11111 %
11112 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11113 %  a Gaussian operator of the given radius and standard deviation (sigma).
11114 %  For reasonable results, radius should be larger than sigma.  Use a
11115 %  radius of 0 and SketchImage() selects a suitable radius for you.
11116 %  Angle gives the angle of the blurring motion.
11117 %
11118 %  The format of the MagickSketchImage method is:
11119 %
11120 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11121 %        const double radius,const double sigma,const double angle)
11122 %
11123 %  A description of each parameter follows:
11124 %
11125 %    o wand: the magick wand.
11126 %
11127 %    o radius: the radius of the Gaussian, in pixels, not counting
11128 %      the center pixel.
11129 %
11130 %    o sigma: the standard deviation of the Gaussian, in pixels.
11131 %
11132 %    o angle: apply the effect along this angle.
11133 %
11134 */
MagickSketchImage(MagickWand * wand,const double radius,const double sigma,const double angle)11135 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11136   const double radius,const double sigma,const double angle)
11137 {
11138   Image
11139     *sketch_image;
11140 
11141   assert(wand != (MagickWand *) NULL);
11142   assert(wand->signature == MagickWandSignature);
11143   if (wand->debug != MagickFalse)
11144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11145   if (wand->images == (Image *) NULL)
11146     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11147   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11148   if (sketch_image == (Image *) NULL)
11149     return(MagickFalse);
11150   ReplaceImageInList(&wand->images,sketch_image);
11151   return(MagickTrue);
11152 }
11153 
11154 /*
11155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11156 %                                                                             %
11157 %                                                                             %
11158 %                                                                             %
11159 %   M a g i c k S m u s h I m a g e s                                         %
11160 %                                                                             %
11161 %                                                                             %
11162 %                                                                             %
11163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11164 %
11165 %  MagickSmushImages() takes all images from the current image pointer to the
11166 %  end of the image list and smushs them to each other top-to-bottom if the
11167 %  stack parameter is true, otherwise left-to-right.
11168 %
11169 %  The format of the MagickSmushImages method is:
11170 %
11171 %      MagickWand *MagickSmushImages(MagickWand *wand,
11172 %        const MagickBooleanType stack,const ssize_t offset)
11173 %
11174 %  A description of each parameter follows:
11175 %
11176 %    o wand: the magick wand.
11177 %
11178 %    o stack: By default, images are stacked left-to-right. Set stack to
11179 %      MagickTrue to stack them top-to-bottom.
11180 %
11181 %    o offset: minimum distance in pixels between images.
11182 %
11183 */
MagickSmushImages(MagickWand * wand,const MagickBooleanType stack,const ssize_t offset)11184 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11185   const MagickBooleanType stack,const ssize_t offset)
11186 {
11187   Image
11188     *smush_image;
11189 
11190   assert(wand != (MagickWand *) NULL);
11191   assert(wand->signature == MagickWandSignature);
11192   if (wand->debug != MagickFalse)
11193     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11194   if (wand->images == (Image *) NULL)
11195     return((MagickWand *) NULL);
11196   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11197   if (smush_image == (Image *) NULL)
11198     return((MagickWand *) NULL);
11199   return(CloneMagickWandFromImages(wand,smush_image));
11200 }
11201 
11202 /*
11203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11204 %                                                                             %
11205 %                                                                             %
11206 %                                                                             %
11207 %     M a g i c k S o l a r i z e I m a g e                                   %
11208 %                                                                             %
11209 %                                                                             %
11210 %                                                                             %
11211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11212 %
11213 %  MagickSolarizeImage() applies a special effect to the image, similar to the
11214 %  effect achieved in a photo darkroom by selectively exposing areas of photo
11215 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11216 %  measure of the extent of the solarization.
11217 %
11218 %  The format of the MagickSolarizeImage method is:
11219 %
11220 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11221 %        const double threshold)
11222 %
11223 %  A description of each parameter follows:
11224 %
11225 %    o wand: the magick wand.
11226 %
11227 %    o threshold:  Define the extent of the solarization.
11228 %
11229 */
MagickSolarizeImage(MagickWand * wand,const double threshold)11230 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11231   const double threshold)
11232 {
11233   MagickBooleanType
11234     status;
11235 
11236   assert(wand != (MagickWand *) NULL);
11237   assert(wand->signature == MagickWandSignature);
11238   if (wand->debug != MagickFalse)
11239     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11240   if (wand->images == (Image *) NULL)
11241     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11242   status=SolarizeImage(wand->images,threshold,wand->exception);
11243   return(status);
11244 }
11245 
11246 /*
11247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11248 %                                                                             %
11249 %                                                                             %
11250 %                                                                             %
11251 %   M a g i c k S p a r s e C o l o r I m a g e                               %
11252 %                                                                             %
11253 %                                                                             %
11254 %                                                                             %
11255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11256 %
11257 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
11258 %  colors found at those coordinates, across the whole image, using various
11259 %  methods.
11260 %
11261 %  The format of the MagickSparseColorImage method is:
11262 %
11263 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11264 %        const SparseColorMethod method,const size_t number_arguments,
11265 %        const double *arguments)
11266 %
11267 %  A description of each parameter follows:
11268 %
11269 %    o image: the image to be sparseed.
11270 %
11271 %    o method: the method of image sparseion.
11272 %
11273 %        ArcSparseColorion will always ignore source image offset, and always
11274 %        'bestfit' the destination image with the top left corner offset
11275 %        relative to the polar mapping center.
11276 %
11277 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11278 %        style of image sparseion.
11279 %
11280 %        Affine, Perspective, and Bilinear, will do least squares fitting of
11281 %        the distrotion when more than the minimum number of control point
11282 %        pairs are provided.
11283 %
11284 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
11285 %        less than 4 control point pairs are provided. While Affine sparseions
11286 %        will let you use any number of control point pairs, that is Zero pairs
11287 %        is a No-Op (viewport only) distrotion, one pair is a translation and
11288 %        two pairs of control points will do a scale-rotate-translate, without
11289 %        any shearing.
11290 %
11291 %    o number_arguments: the number of arguments given for this sparseion
11292 %      method.
11293 %
11294 %    o arguments: the arguments for this sparseion method.
11295 %
11296 */
MagickSparseColorImage(MagickWand * wand,const SparseColorMethod method,const size_t number_arguments,const double * arguments)11297 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11298   const SparseColorMethod method,const size_t number_arguments,
11299   const double *arguments)
11300 {
11301   Image
11302     *sparse_image;
11303 
11304   assert(wand != (MagickWand *) NULL);
11305   assert(wand->signature == MagickWandSignature);
11306   if (wand->debug != MagickFalse)
11307     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11308   if (wand->images == (Image *) NULL)
11309     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11310   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11311     wand->exception);
11312   if (sparse_image == (Image *) NULL)
11313     return(MagickFalse);
11314   ReplaceImageInList(&wand->images,sparse_image);
11315   return(MagickTrue);
11316 }
11317 
11318 /*
11319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11320 %                                                                             %
11321 %                                                                             %
11322 %                                                                             %
11323 %   M a g i c k S p l i c e I m a g e                                         %
11324 %                                                                             %
11325 %                                                                             %
11326 %                                                                             %
11327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11328 %
11329 %  MagickSpliceImage() splices a solid color into the image.
11330 %
11331 %  The format of the MagickSpliceImage method is:
11332 %
11333 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11334 %        const size_t width,const size_t height,const ssize_t x,
11335 %        const ssize_t y)
11336 %
11337 %  A description of each parameter follows:
11338 %
11339 %    o wand: the magick wand.
11340 %
11341 %    o width: the region width.
11342 %
11343 %    o height: the region height.
11344 %
11345 %    o x: the region x offset.
11346 %
11347 %    o y: the region y offset.
11348 %
11349 */
MagickSpliceImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)11350 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11351   const size_t width,const size_t height,const ssize_t x,
11352   const ssize_t y)
11353 {
11354   Image
11355     *splice_image;
11356 
11357   RectangleInfo
11358     splice;
11359 
11360   assert(wand != (MagickWand *) NULL);
11361   assert(wand->signature == MagickWandSignature);
11362   if (wand->debug != MagickFalse)
11363     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11364   if (wand->images == (Image *) NULL)
11365     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11366   splice.width=width;
11367   splice.height=height;
11368   splice.x=x;
11369   splice.y=y;
11370   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11371   if (splice_image == (Image *) NULL)
11372     return(MagickFalse);
11373   ReplaceImageInList(&wand->images,splice_image);
11374   return(MagickTrue);
11375 }
11376 
11377 /*
11378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11379 %                                                                             %
11380 %                                                                             %
11381 %                                                                             %
11382 %   M a g i c k S p r e a d I m a g e                                         %
11383 %                                                                             %
11384 %                                                                             %
11385 %                                                                             %
11386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11387 %
11388 %  MagickSpreadImage() is a special effects method that randomly displaces each
11389 %  pixel in a block defined by the radius parameter.
11390 %
11391 %  The format of the MagickSpreadImage method is:
11392 %
11393 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,
11394 %        const PixelInterpolateMethod method,const double radius)
11395 %
11396 %  A description of each parameter follows:
11397 %
11398 %    o wand: the magick wand.
11399 %
11400 %    o method:  intepolation method.
11401 %
11402 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11403 %
11404 */
MagickSpreadImage(MagickWand * wand,const PixelInterpolateMethod method,const double radius)11405 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11406   const PixelInterpolateMethod method,const double radius)
11407 {
11408   Image
11409     *spread_image;
11410 
11411   assert(wand != (MagickWand *) NULL);
11412   assert(wand->signature == MagickWandSignature);
11413   if (wand->debug != MagickFalse)
11414     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11415   if (wand->images == (Image *) NULL)
11416     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11417   spread_image=SpreadImage(wand->images,method,radius,wand->exception);
11418   if (spread_image == (Image *) NULL)
11419     return(MagickFalse);
11420   ReplaceImageInList(&wand->images,spread_image);
11421   return(MagickTrue);
11422 }
11423 
11424 /*
11425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11426 %                                                                             %
11427 %                                                                             %
11428 %                                                                             %
11429 %   M a g i c k S t a t i s t i c I m a g e                                   %
11430 %                                                                             %
11431 %                                                                             %
11432 %                                                                             %
11433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11434 %
11435 %  MagickStatisticImage() replace each pixel with corresponding statistic from
11436 %  the neighborhood of the specified width and height.
11437 %
11438 %  The format of the MagickStatisticImage method is:
11439 %
11440 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11441 %        const StatisticType type,const double width,const size_t height)
11442 %
11443 %  A description of each parameter follows:
11444 %
11445 %    o wand: the magick wand.
11446 %
11447 %    o type: the statistic type (e.g. median, mode, etc.).
11448 %
11449 %    o width: the width of the pixel neighborhood.
11450 %
11451 %    o height: the height of the pixel neighborhood.
11452 %
11453 */
MagickStatisticImage(MagickWand * wand,const StatisticType type,const size_t width,const size_t height)11454 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11455   const StatisticType type,const size_t width,const size_t height)
11456 {
11457   Image
11458     *statistic_image;
11459 
11460   assert(wand != (MagickWand *) NULL);
11461   assert(wand->signature == MagickWandSignature);
11462   if (wand->debug != MagickFalse)
11463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11464   if (wand->images == (Image *) NULL)
11465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11466   statistic_image=StatisticImage(wand->images,type,width,height,
11467     wand->exception);
11468   if (statistic_image == (Image *) NULL)
11469     return(MagickFalse);
11470   ReplaceImageInList(&wand->images,statistic_image);
11471   return(MagickTrue);
11472 }
11473 
11474 /*
11475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11476 %                                                                             %
11477 %                                                                             %
11478 %                                                                             %
11479 %   M a g i c k S t e g a n o I m a g e                                       %
11480 %                                                                             %
11481 %                                                                             %
11482 %                                                                             %
11483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11484 %
11485 %  MagickSteganoImage() hides a digital watermark within the image.
11486 %  Recover the hidden watermark later to prove that the authenticity of
11487 %  an image.  Offset defines the start position within the image to hide
11488 %  the watermark.
11489 %
11490 %  The format of the MagickSteganoImage method is:
11491 %
11492 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11493 %        const MagickWand *watermark_wand,const ssize_t offset)
11494 %
11495 %  A description of each parameter follows:
11496 %
11497 %    o wand: the magick wand.
11498 %
11499 %    o watermark_wand: the watermark wand.
11500 %
11501 %    o offset: Start hiding at this offset into the image.
11502 %
11503 */
MagickSteganoImage(MagickWand * wand,const MagickWand * watermark_wand,const ssize_t offset)11504 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11505   const MagickWand *watermark_wand,const ssize_t offset)
11506 {
11507   Image
11508     *stegano_image;
11509 
11510   assert(wand != (MagickWand *) NULL);
11511   assert(wand->signature == MagickWandSignature);
11512   if (wand->debug != MagickFalse)
11513     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11514   if ((wand->images == (Image *) NULL) ||
11515       (watermark_wand->images == (Image *) NULL))
11516     {
11517       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11518         "ContainsNoImages","`%s'",wand->name);
11519       return((MagickWand *) NULL);
11520     }
11521   wand->images->offset=offset;
11522   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11523     wand->exception);
11524   if (stegano_image == (Image *) NULL)
11525     return((MagickWand *) NULL);
11526   return(CloneMagickWandFromImages(wand,stegano_image));
11527 }
11528 
11529 /*
11530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11531 %                                                                             %
11532 %                                                                             %
11533 %                                                                             %
11534 %   M a g i c k S t e r e o I m a g e                                         %
11535 %                                                                             %
11536 %                                                                             %
11537 %                                                                             %
11538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11539 %
11540 %  MagickStereoImage() composites two images and produces a single image that
11541 %  is the composite of a left and right image of a stereo pair
11542 %
11543 %  The format of the MagickStereoImage method is:
11544 %
11545 %      MagickWand *MagickStereoImage(MagickWand *wand,
11546 %        const MagickWand *offset_wand)
11547 %
11548 %  A description of each parameter follows:
11549 %
11550 %    o wand: the magick wand.
11551 %
11552 %    o offset_wand: Another image wand.
11553 %
11554 */
MagickStereoImage(MagickWand * wand,const MagickWand * offset_wand)11555 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11556   const MagickWand *offset_wand)
11557 {
11558   Image
11559     *stereo_image;
11560 
11561   assert(wand != (MagickWand *) NULL);
11562   assert(wand->signature == MagickWandSignature);
11563   if (wand->debug != MagickFalse)
11564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11565   if ((wand->images == (Image *) NULL) ||
11566       (offset_wand->images == (Image *) NULL))
11567     {
11568       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11569         "ContainsNoImages","`%s'",wand->name);
11570       return((MagickWand *) NULL);
11571     }
11572   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11573   if (stereo_image == (Image *) NULL)
11574     return((MagickWand *) NULL);
11575   return(CloneMagickWandFromImages(wand,stereo_image));
11576 }
11577 
11578 /*
11579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11580 %                                                                             %
11581 %                                                                             %
11582 %                                                                             %
11583 %   M a g i c k S t r i p I m a g e                                           %
11584 %                                                                             %
11585 %                                                                             %
11586 %                                                                             %
11587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11588 %
11589 %  MagickStripImage() strips an image of all profiles and comments.
11590 %
11591 %  The format of the MagickStripImage method is:
11592 %
11593 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11594 %
11595 %  A description of each parameter follows:
11596 %
11597 %    o wand: the magick wand.
11598 %
11599 */
MagickStripImage(MagickWand * wand)11600 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11601 {
11602   assert(wand != (MagickWand *) NULL);
11603   assert(wand->signature == MagickWandSignature);
11604   if (wand->debug != MagickFalse)
11605     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11606   if (wand->images == (Image *) NULL)
11607     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11608   return(StripImage(wand->images,wand->exception));
11609 }
11610 
11611 /*
11612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11613 %                                                                             %
11614 %                                                                             %
11615 %                                                                             %
11616 %   M a g i c k S w i r l I m a g e                                           %
11617 %                                                                             %
11618 %                                                                             %
11619 %                                                                             %
11620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11621 %
11622 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11623 %  degrees indicates the sweep of the arc through which each pixel is moved.
11624 %  You get a more dramatic effect as the degrees move from 1 to 360.
11625 %
11626 %  The format of the MagickSwirlImage method is:
11627 %
11628 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11629 %        const PixelInterpolateMethod method)
11630 %
11631 %  A description of each parameter follows:
11632 %
11633 %    o wand: the magick wand.
11634 %
11635 %    o degrees: Define the tightness of the swirling effect.
11636 %
11637 %    o method: the pixel interpolation method.
11638 %
11639 */
MagickSwirlImage(MagickWand * wand,const double degrees,const PixelInterpolateMethod method)11640 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11641   const double degrees,const PixelInterpolateMethod method)
11642 {
11643   Image
11644     *swirl_image;
11645 
11646   assert(wand != (MagickWand *) NULL);
11647   assert(wand->signature == MagickWandSignature);
11648   if (wand->debug != MagickFalse)
11649     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11650   if (wand->images == (Image *) NULL)
11651     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11652   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11653   if (swirl_image == (Image *) NULL)
11654     return(MagickFalse);
11655   ReplaceImageInList(&wand->images,swirl_image);
11656   return(MagickTrue);
11657 }
11658 
11659 /*
11660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11661 %                                                                             %
11662 %                                                                             %
11663 %                                                                             %
11664 %   M a g i c k T e x t u r e I m a g e                                       %
11665 %                                                                             %
11666 %                                                                             %
11667 %                                                                             %
11668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11669 %
11670 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11671 %  image canvas.
11672 %
11673 %  The format of the MagickTextureImage method is:
11674 %
11675 %      MagickWand *MagickTextureImage(MagickWand *wand,
11676 %        const MagickWand *texture_wand)
11677 %
11678 %  A description of each parameter follows:
11679 %
11680 %    o wand: the magick wand.
11681 %
11682 %    o texture_wand: the texture wand
11683 %
11684 */
MagickTextureImage(MagickWand * wand,const MagickWand * texture_wand)11685 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11686   const MagickWand *texture_wand)
11687 {
11688   Image
11689     *texture_image;
11690 
11691   MagickBooleanType
11692     status;
11693 
11694   assert(wand != (MagickWand *) NULL);
11695   assert(wand->signature == MagickWandSignature);
11696   if (wand->debug != MagickFalse)
11697     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11698   if ((wand->images == (Image *) NULL) ||
11699       (texture_wand->images == (Image *) NULL))
11700     {
11701       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11702         "ContainsNoImages","`%s'",wand->name);
11703       return((MagickWand *) NULL);
11704     }
11705   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11706   if (texture_image == (Image *) NULL)
11707     return((MagickWand *) NULL);
11708   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11709   if (status == MagickFalse)
11710     {
11711       texture_image=DestroyImage(texture_image);
11712       return((MagickWand *) NULL);
11713     }
11714   return(CloneMagickWandFromImages(wand,texture_image));
11715 }
11716 
11717 /*
11718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11719 %                                                                             %
11720 %                                                                             %
11721 %                                                                             %
11722 %   M a g i c k T h r e s h o l d I m a g e                                   %
11723 %                                                                             %
11724 %                                                                             %
11725 %                                                                             %
11726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11727 %
11728 %  MagickThresholdImage() changes the value of individual pixels based on
11729 %  the intensity of each pixel compared to threshold.  The result is a
11730 %  high-contrast, two color image.
11731 %
11732 %  The format of the MagickThresholdImage method is:
11733 %
11734 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11735 %        const double threshold)
11736 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11737 %        const ChannelType channel,const double threshold)
11738 %
11739 %  A description of each parameter follows:
11740 %
11741 %    o wand: the magick wand.
11742 %
11743 %    o channel: the image channel(s).
11744 %
11745 %    o threshold: Define the threshold value.
11746 %
11747 */
MagickThresholdImage(MagickWand * wand,const double threshold)11748 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11749   const double threshold)
11750 {
11751   MagickBooleanType
11752     status;
11753 
11754   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11755   return(status);
11756 }
11757 
MagickThresholdImageChannel(MagickWand * wand,const ChannelType channel,const double threshold)11758 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11759   const ChannelType channel,const double threshold)
11760 {
11761   MagickBooleanType
11762     status;
11763 
11764   ChannelType
11765     channel_mask;
11766 
11767   assert(wand != (MagickWand *) NULL);
11768   assert(wand->signature == MagickWandSignature);
11769   if (wand->debug != MagickFalse)
11770     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11771   if (wand->images == (Image *) NULL)
11772     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11773   channel_mask=SetImageChannelMask(wand->images,channel);
11774   status=BilevelImage(wand->images,threshold,wand->exception);
11775   (void) SetImageChannelMask(wand->images,channel_mask);
11776   return(status);
11777 }
11778 
11779 /*
11780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11781 %                                                                             %
11782 %                                                                             %
11783 %                                                                             %
11784 %   M a g i c k T h u m b n a i l I m a g e                                   %
11785 %                                                                             %
11786 %                                                                             %
11787 %                                                                             %
11788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11789 %
11790 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11791 %  and removes any associated profiles.  The goal is to produce small low cost
11792 %  thumbnail images suited for display on the Web.
11793 %
11794 %  The format of the MagickThumbnailImage method is:
11795 %
11796 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11797 %        const size_t columns,const size_t rows)
11798 %
11799 %  A description of each parameter follows:
11800 %
11801 %    o wand: the magick wand.
11802 %
11803 %    o columns: the number of columns in the scaled image.
11804 %
11805 %    o rows: the number of rows in the scaled image.
11806 %
11807 */
MagickThumbnailImage(MagickWand * wand,const size_t columns,const size_t rows)11808 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11809   const size_t columns,const size_t rows)
11810 {
11811   Image
11812     *thumbnail_image;
11813 
11814   assert(wand != (MagickWand *) NULL);
11815   assert(wand->signature == MagickWandSignature);
11816   if (wand->debug != MagickFalse)
11817     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11818   if (wand->images == (Image *) NULL)
11819     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11820   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11821   if (thumbnail_image == (Image *) NULL)
11822     return(MagickFalse);
11823   ReplaceImageInList(&wand->images,thumbnail_image);
11824   return(MagickTrue);
11825 }
11826 
11827 /*
11828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11829 %                                                                             %
11830 %                                                                             %
11831 %                                                                             %
11832 %   M a g i c k T i n t I m a g e                                             %
11833 %                                                                             %
11834 %                                                                             %
11835 %                                                                             %
11836 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11837 %
11838 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11839 %  length of the vector is 0 for black and white and at its maximum for the
11840 %  midtones.  The vector weighting function is
11841 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11842 %
11843 %  The format of the MagickTintImage method is:
11844 %
11845 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11846 %        const PixelWand *tint,const PixelWand *blend)
11847 %
11848 %  A description of each parameter follows:
11849 %
11850 %    o wand: the magick wand.
11851 %
11852 %    o tint: the tint pixel wand.
11853 %
11854 %    o alpha: the alpha pixel wand.
11855 %
11856 */
MagickTintImage(MagickWand * wand,const PixelWand * tint,const PixelWand * blend)11857 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11858   const PixelWand *tint,const PixelWand *blend)
11859 {
11860   char
11861     percent_blend[MagickPathExtent];
11862 
11863   Image
11864     *tint_image;
11865 
11866   PixelInfo
11867     target;
11868 
11869   assert(wand != (MagickWand *) NULL);
11870   assert(wand->signature == MagickWandSignature);
11871   if (wand->debug != MagickFalse)
11872     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11873   if (wand->images == (Image *) NULL)
11874     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11875   if (wand->images->colorspace != CMYKColorspace)
11876     (void) FormatLocaleString(percent_blend,MagickPathExtent,
11877       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11878       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11879       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11880       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11881       PixelGetAlphaQuantum(blend)));
11882   else
11883     (void) FormatLocaleString(percent_blend,MagickPathExtent,
11884       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11885       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11886       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11887       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11888       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11889       PixelGetAlphaQuantum(blend)));
11890   target=PixelGetPixel(tint);
11891   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11892   if (tint_image == (Image *) NULL)
11893     return(MagickFalse);
11894   ReplaceImageInList(&wand->images,tint_image);
11895   return(MagickTrue);
11896 }
11897 
11898 /*
11899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11900 %                                                                             %
11901 %                                                                             %
11902 %                                                                             %
11903 %   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               %
11904 %                                                                             %
11905 %                                                                             %
11906 %                                                                             %
11907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11908 %
11909 %  MagickTransformImageColorspace() transform the image colorspace, setting
11910 %  the images colorspace while transforming the images data to that
11911 %  colorspace.
11912 %
11913 %  The format of the MagickTransformImageColorspace method is:
11914 %
11915 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11916 %        const ColorspaceType colorspace)
11917 %
11918 %  A description of each parameter follows:
11919 %
11920 %    o wand: the magick wand.
11921 %
11922 %    o colorspace: the image colorspace:   UndefinedColorspace,
11923 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
11924 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11925 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
11926 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11927 %      HSLColorspace, HWBColorspace.
11928 %
11929 */
MagickTransformImageColorspace(MagickWand * wand,const ColorspaceType colorspace)11930 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11931   const ColorspaceType colorspace)
11932 {
11933   assert(wand != (MagickWand *) NULL);
11934   assert(wand->signature == MagickWandSignature);
11935   if (wand->debug != MagickFalse)
11936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11937   if (wand->images == (Image *) NULL)
11938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11939   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11940 }
11941 
11942 /*
11943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11944 %                                                                             %
11945 %                                                                             %
11946 %                                                                             %
11947 %   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                     %
11948 %                                                                             %
11949 %                                                                             %
11950 %                                                                             %
11951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11952 %
11953 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11954 %  color defined by fill.
11955 %
11956 %  The format of the MagickTransparentPaintImage method is:
11957 %
11958 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11959 %        const PixelWand *target,const double alpha,const double fuzz,
11960 %        const MagickBooleanType invert)
11961 %
11962 %  A description of each parameter follows:
11963 %
11964 %    o wand: the magick wand.
11965 %
11966 %    o target: Change this target color to specified alpha value within
11967 %      the image.
11968 %
11969 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11970 %      transparent.
11971 %
11972 %    o fuzz: By default target must match a particular pixel color
11973 %      exactly.  However, in many cases two colors may differ by a small amount.
11974 %      The fuzz member of image defines how much tolerance is acceptable to
11975 %      consider two colors as the same.  For example, set fuzz to 10 and the
11976 %      color red at intensities of 100 and 102 respectively are now interpreted
11977 %      as the same color for the purposes of the floodfill.
11978 %
11979 %    o invert: paint any pixel that does not match the target color.
11980 %
11981 */
MagickTransparentPaintImage(MagickWand * wand,const PixelWand * target,const double alpha,const double fuzz,const MagickBooleanType invert)11982 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11983   const PixelWand *target,const double alpha,const double fuzz,
11984   const MagickBooleanType invert)
11985 {
11986   MagickBooleanType
11987     status;
11988 
11989   PixelInfo
11990     target_pixel;
11991 
11992   assert(wand != (MagickWand *) NULL);
11993   assert(wand->signature == MagickWandSignature);
11994   if (wand->debug != MagickFalse)
11995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11996   if (wand->images == (Image *) NULL)
11997     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11998   PixelGetMagickColor(target,&target_pixel);
11999   wand->images->fuzz=fuzz;
12000   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12001     QuantumRange*alpha),invert,wand->exception);
12002   return(status);
12003 }
12004 
12005 /*
12006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12007 %                                                                             %
12008 %                                                                             %
12009 %                                                                             %
12010 %   M a g i c k T r a n s p o s e I m a g e                                   %
12011 %                                                                             %
12012 %                                                                             %
12013 %                                                                             %
12014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12015 %
12016 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
12017 %  pixels around the central x-axis while rotating them 90-degrees.
12018 %
12019 %  The format of the MagickTransposeImage method is:
12020 %
12021 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12022 %
12023 %  A description of each parameter follows:
12024 %
12025 %    o wand: the magick wand.
12026 %
12027 */
MagickTransposeImage(MagickWand * wand)12028 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12029 {
12030   Image
12031     *transpose_image;
12032 
12033   assert(wand != (MagickWand *) NULL);
12034   assert(wand->signature == MagickWandSignature);
12035   if (wand->debug != MagickFalse)
12036     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12037   if (wand->images == (Image *) NULL)
12038     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12039   transpose_image=TransposeImage(wand->images,wand->exception);
12040   if (transpose_image == (Image *) NULL)
12041     return(MagickFalse);
12042   ReplaceImageInList(&wand->images,transpose_image);
12043   return(MagickTrue);
12044 }
12045 
12046 /*
12047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12048 %                                                                             %
12049 %                                                                             %
12050 %                                                                             %
12051 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12052 %                                                                             %
12053 %                                                                             %
12054 %                                                                             %
12055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12056 %
12057 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12058 %  pixels around the central y-axis while rotating them 270-degrees.
12059 %
12060 %  The format of the MagickTransverseImage method is:
12061 %
12062 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12063 %
12064 %  A description of each parameter follows:
12065 %
12066 %    o wand: the magick wand.
12067 %
12068 */
MagickTransverseImage(MagickWand * wand)12069 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12070 {
12071   Image
12072     *transverse_image;
12073 
12074   assert(wand != (MagickWand *) NULL);
12075   assert(wand->signature == MagickWandSignature);
12076   if (wand->debug != MagickFalse)
12077     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12078   if (wand->images == (Image *) NULL)
12079     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12080   transverse_image=TransverseImage(wand->images,wand->exception);
12081   if (transverse_image == (Image *) NULL)
12082     return(MagickFalse);
12083   ReplaceImageInList(&wand->images,transverse_image);
12084   return(MagickTrue);
12085 }
12086 
12087 /*
12088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12089 %                                                                             %
12090 %                                                                             %
12091 %                                                                             %
12092 %   M a g i c k T r i m I m a g e                                             %
12093 %                                                                             %
12094 %                                                                             %
12095 %                                                                             %
12096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12097 %
12098 %  MagickTrimImage() remove edges that are the background color from the image.
12099 %
12100 %  The format of the MagickTrimImage method is:
12101 %
12102 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12103 %
12104 %  A description of each parameter follows:
12105 %
12106 %    o wand: the magick wand.
12107 %
12108 %    o fuzz: By default target must match a particular pixel color
12109 %      exactly.  However, in many cases two colors may differ by a small amount.
12110 %      The fuzz member of image defines how much tolerance is acceptable to
12111 %      consider two colors as the same.  For example, set fuzz to 10 and the
12112 %      color red at intensities of 100 and 102 respectively are now interpreted
12113 %      as the same color for the purposes of the floodfill.
12114 %
12115 */
MagickTrimImage(MagickWand * wand,const double fuzz)12116 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12117 {
12118   Image
12119     *trim_image;
12120 
12121   assert(wand != (MagickWand *) NULL);
12122   assert(wand->signature == MagickWandSignature);
12123   if (wand->debug != MagickFalse)
12124     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12125   if (wand->images == (Image *) NULL)
12126     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12127   wand->images->fuzz=fuzz;
12128   trim_image=TrimImage(wand->images,wand->exception);
12129   if (trim_image == (Image *) NULL)
12130     return(MagickFalse);
12131   ReplaceImageInList(&wand->images,trim_image);
12132   return(MagickTrue);
12133 }
12134 
12135 /*
12136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12137 %                                                                             %
12138 %                                                                             %
12139 %                                                                             %
12140 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
12141 %                                                                             %
12142 %                                                                             %
12143 %                                                                             %
12144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12145 %
12146 %  MagickUniqueImageColors() discards all but one of any pixel color.
12147 %
12148 %  The format of the MagickUniqueImageColors method is:
12149 %
12150 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12151 %
12152 %  A description of each parameter follows:
12153 %
12154 %    o wand: the magick wand.
12155 %
12156 */
MagickUniqueImageColors(MagickWand * wand)12157 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12158 {
12159   Image
12160     *unique_image;
12161 
12162   assert(wand != (MagickWand *) NULL);
12163   assert(wand->signature == MagickWandSignature);
12164   if (wand->debug != MagickFalse)
12165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12166   if (wand->images == (Image *) NULL)
12167     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12168   unique_image=UniqueImageColors(wand->images,wand->exception);
12169   if (unique_image == (Image *) NULL)
12170     return(MagickFalse);
12171   ReplaceImageInList(&wand->images,unique_image);
12172   return(MagickTrue);
12173 }
12174 
12175 /*
12176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12177 %                                                                             %
12178 %                                                                             %
12179 %                                                                             %
12180 %   M a g i c k U n s h a r p M a s k I m a g e                               %
12181 %                                                                             %
12182 %                                                                             %
12183 %                                                                             %
12184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12185 %
12186 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12187 %  Gaussian operator of the given radius and standard deviation (sigma).
12188 %  For reasonable results, radius should be larger than sigma.  Use a radius
12189 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12190 %
12191 %  The format of the MagickUnsharpMaskImage method is:
12192 %
12193 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12194 %        const double radius,const double sigma,const double gain,
12195 %        const double threshold)
12196 %
12197 %  A description of each parameter follows:
12198 %
12199 %    o wand: the magick wand.
12200 %
12201 %    o radius: the radius of the Gaussian, in pixels, not counting the center
12202 %      pixel.
12203 %
12204 %    o sigma: the standard deviation of the Gaussian, in pixels.
12205 %
12206 %    o gain: the percentage of the difference between the original and the
12207 %      blur image that is added back into the original.
12208 %
12209 %    o threshold: the threshold in pixels needed to apply the diffence gain.
12210 %
12211 */
MagickUnsharpMaskImage(MagickWand * wand,const double radius,const double sigma,const double gain,const double threshold)12212 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12213   const double radius,const double sigma,const double gain,
12214   const double threshold)
12215 {
12216   Image
12217     *unsharp_image;
12218 
12219   assert(wand != (MagickWand *) NULL);
12220   assert(wand->signature == MagickWandSignature);
12221   if (wand->debug != MagickFalse)
12222     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12223   if (wand->images == (Image *) NULL)
12224     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12225   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
12226     wand->exception);
12227   if (unsharp_image == (Image *) NULL)
12228     return(MagickFalse);
12229   ReplaceImageInList(&wand->images,unsharp_image);
12230   return(MagickTrue);
12231 }
12232 
12233 /*
12234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12235 %                                                                             %
12236 %                                                                             %
12237 %                                                                             %
12238 %   M a g i c k V i g n e t t e I m a g e                                     %
12239 %                                                                             %
12240 %                                                                             %
12241 %                                                                             %
12242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12243 %
12244 %  MagickVignetteImage() softens the edges of the image in vignette style.
12245 %
12246 %  The format of the MagickVignetteImage method is:
12247 %
12248 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12249 %        const double radius,const double sigma,const ssize_t x,
12250 %        const ssize_t y)
12251 %
12252 %  A description of each parameter follows:
12253 %
12254 %    o wand: the magick wand.
12255 %
12256 %    o radius: the radius.
12257 %
12258 %    o sigma: the sigma.
12259 %
12260 %    o x, y:  Define the x and y ellipse offset.
12261 %
12262 */
MagickVignetteImage(MagickWand * wand,const double radius,const double sigma,const ssize_t x,const ssize_t y)12263 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12264   const double radius,const double sigma,const ssize_t x,const ssize_t y)
12265 {
12266   Image
12267     *vignette_image;
12268 
12269   assert(wand != (MagickWand *) NULL);
12270   assert(wand->signature == MagickWandSignature);
12271   if (wand->debug != MagickFalse)
12272     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12273   if (wand->images == (Image *) NULL)
12274     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12275   vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12276   if (vignette_image == (Image *) NULL)
12277     return(MagickFalse);
12278   ReplaceImageInList(&wand->images,vignette_image);
12279   return(MagickTrue);
12280 }
12281 
12282 /*
12283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12284 %                                                                             %
12285 %                                                                             %
12286 %                                                                             %
12287 %   M a g i c k W a v e I m a g e                                             %
12288 %                                                                             %
12289 %                                                                             %
12290 %                                                                             %
12291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12292 %
12293 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12294 %  the pixels vertically along a sine wave whose amplitude and wavelength
12295 %  is specified by the given parameters.
12296 %
12297 %  The format of the MagickWaveImage method is:
12298 %
12299 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
12300 %        const double amplitude,const double wave_length,
12301 %        const PixelInterpolateMethod method)
12302 %
12303 %  A description of each parameter follows:
12304 %
12305 %    o wand: the magick wand.
12306 %
12307 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12308 %      sine wave.
12309 %
12310 %    o method: the pixel interpolation method.
12311 %
12312 */
MagickWaveImage(MagickWand * wand,const double amplitude,const double wave_length,const PixelInterpolateMethod method)12313 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12314   const double amplitude,const double wave_length,
12315   const PixelInterpolateMethod method)
12316 {
12317   Image
12318     *wave_image;
12319 
12320   assert(wand != (MagickWand *) NULL);
12321   assert(wand->signature == MagickWandSignature);
12322   if (wand->debug != MagickFalse)
12323     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12324   if (wand->images == (Image *) NULL)
12325     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12326   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12327     wand->exception);
12328   if (wave_image == (Image *) NULL)
12329     return(MagickFalse);
12330   ReplaceImageInList(&wand->images,wave_image);
12331   return(MagickTrue);
12332 }
12333 
12334 /*
12335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12336 %                                                                             %
12337 %                                                                             %
12338 %                                                                             %
12339 %   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                         %
12340 %                                                                             %
12341 %                                                                             %
12342 %                                                                             %
12343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12344 %
12345 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12346 %  above the threshold into white while leaving all pixels below the threshold
12347 %  unchanged.
12348 %
12349 %  The format of the MagickWhiteThresholdImage method is:
12350 %
12351 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12352 %        const PixelWand *threshold)
12353 %
12354 %  A description of each parameter follows:
12355 %
12356 %    o wand: the magick wand.
12357 %
12358 %    o threshold: the pixel wand.
12359 %
12360 */
MagickWhiteThresholdImage(MagickWand * wand,const PixelWand * threshold)12361 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12362   const PixelWand *threshold)
12363 {
12364   char
12365     thresholds[MagickPathExtent];
12366 
12367   assert(wand != (MagickWand *) NULL);
12368   assert(wand->signature == MagickWandSignature);
12369   if (wand->debug != MagickFalse)
12370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12371   if (wand->images == (Image *) NULL)
12372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12373   (void) FormatLocaleString(thresholds,MagickPathExtent,
12374     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12375     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12376     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12377   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12378 }
12379 
12380 /*
12381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12382 %                                                                             %
12383 %                                                                             %
12384 %                                                                             %
12385 %   M a g i c k W r i t e I m a g e                                           %
12386 %                                                                             %
12387 %                                                                             %
12388 %                                                                             %
12389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12390 %
12391 %  MagickWriteImage() writes an image to the specified filename.  If the
12392 %  filename parameter is NULL, the image is written to the filename set
12393 %  by MagickReadImage() or MagickSetImageFilename().
12394 %
12395 %  The format of the MagickWriteImage method is:
12396 %
12397 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12398 %        const char *filename)
12399 %
12400 %  A description of each parameter follows:
12401 %
12402 %    o wand: the magick wand.
12403 %
12404 %    o filename: the image filename.
12405 %
12406 %
12407 */
MagickWriteImage(MagickWand * wand,const char * filename)12408 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12409   const char *filename)
12410 {
12411   Image
12412     *image;
12413 
12414   ImageInfo
12415     *write_info;
12416 
12417   MagickBooleanType
12418     status;
12419 
12420   assert(wand != (MagickWand *) NULL);
12421   assert(wand->signature == MagickWandSignature);
12422   if (wand->debug != MagickFalse)
12423     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12424   if (wand->images == (Image *) NULL)
12425     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12426   if (filename != (const char *) NULL)
12427     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
12428   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12429   if (image == (Image *) NULL)
12430     return(MagickFalse);
12431   write_info=CloneImageInfo(wand->image_info);
12432   write_info->adjoin=MagickTrue;
12433   status=WriteImage(write_info,image,wand->exception);
12434   image=DestroyImage(image);
12435   write_info=DestroyImageInfo(write_info);
12436   return(status);
12437 }
12438 
12439 /*
12440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12441 %                                                                             %
12442 %                                                                             %
12443 %                                                                             %
12444 %   M a g i c k W r i t e I m a g e F i l e                                   %
12445 %                                                                             %
12446 %                                                                             %
12447 %                                                                             %
12448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12449 %
12450 %  MagickWriteImageFile() writes an image to an open file descriptor.
12451 %
12452 %  The format of the MagickWriteImageFile method is:
12453 %
12454 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12455 %
12456 %  A description of each parameter follows:
12457 %
12458 %    o wand: the magick wand.
12459 %
12460 %    o file: the file descriptor.
12461 %
12462 */
MagickWriteImageFile(MagickWand * wand,FILE * file)12463 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12464 {
12465   Image
12466     *image;
12467 
12468   ImageInfo
12469     *write_info;
12470 
12471   MagickBooleanType
12472     status;
12473 
12474   assert(wand != (MagickWand *) NULL);
12475   assert(wand->signature == MagickWandSignature);
12476   assert(file != (FILE *) NULL);
12477   if (wand->debug != MagickFalse)
12478     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12479   if (wand->images == (Image *) NULL)
12480     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12481   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12482   if (image == (Image *) NULL)
12483     return(MagickFalse);
12484   write_info=CloneImageInfo(wand->image_info);
12485   SetImageInfoFile(write_info,file);
12486   write_info->adjoin=MagickTrue;
12487   status=WriteImage(write_info,image,wand->exception);
12488   write_info=DestroyImageInfo(write_info);
12489   image=DestroyImage(image);
12490   return(status);
12491 }
12492 
12493 /*
12494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12495 %                                                                             %
12496 %                                                                             %
12497 %                                                                             %
12498 %   M a g i c k W r i t e I m a g e s                                         %
12499 %                                                                             %
12500 %                                                                             %
12501 %                                                                             %
12502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12503 %
12504 %  MagickWriteImages() writes an image or image sequence.
12505 %
12506 %  The format of the MagickWriteImages method is:
12507 %
12508 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12509 %        const char *filename,const MagickBooleanType adjoin)
12510 %
12511 %  A description of each parameter follows:
12512 %
12513 %    o wand: the magick wand.
12514 %
12515 %    o filename: the image filename.
12516 %
12517 %    o adjoin: join images into a single multi-image file.
12518 %
12519 */
MagickWriteImages(MagickWand * wand,const char * filename,const MagickBooleanType adjoin)12520 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12521   const char *filename,const MagickBooleanType adjoin)
12522 {
12523   ImageInfo
12524     *write_info;
12525 
12526   MagickBooleanType
12527     status;
12528 
12529   assert(wand != (MagickWand *) NULL);
12530   assert(wand->signature == MagickWandSignature);
12531   if (wand->debug != MagickFalse)
12532     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12533   if (wand->images == (Image *) NULL)
12534     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12535   write_info=CloneImageInfo(wand->image_info);
12536   write_info->adjoin=adjoin;
12537   status=WriteImages(write_info,wand->images,filename,wand->exception);
12538   write_info=DestroyImageInfo(write_info);
12539   return(status);
12540 }
12541 
12542 /*
12543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12544 %                                                                             %
12545 %                                                                             %
12546 %                                                                             %
12547 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12548 %                                                                             %
12549 %                                                                             %
12550 %                                                                             %
12551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12552 %
12553 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12554 %
12555 %  The format of the MagickWriteImagesFile method is:
12556 %
12557 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12558 %
12559 %  A description of each parameter follows:
12560 %
12561 %    o wand: the magick wand.
12562 %
12563 %    o file: the file descriptor.
12564 %
12565 */
MagickWriteImagesFile(MagickWand * wand,FILE * file)12566 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12567 {
12568   ImageInfo
12569     *write_info;
12570 
12571   MagickBooleanType
12572     status;
12573 
12574   assert(wand != (MagickWand *) NULL);
12575   assert(wand->signature == MagickWandSignature);
12576   if (wand->debug != MagickFalse)
12577     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12578   if (wand->images == (Image *) NULL)
12579     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12580   write_info=CloneImageInfo(wand->image_info);
12581   SetImageInfoFile(write_info,file);
12582   write_info->adjoin=MagickTrue;
12583   status=WriteImages(write_info,wand->images,(const char *) NULL,
12584     wand->exception);
12585   write_info=DestroyImageInfo(write_info);
12586   return(status);
12587 }
12588