• 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-2021 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 *) AcquireCriticalMemory(sizeof(*clone_wand));
98   (void) memset(clone_wand,0,sizeof(*clone_wand));
99   clone_wand->id=AcquireWandId();
100   (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
101     MagickWandId,(double) clone_wand->id);
102   clone_wand->exception=AcquireExceptionInfo();
103   InheritException(clone_wand->exception,wand->exception);
104   clone_wand->image_info=CloneImageInfo(wand->image_info);
105   clone_wand->images=images;
106   clone_wand->debug=IsEventLogging();
107   clone_wand->signature=MagickWandSignature;
108   if (clone_wand->debug != MagickFalse)
109     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
110   return(clone_wand);
111 }
112 
113 /*
114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115 %                                                                             %
116 %                                                                             %
117 %                                                                             %
118 %   G e t I m a g e F r o m M a g i c k W a n d                               %
119 %                                                                             %
120 %                                                                             %
121 %                                                                             %
122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 %
124 %  GetImageFromMagickWand() returns the current image from the magick wand.
125 %
126 %  The format of the GetImageFromMagickWand method is:
127 %
128 %      Image *GetImageFromMagickWand(const MagickWand *wand)
129 %
130 %  A description of each parameter follows:
131 %
132 %    o wand: the magick wand.
133 %
134 */
GetImageFromMagickWand(const MagickWand * wand)135 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
136 {
137   assert(wand != (MagickWand *) NULL);
138   assert(wand->signature == MagickWandSignature);
139   if (wand->debug != MagickFalse)
140     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
141   if (wand->images == (Image *) NULL)
142     {
143       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
144         "ContainsNoImages","`%s'",wand->name);
145       return((Image *) NULL);
146     }
147   return(wand->images);
148 }
149 
150 /*
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 %                                                                             %
153 %                                                                             %
154 %                                                                             %
155 %   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                       %
156 %                                                                             %
157 %                                                                             %
158 %                                                                             %
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160 %
161 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
162 %  less intensely near image edges and more intensely far from edges. We
163 %  blur the image with a Gaussian operator of the given radius and standard
164 %  deviation (sigma).  For reasonable results, radius should be larger than
165 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
166 %  suitable radius for you.
167 %
168 %  The format of the MagickAdaptiveBlurImage method is:
169 %
170 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
171 %        const double radius,const double sigma)
172 %
173 %  A description of each parameter follows:
174 %
175 %    o wand: the magick wand.
176 %
177 %    o radius: the radius of the Gaussian, in pixels, not counting the center
178 %      pixel.
179 %
180 %    o sigma: the standard deviation of the Gaussian, in pixels.
181 %
182 */
MagickAdaptiveBlurImage(MagickWand * wand,const double radius,const double sigma)183 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
184   const double radius,const double sigma)
185 {
186   Image
187     *sharp_image;
188 
189   assert(wand != (MagickWand *) NULL);
190   assert(wand->signature == MagickWandSignature);
191   if (wand->debug != MagickFalse)
192     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
193   if (wand->images == (Image *) NULL)
194     ThrowWandException(WandError,"ContainsNoImages",wand->name);
195   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
196   if (sharp_image == (Image *) NULL)
197     return(MagickFalse);
198   ReplaceImageInList(&wand->images,sharp_image);
199   return(MagickTrue);
200 }
201 
202 /*
203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
204 %                                                                             %
205 %                                                                             %
206 %                                                                             %
207 %   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                         %
208 %                                                                             %
209 %                                                                             %
210 %                                                                             %
211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
212 %
213 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
214 %  triangulation.
215 %
216 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
217 %        const size_t columns,const size_t rows)
218 %
219 %  A description of each parameter follows:
220 %
221 %    o wand: the magick wand.
222 %
223 %    o columns: the number of columns in the scaled image.
224 %
225 %    o rows: the number of rows in the scaled image.
226 %
227 */
MagickAdaptiveResizeImage(MagickWand * wand,const size_t columns,const size_t rows)228 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
229   const size_t columns,const size_t rows)
230 {
231   Image
232     *resize_image;
233 
234   assert(wand != (MagickWand *) NULL);
235   assert(wand->signature == MagickWandSignature);
236   if (wand->debug != MagickFalse)
237     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
238   if (wand->images == (Image *) NULL)
239     ThrowWandException(WandError,"ContainsNoImages",wand->name);
240   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
241   if (resize_image == (Image *) NULL)
242     return(MagickFalse);
243   ReplaceImageInList(&wand->images,resize_image);
244   return(MagickTrue);
245 }
246 
247 /*
248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
249 %                                                                             %
250 %                                                                             %
251 %                                                                             %
252 %   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                       %
253 %                                                                             %
254 %                                                                             %
255 %                                                                             %
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257 %
258 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
259 %  more intensely near image edges and less intensely far from edges. We
260 %  sharpen the image with a Gaussian operator of the given radius and standard
261 %  deviation (sigma).  For reasonable results, radius should be larger than
262 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
263 %  suitable radius for you.
264 %
265 %  The format of the MagickAdaptiveSharpenImage method is:
266 %
267 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
268 %        const double radius,const double sigma)
269 %
270 %  A description of each parameter follows:
271 %
272 %    o wand: the magick wand.
273 %
274 %    o radius: the radius of the Gaussian, in pixels, not counting the center
275 %      pixel.
276 %
277 %    o sigma: the standard deviation of the Gaussian, in pixels.
278 %
279 */
MagickAdaptiveSharpenImage(MagickWand * wand,const double radius,const double sigma)280 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
281   const double radius,const double sigma)
282 {
283   Image
284     *sharp_image;
285 
286   assert(wand != (MagickWand *) NULL);
287   assert(wand->signature == MagickWandSignature);
288   if (wand->debug != MagickFalse)
289     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
290   if (wand->images == (Image *) NULL)
291     ThrowWandException(WandError,"ContainsNoImages",wand->name);
292   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
293   if (sharp_image == (Image *) NULL)
294     return(MagickFalse);
295   ReplaceImageInList(&wand->images,sharp_image);
296   return(MagickTrue);
297 }
298 
299 /*
300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
301 %                                                                             %
302 %                                                                             %
303 %                                                                             %
304 %   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                   %
305 %                                                                             %
306 %                                                                             %
307 %                                                                             %
308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309 %
310 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
311 %  based on the range of intensity values in its local neighborhood.  This
312 %  allows for thresholding of an image whose global intensity histogram
313 %  doesn't contain distinctive peaks.
314 %
315 %  The format of the AdaptiveThresholdImage method is:
316 %
317 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
318 %        const size_t width,const size_t height,const double bias)
319 %
320 %  A description of each parameter follows:
321 %
322 %    o wand: the magick wand.
323 %
324 %    o width: the width of the local neighborhood.
325 %
326 %    o height: the height of the local neighborhood.
327 %
328 %    o offset: the mean bias.
329 %
330 */
MagickAdaptiveThresholdImage(MagickWand * wand,const size_t width,const size_t height,const double bias)331 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
332   const size_t width,const size_t height,const double bias)
333 {
334   Image
335     *threshold_image;
336 
337   assert(wand != (MagickWand *) NULL);
338   assert(wand->signature == MagickWandSignature);
339   if (wand->debug != MagickFalse)
340     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
341   if (wand->images == (Image *) NULL)
342     ThrowWandException(WandError,"ContainsNoImages",wand->name);
343   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
344     wand->exception);
345   if (threshold_image == (Image *) NULL)
346     return(MagickFalse);
347   ReplaceImageInList(&wand->images,threshold_image);
348   return(MagickTrue);
349 }
350 
351 /*
352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
353 %                                                                             %
354 %                                                                             %
355 %                                                                             %
356 %   M a g i c k A d d I m a g e                                               %
357 %                                                                             %
358 %                                                                             %
359 %                                                                             %
360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361 %
362 %  MagickAddImage() adds a clone of the images from the second wand and
363 %  inserts them into the first wand.
364 %
365 %  Use MagickSetLastIterator(), to append new images into an existing wand,
366 %  current image will be set to last image so later adds with also be
367 %  appended to end of wand.
368 %
369 %  Use MagickSetFirstIterator() to prepend new images into wand, any more
370 %  images added will also be prepended before other images in the wand.
371 %  However the order of a list of new images will not change.
372 %
373 %  Otherwise the new images will be inserted just after the current image,
374 %  and any later image will also be added after this current image but
375 %  before the previously added images.  Caution is advised when multiple
376 %  image adds are inserted into the middle of the wand image list.
377 %
378 %  The format of the MagickAddImage method is:
379 %
380 %      MagickBooleanType MagickAddImage(MagickWand *wand,
381 %        const MagickWand *add_wand)
382 %
383 %  A description of each parameter follows:
384 %
385 %    o wand: the magick wand.
386 %
387 %    o add_wand: A wand that contains the image list to be added
388 %
389 */
InsertImageInWand(MagickWand * wand,Image * images)390 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
391   Image *images)
392 {
393   if (wand->images == (Image *) NULL)
394     {
395       /*
396         No images in wand, just add them, set current as appropriate.
397       */
398       if (wand->insert_before != MagickFalse)
399         wand->images=GetFirstImageInList(images);
400       else
401         wand->images=GetLastImageInList(images);
402       return(MagickTrue);
403     }
404   /* user jumped to first image, so prepend new images - remain active */
405   if ((wand->insert_before != MagickFalse) &&
406        (wand->images->previous == (Image *) NULL))
407     {
408       PrependImageToList(&wand->images,images);
409       wand->images=GetFirstImageInList(images);
410       return(MagickTrue);
411     }
412   /*
413     Note you should never have 'insert_before' true when current image is not
414     the first image in the wand!  That is no insert before current image, only
415     after current image
416   */
417   if (wand->images->next == (Image *) NULL)
418     {
419       /*
420         At last image, append new images.
421       */
422       InsertImageInList(&wand->images,images);
423       wand->images=GetLastImageInList(images);
424       return(MagickTrue);
425     }
426   /*
427     Insert new images, just after the current image.
428   */
429   InsertImageInList(&wand->images,images);
430   return(MagickTrue);
431 }
432 
MagickAddImage(MagickWand * wand,const MagickWand * add_wand)433 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
434   const MagickWand *add_wand)
435 {
436   Image
437     *images;
438 
439   assert(wand != (MagickWand *) NULL);
440   assert(wand->signature == MagickWandSignature);
441   if (wand->debug != MagickFalse)
442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
443   assert(add_wand != (MagickWand *) NULL);
444   assert(add_wand->signature == MagickWandSignature);
445   if (add_wand->images == (Image *) NULL)
446     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
447   /*
448     Clone images in second wand, and insert into first.
449   */
450   images=CloneImageList(add_wand->images,wand->exception);
451   if (images == (Image *) NULL)
452     return(MagickFalse);
453   return(InsertImageInWand(wand,images));
454 }
455 
456 /*
457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
458 %                                                                             %
459 %                                                                             %
460 %                                                                             %
461 %     M a g i c k A d d N o i s e I m a g e                                   %
462 %                                                                             %
463 %                                                                             %
464 %                                                                             %
465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466 %
467 %  MagickAddNoiseImage() adds random noise to the image.
468 %
469 %  The format of the MagickAddNoiseImage method is:
470 %
471 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
472 %        const NoiseType noise_type,const double attenuate)
473 %
474 %  A description of each parameter follows:
475 %
476 %    o wand: the magick wand.
477 %
478 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
479 %      Impulse, Laplacian, or Poisson.
480 %
481 %    o attenuate:  attenuate the random distribution.
482 %
483 */
MagickAddNoiseImage(MagickWand * wand,const NoiseType noise_type,const double attenuate)484 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
485   const NoiseType noise_type,const double attenuate)
486 {
487   Image
488     *noise_image;
489 
490   assert(wand != (MagickWand *) NULL);
491   assert(wand->signature == MagickWandSignature);
492   if (wand->debug != MagickFalse)
493     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
494   if (wand->images == (Image *) NULL)
495     ThrowWandException(WandError,"ContainsNoImages",wand->name);
496   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
497   if (noise_image == (Image *) NULL)
498     return(MagickFalse);
499   ReplaceImageInList(&wand->images,noise_image);
500   return(MagickTrue);
501 }
502 
503 /*
504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
505 %                                                                             %
506 %                                                                             %
507 %                                                                             %
508 %   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                       %
509 %                                                                             %
510 %                                                                             %
511 %                                                                             %
512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513 %
514 %  MagickAffineTransformImage() transforms an image as dictated by the affine
515 %  matrix of the drawing wand.
516 %
517 %  The format of the MagickAffineTransformImage method is:
518 %
519 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
520 %        const DrawingWand *drawing_wand)
521 %
522 %  A description of each parameter follows:
523 %
524 %    o wand: the magick wand.
525 %
526 %    o drawing_wand: the draw wand.
527 %
528 */
MagickAffineTransformImage(MagickWand * wand,const DrawingWand * drawing_wand)529 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
530   const DrawingWand *drawing_wand)
531 {
532   DrawInfo
533     *draw_info;
534 
535   Image
536     *affine_image;
537 
538   assert(wand != (MagickWand *) NULL);
539   assert(wand->signature == MagickWandSignature);
540   if (wand->debug != MagickFalse)
541     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
542   if (wand->images == (Image *) NULL)
543     ThrowWandException(WandError,"ContainsNoImages",wand->name);
544   draw_info=PeekDrawingWand(drawing_wand);
545   if (draw_info == (DrawInfo *) NULL)
546     return(MagickFalse);
547   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
548     wand->exception);
549   draw_info=DestroyDrawInfo(draw_info);
550   if (affine_image == (Image *) NULL)
551     return(MagickFalse);
552   ReplaceImageInList(&wand->images,affine_image);
553   return(MagickTrue);
554 }
555 
556 /*
557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
558 %                                                                             %
559 %                                                                             %
560 %                                                                             %
561 %   M a g i c k A n n o t a t e I m a g e                                     %
562 %                                                                             %
563 %                                                                             %
564 %                                                                             %
565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
566 %
567 %  MagickAnnotateImage() annotates an image with text.
568 %
569 %  The format of the MagickAnnotateImage method is:
570 %
571 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
572 %        const DrawingWand *drawing_wand,const double x,const double y,
573 %        const double angle,const char *text)
574 %
575 %  A description of each parameter follows:
576 %
577 %    o wand: the magick wand.
578 %
579 %    o drawing_wand: the draw wand.
580 %
581 %    o x: x ordinate to left of text
582 %
583 %    o y: y ordinate to text baseline
584 %
585 %    o angle: rotate text relative to this angle.
586 %
587 %    o text: text to draw
588 %
589 */
MagickAnnotateImage(MagickWand * wand,const DrawingWand * drawing_wand,const double x,const double y,const double angle,const char * text)590 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
591   const DrawingWand *drawing_wand,const double x,const double y,
592   const double angle,const char *text)
593 {
594   char
595     geometry[MagickPathExtent];
596 
597   DrawInfo
598     *draw_info;
599 
600   MagickBooleanType
601     status;
602 
603   assert(wand != (MagickWand *) NULL);
604   assert(wand->signature == MagickWandSignature);
605   if (wand->debug != MagickFalse)
606     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
607   if (wand->images == (Image *) NULL)
608     ThrowWandException(WandError,"ContainsNoImages",wand->name);
609   draw_info=PeekDrawingWand(drawing_wand);
610   if (draw_info == (DrawInfo *) NULL)
611     return(MagickFalse);
612   (void) CloneString(&draw_info->text,text);
613   (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
614   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
615   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
616   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
617   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
618   (void) CloneString(&draw_info->geometry,geometry);
619   status=AnnotateImage(wand->images,draw_info,wand->exception);
620   draw_info=DestroyDrawInfo(draw_info);
621   return(status);
622 }
623 
624 /*
625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
626 %                                                                             %
627 %                                                                             %
628 %                                                                             %
629 %   M a g i c k A n i m a t e I m a g e s                                     %
630 %                                                                             %
631 %                                                                             %
632 %                                                                             %
633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
634 %
635 %  MagickAnimateImages() animates an image or image sequence.
636 %
637 %  The format of the MagickAnimateImages method is:
638 %
639 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
640 %        const char *server_name)
641 %
642 %  A description of each parameter follows:
643 %
644 %    o wand: the magick wand.
645 %
646 %    o server_name: the X server name.
647 %
648 */
MagickAnimateImages(MagickWand * wand,const char * server_name)649 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
650   const char *server_name)
651 {
652   MagickBooleanType
653     status;
654 
655   assert(wand != (MagickWand *) NULL);
656   assert(wand->signature == MagickWandSignature);
657   if (wand->debug != MagickFalse)
658     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
659   (void) CloneString(&wand->image_info->server_name,server_name);
660   status=AnimateImages(wand->image_info,wand->images,wand->exception);
661   return(status);
662 }
663 
664 /*
665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
666 %                                                                             %
667 %                                                                             %
668 %                                                                             %
669 %   M a g i c k A p p e n d I m a g e s                                       %
670 %                                                                             %
671 %                                                                             %
672 %                                                                             %
673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
674 %
675 %  MagickAppendImages() append the images in a wand from the current image
676 %  onwards, creating a new wand with the single image result.  This is
677 %  affected by the gravity and background settings of the first image.
678 %
679 %  Typically you would call either MagickResetIterator() or
680 %  MagickSetFirstImage() before calling this function to ensure that all
681 %  the images in the wand's image list will be appended together.
682 %
683 %  The format of the MagickAppendImages method is:
684 %
685 %      MagickWand *MagickAppendImages(MagickWand *wand,
686 %        const MagickBooleanType stack)
687 %
688 %  A description of each parameter follows:
689 %
690 %    o wand: the magick wand.
691 %
692 %    o stack: By default, images are stacked left-to-right. Set stack to
693 %      MagickTrue to stack them top-to-bottom.
694 %
695 */
MagickAppendImages(MagickWand * wand,const MagickBooleanType stack)696 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
697   const MagickBooleanType stack)
698 {
699   Image
700     *append_image;
701 
702   assert(wand != (MagickWand *) NULL);
703   assert(wand->signature == MagickWandSignature);
704   if (wand->debug != MagickFalse)
705     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
706   if (wand->images == (Image *) NULL)
707     return((MagickWand *) NULL);
708   append_image=AppendImages(wand->images,stack,wand->exception);
709   if (append_image == (Image *) NULL)
710     return((MagickWand *) NULL);
711   return(CloneMagickWandFromImages(wand,append_image));
712 }
713 
714 /*
715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
716 %                                                                             %
717 %                                                                             %
718 %                                                                             %
719 %   M a g i c k A u t o G a m m a I m a g e                                   %
720 %                                                                             %
721 %                                                                             %
722 %                                                                             %
723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
724 %
725 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
726 %  image to try make set its gamma appropriatally.
727 %
728 %  The format of the MagickAutoGammaImage method is:
729 %
730 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
731 %
732 %  A description of each parameter follows:
733 %
734 %    o wand: the magick wand.
735 %
736 */
MagickAutoGammaImage(MagickWand * wand)737 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
738 {
739   MagickBooleanType
740     status;
741 
742   assert(wand != (MagickWand *) NULL);
743   assert(wand->signature == MagickWandSignature);
744   if (wand->debug != MagickFalse)
745     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
746   if (wand->images == (Image *) NULL)
747     ThrowWandException(WandError,"ContainsNoImages",wand->name);
748   status=AutoGammaImage(wand->images,wand->exception);
749   return(status);
750 }
751 
752 /*
753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
754 %                                                                             %
755 %                                                                             %
756 %                                                                             %
757 %   M a g i c k A u t o L e v e l I m a g e                                   %
758 %                                                                             %
759 %                                                                             %
760 %                                                                             %
761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
762 %
763 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
764 %  scaling the minimum and maximum values to the full quantum range.
765 %
766 %  The format of the MagickAutoLevelImage method is:
767 %
768 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
769 %
770 %  A description of each parameter follows:
771 %
772 %    o wand: the magick wand.
773 %
774 */
MagickAutoLevelImage(MagickWand * wand)775 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
776 {
777   MagickBooleanType
778     status;
779 
780   assert(wand != (MagickWand *) NULL);
781   assert(wand->signature == MagickWandSignature);
782   if (wand->debug != MagickFalse)
783     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
784   if (wand->images == (Image *) NULL)
785     ThrowWandException(WandError,"ContainsNoImages",wand->name);
786   status=AutoLevelImage(wand->images,wand->exception);
787   return(status);
788 }
789 
790 /*
791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
792 %                                                                             %
793 %                                                                             %
794 %                                                                             %
795 %   M a g i c k A u t o O r i e n t I m a g e                                 %
796 %                                                                             %
797 %                                                                             %
798 %                                                                             %
799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
800 %
801 %  MagickAutoOrientImage() adjusts an image so that its orientation is suitable
802 $  for viewing (i.e. top-left orientation).
803 %
804 %  The format of the MagickAutoOrientImage method is:
805 %
806 %      MagickBooleanType MagickAutoOrientImage(MagickWand *image)
807 %
808 %  A description of each parameter follows:
809 %
810 %    o wand: the magick wand.
811 %
812 */
MagickAutoOrientImage(MagickWand * wand)813 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
814 {
815 
816   Image
817     *orient_image;
818 
819   assert(wand != (MagickWand *) NULL);
820   assert(wand->signature == MagickWandSignature);
821   if (wand->debug != MagickFalse)
822     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
823   if (wand->images == (Image *) NULL)
824     ThrowWandException(WandError,"ContainsNoImages",wand->name);
825   orient_image=AutoOrientImage(wand->images,wand->images->orientation,
826     wand->exception);
827   if (orient_image == (Image *) NULL)
828     return(MagickFalse);
829   ReplaceImageInList(&wand->images,orient_image);
830   return(MagickTrue);
831 }
832 
833 /*
834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
835 %                                                                             %
836 %                                                                             %
837 %                                                                             %
838 %   M a g i c k A u t o T h r e s h o l d I m a g e                           %
839 %                                                                             %
840 %                                                                             %
841 %                                                                             %
842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
843 %
844 %  MagickAutoThresholdImage() automatically performs image thresholding
845 %  dependent on which method you specify.
846 %
847 %  The format of the AutoThresholdImage method is:
848 %
849 %      MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
850 %        const AutoThresholdMethod method)
851 %
852 %  A description of each parameter follows:
853 %
854 %    o wand: the magick wand.
855 %
856 %    o method: choose from KapurThresholdMethod, OTSUThresholdMethod, or
857 %      TriangleThresholdMethod.
858 %
859 */
MagickAutoThresholdImage(MagickWand * wand,const AutoThresholdMethod method)860 WandExport MagickBooleanType MagickAutoThresholdImage(MagickWand *wand,
861   const AutoThresholdMethod method)
862 {
863   assert(wand != (MagickWand *) NULL);
864   assert(wand->signature == MagickWandSignature);
865   if (wand->debug != MagickFalse)
866     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
867   if (wand->images == (Image *) NULL)
868     ThrowWandException(WandError,"ContainsNoImages",wand->name);
869   return(AutoThresholdImage(wand->images,method,wand->exception));
870 }
871 
872 /*
873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
874 %                                                                             %
875 %                                                                             %
876 %                                                                             %
877 %   M a g i c k B i l a t e r a l B l u r I m a g e                           %
878 %                                                                             %
879 %                                                                             %
880 %                                                                             %
881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882 %
883 %  MagickBilateralBlurImage() is a non-linear, edge-preserving, and
884 %  noise-reducing smoothing filter for images.  It replaces the intensity of
885 %  each pixel with a weighted average of intensity values from nearby pixels.
886 %  This weight is based on a Gaussian distribution.  The weights depend not
887 %  only on Euclidean distance of pixels, but also on the radiometric
888 %  differences (e.g., range differences, such as color intensity, depth
889 %  distance, etc.). This preserves sharp edges.
890 %
891 %  The format of the MagickBilateralBlurImage method is:
892 %
893 %      MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
894 %        const double radius,const double sigma,const double intensity_sigma,
895 %        const double spatial_sigma)
896 %
897 %  A description of each parameter follows:
898 %
899 %    o wand: the magick wand.
900 %
901 %    o radius: the radius of the Gaussian, in pixels, not counting the center
902 %      pixel.
903 %
904 %    o sigma: the standard deviation of the , in pixels.
905 %
906 %    o intensity_sigma: sigma in the intensity space. A larger value means
907 %      that farther colors within the pixel neighborhood (see spatial_sigma)
908 %      will be mixed together, resulting in larger areas of semi-equal color.
909 %
910 %    o spatial_sigma: sigma in the coordinate space. A larger value means that
911 %      farther pixels influence each other as long as their colors are close
912 %      enough (see intensity_sigma ). When the neigborhood diameter is greater
913 %      than zero, it specifies the neighborhood size regardless of
914 %      spatial_sigma. Otherwise, the neigborhood diameter is proportional to
915 %      spatial_sigma.
916 %
917 */
MagickBilateralBlurImage(MagickWand * wand,const double radius,const double sigma,const double intensity_sigma,const double spatial_sigma)918 WandExport MagickBooleanType MagickBilateralBlurImage(MagickWand *wand,
919   const double radius,const double sigma,const double intensity_sigma,
920   const double spatial_sigma)
921 {
922   Image
923     *blur_image;
924 
925   assert(wand != (MagickWand *) NULL);
926   assert(wand->signature == MagickWandSignature);
927   if (wand->debug != MagickFalse)
928     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
929   if (wand->images == (Image *) NULL)
930     ThrowWandException(WandError,"ContainsNoImages",wand->name);
931   blur_image=BilateralBlurImage(wand->images,radius,sigma,intensity_sigma,
932     spatial_sigma,wand->exception);
933   if (blur_image == (Image *) NULL)
934     return(MagickFalse);
935   ReplaceImageInList(&wand->images,blur_image);
936   return(MagickTrue);
937 }
938 
939 /*
940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
941 %                                                                             %
942 %                                                                             %
943 %                                                                             %
944 %   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                         %
945 %                                                                             %
946 %                                                                             %
947 %                                                                             %
948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
949 %
950 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
951 %  pixels below the threshold into black while leaving all pixels above the
952 %  threshold unchanged.
953 %
954 %  The format of the MagickBlackThresholdImage method is:
955 %
956 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
957 %        const PixelWand *threshold)
958 %
959 %  A description of each parameter follows:
960 %
961 %    o wand: the magick wand.
962 %
963 %    o threshold: the pixel wand.
964 %
965 */
MagickBlackThresholdImage(MagickWand * wand,const PixelWand * threshold)966 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
967   const PixelWand *threshold)
968 {
969   char
970     thresholds[MagickPathExtent];
971 
972   assert(wand != (MagickWand *) NULL);
973   assert(wand->signature == MagickWandSignature);
974   if (wand->debug != MagickFalse)
975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
976   if (wand->images == (Image *) NULL)
977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
978   (void) FormatLocaleString(thresholds,MagickPathExtent,
979     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
980     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
981     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
982   return(BlackThresholdImage(wand->images,thresholds,wand->exception));
983 }
984 
985 /*
986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
987 %                                                                             %
988 %                                                                             %
989 %                                                                             %
990 %   M a g i c k B l u e S h i f t I m a g e                                   %
991 %                                                                             %
992 %                                                                             %
993 %                                                                             %
994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
995 %
996 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
997 %  nighttime in the moonlight.
998 %
999 %  The format of the MagickBlueShiftImage method is:
1000 %
1001 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
1002 %        const double factor)
1003 %
1004 %  A description of each parameter follows:
1005 %
1006 %    o wand: the magick wand.
1007 %
1008 %    o factor: the blue shift factor (default 1.5)
1009 %
1010 */
MagickBlueShiftImage(MagickWand * wand,const double factor)1011 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
1012   const double factor)
1013 {
1014   Image
1015     *shift_image;
1016 
1017   assert(wand != (MagickWand *) NULL);
1018   assert(wand->signature == MagickWandSignature);
1019   if (wand->debug != MagickFalse)
1020     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1021   if (wand->images == (Image *) NULL)
1022     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1023   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
1024   if (shift_image == (Image *) NULL)
1025     return(MagickFalse);
1026   ReplaceImageInList(&wand->images,shift_image);
1027   return(MagickTrue);
1028 }
1029 
1030 /*
1031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1032 %                                                                             %
1033 %                                                                             %
1034 %                                                                             %
1035 %   M a g i c k B l u r I m a g e                                             %
1036 %                                                                             %
1037 %                                                                             %
1038 %                                                                             %
1039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1040 %
1041 %  MagickBlurImage() blurs an image.  We convolve the image with a
1042 %  gaussian operator of the given radius and standard deviation (sigma).
1043 %  For reasonable results, the radius should be larger than sigma.  Use a
1044 %  radius of 0 and BlurImage() selects a suitable radius for you.
1045 %
1046 %  The format of the MagickBlurImage method is:
1047 %
1048 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
1049 %        const double sigma)
1050 %
1051 %  A description of each parameter follows:
1052 %
1053 %    o wand: the magick wand.
1054 %
1055 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1056 %      pixel.
1057 %
1058 %    o sigma: the standard deviation of the , in pixels.
1059 %
1060 */
MagickBlurImage(MagickWand * wand,const double radius,const double sigma)1061 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
1062   const double radius,const double sigma)
1063 {
1064   Image
1065     *blur_image;
1066 
1067   assert(wand != (MagickWand *) NULL);
1068   assert(wand->signature == MagickWandSignature);
1069   if (wand->debug != MagickFalse)
1070     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1071   if (wand->images == (Image *) NULL)
1072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1073   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
1074   if (blur_image == (Image *) NULL)
1075     return(MagickFalse);
1076   ReplaceImageInList(&wand->images,blur_image);
1077   return(MagickTrue);
1078 }
1079 
1080 /*
1081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1082 %                                                                             %
1083 %                                                                             %
1084 %                                                                             %
1085 %   M a g i c k B o r d e r I m a g e                                         %
1086 %                                                                             %
1087 %                                                                             %
1088 %                                                                             %
1089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1090 %
1091 %  MagickBorderImage() surrounds the image with a border of the color defined
1092 %  by the bordercolor pixel wand.
1093 %
1094 %  The format of the MagickBorderImage method is:
1095 %
1096 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
1097 %        const PixelWand *bordercolor,const size_t width,
1098 %        const size_t height,const CompositeOperator compose)
1099 %
1100 %  A description of each parameter follows:
1101 %
1102 %    o wand: the magick wand.
1103 %
1104 %    o bordercolor: the border color pixel wand.
1105 %
1106 %    o width: the border width.
1107 %
1108 %    o height: the border height.
1109 %
1110 %    o compose: the composite operator.
1111 %
1112 */
MagickBorderImage(MagickWand * wand,const PixelWand * bordercolor,const size_t width,const size_t height,const CompositeOperator compose)1113 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1114   const PixelWand *bordercolor,const size_t width,const size_t height,
1115   const CompositeOperator compose)
1116 {
1117   Image
1118     *border_image;
1119 
1120   RectangleInfo
1121     border_info;
1122 
1123   assert(wand != (MagickWand *) NULL);
1124   assert(wand->signature == MagickWandSignature);
1125   if (wand->debug != MagickFalse)
1126     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1127   if (wand->images == (Image *) NULL)
1128     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1129   border_info.width=width;
1130   border_info.height=height;
1131   border_info.x=0;
1132   border_info.y=0;
1133   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1134   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1135   if (border_image == (Image *) NULL)
1136     return(MagickFalse);
1137   ReplaceImageInList(&wand->images,border_image);
1138   return(MagickTrue);
1139 }
1140 
1141 /*
1142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1143 %                                                                             %
1144 %                                                                             %
1145 %                                                                             %
1146 %   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   %
1147 %                                                                             %
1148 %                                                                             %
1149 %                                                                             %
1150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1151 %
1152 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1153 %  of an image.  It converts the brightness and contrast parameters into slope
1154 %  and intercept and calls a polynomical function to apply to the image.
1155 
1156 %
1157 %  The format of the MagickBrightnessContrastImage method is:
1158 %
1159 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1160 %        const double brightness,const double contrast)
1161 %
1162 %  A description of each parameter follows:
1163 %
1164 %    o wand: the magick wand.
1165 %
1166 %    o brightness: the brightness percent (-100 .. 100).
1167 %
1168 %    o contrast: the contrast percent (-100 .. 100).
1169 %
1170 */
MagickBrightnessContrastImage(MagickWand * wand,const double brightness,const double contrast)1171 WandExport MagickBooleanType MagickBrightnessContrastImage(
1172   MagickWand *wand,const double brightness,const double contrast)
1173 {
1174   MagickBooleanType
1175     status;
1176 
1177   assert(wand != (MagickWand *) NULL);
1178   assert(wand->signature == MagickWandSignature);
1179   if (wand->debug != MagickFalse)
1180     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1181   if (wand->images == (Image *) NULL)
1182     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1183   status=BrightnessContrastImage(wand->images,brightness,contrast,
1184     wand->exception);
1185   return(status);
1186 }
1187 
1188 /*
1189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1190 %                                                                             %
1191 %                                                                             %
1192 %                                                                             %
1193 %   M a g i c k C a n n y E d g e I m a g e                                   %
1194 %                                                                             %
1195 %                                                                             %
1196 %                                                                             %
1197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1198 %
1199 %  MagickCannyEdgeImage() uses a multi-stage algorithm to detect a wide range of
1200 %  edges in images.
1201 %
1202 %  The format of the MagickCannyEdgeImage method is:
1203 %
1204 %      MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
1205 %        const double radius,const double sigma,const double lower_percent,
1206 %        const double upper_percent)
1207 %
1208 %  A description of each parameter follows:
1209 %
1210 %    o wand: the magick wand.
1211 %
1212 %    o radius: the radius of the gaussian smoothing filter.
1213 %
1214 %    o sigma: the sigma of the gaussian smoothing filter.
1215 %
1216 %    o lower_percent: percentage of edge pixels in the lower threshold.
1217 %
1218 %    o upper_percent: percentage of edge pixels in the upper threshold.
1219 %
1220 */
MagickCannyEdgeImage(MagickWand * wand,const double radius,const double sigma,const double lower_percent,const double upper_percent)1221 WandExport MagickBooleanType MagickCannyEdgeImage(MagickWand *wand,
1222   const double radius,const double sigma,const double lower_percent,
1223   const double upper_percent)
1224 {
1225   Image
1226     *edge_image;
1227 
1228   assert(wand != (MagickWand *) NULL);
1229   assert(wand->signature == MagickWandSignature);
1230   if (wand->debug != MagickFalse)
1231     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1232   if (wand->images == (Image *) NULL)
1233     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1234   edge_image=CannyEdgeImage(wand->images,radius,sigma,lower_percent,
1235     upper_percent,wand->exception);
1236   if (edge_image == (Image *) NULL)
1237     return(MagickFalse);
1238   ReplaceImageInList(&wand->images,edge_image);
1239   return(MagickTrue);
1240 }
1241 
1242 /*
1243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1244 %                                                                             %
1245 %                                                                             %
1246 %                                                                             %
1247 %   M a g i c k C h a n n e l F x I m a g e                                   %
1248 %                                                                             %
1249 %                                                                             %
1250 %                                                                             %
1251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1252 %
1253 %  MagickChannelFxImage() applies a channel expression to the specified image.
1254 %  The expression consists of one or more channels, either mnemonic or numeric
1255 %  (e.g. red, 1), separated by actions as follows:
1256 %
1257 %    <=>     exchange two channels (e.g. red<=>blue)
1258 %    =>      transfer a channel to another (e.g. red=>green)
1259 %    ,       separate channel operations (e.g. red, green)
1260 %    |       read channels from next input image (e.g. red | green)
1261 %    ;       write channels to next output image (e.g. red; green; blue)
1262 %
1263 %  A channel without a operation symbol implies extract. For example, to create
1264 %  3 grayscale images from the red, green, and blue channels of an image, use:
1265 %
1266 %    -channel-fx "red; green; blue"
1267 %
1268 %  The format of the MagickChannelFxImage method is:
1269 %
1270 %      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1271 %
1272 %  A description of each parameter follows:
1273 %
1274 %    o wand: the magick wand.
1275 %
1276 %    o expression: the expression.
1277 %
1278 */
MagickChannelFxImage(MagickWand * wand,const char * expression)1279 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1280   const char *expression)
1281 {
1282   Image
1283     *fx_image;
1284 
1285   assert(wand != (MagickWand *) NULL);
1286   assert(wand->signature == MagickWandSignature);
1287   if (wand->debug != MagickFalse)
1288     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1289   if (wand->images == (Image *) NULL)
1290     return((MagickWand *) NULL);
1291   fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1292   if (fx_image == (Image *) NULL)
1293     return((MagickWand *) NULL);
1294   return(CloneMagickWandFromImages(wand,fx_image));
1295 }
1296 
1297 /*
1298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1299 %                                                                             %
1300 %                                                                             %
1301 %                                                                             %
1302 %   M a g i c k C h a r c o a l I m a g e                                     %
1303 %                                                                             %
1304 %                                                                             %
1305 %                                                                             %
1306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1307 %
1308 %  MagickCharcoalImage() simulates a charcoal drawing.
1309 %
1310 %  The format of the MagickCharcoalImage method is:
1311 %
1312 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1313 %        const double radius,const double sigma)
1314 %
1315 %  A description of each parameter follows:
1316 %
1317 %    o wand: the magick wand.
1318 %
1319 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1320 %      pixel.
1321 %
1322 %    o sigma: the standard deviation of the Gaussian, in pixels.
1323 %
1324 */
MagickCharcoalImage(MagickWand * wand,const double radius,const double sigma)1325 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1326   const double radius,const double sigma)
1327 {
1328   Image
1329     *charcoal_image;
1330 
1331   assert(wand != (MagickWand *) NULL);
1332   assert(wand->signature == MagickWandSignature);
1333   if (wand->debug != MagickFalse)
1334     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1335   if (wand->images == (Image *) NULL)
1336     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1337   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1338   if (charcoal_image == (Image *) NULL)
1339     return(MagickFalse);
1340   ReplaceImageInList(&wand->images,charcoal_image);
1341   return(MagickTrue);
1342 }
1343 
1344 /*
1345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1346 %                                                                             %
1347 %                                                                             %
1348 %                                                                             %
1349 %   M a g i c k C h o p I m a g e                                             %
1350 %                                                                             %
1351 %                                                                             %
1352 %                                                                             %
1353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1354 %
1355 %  MagickChopImage() removes a region of an image and collapses the image to
1356 %  occupy the removed portion
1357 %
1358 %  The format of the MagickChopImage method is:
1359 %
1360 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1361 %        const size_t width,const size_t height,const ssize_t x,
1362 %        const ssize_t y)
1363 %
1364 %  A description of each parameter follows:
1365 %
1366 %    o wand: the magick wand.
1367 %
1368 %    o width: the region width.
1369 %
1370 %    o height: the region height.
1371 %
1372 %    o x: the region x offset.
1373 %
1374 %    o y: the region y offset.
1375 %
1376 %
1377 */
MagickChopImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)1378 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1379   const size_t width,const size_t height,const ssize_t x,
1380   const ssize_t y)
1381 {
1382   Image
1383     *chop_image;
1384 
1385   RectangleInfo
1386     chop;
1387 
1388   assert(wand != (MagickWand *) NULL);
1389   assert(wand->signature == MagickWandSignature);
1390   if (wand->debug != MagickFalse)
1391     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1392   if (wand->images == (Image *) NULL)
1393     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1394   chop.width=width;
1395   chop.height=height;
1396   chop.x=x;
1397   chop.y=y;
1398   chop_image=ChopImage(wand->images,&chop,wand->exception);
1399   if (chop_image == (Image *) NULL)
1400     return(MagickFalse);
1401   ReplaceImageInList(&wand->images,chop_image);
1402   return(MagickTrue);
1403 }
1404 
1405 /*
1406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1407 %                                                                             %
1408 %                                                                             %
1409 %                                                                             %
1410 %   M a g i c k C L A H E I m a g e                                           %
1411 %                                                                             %
1412 %                                                                             %
1413 %                                                                             %
1414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1415 %
1416 %  MagickCLAHEImage() is a variant of adaptive histogram equalization in which
1417 %  the contrast amplification is limited, so as to reduce this problem of noise
1418 %  amplification.
1419 %
1420 %  The format of the CLAHEImage method is:
1421 %
1422 %      MagickBooleanType MagickCLAHEImage(MagickWand *wand,const size_t width,
1423 %        const size_t height,const double number_bins,const double clip_limit)
1424 %
1425 %  A description of each parameter follows:
1426 %
1427 %    o wand: the magick wand.
1428 %
1429 %    o width: the width of the tile divisions to use in horizontal direction.
1430 %
1431 %    o height: the height of the tile divisions to use in vertical direction.
1432 %
1433 %    o number_bins: number of bins for histogram ("dynamic range").
1434 %
1435 %    o clip_limit: contrast limit for localised changes in contrast. A limit
1436 %      less than 1 results in standard non-contrast limited AHE.
1437 %
1438 */
MagickCLAHEImage(MagickWand * wand,const size_t width,const size_t height,const double number_bins,const double clip_limit)1439 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand,
1440   const size_t width,const size_t height,const double number_bins,
1441   const double clip_limit)
1442 {
1443   MagickBooleanType
1444     status;
1445 
1446   assert(wand != (MagickWand *) NULL);
1447   assert(wand->signature == MagickWandSignature);
1448   if (wand->debug != MagickFalse)
1449     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1450   if (wand->images == (Image *) NULL)
1451     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1452   status=CLAHEImage(wand->images,width,height,(size_t) number_bins,clip_limit,
1453     wand->exception);
1454   return(status);
1455 }
1456 
1457 /*
1458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1459 %                                                                             %
1460 %                                                                             %
1461 %                                                                             %
1462 %   M a g i c k C l a m p I m a g e                                           %
1463 %                                                                             %
1464 %                                                                             %
1465 %                                                                             %
1466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1467 %
1468 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1469 %
1470 %  The format of the MagickClampImage method is:
1471 %
1472 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1473 %
1474 %  A description of each parameter follows:
1475 %
1476 %    o wand: the magick wand.
1477 %
1478 %    o channel: the channel.
1479 %
1480 */
MagickClampImage(MagickWand * wand)1481 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1482 {
1483   assert(wand != (MagickWand *) NULL);
1484   assert(wand->signature == MagickWandSignature);
1485   if (wand->debug != MagickFalse)
1486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1487   if (wand->images == (Image *) NULL)
1488     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1489   return(ClampImage(wand->images,wand->exception));
1490 }
1491 
1492 /*
1493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1494 %                                                                             %
1495 %                                                                             %
1496 %                                                                             %
1497 %   M a g i c k C l i p I m a g e                                             %
1498 %                                                                             %
1499 %                                                                             %
1500 %                                                                             %
1501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1502 %
1503 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1504 %  present.
1505 %
1506 %  The format of the MagickClipImage method is:
1507 %
1508 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1509 %
1510 %  A description of each parameter follows:
1511 %
1512 %    o wand: the magick wand.
1513 %
1514 */
MagickClipImage(MagickWand * wand)1515 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1516 {
1517   MagickBooleanType
1518     status;
1519 
1520   assert(wand != (MagickWand *) NULL);
1521   assert(wand->signature == MagickWandSignature);
1522   if (wand->debug != MagickFalse)
1523     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1524   if (wand->images == (Image *) NULL)
1525     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1526   status=ClipImage(wand->images,wand->exception);
1527   return(status);
1528 }
1529 
1530 /*
1531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1532 %                                                                             %
1533 %                                                                             %
1534 %                                                                             %
1535 %   M a g i c k C l i p I m a g e P a t h                                     %
1536 %                                                                             %
1537 %                                                                             %
1538 %                                                                             %
1539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1540 %
1541 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1542 %  present. Later operations take effect inside the path.  Id may be a number
1543 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1544 %  path.
1545 %
1546 %  The format of the MagickClipImagePath method is:
1547 %
1548 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1549 %        const char *pathname,const MagickBooleanType inside)
1550 %
1551 %  A description of each parameter follows:
1552 %
1553 %    o wand: the magick wand.
1554 %
1555 %    o pathname: name of clipping path resource. If name is preceded by #, use
1556 %      clipping path numbered by name.
1557 %
1558 %    o inside: if non-zero, later operations take effect inside clipping path.
1559 %      Otherwise later operations take effect outside clipping path.
1560 %
1561 */
MagickClipImagePath(MagickWand * wand,const char * pathname,const MagickBooleanType inside)1562 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1563   const char *pathname,const MagickBooleanType inside)
1564 {
1565   MagickBooleanType
1566     status;
1567 
1568   assert(wand != (MagickWand *) NULL);
1569   assert(wand->signature == MagickWandSignature);
1570   if (wand->debug != MagickFalse)
1571     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1572   if (wand->images == (Image *) NULL)
1573     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1574   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1575   return(status);
1576 }
1577 
1578 /*
1579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1580 %                                                                             %
1581 %                                                                             %
1582 %                                                                             %
1583 %   M a g i c k C l u t I m a g e                                             %
1584 %                                                                             %
1585 %                                                                             %
1586 %                                                                             %
1587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1588 %
1589 %  MagickClutImage() replaces colors in the image from a color lookup table.
1590 %
1591 %  The format of the MagickClutImage method is:
1592 %
1593 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1594 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1595 %
1596 %  A description of each parameter follows:
1597 %
1598 %    o wand: the magick wand.
1599 %
1600 %    o clut_image: the clut image.
1601 %
1602 %    o method: the pixel interpolation method.
1603 %
1604 */
MagickClutImage(MagickWand * wand,const MagickWand * clut_wand,const PixelInterpolateMethod method)1605 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1606   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1607 {
1608   MagickBooleanType
1609     status;
1610 
1611   assert(wand != (MagickWand *) NULL);
1612   assert(wand->signature == MagickWandSignature);
1613   if (wand->debug != MagickFalse)
1614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1615   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1616     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1617   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1618   return(status);
1619 }
1620 
1621 /*
1622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1623 %                                                                             %
1624 %                                                                             %
1625 %                                                                             %
1626 %   M a g i c k C o a l e s c e I m a g e s                                   %
1627 %                                                                             %
1628 %                                                                             %
1629 %                                                                             %
1630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1631 %
1632 %  MagickCoalesceImages() composites a set of images while respecting any page
1633 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1634 %  typically start with an image background and each subsequent image
1635 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1636 %  where each image in the sequence is the same size as the first and
1637 %  composited with the next image in the sequence.
1638 %
1639 %  The format of the MagickCoalesceImages method is:
1640 %
1641 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1642 %
1643 %  A description of each parameter follows:
1644 %
1645 %    o wand: the magick wand.
1646 %
1647 */
MagickCoalesceImages(MagickWand * wand)1648 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1649 {
1650   Image
1651     *coalesce_image;
1652 
1653   assert(wand != (MagickWand *) NULL);
1654   assert(wand->signature == MagickWandSignature);
1655   if (wand->debug != MagickFalse)
1656     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1657   if (wand->images == (Image *) NULL)
1658     return((MagickWand *) NULL);
1659   coalesce_image=CoalesceImages(wand->images,wand->exception);
1660   if (coalesce_image == (Image *) NULL)
1661     return((MagickWand *) NULL);
1662   return(CloneMagickWandFromImages(wand,coalesce_image));
1663 }
1664 
1665 /*
1666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1667 %                                                                             %
1668 %                                                                             %
1669 %                                                                             %
1670 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1671 %                                                                             %
1672 %                                                                             %
1673 %                                                                             %
1674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1675 %
1676 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1677 %  Collection (CCC) file which solely contains one or more color corrections
1678 %  and applies the color correction to the image.  Here is a sample CCC file:
1679 %
1680 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1681 %          <ColorCorrection id="cc03345">
1682 %                <SOPNode>
1683 %                     <Slope> 0.9 1.2 0.5 </Slope>
1684 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1685 %                     <Power> 1.0 0.8 1.5 </Power>
1686 %                </SOPNode>
1687 %                <SATNode>
1688 %                     <Saturation> 0.85 </Saturation>
1689 %                </SATNode>
1690 %          </ColorCorrection>
1691 %    </ColorCorrectionCollection>
1692 %
1693 %  which includes the offset, slope, and power for each of the RGB channels
1694 %  as well as the saturation.
1695 %
1696 %  The format of the MagickColorDecisionListImage method is:
1697 %
1698 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1699 %        const char *color_correction_collection)
1700 %
1701 %  A description of each parameter follows:
1702 %
1703 %    o wand: the magick wand.
1704 %
1705 %    o color_correction_collection: the color correction collection in XML.
1706 %
1707 */
MagickColorDecisionListImage(MagickWand * wand,const char * color_correction_collection)1708 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1709   const char *color_correction_collection)
1710 {
1711   MagickBooleanType
1712     status;
1713 
1714   assert(wand != (MagickWand *) NULL);
1715   assert(wand->signature == MagickWandSignature);
1716   if (wand->debug != MagickFalse)
1717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1718   if (wand->images == (Image *) NULL)
1719     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1720   status=ColorDecisionListImage(wand->images,color_correction_collection,
1721     wand->exception);
1722   return(status);
1723 }
1724 
1725 /*
1726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1727 %                                                                             %
1728 %                                                                             %
1729 %                                                                             %
1730 %   M a g i c k C o l o r i z e I m a g e                                     %
1731 %                                                                             %
1732 %                                                                             %
1733 %                                                                             %
1734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1735 %
1736 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1737 %
1738 %  The format of the MagickColorizeImage method is:
1739 %
1740 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1741 %        const PixelWand *colorize,const PixelWand *blend)
1742 %
1743 %  A description of each parameter follows:
1744 %
1745 %    o wand: the magick wand.
1746 %
1747 %    o colorize: the colorize pixel wand.
1748 %
1749 %    o alpha: the alpha pixel wand.
1750 %
1751 */
MagickColorizeImage(MagickWand * wand,const PixelWand * colorize,const PixelWand * blend)1752 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1753   const PixelWand *colorize,const PixelWand *blend)
1754 {
1755   char
1756     percent_blend[MagickPathExtent];
1757 
1758   Image
1759     *colorize_image;
1760 
1761   PixelInfo
1762     target;
1763 
1764   assert(wand != (MagickWand *) NULL);
1765   assert(wand->signature == MagickWandSignature);
1766   if (wand->debug != MagickFalse)
1767     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1768   if (wand->images == (Image *) NULL)
1769     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1770   GetPixelInfo(wand->images,&target);
1771   if (target.colorspace != CMYKColorspace)
1772     (void) FormatLocaleString(percent_blend,MagickPathExtent,
1773       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1774       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1775       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1776       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1777       PixelGetAlphaQuantum(blend)));
1778   else
1779     (void) FormatLocaleString(percent_blend,MagickPathExtent,
1780       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1781       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1782       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1783       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1784       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1785       PixelGetAlphaQuantum(blend)));
1786   target=PixelGetPixel(colorize);
1787   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1788     wand->exception);
1789   if (colorize_image == (Image *) NULL)
1790     return(MagickFalse);
1791   ReplaceImageInList(&wand->images,colorize_image);
1792   return(MagickTrue);
1793 }
1794 
1795 /*
1796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1797 %                                                                             %
1798 %                                                                             %
1799 %                                                                             %
1800 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1801 %                                                                             %
1802 %                                                                             %
1803 %                                                                             %
1804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1805 %
1806 %  MagickColorMatrixImage() apply color transformation to an image. The method
1807 %  permits saturation changes, hue rotation, luminance to alpha, and various
1808 %  other effects.  Although variable-sized transformation matrices can be used,
1809 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1810 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1811 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1812 %  and offsets are normalized (divide Flash offset by 255).
1813 %
1814 %  The format of the MagickColorMatrixImage method is:
1815 %
1816 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1817 %        const KernelInfo *color_matrix)
1818 %
1819 %  A description of each parameter follows:
1820 %
1821 %    o wand: the magick wand.
1822 %
1823 %    o color_matrix:  the color matrix.
1824 %
1825 */
MagickColorMatrixImage(MagickWand * wand,const KernelInfo * color_matrix)1826 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1827   const KernelInfo *color_matrix)
1828 {
1829   Image
1830     *color_image;
1831 
1832   assert(wand != (MagickWand *) NULL);
1833   assert(wand->signature == MagickWandSignature);
1834   if (wand->debug != MagickFalse)
1835     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1836   if (color_matrix == (const KernelInfo *) NULL)
1837     return(MagickFalse);
1838   if (wand->images == (Image *) NULL)
1839     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1840   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1841   if (color_image == (Image *) NULL)
1842     return(MagickFalse);
1843   ReplaceImageInList(&wand->images,color_image);
1844   return(MagickTrue);
1845 }
1846 
1847 /*
1848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1849 %                                                                             %
1850 %                                                                             %
1851 %                                                                             %
1852 %   M a g i c k C o l o r T h r e s h o l d I m a g e                         %
1853 %                                                                             %
1854 %                                                                             %
1855 %                                                                             %
1856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1857 %
1858 %  MagickColorThresholdImage() forces all pixels in the color range to white
1859 %  otherwise black.
1860 %
1861 %  The format of the MagickWhiteThresholdImage method is:
1862 %
1863 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
1864 %        const PixelWand *start_color,const PixelWand *stop_color)
1865 %
1866 %  A description of each parameter follows:
1867 %
1868 %    o wand: the magick wand.
1869 %
1870 %    o start-color: the start color pixel wand.
1871 %
1872 %    o stop-color: the stop color pixel wand.
1873 %
1874 */
MagickColorThresholdImage(MagickWand * wand,const PixelWand * start_color,const PixelWand * stop_color)1875 WandExport MagickBooleanType MagickColorThresholdImage(MagickWand *wand,
1876   const PixelWand *start_color,const PixelWand *stop_color)
1877 {
1878   PixelInfo
1879     start,
1880     stop;
1881 
1882   assert(wand != (MagickWand *) NULL);
1883   assert(wand->signature == MagickWandSignature);
1884   if (wand->debug != MagickFalse)
1885     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1886   if (wand->images == (Image *) NULL)
1887     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1888   PixelGetMagickColor(start_color,&start);
1889   PixelGetMagickColor(stop_color,&stop);
1890   return(ColorThresholdImage(wand->images,&start,&stop,wand->exception));
1891 }
1892 
1893 /*
1894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1895 %                                                                             %
1896 %                                                                             %
1897 %                                                                             %
1898 %   M a g i c k C o m b i n e I m a g e s                                     %
1899 %                                                                             %
1900 %                                                                             %
1901 %                                                                             %
1902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1903 %
1904 %  MagickCombineImages() combines one or more images into a single image.  The
1905 %  grayscale value of the pixels of each image in the sequence is assigned in
1906 %  order to the specified  hannels of the combined image.   The typical
1907 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1908 %
1909 %  The format of the MagickCombineImages method is:
1910 %
1911 %      MagickWand *MagickCombineImages(MagickWand *wand,
1912 %        const ColorspaceType colorspace)
1913 %
1914 %  A description of each parameter follows:
1915 %
1916 %    o wand: the magick wand.
1917 %
1918 %    o colorspace: the colorspace.
1919 %
1920 */
MagickCombineImages(MagickWand * wand,const ColorspaceType colorspace)1921 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1922   const ColorspaceType colorspace)
1923 {
1924   Image
1925     *combine_image;
1926 
1927   assert(wand != (MagickWand *) NULL);
1928   assert(wand->signature == MagickWandSignature);
1929   if (wand->debug != MagickFalse)
1930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1931   if (wand->images == (Image *) NULL)
1932     return((MagickWand *) NULL);
1933   combine_image=CombineImages(wand->images,colorspace,wand->exception);
1934   if (combine_image == (Image *) NULL)
1935     return((MagickWand *) NULL);
1936   return(CloneMagickWandFromImages(wand,combine_image));
1937 }
1938 
1939 /*
1940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1941 %                                                                             %
1942 %                                                                             %
1943 %                                                                             %
1944 %   M a g i c k C o m m e n t I m a g e                                       %
1945 %                                                                             %
1946 %                                                                             %
1947 %                                                                             %
1948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1949 %
1950 %  MagickCommentImage() adds a comment to your image.
1951 %
1952 %  The format of the MagickCommentImage method is:
1953 %
1954 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1955 %        const char *comment)
1956 %
1957 %  A description of each parameter follows:
1958 %
1959 %    o wand: the magick wand.
1960 %
1961 %    o comment: the image comment.
1962 %
1963 */
MagickCommentImage(MagickWand * wand,const char * comment)1964 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1965   const char *comment)
1966 {
1967   MagickBooleanType
1968     status;
1969 
1970   assert(wand != (MagickWand *) NULL);
1971   assert(wand->signature == MagickWandSignature);
1972   if (wand->debug != MagickFalse)
1973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1974   if (wand->images == (Image *) NULL)
1975     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1976   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1977   return(status);
1978 }
1979 
1980 /*
1981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1982 %                                                                             %
1983 %                                                                             %
1984 %                                                                             %
1985 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1986 %                                                                             %
1987 %                                                                             %
1988 %                                                                             %
1989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1990 %
1991 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1992 %  and returns the maximum bounding region of any pixel differences it
1993 %  discovers.
1994 %
1995 %  The format of the MagickCompareImagesLayers method is:
1996 %
1997 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1998 %        const LayerMethod method)
1999 %
2000 %  A description of each parameter follows:
2001 %
2002 %    o wand: the magick wand.
2003 %
2004 %    o method: the compare method.
2005 %
2006 */
MagickCompareImagesLayers(MagickWand * wand,const LayerMethod method)2007 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
2008   const LayerMethod method)
2009 {
2010   Image
2011     *layers_image;
2012 
2013   assert(wand != (MagickWand *) NULL);
2014   assert(wand->signature == MagickWandSignature);
2015   if (wand->debug != MagickFalse)
2016     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2017   if (wand->images == (Image *) NULL)
2018     return((MagickWand *) NULL);
2019   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
2020   if (layers_image == (Image *) NULL)
2021     return((MagickWand *) NULL);
2022   return(CloneMagickWandFromImages(wand,layers_image));
2023 }
2024 
2025 /*
2026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2027 %                                                                             %
2028 %                                                                             %
2029 %                                                                             %
2030 %   M a g i c k C o m p a r e I m a g e s                                     %
2031 %                                                                             %
2032 %                                                                             %
2033 %                                                                             %
2034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2035 %
2036 %  MagickCompareImages() compares an image to a reconstructed image and returns
2037 %  the specified difference image.
2038 %
2039 %  The format of the MagickCompareImages method is:
2040 %
2041 %      MagickWand *MagickCompareImages(MagickWand *wand,
2042 %        const MagickWand *reference,const MetricType metric,
2043 %        double *distortion)
2044 %
2045 %  A description of each parameter follows:
2046 %
2047 %    o wand: the magick wand.
2048 %
2049 %    o reference: the reference wand.
2050 %
2051 %    o metric: the metric.
2052 %
2053 %    o distortion: the computed distortion between the images.
2054 %
2055 */
MagickCompareImages(MagickWand * wand,const MagickWand * reference,const MetricType metric,double * distortion)2056 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
2057   const MagickWand *reference,const MetricType metric,double *distortion)
2058 {
2059   Image
2060     *compare_image;
2061 
2062 
2063   assert(wand != (MagickWand *) NULL);
2064   assert(wand->signature == MagickWandSignature);
2065   if (wand->debug != MagickFalse)
2066     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2067   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
2068     {
2069       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
2070         "ContainsNoImages","`%s'",wand->name);
2071       return((MagickWand *) NULL);
2072     }
2073   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
2074     wand->exception);
2075   if (compare_image == (Image *) NULL)
2076     return((MagickWand *) NULL);
2077   return(CloneMagickWandFromImages(wand,compare_image));
2078 }
2079 
2080 /*
2081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2082 %                                                                             %
2083 %                                                                             %
2084 %                                                                             %
2085 %   M a g i c k C o m p l e x I m a g e s                                     %
2086 %                                                                             %
2087 %                                                                             %
2088 %                                                                             %
2089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2090 %
2091 %  MagickComplexImages() performs complex mathematics on an image sequence.
2092 %
2093 %  The format of the MagickComplexImages method is:
2094 %
2095 %      MagickWand *MagickComplexImages(MagickWand *wand,
2096 %        const ComplexOperator op)
2097 %
2098 %  A description of each parameter follows:
2099 %
2100 %    o wand: the magick wand.
2101 %
2102 %    o op: A complex operator. Choose from AddComplexOperator,
2103 %      ConjugateComplexOperator,DivideComplexOperator,
2104 %      MagnitudePhaseComplexOperator,MultiplyComplexOperator,
2105 %      RealImaginaryComplexOperator, SubtractComplexOperator.
2106 %
2107 */
MagickComplexImages(MagickWand * wand,const ComplexOperator op)2108 WandExport MagickWand *MagickComplexImages(MagickWand *wand,
2109   const ComplexOperator op)
2110 {
2111   Image
2112     *complex_image;
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     return((MagickWand *) NULL);
2120   complex_image=ComplexImages(wand->images,op,wand->exception);
2121   if (complex_image == (Image *) NULL)
2122     return((MagickWand *) NULL);
2123   return(CloneMagickWandFromImages(wand,complex_image));
2124 }
2125 
2126 /*
2127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2128 %                                                                             %
2129 %                                                                             %
2130 %                                                                             %
2131 %   M a g i c k C o m p o s i t e I m a g e                                   %
2132 %                                                                             %
2133 %                                                                             %
2134 %                                                                             %
2135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2136 %
2137 %  MagickCompositeImage() composite one image onto another at the specified
2138 %  offset.
2139 %
2140 %  The format of the MagickCompositeImage method is:
2141 %
2142 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
2143 %        const MagickWand *source_wand,const CompositeOperator compose,
2144 %        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2145 %
2146 %  A description of each parameter follows:
2147 %
2148 %    o wand: the magick wand holding the destination images
2149 %
2150 %    o source_image: the magick wand holding source image.
2151 %
2152 %    o compose: This operator affects how the composite is applied to the
2153 %      image.  The default is Over.  These are some of the compose methods
2154 %      availble.
2155 %
2156 %        OverCompositeOp       InCompositeOp         OutCompositeOp
2157 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
2158 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
2159 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
2160 %        DisplaceCompositeOp
2161 %
2162 %    o clip_to_self: set to MagickTrue to limit composition to area composed.
2163 %
2164 %    o x: the column offset of the composited image.
2165 %
2166 %    o y: the row offset of the composited image.
2167 %
2168 */
MagickCompositeImage(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)2169 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
2170   const MagickWand *source_wand,const CompositeOperator compose,
2171   const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
2172 {
2173   MagickBooleanType
2174     status;
2175 
2176   assert(wand != (MagickWand *) NULL);
2177   assert(wand->signature == MagickWandSignature);
2178   if (wand->debug != MagickFalse)
2179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2180   if ((wand->images == (Image *) NULL) ||
2181       (source_wand->images == (Image *) NULL))
2182     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2183   status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
2184     x,y,wand->exception);
2185   return(status);
2186 }
2187 
2188 /*
2189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2190 %                                                                             %
2191 %                                                                             %
2192 %                                                                             %
2193 %   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                     %
2194 %                                                                             %
2195 %                                                                             %
2196 %                                                                             %
2197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2198 %
2199 %  MagickCompositeImageGravity() composite one image onto another using the
2200 %  specified gravity.
2201 %
2202 %  The format of the MagickCompositeImageGravity method is:
2203 %
2204 %      MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2205 %        const MagickWand *source_wand,const CompositeOperator compose,
2206 %        const GravityType gravity)
2207 %
2208 %  A description of each parameter follows:
2209 %
2210 %    o wand: the magick wand holding the destination images
2211 %
2212 %    o source_image: the magick wand holding source image.
2213 %
2214 %    o compose: This operator affects how the composite is applied to the
2215 %      image.  The default is Over.  These are some of the compose methods
2216 %      availble.
2217 %
2218 %        OverCompositeOp       InCompositeOp         OutCompositeOp
2219 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
2220 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
2221 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
2222 %        DisplaceCompositeOp
2223 %
2224 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
2225 %               NorthEastGravity, WestGravity, CenterGravity,
2226 %               EastGravity, SouthWestGravity, SouthGravity,
2227 %               SouthEastGravity)
2228 %
2229 */
MagickCompositeImageGravity(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const GravityType gravity)2230 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2231   const MagickWand *source_wand,const CompositeOperator compose,
2232   const GravityType gravity)
2233 {
2234   MagickBooleanType
2235     status;
2236 
2237   RectangleInfo
2238     geometry;
2239 
2240   assert(wand != (MagickWand *) NULL);
2241   assert(wand->signature == MagickWandSignature);
2242   if (wand->debug != MagickFalse)
2243     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2244   if ((wand->images == (Image *) NULL) ||
2245       (source_wand->images == (Image *) NULL))
2246     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2247   SetGeometry(source_wand->images,&geometry);
2248   GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
2249     &geometry);
2250   status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
2251     geometry.x,geometry.y,wand->exception);
2252   return(status);
2253 }
2254 
2255 /*
2256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2257 %                                                                             %
2258 %                                                                             %
2259 %                                                                             %
2260 %   M a g i c k C o m p o s i t e L a y e r s                                 %
2261 %                                                                             %
2262 %                                                                             %
2263 %                                                                             %
2264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2265 %
2266 %  MagickCompositeLayers() composite the images in the source wand over the
2267 %  images in the destination wand in sequence, starting with the current
2268 %  image in both lists.
2269 %
2270 %  Each layer from the two image lists are composted together until the end of
2271 %  one of the image lists is reached.  The offset of each composition is also
2272 %  adjusted to match the virtual canvas offsets of each layer. As such the
2273 %  given offset is relative to the virtual canvas, and not the actual image.
2274 %
2275 %  Composition uses given x and y offsets, as the 'origin' location of the
2276 %  source images virtual canvas (not the real image) allowing you to compose a
2277 %  list of 'layer images' into the destiantioni images.  This makes it well
2278 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
2279 %  Animations' onto a static or other 'Coaleased Animation' destination image
2280 %  list.  GIF disposal handling is not looked at.
2281 %
2282 %  Special case:- If one of the image sequences is the last image (just a
2283 %  single image remaining), that image is repeatally composed with all the
2284 %  images in the other image list.  Either the source or destination lists may
2285 %  be the single image, for this situation.
2286 %
2287 %  In the case of a single destination image (or last image given), that image
2288 %  will ve cloned to match the number of images remaining in the source image
2289 %  list.
2290 %
2291 %  This is equivelent to the "-layer Composite" Shell API operator.
2292 %
2293 %  The format of the MagickCompositeLayers method is:
2294 %
2295 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2296 %        const MagickWand *source_wand, const CompositeOperator compose,
2297 %        const ssize_t x,const ssize_t y)
2298 %
2299 %  A description of each parameter follows:
2300 %
2301 %    o wand: the magick wand holding destaintion images
2302 %
2303 %    o source_wand: the wand holding the source images
2304 %
2305 %    o compose, x, y:  composition arguments
2306 %
2307 */
MagickCompositeLayers(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const ssize_t x,const ssize_t y)2308 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2309   const MagickWand *source_wand,const CompositeOperator compose,
2310   const ssize_t x,const ssize_t y)
2311 {
2312   MagickBooleanType
2313     status;
2314 
2315   assert(wand != (MagickWand *) NULL);
2316   assert(wand->signature == MagickWandSignature);
2317   if (wand->debug != MagickFalse)
2318     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2319   if ((wand->images == (Image *) NULL) ||
2320       (source_wand->images == (Image *) NULL))
2321     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2322   CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2323   status=MagickTrue;  /* FUTURE: determine status from exceptions */
2324   return(status);
2325 }
2326 
2327 /*
2328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2329 %                                                                             %
2330 %                                                                             %
2331 %                                                                             %
2332 %   M a g i c k C o n n e c t e d C o m p o n e n t s I m a g e               %
2333 %                                                                             %
2334 %                                                                             %
2335 %                                                                             %
2336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2337 %
2338 %  MagickConnectedComponentsImage() returns the connected-components of the
2339 %  image uniquely labeled.  The returned connected components image colors
2340 %  member defines the number of unique objects.  Choose from 4 or 8-way
2341 %  connectivity.
2342 %
2343 %  The format of the MagickConnectedComponentsImage method is:
2344 %
2345 %      MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2346 %        const size_t connectivity,CCObjectInfo **objects)
2347 %
2348 %  A description of each parameter follows:
2349 %
2350 %    o wand: the magick wand.
2351 %
2352 %    o connectivity: how many neighbors to visit, choose from 4 or 8.
2353 %
2354 %    o objects: return the attributes of each unique object.
2355 %
2356 */
MagickConnectedComponentsImage(MagickWand * wand,const size_t connectivity,CCObjectInfo ** objects)2357 WandExport MagickBooleanType MagickConnectedComponentsImage(MagickWand *wand,
2358   const size_t connectivity,CCObjectInfo **objects)
2359 {
2360   Image
2361     *connected_components_image;
2362 
2363   assert(wand != (MagickWand *) NULL);
2364   assert(wand->signature == MagickWandSignature);
2365   if (wand->debug != MagickFalse)
2366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2367   if (wand->images == (Image *) NULL)
2368     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2369   connected_components_image=ConnectedComponentsImage(wand->images,connectivity,
2370     objects,wand->exception);
2371   if (connected_components_image == (Image *) NULL)
2372     return(MagickFalse);
2373   ReplaceImageInList(&wand->images,connected_components_image);
2374   return(MagickTrue);
2375 }
2376 
2377 /*
2378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2379 %                                                                             %
2380 %                                                                             %
2381 %                                                                             %
2382 %   M a g i c k C o n t r a s t I m a g e                                     %
2383 %                                                                             %
2384 %                                                                             %
2385 %                                                                             %
2386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2387 %
2388 %  MagickContrastImage() enhances the intensity differences between the lighter
2389 %  and darker elements of the image.  Set sharpen to a value other than 0 to
2390 %  increase the image contrast otherwise the contrast is reduced.
2391 %
2392 %  The format of the MagickContrastImage method is:
2393 %
2394 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
2395 %        const MagickBooleanType sharpen)
2396 %
2397 %  A description of each parameter follows:
2398 %
2399 %    o wand: the magick wand.
2400 %
2401 %    o sharpen: Increase or decrease image contrast.
2402 %
2403 %
2404 */
MagickContrastImage(MagickWand * wand,const MagickBooleanType sharpen)2405 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2406   const MagickBooleanType sharpen)
2407 {
2408   MagickBooleanType
2409     status;
2410 
2411   assert(wand != (MagickWand *) NULL);
2412   assert(wand->signature == MagickWandSignature);
2413   if (wand->debug != MagickFalse)
2414     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2415   if (wand->images == (Image *) NULL)
2416     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2417   status=ContrastImage(wand->images,sharpen,wand->exception);
2418   return(status);
2419 }
2420 
2421 /*
2422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2423 %                                                                             %
2424 %                                                                             %
2425 %                                                                             %
2426 %   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                       %
2427 %                                                                             %
2428 %                                                                             %
2429 %                                                                             %
2430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2431 %
2432 %  MagickContrastStretchImage() enhances the contrast of a color image by
2433 %  adjusting the pixels color to span the entire range of colors available.
2434 %  You can also reduce the influence of a particular channel with a gamma
2435 %  value of 0.
2436 %
2437 %  The format of the MagickContrastStretchImage method is:
2438 %
2439 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2440 %        const double black_point,const double white_point)
2441 %
2442 %  A description of each parameter follows:
2443 %
2444 %    o wand: the magick wand.
2445 %
2446 %    o black_point: the black point.
2447 %
2448 %    o white_point: the white point.
2449 %
2450 */
MagickContrastStretchImage(MagickWand * wand,const double black_point,const double white_point)2451 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2452   const double black_point,const double white_point)
2453 {
2454   MagickBooleanType
2455     status;
2456 
2457   assert(wand != (MagickWand *) NULL);
2458   assert(wand->signature == MagickWandSignature);
2459   if (wand->debug != MagickFalse)
2460     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2461   if (wand->images == (Image *) NULL)
2462     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2463   status=ContrastStretchImage(wand->images,black_point,white_point,
2464     wand->exception);
2465   return(status);
2466 }
2467 
2468 /*
2469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2470 %                                                                             %
2471 %                                                                             %
2472 %                                                                             %
2473 %   M a g i c k C o n v o l v e I m a g e                                     %
2474 %                                                                             %
2475 %                                                                             %
2476 %                                                                             %
2477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2478 %
2479 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2480 %
2481 %  The format of the MagickConvolveImage method is:
2482 %
2483 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2484 %        const KernelInfo *kernel)
2485 %
2486 %  A description of each parameter follows:
2487 %
2488 %    o wand: the magick wand.
2489 %
2490 %    o kernel: An array of doubles representing the convolution kernel.
2491 %
2492 */
MagickConvolveImage(MagickWand * wand,const KernelInfo * kernel)2493 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2494   const KernelInfo *kernel)
2495 {
2496   Image
2497     *filter_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 (kernel == (const KernelInfo *) NULL)
2504     return(MagickFalse);
2505   if (wand->images == (Image *) NULL)
2506     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2507   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2508   if (filter_image == (Image *) NULL)
2509     return(MagickFalse);
2510   ReplaceImageInList(&wand->images,filter_image);
2511   return(MagickTrue);
2512 }
2513 
2514 /*
2515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2516 %                                                                             %
2517 %                                                                             %
2518 %                                                                             %
2519 %   M a g i c k C r o p I m a g e                                             %
2520 %                                                                             %
2521 %                                                                             %
2522 %                                                                             %
2523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2524 %
2525 %  MagickCropImage() extracts a region of the image.
2526 %
2527 %  The format of the MagickCropImage method is:
2528 %
2529 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2530 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2531 %
2532 %  A description of each parameter follows:
2533 %
2534 %    o wand: the magick wand.
2535 %
2536 %    o width: the region width.
2537 %
2538 %    o height: the region height.
2539 %
2540 %    o x: the region x-offset.
2541 %
2542 %    o y: the region y-offset.
2543 %
2544 */
MagickCropImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)2545 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2546   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2547 {
2548   Image
2549     *crop_image;
2550 
2551   RectangleInfo
2552     crop;
2553 
2554   assert(wand != (MagickWand *) NULL);
2555   assert(wand->signature == MagickWandSignature);
2556   if (wand->debug != MagickFalse)
2557     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2558   if (wand->images == (Image *) NULL)
2559     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2560   crop.width=width;
2561   crop.height=height;
2562   crop.x=x;
2563   crop.y=y;
2564   crop_image=CropImage(wand->images,&crop,wand->exception);
2565   if (crop_image == (Image *) NULL)
2566     return(MagickFalse);
2567   ReplaceImageInList(&wand->images,crop_image);
2568   return(MagickTrue);
2569 }
2570 
2571 /*
2572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2573 %                                                                             %
2574 %                                                                             %
2575 %                                                                             %
2576 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2577 %                                                                             %
2578 %                                                                             %
2579 %                                                                             %
2580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2581 %
2582 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2583 %  of positions.  If you cycle the colormap a number of times you can produce
2584 %  a psychodelic effect.
2585 %
2586 %  The format of the MagickCycleColormapImage method is:
2587 %
2588 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2589 %        const ssize_t displace)
2590 %
2591 %  A description of each parameter follows:
2592 %
2593 %    o wand: the magick wand.
2594 %
2595 %    o pixel_wand: the pixel wand.
2596 %
2597 */
MagickCycleColormapImage(MagickWand * wand,const ssize_t displace)2598 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2599   const ssize_t displace)
2600 {
2601   MagickBooleanType
2602     status;
2603 
2604   assert(wand != (MagickWand *) NULL);
2605   assert(wand->signature == MagickWandSignature);
2606   if (wand->debug != MagickFalse)
2607     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2608   if (wand->images == (Image *) NULL)
2609     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2610   status=CycleColormapImage(wand->images,displace,wand->exception);
2611   return(status);
2612 }
2613 
2614 /*
2615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2616 %                                                                             %
2617 %                                                                             %
2618 %                                                                             %
2619 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2620 %                                                                             %
2621 %                                                                             %
2622 %                                                                             %
2623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2624 %
2625 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2626 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2627 %  The data can be char, short int, int, float, or double.  Float and double
2628 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2629 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2630 %  example, to create a 640x480 image from unsigned red-green-blue character
2631 %  data, use
2632 %
2633 %      MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2634 %
2635 %  The format of the MagickConstituteImage method is:
2636 %
2637 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2638 %        const size_t columns,const size_t rows,const char *map,
2639 %        const StorageType storage,void *pixels)
2640 %
2641 %  A description of each parameter follows:
2642 %
2643 %    o wand: the magick wand.
2644 %
2645 %    o columns: width in pixels of the image.
2646 %
2647 %    o rows: height in pixels of the image.
2648 %
2649 %    o map:  This string reflects the expected ordering of the pixel array.
2650 %      It can be any combination or order of R = red, G = green, B = blue,
2651 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2652 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2653 %      P = pad.
2654 %
2655 %    o storage: Define the data type of the pixels.  Float and double types are
2656 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2657 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2658 %      LongPixel, QuantumPixel, or ShortPixel.
2659 %
2660 %    o pixels: This array of values contain the pixel components as defined by
2661 %      map and type.  You must preallocate this array where the expected
2662 %      length varies depending on the values of width, height, map, and type.
2663 %
2664 %
2665 */
MagickConstituteImage(MagickWand * wand,const size_t columns,const size_t rows,const char * map,const StorageType storage,const void * pixels)2666 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2667   const size_t columns,const size_t rows,const char *map,
2668   const StorageType storage,const void *pixels)
2669 {
2670   Image
2671     *images;
2672 
2673   assert(wand != (MagickWand *) NULL);
2674   assert(wand->signature == MagickWandSignature);
2675   if (wand->debug != MagickFalse)
2676     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2677   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2678   if (images == (Image *) NULL)
2679     return(MagickFalse);
2680   return(InsertImageInWand(wand,images));
2681 }
2682 
2683 /*
2684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2685 %                                                                             %
2686 %                                                                             %
2687 %                                                                             %
2688 %   M a g i c k D e c i p h e r I m a g e                                     %
2689 %                                                                             %
2690 %                                                                             %
2691 %                                                                             %
2692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2693 %
2694 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2695 %
2696 %  The format of the MagickDecipherImage method is:
2697 %
2698 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2699 %        const char *passphrase)
2700 %
2701 %  A description of each parameter follows:
2702 %
2703 %    o wand: the magick wand.
2704 %
2705 %    o passphrase: the passphrase.
2706 %
2707 */
MagickDecipherImage(MagickWand * wand,const char * passphrase)2708 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2709   const char *passphrase)
2710 {
2711   assert(wand != (MagickWand *) NULL);
2712   assert(wand->signature == MagickWandSignature);
2713   if (wand->debug != MagickFalse)
2714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2715   if (wand->images == (Image *) NULL)
2716     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2717   return(DecipherImage(wand->images,passphrase,wand->exception));
2718 }
2719 
2720 /*
2721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2722 %                                                                             %
2723 %                                                                             %
2724 %                                                                             %
2725 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2726 %                                                                             %
2727 %                                                                             %
2728 %                                                                             %
2729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2730 %
2731 %  MagickDeconstructImages() compares each image with the next in a sequence
2732 %  and returns the maximum bounding region of any pixel differences it
2733 %  discovers.
2734 %
2735 %  The format of the MagickDeconstructImages method is:
2736 %
2737 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2738 %
2739 %  A description of each parameter follows:
2740 %
2741 %    o wand: the magick wand.
2742 %
2743 */
MagickDeconstructImages(MagickWand * wand)2744 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2745 {
2746   Image
2747     *deconstruct_image;
2748 
2749   assert(wand != (MagickWand *) NULL);
2750   assert(wand->signature == MagickWandSignature);
2751   if (wand->debug != MagickFalse)
2752     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2753   if (wand->images == (Image *) NULL)
2754     return((MagickWand *) NULL);
2755   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2756     wand->exception);
2757   if (deconstruct_image == (Image *) NULL)
2758     return((MagickWand *) NULL);
2759   return(CloneMagickWandFromImages(wand,deconstruct_image));
2760 }
2761 
2762 /*
2763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2764 %                                                                             %
2765 %                                                                             %
2766 %                                                                             %
2767 %     M a g i c k D e s k e w I m a g e                                       %
2768 %                                                                             %
2769 %                                                                             %
2770 %                                                                             %
2771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2772 %
2773 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2774 %  occurs in scanned images because of the camera being misaligned,
2775 %  imperfections in the scanning or surface, or simply because the paper was
2776 %  not placed completely flat when scanned.
2777 %
2778 %  The format of the MagickDeskewImage method is:
2779 %
2780 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2781 %        const double threshold)
2782 %
2783 %  A description of each parameter follows:
2784 %
2785 %    o wand: the magick wand.
2786 %
2787 %    o threshold: separate background from foreground.
2788 %
2789 */
MagickDeskewImage(MagickWand * wand,const double threshold)2790 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2791   const double threshold)
2792 {
2793   Image
2794     *sepia_image;
2795 
2796   assert(wand != (MagickWand *) NULL);
2797   assert(wand->signature == MagickWandSignature);
2798   if (wand->debug != MagickFalse)
2799     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2800   if (wand->images == (Image *) NULL)
2801     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2802   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2803   if (sepia_image == (Image *) NULL)
2804     return(MagickFalse);
2805   ReplaceImageInList(&wand->images,sepia_image);
2806   return(MagickTrue);
2807 }
2808 
2809 /*
2810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2811 %                                                                             %
2812 %                                                                             %
2813 %                                                                             %
2814 %     M a g i c k D e s p e c k l e I m a g e                                 %
2815 %                                                                             %
2816 %                                                                             %
2817 %                                                                             %
2818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2819 %
2820 %  MagickDespeckleImage() reduces the speckle noise in an image while
2821 %  perserving the edges of the original image.
2822 %
2823 %  The format of the MagickDespeckleImage method is:
2824 %
2825 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2826 %
2827 %  A description of each parameter follows:
2828 %
2829 %    o wand: the magick wand.
2830 %
2831 */
MagickDespeckleImage(MagickWand * wand)2832 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2833 {
2834   Image
2835     *despeckle_image;
2836 
2837   assert(wand != (MagickWand *) NULL);
2838   assert(wand->signature == MagickWandSignature);
2839   if (wand->debug != MagickFalse)
2840     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2841   if (wand->images == (Image *) NULL)
2842     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2843   despeckle_image=DespeckleImage(wand->images,wand->exception);
2844   if (despeckle_image == (Image *) NULL)
2845     return(MagickFalse);
2846   ReplaceImageInList(&wand->images,despeckle_image);
2847   return(MagickTrue);
2848 }
2849 
2850 /*
2851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2852 %                                                                             %
2853 %                                                                             %
2854 %                                                                             %
2855 %   M a g i c k D e s t r o y I m a g e                                       %
2856 %                                                                             %
2857 %                                                                             %
2858 %                                                                             %
2859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2860 %
2861 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2862 %  with the image if the reference count becomes zero.
2863 %
2864 %  The format of the MagickDestroyImage method is:
2865 %
2866 %      Image *MagickDestroyImage(Image *image)
2867 %
2868 %  A description of each parameter follows:
2869 %
2870 %    o image: the image.
2871 %
2872 */
MagickDestroyImage(Image * image)2873 WandExport Image *MagickDestroyImage(Image *image)
2874 {
2875   return(DestroyImage(image));
2876 }
2877 
2878 /*
2879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2880 %                                                                             %
2881 %                                                                             %
2882 %                                                                             %
2883 %   M a g i c k D i s p l a y I m a g e                                       %
2884 %                                                                             %
2885 %                                                                             %
2886 %                                                                             %
2887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2888 %
2889 %  MagickDisplayImage() displays an image.
2890 %
2891 %  The format of the MagickDisplayImage method is:
2892 %
2893 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2894 %        const char *server_name)
2895 %
2896 %  A description of each parameter follows:
2897 %
2898 %    o wand: the magick wand.
2899 %
2900 %    o server_name: the X server name.
2901 %
2902 */
MagickDisplayImage(MagickWand * wand,const char * server_name)2903 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2904   const char *server_name)
2905 {
2906   Image
2907     *image;
2908 
2909   MagickBooleanType
2910     status;
2911 
2912   assert(wand != (MagickWand *) NULL);
2913   assert(wand->signature == MagickWandSignature);
2914   if (wand->debug != MagickFalse)
2915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2916   if (wand->images == (Image *) NULL)
2917     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2918   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2919   if (image == (Image *) NULL)
2920     return(MagickFalse);
2921   (void) CloneString(&wand->image_info->server_name,server_name);
2922   status=DisplayImages(wand->image_info,image,wand->exception);
2923   image=DestroyImage(image);
2924   return(status);
2925 }
2926 
2927 /*
2928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2929 %                                                                             %
2930 %                                                                             %
2931 %                                                                             %
2932 %   M a g i c k D i s p l a y I m a g e s                                     %
2933 %                                                                             %
2934 %                                                                             %
2935 %                                                                             %
2936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2937 %
2938 %  MagickDisplayImages() displays an image or image sequence.
2939 %
2940 %  The format of the MagickDisplayImages method is:
2941 %
2942 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2943 %        const char *server_name)
2944 %
2945 %  A description of each parameter follows:
2946 %
2947 %    o wand: the magick wand.
2948 %
2949 %    o server_name: the X server name.
2950 %
2951 */
MagickDisplayImages(MagickWand * wand,const char * server_name)2952 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2953   const char *server_name)
2954 {
2955   MagickBooleanType
2956     status;
2957 
2958   assert(wand != (MagickWand *) NULL);
2959   assert(wand->signature == MagickWandSignature);
2960   if (wand->debug != MagickFalse)
2961     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2962   (void) CloneString(&wand->image_info->server_name,server_name);
2963   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2964   return(status);
2965 }
2966 
2967 /*
2968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2969 %                                                                             %
2970 %                                                                             %
2971 %                                                                             %
2972 %   M a g i c k D i s t o r t I m a g e                                       %
2973 %                                                                             %
2974 %                                                                             %
2975 %                                                                             %
2976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2977 %
2978 %  MagickDistortImage() distorts an image using various distortion methods, by
2979 %  mapping color lookups of the source image to a new destination image
2980 %  usally of the same size as the source image, unless 'bestfit' is set to
2981 %  true.
2982 %
2983 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2984 %  adjusted to ensure the whole source 'image' will just fit within the final
2985 %  destination image, which will be sized and offset accordingly.  Also in
2986 %  many cases the virtual offset of the source image will be taken into
2987 %  account in the mapping.
2988 %
2989 %  The format of the MagickDistortImage method is:
2990 %
2991 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2992 %        const DistortMethod method,const size_t number_arguments,
2993 %        const double *arguments,const MagickBooleanType bestfit)
2994 %
2995 %  A description of each parameter follows:
2996 %
2997 %    o image: the image to be distorted.
2998 %
2999 %    o method: the method of image distortion.
3000 %
3001 %        ArcDistortion always ignores the source image offset, and always
3002 %        'bestfit' the destination image with the top left corner offset
3003 %        relative to the polar mapping center.
3004 %
3005 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
3006 %        style of image distortion.
3007 %
3008 %        Affine, Perspective, and Bilinear, do least squares fitting of the
3009 %        distortion when more than the minimum number of control point pairs
3010 %        are provided.
3011 %
3012 %        Perspective, and Bilinear, falls back to a Affine distortion when less
3013 %        that 4 control point pairs are provided. While Affine distortions let
3014 %        you use any number of control point pairs, that is Zero pairs is a
3015 %        no-Op (viewport only) distrotion, one pair is a translation and two
3016 %        pairs of control points do a scale-rotate-translate, without any
3017 %        shearing.
3018 %
3019 %    o number_arguments: the number of arguments given for this distortion
3020 %      method.
3021 %
3022 %    o arguments: the arguments for this distortion method.
3023 %
3024 %    o bestfit: Attempt to resize destination to fit distorted source.
3025 %
3026 */
MagickDistortImage(MagickWand * wand,const DistortMethod method,const size_t number_arguments,const double * arguments,const MagickBooleanType bestfit)3027 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
3028   const DistortMethod method,const size_t number_arguments,
3029   const double *arguments,const MagickBooleanType bestfit)
3030 {
3031   Image
3032     *distort_image;
3033 
3034   assert(wand != (MagickWand *) NULL);
3035   assert(wand->signature == MagickWandSignature);
3036   if (wand->debug != MagickFalse)
3037     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3038   if (wand->images == (Image *) NULL)
3039     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3040   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
3041     bestfit,wand->exception);
3042   if (distort_image == (Image *) NULL)
3043     return(MagickFalse);
3044   ReplaceImageInList(&wand->images,distort_image);
3045   return(MagickTrue);
3046 }
3047 
3048 /*
3049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3050 %                                                                             %
3051 %                                                                             %
3052 %                                                                             %
3053 %   M a g i c k D r a w I m a g e                                             %
3054 %                                                                             %
3055 %                                                                             %
3056 %                                                                             %
3057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3058 %
3059 %  MagickDrawImage() renders the drawing wand on the current image.
3060 %
3061 %  The format of the MagickDrawImage method is:
3062 %
3063 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
3064 %        const DrawingWand *drawing_wand)
3065 %
3066 %  A description of each parameter follows:
3067 %
3068 %    o wand: the magick wand.
3069 %
3070 %    o drawing_wand: the draw wand.
3071 %
3072 */
MagickDrawImage(MagickWand * wand,const DrawingWand * drawing_wand)3073 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
3074   const DrawingWand *drawing_wand)
3075 {
3076   char
3077     *primitive;
3078 
3079   DrawInfo
3080     *draw_info;
3081 
3082   MagickBooleanType
3083     status;
3084 
3085   assert(wand != (MagickWand *) NULL);
3086   assert(wand->signature == MagickWandSignature);
3087   if (wand->debug != MagickFalse)
3088     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3089   if (wand->images == (Image *) NULL)
3090     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3091   draw_info=PeekDrawingWand(drawing_wand);
3092   if ((draw_info == (DrawInfo *) NULL) ||
3093       (draw_info->primitive == (char *) NULL))
3094     return(MagickFalse);
3095   primitive=AcquireString(draw_info->primitive);
3096   draw_info=DestroyDrawInfo(draw_info);
3097   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3098   draw_info->primitive=primitive;
3099   status=DrawImage(wand->images,draw_info,wand->exception);
3100   draw_info=DestroyDrawInfo(draw_info);
3101   return(status);
3102 }
3103 
3104 /*
3105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3106 %                                                                             %
3107 %                                                                             %
3108 %                                                                             %
3109 %   M a g i c k E d g e I m a g e                                             %
3110 %                                                                             %
3111 %                                                                             %
3112 %                                                                             %
3113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3114 %
3115 %  MagickEdgeImage() enhance edges within the image with a convolution filter
3116 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
3117 %  radius for you.
3118 %
3119 %  The format of the MagickEdgeImage method is:
3120 %
3121 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
3122 %
3123 %  A description of each parameter follows:
3124 %
3125 %    o wand: the magick wand.
3126 %
3127 %    o radius: the radius of the pixel neighborhood.
3128 %
3129 */
MagickEdgeImage(MagickWand * wand,const double radius)3130 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
3131   const double radius)
3132 {
3133   Image
3134     *edge_image;
3135 
3136   assert(wand != (MagickWand *) NULL);
3137   assert(wand->signature == MagickWandSignature);
3138   if (wand->debug != MagickFalse)
3139     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3140   if (wand->images == (Image *) NULL)
3141     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3142   edge_image=EdgeImage(wand->images,radius,wand->exception);
3143   if (edge_image == (Image *) NULL)
3144     return(MagickFalse);
3145   ReplaceImageInList(&wand->images,edge_image);
3146   return(MagickTrue);
3147 }
3148 
3149 /*
3150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3151 %                                                                             %
3152 %                                                                             %
3153 %                                                                             %
3154 %   M a g i c k E m b o s s I m a g e                                         %
3155 %                                                                             %
3156 %                                                                             %
3157 %                                                                             %
3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3159 %
3160 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
3161 %  effect.  We convolve the image with a Gaussian operator of the given radius
3162 %  and standard deviation (sigma).  For reasonable results, radius should be
3163 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
3164 %  radius for you.
3165 %
3166 %  The format of the MagickEmbossImage method is:
3167 %
3168 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
3169 %        const double sigma)
3170 %
3171 %  A description of each parameter follows:
3172 %
3173 %    o wand: the magick wand.
3174 %
3175 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3176 %      pixel.
3177 %
3178 %    o sigma: the standard deviation of the Gaussian, in pixels.
3179 %
3180 */
MagickEmbossImage(MagickWand * wand,const double radius,const double sigma)3181 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
3182   const double radius,const double sigma)
3183 {
3184   Image
3185     *emboss_image;
3186 
3187   assert(wand != (MagickWand *) NULL);
3188   assert(wand->signature == MagickWandSignature);
3189   if (wand->debug != MagickFalse)
3190     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3191   if (wand->images == (Image *) NULL)
3192     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3193   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
3194   if (emboss_image == (Image *) NULL)
3195     return(MagickFalse);
3196   ReplaceImageInList(&wand->images,emboss_image);
3197   return(MagickTrue);
3198 }
3199 
3200 /*
3201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3202 %                                                                             %
3203 %                                                                             %
3204 %                                                                             %
3205 %   M a g i c k E n c i p h e r I m a g e                                     %
3206 %                                                                             %
3207 %                                                                             %
3208 %                                                                             %
3209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3210 %
3211 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
3212 %
3213 %  The format of the MagickEncipherImage method is:
3214 %
3215 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
3216 %        const char *passphrase)
3217 %
3218 %  A description of each parameter follows:
3219 %
3220 %    o wand: the magick wand.
3221 %
3222 %    o passphrase: the passphrase.
3223 %
3224 */
MagickEncipherImage(MagickWand * wand,const char * passphrase)3225 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
3226   const char *passphrase)
3227 {
3228   assert(wand != (MagickWand *) NULL);
3229   assert(wand->signature == MagickWandSignature);
3230   if (wand->debug != MagickFalse)
3231     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3232   if (wand->images == (Image *) NULL)
3233     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3234   return(EncipherImage(wand->images,passphrase,wand->exception));
3235 }
3236 
3237 /*
3238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3239 %                                                                             %
3240 %                                                                             %
3241 %                                                                             %
3242 %   M a g i c k E n h a n c e I m a g e                                       %
3243 %                                                                             %
3244 %                                                                             %
3245 %                                                                             %
3246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3247 %
3248 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
3249 %  noisy image.
3250 %
3251 %  The format of the MagickEnhanceImage method is:
3252 %
3253 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3254 %
3255 %  A description of each parameter follows:
3256 %
3257 %    o wand: the magick wand.
3258 %
3259 */
MagickEnhanceImage(MagickWand * wand)3260 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3261 {
3262   Image
3263     *enhance_image;
3264 
3265   assert(wand != (MagickWand *) NULL);
3266   assert(wand->signature == MagickWandSignature);
3267   if (wand->debug != MagickFalse)
3268     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3269   if (wand->images == (Image *) NULL)
3270     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3271   enhance_image=EnhanceImage(wand->images,wand->exception);
3272   if (enhance_image == (Image *) NULL)
3273     return(MagickFalse);
3274   ReplaceImageInList(&wand->images,enhance_image);
3275   return(MagickTrue);
3276 }
3277 
3278 /*
3279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3280 %                                                                             %
3281 %                                                                             %
3282 %                                                                             %
3283 %   M a g i c k E q u a l i z e I m a g e                                     %
3284 %                                                                             %
3285 %                                                                             %
3286 %                                                                             %
3287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3288 %
3289 %  MagickEqualizeImage() equalizes the image histogram.
3290 %
3291 %  The format of the MagickEqualizeImage method is:
3292 %
3293 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3294 %
3295 %  A description of each parameter follows:
3296 %
3297 %    o wand: the magick wand.
3298 %
3299 %    o channel: the image channel(s).
3300 %
3301 */
MagickEqualizeImage(MagickWand * wand)3302 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3303 {
3304   MagickBooleanType
3305     status;
3306 
3307   assert(wand != (MagickWand *) NULL);
3308   assert(wand->signature == MagickWandSignature);
3309   if (wand->debug != MagickFalse)
3310     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3311   if (wand->images == (Image *) NULL)
3312     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3313   status=EqualizeImage(wand->images,wand->exception);
3314   return(status);
3315 }
3316 
3317 /*
3318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3319 %                                                                             %
3320 %                                                                             %
3321 %                                                                             %
3322 %   M a g i c k E v a l u a t e I m a g e                                     %
3323 %                                                                             %
3324 %                                                                             %
3325 %                                                                             %
3326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3327 %
3328 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
3329 %  expression to an image.  Use these operators to lighten or darken an image,
3330 %  to increase or decrease contrast in an image, or to produce the "negative"
3331 %  of an image.
3332 %
3333 %  The format of the MagickEvaluateImage method is:
3334 %
3335 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3336 %        const MagickEvaluateOperator operator,const double value)
3337 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3338 %        const MagickEvaluateOperator operator)
3339 %
3340 %  A description of each parameter follows:
3341 %
3342 %    o wand: the magick wand.
3343 %
3344 %    o op: A channel operator.
3345 %
3346 %    o value: A value value.
3347 %
3348 */
3349 
MagickEvaluateImages(MagickWand * wand,const MagickEvaluateOperator op)3350 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3351   const MagickEvaluateOperator op)
3352 {
3353   Image
3354     *evaluate_image;
3355 
3356   assert(wand != (MagickWand *) NULL);
3357   assert(wand->signature == MagickWandSignature);
3358   if (wand->debug != MagickFalse)
3359     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3360   if (wand->images == (Image *) NULL)
3361     return((MagickWand *) NULL);
3362   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3363   if (evaluate_image == (Image *) NULL)
3364     return((MagickWand *) NULL);
3365   return(CloneMagickWandFromImages(wand,evaluate_image));
3366 }
3367 
MagickEvaluateImage(MagickWand * wand,const MagickEvaluateOperator op,const double value)3368 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3369   const MagickEvaluateOperator op,const double value)
3370 {
3371   MagickBooleanType
3372     status;
3373 
3374   assert(wand != (MagickWand *) NULL);
3375   assert(wand->signature == MagickWandSignature);
3376   if (wand->debug != MagickFalse)
3377     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3378   if (wand->images == (Image *) NULL)
3379     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3380   status=EvaluateImage(wand->images,op,value,wand->exception);
3381   return(status);
3382 }
3383 
3384 /*
3385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3386 %                                                                             %
3387 %                                                                             %
3388 %                                                                             %
3389 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
3390 %                                                                             %
3391 %                                                                             %
3392 %                                                                             %
3393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3394 %
3395 %  MagickExportImagePixels() extracts pixel data from an image and returns it
3396 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3397 %  an error is encountered.  The data is returned as char, short int, int,
3398 %  ssize_t, float, or double in the order specified by map.
3399 %
3400 %  Suppose you want to extract the first scanline of a 640x480 image as
3401 %  character data in red-green-blue order:
3402 %
3403 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3404 %
3405 %  The format of the MagickExportImagePixels method is:
3406 %
3407 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3408 %        const ssize_t x,const ssize_t y,const size_t columns,
3409 %        const size_t rows,const char *map,const StorageType storage,
3410 %        void *pixels)
3411 %
3412 %  A description of each parameter follows:
3413 %
3414 %    o wand: the magick wand.
3415 %
3416 %    o x, y, columns, rows:  These values define the perimeter
3417 %      of a region of pixels you want to extract.
3418 %
3419 %    o map:  This string reflects the expected ordering of the pixel array.
3420 %      It can be any combination or order of R = red, G = green, B = blue,
3421 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3422 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3423 %      P = pad.
3424 %
3425 %    o storage: Define the data type of the pixels.  Float and double types are
3426 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3427 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3428 %      LongPixel, QuantumPixel, or ShortPixel.
3429 %
3430 %    o pixels: This array of values contain the pixel components as defined by
3431 %      map and type.  You must preallocate this array where the expected
3432 %      length varies depending on the values of width, height, map, and type.
3433 %
3434 */
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)3435 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3436   const ssize_t x,const ssize_t y,const size_t columns,
3437   const size_t rows,const char *map,const StorageType storage,
3438   void *pixels)
3439 {
3440   MagickBooleanType
3441     status;
3442 
3443   assert(wand != (MagickWand *) NULL);
3444   assert(wand->signature == MagickWandSignature);
3445   if (wand->debug != MagickFalse)
3446     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3447   if (wand->images == (Image *) NULL)
3448     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3449   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3450     storage,pixels,wand->exception);
3451   return(status);
3452 }
3453 
3454 /*
3455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3456 %                                                                             %
3457 %                                                                             %
3458 %                                                                             %
3459 %   M a g i c k E x t e n t I m a g e                                         %
3460 %                                                                             %
3461 %                                                                             %
3462 %                                                                             %
3463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3464 %
3465 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3466 %  and wand background color.  Set the (x,y) offset of the geometry to move
3467 %  the original wand relative to the extended wand.
3468 %
3469 %  The format of the MagickExtentImage method is:
3470 %
3471 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3472 %        const size_t height,const ssize_t x,const ssize_t y)
3473 %
3474 %  A description of each parameter follows:
3475 %
3476 %    o wand: the magick wand.
3477 %
3478 %    o width: the region width.
3479 %
3480 %    o height: the region height.
3481 %
3482 %    o x: the region x offset.
3483 %
3484 %    o y: the region y offset.
3485 %
3486 */
MagickExtentImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)3487 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3488   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3489 {
3490   Image
3491     *extent_image;
3492 
3493   RectangleInfo
3494     extent;
3495 
3496   assert(wand != (MagickWand *) NULL);
3497   assert(wand->signature == MagickWandSignature);
3498   if (wand->debug != MagickFalse)
3499     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3500   if (wand->images == (Image *) NULL)
3501     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3502   extent.width=width;
3503   extent.height=height;
3504   extent.x=x;
3505   extent.y=y;
3506   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3507   if (extent_image == (Image *) NULL)
3508     return(MagickFalse);
3509   ReplaceImageInList(&wand->images,extent_image);
3510   return(MagickTrue);
3511 }
3512 
3513 /*
3514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3515 %                                                                             %
3516 %                                                                             %
3517 %                                                                             %
3518 %   M a g i c k F l i p I m a g e                                             %
3519 %                                                                             %
3520 %                                                                             %
3521 %                                                                             %
3522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3523 %
3524 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3525 %  around the central x-axis.
3526 %
3527 %  The format of the MagickFlipImage method is:
3528 %
3529 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3530 %
3531 %  A description of each parameter follows:
3532 %
3533 %    o wand: the magick wand.
3534 %
3535 */
MagickFlipImage(MagickWand * wand)3536 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3537 {
3538   Image
3539     *flip_image;
3540 
3541   assert(wand != (MagickWand *) NULL);
3542   assert(wand->signature == MagickWandSignature);
3543   if (wand->debug != MagickFalse)
3544     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3545   if (wand->images == (Image *) NULL)
3546     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3547   flip_image=FlipImage(wand->images,wand->exception);
3548   if (flip_image == (Image *) NULL)
3549     return(MagickFalse);
3550   ReplaceImageInList(&wand->images,flip_image);
3551   return(MagickTrue);
3552 }
3553 
3554 /*
3555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3556 %                                                                             %
3557 %                                                                             %
3558 %                                                                             %
3559 %   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                         %
3560 %                                                                             %
3561 %                                                                             %
3562 %                                                                             %
3563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3564 %
3565 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3566 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3567 %  specified, the color value is changed for any neighbor pixel that does not
3568 %  match the bordercolor member of image.
3569 %
3570 %  The format of the MagickFloodfillPaintImage method is:
3571 %
3572 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3573 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3574 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3575 %
3576 %  A description of each parameter follows:
3577 %
3578 %    o wand: the magick wand.
3579 %
3580 %    o fill: the floodfill color pixel wand.
3581 %
3582 %    o fuzz: By default target must match a particular pixel color
3583 %      exactly.  However, in many cases two colors may differ by a small amount.
3584 %      The fuzz member of image defines how much tolerance is acceptable to
3585 %      consider two colors as the same.  For example, set fuzz to 10 and the
3586 %      color red at intensities of 100 and 102 respectively are now interpreted
3587 %      as the same color for the purposes of the floodfill.
3588 %
3589 %    o bordercolor: the border color pixel wand.
3590 %
3591 %    o x,y: the starting location of the operation.
3592 %
3593 %    o invert: paint any pixel that does not match the target color.
3594 %
3595 */
MagickFloodfillPaintImage(MagickWand * wand,const PixelWand * fill,const double fuzz,const PixelWand * bordercolor,const ssize_t x,const ssize_t y,const MagickBooleanType invert)3596 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3597   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3598   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3599 {
3600   DrawInfo
3601     *draw_info;
3602 
3603   MagickBooleanType
3604     status;
3605 
3606   PixelInfo
3607     target;
3608 
3609   assert(wand != (MagickWand *) NULL);
3610   assert(wand->signature == MagickWandSignature);
3611   if (wand->debug != MagickFalse)
3612     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3613   if (wand->images == (Image *) NULL)
3614     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3615   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3616   PixelGetQuantumPacket(fill,&draw_info->fill);
3617   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3618     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3619   if (bordercolor != (PixelWand *) NULL)
3620     PixelGetMagickColor(bordercolor,&target);
3621   wand->images->fuzz=fuzz;
3622   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3623     wand->exception);
3624   draw_info=DestroyDrawInfo(draw_info);
3625   return(status);
3626 }
3627 
3628 /*
3629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3630 %                                                                             %
3631 %                                                                             %
3632 %                                                                             %
3633 %   M a g i c k F l o p I m a g e                                             %
3634 %                                                                             %
3635 %                                                                             %
3636 %                                                                             %
3637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3638 %
3639 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3640 %  around the central y-axis.
3641 %
3642 %  The format of the MagickFlopImage method is:
3643 %
3644 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3645 %
3646 %  A description of each parameter follows:
3647 %
3648 %    o wand: the magick wand.
3649 %
3650 */
MagickFlopImage(MagickWand * wand)3651 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3652 {
3653   Image
3654     *flop_image;
3655 
3656   assert(wand != (MagickWand *) NULL);
3657   assert(wand->signature == MagickWandSignature);
3658   if (wand->debug != MagickFalse)
3659     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3660   if (wand->images == (Image *) NULL)
3661     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3662   flop_image=FlopImage(wand->images,wand->exception);
3663   if (flop_image == (Image *) NULL)
3664     return(MagickFalse);
3665   ReplaceImageInList(&wand->images,flop_image);
3666   return(MagickTrue);
3667 }
3668 
3669 /*
3670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3671 %                                                                             %
3672 %                                                                             %
3673 %                                                                             %
3674 %   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                     %
3675 %                                                                             %
3676 %                                                                             %
3677 %                                                                             %
3678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3679 %
3680 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3681 %  transform (DFT) of the image either as a magnitude / phase or real /
3682 %  imaginary image pair.
3683 %
3684 %  The format of the MagickForwardFourierTransformImage method is:
3685 %
3686 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3687 %        const MagickBooleanType magnitude)
3688 %
3689 %  A description of each parameter follows:
3690 %
3691 %    o wand: the magick wand.
3692 %
3693 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3694 %      imaginary image pair.
3695 %
3696 */
MagickForwardFourierTransformImage(MagickWand * wand,const MagickBooleanType magnitude)3697 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3698   MagickWand *wand,const MagickBooleanType magnitude)
3699 {
3700   Image
3701     *forward_image;
3702 
3703   assert(wand != (MagickWand *) NULL);
3704   assert(wand->signature == MagickWandSignature);
3705   if (wand->debug != MagickFalse)
3706     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3707   if (wand->images == (Image *) NULL)
3708     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3709   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3710     wand->exception);
3711   if (forward_image == (Image *) NULL)
3712     return(MagickFalse);
3713   ReplaceImageInList(&wand->images,forward_image);
3714   return(MagickTrue);
3715 }
3716 
3717 /*
3718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3719 %                                                                             %
3720 %                                                                             %
3721 %                                                                             %
3722 %   M a g i c k F r a m e I m a g e                                           %
3723 %                                                                             %
3724 %                                                                             %
3725 %                                                                             %
3726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3727 %
3728 %  MagickFrameImage() adds a simulated three-dimensional border around the
3729 %  image.  The width and height specify the border width of the vertical and
3730 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3731 %  width of the inner and outer shadows of the frame.
3732 %
3733 %  The format of the MagickFrameImage method is:
3734 %
3735 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3736 %        const PixelWand *matte_color,const size_t width,
3737 %        const size_t height,const ssize_t inner_bevel,
3738 %        const ssize_t outer_bevel,const CompositeOperator compose)
3739 %
3740 %  A description of each parameter follows:
3741 %
3742 %    o wand: the magick wand.
3743 %
3744 %    o matte_color: the frame color pixel wand.
3745 %
3746 %    o width: the border width.
3747 %
3748 %    o height: the border height.
3749 %
3750 %    o inner_bevel: the inner bevel width.
3751 %
3752 %    o outer_bevel: the outer bevel width.
3753 %
3754 %    o compose: the composite operator.
3755 %
3756 */
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)3757 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3758   const PixelWand *matte_color,const size_t width,const size_t height,
3759   const ssize_t inner_bevel,const ssize_t outer_bevel,
3760   const CompositeOperator compose)
3761 {
3762   Image
3763     *frame_image;
3764 
3765   FrameInfo
3766     frame_info;
3767 
3768   assert(wand != (MagickWand *) NULL);
3769   assert(wand->signature == MagickWandSignature);
3770   if (wand->debug != MagickFalse)
3771     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3772   if (wand->images == (Image *) NULL)
3773     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3774   (void) memset(&frame_info,0,sizeof(frame_info));
3775   frame_info.width=wand->images->columns+2*width;
3776   frame_info.height=wand->images->rows+2*height;
3777   frame_info.x=(ssize_t) width;
3778   frame_info.y=(ssize_t) height;
3779   frame_info.inner_bevel=inner_bevel;
3780   frame_info.outer_bevel=outer_bevel;
3781   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3782   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3783   if (frame_image == (Image *) NULL)
3784     return(MagickFalse);
3785   ReplaceImageInList(&wand->images,frame_image);
3786   return(MagickTrue);
3787 }
3788 
3789 /*
3790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3791 %                                                                             %
3792 %                                                                             %
3793 %                                                                             %
3794 %   M a g i c k F u n c t i o n I m a g e                                     %
3795 %                                                                             %
3796 %                                                                             %
3797 %                                                                             %
3798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3799 %
3800 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3801 %  expression to an image.  Use these operators to lighten or darken an image,
3802 %  to increase or decrease contrast in an image, or to produce the "negative"
3803 %  of an image.
3804 %
3805 %  The format of the MagickFunctionImage method is:
3806 %
3807 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3808 %        const MagickFunction function,const size_t number_arguments,
3809 %        const double *arguments)
3810 %
3811 %  A description of each parameter follows:
3812 %
3813 %    o wand: the magick wand.
3814 %
3815 %    o function: the image function.
3816 %
3817 %    o number_arguments: the number of function arguments.
3818 %
3819 %    o arguments: the function arguments.
3820 %
3821 */
MagickFunctionImage(MagickWand * wand,const MagickFunction function,const size_t number_arguments,const double * arguments)3822 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3823   const MagickFunction function,const size_t number_arguments,
3824   const double *arguments)
3825 {
3826   MagickBooleanType
3827     status;
3828 
3829   assert(wand != (MagickWand *) NULL);
3830   assert(wand->signature == MagickWandSignature);
3831   if (wand->debug != MagickFalse)
3832     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3833   if (wand->images == (Image *) NULL)
3834     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3835   status=FunctionImage(wand->images,function,number_arguments,arguments,
3836     wand->exception);
3837   return(status);
3838 }
3839 
3840 /*
3841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3842 %                                                                             %
3843 %                                                                             %
3844 %                                                                             %
3845 %   M a g i c k F x I m a g e                                                 %
3846 %                                                                             %
3847 %                                                                             %
3848 %                                                                             %
3849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3850 %
3851 %  MagickFxImage() evaluate expression for each pixel in the image.
3852 %
3853 %  The format of the MagickFxImage method is:
3854 %
3855 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3856 %
3857 %  A description of each parameter follows:
3858 %
3859 %    o wand: the magick wand.
3860 %
3861 %    o expression: the expression.
3862 %
3863 */
MagickFxImage(MagickWand * wand,const char * expression)3864 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3865 {
3866   Image
3867     *fx_image;
3868 
3869   assert(wand != (MagickWand *) NULL);
3870   assert(wand->signature == MagickWandSignature);
3871   if (wand->debug != MagickFalse)
3872     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3873   if (wand->images == (Image *) NULL)
3874     return((MagickWand *) NULL);
3875   fx_image=FxImage(wand->images,expression,wand->exception);
3876   if (fx_image == (Image *) NULL)
3877     return((MagickWand *) NULL);
3878   return(CloneMagickWandFromImages(wand,fx_image));
3879 }
3880 
3881 /*
3882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3883 %                                                                             %
3884 %                                                                             %
3885 %                                                                             %
3886 %   M a g i c k G a m m a I m a g e                                           %
3887 %                                                                             %
3888 %                                                                             %
3889 %                                                                             %
3890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3891 %
3892 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3893 %  different devices will have perceptual differences in the way the image's
3894 %  intensities are represented on the screen.  Specify individual gamma levels
3895 %  for the red, green, and blue channels, or adjust all three with the gamma
3896 %  parameter.  Values typically range from 0.8 to 2.3.
3897 %
3898 %  You can also reduce the influence of a particular channel with a gamma
3899 %  value of 0.
3900 %
3901 %  The format of the MagickGammaImage method is:
3902 %
3903 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3904 %
3905 %  A description of each parameter follows:
3906 %
3907 %    o wand: the magick wand.
3908 %
3909 %    o level: Define the level of gamma correction.
3910 %
3911 */
MagickGammaImage(MagickWand * wand,const double gamma)3912 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3913   const double gamma)
3914 {
3915   MagickBooleanType
3916     status;
3917 
3918   assert(wand != (MagickWand *) NULL);
3919   assert(wand->signature == MagickWandSignature);
3920   if (wand->debug != MagickFalse)
3921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3922   if (wand->images == (Image *) NULL)
3923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3924   status=GammaImage(wand->images,gamma,wand->exception);
3925   return(status);
3926 }
3927 
3928 /*
3929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3930 %                                                                             %
3931 %                                                                             %
3932 %                                                                             %
3933 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3934 %                                                                             %
3935 %                                                                             %
3936 %                                                                             %
3937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3938 %
3939 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3940 %  Gaussian operator of the given radius and standard deviation (sigma).
3941 %  For reasonable results, the radius should be larger than sigma.  Use a
3942 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3943 %
3944 %  The format of the MagickGaussianBlurImage method is:
3945 %
3946 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3947 %        const double radius,const double sigma)
3948 %
3949 %  A description of each parameter follows:
3950 %
3951 %    o wand: the magick wand.
3952 %
3953 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3954 %      pixel.
3955 %
3956 %    o sigma: the standard deviation of the Gaussian, in pixels.
3957 %
3958 */
MagickGaussianBlurImage(MagickWand * wand,const double radius,const double sigma)3959 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3960   const double radius,const double sigma)
3961 {
3962   Image
3963     *blur_image;
3964 
3965   assert(wand != (MagickWand *) NULL);
3966   assert(wand->signature == MagickWandSignature);
3967   if (wand->debug != MagickFalse)
3968     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3969   if (wand->images == (Image *) NULL)
3970     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3971   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3972   if (blur_image == (Image *) NULL)
3973     return(MagickFalse);
3974   ReplaceImageInList(&wand->images,blur_image);
3975   return(MagickTrue);
3976 }
3977 
3978 /*
3979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3980 %                                                                             %
3981 %                                                                             %
3982 %                                                                             %
3983 %   M a g i c k G e t I m a g e                                               %
3984 %                                                                             %
3985 %                                                                             %
3986 %                                                                             %
3987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3988 %
3989 %  MagickGetImage() gets the image at the current image index.
3990 %
3991 %  The format of the MagickGetImage method is:
3992 %
3993 %      MagickWand *MagickGetImage(MagickWand *wand)
3994 %
3995 %  A description of each parameter follows:
3996 %
3997 %    o wand: the magick wand.
3998 %
3999 */
MagickGetImage(MagickWand * wand)4000 WandExport MagickWand *MagickGetImage(MagickWand *wand)
4001 {
4002   Image
4003     *image;
4004 
4005   assert(wand != (MagickWand *) NULL);
4006   assert(wand->signature == MagickWandSignature);
4007   if (wand->debug != MagickFalse)
4008     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4009   if (wand->images == (Image *) NULL)
4010     {
4011       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4012         "ContainsNoImages","`%s'",wand->name);
4013       return((MagickWand *) NULL);
4014     }
4015   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
4016   if (image == (Image *) NULL)
4017     return((MagickWand *) NULL);
4018   return(CloneMagickWandFromImages(wand,image));
4019 }
4020 
4021 /*
4022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4023 %                                                                             %
4024 %                                                                             %
4025 %                                                                             %
4026 %   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                       %
4027 %                                                                             %
4028 %                                                                             %
4029 %                                                                             %
4030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4031 %
4032 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
4033 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
4034 %  than CMYKA.
4035 %
4036 %  The format of the MagickGetImageAlphaChannel method is:
4037 %
4038 %      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4039 %
4040 %  A description of each parameter follows:
4041 %
4042 %    o wand: the magick wand.
4043 %
4044 */
MagickGetImageAlphaChannel(MagickWand * wand)4045 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4046 {
4047   assert(wand != (MagickWand *) NULL);
4048   assert(wand->signature == MagickWandSignature);
4049   if (wand->debug != MagickFalse)
4050     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4051   if (wand->images == (Image *) NULL)
4052     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4053   return(GetImageAlphaChannel(wand->images));
4054 }
4055 
4056 /*
4057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4058 %                                                                             %
4059 %                                                                             %
4060 %                                                                             %
4061 %   M a g i c k G e t I m a g e C l i p M a s k                               %
4062 %                                                                             %
4063 %                                                                             %
4064 %                                                                             %
4065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4066 %
4067 %  MagickGetImageMask() gets the image clip mask at the current image index.
4068 %
4069 %  The format of the MagickGetImageMask method is:
4070 %
4071 %      MagickWand *MagickGetImageMask(MagickWand *wand)
4072 %
4073 %  A description of each parameter follows:
4074 %
4075 %    o wand: the magick wand.
4076 %
4077 %    o type: type of mask, ReadPixelMask or WritePixelMask.
4078 %
4079 */
MagickGetImageMask(MagickWand * wand,const PixelMask type)4080 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
4081   const PixelMask type)
4082 {
4083   Image
4084     *image;
4085 
4086   assert(wand != (MagickWand *) NULL);
4087   assert(wand->signature == MagickWandSignature);
4088   if (wand->debug != MagickFalse)
4089     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4090   if (wand->images == (Image *) NULL)
4091     {
4092       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4093         "ContainsNoImages","`%s'",wand->name);
4094       return((MagickWand *) NULL);
4095     }
4096   image=GetImageMask(wand->images,type,wand->exception);
4097   if (image == (Image *) NULL)
4098     return((MagickWand *) NULL);
4099   return(CloneMagickWandFromImages(wand,image));
4100 }
4101 
4102 /*
4103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4104 %                                                                             %
4105 %                                                                             %
4106 %                                                                             %
4107 %   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                 %
4108 %                                                                             %
4109 %                                                                             %
4110 %                                                                             %
4111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4112 %
4113 %  MagickGetImageBackgroundColor() returns the image background color.
4114 %
4115 %  The format of the MagickGetImageBackgroundColor method is:
4116 %
4117 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4118 %        PixelWand *background_color)
4119 %
4120 %  A description of each parameter follows:
4121 %
4122 %    o wand: the magick wand.
4123 %
4124 %    o background_color: Return the background color.
4125 %
4126 */
MagickGetImageBackgroundColor(MagickWand * wand,PixelWand * background_color)4127 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4128   PixelWand *background_color)
4129 {
4130   assert(wand != (MagickWand *) NULL);
4131   assert(wand->signature == MagickWandSignature);
4132   if (wand->debug != MagickFalse)
4133     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4134   if (wand->images == (Image *) NULL)
4135     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4136   PixelSetPixelColor(background_color,&wand->images->background_color);
4137   return(MagickTrue);
4138 }
4139 
4140 /*
4141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4142 %                                                                             %
4143 %                                                                             %
4144 %                                                                             %
4145 %   M a g i c k G e t I m a g e B l o b                                       %
4146 %                                                                             %
4147 %                                                                             %
4148 %                                                                             %
4149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4150 %
4151 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
4152 %  the image as a blob (a formatted "file" in memory) and its length, starting
4153 %  from the current position in the image sequence.  Use MagickSetImageFormat()
4154 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
4155 %
4156 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
4157 %  the image sequence.
4158 %
4159 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
4160 %
4161 %  The format of the MagickGetImageBlob method is:
4162 %
4163 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4164 %
4165 %  A description of each parameter follows:
4166 %
4167 %    o wand: the magick wand.
4168 %
4169 %    o length: the length of the blob.
4170 %
4171 */
MagickGetImageBlob(MagickWand * wand,size_t * length)4172 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4173 {
4174   unsigned char
4175     *blob;
4176 
4177   assert(wand != (MagickWand *) NULL);
4178   assert(wand->signature == MagickWandSignature);
4179   if (wand->debug != MagickFalse)
4180     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4181   if (wand->images == (Image *) NULL)
4182     {
4183       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4184         "ContainsNoImages","`%s'",wand->name);
4185       return((unsigned char *) NULL);
4186     }
4187   blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
4188     wand->exception);
4189   return(blob);
4190 }
4191 
4192 /*
4193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4194 %                                                                             %
4195 %                                                                             %
4196 %                                                                             %
4197 %   M a g i c k G e t I m a g e s B l o b                                     %
4198 %                                                                             %
4199 %                                                                             %
4200 %                                                                             %
4201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4202 %
4203 %  MagickGetImagesBlob() implements direct to memory image formats.  It
4204 %  returns the image sequence as a blob and its length.  The format of the image
4205 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
4206 %  return a different image format, use MagickSetImageFormat().
4207 %
4208 %  Note, some image formats do not permit multiple images to the same image
4209 %  stream (e.g. JPEG).  in this instance, just the first image of the
4210 %  sequence is returned as a blob.
4211 %
4212 %  The format of the MagickGetImagesBlob method is:
4213 %
4214 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4215 %
4216 %  A description of each parameter follows:
4217 %
4218 %    o wand: the magick wand.
4219 %
4220 %    o length: the length of the blob.
4221 %
4222 */
MagickGetImagesBlob(MagickWand * wand,size_t * length)4223 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4224 {
4225   unsigned char
4226     *blob;
4227 
4228   assert(wand != (MagickWand *) NULL);
4229   assert(wand->signature == MagickWandSignature);
4230   if (wand->debug != MagickFalse)
4231     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4232   if (wand->images == (Image *) NULL)
4233     {
4234       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4235         "ContainsNoImages","`%s'",wand->name);
4236       return((unsigned char *) NULL);
4237     }
4238   blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
4239     wand->images),length,wand->exception);
4240   return(blob);
4241 }
4242 
4243 /*
4244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4245 %                                                                             %
4246 %                                                                             %
4247 %                                                                             %
4248 %   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                         %
4249 %                                                                             %
4250 %                                                                             %
4251 %                                                                             %
4252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4253 %
4254 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4255 %  image.
4256 %
4257 %  The format of the MagickGetImageBluePrimary method is:
4258 %
4259 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4260 %        double *y,double *z)
4261 %
4262 %  A description of each parameter follows:
4263 %
4264 %    o wand: the magick wand.
4265 %
4266 %    o x: the chromaticity blue primary x-point.
4267 %
4268 %    o y: the chromaticity blue primary y-point.
4269 %
4270 %    o z: the chromaticity blue primary z-point.
4271 %
4272 */
MagickGetImageBluePrimary(MagickWand * wand,double * x,double * y,double * z)4273 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4274   double *x,double *y,double *z)
4275 {
4276   assert(wand != (MagickWand *) NULL);
4277   assert(wand->signature == MagickWandSignature);
4278   if (wand->debug != MagickFalse)
4279     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4280   if (wand->images == (Image *) NULL)
4281     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4282   *x=wand->images->chromaticity.blue_primary.x;
4283   *y=wand->images->chromaticity.blue_primary.y;
4284   *z=wand->images->chromaticity.blue_primary.z;
4285   return(MagickTrue);
4286 }
4287 
4288 /*
4289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4290 %                                                                             %
4291 %                                                                             %
4292 %                                                                             %
4293 %   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                         %
4294 %                                                                             %
4295 %                                                                             %
4296 %                                                                             %
4297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4298 %
4299 %  MagickGetImageBorderColor() returns the image border color.
4300 %
4301 %  The format of the MagickGetImageBorderColor method is:
4302 %
4303 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4304 %        PixelWand *border_color)
4305 %
4306 %  A description of each parameter follows:
4307 %
4308 %    o wand: the magick wand.
4309 %
4310 %    o border_color: Return the border color.
4311 %
4312 */
MagickGetImageBorderColor(MagickWand * wand,PixelWand * border_color)4313 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4314   PixelWand *border_color)
4315 {
4316   assert(wand != (MagickWand *) NULL);
4317   assert(wand->signature == MagickWandSignature);
4318   if (wand->debug != MagickFalse)
4319     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4320   if (wand->images == (Image *) NULL)
4321     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4322   PixelSetPixelColor(border_color,&wand->images->border_color);
4323   return(MagickTrue);
4324 }
4325 
4326 /*
4327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4328 %                                                                             %
4329 %                                                                             %
4330 %                                                                             %
4331 %   M a g i c k G e t I m a g e F e a t u r e s                               %
4332 %                                                                             %
4333 %                                                                             %
4334 %                                                                             %
4335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4336 %
4337 %  MagickGetImageFeatures() returns features for each channel in the
4338 %  image in each of four directions (horizontal, vertical, left and right
4339 %  diagonals) for the specified distance.  The features include the angular
4340 %  second moment, contrast, correlation, sum of squares: variance, inverse
4341 %  difference moment, sum average, sum varience, sum entropy, entropy,
4342 %  difference variance, difference entropy, information measures of
4343 %  correlation 1, information measures of correlation 2, and maximum
4344 %  correlation coefficient.  You can access the red channel contrast, for
4345 %  example, like this:
4346 %
4347 %      channel_features=MagickGetImageFeatures(wand,1);
4348 %      contrast=channel_features[RedPixelChannel].contrast[0];
4349 %
4350 %  Use MagickRelinquishMemory() to free the statistics buffer.
4351 %
4352 %  The format of the MagickGetImageFeatures method is:
4353 %
4354 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4355 %        const size_t distance)
4356 %
4357 %  A description of each parameter follows:
4358 %
4359 %    o wand: the magick wand.
4360 %
4361 %    o distance: the distance.
4362 %
4363 */
MagickGetImageFeatures(MagickWand * wand,const size_t distance)4364 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4365   const size_t distance)
4366 {
4367   assert(wand != (MagickWand *) NULL);
4368   assert(wand->signature == MagickWandSignature);
4369   if (wand->debug != MagickFalse)
4370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4371   if (wand->images == (Image *) NULL)
4372     {
4373       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4374         "ContainsNoImages","`%s'",wand->name);
4375       return((ChannelFeatures *) NULL);
4376     }
4377   return(GetImageFeatures(wand->images,distance,wand->exception));
4378 }
4379 
4380 /*
4381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4382 %                                                                             %
4383 %                                                                             %
4384 %                                                                             %
4385 %   M a g i c k G e t I m a g e K u r t o s i s                               %
4386 %                                                                             %
4387 %                                                                             %
4388 %                                                                             %
4389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4390 %
4391 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4392 %  more image channels.
4393 %
4394 %  The format of the MagickGetImageKurtosis method is:
4395 %
4396 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4397 %        double *kurtosis,double *skewness)
4398 %
4399 %  A description of each parameter follows:
4400 %
4401 %    o wand: the magick wand.
4402 %
4403 %    o kurtosis:  The kurtosis for the specified channel(s).
4404 %
4405 %    o skewness:  The skewness for the specified channel(s).
4406 %
4407 */
MagickGetImageKurtosis(MagickWand * wand,double * kurtosis,double * skewness)4408 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4409   double *kurtosis,double *skewness)
4410 {
4411   MagickBooleanType
4412     status;
4413 
4414   assert(wand != (MagickWand *) NULL);
4415   assert(wand->signature == MagickWandSignature);
4416   if (wand->debug != MagickFalse)
4417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4418   if (wand->images == (Image *) NULL)
4419     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4420   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4421   return(status);
4422 }
4423 
4424 /*
4425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4426 %                                                                             %
4427 %                                                                             %
4428 %                                                                             %
4429 %   M a g i c k G e t I m a g e M e a n                                       %
4430 %                                                                             %
4431 %                                                                             %
4432 %                                                                             %
4433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4434 %
4435 %  MagickGetImageMean() gets the mean and standard deviation of one or more
4436 %  image channels.
4437 %
4438 %  The format of the MagickGetImageMean method is:
4439 %
4440 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4441 %        double *standard_deviation)
4442 %
4443 %  A description of each parameter follows:
4444 %
4445 %    o wand: the magick wand.
4446 %
4447 %    o channel: the image channel(s).
4448 %
4449 %    o mean:  The mean pixel value for the specified channel(s).
4450 %
4451 %    o standard_deviation:  The standard deviation for the specified channel(s).
4452 %
4453 */
MagickGetImageMean(MagickWand * wand,double * mean,double * standard_deviation)4454 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4455   double *standard_deviation)
4456 {
4457   MagickBooleanType
4458     status;
4459 
4460   assert(wand != (MagickWand *) NULL);
4461   assert(wand->signature == MagickWandSignature);
4462   if (wand->debug != MagickFalse)
4463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4464   if (wand->images == (Image *) NULL)
4465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4466   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4467   return(status);
4468 }
4469 
4470 /*
4471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4472 %                                                                             %
4473 %                                                                             %
4474 %                                                                             %
4475 %   M a g i c k G e t I m a g e R a n g e                                     %
4476 %                                                                             %
4477 %                                                                             %
4478 %                                                                             %
4479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4480 %
4481 %  MagickGetImageRange() gets the range for one or more image channels.
4482 %
4483 %  The format of the MagickGetImageRange method is:
4484 %
4485 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4486 %        double *maxima)
4487 %
4488 %  A description of each parameter follows:
4489 %
4490 %    o wand: the magick wand.
4491 %
4492 %    o minima:  The minimum pixel value for the specified channel(s).
4493 %
4494 %    o maxima:  The maximum pixel value for the specified channel(s).
4495 %
4496 */
MagickGetImageRange(MagickWand * wand,double * minima,double * maxima)4497 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4498   double *minima,double *maxima)
4499 {
4500   MagickBooleanType
4501     status;
4502 
4503   assert(wand != (MagickWand *) NULL);
4504   assert(wand->signature == MagickWandSignature);
4505   if (wand->debug != MagickFalse)
4506     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4507   if (wand->images == (Image *) NULL)
4508     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4509   status=GetImageRange(wand->images,minima,maxima,wand->exception);
4510   return(status);
4511 }
4512 
4513 /*
4514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4515 %                                                                             %
4516 %                                                                             %
4517 %                                                                             %
4518 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4519 %                                                                             %
4520 %                                                                             %
4521 %                                                                             %
4522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4523 %
4524 %  MagickGetImageStatistics() returns statistics for each channel in the
4525 %  image.  The statistics include the channel depth, its minima and
4526 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4527 %  You can access the red channel mean, for example, like this:
4528 %
4529 %      channel_statistics=MagickGetImageStatistics(wand);
4530 %      red_mean=channel_statistics[RedPixelChannel].mean;
4531 %
4532 %  Use MagickRelinquishMemory() to free the statistics buffer.
4533 %
4534 %  The format of the MagickGetImageStatistics method is:
4535 %
4536 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4537 %
4538 %  A description of each parameter follows:
4539 %
4540 %    o wand: the magick wand.
4541 %
4542 */
MagickGetImageStatistics(MagickWand * wand)4543 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4544 {
4545   assert(wand != (MagickWand *) NULL);
4546   assert(wand->signature == MagickWandSignature);
4547   if (wand->debug != MagickFalse)
4548     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4549   if (wand->images == (Image *) NULL)
4550     {
4551       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4552         "ContainsNoImages","`%s'",wand->name);
4553       return((ChannelStatistics *) NULL);
4554     }
4555   return(GetImageStatistics(wand->images,wand->exception));
4556 }
4557 
4558 /*
4559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4560 %                                                                             %
4561 %                                                                             %
4562 %                                                                             %
4563 %   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                     %
4564 %                                                                             %
4565 %                                                                             %
4566 %                                                                             %
4567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4568 %
4569 %  MagickGetImageColormapColor() returns the color of the specified colormap
4570 %  index.
4571 %
4572 %  The format of the MagickGetImageColormapColor method is:
4573 %
4574 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4575 %        const size_t index,PixelWand *color)
4576 %
4577 %  A description of each parameter follows:
4578 %
4579 %    o wand: the magick wand.
4580 %
4581 %    o index: the offset into the image colormap.
4582 %
4583 %    o color: Return the colormap color in this wand.
4584 %
4585 */
MagickGetImageColormapColor(MagickWand * wand,const size_t index,PixelWand * color)4586 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4587   const size_t index,PixelWand *color)
4588 {
4589   assert(wand != (MagickWand *) NULL);
4590   assert(wand->signature == MagickWandSignature);
4591   if (wand->debug != MagickFalse)
4592     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4593   if (wand->images == (Image *) NULL)
4594     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4595   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4596       (index >= wand->images->colors))
4597     {
4598       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4599         "InvalidColormapIndex","`%s'",wand->name);
4600       return(MagickFalse);
4601     }
4602   PixelSetPixelColor(color,wand->images->colormap+index);
4603   return(MagickTrue);
4604 }
4605 
4606 /*
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4608 %                                                                             %
4609 %                                                                             %
4610 %                                                                             %
4611 %   M a g i c k G e t I m a g e C o l o r s                                   %
4612 %                                                                             %
4613 %                                                                             %
4614 %                                                                             %
4615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4616 %
4617 %  MagickGetImageColors() gets the number of unique colors in the image.
4618 %
4619 %  The format of the MagickGetImageColors method is:
4620 %
4621 %      size_t MagickGetImageColors(MagickWand *wand)
4622 %
4623 %  A description of each parameter follows:
4624 %
4625 %    o wand: the magick wand.
4626 %
4627 */
MagickGetImageColors(MagickWand * wand)4628 WandExport size_t MagickGetImageColors(MagickWand *wand)
4629 {
4630   assert(wand != (MagickWand *) NULL);
4631   assert(wand->signature == MagickWandSignature);
4632   if (wand->debug != MagickFalse)
4633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4634   if (wand->images == (Image *) NULL)
4635     {
4636       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4637         "ContainsNoImages","`%s'",wand->name);
4638       return(0);
4639     }
4640   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4641 }
4642 
4643 /*
4644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4645 %                                                                             %
4646 %                                                                             %
4647 %                                                                             %
4648 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4649 %                                                                             %
4650 %                                                                             %
4651 %                                                                             %
4652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4653 %
4654 %  MagickGetImageColorspace() gets the image colorspace.
4655 %
4656 %  The format of the MagickGetImageColorspace method is:
4657 %
4658 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4659 %
4660 %  A description of each parameter follows:
4661 %
4662 %    o wand: the magick wand.
4663 %
4664 */
MagickGetImageColorspace(MagickWand * wand)4665 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4666 {
4667   assert(wand != (MagickWand *) NULL);
4668   assert(wand->signature == MagickWandSignature);
4669   if (wand->debug != MagickFalse)
4670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4671   if (wand->images == (Image *) NULL)
4672     {
4673       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4674         "ContainsNoImages","`%s'",wand->name);
4675       return(UndefinedColorspace);
4676     }
4677   return(wand->images->colorspace);
4678 }
4679 
4680 /*
4681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4682 %                                                                             %
4683 %                                                                             %
4684 %                                                                             %
4685 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4686 %                                                                             %
4687 %                                                                             %
4688 %                                                                             %
4689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4690 %
4691 %  MagickGetImageCompose() returns the composite operator associated with the
4692 %  image.
4693 %
4694 %  The format of the MagickGetImageCompose method is:
4695 %
4696 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4697 %
4698 %  A description of each parameter follows:
4699 %
4700 %    o wand: the magick wand.
4701 %
4702 */
MagickGetImageCompose(MagickWand * wand)4703 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4704 {
4705   assert(wand != (MagickWand *) NULL);
4706   assert(wand->signature == MagickWandSignature);
4707   if (wand->debug != MagickFalse)
4708     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4709   if (wand->images == (Image *) NULL)
4710     {
4711       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4712         "ContainsNoImages","`%s'",wand->name);
4713       return(UndefinedCompositeOp);
4714     }
4715   return(wand->images->compose);
4716 }
4717 
4718 /*
4719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4720 %                                                                             %
4721 %                                                                             %
4722 %                                                                             %
4723 %   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                         %
4724 %                                                                             %
4725 %                                                                             %
4726 %                                                                             %
4727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4728 %
4729 %  MagickGetImageCompression() gets the image compression.
4730 %
4731 %  The format of the MagickGetImageCompression method is:
4732 %
4733 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4734 %
4735 %  A description of each parameter follows:
4736 %
4737 %    o wand: the magick wand.
4738 %
4739 */
MagickGetImageCompression(MagickWand * wand)4740 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4741 {
4742   assert(wand != (MagickWand *) NULL);
4743   assert(wand->signature == MagickWandSignature);
4744   if (wand->debug != MagickFalse)
4745     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4746   if (wand->images == (Image *) NULL)
4747     {
4748       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4749         "ContainsNoImages","`%s'",wand->name);
4750       return(UndefinedCompression);
4751     }
4752   return(wand->images->compression);
4753 }
4754 
4755 /*
4756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4757 %                                                                             %
4758 %                                                                             %
4759 %                                                                             %
4760 %   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           %
4761 %                                                                             %
4762 %                                                                             %
4763 %                                                                             %
4764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4765 %
4766 %  MagickGetImageCompressionQuality() gets the image compression quality.
4767 %
4768 %  The format of the MagickGetImageCompressionQuality method is:
4769 %
4770 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4771 %
4772 %  A description of each parameter follows:
4773 %
4774 %    o wand: the magick wand.
4775 %
4776 */
MagickGetImageCompressionQuality(MagickWand * wand)4777 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4778 {
4779   assert(wand != (MagickWand *) NULL);
4780   assert(wand->signature == MagickWandSignature);
4781   if (wand->debug != MagickFalse)
4782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4783   if (wand->images == (Image *) NULL)
4784     {
4785       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4786         "ContainsNoImages","`%s'",wand->name);
4787       return(0UL);
4788     }
4789   return(wand->images->quality);
4790 }
4791 
4792 /*
4793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4794 %                                                                             %
4795 %                                                                             %
4796 %                                                                             %
4797 %   M a g i c k G e t I m a g e D e l a y                                     %
4798 %                                                                             %
4799 %                                                                             %
4800 %                                                                             %
4801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4802 %
4803 %  MagickGetImageDelay() gets the image delay.
4804 %
4805 %  The format of the MagickGetImageDelay method is:
4806 %
4807 %      size_t MagickGetImageDelay(MagickWand *wand)
4808 %
4809 %  A description of each parameter follows:
4810 %
4811 %    o wand: the magick wand.
4812 %
4813 */
MagickGetImageDelay(MagickWand * wand)4814 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4815 {
4816   assert(wand != (MagickWand *) NULL);
4817   assert(wand->signature == MagickWandSignature);
4818   if (wand->debug != MagickFalse)
4819     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4820   if (wand->images == (Image *) NULL)
4821     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4822   return(wand->images->delay);
4823 }
4824 
4825 /*
4826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4827 %                                                                             %
4828 %                                                                             %
4829 %                                                                             %
4830 %   M a g i c k G e t I m a g e D e p t h                                     %
4831 %                                                                             %
4832 %                                                                             %
4833 %                                                                             %
4834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4835 %
4836 %  MagickGetImageDepth() gets the image depth.
4837 %
4838 %  The format of the MagickGetImageDepth method is:
4839 %
4840 %      size_t MagickGetImageDepth(MagickWand *wand)
4841 %
4842 %  A description of each parameter follows:
4843 %
4844 %    o wand: the magick wand.
4845 %
4846 */
MagickGetImageDepth(MagickWand * wand)4847 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4848 {
4849   assert(wand != (MagickWand *) NULL);
4850   assert(wand->signature == MagickWandSignature);
4851   if (wand->debug != MagickFalse)
4852     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4853   if (wand->images == (Image *) NULL)
4854     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4855   return(wand->images->depth);
4856 }
4857 
4858 /*
4859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4860 %                                                                             %
4861 %                                                                             %
4862 %                                                                             %
4863 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4864 %                                                                             %
4865 %                                                                             %
4866 %                                                                             %
4867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4868 %
4869 %  MagickGetImageDispose() gets the image disposal method.
4870 %
4871 %  The format of the MagickGetImageDispose method is:
4872 %
4873 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4874 %
4875 %  A description of each parameter follows:
4876 %
4877 %    o wand: the magick wand.
4878 %
4879 */
MagickGetImageDispose(MagickWand * wand)4880 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4881 {
4882   assert(wand != (MagickWand *) NULL);
4883   assert(wand->signature == MagickWandSignature);
4884   if (wand->debug != MagickFalse)
4885     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4886   if (wand->images == (Image *) NULL)
4887     {
4888       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4889         "ContainsNoImages","`%s'",wand->name);
4890       return(UndefinedDispose);
4891     }
4892   return((DisposeType) wand->images->dispose);
4893 }
4894 
4895 /*
4896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4897 %                                                                             %
4898 %                                                                             %
4899 %                                                                             %
4900 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4901 %                                                                             %
4902 %                                                                             %
4903 %                                                                             %
4904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4905 %
4906 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4907 %  returns the specified distortion metric.
4908 %
4909 %  The format of the MagickGetImageDistortion method is:
4910 %
4911 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4912 %        const MagickWand *reference,const MetricType metric,
4913 %        double *distortion)
4914 %
4915 %  A description of each parameter follows:
4916 %
4917 %    o wand: the magick wand.
4918 %
4919 %    o reference: the reference wand.
4920 %
4921 %    o metric: the metric.
4922 %
4923 %    o distortion: the computed distortion between the images.
4924 %
4925 */
MagickGetImageDistortion(MagickWand * wand,const MagickWand * reference,const MetricType metric,double * distortion)4926 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4927   const MagickWand *reference,const MetricType metric,double *distortion)
4928 {
4929   MagickBooleanType
4930     status;
4931 
4932   assert(wand != (MagickWand *) NULL);
4933   assert(wand->signature == MagickWandSignature);
4934   if (wand->debug != MagickFalse)
4935     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4936   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4937     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4938   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4939     wand->exception);
4940   return(status);
4941 }
4942 
4943 /*
4944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4945 %                                                                             %
4946 %                                                                             %
4947 %                                                                             %
4948 %   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                         %
4949 %                                                                             %
4950 %                                                                             %
4951 %                                                                             %
4952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4953 %
4954 %  MagickGetImageDistortions() compares one or more pixel channels of an
4955 %  image to a reconstructed image and returns the specified distortion metrics.
4956 %
4957 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4958 %
4959 %  The format of the MagickGetImageDistortion method is:
4960 %
4961 %      double *MagickGetImageDistortion(MagickWand *wand,
4962 %        const MagickWand *reference,const MetricType metric)
4963 %
4964 %  A description of each parameter follows:
4965 %
4966 %    o wand: the magick wand.
4967 %
4968 %    o reference: the reference wand.
4969 %
4970 %    o metric: the metric.
4971 %
4972 */
MagickGetImageDistortions(MagickWand * wand,const MagickWand * reference,const MetricType metric)4973 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4974   const MagickWand *reference,const MetricType metric)
4975 {
4976   double
4977     *channel_distortion;
4978 
4979   assert(wand != (MagickWand *) NULL);
4980   assert(wand->signature == MagickWandSignature);
4981   if (wand->debug != MagickFalse)
4982     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4983   assert(reference != (MagickWand *) NULL);
4984   assert(reference->signature == MagickWandSignature);
4985   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4986     {
4987       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4988         "ContainsNoImages","`%s'",wand->name);
4989       return((double *) NULL);
4990     }
4991   channel_distortion=GetImageDistortions(wand->images,reference->images,
4992     metric,wand->exception);
4993   return(channel_distortion);
4994 }
4995 
4996 /*
4997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4998 %                                                                             %
4999 %                                                                             %
5000 %                                                                             %
5001 %   M a g i c k G e t I m a g e E n d i a n                                   %
5002 %                                                                             %
5003 %                                                                             %
5004 %                                                                             %
5005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5006 %
5007 %  MagickGetImageEndian() gets the image endian.
5008 %
5009 %  The format of the MagickGetImageEndian method is:
5010 %
5011 %      EndianType MagickGetImageEndian(MagickWand *wand)
5012 %
5013 %  A description of each parameter follows:
5014 %
5015 %    o wand: the magick wand.
5016 %
5017 */
MagickGetImageEndian(MagickWand * wand)5018 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
5019 {
5020   assert(wand != (MagickWand *) NULL);
5021   assert(wand->signature == MagickWandSignature);
5022   if (wand->debug != MagickFalse)
5023     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5024   if (wand->images == (Image *) NULL)
5025     {
5026       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5027         "ContainsNoImages","`%s'",wand->name);
5028       return(UndefinedEndian);
5029     }
5030   return(wand->images->endian);
5031 }
5032 
5033 /*
5034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5035 %                                                                             %
5036 %                                                                             %
5037 %                                                                             %
5038 %   M a g i c k G e t I m a g e F i l e n a m e                               %
5039 %                                                                             %
5040 %                                                                             %
5041 %                                                                             %
5042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5043 %
5044 %  MagickGetImageFilename() returns the filename of a particular image in a
5045 %  sequence.
5046 %
5047 %  The format of the MagickGetImageFilename method is:
5048 %
5049 %      char *MagickGetImageFilename(MagickWand *wand)
5050 %
5051 %  A description of each parameter follows:
5052 %
5053 %    o wand: the magick wand.
5054 %
5055 */
MagickGetImageFilename(MagickWand * wand)5056 WandExport char *MagickGetImageFilename(MagickWand *wand)
5057 {
5058   assert(wand != (MagickWand *) NULL);
5059   assert(wand->signature == MagickWandSignature);
5060   if (wand->debug != MagickFalse)
5061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5062   if (wand->images == (Image *) NULL)
5063     {
5064       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5065         "ContainsNoImages","`%s'",wand->name);
5066       return((char *) NULL);
5067     }
5068   return(AcquireString(wand->images->filename));
5069 }
5070 
5071 /*
5072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5073 %                                                                             %
5074 %                                                                             %
5075 %                                                                             %
5076 %   M a g i c k G e t I m a g e F o r m a t                                   %
5077 %                                                                             %
5078 %                                                                             %
5079 %                                                                             %
5080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5081 %
5082 %  MagickGetImageFormat() returns the format of a particular image in a
5083 %  sequence.
5084 %
5085 %  The format of the MagickGetImageFormat method is:
5086 %
5087 %      char *MagickGetImageFormat(MagickWand *wand)
5088 %
5089 %  A description of each parameter follows:
5090 %
5091 %    o wand: the magick wand.
5092 %
5093 */
MagickGetImageFormat(MagickWand * wand)5094 WandExport char *MagickGetImageFormat(MagickWand *wand)
5095 {
5096   assert(wand != (MagickWand *) NULL);
5097   assert(wand->signature == MagickWandSignature);
5098   if (wand->debug != MagickFalse)
5099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5100   if (wand->images == (Image *) NULL)
5101     {
5102       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5103         "ContainsNoImages","`%s'",wand->name);
5104       return((char *) NULL);
5105     }
5106   return(AcquireString(wand->images->magick));
5107 }
5108 
5109 /*
5110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5111 %                                                                             %
5112 %                                                                             %
5113 %                                                                             %
5114 %   M a g i c k G e t I m a g e F u z z                                       %
5115 %                                                                             %
5116 %                                                                             %
5117 %                                                                             %
5118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5119 %
5120 %  MagickGetImageFuzz() gets the image fuzz.
5121 %
5122 %  The format of the MagickGetImageFuzz method is:
5123 %
5124 %      double MagickGetImageFuzz(MagickWand *wand)
5125 %
5126 %  A description of each parameter follows:
5127 %
5128 %    o wand: the magick wand.
5129 %
5130 */
MagickGetImageFuzz(MagickWand * wand)5131 WandExport double MagickGetImageFuzz(MagickWand *wand)
5132 {
5133   assert(wand != (MagickWand *) NULL);
5134   assert(wand->signature == MagickWandSignature);
5135   if (wand->debug != MagickFalse)
5136     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5137   if (wand->images == (Image *) NULL)
5138     {
5139       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5140         "ContainsNoImages","`%s'",wand->name);
5141       return(0.0);
5142     }
5143   return(wand->images->fuzz);
5144 }
5145 
5146 /*
5147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5148 %                                                                             %
5149 %                                                                             %
5150 %                                                                             %
5151 %   M a g i c k G e t I m a g e G a m m a                                     %
5152 %                                                                             %
5153 %                                                                             %
5154 %                                                                             %
5155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5156 %
5157 %  MagickGetImageGamma() gets the image gamma.
5158 %
5159 %  The format of the MagickGetImageGamma method is:
5160 %
5161 %      double MagickGetImageGamma(MagickWand *wand)
5162 %
5163 %  A description of each parameter follows:
5164 %
5165 %    o wand: the magick wand.
5166 %
5167 */
MagickGetImageGamma(MagickWand * wand)5168 WandExport double MagickGetImageGamma(MagickWand *wand)
5169 {
5170   assert(wand != (MagickWand *) NULL);
5171   assert(wand->signature == MagickWandSignature);
5172   if (wand->debug != MagickFalse)
5173     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5174   if (wand->images == (Image *) NULL)
5175     {
5176       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5177         "ContainsNoImages","`%s'",wand->name);
5178       return(0.0);
5179     }
5180   return(wand->images->gamma);
5181 }
5182 
5183 /*
5184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5185 %                                                                             %
5186 %                                                                             %
5187 %                                                                             %
5188 %   M a g i c k G e t I m a g e G r a v i t y                                 %
5189 %                                                                             %
5190 %                                                                             %
5191 %                                                                             %
5192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5193 %
5194 %  MagickGetImageGravity() gets the image gravity.
5195 %
5196 %  The format of the MagickGetImageGravity method is:
5197 %
5198 %      GravityType MagickGetImageGravity(MagickWand *wand)
5199 %
5200 %  A description of each parameter follows:
5201 %
5202 %    o wand: the magick wand.
5203 %
5204 */
MagickGetImageGravity(MagickWand * wand)5205 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5206 {
5207   assert(wand != (MagickWand *) NULL);
5208   assert(wand->signature == MagickWandSignature);
5209   if (wand->debug != MagickFalse)
5210     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5211   if (wand->images == (Image *) NULL)
5212     {
5213       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5214         "ContainsNoImages","`%s'",wand->name);
5215       return(UndefinedGravity);
5216     }
5217   return(wand->images->gravity);
5218 }
5219 
5220 /*
5221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5222 %                                                                             %
5223 %                                                                             %
5224 %                                                                             %
5225 %   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                       %
5226 %                                                                             %
5227 %                                                                             %
5228 %                                                                             %
5229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5230 %
5231 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5232 %
5233 %  The format of the MagickGetImageGreenPrimary method is:
5234 %
5235 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5236 %        double *y,double *z)
5237 %
5238 %  A description of each parameter follows:
5239 %
5240 %    o wand: the magick wand.
5241 %
5242 %    o x: the chromaticity green primary x-point.
5243 %
5244 %    o y: the chromaticity green primary y-point.
5245 %
5246 %    o z: the chromaticity green primary z-point.
5247 %
5248 */
MagickGetImageGreenPrimary(MagickWand * wand,double * x,double * y,double * z)5249 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5250   double *x,double *y,double *z)
5251 {
5252   assert(wand != (MagickWand *) NULL);
5253   assert(wand->signature == MagickWandSignature);
5254   if (wand->debug != MagickFalse)
5255     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5256   if (wand->images == (Image *) NULL)
5257     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5258   *x=wand->images->chromaticity.green_primary.x;
5259   *y=wand->images->chromaticity.green_primary.y;
5260   *z=wand->images->chromaticity.green_primary.z;
5261   return(MagickTrue);
5262 }
5263 
5264 /*
5265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5266 %                                                                             %
5267 %                                                                             %
5268 %                                                                             %
5269 %   M a g i c k G e t I m a g e H e i g h t                                   %
5270 %                                                                             %
5271 %                                                                             %
5272 %                                                                             %
5273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5274 %
5275 %  MagickGetImageHeight() returns the image height.
5276 %
5277 %  The format of the MagickGetImageHeight method is:
5278 %
5279 %      size_t MagickGetImageHeight(MagickWand *wand)
5280 %
5281 %  A description of each parameter follows:
5282 %
5283 %    o wand: the magick wand.
5284 %
5285 */
MagickGetImageHeight(MagickWand * wand)5286 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5287 {
5288   assert(wand != (MagickWand *) NULL);
5289   assert(wand->signature == MagickWandSignature);
5290   if (wand->debug != MagickFalse)
5291     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5292   if (wand->images == (Image *) NULL)
5293     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5294   return(wand->images->rows);
5295 }
5296 
5297 /*
5298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5299 %                                                                             %
5300 %                                                                             %
5301 %                                                                             %
5302 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
5303 %                                                                             %
5304 %                                                                             %
5305 %                                                                             %
5306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5307 %
5308 %  MagickGetImageHistogram() returns the image histogram as an array of
5309 %  PixelWand wands.
5310 %
5311 %  The format of the MagickGetImageHistogram method is:
5312 %
5313 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5314 %        size_t *number_colors)
5315 %
5316 %  A description of each parameter follows:
5317 %
5318 %    o wand: the magick wand.
5319 %
5320 %    o number_colors: the number of unique colors in the image and the number
5321 %      of pixel wands returned.
5322 %
5323 */
MagickGetImageHistogram(MagickWand * wand,size_t * number_colors)5324 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5325   size_t *number_colors)
5326 {
5327   PixelInfo
5328     *histogram;
5329 
5330   PixelWand
5331     **pixel_wands;
5332 
5333   ssize_t
5334     i;
5335 
5336   assert(wand != (MagickWand *) NULL);
5337   assert(wand->signature == MagickWandSignature);
5338   if (wand->debug != MagickFalse)
5339     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5340   if (wand->images == (Image *) NULL)
5341     {
5342       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5343         "ContainsNoImages","`%s'",wand->name);
5344       return((PixelWand **) NULL);
5345     }
5346   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5347   if (histogram == (PixelInfo *) NULL)
5348     return((PixelWand **) NULL);
5349   pixel_wands=NewPixelWands(*number_colors);
5350   for (i=0; i < (ssize_t) *number_colors; i++)
5351   {
5352     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5353     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5354   }
5355   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5356   return(pixel_wands);
5357 }
5358 
5359 /*
5360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5361 %                                                                             %
5362 %                                                                             %
5363 %                                                                             %
5364 %   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                 %
5365 %                                                                             %
5366 %                                                                             %
5367 %                                                                             %
5368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5369 %
5370 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5371 %
5372 %  The format of the MagickGetImageInterlaceScheme method is:
5373 %
5374 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5375 %
5376 %  A description of each parameter follows:
5377 %
5378 %    o wand: the magick wand.
5379 %
5380 */
MagickGetImageInterlaceScheme(MagickWand * wand)5381 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5382 {
5383   assert(wand != (MagickWand *) NULL);
5384   assert(wand->signature == MagickWandSignature);
5385   if (wand->debug != MagickFalse)
5386     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5387   if (wand->images == (Image *) NULL)
5388     {
5389       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5390         "ContainsNoImages","`%s'",wand->name);
5391       return(UndefinedInterlace);
5392     }
5393   return(wand->images->interlace);
5394 }
5395 
5396 /*
5397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5398 %                                                                             %
5399 %                                                                             %
5400 %                                                                             %
5401 %   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             %
5402 %                                                                             %
5403 %                                                                             %
5404 %                                                                             %
5405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5406 %
5407 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5408 %  sepcified image.
5409 %
5410 %  The format of the MagickGetImageInterpolateMethod method is:
5411 %
5412 %      PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5413 %
5414 %  A description of each parameter follows:
5415 %
5416 %    o wand: the magick wand.
5417 %
5418 */
MagickGetImageInterpolateMethod(MagickWand * wand)5419 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5420   MagickWand *wand)
5421 {
5422   assert(wand != (MagickWand *) NULL);
5423   assert(wand->signature == MagickWandSignature);
5424   if (wand->debug != MagickFalse)
5425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5426   if (wand->images == (Image *) NULL)
5427     {
5428       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5429         "ContainsNoImages","`%s'",wand->name);
5430       return(UndefinedInterpolatePixel);
5431     }
5432   return(wand->images->interpolate);
5433 }
5434 
5435 /*
5436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5437 %                                                                             %
5438 %                                                                             %
5439 %                                                                             %
5440 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5441 %                                                                             %
5442 %                                                                             %
5443 %                                                                             %
5444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5445 %
5446 %  MagickGetImageIterations() gets the image iterations.
5447 %
5448 %  The format of the MagickGetImageIterations method is:
5449 %
5450 %      size_t MagickGetImageIterations(MagickWand *wand)
5451 %
5452 %  A description of each parameter follows:
5453 %
5454 %    o wand: the magick wand.
5455 %
5456 */
MagickGetImageIterations(MagickWand * wand)5457 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5458 {
5459   assert(wand != (MagickWand *) NULL);
5460   assert(wand->signature == MagickWandSignature);
5461   if (wand->debug != MagickFalse)
5462     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5463   if (wand->images == (Image *) NULL)
5464     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5465   return(wand->images->iterations);
5466 }
5467 
5468 /*
5469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5470 %                                                                             %
5471 %                                                                             %
5472 %                                                                             %
5473 %   M a g i c k G e t I m a g e L e n g t h                                   %
5474 %                                                                             %
5475 %                                                                             %
5476 %                                                                             %
5477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5478 %
5479 %  MagickGetImageLength() returns the image length in bytes.
5480 %
5481 %  The format of the MagickGetImageLength method is:
5482 %
5483 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5484 %        MagickSizeType *length)
5485 %
5486 %  A description of each parameter follows:
5487 %
5488 %    o wand: the magick wand.
5489 %
5490 %    o length: the image length in bytes.
5491 %
5492 */
MagickGetImageLength(MagickWand * wand,MagickSizeType * length)5493 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5494   MagickSizeType *length)
5495 {
5496   assert(wand != (MagickWand *) NULL);
5497   assert(wand->signature == MagickWandSignature);
5498   if (wand->debug != MagickFalse)
5499     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5500   if (wand->images == (Image *) NULL)
5501     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5502   *length=GetBlobSize(wand->images);
5503   return(MagickTrue);
5504 }
5505 
5506 /*
5507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5508 %                                                                             %
5509 %                                                                             %
5510 %                                                                             %
5511 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5512 %                                                                             %
5513 %                                                                             %
5514 %                                                                             %
5515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5516 %
5517 %  MagickGetImageMatteColor() returns the image matte color.
5518 %
5519 %  The format of the MagickGetImageMatteColor method is:
5520 %
5521 %      MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5522 %        PixelWand *matte_color)
5523 %
5524 %  A description of each parameter follows:
5525 %
5526 %    o wand: the magick wand.
5527 %
5528 %    o matte_color: return the alpha color.
5529 %
5530 */
MagickGetImageMatteColor(MagickWand * wand,PixelWand * matte_color)5531 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5532   PixelWand *matte_color)
5533 {
5534   assert(wand != (MagickWand *)NULL);
5535   assert(wand->signature == MagickWandSignature);
5536   if (wand->debug != MagickFalse)
5537     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5538   if (wand->images == (Image *)NULL)
5539     ThrowWandException(WandError, "ContainsNoImages", wand->name);
5540   PixelSetPixelColor(matte_color,&wand->images->matte_color);
5541   return(MagickTrue);
5542 }
5543 
5544 /*
5545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5546 %                                                                             %
5547 %                                                                             %
5548 %                                                                             %
5549 %   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                         %
5550 %                                                                             %
5551 %                                                                             %
5552 %                                                                             %
5553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5554 %
5555 %  MagickGetImageOrientation() returns the image orientation.
5556 %
5557 %  The format of the MagickGetImageOrientation method is:
5558 %
5559 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5560 %
5561 %  A description of each parameter follows:
5562 %
5563 %    o wand: the magick wand.
5564 %
5565 */
MagickGetImageOrientation(MagickWand * wand)5566 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5567 {
5568   assert(wand != (MagickWand *) NULL);
5569   assert(wand->signature == MagickWandSignature);
5570   if (wand->debug != MagickFalse)
5571     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5572   if (wand->images == (Image *) NULL)
5573     {
5574       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5575         "ContainsNoImages","`%s'",wand->name);
5576       return(UndefinedOrientation);
5577     }
5578   return(wand->images->orientation);
5579 }
5580 
5581 /*
5582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5583 %                                                                             %
5584 %                                                                             %
5585 %                                                                             %
5586 %   M a g i c k G e t I m a g e P a g e                                       %
5587 %                                                                             %
5588 %                                                                             %
5589 %                                                                             %
5590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5591 %
5592 %  MagickGetImagePage() returns the page geometry associated with the image.
5593 %
5594 %  The format of the MagickGetImagePage method is:
5595 %
5596 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5597 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5598 %
5599 %  A description of each parameter follows:
5600 %
5601 %    o wand: the magick wand.
5602 %
5603 %    o width: the page width.
5604 %
5605 %    o height: the page height.
5606 %
5607 %    o x: the page x-offset.
5608 %
5609 %    o y: the page y-offset.
5610 %
5611 */
MagickGetImagePage(MagickWand * wand,size_t * width,size_t * height,ssize_t * x,ssize_t * y)5612 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5613   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5614 {
5615   assert(wand != (const MagickWand *) NULL);
5616   assert(wand->signature == MagickWandSignature);
5617   if (wand->debug != MagickFalse)
5618     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5619   if (wand->images == (Image *) NULL)
5620     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5621   *width=wand->images->page.width;
5622   *height=wand->images->page.height;
5623   *x=wand->images->page.x;
5624   *y=wand->images->page.y;
5625   return(MagickTrue);
5626 }
5627 
5628 /*
5629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5630 %                                                                             %
5631 %                                                                             %
5632 %                                                                             %
5633 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5634 %                                                                             %
5635 %                                                                             %
5636 %                                                                             %
5637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5638 %
5639 %  MagickGetImagePixelColor() gets the color of the specified pixel.
5640 %
5641 %  The format of the MagickGetImagePixelColor method is:
5642 %
5643 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5644 %        const ssize_t x,const ssize_t y,PixelWand *color)
5645 %
5646 %  A description of each parameter follows:
5647 %
5648 %    o wand: the magick wand.
5649 %
5650 %    o x,y: the pixel offset into the image.
5651 %
5652 %    o color: Return the colormap color in this wand.
5653 %
5654 */
MagickGetImagePixelColor(MagickWand * wand,const ssize_t x,const ssize_t y,PixelWand * color)5655 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5656   const ssize_t x,const ssize_t y,PixelWand *color)
5657 {
5658   const Quantum
5659     *p;
5660 
5661   CacheView
5662     *image_view;
5663 
5664   assert(wand != (MagickWand *) NULL);
5665   assert(wand->signature == MagickWandSignature);
5666   if (wand->debug != MagickFalse)
5667     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5668   if (wand->images == (Image *) NULL)
5669     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5670   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5671   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5672   if (p == (const Quantum *) NULL)
5673     {
5674       image_view=DestroyCacheView(image_view);
5675       return(MagickFalse);
5676     }
5677   PixelSetQuantumPixel(wand->images,p,color);
5678   image_view=DestroyCacheView(image_view);
5679   return(MagickTrue);
5680 }
5681 
5682 /*
5683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5684 %                                                                             %
5685 %                                                                             %
5686 %                                                                             %
5687 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5688 %                                                                             %
5689 %                                                                             %
5690 %                                                                             %
5691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5692 %
5693 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5694 %
5695 %  The format of the MagickGetImageRedPrimary method is:
5696 %
5697 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5698 %        double *y, double *z)
5699 %
5700 %  A description of each parameter follows:
5701 %
5702 %    o wand: the magick wand.
5703 %
5704 %    o x: the chromaticity red primary x-point.
5705 %
5706 %    o y: the chromaticity red primary y-point.
5707 %
5708 %    o z: the chromaticity red primary z-point.
5709 %
5710 */
MagickGetImageRedPrimary(MagickWand * wand,double * x,double * y,double * z)5711 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5712   double *x,double *y,double *z)
5713 {
5714   assert(wand != (MagickWand *) NULL);
5715   assert(wand->signature == MagickWandSignature);
5716   if (wand->debug != MagickFalse)
5717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5718   if (wand->images == (Image *) NULL)
5719     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5720   *x=wand->images->chromaticity.red_primary.x;
5721   *y=wand->images->chromaticity.red_primary.y;
5722   *z=wand->images->chromaticity.red_primary.z;
5723   return(MagickTrue);
5724 }
5725 
5726 /*
5727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5728 %                                                                             %
5729 %                                                                             %
5730 %                                                                             %
5731 %   M a g i c k G e t I m a g e R e g i o n                                   %
5732 %                                                                             %
5733 %                                                                             %
5734 %                                                                             %
5735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5736 %
5737 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5738 %  a new wand.
5739 %
5740 %  The format of the MagickGetImageRegion method is:
5741 %
5742 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5743 %        const size_t width,const size_t height,const ssize_t x,
5744 %        const ssize_t y)
5745 %
5746 %  A description of each parameter follows:
5747 %
5748 %    o wand: the magick wand.
5749 %
5750 %    o width: the region width.
5751 %
5752 %    o height: the region height.
5753 %
5754 %    o x: the region x offset.
5755 %
5756 %    o y: the region y offset.
5757 %
5758 */
MagickGetImageRegion(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)5759 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5760   const size_t width,const size_t height,const ssize_t x,
5761   const ssize_t y)
5762 {
5763   Image
5764     *region_image;
5765 
5766   RectangleInfo
5767     region;
5768 
5769   assert(wand != (MagickWand *) NULL);
5770   assert(wand->signature == MagickWandSignature);
5771   if (wand->debug != MagickFalse)
5772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5773   if (wand->images == (Image *) NULL)
5774     return((MagickWand *) NULL);
5775   region.width=width;
5776   region.height=height;
5777   region.x=x;
5778   region.y=y;
5779   region_image=CropImage(wand->images,&region,wand->exception);
5780   if (region_image == (Image *) NULL)
5781     return((MagickWand *) NULL);
5782   return(CloneMagickWandFromImages(wand,region_image));
5783 }
5784 
5785 /*
5786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5787 %                                                                             %
5788 %                                                                             %
5789 %                                                                             %
5790 %   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                 %
5791 %                                                                             %
5792 %                                                                             %
5793 %                                                                             %
5794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5795 %
5796 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5797 %
5798 %  The format of the MagickGetImageRenderingIntent method is:
5799 %
5800 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5801 %
5802 %  A description of each parameter follows:
5803 %
5804 %    o wand: the magick wand.
5805 %
5806 */
MagickGetImageRenderingIntent(MagickWand * wand)5807 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5808 {
5809   assert(wand != (MagickWand *) NULL);
5810   assert(wand->signature == MagickWandSignature);
5811   if (wand->debug != MagickFalse)
5812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5813   if (wand->images == (Image *) NULL)
5814     {
5815       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5816         "ContainsNoImages","`%s'",wand->name);
5817       return(UndefinedIntent);
5818     }
5819   return((RenderingIntent) wand->images->rendering_intent);
5820 }
5821 
5822 /*
5823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824 %                                                                             %
5825 %                                                                             %
5826 %                                                                             %
5827 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5828 %                                                                             %
5829 %                                                                             %
5830 %                                                                             %
5831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5832 %
5833 %  MagickGetImageResolution() gets the image X and Y resolution.
5834 %
5835 %  The format of the MagickGetImageResolution method is:
5836 %
5837 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5838 %        double *y)
5839 %
5840 %  A description of each parameter follows:
5841 %
5842 %    o wand: the magick wand.
5843 %
5844 %    o x: the image x-resolution.
5845 %
5846 %    o y: the image y-resolution.
5847 %
5848 */
MagickGetImageResolution(MagickWand * wand,double * x,double * y)5849 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5850   double *x,double *y)
5851 {
5852   assert(wand != (MagickWand *) NULL);
5853   assert(wand->signature == MagickWandSignature);
5854   if (wand->debug != MagickFalse)
5855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5856   if (wand->images == (Image *) NULL)
5857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5858   *x=wand->images->resolution.x;
5859   *y=wand->images->resolution.y;
5860   return(MagickTrue);
5861 }
5862 
5863 /*
5864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5865 %                                                                             %
5866 %                                                                             %
5867 %                                                                             %
5868 %   M a g i c k G e t I m a g e S c e n e                                     %
5869 %                                                                             %
5870 %                                                                             %
5871 %                                                                             %
5872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5873 %
5874 %  MagickGetImageScene() gets the image scene.
5875 %
5876 %  The format of the MagickGetImageScene method is:
5877 %
5878 %      size_t MagickGetImageScene(MagickWand *wand)
5879 %
5880 %  A description of each parameter follows:
5881 %
5882 %    o wand: the magick wand.
5883 %
5884 */
MagickGetImageScene(MagickWand * wand)5885 WandExport size_t MagickGetImageScene(MagickWand *wand)
5886 {
5887   assert(wand != (MagickWand *) NULL);
5888   assert(wand->signature == MagickWandSignature);
5889   if (wand->debug != MagickFalse)
5890     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5891   if (wand->images == (Image *) NULL)
5892     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5893   return(wand->images->scene);
5894 }
5895 
5896 /*
5897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5898 %                                                                             %
5899 %                                                                             %
5900 %                                                                             %
5901 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5902 %                                                                             %
5903 %                                                                             %
5904 %                                                                             %
5905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5906 %
5907 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5908 %  pixel stream.
5909 %
5910 %  The format of the MagickGetImageSignature method is:
5911 %
5912 %      char *MagickGetImageSignature(MagickWand *wand)
5913 %
5914 %  A description of each parameter follows:
5915 %
5916 %    o wand: the magick wand.
5917 %
5918 */
MagickGetImageSignature(MagickWand * wand)5919 WandExport char *MagickGetImageSignature(MagickWand *wand)
5920 {
5921   const char
5922     *value;
5923 
5924   MagickBooleanType
5925     status;
5926 
5927   assert(wand != (MagickWand *) NULL);
5928   assert(wand->signature == MagickWandSignature);
5929   if (wand->debug != MagickFalse)
5930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5931   if (wand->images == (Image *) NULL)
5932     {
5933       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5934         "ContainsNoImages","`%s'",wand->name);
5935       return((char *) NULL);
5936     }
5937   status=SignatureImage(wand->images,wand->exception);
5938   if (status == MagickFalse)
5939     return((char *) NULL);
5940   value=GetImageProperty(wand->images,"signature",wand->exception);
5941   if (value == (const char *) NULL)
5942     return((char *) NULL);
5943   return(AcquireString(value));
5944 }
5945 
5946 /*
5947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5948 %                                                                             %
5949 %                                                                             %
5950 %                                                                             %
5951 %   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                   %
5952 %                                                                             %
5953 %                                                                             %
5954 %                                                                             %
5955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5956 %
5957 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5958 %
5959 %  The format of the MagickGetImageTicksPerSecond method is:
5960 %
5961 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5962 %
5963 %  A description of each parameter follows:
5964 %
5965 %    o wand: the magick wand.
5966 %
5967 */
MagickGetImageTicksPerSecond(MagickWand * wand)5968 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5969 {
5970   assert(wand != (MagickWand *) NULL);
5971   assert(wand->signature == MagickWandSignature);
5972   if (wand->debug != MagickFalse)
5973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5974   if (wand->images == (Image *) NULL)
5975     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5976   return((size_t) wand->images->ticks_per_second);
5977 }
5978 
5979 /*
5980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5981 %                                                                             %
5982 %                                                                             %
5983 %                                                                             %
5984 %   M a g i c k G e t I m a g e T y p e                                       %
5985 %                                                                             %
5986 %                                                                             %
5987 %                                                                             %
5988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5989 %
5990 %  MagickGetImageType() gets the potential image type:
5991 %
5992 %        Bilevel        Grayscale       GrayscaleMatte
5993 %        Palette        PaletteMatte    TrueColor
5994 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5995 %
5996 %  The format of the MagickGetImageType method is:
5997 %
5998 %      ImageType MagickGetImageType(MagickWand *wand)
5999 %
6000 %  A description of each parameter follows:
6001 %
6002 %    o wand: the magick wand.
6003 %
6004 */
MagickGetImageType(MagickWand * wand)6005 WandExport ImageType MagickGetImageType(MagickWand *wand)
6006 {
6007   assert(wand != (MagickWand *) NULL);
6008   assert(wand->signature == MagickWandSignature);
6009   if (wand->debug != MagickFalse)
6010     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6011   if (wand->images == (Image *) NULL)
6012     {
6013       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6014         "ContainsNoImages","`%s'",wand->name);
6015       return(UndefinedType);
6016     }
6017   return(GetImageType(wand->images));
6018 }
6019 
6020 /*
6021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6022 %                                                                             %
6023 %                                                                             %
6024 %                                                                             %
6025 %   M a g i c k G e t I m a g e U n i t s                                     %
6026 %                                                                             %
6027 %                                                                             %
6028 %                                                                             %
6029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6030 %
6031 %  MagickGetImageUnits() gets the image units of resolution.
6032 %
6033 %  The format of the MagickGetImageUnits method is:
6034 %
6035 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
6036 %
6037 %  A description of each parameter follows:
6038 %
6039 %    o wand: the magick wand.
6040 %
6041 */
MagickGetImageUnits(MagickWand * wand)6042 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
6043 {
6044   assert(wand != (MagickWand *) NULL);
6045   assert(wand->signature == MagickWandSignature);
6046   if (wand->debug != MagickFalse)
6047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6048   if (wand->images == (Image *) NULL)
6049     {
6050       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6051         "ContainsNoImages","`%s'",wand->name);
6052       return(UndefinedResolution);
6053     }
6054   return(wand->images->units);
6055 }
6056 
6057 /*
6058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6059 %                                                                             %
6060 %                                                                             %
6061 %                                                                             %
6062 %   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           %
6063 %                                                                             %
6064 %                                                                             %
6065 %                                                                             %
6066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6067 %
6068 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6069 %  sepcified image.
6070 %
6071 %  The format of the MagickGetImageVirtualPixelMethod method is:
6072 %
6073 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6074 %
6075 %  A description of each parameter follows:
6076 %
6077 %    o wand: the magick wand.
6078 %
6079 */
MagickGetImageVirtualPixelMethod(MagickWand * wand)6080 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6081 {
6082   assert(wand != (MagickWand *) NULL);
6083   assert(wand->signature == MagickWandSignature);
6084   if (wand->debug != MagickFalse)
6085     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6086   if (wand->images == (Image *) NULL)
6087     {
6088       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6089         "ContainsNoImages","`%s'",wand->name);
6090       return(UndefinedVirtualPixelMethod);
6091     }
6092   return(GetImageVirtualPixelMethod(wand->images));
6093 }
6094 
6095 /*
6096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6097 %                                                                             %
6098 %                                                                             %
6099 %                                                                             %
6100 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
6101 %                                                                             %
6102 %                                                                             %
6103 %                                                                             %
6104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6105 %
6106 %  MagickGetImageWhitePoint() returns the chromaticy white point.
6107 %
6108 %  The format of the MagickGetImageWhitePoint method is:
6109 %
6110 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6111 %        double *y,double *z)
6112 %
6113 %  A description of each parameter follows:
6114 %
6115 %    o wand: the magick wand.
6116 %
6117 %    o x: the chromaticity white x-point.
6118 %
6119 %    o y: the chromaticity white y-point.
6120 %
6121 %    o z: the chromaticity white z-point.
6122 %
6123 */
MagickGetImageWhitePoint(MagickWand * wand,double * x,double * y,double * z)6124 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6125   double *x,double *y,double *z)
6126 {
6127   assert(wand != (MagickWand *) NULL);
6128   assert(wand->signature == MagickWandSignature);
6129   if (wand->debug != MagickFalse)
6130     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6131   if (wand->images == (Image *) NULL)
6132     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6133   *x=wand->images->chromaticity.white_point.x;
6134   *y=wand->images->chromaticity.white_point.y;
6135   *z=wand->images->chromaticity.white_point.z;
6136   return(MagickTrue);
6137 }
6138 
6139 /*
6140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6141 %                                                                             %
6142 %                                                                             %
6143 %                                                                             %
6144 %   M a g i c k G e t I m a g e W i d t h                                     %
6145 %                                                                             %
6146 %                                                                             %
6147 %                                                                             %
6148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6149 %
6150 %  MagickGetImageWidth() returns the image width.
6151 %
6152 %  The format of the MagickGetImageWidth method is:
6153 %
6154 %      size_t MagickGetImageWidth(MagickWand *wand)
6155 %
6156 %  A description of each parameter follows:
6157 %
6158 %    o wand: the magick wand.
6159 %
6160 */
MagickGetImageWidth(MagickWand * wand)6161 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6162 {
6163   assert(wand != (MagickWand *) NULL);
6164   assert(wand->signature == MagickWandSignature);
6165   if (wand->debug != MagickFalse)
6166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6167   if (wand->images == (Image *) NULL)
6168     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6169   return(wand->images->columns);
6170 }
6171 
6172 /*
6173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6174 %                                                                             %
6175 %                                                                             %
6176 %                                                                             %
6177 %   M a g i c k G e t N u m b e r I m a g e s                                 %
6178 %                                                                             %
6179 %                                                                             %
6180 %                                                                             %
6181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6182 %
6183 %  MagickGetNumberImages() returns the number of images associated with a
6184 %  magick wand.
6185 %
6186 %  The format of the MagickGetNumberImages method is:
6187 %
6188 %      size_t MagickGetNumberImages(MagickWand *wand)
6189 %
6190 %  A description of each parameter follows:
6191 %
6192 %    o wand: the magick wand.
6193 %
6194 */
MagickGetNumberImages(MagickWand * wand)6195 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6196 {
6197   assert(wand != (MagickWand *) NULL);
6198   assert(wand->signature == MagickWandSignature);
6199   if (wand->debug != MagickFalse)
6200     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6201   return(GetImageListLength(wand->images));
6202 }
6203 
6204 /*
6205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6206 %                                                                             %
6207 %                                                                             %
6208 %                                                                             %
6209 %   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                 %
6210 %                                                                             %
6211 %                                                                             %
6212 %                                                                             %
6213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6214 %
6215 %  MagickGetImageTotalInkDensity() gets the image total ink density.
6216 %
6217 %  The format of the MagickGetImageTotalInkDensity method is:
6218 %
6219 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
6220 %
6221 %  A description of each parameter follows:
6222 %
6223 %    o wand: the magick wand.
6224 %
6225 */
MagickGetImageTotalInkDensity(MagickWand * wand)6226 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6227 {
6228   assert(wand != (MagickWand *) NULL);
6229   assert(wand->signature == MagickWandSignature);
6230   if (wand->debug != MagickFalse)
6231     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6232   if (wand->images == (Image *) NULL)
6233     {
6234       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6235         "ContainsNoImages","`%s'",wand->name);
6236       return(0.0);
6237     }
6238   return(GetImageTotalInkDensity(wand->images,wand->exception));
6239 }
6240 
6241 /*
6242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6243 %                                                                             %
6244 %                                                                             %
6245 %                                                                             %
6246 %   M a g i c k H a l d C l u t I m a g e                                     %
6247 %                                                                             %
6248 %                                                                             %
6249 %                                                                             %
6250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6251 %
6252 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6253 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6254 %  dimensions.  Create it with the HALD coder.  You can apply any color
6255 %  transformation to the Hald image and then use this method to apply the
6256 %  transform to the image.
6257 %
6258 %  The format of the MagickHaldClutImage method is:
6259 %
6260 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6261 %        const MagickWand *hald_wand)
6262 %
6263 %  A description of each parameter follows:
6264 %
6265 %    o wand: the magick wand.
6266 %
6267 %    o hald_image: the hald CLUT image.
6268 %
6269 */
MagickHaldClutImage(MagickWand * wand,const MagickWand * hald_wand)6270 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6271   const MagickWand *hald_wand)
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) || (hald_wand->images == (Image *) NULL))
6281     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6282   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
6283   return(status);
6284 }
6285 
6286 /*
6287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6288 %                                                                             %
6289 %                                                                             %
6290 %                                                                             %
6291 %   M a g i c k H a s N e x t I m a g e                                       %
6292 %                                                                             %
6293 %                                                                             %
6294 %                                                                             %
6295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6296 %
6297 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
6298 %  traversing the list in the forward direction
6299 %
6300 %  The format of the MagickHasNextImage method is:
6301 %
6302 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6303 %
6304 %  A description of each parameter follows:
6305 %
6306 %    o wand: the magick wand.
6307 %
6308 */
MagickHasNextImage(MagickWand * wand)6309 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6310 {
6311   assert(wand != (MagickWand *) NULL);
6312   assert(wand->signature == MagickWandSignature);
6313   if (wand->debug != MagickFalse)
6314     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6315   if (wand->images == (Image *) NULL)
6316     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6317   if (GetNextImageInList(wand->images) == (Image *) NULL)
6318     return(MagickFalse);
6319   return(MagickTrue);
6320 }
6321 
6322 /*
6323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6324 %                                                                             %
6325 %                                                                             %
6326 %                                                                             %
6327 %   M a g i c k H a s P r e v i o u s I m a g e                               %
6328 %                                                                             %
6329 %                                                                             %
6330 %                                                                             %
6331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6332 %
6333 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6334 %  traversing the list in the reverse direction
6335 %
6336 %  The format of the MagickHasPreviousImage method is:
6337 %
6338 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6339 %
6340 %  A description of each parameter follows:
6341 %
6342 %    o wand: the magick wand.
6343 %
6344 */
MagickHasPreviousImage(MagickWand * wand)6345 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6346 {
6347   assert(wand != (MagickWand *) NULL);
6348   assert(wand->signature == MagickWandSignature);
6349   if (wand->debug != MagickFalse)
6350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6351   if (wand->images == (Image *) NULL)
6352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6353   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6354     return(MagickFalse);
6355   return(MagickTrue);
6356 }
6357 
6358 /*
6359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6360 %                                                                             %
6361 %                                                                             %
6362 %                                                                             %
6363 %   M a g i c k H o u g h L i n e I m a g e                                   %
6364 %                                                                             %
6365 %                                                                             %
6366 %                                                                             %
6367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6368 %
6369 %  Use MagickHoughLineImage() in conjunction with any binary edge extracted
6370 %  image (we recommand Canny) to identify lines in the image.  The algorithm
6371 %  accumulates counts for every white pixel for every possible orientation (for
6372 %  angles from 0 to 179 in 1 degree increments) and distance from the center of
6373 %  the image to the corner (in 1 px increments) and stores the counts in an
6374 %  accumulator matrix of angle vs distance. The size of the accumulator is
6375 %  180x(diagonal/2). Next it searches this space for peaks in counts and
6376 %  converts the locations of the peaks to slope and intercept in the normal x,y
6377 %  input image space. Use the slope/intercepts to find the endpoints clipped to
6378 %  the bounds of the image. The lines are then drawn. The counts are a measure
6379 %  of the length of the lines.
6380 %
6381 %  The format of the MagickHoughLineImage method is:
6382 %
6383 %      MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6384 %        const size_t width,const size_t height,const size_t threshold)
6385 %
6386 %  A description of each parameter follows:
6387 %
6388 %    o wand: the magick wand.
6389 %
6390 %    o width, height: find line pairs as local maxima in this neighborhood.
6391 %
6392 %    o threshold: the line count threshold.
6393 %
6394 */
MagickHoughLineImage(MagickWand * wand,const size_t width,const size_t height,const size_t threshold)6395 WandExport MagickBooleanType MagickHoughLineImage(MagickWand *wand,
6396   const size_t width,const size_t height,const size_t threshold)
6397 {
6398   Image
6399     *lines_image;
6400 
6401   assert(wand != (MagickWand *) NULL);
6402   assert(wand->signature == MagickWandSignature);
6403   if (wand->debug != MagickFalse)
6404     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6405   if (wand->images == (Image *) NULL)
6406     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6407   lines_image=HoughLineImage(wand->images,width,height,threshold,
6408     wand->exception);
6409   if (lines_image == (Image *) NULL)
6410     return(MagickFalse);
6411   ReplaceImageInList(&wand->images,lines_image);
6412   return(MagickTrue);
6413 }
6414 
6415 /*
6416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6417 %                                                                             %
6418 %                                                                             %
6419 %                                                                             %
6420 %   M a g i c k I d e n t i f y I m a g e                                     %
6421 %                                                                             %
6422 %                                                                             %
6423 %                                                                             %
6424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6425 %
6426 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6427 %  file.  Attributes include the image width, height, size, and others.
6428 %
6429 %  The format of the MagickIdentifyImage method is:
6430 %
6431 %      const char *MagickIdentifyImage(MagickWand *wand)
6432 %
6433 %  A description of each parameter follows:
6434 %
6435 %    o wand: the magick wand.
6436 %
6437 */
MagickIdentifyImage(MagickWand * wand)6438 WandExport char *MagickIdentifyImage(MagickWand *wand)
6439 {
6440   char
6441     *description,
6442     filename[MagickPathExtent];
6443 
6444   FILE
6445     *file;
6446 
6447   int
6448     unique_file;
6449 
6450   assert(wand != (MagickWand *) NULL);
6451   assert(wand->signature == MagickWandSignature);
6452   if (wand->debug != MagickFalse)
6453     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6454   if (wand->images == (Image *) NULL)
6455     {
6456       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6457         "ContainsNoImages","`%s'",wand->name);
6458       return((char *) NULL);
6459     }
6460   description=(char *) NULL;
6461   unique_file=AcquireUniqueFileResource(filename);
6462   file=(FILE *) NULL;
6463   if (unique_file != -1)
6464     file=fdopen(unique_file,"wb");
6465   if ((unique_file == -1) || (file == (FILE *) NULL))
6466     {
6467       (void) RelinquishUniqueFileResource(filename);
6468       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6469         "UnableToCreateTemporaryFile","`%s'",wand->name);
6470       return((char *) NULL);
6471     }
6472   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6473   (void) fclose(file);
6474   description=FileToString(filename,~0UL,wand->exception);
6475   (void) RelinquishUniqueFileResource(filename);
6476   return(description);
6477 }
6478 
6479 /*
6480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6481 %                                                                             %
6482 %                                                                             %
6483 %                                                                             %
6484 %   M a g i c k I d e n t i f y I m a g e T y p e                             %
6485 %                                                                             %
6486 %                                                                             %
6487 %                                                                             %
6488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6489 %
6490 %  MagickIdentifyImageType() gets the potential image type:
6491 %
6492 %        Bilevel        Grayscale       GrayscaleMatte
6493 %        Palette        PaletteMatte    TrueColor
6494 %        TrueColorMatte ColorSeparation ColorSeparationMatte
6495 %
6496 %  To ensure the image type matches its potential, use MagickSetImageType():
6497 %
6498 %    (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6499 %
6500 %  The format of the MagickIdentifyImageType method is:
6501 %
6502 %      ImageType MagickIdentifyImageType(MagickWand *wand)
6503 %
6504 %  A description of each parameter follows:
6505 %
6506 %    o wand: the magick wand.
6507 %
6508 */
MagickIdentifyImageType(MagickWand * wand)6509 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6510 {
6511   assert(wand != (MagickWand *) NULL);
6512   assert(wand->signature == MagickWandSignature);
6513   if (wand->debug != MagickFalse)
6514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6515   if (wand->images == (Image *) NULL)
6516     {
6517       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6518         "ContainsNoImages","`%s'",wand->name);
6519       return(UndefinedType);
6520     }
6521   return(IdentifyImageType(wand->images,wand->exception));
6522 }
6523 
6524 /*
6525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6526 %                                                                             %
6527 %                                                                             %
6528 %                                                                             %
6529 %   M a g i c k I m p l o d e I m a g e                                       %
6530 %                                                                             %
6531 %                                                                             %
6532 %                                                                             %
6533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6534 %
6535 %  MagickImplodeImage() creates a new image that is a copy of an existing
6536 %  one with the image pixels "implode" by the specified percentage.  It
6537 %  allocates the memory necessary for the new Image structure and returns a
6538 %  pointer to the new image.
6539 %
6540 %  The format of the MagickImplodeImage method is:
6541 %
6542 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6543 %        const double radius,const PixelInterpolateMethod method)
6544 %
6545 %  A description of each parameter follows:
6546 %
6547 %    o wand: the magick wand.
6548 %
6549 %    o amount: Define the extent of the implosion.
6550 %
6551 %    o method: the pixel interpolation method.
6552 %
6553 */
MagickImplodeImage(MagickWand * wand,const double amount,const PixelInterpolateMethod method)6554 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6555   const double amount,const PixelInterpolateMethod method)
6556 {
6557   Image
6558     *implode_image;
6559 
6560   assert(wand != (MagickWand *) NULL);
6561   assert(wand->signature == MagickWandSignature);
6562   if (wand->debug != MagickFalse)
6563     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6564   if (wand->images == (Image *) NULL)
6565     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6566   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6567   if (implode_image == (Image *) NULL)
6568     return(MagickFalse);
6569   ReplaceImageInList(&wand->images,implode_image);
6570   return(MagickTrue);
6571 }
6572 
6573 /*
6574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6575 %                                                                             %
6576 %                                                                             %
6577 %                                                                             %
6578 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6579 %                                                                             %
6580 %                                                                             %
6581 %                                                                             %
6582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6583 %
6584 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6585 %  location you specify.  The method returns MagickTrue on success otherwise
6586 %  MagickFalse if an error is encountered.  The pixel data can be either char,
6587 %  short int, int, ssize_t, float, or double in the order specified by map.
6588 %
6589 %  Suppose your want to upload the first scanline of a 640x480 image from
6590 %  character data in red-green-blue order:
6591 %
6592 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6593 %
6594 %  The format of the MagickImportImagePixels method is:
6595 %
6596 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6597 %        const ssize_t x,const ssize_t y,const size_t columns,
6598 %        const size_t rows,const char *map,const StorageType storage,
6599 %        const void *pixels)
6600 %
6601 %  A description of each parameter follows:
6602 %
6603 %    o wand: the magick wand.
6604 %
6605 %    o x, y, columns, rows:  These values define the perimeter of a region
6606 %      of pixels you want to define.
6607 %
6608 %    o map:  This string reflects the expected ordering of the pixel array.
6609 %      It can be any combination or order of R = red, G = green, B = blue,
6610 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6611 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6612 %      P = pad.
6613 %
6614 %    o storage: Define the data type of the pixels.  Float and double types are
6615 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6616 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6617 %      or DoublePixel.
6618 %
6619 %    o pixels: This array of values contain the pixel components as defined by
6620 %      map and type.  You must preallocate this array where the expected
6621 %      length varies depending on the values of width, height, map, and type.
6622 %
6623 */
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)6624 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6625   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6626   const char *map,const StorageType storage,const void *pixels)
6627 {
6628   MagickBooleanType
6629     status;
6630 
6631   assert(wand != (MagickWand *) NULL);
6632   assert(wand->signature == MagickWandSignature);
6633   if (wand->debug != MagickFalse)
6634     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6635   if (wand->images == (Image *) NULL)
6636     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6637   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6638     wand->exception);
6639   return(status);
6640 }
6641 
6642 /*
6643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6644 %                                                                             %
6645 %                                                                             %
6646 %                                                                             %
6647 %   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               %
6648 %                                                                             %
6649 %                                                                             %
6650 %                                                                             %
6651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6652 %
6653 %  MagickInterpolativeResizeImage() resize image using a interpolative
6654 %  method.
6655 %
6656 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6657 %        const size_t columns,const size_t rows,
6658 %        const PixelInterpolateMethod method)
6659 %
6660 %  A description of each parameter follows:
6661 %
6662 %    o wand: the magick wand.
6663 %
6664 %    o columns: the number of columns in the scaled image.
6665 %
6666 %    o rows: the number of rows in the scaled image.
6667 %
6668 %    o interpolate: the pixel interpolation method.
6669 %
6670 */
MagickInterpolativeResizeImage(MagickWand * wand,const size_t columns,const size_t rows,const PixelInterpolateMethod method)6671 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6672   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6673 {
6674   Image
6675     *resize_image;
6676 
6677   assert(wand != (MagickWand *) NULL);
6678   assert(wand->signature == MagickWandSignature);
6679   if (wand->debug != MagickFalse)
6680     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6681   if (wand->images == (Image *) NULL)
6682     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6683   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6684     wand->exception);
6685   if (resize_image == (Image *) NULL)
6686     return(MagickFalse);
6687   ReplaceImageInList(&wand->images,resize_image);
6688   return(MagickTrue);
6689 }
6690 
6691 /*
6692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6693 %                                                                             %
6694 %                                                                             %
6695 %                                                                             %
6696 %   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       %
6697 %                                                                             %
6698 %                                                                             %
6699 %                                                                             %
6700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6701 %
6702 %  MagickInverseFourierTransformImage() implements the inverse discrete
6703 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6704 %  imaginary image pair.
6705 %
6706 %  The format of the MagickInverseFourierTransformImage method is:
6707 %
6708 %      MagickBooleanType MagickInverseFourierTransformImage(
6709 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6710 %        const MagickBooleanType magnitude)
6711 %
6712 %  A description of each parameter follows:
6713 %
6714 %    o magnitude_wand: the magnitude or real wand.
6715 %
6716 %    o phase_wand: the phase or imaginary wand.
6717 %
6718 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6719 %      imaginary image pair.
6720 %
6721 */
MagickInverseFourierTransformImage(MagickWand * magnitude_wand,MagickWand * phase_wand,const MagickBooleanType magnitude)6722 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6723   MagickWand *magnitude_wand,MagickWand *phase_wand,
6724   const MagickBooleanType magnitude)
6725 {
6726   Image
6727     *inverse_image;
6728 
6729   MagickWand
6730     *wand;
6731 
6732   assert(magnitude_wand != (MagickWand *) NULL);
6733   assert(magnitude_wand->signature == MagickWandSignature);
6734   if (magnitude_wand->debug != MagickFalse)
6735     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6736       magnitude_wand->name);
6737   wand=magnitude_wand;
6738   if (magnitude_wand->images == (Image *) NULL)
6739     ThrowWandException(WandError,"ContainsNoImages",
6740       magnitude_wand->name);
6741   assert(phase_wand != (MagickWand *) NULL);
6742   assert(phase_wand->signature == MagickWandSignature);
6743   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6744     phase_wand->images,magnitude,wand->exception);
6745   if (inverse_image == (Image *) NULL)
6746     return(MagickFalse);
6747   ReplaceImageInList(&wand->images,inverse_image);
6748   return(MagickTrue);
6749 }
6750 
6751 /*
6752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6753 %                                                                             %
6754 %                                                                             %
6755 %                                                                             %
6756 %   M a g i c k K m e a n s I m a g e                                         %
6757 %                                                                             %
6758 %                                                                             %
6759 %                                                                             %
6760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6761 %
6762 %  MagickKmeansImage() applies k-means color reduction to an image. This is a
6763 %  colorspace clustering or segmentation technique.
6764 %
6765 %  The format of the MagickKuwaharaImage method is:
6766 %
6767 %      MagickBooleanType MagickKmeansImage(MagickWand *wand,
6768 %        const size_t number_colors, const size_t max_iterations,
6769 %        const double tolerance)
6770 %
6771 %  A description of each parameter follows:
6772 %
6773 %    o wand: the magick wand.
6774 %
6775 %    o number_colors: number of colors to use as seeds.
6776 %
6777 %    o max_iterations: maximum number of iterations while converging.
6778 %
6779 %    o tolerance: the maximum tolerance.
6780 %
6781 */
MagickKmeansImage(MagickWand * wand,const size_t number_colors,const size_t max_iterations,const double tolerance)6782 WandExport MagickBooleanType MagickKmeansImage(MagickWand *wand,
6783   const size_t number_colors,const size_t max_iterations,
6784   const double tolerance)
6785 {
6786   MagickBooleanType
6787     status;
6788 
6789   assert(wand != (MagickWand *) NULL);
6790   assert(wand->signature == MagickWandSignature);
6791   if (wand->debug != MagickFalse)
6792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6793   if (wand->images == (Image *) NULL)
6794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6795   status=KmeansImage(wand->images,number_colors,max_iterations,tolerance,
6796     wand->exception);
6797   return(status);
6798 }
6799 
6800 /*
6801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6802 %                                                                             %
6803 %                                                                             %
6804 %                                                                             %
6805 %   M a g i c k K u w a h a r a I m a g e                                     %
6806 %                                                                             %
6807 %                                                                             %
6808 %                                                                             %
6809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6810 %
6811 %  Use MagickKuwaharaImage() is an edge preserving noise reduction filter.
6812 %
6813 %  The format of the MagickKuwaharaImage method is:
6814 %
6815 %      MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6816 %        const double radius,const double sigma)
6817 %
6818 %  A description of each parameter follows:
6819 %
6820 %    o wand: the magick wand.
6821 %
6822 %    o radius: the square window radius.
6823 %
6824 %    o sigma: the standard deviation of the Gaussian, in pixels.
6825 %
6826 */
MagickKuwaharaImage(MagickWand * wand,const double radius,const double sigma)6827 WandExport MagickBooleanType MagickKuwaharaImage(MagickWand *wand,
6828   const double radius,const double sigma)
6829 {
6830   Image
6831     *kuwahara_image;
6832 
6833   assert(wand != (MagickWand *) NULL);
6834   assert(wand->signature == MagickWandSignature);
6835   if (wand->debug != MagickFalse)
6836     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6837   if (wand->images == (Image *) NULL)
6838     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6839   kuwahara_image=KuwaharaImage(wand->images,radius,sigma,wand->exception);
6840   if (kuwahara_image == (Image *) NULL)
6841     return(MagickFalse);
6842   ReplaceImageInList(&wand->images,kuwahara_image);
6843   return(MagickTrue);
6844 }
6845 
6846 /*
6847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6848 %                                                                             %
6849 %                                                                             %
6850 %                                                                             %
6851 %   M a g i c k L a b e l I m a g e                                           %
6852 %                                                                             %
6853 %                                                                             %
6854 %                                                                             %
6855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6856 %
6857 %  MagickLabelImage() adds a label to your image.
6858 %
6859 %  The format of the MagickLabelImage method is:
6860 %
6861 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6862 %
6863 %  A description of each parameter follows:
6864 %
6865 %    o wand: the magick wand.
6866 %
6867 %    o label: the image label.
6868 %
6869 */
MagickLabelImage(MagickWand * wand,const char * label)6870 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6871   const char *label)
6872 {
6873   MagickBooleanType
6874     status;
6875 
6876   assert(wand != (MagickWand *) NULL);
6877   assert(wand->signature == MagickWandSignature);
6878   if (wand->debug != MagickFalse)
6879     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6880   if (wand->images == (Image *) NULL)
6881     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6882   status=SetImageProperty(wand->images,"label",label,wand->exception);
6883   return(status);
6884 }
6885 
6886 /*
6887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6888 %                                                                             %
6889 %                                                                             %
6890 %                                                                             %
6891 %   M a g i c k L e v e l I m a g e                                           %
6892 %                                                                             %
6893 %                                                                             %
6894 %                                                                             %
6895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6896 %
6897 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6898 %  falling between specified white and black points to the full available
6899 %  quantum range. The parameters provided represent the black, mid, and white
6900 %  points. The black point specifies the darkest color in the image. Colors
6901 %  darker than the black point are set to zero. Mid point specifies a gamma
6902 %  correction to apply to the image.  White point specifies the lightest color
6903 %  in the image. Colors brighter than the white point are set to the maximum
6904 %  quantum value.
6905 %
6906 %  The format of the MagickLevelImage method is:
6907 %
6908 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6909 %        const double black_point,const double gamma,const double white_point)
6910 %
6911 %  A description of each parameter follows:
6912 %
6913 %    o wand: the magick wand.
6914 %
6915 %    o channel: Identify which channel to level: RedPixelChannel,
6916 %      GreenPixelChannel, etc.
6917 %
6918 %    o black_point: the black point.
6919 %
6920 %    o gamma: the gamma.
6921 %
6922 %    o white_point: the white point.
6923 %
6924 */
MagickLevelImage(MagickWand * wand,const double black_point,const double gamma,const double white_point)6925 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6926   const double black_point,const double gamma,const double white_point)
6927 {
6928   MagickBooleanType
6929     status;
6930 
6931   assert(wand != (MagickWand *) NULL);
6932   assert(wand->signature == MagickWandSignature);
6933   if (wand->debug != MagickFalse)
6934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6935   if (wand->images == (Image *) NULL)
6936     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6937   status=LevelImage(wand->images,black_point,white_point,gamma,
6938     wand->exception);
6939   return(status);
6940 }
6941 
6942 /*
6943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6944 %                                                                             %
6945 %                                                                             %
6946 %                                                                             %
6947 %   M a g i c k L e v e l I m a g e C o l o r s                               %
6948 %                                                                             %
6949 %                                                                             %
6950 %                                                                             %
6951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6952 %
6953 %  MagickLevelImageColors() maps the given color to "black" and "white" values,
6954 %  linearly spreading out the colors, and level values on a channel by channel
6955 %  bases, as per LevelImage().  The given colors allows you to specify
6956 %  different level ranges for each of the color channels separately.
6957 %
6958 %  The format of the MagickLevelImageColors method is:
6959 %
6960 %      MagickBooleanType MagickLevelImageColors(MagickWand *wand,
6961 %        const PixelWand *black_color,const PixelWand *white_color,
6962 %        const MagickBooleanType invert)
6963 %
6964 %  A description of each parameter follows:
6965 %
6966 %    o wand: the magick wand.
6967 %
6968 %    o black_color: the black color.
6969 %
6970 %    o white_color: the white color.
6971 %
6972 %    o invert: if true map the colors (levelize), rather than from (level)
6973 %
6974 */
MagickLevelImageColors(MagickWand * wand,const PixelWand * black_color,const PixelWand * white_color,const MagickBooleanType invert)6975 WandExport MagickBooleanType MagickLevelImageColors(MagickWand *wand,
6976   const PixelWand *black_color,const PixelWand *white_color,
6977   const MagickBooleanType invert)
6978 {
6979   MagickBooleanType
6980     status;
6981 
6982   PixelInfo
6983     black,
6984     white;
6985 
6986   assert(wand != (MagickWand *) NULL);
6987   assert(wand->signature == MagickWandSignature);
6988   if (wand->debug != MagickFalse)
6989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6990   if (wand->images == (Image *) NULL)
6991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6992   PixelGetMagickColor(black_color,&black);
6993   PixelGetMagickColor(white_color,&white);
6994   status=LevelImageColors(wand->images,&black,&white,invert,wand->exception);
6995   return(status);
6996 }
6997 
6998 /*
6999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7000 %                                                                             %
7001 %                                                                             %
7002 %                                                                             %
7003 %   M a g i c k L e v e l i z e I m a g e                                     %
7004 %                                                                             %
7005 %                                                                             %
7006 %                                                                             %
7007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7008 %
7009 %  MagickLevelizeImage() applies the reversed MagickLevelImage(). It compresses
7010 %  the full range of color values, so that they lie between the given black and
7011 %  white points.  Gamma is applied before the values are mapped.  It can be
7012 %  used to de-contrast a greyscale image to the exact levels specified.
7013 %
7014 %  The format of the MagickLevelizeImage method is:
7015 %
7016 %      MagickBooleanType MagickLevelizeImage(MagickWand *wand,
7017 %        const double black_point, const double white_point,const double gamma)
7018 %
7019 %  A description of each parameter follows:
7020 %
7021 %    o wand: the magick wand.
7022 %
7023 %    o black_point: The level to map zero (black) to.
7024 %
7025 %    o white_point: The level to map QuantumRange (white) to.
7026 %
7027 %    o gamma: adjust gamma by this factor before mapping values.
7028 %
7029 */
MagickLevelizeImage(MagickWand * wand,const double black_point,const double gamma,const double white_point)7030 WandExport MagickBooleanType MagickLevelizeImage(MagickWand *wand,
7031   const double black_point,const double gamma,const double white_point)
7032 {
7033   MagickBooleanType
7034     status;
7035 
7036   assert(wand != (MagickWand *) NULL);
7037   assert(wand->signature == MagickWandSignature);
7038   if (wand->debug != MagickFalse)
7039     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7040   if (wand->images == (Image *) NULL)
7041     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7042   status=LevelizeImage(wand->images,black_point,white_point,gamma,
7043     wand->exception);
7044   return(status);
7045 }
7046 
7047 /*
7048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7049 %                                                                             %
7050 %                                                                             %
7051 %                                                                             %
7052 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
7053 %                                                                             %
7054 %                                                                             %
7055 %                                                                             %
7056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7057 %
7058 %  MagickLinearStretchImage() stretches with saturation the image intensity.
7059 %
7060 %  You can also reduce the influence of a particular channel with a gamma
7061 %  value of 0.
7062 %
7063 %  The format of the MagickLinearStretchImage method is:
7064 %
7065 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7066 %        const double black_point,const double white_point)
7067 %
7068 %  A description of each parameter follows:
7069 %
7070 %    o wand: the magick wand.
7071 %
7072 %    o black_point: the black point.
7073 %
7074 %    o white_point: the white point.
7075 %
7076 */
MagickLinearStretchImage(MagickWand * wand,const double black_point,const double white_point)7077 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7078   const double black_point,const double white_point)
7079 {
7080   MagickBooleanType
7081     status;
7082 
7083   assert(wand != (MagickWand *) NULL);
7084   assert(wand->signature == MagickWandSignature);
7085   if (wand->debug != MagickFalse)
7086     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7087   if (wand->images == (Image *) NULL)
7088     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7089   status=LinearStretchImage(wand->images,black_point,white_point,
7090     wand->exception);
7091   return(status);
7092 }
7093 
7094 /*
7095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7096 %                                                                             %
7097 %                                                                             %
7098 %                                                                             %
7099 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
7100 %                                                                             %
7101 %                                                                             %
7102 %                                                                             %
7103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7104 %
7105 %  MagickLiquidRescaleImage() rescales image with seam carving.
7106 %
7107 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7108 %        const size_t columns,const size_t rows,
7109 %        const double delta_x,const double rigidity)
7110 %
7111 %  A description of each parameter follows:
7112 %
7113 %    o wand: the magick wand.
7114 %
7115 %    o columns: the number of columns in the scaled image.
7116 %
7117 %    o rows: the number of rows in the scaled image.
7118 %
7119 %    o delta_x: maximum seam transversal step (0 means straight seams).
7120 %
7121 %    o rigidity: introduce a bias for non-straight seams (typically 0).
7122 %
7123 */
MagickLiquidRescaleImage(MagickWand * wand,const size_t columns,const size_t rows,const double delta_x,const double rigidity)7124 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7125   const size_t columns,const size_t rows,const double delta_x,
7126   const double rigidity)
7127 {
7128   Image
7129     *rescale_image;
7130 
7131   assert(wand != (MagickWand *) NULL);
7132   assert(wand->signature == MagickWandSignature);
7133   if (wand->debug != MagickFalse)
7134     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7135   if (wand->images == (Image *) NULL)
7136     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7137   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
7138     rigidity,wand->exception);
7139   if (rescale_image == (Image *) NULL)
7140     return(MagickFalse);
7141   ReplaceImageInList(&wand->images,rescale_image);
7142   return(MagickTrue);
7143 }
7144 
7145 /*
7146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7147 %                                                                             %
7148 %                                                                             %
7149 %                                                                             %
7150 %     M a g i c k L o c a l C o n t r a s t I m a g e                         %
7151 %                                                                             %
7152 %                                                                             %
7153 %                                                                             %
7154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7155 %
7156 %  MagickLocalContrastImage() attempts to increase the appearance of
7157 %  large-scale light-dark transitions. Local contrast enhancement works
7158 %  similarly to sharpening with an unsharp mask, however the mask is instead
7159 %  created using an image with a greater blur distance.
7160 %
7161 %      MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7162 %        const double radius,const double strength)
7163 %
7164 %  A description of each parameter follows:
7165 %
7166 %    o image: the image.
7167 %
7168 %    o radius: the radius of the Gaussian, in pixels, not counting
7169 %      the center pixel.
7170 %
7171 %    o strength: the strength of the blur mask in percentage.
7172 %
7173 */
MagickLocalContrastImage(MagickWand * wand,const double radius,const double strength)7174 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7175   const double radius, const double strength)
7176 {
7177   Image
7178     *contrast_image;
7179 
7180   assert(wand != (MagickWand *)NULL);
7181   assert(wand->signature == MagickWandSignature);
7182   if (wand->debug != MagickFalse)
7183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
7184   if (wand->images == (Image *)NULL)
7185     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7186   contrast_image=LocalContrastImage(wand->images,radius,strength,
7187     wand->exception);
7188   if (contrast_image == (Image *)NULL)
7189     return(MagickFalse);
7190   ReplaceImageInList(&wand->images,contrast_image);
7191   return(MagickTrue);
7192 }
7193 
7194 /*
7195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7196 %                                                                             %
7197 %                                                                             %
7198 %                                                                             %
7199 %   M a g i c k M a g n i f y I m a g e                                       %
7200 %                                                                             %
7201 %                                                                             %
7202 %                                                                             %
7203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7204 %
7205 %  MagickMagnifyImage() is a convenience method that scales an image
7206 %  proportionally to twice its original size.
7207 %
7208 %  The format of the MagickMagnifyImage method is:
7209 %
7210 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7211 %
7212 %  A description of each parameter follows:
7213 %
7214 %    o wand: the magick wand.
7215 %
7216 */
MagickMagnifyImage(MagickWand * wand)7217 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7218 {
7219   Image
7220     *magnify_image;
7221 
7222   assert(wand != (MagickWand *) NULL);
7223   assert(wand->signature == MagickWandSignature);
7224   if (wand->debug != MagickFalse)
7225     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7226   if (wand->images == (Image *) NULL)
7227     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7228   magnify_image=MagnifyImage(wand->images,wand->exception);
7229   if (magnify_image == (Image *) NULL)
7230     return(MagickFalse);
7231   ReplaceImageInList(&wand->images,magnify_image);
7232   return(MagickTrue);
7233 }
7234 
7235 /*
7236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7237 %                                                                             %
7238 %                                                                             %
7239 %                                                                             %
7240 %   M a g i c k M e a n S h i f t I m a g e                                   %
7241 %                                                                             %
7242 %                                                                             %
7243 %                                                                             %
7244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7245 %
7246 %  MagickMeanShiftImage() elineate arbitrarily shaped clusters in the image. For
7247 %  each pixel, it visits all the pixels in the neighborhood specified by
7248 %  the window centered at the pixel and excludes those that are outside the
7249 %  radius=(window-1)/2 surrounding the pixel. From those pixels, it finds those
7250 %  that are within the specified color distance from the current mean, and
7251 %  computes a new x,y centroid from those coordinates and a new mean. This new
7252 %  x,y centroid is used as the center for a new window. This process iterates
7253 %  until it converges and the final mean is replaces the (original window
7254 %  center) pixel value. It repeats this process for the next pixel, etc.,
7255 %  until it processes all pixels in the image. Results are typically better with
7256 %  colorspaces other than sRGB. We recommend YIQ, YUV or YCbCr.
7257 %
7258 %  The format of the MagickMeanShiftImage method is:
7259 %
7260 %      MagickBooleanType MagickMeanShiftImage(MagickWand *wand,
7261 %        const size_t number_terms,const double *terms)
7262 %
7263 %  A description of each parameter follows:
7264 %
7265 %    o wand: the magick wand.
7266 %
7267 %    o width, height: find pixels in this neighborhood.
7268 %
7269 %    o color_distance: the color distance.
7270 %
7271 */
MagickMeanShiftImage(MagickWand * wand,const size_t width,const size_t height,const double color_distance)7272 WandExport MagickBooleanType MagickMeanShiftImage(MagickWand *wand,
7273   const size_t width,const size_t height,const double color_distance)
7274 {
7275   Image
7276     *mean_image;
7277 
7278   assert(wand != (MagickWand *) NULL);
7279   assert(wand->signature == MagickWandSignature);
7280   if (wand->debug != MagickFalse)
7281     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7282   if (wand->images == (Image *) NULL)
7283     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7284   mean_image=MeanShiftImage(wand->images,width,height,color_distance,
7285     wand->exception);
7286   if (mean_image == (Image *) NULL)
7287     return(MagickFalse);
7288   ReplaceImageInList(&wand->images,mean_image);
7289   return(MagickTrue);
7290 }
7291 
7292 /*
7293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7294 %                                                                             %
7295 %                                                                             %
7296 %                                                                             %
7297 %   M a g i c k M e r g e I m a g e L a y e r s                               %
7298 %                                                                             %
7299 %                                                                             %
7300 %                                                                             %
7301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7302 %
7303 %  MagickMergeImageLayers() composes all the image layers from the current
7304 %  given image onward to produce a single image of the merged layers.
7305 %
7306 %  The inital canvas's size depends on the given LayerMethod, and is
7307 %  initialized using the first images background color.  The images
7308 %  are then compositied onto that image in sequence using the given
7309 %  composition that has been assigned to each individual image.
7310 %
7311 %  The format of the MagickMergeImageLayers method is:
7312 %
7313 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
7314 %        const LayerMethod method)
7315 %
7316 %  A description of each parameter follows:
7317 %
7318 %    o wand: the magick wand.
7319 %
7320 %    o method: the method of selecting the size of the initial canvas.
7321 %
7322 %        MergeLayer: Merge all layers onto a canvas just large enough
7323 %           to hold all the actual images. The virtual canvas of the
7324 %           first image is preserved but otherwise ignored.
7325 %
7326 %        FlattenLayer: Use the virtual canvas size of first image.
7327 %           Images which fall outside this canvas is clipped.
7328 %           This can be used to 'fill out' a given virtual canvas.
7329 %
7330 %        MosaicLayer: Start with the virtual canvas of the first image,
7331 %           enlarging left and right edges to contain all images.
7332 %           Images with negative offsets will be clipped.
7333 %
7334 */
MagickMergeImageLayers(MagickWand * wand,const LayerMethod method)7335 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
7336   const LayerMethod method)
7337 {
7338   Image
7339     *mosaic_image;
7340 
7341   assert(wand != (MagickWand *) NULL);
7342   assert(wand->signature == MagickWandSignature);
7343   if (wand->debug != MagickFalse)
7344     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7345   if (wand->images == (Image *) NULL)
7346     return((MagickWand *) NULL);
7347   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
7348   if (mosaic_image == (Image *) NULL)
7349     return((MagickWand *) NULL);
7350   return(CloneMagickWandFromImages(wand,mosaic_image));
7351 }
7352 
7353 /*
7354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7355 %                                                                             %
7356 %                                                                             %
7357 %                                                                             %
7358 %   M a g i c k M i n i f y I m a g e                                         %
7359 %                                                                             %
7360 %                                                                             %
7361 %                                                                             %
7362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7363 %
7364 %  MagickMinifyImage() is a convenience method that scales an image
7365 %  proportionally to one-half its original size
7366 %
7367 %  The format of the MagickMinifyImage method is:
7368 %
7369 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
7370 %
7371 %  A description of each parameter follows:
7372 %
7373 %    o wand: the magick wand.
7374 %
7375 */
MagickMinifyImage(MagickWand * wand)7376 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
7377 {
7378   Image
7379     *minify_image;
7380 
7381   assert(wand != (MagickWand *) NULL);
7382   assert(wand->signature == MagickWandSignature);
7383   if (wand->debug != MagickFalse)
7384     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7385   if (wand->images == (Image *) NULL)
7386     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7387   minify_image=MinifyImage(wand->images,wand->exception);
7388   if (minify_image == (Image *) NULL)
7389     return(MagickFalse);
7390   ReplaceImageInList(&wand->images,minify_image);
7391   return(MagickTrue);
7392 }
7393 
7394 /*
7395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7396 %                                                                             %
7397 %                                                                             %
7398 %                                                                             %
7399 %   M a g i c k M o d u l a t e I m a g e                                     %
7400 %                                                                             %
7401 %                                                                             %
7402 %                                                                             %
7403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7404 %
7405 %  MagickModulateImage() lets you control the brightness, saturation, and hue
7406 %  of an image.  Hue is the percentage of absolute rotation from the current
7407 %  position.  For example 50 results in a counter-clockwise rotation of 90
7408 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
7409 %  both resulting in a rotation of 180 degrees.
7410 %
7411 %  To increase the color brightness by 20% and decrease the color saturation by
7412 %  10% and leave the hue unchanged, use: 120,90,100.
7413 %
7414 %  The format of the MagickModulateImage method is:
7415 %
7416 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
7417 %        const double brightness,const double saturation,const double hue)
7418 %
7419 %  A description of each parameter follows:
7420 %
7421 %    o wand: the magick wand.
7422 %
7423 %    o brightness: the percent change in brighness.
7424 %
7425 %    o saturation: the percent change in saturation.
7426 %
7427 %    o hue: the percent change in hue.
7428 %
7429 */
MagickModulateImage(MagickWand * wand,const double brightness,const double saturation,const double hue)7430 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
7431   const double brightness,const double saturation,const double hue)
7432 {
7433   char
7434     modulate[MagickPathExtent];
7435 
7436   MagickBooleanType
7437     status;
7438 
7439   assert(wand != (MagickWand *) NULL);
7440   assert(wand->signature == MagickWandSignature);
7441   if (wand->debug != MagickFalse)
7442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7443   if (wand->images == (Image *) NULL)
7444     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7445   (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
7446     brightness,saturation,hue);
7447   status=ModulateImage(wand->images,modulate,wand->exception);
7448   return(status);
7449 }
7450 
7451 /*
7452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7453 %                                                                             %
7454 %                                                                             %
7455 %                                                                             %
7456 %   M a g i c k M o n t a g e I m a g e                                       %
7457 %                                                                             %
7458 %                                                                             %
7459 %                                                                             %
7460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7461 %
7462 %  MagickMontageImage() creates a composite image by combining several
7463 %  separate images. The images are tiled on the composite image with the name
7464 %  of the image optionally appearing just below the individual tile.
7465 %
7466 %  The format of the MagickMontageImage method is:
7467 %
7468 %      MagickWand *MagickMontageImage(MagickWand *wand,
7469 %        const DrawingWand drawing_wand,const char *tile_geometry,
7470 %        const char *thumbnail_geometry,const MontageMode mode,
7471 %        const char *frame)
7472 %
7473 %  A description of each parameter follows:
7474 %
7475 %    o wand: the magick wand.
7476 %
7477 %    o drawing_wand: the drawing wand.  The font name, size, and color are
7478 %      obtained from this wand.
7479 %
7480 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7481 %
7482 %    o thumbnail_geometry: Preferred image size and border size of each
7483 %      thumbnail (e.g. 120x120+4+3>).
7484 %
7485 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7486 %
7487 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7488 %      The frame color is that of the thumbnail's matte color.
7489 %
7490 */
MagickMontageImage(MagickWand * wand,const DrawingWand * drawing_wand,const char * tile_geometry,const char * thumbnail_geometry,const MontageMode mode,const char * frame)7491 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7492   const DrawingWand *drawing_wand,const char *tile_geometry,
7493   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7494 {
7495   char
7496     *font;
7497 
7498   Image
7499     *montage_image;
7500 
7501   MontageInfo
7502     *montage_info;
7503 
7504   PixelWand
7505     *pixel_wand;
7506 
7507   assert(wand != (MagickWand *) NULL);
7508   assert(wand->signature == MagickWandSignature);
7509   if (wand->debug != MagickFalse)
7510     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7511   if (wand->images == (Image *) NULL)
7512     return((MagickWand *) NULL);
7513   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7514   switch (mode)
7515   {
7516     case FrameMode:
7517     {
7518       (void) CloneString(&montage_info->frame,"15x15+3+3");
7519       montage_info->shadow=MagickTrue;
7520       break;
7521     }
7522     case UnframeMode:
7523     {
7524       montage_info->frame=(char *) NULL;
7525       montage_info->shadow=MagickFalse;
7526       montage_info->border_width=0;
7527       break;
7528     }
7529     case ConcatenateMode:
7530     {
7531       montage_info->frame=(char *) NULL;
7532       montage_info->shadow=MagickFalse;
7533       (void) CloneString(&montage_info->geometry,"+0+0");
7534       montage_info->border_width=0;
7535       break;
7536     }
7537     default:
7538       break;
7539   }
7540   font=DrawGetFont(drawing_wand);
7541   if (font != (char *) NULL)
7542     (void) CloneString(&montage_info->font,font);
7543   if (frame != (char *) NULL)
7544     (void) CloneString(&montage_info->frame,frame);
7545   montage_info->pointsize=DrawGetFontSize(drawing_wand);
7546   pixel_wand=NewPixelWand();
7547   DrawGetFillColor(drawing_wand,pixel_wand);
7548   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
7549   DrawGetStrokeColor(drawing_wand,pixel_wand);
7550   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
7551   pixel_wand=DestroyPixelWand(pixel_wand);
7552   if (thumbnail_geometry != (char *) NULL)
7553     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7554   if (tile_geometry != (char *) NULL)
7555     (void) CloneString(&montage_info->tile,tile_geometry);
7556   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7557     wand->exception);
7558   montage_info=DestroyMontageInfo(montage_info);
7559   if (montage_image == (Image *) NULL)
7560     return((MagickWand *) NULL);
7561   return(CloneMagickWandFromImages(wand,montage_image));
7562 }
7563 
7564 /*
7565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7566 %                                                                             %
7567 %                                                                             %
7568 %                                                                             %
7569 %   M a g i c k M o r p h I m a g e s                                         %
7570 %                                                                             %
7571 %                                                                             %
7572 %                                                                             %
7573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7574 %
7575 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
7576 %  and size are linearly interpolated to give the appearance of a
7577 %  meta-morphosis from one image to the next.
7578 %
7579 %  The format of the MagickMorphImages method is:
7580 %
7581 %      MagickWand *MagickMorphImages(MagickWand *wand,
7582 %        const size_t number_frames)
7583 %
7584 %  A description of each parameter follows:
7585 %
7586 %    o wand: the magick wand.
7587 %
7588 %    o number_frames: the number of in-between images to generate.
7589 %
7590 */
MagickMorphImages(MagickWand * wand,const size_t number_frames)7591 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7592   const size_t number_frames)
7593 {
7594   Image
7595     *morph_image;
7596 
7597   assert(wand != (MagickWand *) NULL);
7598   assert(wand->signature == MagickWandSignature);
7599   if (wand->debug != MagickFalse)
7600     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7601   if (wand->images == (Image *) NULL)
7602     return((MagickWand *) NULL);
7603   morph_image=MorphImages(wand->images,number_frames,wand->exception);
7604   if (morph_image == (Image *) NULL)
7605     return((MagickWand *) NULL);
7606   return(CloneMagickWandFromImages(wand,morph_image));
7607 }
7608 
7609 /*
7610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7611 %                                                                             %
7612 %                                                                             %
7613 %                                                                             %
7614 %   M a g i c k M o r p h o l o g y I m a g e                                 %
7615 %                                                                             %
7616 %                                                                             %
7617 %                                                                             %
7618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7619 %
7620 %  MagickMorphologyImage() applies a user supplied kernel to the image
7621 %  according to the given mophology method.
7622 %
7623 %  The format of the MagickMorphologyImage method is:
7624 %
7625 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7626 %        const MorphologyMethod method,const ssize_t iterations,
7627 %        const KernelInfo *kernel)
7628 %
7629 %  A description of each parameter follows:
7630 %
7631 %    o wand: the magick wand.
7632 %
7633 %    o method: the morphology method to be applied.
7634 %
7635 %    o iterations: apply the operation this many times (or no change).
7636 %      A value of -1 means loop until no change found.  How this is applied
7637 %      may depend on the morphology method.  Typically this is a value of 1.
7638 %
7639 %    o kernel: An array of doubles representing the morphology kernel.
7640 %
7641 */
MagickMorphologyImage(MagickWand * wand,const MorphologyMethod method,const ssize_t iterations,const KernelInfo * kernel)7642 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7643   const MorphologyMethod method,const ssize_t iterations,
7644   const KernelInfo *kernel)
7645 {
7646   Image
7647     *morphology_image;
7648 
7649   assert(wand != (MagickWand *) NULL);
7650   assert(wand->signature == MagickWandSignature);
7651   if (wand->debug != MagickFalse)
7652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7653   if (kernel == (const KernelInfo *) NULL)
7654     return(MagickFalse);
7655   if (wand->images == (Image *) NULL)
7656     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7657   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
7658     wand->exception);
7659   if (morphology_image == (Image *) NULL)
7660     return(MagickFalse);
7661   ReplaceImageInList(&wand->images,morphology_image);
7662   return(MagickTrue);
7663 }
7664 
7665 /*
7666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7667 %                                                                             %
7668 %                                                                             %
7669 %                                                                             %
7670 %   M a g i c k M o t i o n B l u r I m a g e                                 %
7671 %                                                                             %
7672 %                                                                             %
7673 %                                                                             %
7674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7675 %
7676 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7677 %  Gaussian operator of the given radius and standard deviation (sigma).
7678 %  For reasonable results, radius should be larger than sigma.  Use a
7679 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7680 %  Angle gives the angle of the blurring motion.
7681 %
7682 %  The format of the MagickMotionBlurImage method is:
7683 %
7684 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7685 %        const double radius,const double sigma,const double angle)
7686 %
7687 %  A description of each parameter follows:
7688 %
7689 %    o wand: the magick wand.
7690 %
7691 %    o radius: the radius of the Gaussian, in pixels, not counting
7692 %      the center pixel.
7693 %
7694 %    o sigma: the standard deviation of the Gaussian, in pixels.
7695 %
7696 %    o angle: Apply the effect along this angle.
7697 %
7698 */
MagickMotionBlurImage(MagickWand * wand,const double radius,const double sigma,const double angle)7699 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7700   const double radius,const double sigma,const double angle)
7701 {
7702   Image
7703     *blur_image;
7704 
7705   assert(wand != (MagickWand *) NULL);
7706   assert(wand->signature == MagickWandSignature);
7707   if (wand->debug != MagickFalse)
7708     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7709   if (wand->images == (Image *) NULL)
7710     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7711   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
7712   if (blur_image == (Image *) NULL)
7713     return(MagickFalse);
7714   ReplaceImageInList(&wand->images,blur_image);
7715   return(MagickTrue);
7716 }
7717 
7718 /*
7719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7720 %                                                                             %
7721 %                                                                             %
7722 %                                                                             %
7723 %   M a g i c k N e g a t e I m a g e                                         %
7724 %                                                                             %
7725 %                                                                             %
7726 %                                                                             %
7727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7728 %
7729 %  MagickNegateImage() negates the colors in the reference image.  The
7730 %  Grayscale option means that only grayscale values within the image are
7731 %  negated.
7732 %
7733 %  You can also reduce the influence of a particular channel with a gamma
7734 %  value of 0.
7735 %
7736 %  The format of the MagickNegateImage method is:
7737 %
7738 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7739 %        const MagickBooleanType gray)
7740 %
7741 %  A description of each parameter follows:
7742 %
7743 %    o wand: the magick wand.
7744 %
7745 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7746 %
7747 */
MagickNegateImage(MagickWand * wand,const MagickBooleanType gray)7748 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7749   const MagickBooleanType gray)
7750 {
7751   MagickBooleanType
7752     status;
7753 
7754   assert(wand != (MagickWand *) NULL);
7755   assert(wand->signature == MagickWandSignature);
7756   if (wand->debug != MagickFalse)
7757     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7758   if (wand->images == (Image *) NULL)
7759     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7760   status=NegateImage(wand->images,gray,wand->exception);
7761   return(status);
7762 }
7763 
7764 /*
7765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7766 %                                                                             %
7767 %                                                                             %
7768 %                                                                             %
7769 %   M a g i c k N e w I m a g e                                               %
7770 %                                                                             %
7771 %                                                                             %
7772 %                                                                             %
7773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7774 %
7775 %  MagickNewImage() adds a blank image canvas of the specified size and
7776 %  background color to the wand.
7777 %
7778 %  The format of the MagickNewImage method is:
7779 %
7780 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7781 %        const size_t columns,const size_t rows,
7782 %        const PixelWand *background)
7783 %
7784 %  A description of each parameter follows:
7785 %
7786 %    o wand: the magick wand.
7787 %
7788 %    o width: the image width.
7789 %
7790 %    o height: the image height.
7791 %
7792 %    o background: the image color.
7793 %
7794 */
MagickNewImage(MagickWand * wand,const size_t width,const size_t height,const PixelWand * background)7795 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7796   const size_t height,const PixelWand *background)
7797 {
7798   Image
7799     *images;
7800 
7801   PixelInfo
7802     pixel;
7803 
7804   assert(wand != (MagickWand *) NULL);
7805   assert(wand->signature == MagickWandSignature);
7806   if (wand->debug != MagickFalse)
7807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7808   PixelGetMagickColor(background,&pixel);
7809   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7810   if (images == (Image *) NULL)
7811     return(MagickFalse);
7812   return(InsertImageInWand(wand,images));
7813 }
7814 
7815 /*
7816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7817 %                                                                             %
7818 %                                                                             %
7819 %                                                                             %
7820 %   M a g i c k N e x t I m a g e                                             %
7821 %                                                                             %
7822 %                                                                             %
7823 %                                                                             %
7824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7825 %
7826 %  MagickNextImage() sets the next image in the wand as the current image.
7827 %
7828 %  It is typically used after MagickResetIterator(), after which its first use
7829 %  will set the first image as the current image (unless the wand is empty).
7830 %
7831 %  It will return MagickFalse when no more images are left to be returned
7832 %  which happens when the wand is empty, or the current image is the last
7833 %  image.
7834 %
7835 %  When the above condition (end of image list) is reached, the iterator is
7836 %  automaticall set so that you can start using MagickPreviousImage() to
7837 %  again iterate over the images in the reverse direction, starting with the
7838 %  last image (again).  You can jump to this condition immeditally using
7839 %  MagickSetLastIterator().
7840 %
7841 %  The format of the MagickNextImage method is:
7842 %
7843 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7844 %
7845 %  A description of each parameter follows:
7846 %
7847 %    o wand: the magick wand.
7848 %
7849 */
MagickNextImage(MagickWand * wand)7850 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7851 {
7852   assert(wand != (MagickWand *) NULL);
7853   assert(wand->signature == MagickWandSignature);
7854   if (wand->debug != MagickFalse)
7855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7856   if (wand->images == (Image *) NULL)
7857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7858   wand->insert_before=MagickFalse; /* Inserts is now appended */
7859   if (wand->image_pending != MagickFalse)
7860     {
7861       wand->image_pending=MagickFalse;
7862       return(MagickTrue);
7863     }
7864   if (GetNextImageInList(wand->images) == (Image *) NULL)
7865     {
7866       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7867       return(MagickFalse);
7868     }
7869   wand->images=GetNextImageInList(wand->images);
7870   return(MagickTrue);
7871 }
7872 
7873 /*
7874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7875 %                                                                             %
7876 %                                                                             %
7877 %                                                                             %
7878 %   M a g i c k N o r m a l i z e I m a g e                                   %
7879 %                                                                             %
7880 %                                                                             %
7881 %                                                                             %
7882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7883 %
7884 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7885 %  the pixels color to span the entire range of colors available
7886 %
7887 %  You can also reduce the influence of a particular channel with a gamma
7888 %  value of 0.
7889 %
7890 %  The format of the MagickNormalizeImage method is:
7891 %
7892 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7893 %
7894 %  A description of each parameter follows:
7895 %
7896 %    o wand: the magick wand.
7897 %
7898 */
MagickNormalizeImage(MagickWand * wand)7899 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7900 {
7901   MagickBooleanType
7902     status;
7903 
7904   assert(wand != (MagickWand *) NULL);
7905   assert(wand->signature == MagickWandSignature);
7906   if (wand->debug != MagickFalse)
7907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7908   if (wand->images == (Image *) NULL)
7909     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7910   status=NormalizeImage(wand->images,wand->exception);
7911   return(status);
7912 }
7913 
7914 /*
7915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7916 %                                                                             %
7917 %                                                                             %
7918 %                                                                             %
7919 %   M a g i c k O i l P a i n t I m a g e                                     %
7920 %                                                                             %
7921 %                                                                             %
7922 %                                                                             %
7923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7924 %
7925 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7926 %  painting.  Each pixel is replaced by the most frequent color occurring
7927 %  in a circular region defined by radius.
7928 %
7929 %  The format of the MagickOilPaintImage method is:
7930 %
7931 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7932 %        const double radius,const double sigma)
7933 %
7934 %  A description of each parameter follows:
7935 %
7936 %    o wand: the magick wand.
7937 %
7938 %    o radius: the radius of the circular neighborhood.
7939 %
7940 %    o sigma: the standard deviation of the Gaussian, in pixels.
7941 %
7942 */
MagickOilPaintImage(MagickWand * wand,const double radius,const double sigma)7943 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7944   const double radius,const double sigma)
7945 {
7946   Image
7947     *paint_image;
7948 
7949   assert(wand != (MagickWand *) NULL);
7950   assert(wand->signature == MagickWandSignature);
7951   if (wand->debug != MagickFalse)
7952     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7953   if (wand->images == (Image *) NULL)
7954     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7955   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7956   if (paint_image == (Image *) NULL)
7957     return(MagickFalse);
7958   ReplaceImageInList(&wand->images,paint_image);
7959   return(MagickTrue);
7960 }
7961 
7962 /*
7963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7964 %                                                                             %
7965 %                                                                             %
7966 %                                                                             %
7967 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7968 %                                                                             %
7969 %                                                                             %
7970 %                                                                             %
7971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7972 %
7973 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7974 %  defined by fill.
7975 %
7976 %  The format of the MagickOpaquePaintImage method is:
7977 %
7978 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7979 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7980 %        const MagickBooleanType invert)
7981 %
7982 %  A description of each parameter follows:
7983 %
7984 %    o wand: the magick wand.
7985 %
7986 %    o target: Change this target color to the fill color within the image.
7987 %
7988 %    o fill: the fill pixel wand.
7989 %
7990 %    o fuzz: By default target must match a particular pixel color
7991 %      exactly.  However, in many cases two colors may differ by a small amount.
7992 %      The fuzz member of image defines how much tolerance is acceptable to
7993 %      consider two colors as the same.  For example, set fuzz to 10 and the
7994 %      color red at intensities of 100 and 102 respectively are now interpreted
7995 %      as the same color for the purposes of the floodfill.
7996 %
7997 %    o invert: paint any pixel that does not match the target color.
7998 %
7999 */
MagickOpaquePaintImage(MagickWand * wand,const PixelWand * target,const PixelWand * fill,const double fuzz,const MagickBooleanType invert)8000 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
8001   const PixelWand *target,const PixelWand *fill,const double fuzz,
8002   const MagickBooleanType invert)
8003 {
8004   MagickBooleanType
8005     status;
8006 
8007   PixelInfo
8008     fill_pixel,
8009     target_pixel;
8010 
8011   assert(wand != (MagickWand *) NULL);
8012   assert(wand->signature == MagickWandSignature);
8013   if (wand->debug != MagickFalse)
8014     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8015   if (wand->images == (Image *) NULL)
8016     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8017   PixelGetMagickColor(target,&target_pixel);
8018   PixelGetMagickColor(fill,&fill_pixel);
8019   wand->images->fuzz=fuzz;
8020   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
8021     wand->exception);
8022   return(status);
8023 }
8024 
8025 /*
8026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8027 %                                                                             %
8028 %                                                                             %
8029 %                                                                             %
8030 %   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                         %
8031 %                                                                             %
8032 %                                                                             %
8033 %                                                                             %
8034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8035 %
8036 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
8037 %  previous image in the sequence.  From this it attempts to select the
8038 %  smallest cropped image to replace each frame, while preserving the results
8039 %  of the animation.
8040 %
8041 %  The format of the MagickOptimizeImageLayers method is:
8042 %
8043 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8044 %
8045 %  A description of each parameter follows:
8046 %
8047 %    o wand: the magick wand.
8048 %
8049 */
MagickOptimizeImageLayers(MagickWand * wand)8050 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8051 {
8052   Image
8053     *optimize_image;
8054 
8055   assert(wand != (MagickWand *) NULL);
8056   assert(wand->signature == MagickWandSignature);
8057   if (wand->debug != MagickFalse)
8058     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8059   if (wand->images == (Image *) NULL)
8060     return((MagickWand *) NULL);
8061   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
8062   if (optimize_image == (Image *) NULL)
8063     return((MagickWand *) NULL);
8064   return(CloneMagickWandFromImages(wand,optimize_image));
8065 }
8066 
8067 /*
8068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8069 %                                                                             %
8070 %                                                                             %
8071 %                                                                             %
8072 %   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             %
8073 %                                                                             %
8074 %                                                                             %
8075 %                                                                             %
8076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8077 %
8078 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
8079 %  compares the overlayed pixels against the disposal image resulting from all
8080 %  the previous frames in the animation.  Any pixel that does not change the
8081 %  disposal image (and thus does not effect the outcome of an overlay) is made
8082 %  transparent.
8083 %
8084 %  WARNING: This modifies the current images directly, rather than generate
8085 %  a new image sequence.
8086 %  The format of the MagickOptimizeImageTransparency method is:
8087 %
8088 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8089 %
8090 %  A description of each parameter follows:
8091 %
8092 %    o wand: the magick wand.
8093 %
8094 */
MagickOptimizeImageTransparency(MagickWand * wand)8095 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8096 {
8097   assert(wand != (MagickWand *) NULL);
8098   assert(wand->signature == MagickWandSignature);
8099   if (wand->debug != MagickFalse)
8100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8101   if (wand->images == (Image *) NULL)
8102     return(MagickFalse);
8103   OptimizeImageTransparency(wand->images,wand->exception);
8104   return(MagickTrue);
8105 }
8106 
8107 /*
8108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8109 %                                                                             %
8110 %                                                                             %
8111 %                                                                             %
8112 %     M a g i c k O r d e r e d D i t h e r I m a g e                         %
8113 %                                                                             %
8114 %                                                                             %
8115 %                                                                             %
8116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8117 %
8118 %  MagickOrderedDitherImage() performs an ordered dither based on a number
8119 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
8120 %  which can be different for different channels, according to the input
8121 %  arguments.
8122 %
8123 %  The format of the MagickOrderedDitherImage method is:
8124 %
8125 %      MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
8126 %        const char *threshold_map)
8127 %
8128 %  A description of each parameter follows:
8129 %
8130 %    o image: the image.
8131 %
8132 %    o threshold_map: A string containing the name of the threshold dither
8133 %      map to use, followed by zero or more numbers representing the number of
8134 %      color levels tho dither between.
8135 %
8136 %      Any level number less than 2 is equivalent to 2, and means only binary
8137 %      dithering will be applied to each color channel.
8138 %
8139 %      No numbers also means a 2 level (bitmap) dither will be applied to all
8140 %      channels, while a single number is the number of levels applied to each
8141 %      channel in sequence.  More numbers will be applied in turn to each of
8142 %      the color channels.
8143 %
8144 %      For example: "o3x3,6" generates a 6 level posterization of the image
8145 %      with a ordered 3x3 diffused pixel dither being applied between each
8146 %      level. While checker,8,8,4 will produce a 332 colormaped image with
8147 %      only a single checkerboard hash pattern (50% grey) between each color
8148 %      level, to basically double the number of color levels with a bare
8149 %      minimim of dithering.
8150 %
8151 */
MagickOrderedDitherImage(MagickWand * wand,const char * threshold_map)8152 WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand,
8153   const char *threshold_map)
8154 {
8155   MagickBooleanType
8156     status;
8157 
8158   assert(wand != (MagickWand *) NULL);
8159   assert(wand->signature == MagickWandSignature);
8160   if (wand->debug != MagickFalse)
8161     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8162   if (wand->images == (Image *) NULL)
8163     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8164   status=OrderedDitherImage(wand->images,threshold_map,wand->exception);
8165   return(status);
8166 }
8167 
8168 /*
8169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8170 %                                                                             %
8171 %                                                                             %
8172 %                                                                             %
8173 %   M a g i c k P i n g I m a g e                                             %
8174 %                                                                             %
8175 %                                                                             %
8176 %                                                                             %
8177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8178 %
8179 %  MagickPingImage() is the same as MagickReadImage() except the only valid
8180 %  information returned is the image width, height, size, and format.  It
8181 %  is designed to efficiently obtain this information from a file without
8182 %  reading the entire image sequence into memory.
8183 %
8184 %  The format of the MagickPingImage method is:
8185 %
8186 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
8187 %
8188 %  A description of each parameter follows:
8189 %
8190 %    o wand: the magick wand.
8191 %
8192 %    o filename: the image filename.
8193 %
8194 */
MagickPingImage(MagickWand * wand,const char * filename)8195 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
8196   const char *filename)
8197 {
8198   Image
8199     *images;
8200 
8201   ImageInfo
8202     *ping_info;
8203 
8204   assert(wand != (MagickWand *) NULL);
8205   assert(wand->signature == MagickWandSignature);
8206   if (wand->debug != MagickFalse)
8207     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8208   ping_info=CloneImageInfo(wand->image_info);
8209   if (filename != (const char *) NULL)
8210     (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
8211   images=PingImage(ping_info,wand->exception);
8212   ping_info=DestroyImageInfo(ping_info);
8213   if (images == (Image *) NULL)
8214     return(MagickFalse);
8215   return(InsertImageInWand(wand,images));
8216 }
8217 
8218 /*
8219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8220 %                                                                             %
8221 %                                                                             %
8222 %                                                                             %
8223 %   M a g i c k P i n g I m a g e B l o b                                     %
8224 %                                                                             %
8225 %                                                                             %
8226 %                                                                             %
8227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8228 %
8229 %  MagickPingImageBlob() pings an image or image sequence from a blob.
8230 %
8231 %  The format of the MagickPingImageBlob method is:
8232 %
8233 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8234 %        const void *blob,const size_t length)
8235 %
8236 %  A description of each parameter follows:
8237 %
8238 %    o wand: the magick wand.
8239 %
8240 %    o blob: the blob.
8241 %
8242 %    o length: the blob length.
8243 %
8244 */
MagickPingImageBlob(MagickWand * wand,const void * blob,const size_t length)8245 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8246   const void *blob,const size_t length)
8247 {
8248   Image
8249     *images;
8250 
8251   ImageInfo
8252     *read_info;
8253 
8254   assert(wand != (MagickWand *) NULL);
8255   assert(wand->signature == MagickWandSignature);
8256   if (wand->debug != MagickFalse)
8257     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8258   read_info=CloneImageInfo(wand->image_info);
8259   SetImageInfoBlob(read_info,blob,length);
8260   images=PingImage(read_info,wand->exception);
8261   read_info=DestroyImageInfo(read_info);
8262   if (images == (Image *) NULL)
8263     return(MagickFalse);
8264   return(InsertImageInWand(wand,images));
8265 }
8266 
8267 /*
8268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8269 %                                                                             %
8270 %                                                                             %
8271 %                                                                             %
8272 %   M a g i c k P i n g I m a g e F i l e                                     %
8273 %                                                                             %
8274 %                                                                             %
8275 %                                                                             %
8276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8277 %
8278 %  MagickPingImageFile() pings an image or image sequence from an open file
8279 %  descriptor.
8280 %
8281 %  The format of the MagickPingImageFile method is:
8282 %
8283 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8284 %
8285 %  A description of each parameter follows:
8286 %
8287 %    o wand: the magick wand.
8288 %
8289 %    o file: the file descriptor.
8290 %
8291 */
MagickPingImageFile(MagickWand * wand,FILE * file)8292 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8293 {
8294   Image
8295     *images;
8296 
8297   ImageInfo
8298     *read_info;
8299 
8300   assert(wand != (MagickWand *) NULL);
8301   assert(wand->signature == MagickWandSignature);
8302   assert(file != (FILE *) NULL);
8303   if (wand->debug != MagickFalse)
8304     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8305   read_info=CloneImageInfo(wand->image_info);
8306   SetImageInfoFile(read_info,file);
8307   images=PingImage(read_info,wand->exception);
8308   read_info=DestroyImageInfo(read_info);
8309   if (images == (Image *) NULL)
8310     return(MagickFalse);
8311   return(InsertImageInWand(wand,images));
8312 }
8313 
8314 /*
8315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8316 %                                                                             %
8317 %                                                                             %
8318 %                                                                             %
8319 %   M a g i c k P o l a r o i d I m a g e                                     %
8320 %                                                                             %
8321 %                                                                             %
8322 %                                                                             %
8323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8324 %
8325 %  MagickPolaroidImage() simulates a Polaroid picture.
8326 %
8327 %  The format of the MagickPolaroidImage method is:
8328 %
8329 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8330 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
8331 %        const PixelInterpolateMethod method)
8332 %
8333 %  A description of each parameter follows:
8334 %
8335 %    o wand: the magick wand.
8336 %
8337 %    o drawing_wand: the draw wand.
8338 %
8339 %    o caption: the Polaroid caption.
8340 %
8341 %    o angle: Apply the effect along this angle.
8342 %
8343 %    o method: the pixel interpolation method.
8344 %
8345 */
MagickPolaroidImage(MagickWand * wand,const DrawingWand * drawing_wand,const char * caption,const double angle,const PixelInterpolateMethod method)8346 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8347   const DrawingWand *drawing_wand,const char *caption,const double angle,
8348   const PixelInterpolateMethod method)
8349 {
8350   DrawInfo
8351     *draw_info;
8352 
8353   Image
8354     *polaroid_image;
8355 
8356   assert(wand != (MagickWand *) NULL);
8357   assert(wand->signature == MagickWandSignature);
8358   if (wand->debug != MagickFalse)
8359     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8360   if (wand->images == (Image *) NULL)
8361     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8362   draw_info=PeekDrawingWand(drawing_wand);
8363   if (draw_info == (DrawInfo *) NULL)
8364     return(MagickFalse);
8365   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
8366     wand->exception);
8367   if (polaroid_image == (Image *) NULL)
8368     return(MagickFalse);
8369   ReplaceImageInList(&wand->images,polaroid_image);
8370   return(MagickTrue);
8371 }
8372 
8373 /*
8374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8375 %                                                                             %
8376 %                                                                             %
8377 %                                                                             %
8378 %   M a g i c k P o l y n o m i a l I m a g e                                 %
8379 %                                                                             %
8380 %                                                                             %
8381 %                                                                             %
8382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8383 %
8384 %  MagickPolynomialImage() returns an image where each pixel is the sum of the
8385 %  pixels in the image sequence after applying its corresponding terms
8386 %  (coefficient and degree pairs).
8387 %
8388 %  The format of the MagickPolynomialImage method is:
8389 %
8390 %      MagickBooleanType MagickPolynomialImage(MagickWand *wand,
8391 %        const size_t number_terms,const double *terms)
8392 %
8393 %  A description of each parameter follows:
8394 %
8395 %    o wand: the magick wand.
8396 %
8397 %    o number_terms: the number of terms in the list.  The actual list length
8398 %      is 2 x number_terms + 1 (the constant).
8399 %
8400 %    o terms: the list of polynomial coefficients and degree pairs and a
8401 %      constant.
8402 %
8403 */
MagickPolynomialImage(MagickWand * wand,const size_t number_terms,const double * terms)8404 WandExport MagickBooleanType MagickPolynomialImage(MagickWand *wand,
8405   const size_t number_terms,const double *terms)
8406 {
8407   Image
8408     *polynomial_image;
8409 
8410   assert(wand != (MagickWand *) NULL);
8411   assert(wand->signature == MagickWandSignature);
8412   if (wand->debug != MagickFalse)
8413     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8414   if (wand->images == (Image *) NULL)
8415     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8416   polynomial_image=PolynomialImage(wand->images,number_terms,terms,
8417     wand->exception);
8418   if (polynomial_image == (Image *) NULL)
8419     return(MagickFalse);
8420   ReplaceImageInList(&wand->images,polynomial_image);
8421   return(MagickTrue);
8422 }
8423 
8424 /*
8425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8426 %                                                                             %
8427 %                                                                             %
8428 %                                                                             %
8429 %   M a g i c k P o s t e r i z e I m a g e                                   %
8430 %                                                                             %
8431 %                                                                             %
8432 %                                                                             %
8433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8434 %
8435 %  MagickPosterizeImage() reduces the image to a limited number of color level.
8436 %
8437 %  The format of the MagickPosterizeImage method is:
8438 %
8439 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8440 %        const size_t levels,const DitherMethod method)
8441 %
8442 %  A description of each parameter follows:
8443 %
8444 %    o wand: the magick wand.
8445 %
8446 %    o levels: Number of color levels allowed in each channel.  Very low values
8447 %      (2, 3, or 4) have the most visible effect.
8448 %
8449 %    o method: choose the dither method: UndefinedDitherMethod,
8450 %      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8451 %
8452 */
MagickPosterizeImage(MagickWand * wand,const size_t levels,const DitherMethod dither)8453 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8454   const size_t levels,const DitherMethod dither)
8455 {
8456   MagickBooleanType
8457     status;
8458 
8459   assert(wand != (MagickWand *) NULL);
8460   assert(wand->signature == MagickWandSignature);
8461   if (wand->debug != MagickFalse)
8462     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8463   if (wand->images == (Image *) NULL)
8464     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8465   status=PosterizeImage(wand->images,levels,dither,wand->exception);
8466   return(status);
8467 }
8468 
8469 /*
8470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8471 %                                                                             %
8472 %                                                                             %
8473 %                                                                             %
8474 %   M a g i c k P r e v i e w I m a g e s                                     %
8475 %                                                                             %
8476 %                                                                             %
8477 %                                                                             %
8478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8479 %
8480 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8481 %  image processing operation applied at varying strengths.  This helpful
8482 %  to quickly pin-point an appropriate parameter for an image processing
8483 %  operation.
8484 %
8485 %  The format of the MagickPreviewImages method is:
8486 %
8487 %      MagickWand *MagickPreviewImages(MagickWand *wand,
8488 %        const PreviewType preview)
8489 %
8490 %  A description of each parameter follows:
8491 %
8492 %    o wand: the magick wand.
8493 %
8494 %    o preview: the preview type.
8495 %
8496 */
MagickPreviewImages(MagickWand * wand,const PreviewType preview)8497 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8498   const PreviewType preview)
8499 {
8500   Image
8501     *preview_image;
8502 
8503   assert(wand != (MagickWand *) NULL);
8504   assert(wand->signature == MagickWandSignature);
8505   if (wand->debug != MagickFalse)
8506     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8507   if (wand->images == (Image *) NULL)
8508     return((MagickWand *) NULL);
8509   preview_image=PreviewImage(wand->images,preview,wand->exception);
8510   if (preview_image == (Image *) NULL)
8511     return((MagickWand *) NULL);
8512   return(CloneMagickWandFromImages(wand,preview_image));
8513 }
8514 
8515 /*
8516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8517 %                                                                             %
8518 %                                                                             %
8519 %                                                                             %
8520 %   M a g i c k P r e v i o u s I m a g e                                     %
8521 %                                                                             %
8522 %                                                                             %
8523 %                                                                             %
8524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8525 %
8526 %  MagickPreviousImage() sets the previous image in the wand as the current
8527 %  image.
8528 %
8529 %  It is typically used after MagickSetLastIterator(), after which its first
8530 %  use will set the last image as the current image (unless the wand is empty).
8531 %
8532 %  It will return MagickFalse when no more images are left to be returned
8533 %  which happens when the wand is empty, or the current image is the first
8534 %  image.  At that point the iterator is than reset to again process images in
8535 %  the forward direction, again starting with the first image in list. Images
8536 %  added at this point are prepended.
8537 %
8538 %  Also at that point any images added to the wand using MagickAddImages() or
8539 %  MagickReadImages() will be prepended before the first image. In this sense
8540 %  the condition is not quite exactly the same as MagickResetIterator().
8541 %
8542 %  The format of the MagickPreviousImage method is:
8543 %
8544 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
8545 %
8546 %  A description of each parameter follows:
8547 %
8548 %    o wand: the magick wand.
8549 %
8550 */
MagickPreviousImage(MagickWand * wand)8551 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8552 {
8553   assert(wand != (MagickWand *) NULL);
8554   assert(wand->signature == MagickWandSignature);
8555   if (wand->debug != MagickFalse)
8556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8557   if (wand->images == (Image *) NULL)
8558     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8559   if (wand->image_pending != MagickFalse)
8560     {
8561       wand->image_pending=MagickFalse;  /* image returned no longer pending */
8562       return(MagickTrue);
8563     }
8564   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8565     {
8566       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
8567       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
8568       return(MagickFalse);
8569     }
8570   wand->images=GetPreviousImageInList(wand->images);
8571   return(MagickTrue);
8572 }
8573 
8574 /*
8575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8576 %                                                                             %
8577 %                                                                             %
8578 %                                                                             %
8579 %   M a g i c k Q u a n t i z e I m a g e                                     %
8580 %                                                                             %
8581 %                                                                             %
8582 %                                                                             %
8583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8584 %
8585 %  MagickQuantizeImage() analyzes the colors within a reference image and
8586 %  chooses a fixed number of colors to represent the image.  The goal of the
8587 %  algorithm is to minimize the color difference between the input and output
8588 %  image while minimizing the processing time.
8589 %
8590 %  The format of the MagickQuantizeImage method is:
8591 %
8592 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8593 %        const size_t number_colors,const ColorspaceType colorspace,
8594 %        const size_t treedepth,const DitherMethod dither_method,
8595 %        const MagickBooleanType measure_error)
8596 %
8597 %  A description of each parameter follows:
8598 %
8599 %    o wand: the magick wand.
8600 %
8601 %    o number_colors: the number of colors.
8602 %
8603 %    o colorspace: Perform color reduction in this colorspace, typically
8604 %      RGBColorspace.
8605 %
8606 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8607 %      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
8608 %      reference image with the least amount of memory and the fastest
8609 %      computational speed.  In some cases, such as an image with low color
8610 %      dispersion (a few number of colors), a value other than
8611 %      Log4(number_colors) is required.  To expand the color tree completely,
8612 %      use a value of 8.
8613 %
8614 %    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
8615 %      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
8616 %
8617 %    o measure_error: A value other than zero measures the difference between
8618 %      the original and quantized images.  This difference is the total
8619 %      quantization error.  The error is computed by summing over all pixels
8620 %      in an image the distance squared in RGB space between each reference
8621 %      pixel value and its quantized value.
8622 %
8623 */
MagickQuantizeImage(MagickWand * wand,const size_t number_colors,const ColorspaceType colorspace,const size_t treedepth,const DitherMethod dither_method,const MagickBooleanType measure_error)8624 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8625   const size_t number_colors,const ColorspaceType colorspace,
8626   const size_t treedepth,const DitherMethod dither_method,
8627   const MagickBooleanType measure_error)
8628 {
8629   MagickBooleanType
8630     status;
8631 
8632   QuantizeInfo
8633     *quantize_info;
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   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8642   quantize_info->number_colors=number_colors;
8643   quantize_info->dither_method=dither_method;
8644   quantize_info->tree_depth=treedepth;
8645   quantize_info->colorspace=colorspace;
8646   quantize_info->measure_error=measure_error;
8647   status=QuantizeImage(quantize_info,wand->images,wand->exception);
8648   quantize_info=DestroyQuantizeInfo(quantize_info);
8649   return(status);
8650 }
8651 
8652 /*
8653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8654 %                                                                             %
8655 %                                                                             %
8656 %                                                                             %
8657 %   M a g i c k Q u a n t i z e I m a g e s                                   %
8658 %                                                                             %
8659 %                                                                             %
8660 %                                                                             %
8661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8662 %
8663 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
8664 %  chooses a fixed number of colors to represent the image.  The goal of the
8665 %  algorithm is to minimize the color difference between the input and output
8666 %  image while minimizing the processing time.
8667 %
8668 %  The format of the MagickQuantizeImages method is:
8669 %
8670 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8671 %        const size_t number_colors,const ColorspaceType colorspace,
8672 %        const size_t treedepth,const DitherMethod dither_method,
8673 %        const MagickBooleanType measure_error)
8674 %
8675 %  A description of each parameter follows:
8676 %
8677 %    o wand: the magick wand.
8678 %
8679 %    o number_colors: the number of colors.
8680 %
8681 %    o colorspace: Perform color reduction in this colorspace, typically
8682 %      RGBColorspace.
8683 %
8684 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8685 %      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
8686 %      reference image with the least amount of memory and the fastest
8687 %      computational speed.  In some cases, such as an image with low color
8688 %      dispersion (a few number of colors), a value other than
8689 %      Log4(number_colors) is required.  To expand the color tree completely,
8690 %      use a value of 8.
8691 %
8692 %    o dither_method: choose from these dither methods: NoDitherMethod,
8693 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8694 %
8695 %    o measure_error: A value other than zero measures the difference between
8696 %      the original and quantized images.  This difference is the total
8697 %      quantization error.  The error is computed by summing over all pixels
8698 %      in an image the distance squared in RGB space between each reference
8699 %      pixel value and its quantized value.
8700 %
8701 */
MagickQuantizeImages(MagickWand * wand,const size_t number_colors,const ColorspaceType colorspace,const size_t treedepth,const DitherMethod dither_method,const MagickBooleanType measure_error)8702 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8703   const size_t number_colors,const ColorspaceType colorspace,
8704   const size_t treedepth,const DitherMethod dither_method,
8705   const MagickBooleanType measure_error)
8706 {
8707   MagickBooleanType
8708     status;
8709 
8710   QuantizeInfo
8711     *quantize_info;
8712 
8713   assert(wand != (MagickWand *) NULL);
8714   assert(wand->signature == MagickWandSignature);
8715   if (wand->debug != MagickFalse)
8716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8717   if (wand->images == (Image *) NULL)
8718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8719   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8720   quantize_info->number_colors=number_colors;
8721   quantize_info->dither_method=dither_method;
8722   quantize_info->tree_depth=treedepth;
8723   quantize_info->colorspace=colorspace;
8724   quantize_info->measure_error=measure_error;
8725   status=QuantizeImages(quantize_info,wand->images,wand->exception);
8726   quantize_info=DestroyQuantizeInfo(quantize_info);
8727   return(status);
8728 }
8729 
8730 /*
8731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8732 %                                                                             %
8733 %                                                                             %
8734 %                                                                             %
8735 %   M a g i c k R a n g e T h r e s h o l d I m a g e                         %
8736 %                                                                             %
8737 %                                                                             %
8738 %                                                                             %
8739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8740 %
8741 %  MagickRangeThresholdImage() applies soft and hard thresholding.
8742 %
8743 %  The format of the RangeThresholdImage method is:
8744 %
8745 %      MagickBooleanType MagickRangeThresholdImage(MagickWand *wand,
8746 %        const double low_black,const double low_white,const double high_white,
8747 %        const double high_black)
8748 %
8749 %  A description of each parameter follows:
8750 %
8751 %    o wand: the magick wand.
8752 %
8753 %    o low_black: Define the minimum threshold value.
8754 %
8755 %    o low_white: Define the maximum threshold value.
8756 %
8757 %    o high_white: Define the minimum threshold value.
8758 %
8759 %    o low_white: Define the maximum threshold value.
8760 %
8761 */
MagickRangeThresholdImage(MagickWand * wand,const double low_black,const double low_white,const double high_white,const double high_black)8762 WandExport MagickBooleanType MagickRangeThresholdImage(MagickWand *wand,
8763   const double low_black,const double low_white,const double high_white,
8764   const double high_black)
8765 {
8766   MagickBooleanType
8767     status;
8768 
8769   assert(wand != (MagickWand *) NULL);
8770   assert(wand->signature == MagickWandSignature);
8771   if (wand->debug != MagickFalse)
8772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8773   if (wand->images == (Image *) NULL)
8774     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8775   status=RangeThresholdImage(wand->images,low_black,low_white,
8776     high_white,high_black,wand->exception);
8777   return(status);
8778 }
8779 
8780 /*
8781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8782 %                                                                             %
8783 %                                                                             %
8784 %                                                                             %
8785 %   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                         %
8786 %                                                                             %
8787 %                                                                             %
8788 %                                                                             %
8789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8790 %
8791 %  MagickRotationalBlurImage() rotational blurs an image.
8792 %
8793 %  The format of the MagickRotationalBlurImage method is:
8794 %
8795 %      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8796 %        const double angle)
8797 %
8798 %  A description of each parameter follows:
8799 %
8800 %    o wand: the magick wand.
8801 %
8802 %    o angle: the angle of the blur in degrees.
8803 %
8804 */
MagickRotationalBlurImage(MagickWand * wand,const double angle)8805 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8806   const double angle)
8807 {
8808   Image
8809     *blur_image;
8810 
8811   assert(wand != (MagickWand *) NULL);
8812   assert(wand->signature == MagickWandSignature);
8813   if (wand->debug != MagickFalse)
8814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8815   if (wand->images == (Image *) NULL)
8816     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8817   blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
8818   if (blur_image == (Image *) NULL)
8819     return(MagickFalse);
8820   ReplaceImageInList(&wand->images,blur_image);
8821   return(MagickTrue);
8822 }
8823 
8824 /*
8825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8826 %                                                                             %
8827 %                                                                             %
8828 %                                                                             %
8829 %   M a g i c k R a i s e I m a g e                                           %
8830 %                                                                             %
8831 %                                                                             %
8832 %                                                                             %
8833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8834 %
8835 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8836 %  by lightening and darkening the edges of the image.  Members width and
8837 %  height of raise_info define the width of the vertical and horizontal
8838 %  edge of the effect.
8839 %
8840 %  The format of the MagickRaiseImage method is:
8841 %
8842 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8843 %        const size_t width,const size_t height,const ssize_t x,
8844 %        const ssize_t y,const MagickBooleanType raise)
8845 %
8846 %  A description of each parameter follows:
8847 %
8848 %    o wand: the magick wand.
8849 %
8850 %    o width,height,x,y:  Define the dimensions of the area to raise.
8851 %
8852 %    o raise: A value other than zero creates a 3-D raise effect,
8853 %      otherwise it has a lowered effect.
8854 %
8855 */
MagickRaiseImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y,const MagickBooleanType raise)8856 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8857   const size_t width,const size_t height,const ssize_t x,
8858   const ssize_t y,const MagickBooleanType raise)
8859 {
8860   MagickBooleanType
8861     status;
8862 
8863   RectangleInfo
8864     raise_info;
8865 
8866   assert(wand != (MagickWand *) NULL);
8867   assert(wand->signature == MagickWandSignature);
8868   if (wand->debug != MagickFalse)
8869     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8870   if (wand->images == (Image *) NULL)
8871     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8872   raise_info.width=width;
8873   raise_info.height=height;
8874   raise_info.x=x;
8875   raise_info.y=y;
8876   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8877   return(status);
8878 }
8879 
8880 /*
8881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8882 %                                                                             %
8883 %                                                                             %
8884 %                                                                             %
8885 %   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                       %
8886 %                                                                             %
8887 %                                                                             %
8888 %                                                                             %
8889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8890 %
8891 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8892 %  the intensity of each pixel compared to threshold.  The result is a
8893 %  high-contrast, two color image.
8894 %
8895 %  The format of the MagickRandomThresholdImage method is:
8896 %
8897 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8898 %        const double low,const double high)
8899 %
8900 %  A description of each parameter follows:
8901 %
8902 %    o wand: the magick wand.
8903 %
8904 %    o low,high: Specify the high and low thresholds. These values range from
8905 %      0 to QuantumRange.
8906 %
8907 */
MagickRandomThresholdImage(MagickWand * wand,const double low,const double high)8908 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8909   const double low,const double high)
8910 {
8911   assert(wand != (MagickWand *) NULL);
8912   assert(wand->signature == MagickWandSignature);
8913   if (wand->debug != MagickFalse)
8914     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8915   if (wand->images == (Image *) NULL)
8916     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8917   return(RandomThresholdImage(wand->images,low,high,wand->exception));
8918 }
8919 
8920 /*
8921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8922 %                                                                             %
8923 %                                                                             %
8924 %                                                                             %
8925 %   M a g i c k R e a d I m a g e                                             %
8926 %                                                                             %
8927 %                                                                             %
8928 %                                                                             %
8929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8930 %
8931 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8932 %  just before the current image pointer position.
8933 %
8934 %  Use MagickSetFirstIterator(), to insert new images before all the current
8935 %  images in the wand, MagickSetLastIterator() to append add to the end,
8936 %  MagickSetIteratorIndex() to place images just after the given index.
8937 %
8938 %  The format of the MagickReadImage method is:
8939 %
8940 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8941 %
8942 %  A description of each parameter follows:
8943 %
8944 %    o wand: the magick wand.
8945 %
8946 %    o filename: the image filename.
8947 %
8948 */
MagickReadImage(MagickWand * wand,const char * filename)8949 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8950   const char *filename)
8951 {
8952   Image
8953     *images;
8954 
8955   ImageInfo
8956     *read_info;
8957 
8958   assert(wand != (MagickWand *) NULL);
8959   assert(wand->signature == MagickWandSignature);
8960   if (wand->debug != MagickFalse)
8961     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8962   read_info=CloneImageInfo(wand->image_info);
8963   if (filename != (const char *) NULL)
8964     (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
8965   images=ReadImage(read_info,wand->exception);
8966   read_info=DestroyImageInfo(read_info);
8967   if (images == (Image *) NULL)
8968     return(MagickFalse);
8969   return(InsertImageInWand(wand,images));
8970 }
8971 
8972 /*
8973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8974 %                                                                             %
8975 %                                                                             %
8976 %                                                                             %
8977 %   M a g i c k R e a d I m a g e B l o b                                     %
8978 %                                                                             %
8979 %                                                                             %
8980 %                                                                             %
8981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8982 %
8983 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8984 %  In all other respects it is like MagickReadImage().
8985 %
8986 %  The format of the MagickReadImageBlob method is:
8987 %
8988 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8989 %        const void *blob,const size_t length)
8990 %
8991 %  A description of each parameter follows:
8992 %
8993 %    o wand: the magick wand.
8994 %
8995 %    o blob: the blob.
8996 %
8997 %    o length: the blob length.
8998 %
8999 */
MagickReadImageBlob(MagickWand * wand,const void * blob,const size_t length)9000 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
9001   const void *blob,const size_t length)
9002 {
9003   Image
9004     *images;
9005 
9006   assert(wand != (MagickWand *) NULL);
9007   assert(wand->signature == MagickWandSignature);
9008   if (wand->debug != MagickFalse)
9009     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9010   images=BlobToImage(wand->image_info,blob,length,wand->exception);
9011   if (images == (Image *) NULL)
9012     return(MagickFalse);
9013   return(InsertImageInWand(wand,images));
9014 }
9015 
9016 /*
9017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9018 %                                                                             %
9019 %                                                                             %
9020 %                                                                             %
9021 %   M a g i c k R e a d I m a g e F i l e                                     %
9022 %                                                                             %
9023 %                                                                             %
9024 %                                                                             %
9025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9026 %
9027 %  MagickReadImageFile() reads an image or image sequence from an already
9028 %  opened file descriptor.  Otherwise it is like MagickReadImage().
9029 %
9030 %  The format of the MagickReadImageFile method is:
9031 %
9032 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
9033 %
9034 %  A description of each parameter follows:
9035 %
9036 %    o wand: the magick wand.
9037 %
9038 %    o file: the file descriptor.
9039 %
9040 */
MagickReadImageFile(MagickWand * wand,FILE * file)9041 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
9042 {
9043   Image
9044     *images;
9045 
9046   ImageInfo
9047     *read_info;
9048 
9049   assert(wand != (MagickWand *) NULL);
9050   assert(wand->signature == MagickWandSignature);
9051   assert(file != (FILE *) NULL);
9052   if (wand->debug != MagickFalse)
9053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9054   read_info=CloneImageInfo(wand->image_info);
9055   SetImageInfoFile(read_info,file);
9056   images=ReadImage(read_info,wand->exception);
9057   read_info=DestroyImageInfo(read_info);
9058   if (images == (Image *) NULL)
9059     return(MagickFalse);
9060   return(InsertImageInWand(wand,images));
9061 }
9062 
9063 /*
9064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9065 %                                                                             %
9066 %                                                                             %
9067 %                                                                             %
9068 %   M a g i c k R e m a p I m a g e                                           %
9069 %                                                                             %
9070 %                                                                             %
9071 %                                                                             %
9072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9073 %
9074 %  MagickRemapImage() replaces the colors of an image with the closest color
9075 %  from a reference image.
9076 %
9077 %  The format of the MagickRemapImage method is:
9078 %
9079 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
9080 %        const MagickWand *remap_wand,const DitherMethod method)
9081 %
9082 %  A description of each parameter follows:
9083 %
9084 %    o wand: the magick wand.
9085 %
9086 %    o affinity: the affinity wand.
9087 %
9088 %    o method: choose from these dither methods: NoDitherMethod,
9089 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
9090 %
9091 */
MagickRemapImage(MagickWand * wand,const MagickWand * remap_wand,const DitherMethod dither_method)9092 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
9093   const MagickWand *remap_wand,const DitherMethod dither_method)
9094 {
9095   MagickBooleanType
9096     status;
9097 
9098   QuantizeInfo
9099     *quantize_info;
9100 
9101   assert(wand != (MagickWand *) NULL);
9102   assert(wand->signature == MagickWandSignature);
9103   if (wand->debug != MagickFalse)
9104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9105   if ((wand->images == (Image *) NULL) ||
9106       (remap_wand->images == (Image *) NULL))
9107     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9108   quantize_info=AcquireQuantizeInfo(wand->image_info);
9109   quantize_info->dither_method=dither_method;
9110   status=RemapImage(quantize_info,wand->images,remap_wand->images,
9111     wand->exception);
9112   quantize_info=DestroyQuantizeInfo(quantize_info);
9113   return(status);
9114 }
9115 
9116 /*
9117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9118 %                                                                             %
9119 %                                                                             %
9120 %                                                                             %
9121 %   M a g i c k R e m o v e I m a g e                                         %
9122 %                                                                             %
9123 %                                                                             %
9124 %                                                                             %
9125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9126 %
9127 %  MagickRemoveImage() removes an image from the image list.
9128 %
9129 %  The format of the MagickRemoveImage method is:
9130 %
9131 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
9132 %
9133 %  A description of each parameter follows:
9134 %
9135 %    o wand: the magick wand.
9136 %
9137 %    o insert: the splice wand.
9138 %
9139 */
MagickRemoveImage(MagickWand * wand)9140 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
9141 {
9142   assert(wand != (MagickWand *) NULL);
9143   assert(wand->signature == MagickWandSignature);
9144   if (wand->debug != MagickFalse)
9145     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9146   if (wand->images == (Image *) NULL)
9147     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9148   DeleteImageFromList(&wand->images);
9149   return(MagickTrue);
9150 }
9151 
9152 /*
9153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9154 %                                                                             %
9155 %                                                                             %
9156 %                                                                             %
9157 %   M a g i c k R e s a m p l e I m a g e                                     %
9158 %                                                                             %
9159 %                                                                             %
9160 %                                                                             %
9161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9162 %
9163 %  MagickResampleImage() resample image to desired resolution.
9164 %
9165 %    Bessel   Blackman   Box
9166 %    Catrom   Cubic      Gaussian
9167 %    Hanning  Hermite    Lanczos
9168 %    Mitchell Point      Quandratic
9169 %    Sinc     Triangle
9170 %
9171 %  Most of the filters are FIR (finite impulse response), however, Bessel,
9172 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
9173 %  are windowed (brought down to zero) with the Blackman filter.
9174 %
9175 %  The format of the MagickResampleImage method is:
9176 %
9177 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
9178 %        const double x_resolution,const double y_resolution,
9179 %        const FilterType filter)
9180 %
9181 %  A description of each parameter follows:
9182 %
9183 %    o wand: the magick wand.
9184 %
9185 %    o x_resolution: the new image x resolution.
9186 %
9187 %    o y_resolution: the new image y resolution.
9188 %
9189 %    o filter: Image filter to use.
9190 %
9191 */
MagickResampleImage(MagickWand * wand,const double x_resolution,const double y_resolution,const FilterType filter)9192 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
9193   const double x_resolution,const double y_resolution,const FilterType filter)
9194 {
9195   Image
9196     *resample_image;
9197 
9198   assert(wand != (MagickWand *) NULL);
9199   assert(wand->signature == MagickWandSignature);
9200   if (wand->debug != MagickFalse)
9201     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9202   if (wand->images == (Image *) NULL)
9203     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9204   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
9205     wand->exception);
9206   if (resample_image == (Image *) NULL)
9207     return(MagickFalse);
9208   ReplaceImageInList(&wand->images,resample_image);
9209   return(MagickTrue);
9210 }
9211 
9212 /*
9213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9214 %                                                                             %
9215 %                                                                             %
9216 %                                                                             %
9217 %   M a g i c k R e s e t I m a g e P a g e                                   %
9218 %                                                                             %
9219 %                                                                             %
9220 %                                                                             %
9221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9222 %
9223 %  MagickResetImagePage() resets the Wand page canvas and position.
9224 %
9225 %  The format of the MagickResetImagePage method is:
9226 %
9227 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
9228 %        const char *page)
9229 %
9230 %  A description of each parameter follows:
9231 %
9232 %    o wand: the magick wand.
9233 %
9234 %    o page: the relative page specification.
9235 %
9236 */
MagickResetImagePage(MagickWand * wand,const char * page)9237 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
9238   const char *page)
9239 {
9240   assert(wand != (MagickWand *) NULL);
9241   assert(wand->signature == MagickWandSignature);
9242   if (wand->debug != MagickFalse)
9243     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9244   if (wand->images == (Image *) NULL)
9245     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9246   if ((page == (char *) NULL) || (*page == '\0'))
9247     {
9248       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
9249       return(MagickTrue);
9250     }
9251   return(ResetImagePage(wand->images,page));
9252 }
9253 
9254 /*
9255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9256 %                                                                             %
9257 %                                                                             %
9258 %                                                                             %
9259 %   M a g i c k R e s i z e I m a g e                                         %
9260 %                                                                             %
9261 %                                                                             %
9262 %                                                                             %
9263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9264 %
9265 %  MagickResizeImage() scales an image to the desired dimensions with one of
9266 %  these filters:
9267 %
9268 %    Bessel   Blackman   Box
9269 %    Catrom   Cubic      Gaussian
9270 %    Hanning  Hermite    Lanczos
9271 %    Mitchell Point      Quandratic
9272 %    Sinc     Triangle
9273 %
9274 %  Most of the filters are FIR (finite impulse response), however, Bessel,
9275 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
9276 %  are windowed (brought down to zero) with the Blackman filter.
9277 %
9278 %  The format of the MagickResizeImage method is:
9279 %
9280 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
9281 %        const size_t columns,const size_t rows,const FilterType filter)
9282 %
9283 %  A description of each parameter follows:
9284 %
9285 %    o wand: the magick wand.
9286 %
9287 %    o columns: the number of columns in the scaled image.
9288 %
9289 %    o rows: the number of rows in the scaled image.
9290 %
9291 %    o filter: Image filter to use.
9292 %
9293 */
MagickResizeImage(MagickWand * wand,const size_t columns,const size_t rows,const FilterType filter)9294 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
9295   const size_t columns,const size_t rows,const FilterType filter)
9296 {
9297   Image
9298     *resize_image;
9299 
9300   assert(wand != (MagickWand *) NULL);
9301   assert(wand->signature == MagickWandSignature);
9302   if (wand->debug != MagickFalse)
9303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9304   if (wand->images == (Image *) NULL)
9305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9306   resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
9307   if (resize_image == (Image *) NULL)
9308     return(MagickFalse);
9309   ReplaceImageInList(&wand->images,resize_image);
9310   return(MagickTrue);
9311 }
9312 
9313 /*
9314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9315 %                                                                             %
9316 %                                                                             %
9317 %                                                                             %
9318 %   M a g i c k R o l l I m a g e                                             %
9319 %                                                                             %
9320 %                                                                             %
9321 %                                                                             %
9322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9323 %
9324 %  MagickRollImage() offsets an image as defined by x and y.
9325 %
9326 %  The format of the MagickRollImage method is:
9327 %
9328 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
9329 %        const size_t y)
9330 %
9331 %  A description of each parameter follows:
9332 %
9333 %    o wand: the magick wand.
9334 %
9335 %    o x: the x offset.
9336 %
9337 %    o y: the y offset.
9338 %
9339 %
9340 */
MagickRollImage(MagickWand * wand,const ssize_t x,const ssize_t y)9341 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
9342   const ssize_t x,const ssize_t y)
9343 {
9344   Image
9345     *roll_image;
9346 
9347   assert(wand != (MagickWand *) NULL);
9348   assert(wand->signature == MagickWandSignature);
9349   if (wand->debug != MagickFalse)
9350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9351   if (wand->images == (Image *) NULL)
9352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9353   roll_image=RollImage(wand->images,x,y,wand->exception);
9354   if (roll_image == (Image *) NULL)
9355     return(MagickFalse);
9356   ReplaceImageInList(&wand->images,roll_image);
9357   return(MagickTrue);
9358 }
9359 
9360 /*
9361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9362 %                                                                             %
9363 %                                                                             %
9364 %                                                                             %
9365 %   M a g i c k R o t a t e I m a g e                                         %
9366 %                                                                             %
9367 %                                                                             %
9368 %                                                                             %
9369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9370 %
9371 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
9372 %  triangles left over from rotating the image are filled with the
9373 %  background color.
9374 %
9375 %  The format of the MagickRotateImage method is:
9376 %
9377 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
9378 %        const PixelWand *background,const double degrees)
9379 %
9380 %  A description of each parameter follows:
9381 %
9382 %    o wand: the magick wand.
9383 %
9384 %    o background: the background pixel wand.
9385 %
9386 %    o degrees: the number of degrees to rotate the image.
9387 %
9388 %
9389 */
MagickRotateImage(MagickWand * wand,const PixelWand * background,const double degrees)9390 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
9391   const PixelWand *background,const double degrees)
9392 {
9393   Image
9394     *rotate_image;
9395 
9396   assert(wand != (MagickWand *) NULL);
9397   assert(wand->signature == MagickWandSignature);
9398   if (wand->debug != MagickFalse)
9399     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9400   if (wand->images == (Image *) NULL)
9401     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9402   PixelGetQuantumPacket(background,&wand->images->background_color);
9403   rotate_image=RotateImage(wand->images,degrees,wand->exception);
9404   if (rotate_image == (Image *) NULL)
9405     return(MagickFalse);
9406   ReplaceImageInList(&wand->images,rotate_image);
9407   return(MagickTrue);
9408 }
9409 
9410 /*
9411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9412 %                                                                             %
9413 %                                                                             %
9414 %                                                                             %
9415 %   M a g i c k S a m p l e I m a g e                                         %
9416 %                                                                             %
9417 %                                                                             %
9418 %                                                                             %
9419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9420 %
9421 %  MagickSampleImage() scales an image to the desired dimensions with pixel
9422 %  sampling.  Unlike other scaling methods, this method does not introduce
9423 %  any additional color into the scaled image.
9424 %
9425 %  The format of the MagickSampleImage method is:
9426 %
9427 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
9428 %        const size_t columns,const size_t rows)
9429 %
9430 %  A description of each parameter follows:
9431 %
9432 %    o wand: the magick wand.
9433 %
9434 %    o columns: the number of columns in the scaled image.
9435 %
9436 %    o rows: the number of rows in the scaled image.
9437 %
9438 %
9439 */
MagickSampleImage(MagickWand * wand,const size_t columns,const size_t rows)9440 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9441   const size_t columns,const size_t rows)
9442 {
9443   Image
9444     *sample_image;
9445 
9446   assert(wand != (MagickWand *) NULL);
9447   assert(wand->signature == MagickWandSignature);
9448   if (wand->debug != MagickFalse)
9449     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9450   if (wand->images == (Image *) NULL)
9451     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9452   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9453   if (sample_image == (Image *) NULL)
9454     return(MagickFalse);
9455   ReplaceImageInList(&wand->images,sample_image);
9456   return(MagickTrue);
9457 }
9458 
9459 /*
9460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9461 %                                                                             %
9462 %                                                                             %
9463 %                                                                             %
9464 %   M a g i c k S c a l e I m a g e                                           %
9465 %                                                                             %
9466 %                                                                             %
9467 %                                                                             %
9468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9469 %
9470 %  MagickScaleImage() scales the size of an image to the given dimensions.
9471 %
9472 %  The format of the MagickScaleImage method is:
9473 %
9474 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
9475 %        const size_t columns,const size_t rows)
9476 %
9477 %  A description of each parameter follows:
9478 %
9479 %    o wand: the magick wand.
9480 %
9481 %    o columns: the number of columns in the scaled image.
9482 %
9483 %    o rows: the number of rows in the scaled image.
9484 %
9485 %
9486 */
MagickScaleImage(MagickWand * wand,const size_t columns,const size_t rows)9487 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9488   const size_t columns,const size_t rows)
9489 {
9490   Image
9491     *scale_image;
9492 
9493   assert(wand != (MagickWand *) NULL);
9494   assert(wand->signature == MagickWandSignature);
9495   if (wand->debug != MagickFalse)
9496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9497   if (wand->images == (Image *) NULL)
9498     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9499   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9500   if (scale_image == (Image *) NULL)
9501     return(MagickFalse);
9502   ReplaceImageInList(&wand->images,scale_image);
9503   return(MagickTrue);
9504 }
9505 
9506 /*
9507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9508 %                                                                             %
9509 %                                                                             %
9510 %                                                                             %
9511 %   M a g i c k S e g m e n t I m a g e                                       %
9512 %                                                                             %
9513 %                                                                             %
9514 %                                                                             %
9515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9516 %
9517 %  MagickSegmentImage() segments an image by analyzing the histograms of the
9518 %  color components and identifying units that are homogeneous with the fuzzy
9519 %  C-means technique.
9520 %
9521 %  The format of the SegmentImage method is:
9522 %
9523 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
9524 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
9525 %        const double cluster_threshold,const double smooth_threshold)
9526 %
9527 %  A description of each parameter follows.
9528 %
9529 %    o wand: the wand.
9530 %
9531 %    o colorspace: the image colorspace.
9532 %
9533 %    o verbose:  Set to MagickTrue to print detailed information about the
9534 %      identified classes.
9535 %
9536 %    o cluster_threshold:  This represents the minimum number of pixels
9537 %      contained in a hexahedra before it can be considered valid (expressed as
9538 %      a percentage).
9539 %
9540 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
9541 %      derivative of the histogram.  As the value is increased, you can expect a
9542 %      smoother second derivative.
9543 %
9544 */
MagickSegmentImage(MagickWand * wand,const ColorspaceType colorspace,const MagickBooleanType verbose,const double cluster_threshold,const double smooth_threshold)9545 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9546   const ColorspaceType colorspace,const MagickBooleanType verbose,
9547   const double cluster_threshold,const double smooth_threshold)
9548 {
9549   MagickBooleanType
9550     status;
9551 
9552   assert(wand != (MagickWand *) NULL);
9553   assert(wand->signature == MagickWandSignature);
9554   if (wand->debug != MagickFalse)
9555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9556   if (wand->images == (Image *) NULL)
9557     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9558   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9559     smooth_threshold,wand->exception);
9560   return(status);
9561 }
9562 
9563 /*
9564 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9565 %                                                                             %
9566 %                                                                             %
9567 %                                                                             %
9568 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
9569 %                                                                             %
9570 %                                                                             %
9571 %                                                                             %
9572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9573 %
9574 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
9575 %  threshold. It is similar to the unsharpen mask that sharpens everything with
9576 %  contrast above a certain threshold.
9577 %
9578 %  The format of the MagickSelectiveBlurImage method is:
9579 %
9580 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9581 %        const double radius,const double sigma,const double threshold)
9582 %
9583 %  A description of each parameter follows:
9584 %
9585 %    o wand: the magick wand.
9586 %
9587 %    o radius: the radius of the gaussian, in pixels, not counting the center
9588 %      pixel.
9589 %
9590 %    o sigma: the standard deviation of the gaussian, in pixels.
9591 %
9592 %    o threshold: only pixels within this contrast threshold are included
9593 %      in the blur operation.
9594 %
9595 */
MagickSelectiveBlurImage(MagickWand * wand,const double radius,const double sigma,const double threshold)9596 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9597   const double radius,const double sigma,const double threshold)
9598 {
9599   Image
9600     *blur_image;
9601 
9602   assert(wand != (MagickWand *) NULL);
9603   assert(wand->signature == MagickWandSignature);
9604   if (wand->debug != MagickFalse)
9605     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9606   if (wand->images == (Image *) NULL)
9607     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9608   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
9609     wand->exception);
9610   if (blur_image == (Image *) NULL)
9611     return(MagickFalse);
9612   ReplaceImageInList(&wand->images,blur_image);
9613   return(MagickTrue);
9614 }
9615 
9616 /*
9617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9618 %                                                                             %
9619 %                                                                             %
9620 %                                                                             %
9621 %   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                       %
9622 %                                                                             %
9623 %                                                                             %
9624 %                                                                             %
9625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9626 %
9627 %  MagickSeparateImage() separates a channel from the image and returns a
9628 %  grayscale image.  A channel is a particular color component of each pixel
9629 %  in the image.
9630 %
9631 %  The format of the MagickSeparateImage method is:
9632 %
9633 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
9634 %        const ChannelType channel)
9635 %
9636 %  A description of each parameter follows:
9637 %
9638 %    o wand: the magick wand.
9639 %
9640 %    o channel: the channel.
9641 %
9642 */
MagickSeparateImage(MagickWand * wand,const ChannelType channel)9643 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
9644   const ChannelType channel)
9645 {
9646   Image
9647     *separate_image;
9648 
9649   assert(wand != (MagickWand *) NULL);
9650   assert(wand->signature == MagickWandSignature);
9651   if (wand->debug != MagickFalse)
9652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9653   if (wand->images == (Image *) NULL)
9654     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9655   separate_image=SeparateImage(wand->images,channel,wand->exception);
9656   if (separate_image == (Image *) NULL)
9657     return(MagickFalse);
9658   ReplaceImageInList(&wand->images,separate_image);
9659   return(MagickTrue);
9660 }
9661 
9662 /*
9663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9664 %                                                                             %
9665 %                                                                             %
9666 %                                                                             %
9667 %     M a g i c k S e p i a T o n e I m a g e                                 %
9668 %                                                                             %
9669 %                                                                             %
9670 %                                                                             %
9671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9672 %
9673 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
9674 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9675 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9676 %  threshold of 80% is a good starting point for a reasonable tone.
9677 %
9678 %  The format of the MagickSepiaToneImage method is:
9679 %
9680 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9681 %        const double threshold)
9682 %
9683 %  A description of each parameter follows:
9684 %
9685 %    o wand: the magick wand.
9686 %
9687 %    o threshold:  Define the extent of the sepia toning.
9688 %
9689 */
MagickSepiaToneImage(MagickWand * wand,const double threshold)9690 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9691   const double threshold)
9692 {
9693   Image
9694     *sepia_image;
9695 
9696   assert(wand != (MagickWand *) NULL);
9697   assert(wand->signature == MagickWandSignature);
9698   if (wand->debug != MagickFalse)
9699     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9700   if (wand->images == (Image *) NULL)
9701     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9702   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9703   if (sepia_image == (Image *) NULL)
9704     return(MagickFalse);
9705   ReplaceImageInList(&wand->images,sepia_image);
9706   return(MagickTrue);
9707 }
9708 
9709 /*
9710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9711 %                                                                             %
9712 %                                                                             %
9713 %                                                                             %
9714 %   M a g i c k S e t I m a g e                                               %
9715 %                                                                             %
9716 %                                                                             %
9717 %                                                                             %
9718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9719 %
9720 %  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
9721 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
9722 %  wand.
9723 %
9724 %  The format of the MagickSetImage method is:
9725 %
9726 %      MagickBooleanType MagickSetImage(MagickWand *wand,
9727 %        const MagickWand *set_wand)
9728 %
9729 %  A description of each parameter follows:
9730 %
9731 %    o wand: the magick wand.
9732 %
9733 %    o set_wand: the set_wand wand.
9734 %
9735 */
MagickSetImage(MagickWand * wand,const MagickWand * set_wand)9736 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9737   const MagickWand *set_wand)
9738 {
9739   Image
9740     *images;
9741 
9742   assert(wand != (MagickWand *) NULL);
9743   assert(wand->signature == MagickWandSignature);
9744   if (wand->debug != MagickFalse)
9745     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9746   assert(set_wand != (MagickWand *) NULL);
9747   assert(set_wand->signature == MagickWandSignature);
9748   if (wand->debug != MagickFalse)
9749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9750   if (set_wand->images == (Image *) NULL)
9751     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9752   images=CloneImageList(set_wand->images,wand->exception);
9753   if (images == (Image *) NULL)
9754     return(MagickFalse);
9755   ReplaceImageInList(&wand->images,images);
9756   return(MagickTrue);
9757 }
9758 
9759 /*
9760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9761 %                                                                             %
9762 %                                                                             %
9763 %                                                                             %
9764 %   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                       %
9765 %                                                                             %
9766 %                                                                             %
9767 %                                                                             %
9768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9769 %
9770 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9771 %  alpha channel.
9772 %
9773 %  The format of the MagickSetImageAlphaChannel method is:
9774 %
9775 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9776 %        const AlphaChannelOption alpha_type)
9777 %
9778 %  A description of each parameter follows:
9779 %
9780 %    o wand: the magick wand.
9781 %
9782 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9783 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9784 %
9785 */
MagickSetImageAlphaChannel(MagickWand * wand,const AlphaChannelOption alpha_type)9786 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9787   const AlphaChannelOption alpha_type)
9788 {
9789   assert(wand != (MagickWand *) NULL);
9790   assert(wand->signature == MagickWandSignature);
9791   if (wand->debug != MagickFalse)
9792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9793   if (wand->images == (Image *) NULL)
9794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9795   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9796 }
9797 
9798 /*
9799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9800 %                                                                             %
9801 %                                                                             %
9802 %                                                                             %
9803 %   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                 %
9804 %                                                                             %
9805 %                                                                             %
9806 %                                                                             %
9807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9808 %
9809 %  MagickSetImageBackgroundColor() sets the image background color.
9810 %
9811 %  The format of the MagickSetImageBackgroundColor method is:
9812 %
9813 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9814 %        const PixelWand *background)
9815 %
9816 %  A description of each parameter follows:
9817 %
9818 %    o wand: the magick wand.
9819 %
9820 %    o background: the background pixel wand.
9821 %
9822 */
MagickSetImageBackgroundColor(MagickWand * wand,const PixelWand * background)9823 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9824   const PixelWand *background)
9825 {
9826   assert(wand != (MagickWand *) NULL);
9827   assert(wand->signature == MagickWandSignature);
9828   if (wand->debug != MagickFalse)
9829     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9830   if (wand->images == (Image *) NULL)
9831     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9832   PixelGetQuantumPacket(background,&wand->images->background_color);
9833   return(MagickTrue);
9834 }
9835 
9836 /*
9837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9838 %                                                                             %
9839 %                                                                             %
9840 %                                                                             %
9841 %   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                         %
9842 %                                                                             %
9843 %                                                                             %
9844 %                                                                             %
9845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9846 %
9847 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9848 %
9849 %  The format of the MagickSetImageBluePrimary method is:
9850 %
9851 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9852 %        const double x,const double y,const double z)
9853 %
9854 %  A description of each parameter follows:
9855 %
9856 %    o wand: the magick wand.
9857 %
9858 %    o x: the blue primary x-point.
9859 %
9860 %    o y: the blue primary y-point.
9861 %
9862 %    o z: the blue primary z-point.
9863 %
9864 */
MagickSetImageBluePrimary(MagickWand * wand,const double x,const double y,const double z)9865 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9866   const double x,const double y,const double z)
9867 {
9868   assert(wand != (MagickWand *) NULL);
9869   assert(wand->signature == MagickWandSignature);
9870   if (wand->debug != MagickFalse)
9871     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9872   if (wand->images == (Image *) NULL)
9873     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9874   wand->images->chromaticity.blue_primary.x=x;
9875   wand->images->chromaticity.blue_primary.y=y;
9876   wand->images->chromaticity.blue_primary.z=z;
9877   return(MagickTrue);
9878 }
9879 
9880 /*
9881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9882 %                                                                             %
9883 %                                                                             %
9884 %                                                                             %
9885 %   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                         %
9886 %                                                                             %
9887 %                                                                             %
9888 %                                                                             %
9889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9890 %
9891 %  MagickSetImageBorderColor() sets the image border color.
9892 %
9893 %  The format of the MagickSetImageBorderColor method is:
9894 %
9895 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9896 %        const PixelWand *border)
9897 %
9898 %  A description of each parameter follows:
9899 %
9900 %    o wand: the magick wand.
9901 %
9902 %    o border: the border pixel wand.
9903 %
9904 */
MagickSetImageBorderColor(MagickWand * wand,const PixelWand * border)9905 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9906   const PixelWand *border)
9907 {
9908   assert(wand != (MagickWand *) NULL);
9909   assert(wand->signature == MagickWandSignature);
9910   if (wand->debug != MagickFalse)
9911     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9912   if (wand->images == (Image *) NULL)
9913     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9914   PixelGetQuantumPacket(border,&wand->images->border_color);
9915   return(MagickTrue);
9916 }
9917 
9918 /*
9919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9920 %                                                                             %
9921 %                                                                             %
9922 %                                                                             %
9923 %   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                         %
9924 %                                                                             %
9925 %                                                                             %
9926 %                                                                             %
9927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9928 %
9929 %  MagickSetImageChannelMask() sets image channel mask.
9930 %
9931 %  The format of the MagickSetImageChannelMask method is:
9932 %
9933 %      ChannelType MagickSetImageChannelMask(MagickWand *wand,
9934 %        const ChannelType channel_mask)
9935 %
9936 %  A description of each parameter follows:
9937 %
9938 %    o wand: the magick wand.
9939 %
9940 %    o channel_mask: the channel_mask wand.
9941 %
9942 */
MagickSetImageChannelMask(MagickWand * wand,const ChannelType channel_mask)9943 WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9944   const ChannelType channel_mask)
9945 {
9946   assert(wand != (MagickWand *) NULL);
9947   assert(wand->signature == MagickWandSignature);
9948   if (wand->debug != MagickFalse)
9949     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9950   return(SetImageChannelMask(wand->images,channel_mask));
9951 }
9952 
9953 /*
9954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9955 %                                                                             %
9956 %                                                                             %
9957 %                                                                             %
9958 %   M a g i c k S e t I m a g e M a s k                                       %
9959 %                                                                             %
9960 %                                                                             %
9961 %                                                                             %
9962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9963 %
9964 %  MagickSetImageMask() sets image clip mask.
9965 %
9966 %  The format of the MagickSetImageMask method is:
9967 %
9968 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9969 %        const PixelMask type,const MagickWand *clip_mask)
9970 %
9971 %  A description of each parameter follows:
9972 %
9973 %    o wand: the magick wand.
9974 %
9975 %    o type: type of mask, ReadPixelMask or WritePixelMask.
9976 %
9977 %    o clip_mask: the clip_mask wand.
9978 %
9979 */
MagickSetImageMask(MagickWand * wand,const PixelMask type,const MagickWand * clip_mask)9980 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9981   const PixelMask type,const MagickWand *clip_mask)
9982 {
9983   assert(wand != (MagickWand *) NULL);
9984   assert(wand->signature == MagickWandSignature);
9985   if (wand->debug != MagickFalse)
9986     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9987   assert(clip_mask != (MagickWand *) NULL);
9988   assert(clip_mask->signature == MagickWandSignature);
9989   if (clip_mask->debug != MagickFalse)
9990     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9991   if (clip_mask->images == (Image *) NULL)
9992     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9993   return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
9994 }
9995 
9996 /*
9997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9998 %                                                                             %
9999 %                                                                             %
10000 %                                                                             %
10001 %   M a g i c k S e t I m a g e C o l o r                                     %
10002 %                                                                             %
10003 %                                                                             %
10004 %                                                                             %
10005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10006 %
10007 %  MagickSetImageColor() set the entire wand canvas to the specified color.
10008 %
10009 %  The format of the MagickSetImageColor method is:
10010 %
10011 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
10012 %        const PixelWand *color)
10013 %
10014 %  A description of each parameter follows:
10015 %
10016 %    o wand: the magick wand.
10017 %
10018 %    o background: the image color.
10019 %
10020 */
MagickSetImageColor(MagickWand * wand,const PixelWand * color)10021 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
10022   const PixelWand *color)
10023 {
10024   PixelInfo
10025     pixel;
10026 
10027   assert(wand != (MagickWand *) NULL);
10028   assert(wand->signature == MagickWandSignature);
10029   if (wand->debug != MagickFalse)
10030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10031   PixelGetMagickColor(color,&pixel);
10032   return(SetImageColor(wand->images,&pixel,wand->exception));
10033 }
10034 
10035 /*
10036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10037 %                                                                             %
10038 %                                                                             %
10039 %                                                                             %
10040 %   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                     %
10041 %                                                                             %
10042 %                                                                             %
10043 %                                                                             %
10044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10045 %
10046 %  MagickSetImageColormapColor() sets the color of the specified colormap
10047 %  index.
10048 %
10049 %  The format of the MagickSetImageColormapColor method is:
10050 %
10051 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10052 %        const size_t index,const PixelWand *color)
10053 %
10054 %  A description of each parameter follows:
10055 %
10056 %    o wand: the magick wand.
10057 %
10058 %    o index: the offset into the image colormap.
10059 %
10060 %    o color: Return the colormap color in this wand.
10061 %
10062 */
MagickSetImageColormapColor(MagickWand * wand,const size_t index,const PixelWand * color)10063 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10064   const size_t index,const PixelWand *color)
10065 {
10066   assert(wand != (MagickWand *) NULL);
10067   assert(wand->signature == MagickWandSignature);
10068   if (wand->debug != MagickFalse)
10069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10070   if (wand->images == (Image *) NULL)
10071     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10072   if ((wand->images->colormap == (PixelInfo *) NULL) ||
10073       (index >= wand->images->colors))
10074     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
10075   PixelGetQuantumPacket(color,wand->images->colormap+index);
10076   return(SyncImage(wand->images,wand->exception));
10077 }
10078 
10079 /*
10080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10081 %                                                                             %
10082 %                                                                             %
10083 %                                                                             %
10084 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
10085 %                                                                             %
10086 %                                                                             %
10087 %                                                                             %
10088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10089 %
10090 %  MagickSetImageColorspace() sets the image colorspace. But does not modify
10091 %  the image data.
10092 %
10093 %  The format of the MagickSetImageColorspace method is:
10094 %
10095 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10096 %        const ColorspaceType colorspace)
10097 %
10098 %  A description of each parameter follows:
10099 %
10100 %    o wand: the magick wand.
10101 %
10102 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
10103 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
10104 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
10105 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
10106 %      HSLColorspace, or HWBColorspace.
10107 %
10108 */
MagickSetImageColorspace(MagickWand * wand,const ColorspaceType colorspace)10109 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10110   const ColorspaceType colorspace)
10111 {
10112   assert(wand != (MagickWand *) NULL);
10113   assert(wand->signature == MagickWandSignature);
10114   if (wand->debug != MagickFalse)
10115     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10116   if (wand->images == (Image *) NULL)
10117     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10118   return(SetImageColorspace(wand->images,colorspace,wand->exception));
10119 }
10120 
10121 /*
10122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10123 %                                                                             %
10124 %                                                                             %
10125 %                                                                             %
10126 %   M a g i c k S e t I m a g e C o m p o s e                                 %
10127 %                                                                             %
10128 %                                                                             %
10129 %                                                                             %
10130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10131 %
10132 %  MagickSetImageCompose() sets the image composite operator, useful for
10133 %  specifying how to composite the image thumbnail when using the
10134 %  MagickMontageImage() method.
10135 %
10136 %  The format of the MagickSetImageCompose method is:
10137 %
10138 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10139 %        const CompositeOperator compose)
10140 %
10141 %  A description of each parameter follows:
10142 %
10143 %    o wand: the magick wand.
10144 %
10145 %    o compose: the image composite operator.
10146 %
10147 */
MagickSetImageCompose(MagickWand * wand,const CompositeOperator compose)10148 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10149   const CompositeOperator compose)
10150 {
10151   assert(wand != (MagickWand *) NULL);
10152   assert(wand->signature == MagickWandSignature);
10153   if (wand->debug != MagickFalse)
10154     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10155   if (wand->images == (Image *) NULL)
10156     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10157   wand->images->compose=compose;
10158   return(MagickTrue);
10159 }
10160 
10161 /*
10162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10163 %                                                                             %
10164 %                                                                             %
10165 %                                                                             %
10166 %   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                         %
10167 %                                                                             %
10168 %                                                                             %
10169 %                                                                             %
10170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10171 %
10172 %  MagickSetImageCompression() sets the image compression.
10173 %
10174 %  The format of the MagickSetImageCompression method is:
10175 %
10176 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10177 %        const CompressionType compression)
10178 %
10179 %  A description of each parameter follows:
10180 %
10181 %    o wand: the magick wand.
10182 %
10183 %    o compression: the image compression type.
10184 %
10185 */
MagickSetImageCompression(MagickWand * wand,const CompressionType compression)10186 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10187   const CompressionType compression)
10188 {
10189   assert(wand != (MagickWand *) NULL);
10190   assert(wand->signature == MagickWandSignature);
10191   if (wand->debug != MagickFalse)
10192     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10193   if (wand->images == (Image *) NULL)
10194     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10195   wand->images->compression=compression;
10196   return(MagickTrue);
10197 }
10198 
10199 /*
10200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10201 %                                                                             %
10202 %                                                                             %
10203 %                                                                             %
10204 %   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           %
10205 %                                                                             %
10206 %                                                                             %
10207 %                                                                             %
10208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10209 %
10210 %  MagickSetImageCompressionQuality() sets the image compression quality.
10211 %
10212 %  The format of the MagickSetImageCompressionQuality method is:
10213 %
10214 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10215 %        const size_t quality)
10216 %
10217 %  A description of each parameter follows:
10218 %
10219 %    o wand: the magick wand.
10220 %
10221 %    o quality: the image compression tlityype.
10222 %
10223 */
MagickSetImageCompressionQuality(MagickWand * wand,const size_t quality)10224 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10225   const size_t quality)
10226 {
10227   assert(wand != (MagickWand *) NULL);
10228   assert(wand->signature == MagickWandSignature);
10229   if (wand->debug != MagickFalse)
10230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10231   if (wand->images == (Image *) NULL)
10232     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10233   wand->images->quality=quality;
10234   return(MagickTrue);
10235 }
10236 
10237 /*
10238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10239 %                                                                             %
10240 %                                                                             %
10241 %                                                                             %
10242 %   M a g i c k S e t I m a g e D e l a y                                     %
10243 %                                                                             %
10244 %                                                                             %
10245 %                                                                             %
10246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10247 %
10248 %  MagickSetImageDelay() sets the image delay.
10249 %
10250 %  The format of the MagickSetImageDelay method is:
10251 %
10252 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10253 %        const size_t delay)
10254 %
10255 %  A description of each parameter follows:
10256 %
10257 %    o wand: the magick wand.
10258 %
10259 %    o delay: the image delay in ticks-per-second units.
10260 %
10261 */
MagickSetImageDelay(MagickWand * wand,const size_t delay)10262 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10263   const size_t delay)
10264 {
10265   assert(wand != (MagickWand *) NULL);
10266   assert(wand->signature == MagickWandSignature);
10267   if (wand->debug != MagickFalse)
10268     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10269   if (wand->images == (Image *) NULL)
10270     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10271   wand->images->delay=delay;
10272   return(MagickTrue);
10273 }
10274 
10275 /*
10276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10277 %                                                                             %
10278 %                                                                             %
10279 %                                                                             %
10280 %   M a g i c k S e t I m a g e D e p t h                                     %
10281 %                                                                             %
10282 %                                                                             %
10283 %                                                                             %
10284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10285 %
10286 %  MagickSetImageDepth() sets the image depth.
10287 %
10288 %  The format of the MagickSetImageDepth method is:
10289 %
10290 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10291 %        const size_t depth)
10292 %
10293 %  A description of each parameter follows:
10294 %
10295 %    o wand: the magick wand.
10296 %
10297 %    o depth: the image depth in bits: 8, 16, or 32.
10298 %
10299 */
MagickSetImageDepth(MagickWand * wand,const size_t depth)10300 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10301   const size_t depth)
10302 {
10303   assert(wand != (MagickWand *) NULL);
10304   assert(wand->signature == MagickWandSignature);
10305   if (wand->debug != MagickFalse)
10306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10307   if (wand->images == (Image *) NULL)
10308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10309   return(SetImageDepth(wand->images,depth,wand->exception));
10310 }
10311 
10312 /*
10313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10314 %                                                                             %
10315 %                                                                             %
10316 %                                                                             %
10317 %   M a g i c k S e t I m a g e D i s p o s e                                 %
10318 %                                                                             %
10319 %                                                                             %
10320 %                                                                             %
10321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10322 %
10323 %  MagickSetImageDispose() sets the image disposal method.
10324 %
10325 %  The format of the MagickSetImageDispose method is:
10326 %
10327 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10328 %        const DisposeType dispose)
10329 %
10330 %  A description of each parameter follows:
10331 %
10332 %    o wand: the magick wand.
10333 %
10334 %    o dispose: the image disposeal type.
10335 %
10336 */
MagickSetImageDispose(MagickWand * wand,const DisposeType dispose)10337 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10338   const DisposeType dispose)
10339 {
10340   assert(wand != (MagickWand *) NULL);
10341   assert(wand->signature == MagickWandSignature);
10342   if (wand->debug != MagickFalse)
10343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10344   if (wand->images == (Image *) NULL)
10345     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10346   wand->images->dispose=dispose;
10347   return(MagickTrue);
10348 }
10349 
10350 /*
10351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10352 %                                                                             %
10353 %                                                                             %
10354 %                                                                             %
10355 %   M a g i c k S e t I m a g e E n d i a n                                   %
10356 %                                                                             %
10357 %                                                                             %
10358 %                                                                             %
10359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10360 %
10361 %  MagickSetImageEndian() sets the image endian method.
10362 %
10363 %  The format of the MagickSetImageEndian method is:
10364 %
10365 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10366 %        const EndianType endian)
10367 %
10368 %  A description of each parameter follows:
10369 %
10370 %    o wand: the magick wand.
10371 %
10372 %    o endian: the image endian type.
10373 %
10374 */
MagickSetImageEndian(MagickWand * wand,const EndianType endian)10375 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10376   const EndianType endian)
10377 {
10378   assert(wand != (MagickWand *) NULL);
10379   assert(wand->signature == MagickWandSignature);
10380   if (wand->debug != MagickFalse)
10381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10382   if (wand->images == (Image *) NULL)
10383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10384   wand->images->endian=endian;
10385   return(MagickTrue);
10386 }
10387 
10388 /*
10389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10390 %                                                                             %
10391 %                                                                             %
10392 %                                                                             %
10393 %   M a g i c k S e t I m a g e E x t e n t                                   %
10394 %                                                                             %
10395 %                                                                             %
10396 %                                                                             %
10397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10398 %
10399 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
10400 %
10401 %  The format of the MagickSetImageExtent method is:
10402 %
10403 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10404 %        const size_t columns,const unsigned rows)
10405 %
10406 %  A description of each parameter follows:
10407 %
10408 %    o wand: the magick wand.
10409 %
10410 %    o columns:  The image width in pixels.
10411 %
10412 %    o rows:  The image height in pixels.
10413 %
10414 */
MagickSetImageExtent(MagickWand * wand,const size_t columns,const size_t rows)10415 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10416   const size_t columns,const size_t rows)
10417 {
10418   assert(wand != (MagickWand *) NULL);
10419   assert(wand->signature == MagickWandSignature);
10420   if (wand->debug != MagickFalse)
10421     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10422   if (wand->images == (Image *) NULL)
10423     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10424   return(SetImageExtent(wand->images,columns,rows,wand->exception));
10425 }
10426 
10427 /*
10428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10429 %                                                                             %
10430 %                                                                             %
10431 %                                                                             %
10432 %   M a g i c k S e t I m a g e F i l e n a m e                               %
10433 %                                                                             %
10434 %                                                                             %
10435 %                                                                             %
10436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10437 %
10438 %  MagickSetImageFilename() sets the filename of a particular image in a
10439 %  sequence.
10440 %
10441 %  The format of the MagickSetImageFilename method is:
10442 %
10443 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10444 %        const char *filename)
10445 %
10446 %  A description of each parameter follows:
10447 %
10448 %    o wand: the magick wand.
10449 %
10450 %    o filename: the image filename.
10451 %
10452 */
MagickSetImageFilename(MagickWand * wand,const char * filename)10453 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10454   const char *filename)
10455 {
10456   assert(wand != (MagickWand *) NULL);
10457   assert(wand->signature == MagickWandSignature);
10458   if (wand->debug != MagickFalse)
10459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10460   if (wand->images == (Image *) NULL)
10461     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10462   if (filename == (const char *) NULL)
10463     return(MagickFalse);
10464   (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
10465   return(MagickTrue);
10466 }
10467 
10468 /*
10469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10470 %                                                                             %
10471 %                                                                             %
10472 %                                                                             %
10473 %   M a g i c k S e t I m a g e F o r m a t                                   %
10474 %                                                                             %
10475 %                                                                             %
10476 %                                                                             %
10477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10478 %
10479 %  MagickSetImageFormat() sets the format of a particular image in a
10480 %  sequence.
10481 %
10482 %  The format of the MagickSetImageFormat method is:
10483 %
10484 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10485 %        const char *format)
10486 %
10487 %  A description of each parameter follows:
10488 %
10489 %    o wand: the magick wand.
10490 %
10491 %    o format: the image format.
10492 %
10493 */
MagickSetImageFormat(MagickWand * wand,const char * format)10494 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10495   const char *format)
10496 {
10497   const MagickInfo
10498     *magick_info;
10499 
10500   assert(wand != (MagickWand *) NULL);
10501   assert(wand->signature == MagickWandSignature);
10502   if (wand->debug != MagickFalse)
10503     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10504   if (wand->images == (Image *) NULL)
10505     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10506   if ((format == (char *) NULL) || (*format == '\0'))
10507     {
10508       *wand->images->magick='\0';
10509       return(MagickTrue);
10510     }
10511   magick_info=GetMagickInfo(format,wand->exception);
10512   if (magick_info == (const MagickInfo *) NULL)
10513     return(MagickFalse);
10514   ClearMagickException(wand->exception);
10515   (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
10516   return(MagickTrue);
10517 }
10518 
10519 /*
10520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10521 %                                                                             %
10522 %                                                                             %
10523 %                                                                             %
10524 %   M a g i c k S e t I m a g e F u z z                                       %
10525 %                                                                             %
10526 %                                                                             %
10527 %                                                                             %
10528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10529 %
10530 %  MagickSetImageFuzz() sets the image fuzz.
10531 %
10532 %  The format of the MagickSetImageFuzz method is:
10533 %
10534 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10535 %        const double fuzz)
10536 %
10537 %  A description of each parameter follows:
10538 %
10539 %    o wand: the magick wand.
10540 %
10541 %    o fuzz: the image fuzz.
10542 %
10543 */
MagickSetImageFuzz(MagickWand * wand,const double fuzz)10544 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10545   const double fuzz)
10546 {
10547   assert(wand != (MagickWand *) NULL);
10548   assert(wand->signature == MagickWandSignature);
10549   if (wand->debug != MagickFalse)
10550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10551   if (wand->images == (Image *) NULL)
10552     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10553   wand->images->fuzz=fuzz;
10554   return(MagickTrue);
10555 }
10556 
10557 /*
10558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10559 %                                                                             %
10560 %                                                                             %
10561 %                                                                             %
10562 %   M a g i c k S e t I m a g e G a m m a                                     %
10563 %                                                                             %
10564 %                                                                             %
10565 %                                                                             %
10566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10567 %
10568 %  MagickSetImageGamma() sets the image gamma.
10569 %
10570 %  The format of the MagickSetImageGamma method is:
10571 %
10572 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10573 %        const double gamma)
10574 %
10575 %  A description of each parameter follows:
10576 %
10577 %    o wand: the magick wand.
10578 %
10579 %    o gamma: the image gamma.
10580 %
10581 */
MagickSetImageGamma(MagickWand * wand,const double gamma)10582 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10583   const double gamma)
10584 {
10585   assert(wand != (MagickWand *) NULL);
10586   assert(wand->signature == MagickWandSignature);
10587   if (wand->debug != MagickFalse)
10588     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10589   if (wand->images == (Image *) NULL)
10590     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10591   wand->images->gamma=gamma;
10592   return(MagickTrue);
10593 }
10594 
10595 /*
10596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10597 %                                                                             %
10598 %                                                                             %
10599 %                                                                             %
10600 %   M a g i c k S e t I m a g e G r a v i t y                                 %
10601 %                                                                             %
10602 %                                                                             %
10603 %                                                                             %
10604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10605 %
10606 %  MagickSetImageGravity() sets the image gravity type.
10607 %
10608 %  The format of the MagickSetImageGravity method is:
10609 %
10610 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10611 %        const GravityType gravity)
10612 %
10613 %  A description of each parameter follows:
10614 %
10615 %    o wand: the magick wand.
10616 %
10617 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
10618 %               NorthEastGravity, WestGravity, CenterGravity,
10619 %               EastGravity, SouthWestGravity, SouthGravity,
10620 %               SouthEastGravity)
10621 %
10622 */
MagickSetImageGravity(MagickWand * wand,const GravityType gravity)10623 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10624   const GravityType gravity)
10625 {
10626   assert(wand != (MagickWand *) NULL);
10627   assert(wand->signature == MagickWandSignature);
10628   if (wand->debug != MagickFalse)
10629     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10630   if (wand->images == (Image *) NULL)
10631     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10632   wand->images->gravity=gravity;
10633   return(MagickTrue);
10634 }
10635 
10636 /*
10637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10638 %                                                                             %
10639 %                                                                             %
10640 %                                                                             %
10641 %   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                       %
10642 %                                                                             %
10643 %                                                                             %
10644 %                                                                             %
10645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10646 %
10647 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
10648 %  point.
10649 %
10650 %  The format of the MagickSetImageGreenPrimary method is:
10651 %
10652 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10653 %        const double x,const double y,const double z)
10654 %
10655 %  A description of each parameter follows:
10656 %
10657 %    o wand: the magick wand.
10658 %
10659 %    o x: the green primary x-point.
10660 %
10661 %    o y: the green primary y-point.
10662 %
10663 %    o z: the green primary z-point.
10664 %
10665 */
MagickSetImageGreenPrimary(MagickWand * wand,const double x,const double y,const double z)10666 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10667   const double x,const double y,const double z)
10668 {
10669   assert(wand != (MagickWand *) NULL);
10670   assert(wand->signature == MagickWandSignature);
10671   if (wand->debug != MagickFalse)
10672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10673   if (wand->images == (Image *) NULL)
10674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10675   wand->images->chromaticity.green_primary.x=x;
10676   wand->images->chromaticity.green_primary.y=y;
10677   wand->images->chromaticity.green_primary.z=z;
10678   return(MagickTrue);
10679 }
10680 
10681 /*
10682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10683 %                                                                             %
10684 %                                                                             %
10685 %                                                                             %
10686 %   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                 %
10687 %                                                                             %
10688 %                                                                             %
10689 %                                                                             %
10690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10691 %
10692 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10693 %
10694 %  The format of the MagickSetImageInterlaceScheme method is:
10695 %
10696 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10697 %        const InterlaceType interlace)
10698 %
10699 %  A description of each parameter follows:
10700 %
10701 %    o wand: the magick wand.
10702 %
10703 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10704 %      PlaneInterlace, PartitionInterlace.
10705 %
10706 */
MagickSetImageInterlaceScheme(MagickWand * wand,const InterlaceType interlace)10707 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10708   const InterlaceType interlace)
10709 {
10710   assert(wand != (MagickWand *) NULL);
10711   assert(wand->signature == MagickWandSignature);
10712   if (wand->debug != MagickFalse)
10713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10714   if (wand->images == (Image *) NULL)
10715     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10716   wand->images->interlace=interlace;
10717   return(MagickTrue);
10718 }
10719 
10720 /*
10721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10722 %                                                                             %
10723 %                                                                             %
10724 %                                                                             %
10725 %   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             %
10726 %                                                                             %
10727 %                                                                             %
10728 %                                                                             %
10729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10730 %
10731 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10732 %
10733 %  The format of the MagickSetImageInterpolateMethod method is:
10734 %
10735 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10736 %        const PixelInterpolateMethod method)
10737 %
10738 %  A description of each parameter follows:
10739 %
10740 %    o wand: the magick wand.
10741 %
10742 %    o method: the image interpole pixel methods: choose from Undefined,
10743 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10744 %
10745 */
10746 
MagickSetImagePixelInterpolateMethod(MagickWand * wand,const PixelInterpolateMethod method)10747 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
10748   MagickWand *wand,const PixelInterpolateMethod method)
10749 {
10750   return(MagickSetImageInterpolateMethod(wand,method));
10751 }
10752 
MagickSetImageInterpolateMethod(MagickWand * wand,const PixelInterpolateMethod method)10753 WandExport MagickBooleanType MagickSetImageInterpolateMethod(
10754   MagickWand *wand,const PixelInterpolateMethod method)
10755 {
10756   assert(wand != (MagickWand *) NULL);
10757   assert(wand->signature == MagickWandSignature);
10758   if (wand->debug != MagickFalse)
10759     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10760   if (wand->images == (Image *) NULL)
10761     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10762   wand->images->interpolate=method;
10763   return(MagickTrue);
10764 }
10765 
10766 /*
10767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10768 %                                                                             %
10769 %                                                                             %
10770 %                                                                             %
10771 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10772 %                                                                             %
10773 %                                                                             %
10774 %                                                                             %
10775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10776 %
10777 %  MagickSetImageIterations() sets the image iterations.
10778 %
10779 %  The format of the MagickSetImageIterations method is:
10780 %
10781 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10782 %        const size_t iterations)
10783 %
10784 %  A description of each parameter follows:
10785 %
10786 %    o wand: the magick wand.
10787 %
10788 %    o delay: the image delay in 1/100th of a second.
10789 %
10790 */
MagickSetImageIterations(MagickWand * wand,const size_t iterations)10791 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10792   const size_t iterations)
10793 {
10794   assert(wand != (MagickWand *) NULL);
10795   assert(wand->signature == MagickWandSignature);
10796   if (wand->debug != MagickFalse)
10797     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10798   if (wand->images == (Image *) NULL)
10799     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10800   wand->images->iterations=iterations;
10801   return(MagickTrue);
10802 }
10803 
10804 /*
10805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10806 %                                                                             %
10807 %                                                                             %
10808 %                                                                             %
10809 %   M a g i c k S e t I m a g e M a t t e                                     %
10810 %                                                                             %
10811 %                                                                             %
10812 %                                                                             %
10813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10814 %
10815 %  MagickSetImageMatte() sets the image matte channel.
10816 %
10817 %  The format of the MagickSetImageMatte method is:
10818 %
10819 %      MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10820 %        const MagickBooleanType *matte)
10821 %
10822 %  A description of each parameter follows:
10823 %
10824 %    o wand: the magick wand.
10825 %
10826 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10827 %      MagickFalse.
10828 %
10829 */
MagickSetImageMatte(MagickWand * wand,const MagickBooleanType matte)10830 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10831   const MagickBooleanType matte)
10832 {
10833   assert(wand != (MagickWand *) NULL);
10834   assert(wand->signature == MagickWandSignature);
10835   if (wand->debug != MagickFalse)
10836     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10837   if (wand->images == (Image *) NULL)
10838     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10839   if (matte == MagickFalse)
10840     wand->images->alpha_trait=UndefinedPixelTrait;
10841   else
10842     {
10843       if (wand->images->alpha_trait == UndefinedPixelTrait)
10844         (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10845       wand->images->alpha_trait=BlendPixelTrait;
10846     }
10847   return(MagickTrue);
10848 }
10849 
10850 /*
10851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10852 %                                                                             %
10853 %                                                                             %
10854 %                                                                             %
10855 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10856 %                                                                             %
10857 %                                                                             %
10858 %                                                                             %
10859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10860 %
10861 %  MagickSetImageMatteColor() sets the image alpha color.
10862 %
10863 %  The format of the MagickSetImageMatteColor method is:
10864 %
10865 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10866 %        const PixelWand *matte)
10867 %
10868 %  A description of each parameter follows:
10869 %
10870 %    o wand: the magick wand.
10871 %
10872 %    o matte: the alpha pixel wand.
10873 %
10874 */
MagickSetImageMatteColor(MagickWand * wand,const PixelWand * alpha)10875 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10876   const PixelWand *alpha)
10877 {
10878   assert(wand != (MagickWand *)NULL);
10879   assert(wand->signature == MagickWandSignature);
10880   if (wand->debug != MagickFalse)
10881     (void) LogMagickEvent(WandEvent, GetMagickModule(), "%s", wand->name);
10882   if (wand->images == (Image *)NULL)
10883     ThrowWandException(WandError, "ContainsNoImages", wand->name);
10884   PixelGetQuantumPacket(alpha,&wand->images->matte_color);
10885   return(MagickTrue);
10886 }
10887 
10888 /*
10889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10890 %                                                                             %
10891 %                                                                             %
10892 %                                                                             %
10893 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10894 %                                                                             %
10895 %                                                                             %
10896 %                                                                             %
10897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10898 %
10899 %  MagickSetImageAlpha() sets the image to the specified alpha level.
10900 %
10901 %  The format of the MagickSetImageAlpha method is:
10902 %
10903 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10904 %        const double alpha)
10905 %
10906 %  A description of each parameter follows:
10907 %
10908 %    o wand: the magick wand.
10909 %
10910 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10911 %      transparent.
10912 %
10913 */
MagickSetImageAlpha(MagickWand * wand,const double alpha)10914 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10915   const double alpha)
10916 {
10917   MagickBooleanType
10918     status;
10919 
10920   assert(wand != (MagickWand *) NULL);
10921   assert(wand->signature == MagickWandSignature);
10922   if (wand->debug != MagickFalse)
10923     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10924   if (wand->images == (Image *) NULL)
10925     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10926   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10927     wand->exception);
10928   return(status);
10929 }
10930 
10931 /*
10932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10933 %                                                                             %
10934 %                                                                             %
10935 %                                                                             %
10936 %   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                         %
10937 %                                                                             %
10938 %                                                                             %
10939 %                                                                             %
10940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10941 %
10942 %  MagickSetImageOrientation() sets the image orientation.
10943 %
10944 %  The format of the MagickSetImageOrientation method is:
10945 %
10946 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10947 %        const OrientationType orientation)
10948 %
10949 %  A description of each parameter follows:
10950 %
10951 %    o wand: the magick wand.
10952 %
10953 %    o orientation: the image orientation type.
10954 %
10955 */
MagickSetImageOrientation(MagickWand * wand,const OrientationType orientation)10956 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10957   const OrientationType orientation)
10958 {
10959   assert(wand != (MagickWand *) NULL);
10960   assert(wand->signature == MagickWandSignature);
10961   if (wand->debug != MagickFalse)
10962     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10963   if (wand->images == (Image *) NULL)
10964     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10965   wand->images->orientation=orientation;
10966   return(MagickTrue);
10967 }
10968 
10969 /*
10970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10971 %                                                                             %
10972 %                                                                             %
10973 %                                                                             %
10974 %   M a g i c k S e t I m a g e P a g e                                       %
10975 %                                                                             %
10976 %                                                                             %
10977 %                                                                             %
10978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10979 %
10980 %  MagickSetImagePage() sets the page geometry of the image.
10981 %
10982 %  The format of the MagickSetImagePage method is:
10983 %
10984 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
10985 %
10986 %  A description of each parameter follows:
10987 %
10988 %    o wand: the magick wand.
10989 %
10990 %    o width: the page width.
10991 %
10992 %    o height: the page height.
10993 %
10994 %    o x: the page x-offset.
10995 %
10996 %    o y: the page y-offset.
10997 %
10998 */
MagickSetImagePage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)10999 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
11000   const size_t width,const size_t height,const ssize_t x,
11001   const ssize_t y)
11002 {
11003   assert(wand != (MagickWand *) NULL);
11004   assert(wand->signature == MagickWandSignature);
11005   if (wand->debug != MagickFalse)
11006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11007   if (wand->images == (Image *) NULL)
11008     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11009   wand->images->page.width=width;
11010   wand->images->page.height=height;
11011   wand->images->page.x=x;
11012   wand->images->page.y=y;
11013   return(MagickTrue);
11014 }
11015 
11016 /*
11017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11018 %                                                                             %
11019 %                                                                             %
11020 %                                                                             %
11021 %   M a g i c k S e t I m a g e P i x e l C o l o r                           %
11022 %                                                                             %
11023 %                                                                             %
11024 %                                                                             %
11025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11026 %
11027 %  MagickSetImagePixelColor() sets the color of the specified pixel.
11028 %
11029 %  The format of the MagickSetImagePixelColor method is:
11030 %
11031 %      MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11032 %        const ssize_t x,const ssize_t y,const PixelWand *color)
11033 %
11034 %  A description of each parameter follows:
11035 %
11036 %    o wand: the magick wand.
11037 %
11038 %    o x,y: the pixel offset into the image.
11039 %
11040 %    o color: Return the colormap color in this wand.
11041 %
11042 */
MagickSetImagePixelColor(MagickWand * wand,const ssize_t x,const ssize_t y,const PixelWand * color)11043 WandExport MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11044   const ssize_t x,const ssize_t y,const PixelWand *color)
11045 {
11046   Quantum
11047     *q;
11048 
11049   CacheView
11050     *image_view;
11051 
11052   assert(wand != (MagickWand *) NULL);
11053   assert(wand->signature == MagickWandSignature);
11054   if (wand->debug != MagickFalse)
11055     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11056   if (wand->images == (Image *) NULL)
11057     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11058   image_view=AcquireAuthenticCacheView(wand->images,wand->exception);
11059   q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,wand->exception);
11060   if (q == (Quantum *) NULL)
11061     {
11062       image_view=DestroyCacheView(image_view);
11063       return(MagickFalse);
11064     }
11065   PixelGetQuantumPixel(wand->images,color,q);
11066   image_view=DestroyCacheView(image_view);
11067   return(MagickTrue);
11068 }
11069 
11070 /*
11071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11072 %                                                                             %
11073 %                                                                             %
11074 %                                                                             %
11075 %   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                 %
11076 %                                                                             %
11077 %                                                                             %
11078 %                                                                             %
11079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11080 %
11081 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
11082 %  specified method and returns the previous progress monitor if any.  The
11083 %  progress monitor method looks like this:
11084 %
11085 %    MagickBooleanType MagickProgressMonitor(const char *text,
11086 %      const MagickOffsetType offset,const MagickSizeType span,
11087 %      void *client_data)
11088 %
11089 %  If the progress monitor returns MagickFalse, the current operation is
11090 %  interrupted.
11091 %
11092 %  The format of the MagickSetImageProgressMonitor method is:
11093 %
11094 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
11095 %        const MagickProgressMonitor progress_monitor,void *client_data)
11096 %
11097 %  A description of each parameter follows:
11098 %
11099 %    o wand: the magick wand.
11100 %
11101 %    o progress_monitor: Specifies a pointer to a method to monitor progress
11102 %      of an image operation.
11103 %
11104 %    o client_data: Specifies a pointer to any client data.
11105 %
11106 */
MagickSetImageProgressMonitor(MagickWand * wand,const MagickProgressMonitor progress_monitor,void * client_data)11107 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
11108   const MagickProgressMonitor progress_monitor,void *client_data)
11109 {
11110   MagickProgressMonitor
11111     previous_monitor;
11112 
11113   assert(wand != (MagickWand *) NULL);
11114   assert(wand->signature == MagickWandSignature);
11115   if (wand->debug != MagickFalse)
11116     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11117   if (wand->images == (Image *) NULL)
11118     {
11119       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11120         "ContainsNoImages","`%s'",wand->name);
11121       return((MagickProgressMonitor) NULL);
11122     }
11123   previous_monitor=SetImageProgressMonitor(wand->images,
11124     progress_monitor,client_data);
11125   return(previous_monitor);
11126 }
11127 
11128 /*
11129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11130 %                                                                             %
11131 %                                                                             %
11132 %                                                                             %
11133 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
11134 %                                                                             %
11135 %                                                                             %
11136 %                                                                             %
11137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11138 %
11139 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
11140 %
11141 %  The format of the MagickSetImageRedPrimary method is:
11142 %
11143 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11144 %        const double x,const double y,const double z)
11145 %
11146 %  A description of each parameter follows:
11147 %
11148 %    o wand: the magick wand.
11149 %
11150 %    o x: the red primary x-point.
11151 %
11152 %    o y: the red primary y-point.
11153 %
11154 %    o z: the red primary z-point.
11155 %
11156 */
MagickSetImageRedPrimary(MagickWand * wand,const double x,const double y,const double z)11157 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11158   const double x,const double y,const double z)
11159 {
11160   assert(wand != (MagickWand *) NULL);
11161   assert(wand->signature == MagickWandSignature);
11162   if (wand->debug != MagickFalse)
11163     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11164   if (wand->images == (Image *) NULL)
11165     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11166   wand->images->chromaticity.red_primary.x=x;
11167   wand->images->chromaticity.red_primary.y=y;
11168   wand->images->chromaticity.red_primary.z=z;
11169   return(MagickTrue);
11170 }
11171 
11172 /*
11173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11174 %                                                                             %
11175 %                                                                             %
11176 %                                                                             %
11177 %   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                 %
11178 %                                                                             %
11179 %                                                                             %
11180 %                                                                             %
11181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11182 %
11183 %  MagickSetImageRenderingIntent() sets the image rendering intent.
11184 %
11185 %  The format of the MagickSetImageRenderingIntent method is:
11186 %
11187 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11188 %        const RenderingIntent rendering_intent)
11189 %
11190 %  A description of each parameter follows:
11191 %
11192 %    o wand: the magick wand.
11193 %
11194 %    o rendering_intent: the image rendering intent: UndefinedIntent,
11195 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
11196 %
11197 */
MagickSetImageRenderingIntent(MagickWand * wand,const RenderingIntent rendering_intent)11198 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11199   const RenderingIntent rendering_intent)
11200 {
11201   assert(wand != (MagickWand *) NULL);
11202   assert(wand->signature == MagickWandSignature);
11203   if (wand->debug != MagickFalse)
11204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11205   if (wand->images == (Image *) NULL)
11206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11207   wand->images->rendering_intent=rendering_intent;
11208   return(MagickTrue);
11209 }
11210 
11211 /*
11212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11213 %                                                                             %
11214 %                                                                             %
11215 %                                                                             %
11216 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
11217 %                                                                             %
11218 %                                                                             %
11219 %                                                                             %
11220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11221 %
11222 %  MagickSetImageResolution() sets the image resolution.
11223 %
11224 %  The format of the MagickSetImageResolution method is:
11225 %
11226 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11227 %        const double x_resolution,const double y_resolution)
11228 %
11229 %  A description of each parameter follows:
11230 %
11231 %    o wand: the magick wand.
11232 %
11233 %    o x_resolution: the image x resolution.
11234 %
11235 %    o y_resolution: the image y resolution.
11236 %
11237 */
MagickSetImageResolution(MagickWand * wand,const double x_resolution,const double y_resolution)11238 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11239   const double x_resolution,const double y_resolution)
11240 {
11241   assert(wand != (MagickWand *) NULL);
11242   assert(wand->signature == MagickWandSignature);
11243   if (wand->debug != MagickFalse)
11244     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11245   if (wand->images == (Image *) NULL)
11246     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11247   wand->images->resolution.x=x_resolution;
11248   wand->images->resolution.y=y_resolution;
11249   return(MagickTrue);
11250 }
11251 
11252 /*
11253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11254 %                                                                             %
11255 %                                                                             %
11256 %                                                                             %
11257 %   M a g i c k S e t I m a g e S c e n e                                     %
11258 %                                                                             %
11259 %                                                                             %
11260 %                                                                             %
11261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11262 %
11263 %  MagickSetImageScene() sets the image scene.
11264 %
11265 %  The format of the MagickSetImageScene method is:
11266 %
11267 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
11268 %        const size_t scene)
11269 %
11270 %  A description of each parameter follows:
11271 %
11272 %    o wand: the magick wand.
11273 %
11274 %    o delay: the image scene number.
11275 %
11276 */
MagickSetImageScene(MagickWand * wand,const size_t scene)11277 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
11278   const size_t scene)
11279 {
11280   assert(wand != (MagickWand *) NULL);
11281   assert(wand->signature == MagickWandSignature);
11282   if (wand->debug != MagickFalse)
11283     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11284   if (wand->images == (Image *) NULL)
11285     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11286   wand->images->scene=scene;
11287   return(MagickTrue);
11288 }
11289 
11290 /*
11291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11292 %                                                                             %
11293 %                                                                             %
11294 %                                                                             %
11295 %   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                   %
11296 %                                                                             %
11297 %                                                                             %
11298 %                                                                             %
11299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11300 %
11301 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
11302 %
11303 %  The format of the MagickSetImageTicksPerSecond method is:
11304 %
11305 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11306 %        const ssize_t ticks_per-second)
11307 %
11308 %  A description of each parameter follows:
11309 %
11310 %    o wand: the magick wand.
11311 %
11312 %    o ticks_per_second: the units to use for the image delay.
11313 %
11314 */
MagickSetImageTicksPerSecond(MagickWand * wand,const ssize_t ticks_per_second)11315 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11316   const ssize_t ticks_per_second)
11317 {
11318   assert(wand != (MagickWand *) NULL);
11319   assert(wand->signature == MagickWandSignature);
11320   if (wand->debug != MagickFalse)
11321     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11322   if (wand->images == (Image *) NULL)
11323     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11324   wand->images->ticks_per_second=ticks_per_second;
11325   return(MagickTrue);
11326 }
11327 
11328 /*
11329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11330 %                                                                             %
11331 %                                                                             %
11332 %                                                                             %
11333 %   M a g i c k S e t I m a g e T y p e                                       %
11334 %                                                                             %
11335 %                                                                             %
11336 %                                                                             %
11337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11338 %
11339 %  MagickSetImageType() sets the image type.
11340 %
11341 %  The format of the MagickSetImageType method is:
11342 %
11343 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
11344 %        const ImageType image_type)
11345 %
11346 %  A description of each parameter follows:
11347 %
11348 %    o wand: the magick wand.
11349 %
11350 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
11351 %      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
11352 %      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
11353 %      or OptimizeType.
11354 %
11355 */
MagickSetImageType(MagickWand * wand,const ImageType image_type)11356 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
11357   const ImageType image_type)
11358 {
11359   assert(wand != (MagickWand *) NULL);
11360   assert(wand->signature == MagickWandSignature);
11361   if (wand->debug != MagickFalse)
11362     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11363   if (wand->images == (Image *) NULL)
11364     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11365   return(SetImageType(wand->images,image_type,wand->exception));
11366 }
11367 
11368 /*
11369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11370 %                                                                             %
11371 %                                                                             %
11372 %                                                                             %
11373 %   M a g i c k S e t I m a g e U n i t s                                     %
11374 %                                                                             %
11375 %                                                                             %
11376 %                                                                             %
11377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11378 %
11379 %  MagickSetImageUnits() sets the image units of resolution.
11380 %
11381 %  The format of the MagickSetImageUnits method is:
11382 %
11383 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11384 %        const ResolutionType units)
11385 %
11386 %  A description of each parameter follows:
11387 %
11388 %    o wand: the magick wand.
11389 %
11390 %    o units: the image units of resolution : UndefinedResolution,
11391 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
11392 %
11393 */
MagickSetImageUnits(MagickWand * wand,const ResolutionType units)11394 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11395   const ResolutionType units)
11396 {
11397   assert(wand != (MagickWand *) NULL);
11398   assert(wand->signature == MagickWandSignature);
11399   if (wand->debug != MagickFalse)
11400     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11401   if (wand->images == (Image *) NULL)
11402     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11403   wand->images->units=units;
11404   return(MagickTrue);
11405 }
11406 
11407 /*
11408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11409 %                                                                             %
11410 %                                                                             %
11411 %                                                                             %
11412 %   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           %
11413 %                                                                             %
11414 %                                                                             %
11415 %                                                                             %
11416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11417 %
11418 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
11419 %
11420 %  The format of the MagickSetImageVirtualPixelMethod method is:
11421 %
11422 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11423 %        const VirtualPixelMethod method)
11424 %
11425 %  A description of each parameter follows:
11426 %
11427 %    o wand: the magick wand.
11428 %
11429 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
11430 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
11431 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
11432 %
11433 */
MagickSetImageVirtualPixelMethod(MagickWand * wand,const VirtualPixelMethod method)11434 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11435   const VirtualPixelMethod method)
11436 {
11437   assert(wand != (MagickWand *) NULL);
11438   assert(wand->signature == MagickWandSignature);
11439   if (wand->debug != MagickFalse)
11440     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11441   if (wand->images == (Image *) NULL)
11442     return(UndefinedVirtualPixelMethod);
11443   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
11444 }
11445 
11446 /*
11447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11448 %                                                                             %
11449 %                                                                             %
11450 %                                                                             %
11451 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
11452 %                                                                             %
11453 %                                                                             %
11454 %                                                                             %
11455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11456 %
11457 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
11458 %
11459 %  The format of the MagickSetImageWhitePoint method is:
11460 %
11461 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11462 %        const double x,const double y,const double z)
11463 %
11464 %  A description of each parameter follows:
11465 %
11466 %    o wand: the magick wand.
11467 %
11468 %    o x: the white x-point.
11469 %
11470 %    o y: the white y-point.
11471 %
11472 %    o z: the white z-point.
11473 %
11474 */
MagickSetImageWhitePoint(MagickWand * wand,const double x,const double y,const double z)11475 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11476   const double x,const double y,const double z)
11477 {
11478   assert(wand != (MagickWand *) NULL);
11479   assert(wand->signature == MagickWandSignature);
11480   if (wand->debug != MagickFalse)
11481     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11482   if (wand->images == (Image *) NULL)
11483     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11484   wand->images->chromaticity.white_point.x=x;
11485   wand->images->chromaticity.white_point.y=y;
11486   wand->images->chromaticity.white_point.z=z;
11487   return(MagickTrue);
11488 }
11489 
11490 /*
11491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11492 %                                                                             %
11493 %                                                                             %
11494 %                                                                             %
11495 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
11496 %                                                                             %
11497 %                                                                             %
11498 %                                                                             %
11499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11500 %
11501 %  MagickShadeImage() shines a distant light on an image to create a
11502 %  three-dimensional effect. You control the positioning of the light with
11503 %  azimuth and elevation; azimuth is measured in degrees off the x axis
11504 %  and elevation is measured in pixels above the Z axis.
11505 %
11506 %  The format of the MagickShadeImage method is:
11507 %
11508 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
11509 %        const MagickBooleanType gray,const double azimuth,
11510 %        const double elevation)
11511 %
11512 %  A description of each parameter follows:
11513 %
11514 %    o wand: the magick wand.
11515 %
11516 %    o gray: A value other than zero shades the intensity of each pixel.
11517 %
11518 %    o azimuth, elevation:  Define the light source direction.
11519 %
11520 */
MagickShadeImage(MagickWand * wand,const MagickBooleanType gray,const double asimuth,const double elevation)11521 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11522   const MagickBooleanType gray,const double asimuth,const double elevation)
11523 {
11524   Image
11525     *shade_image;
11526 
11527   assert(wand != (MagickWand *) NULL);
11528   assert(wand->signature == MagickWandSignature);
11529   if (wand->debug != MagickFalse)
11530     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11531   if (wand->images == (Image *) NULL)
11532     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11533   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
11534   if (shade_image == (Image *) NULL)
11535     return(MagickFalse);
11536   ReplaceImageInList(&wand->images,shade_image);
11537   return(MagickTrue);
11538 }
11539 
11540 /*
11541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11542 %                                                                             %
11543 %                                                                             %
11544 %                                                                             %
11545 %   M a g i c k S h a d o w I m a g e                                         %
11546 %                                                                             %
11547 %                                                                             %
11548 %                                                                             %
11549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11550 %
11551 %  MagickShadowImage() simulates an image shadow.
11552 %
11553 %  The format of the MagickShadowImage method is:
11554 %
11555 %      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
11556 %        const double sigma,const ssize_t x,const ssize_t y)
11557 %
11558 %  A description of each parameter follows:
11559 %
11560 %    o wand: the magick wand.
11561 %
11562 %    o alpha: percentage transparency.
11563 %
11564 %    o sigma: the standard deviation of the Gaussian, in pixels.
11565 %
11566 %    o x: the shadow x-offset.
11567 %
11568 %    o y: the shadow y-offset.
11569 %
11570 */
MagickShadowImage(MagickWand * wand,const double alpha,const double sigma,const ssize_t x,const ssize_t y)11571 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11572   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
11573 {
11574   Image
11575     *shadow_image;
11576 
11577   assert(wand != (MagickWand *) NULL);
11578   assert(wand->signature == MagickWandSignature);
11579   if (wand->debug != MagickFalse)
11580     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11581   if (wand->images == (Image *) NULL)
11582     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11583   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
11584   if (shadow_image == (Image *) NULL)
11585     return(MagickFalse);
11586   ReplaceImageInList(&wand->images,shadow_image);
11587   return(MagickTrue);
11588 }
11589 
11590 /*
11591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11592 %                                                                             %
11593 %                                                                             %
11594 %                                                                             %
11595 %   M a g i c k S h a r p e n I m a g e                                       %
11596 %                                                                             %
11597 %                                                                             %
11598 %                                                                             %
11599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11600 %
11601 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
11602 %  Gaussian operator of the given radius and standard deviation (sigma).
11603 %  For reasonable results, the radius should be larger than sigma.  Use a
11604 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11605 %
11606 %  The format of the MagickSharpenImage method is:
11607 %
11608 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
11609 %        const double radius,const double sigma)
11610 %
11611 %  A description of each parameter follows:
11612 %
11613 %    o wand: the magick wand.
11614 %
11615 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11616 %      pixel.
11617 %
11618 %    o sigma: the standard deviation of the Gaussian, in pixels.
11619 %
11620 */
MagickSharpenImage(MagickWand * wand,const double radius,const double sigma)11621 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11622   const double radius,const double sigma)
11623 {
11624   Image
11625     *sharp_image;
11626 
11627   assert(wand != (MagickWand *) NULL);
11628   assert(wand->signature == MagickWandSignature);
11629   if (wand->debug != MagickFalse)
11630     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11631   if (wand->images == (Image *) NULL)
11632     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11633   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
11634   if (sharp_image == (Image *) NULL)
11635     return(MagickFalse);
11636   ReplaceImageInList(&wand->images,sharp_image);
11637   return(MagickTrue);
11638 }
11639 
11640 /*
11641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11642 %                                                                             %
11643 %                                                                             %
11644 %                                                                             %
11645 %   M a g i c k S h a v e I m a g e                                           %
11646 %                                                                             %
11647 %                                                                             %
11648 %                                                                             %
11649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11650 %
11651 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
11652 %  memory necessary for the new Image structure and returns a pointer to the
11653 %  new image.
11654 %
11655 %  The format of the MagickShaveImage method is:
11656 %
11657 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
11658 %        const size_t columns,const size_t rows)
11659 %
11660 %  A description of each parameter follows:
11661 %
11662 %    o wand: the magick wand.
11663 %
11664 %    o columns: the number of columns in the scaled image.
11665 %
11666 %    o rows: the number of rows in the scaled image.
11667 %
11668 %
11669 */
MagickShaveImage(MagickWand * wand,const size_t columns,const size_t rows)11670 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11671   const size_t columns,const size_t rows)
11672 {
11673   Image
11674     *shave_image;
11675 
11676   RectangleInfo
11677     shave_info;
11678 
11679   assert(wand != (MagickWand *) NULL);
11680   assert(wand->signature == MagickWandSignature);
11681   if (wand->debug != MagickFalse)
11682     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11683   if (wand->images == (Image *) NULL)
11684     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11685   shave_info.width=columns;
11686   shave_info.height=rows;
11687   shave_info.x=0;
11688   shave_info.y=0;
11689   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11690   if (shave_image == (Image *) NULL)
11691     return(MagickFalse);
11692   ReplaceImageInList(&wand->images,shave_image);
11693   return(MagickTrue);
11694 }
11695 
11696 /*
11697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11698 %                                                                             %
11699 %                                                                             %
11700 %                                                                             %
11701 %   M a g i c k S h e a r I m a g e                                           %
11702 %                                                                             %
11703 %                                                                             %
11704 %                                                                             %
11705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11706 %
11707 %  MagickShearImage() slides one edge of an image along the X or Y axis,
11708 %  creating a parallelogram.  An X direction shear slides an edge along the X
11709 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
11710 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
11711 %  is measured relative to the Y axis, and similarly, for Y direction shears
11712 %  y_shear is measured relative to the X axis.  Empty triangles left over from
11713 %  shearing the image are filled with the background color.
11714 %
11715 %  The format of the MagickShearImage method is:
11716 %
11717 %      MagickBooleanType MagickShearImage(MagickWand *wand,
11718 %        const PixelWand *background,const double x_shear,const double y_shear)
11719 %
11720 %  A description of each parameter follows:
11721 %
11722 %    o wand: the magick wand.
11723 %
11724 %    o background: the background pixel wand.
11725 %
11726 %    o x_shear: the number of degrees to shear the image.
11727 %
11728 %    o y_shear: the number of degrees to shear the image.
11729 %
11730 */
MagickShearImage(MagickWand * wand,const PixelWand * background,const double x_shear,const double y_shear)11731 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11732   const PixelWand *background,const double x_shear,const double y_shear)
11733 {
11734   Image
11735     *shear_image;
11736 
11737   assert(wand != (MagickWand *) NULL);
11738   assert(wand->signature == MagickWandSignature);
11739   if (wand->debug != MagickFalse)
11740     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11741   if (wand->images == (Image *) NULL)
11742     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11743   PixelGetQuantumPacket(background,&wand->images->background_color);
11744   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11745   if (shear_image == (Image *) NULL)
11746     return(MagickFalse);
11747   ReplaceImageInList(&wand->images,shear_image);
11748   return(MagickTrue);
11749 }
11750 
11751 /*
11752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11753 %                                                                             %
11754 %                                                                             %
11755 %                                                                             %
11756 %   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                   %
11757 %                                                                             %
11758 %                                                                             %
11759 %                                                                             %
11760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11761 %
11762 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11763 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11764 %  image using a sigmoidal transfer function without saturating highlights or
11765 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11766 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11767 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11768 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11769 %  is reduced.
11770 %
11771 %  The format of the MagickSigmoidalContrastImage method is:
11772 %
11773 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11774 %        const MagickBooleanType sharpen,const double alpha,const double beta)
11775 %
11776 %  A description of each parameter follows:
11777 %
11778 %    o wand: the magick wand.
11779 %
11780 %    o sharpen: Increase or decrease image contrast.
11781 %
11782 %    o alpha: strength of the contrast, the larger the number the more
11783 %      'threshold-like' it becomes.
11784 %
11785 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
11786 %
11787 */
MagickSigmoidalContrastImage(MagickWand * wand,const MagickBooleanType sharpen,const double alpha,const double beta)11788 WandExport MagickBooleanType MagickSigmoidalContrastImage(
11789   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
11790   const double beta)
11791 {
11792   MagickBooleanType
11793     status;
11794 
11795   assert(wand != (MagickWand *) NULL);
11796   assert(wand->signature == MagickWandSignature);
11797   if (wand->debug != MagickFalse)
11798     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11799   if (wand->images == (Image *) NULL)
11800     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11801   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
11802     wand->exception);
11803   return(status);
11804 }
11805 
11806 /*
11807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11808 %                                                                             %
11809 %                                                                             %
11810 %                                                                             %
11811 %   M a g i c k S i m i l a r i t y I m a g e                                 %
11812 %                                                                             %
11813 %                                                                             %
11814 %                                                                             %
11815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11816 %
11817 %  MagickSimilarityImage() compares the reference image of the image and
11818 %  returns the best match offset.  In addition, it returns a similarity image
11819 %  such that an exact match location is completely white and if none of the
11820 %  pixels match, black, otherwise some gray level in-between.
11821 %
11822 %  The format of the MagickSimilarityImage method is:
11823 %
11824 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
11825 %        const MagickWand *reference,const MetricType metric,
11826 %        const double similarity_threshold,RectangeInfo *offset,
11827 %        double *similarity)
11828 %
11829 %  A description of each parameter follows:
11830 %
11831 %    o wand: the magick wand.
11832 %
11833 %    o reference: the reference wand.
11834 %
11835 %    o metric: the metric.
11836 %
11837 %    o similarity_threshold: minimum distortion for (sub)image match.
11838 %
11839 %    o offset: the best match offset of the reference image within the image.
11840 %
11841 %    o similarity: the computed similarity between the images.
11842 %
11843 */
MagickSimilarityImage(MagickWand * wand,const MagickWand * reference,const MetricType metric,const double similarity_threshold,RectangleInfo * offset,double * similarity)11844 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11845   const MagickWand *reference,const MetricType metric,
11846   const double similarity_threshold,RectangleInfo *offset,double *similarity)
11847 {
11848   Image
11849     *similarity_image;
11850 
11851   assert(wand != (MagickWand *) NULL);
11852   assert(wand->signature == MagickWandSignature);
11853   if (wand->debug != MagickFalse)
11854     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11855   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11856     {
11857       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11858         "ContainsNoImages","`%s'",wand->name);
11859       return((MagickWand *) NULL);
11860     }
11861   similarity_image=SimilarityImage(wand->images,reference->images,metric,
11862     similarity_threshold,offset,similarity,wand->exception);
11863   if (similarity_image == (Image *) NULL)
11864     return((MagickWand *) NULL);
11865   return(CloneMagickWandFromImages(wand,similarity_image));
11866 }
11867 
11868 /*
11869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11870 %                                                                             %
11871 %                                                                             %
11872 %                                                                             %
11873 %   M a g i c k S k e t c h I m a g e                                         %
11874 %                                                                             %
11875 %                                                                             %
11876 %                                                                             %
11877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11878 %
11879 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11880 %  a Gaussian operator of the given radius and standard deviation (sigma).
11881 %  For reasonable results, radius should be larger than sigma.  Use a
11882 %  radius of 0 and SketchImage() selects a suitable radius for you.
11883 %  Angle gives the angle of the blurring motion.
11884 %
11885 %  The format of the MagickSketchImage method is:
11886 %
11887 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11888 %        const double radius,const double sigma,const double angle)
11889 %
11890 %  A description of each parameter follows:
11891 %
11892 %    o wand: the magick wand.
11893 %
11894 %    o radius: the radius of the Gaussian, in pixels, not counting
11895 %      the center pixel.
11896 %
11897 %    o sigma: the standard deviation of the Gaussian, in pixels.
11898 %
11899 %    o angle: apply the effect along this angle.
11900 %
11901 */
MagickSketchImage(MagickWand * wand,const double radius,const double sigma,const double angle)11902 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11903   const double radius,const double sigma,const double angle)
11904 {
11905   Image
11906     *sketch_image;
11907 
11908   assert(wand != (MagickWand *) NULL);
11909   assert(wand->signature == MagickWandSignature);
11910   if (wand->debug != MagickFalse)
11911     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11912   if (wand->images == (Image *) NULL)
11913     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11914   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11915   if (sketch_image == (Image *) NULL)
11916     return(MagickFalse);
11917   ReplaceImageInList(&wand->images,sketch_image);
11918   return(MagickTrue);
11919 }
11920 
11921 /*
11922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11923 %                                                                             %
11924 %                                                                             %
11925 %                                                                             %
11926 %   M a g i c k S m u s h I m a g e s                                         %
11927 %                                                                             %
11928 %                                                                             %
11929 %                                                                             %
11930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11931 %
11932 %  MagickSmushImages() takes all images from the current image pointer to the
11933 %  end of the image list and smushs them to each other top-to-bottom if the
11934 %  stack parameter is true, otherwise left-to-right.
11935 %
11936 %  The format of the MagickSmushImages method is:
11937 %
11938 %      MagickWand *MagickSmushImages(MagickWand *wand,
11939 %        const MagickBooleanType stack,const ssize_t offset)
11940 %
11941 %  A description of each parameter follows:
11942 %
11943 %    o wand: the magick wand.
11944 %
11945 %    o stack: By default, images are stacked left-to-right. Set stack to
11946 %      MagickTrue to stack them top-to-bottom.
11947 %
11948 %    o offset: minimum distance in pixels between images.
11949 %
11950 */
MagickSmushImages(MagickWand * wand,const MagickBooleanType stack,const ssize_t offset)11951 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11952   const MagickBooleanType stack,const ssize_t offset)
11953 {
11954   Image
11955     *smush_image;
11956 
11957   assert(wand != (MagickWand *) NULL);
11958   assert(wand->signature == MagickWandSignature);
11959   if (wand->debug != MagickFalse)
11960     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11961   if (wand->images == (Image *) NULL)
11962     return((MagickWand *) NULL);
11963   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11964   if (smush_image == (Image *) NULL)
11965     return((MagickWand *) NULL);
11966   return(CloneMagickWandFromImages(wand,smush_image));
11967 }
11968 
11969 /*
11970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11971 %                                                                             %
11972 %                                                                             %
11973 %                                                                             %
11974 %     M a g i c k S o l a r i z e I m a g e                                   %
11975 %                                                                             %
11976 %                                                                             %
11977 %                                                                             %
11978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11979 %
11980 %  MagickSolarizeImage() applies a special effect to the image, similar to the
11981 %  effect achieved in a photo darkroom by selectively exposing areas of photo
11982 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11983 %  measure of the extent of the solarization.
11984 %
11985 %  The format of the MagickSolarizeImage method is:
11986 %
11987 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11988 %        const double threshold)
11989 %
11990 %  A description of each parameter follows:
11991 %
11992 %    o wand: the magick wand.
11993 %
11994 %    o threshold:  Define the extent of the solarization.
11995 %
11996 */
MagickSolarizeImage(MagickWand * wand,const double threshold)11997 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11998   const double threshold)
11999 {
12000   MagickBooleanType
12001     status;
12002 
12003   assert(wand != (MagickWand *) NULL);
12004   assert(wand->signature == MagickWandSignature);
12005   if (wand->debug != MagickFalse)
12006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12007   if (wand->images == (Image *) NULL)
12008     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12009   status=SolarizeImage(wand->images,threshold,wand->exception);
12010   return(status);
12011 }
12012 
12013 /*
12014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12015 %                                                                             %
12016 %                                                                             %
12017 %                                                                             %
12018 %   M a g i c k S p a r s e C o l o r I m a g e                               %
12019 %                                                                             %
12020 %                                                                             %
12021 %                                                                             %
12022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12023 %
12024 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
12025 %  colors found at those coordinates, across the whole image, using various
12026 %  methods.
12027 %
12028 %  The format of the MagickSparseColorImage method is:
12029 %
12030 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12031 %        const SparseColorMethod method,const size_t number_arguments,
12032 %        const double *arguments)
12033 %
12034 %  A description of each parameter follows:
12035 %
12036 %    o image: the image to be sparseed.
12037 %
12038 %    o method: the method of image sparseion.
12039 %
12040 %        ArcSparseColorion will always ignore source image offset, and always
12041 %        'bestfit' the destination image with the top left corner offset
12042 %        relative to the polar mapping center.
12043 %
12044 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
12045 %        style of image sparseion.
12046 %
12047 %        Affine, Perspective, and Bilinear, will do least squares fitting of
12048 %        the distrotion when more than the minimum number of control point
12049 %        pairs are provided.
12050 %
12051 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
12052 %        less than 4 control point pairs are provided. While Affine sparseions
12053 %        will let you use any number of control point pairs, that is Zero pairs
12054 %        is a No-Op (viewport only) distrotion, one pair is a translation and
12055 %        two pairs of control points will do a scale-rotate-translate, without
12056 %        any shearing.
12057 %
12058 %    o number_arguments: the number of arguments given for this sparseion
12059 %      method.
12060 %
12061 %    o arguments: the arguments for this sparseion method.
12062 %
12063 */
MagickSparseColorImage(MagickWand * wand,const SparseColorMethod method,const size_t number_arguments,const double * arguments)12064 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12065   const SparseColorMethod method,const size_t number_arguments,
12066   const double *arguments)
12067 {
12068   Image
12069     *sparse_image;
12070 
12071   assert(wand != (MagickWand *) NULL);
12072   assert(wand->signature == MagickWandSignature);
12073   if (wand->debug != MagickFalse)
12074     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12075   if (wand->images == (Image *) NULL)
12076     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12077   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
12078     wand->exception);
12079   if (sparse_image == (Image *) NULL)
12080     return(MagickFalse);
12081   ReplaceImageInList(&wand->images,sparse_image);
12082   return(MagickTrue);
12083 }
12084 
12085 /*
12086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12087 %                                                                             %
12088 %                                                                             %
12089 %                                                                             %
12090 %   M a g i c k S p l i c e I m a g e                                         %
12091 %                                                                             %
12092 %                                                                             %
12093 %                                                                             %
12094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12095 %
12096 %  MagickSpliceImage() splices a solid color into the image.
12097 %
12098 %  The format of the MagickSpliceImage method is:
12099 %
12100 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
12101 %        const size_t width,const size_t height,const ssize_t x,
12102 %        const ssize_t y)
12103 %
12104 %  A description of each parameter follows:
12105 %
12106 %    o wand: the magick wand.
12107 %
12108 %    o width: the region width.
12109 %
12110 %    o height: the region height.
12111 %
12112 %    o x: the region x offset.
12113 %
12114 %    o y: the region y offset.
12115 %
12116 */
MagickSpliceImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)12117 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
12118   const size_t width,const size_t height,const ssize_t x,
12119   const ssize_t y)
12120 {
12121   Image
12122     *splice_image;
12123 
12124   RectangleInfo
12125     splice;
12126 
12127   assert(wand != (MagickWand *) NULL);
12128   assert(wand->signature == MagickWandSignature);
12129   if (wand->debug != MagickFalse)
12130     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12131   if (wand->images == (Image *) NULL)
12132     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12133   splice.width=width;
12134   splice.height=height;
12135   splice.x=x;
12136   splice.y=y;
12137   splice_image=SpliceImage(wand->images,&splice,wand->exception);
12138   if (splice_image == (Image *) NULL)
12139     return(MagickFalse);
12140   ReplaceImageInList(&wand->images,splice_image);
12141   return(MagickTrue);
12142 }
12143 
12144 /*
12145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12146 %                                                                             %
12147 %                                                                             %
12148 %                                                                             %
12149 %   M a g i c k S p r e a d I m a g e                                         %
12150 %                                                                             %
12151 %                                                                             %
12152 %                                                                             %
12153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12154 %
12155 %  MagickSpreadImage() is a special effects method that randomly displaces each
12156 %  pixel in a block defined by the radius parameter.
12157 %
12158 %  The format of the MagickSpreadImage method is:
12159 %
12160 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,
12161 %        const PixelInterpolateMethod method,const double radius)
12162 %
12163 %  A description of each parameter follows:
12164 %
12165 %    o wand: the magick wand.
12166 %
12167 %    o method:  intepolation method.
12168 %
12169 %    o radius:  Choose a random pixel in a neighborhood of this extent.
12170 %
12171 */
MagickSpreadImage(MagickWand * wand,const PixelInterpolateMethod method,const double radius)12172 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
12173   const PixelInterpolateMethod method,const double radius)
12174 {
12175   Image
12176     *spread_image;
12177 
12178   assert(wand != (MagickWand *) NULL);
12179   assert(wand->signature == MagickWandSignature);
12180   if (wand->debug != MagickFalse)
12181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12182   if (wand->images == (Image *) NULL)
12183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12184   spread_image=SpreadImage(wand->images,method,radius,wand->exception);
12185   if (spread_image == (Image *) NULL)
12186     return(MagickFalse);
12187   ReplaceImageInList(&wand->images,spread_image);
12188   return(MagickTrue);
12189 }
12190 
12191 /*
12192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12193 %                                                                             %
12194 %                                                                             %
12195 %                                                                             %
12196 %   M a g i c k S t a t i s t i c I m a g e                                   %
12197 %                                                                             %
12198 %                                                                             %
12199 %                                                                             %
12200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12201 %
12202 %  MagickStatisticImage() replace each pixel with corresponding statistic from
12203 %  the neighborhood of the specified width and height.
12204 %
12205 %  The format of the MagickStatisticImage method is:
12206 %
12207 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
12208 %        const StatisticType type,const double width,const size_t height)
12209 %
12210 %  A description of each parameter follows:
12211 %
12212 %    o wand: the magick wand.
12213 %
12214 %    o type: the statistic type (e.g. median, mode, etc.).
12215 %
12216 %    o width: the width of the pixel neighborhood.
12217 %
12218 %    o height: the height of the pixel neighborhood.
12219 %
12220 */
MagickStatisticImage(MagickWand * wand,const StatisticType type,const size_t width,const size_t height)12221 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
12222   const StatisticType type,const size_t width,const size_t height)
12223 {
12224   Image
12225     *statistic_image;
12226 
12227   assert(wand != (MagickWand *) NULL);
12228   assert(wand->signature == MagickWandSignature);
12229   if (wand->debug != MagickFalse)
12230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12231   if (wand->images == (Image *) NULL)
12232     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12233   statistic_image=StatisticImage(wand->images,type,width,height,
12234     wand->exception);
12235   if (statistic_image == (Image *) NULL)
12236     return(MagickFalse);
12237   ReplaceImageInList(&wand->images,statistic_image);
12238   return(MagickTrue);
12239 }
12240 
12241 /*
12242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12243 %                                                                             %
12244 %                                                                             %
12245 %                                                                             %
12246 %   M a g i c k S t e g a n o I m a g e                                       %
12247 %                                                                             %
12248 %                                                                             %
12249 %                                                                             %
12250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12251 %
12252 %  MagickSteganoImage() hides a digital watermark within the image.
12253 %  Recover the hidden watermark later to prove that the authenticity of
12254 %  an image.  Offset defines the start position within the image to hide
12255 %  the watermark.
12256 %
12257 %  The format of the MagickSteganoImage method is:
12258 %
12259 %      MagickWand *MagickSteganoImage(MagickWand *wand,
12260 %        const MagickWand *watermark_wand,const ssize_t offset)
12261 %
12262 %  A description of each parameter follows:
12263 %
12264 %    o wand: the magick wand.
12265 %
12266 %    o watermark_wand: the watermark wand.
12267 %
12268 %    o offset: Start hiding at this offset into the image.
12269 %
12270 */
MagickSteganoImage(MagickWand * wand,const MagickWand * watermark_wand,const ssize_t offset)12271 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
12272   const MagickWand *watermark_wand,const ssize_t offset)
12273 {
12274   Image
12275     *stegano_image;
12276 
12277   assert(wand != (MagickWand *) NULL);
12278   assert(wand->signature == MagickWandSignature);
12279   if (wand->debug != MagickFalse)
12280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12281   if ((wand->images == (Image *) NULL) ||
12282       (watermark_wand->images == (Image *) NULL))
12283     {
12284       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12285         "ContainsNoImages","`%s'",wand->name);
12286       return((MagickWand *) NULL);
12287     }
12288   wand->images->offset=offset;
12289   stegano_image=SteganoImage(wand->images,watermark_wand->images,
12290     wand->exception);
12291   if (stegano_image == (Image *) NULL)
12292     return((MagickWand *) NULL);
12293   return(CloneMagickWandFromImages(wand,stegano_image));
12294 }
12295 
12296 /*
12297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12298 %                                                                             %
12299 %                                                                             %
12300 %                                                                             %
12301 %   M a g i c k S t e r e o I m a g e                                         %
12302 %                                                                             %
12303 %                                                                             %
12304 %                                                                             %
12305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12306 %
12307 %  MagickStereoImage() composites two images and produces a single image that
12308 %  is the composite of a left and right image of a stereo pair
12309 %
12310 %  The format of the MagickStereoImage method is:
12311 %
12312 %      MagickWand *MagickStereoImage(MagickWand *wand,
12313 %        const MagickWand *offset_wand)
12314 %
12315 %  A description of each parameter follows:
12316 %
12317 %    o wand: the magick wand.
12318 %
12319 %    o offset_wand: Another image wand.
12320 %
12321 */
MagickStereoImage(MagickWand * wand,const MagickWand * offset_wand)12322 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
12323   const MagickWand *offset_wand)
12324 {
12325   Image
12326     *stereo_image;
12327 
12328   assert(wand != (MagickWand *) NULL);
12329   assert(wand->signature == MagickWandSignature);
12330   if (wand->debug != MagickFalse)
12331     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12332   if ((wand->images == (Image *) NULL) ||
12333       (offset_wand->images == (Image *) NULL))
12334     {
12335       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12336         "ContainsNoImages","`%s'",wand->name);
12337       return((MagickWand *) NULL);
12338     }
12339   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
12340   if (stereo_image == (Image *) NULL)
12341     return((MagickWand *) NULL);
12342   return(CloneMagickWandFromImages(wand,stereo_image));
12343 }
12344 
12345 /*
12346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12347 %                                                                             %
12348 %                                                                             %
12349 %                                                                             %
12350 %   M a g i c k S t r i p I m a g e                                           %
12351 %                                                                             %
12352 %                                                                             %
12353 %                                                                             %
12354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12355 %
12356 %  MagickStripImage() strips an image of all profiles and comments.
12357 %
12358 %  The format of the MagickStripImage method is:
12359 %
12360 %      MagickBooleanType MagickStripImage(MagickWand *wand)
12361 %
12362 %  A description of each parameter follows:
12363 %
12364 %    o wand: the magick wand.
12365 %
12366 */
MagickStripImage(MagickWand * wand)12367 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
12368 {
12369   assert(wand != (MagickWand *) NULL);
12370   assert(wand->signature == MagickWandSignature);
12371   if (wand->debug != MagickFalse)
12372     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12373   if (wand->images == (Image *) NULL)
12374     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12375   return(StripImage(wand->images,wand->exception));
12376 }
12377 
12378 /*
12379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12380 %                                                                             %
12381 %                                                                             %
12382 %                                                                             %
12383 %   M a g i c k S w i r l I m a g e                                           %
12384 %                                                                             %
12385 %                                                                             %
12386 %                                                                             %
12387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12388 %
12389 %  MagickSwirlImage() swirls the pixels about the center of the image, where
12390 %  degrees indicates the sweep of the arc through which each pixel is moved.
12391 %  You get a more dramatic effect as the degrees move from 1 to 360.
12392 %
12393 %  The format of the MagickSwirlImage method is:
12394 %
12395 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
12396 %        const PixelInterpolateMethod method)
12397 %
12398 %  A description of each parameter follows:
12399 %
12400 %    o wand: the magick wand.
12401 %
12402 %    o degrees: Define the tightness of the swirling effect.
12403 %
12404 %    o method: the pixel interpolation method.
12405 %
12406 */
MagickSwirlImage(MagickWand * wand,const double degrees,const PixelInterpolateMethod method)12407 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
12408   const double degrees,const PixelInterpolateMethod method)
12409 {
12410   Image
12411     *swirl_image;
12412 
12413   assert(wand != (MagickWand *) NULL);
12414   assert(wand->signature == MagickWandSignature);
12415   if (wand->debug != MagickFalse)
12416     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12417   if (wand->images == (Image *) NULL)
12418     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12419   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
12420   if (swirl_image == (Image *) NULL)
12421     return(MagickFalse);
12422   ReplaceImageInList(&wand->images,swirl_image);
12423   return(MagickTrue);
12424 }
12425 
12426 /*
12427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12428 %                                                                             %
12429 %                                                                             %
12430 %                                                                             %
12431 %   M a g i c k T e x t u r e I m a g e                                       %
12432 %                                                                             %
12433 %                                                                             %
12434 %                                                                             %
12435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12436 %
12437 %  MagickTextureImage() repeatedly tiles the texture image across and down the
12438 %  image canvas.
12439 %
12440 %  The format of the MagickTextureImage method is:
12441 %
12442 %      MagickWand *MagickTextureImage(MagickWand *wand,
12443 %        const MagickWand *texture_wand)
12444 %
12445 %  A description of each parameter follows:
12446 %
12447 %    o wand: the magick wand.
12448 %
12449 %    o texture_wand: the texture wand
12450 %
12451 */
MagickTextureImage(MagickWand * wand,const MagickWand * texture_wand)12452 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
12453   const MagickWand *texture_wand)
12454 {
12455   Image
12456     *texture_image;
12457 
12458   MagickBooleanType
12459     status;
12460 
12461   assert(wand != (MagickWand *) NULL);
12462   assert(wand->signature == MagickWandSignature);
12463   if (wand->debug != MagickFalse)
12464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12465   if ((wand->images == (Image *) NULL) ||
12466       (texture_wand->images == (Image *) NULL))
12467     {
12468       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12469         "ContainsNoImages","`%s'",wand->name);
12470       return((MagickWand *) NULL);
12471     }
12472   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12473   if (texture_image == (Image *) NULL)
12474     return((MagickWand *) NULL);
12475   status=TextureImage(texture_image,texture_wand->images,wand->exception);
12476   if (status == MagickFalse)
12477     {
12478       texture_image=DestroyImage(texture_image);
12479       return((MagickWand *) NULL);
12480     }
12481   return(CloneMagickWandFromImages(wand,texture_image));
12482 }
12483 
12484 /*
12485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12486 %                                                                             %
12487 %                                                                             %
12488 %                                                                             %
12489 %   M a g i c k T h r e s h o l d I m a g e                                   %
12490 %                                                                             %
12491 %                                                                             %
12492 %                                                                             %
12493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12494 %
12495 %  MagickThresholdImage() changes the value of individual pixels based on
12496 %  the intensity of each pixel compared to threshold.  The result is a
12497 %  high-contrast, two color image.
12498 %
12499 %  The format of the MagickThresholdImage method is:
12500 %
12501 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
12502 %        const double threshold)
12503 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12504 %        const ChannelType channel,const double threshold)
12505 %
12506 %  A description of each parameter follows:
12507 %
12508 %    o wand: the magick wand.
12509 %
12510 %    o channel: the image channel(s).
12511 %
12512 %    o threshold: Define the threshold value.
12513 %
12514 */
MagickThresholdImage(MagickWand * wand,const double threshold)12515 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12516   const double threshold)
12517 {
12518   MagickBooleanType
12519     status;
12520 
12521   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12522   return(status);
12523 }
12524 
MagickThresholdImageChannel(MagickWand * wand,const ChannelType channel,const double threshold)12525 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12526   const ChannelType channel,const double threshold)
12527 {
12528   MagickBooleanType
12529     status;
12530 
12531   ChannelType
12532     channel_mask;
12533 
12534   assert(wand != (MagickWand *) NULL);
12535   assert(wand->signature == MagickWandSignature);
12536   if (wand->debug != MagickFalse)
12537     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12538   if (wand->images == (Image *) NULL)
12539     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12540   channel_mask=SetImageChannelMask(wand->images,channel);
12541   status=BilevelImage(wand->images,threshold,wand->exception);
12542   (void) SetImageChannelMask(wand->images,channel_mask);
12543   return(status);
12544 }
12545 
12546 /*
12547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12548 %                                                                             %
12549 %                                                                             %
12550 %                                                                             %
12551 %   M a g i c k T h u m b n a i l I m a g e                                   %
12552 %                                                                             %
12553 %                                                                             %
12554 %                                                                             %
12555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12556 %
12557 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
12558 %  and removes any associated profiles.  The goal is to produce small low cost
12559 %  thumbnail images suited for display on the Web.
12560 %
12561 %  The format of the MagickThumbnailImage method is:
12562 %
12563 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12564 %        const size_t columns,const size_t rows)
12565 %
12566 %  A description of each parameter follows:
12567 %
12568 %    o wand: the magick wand.
12569 %
12570 %    o columns: the number of columns in the scaled image.
12571 %
12572 %    o rows: the number of rows in the scaled image.
12573 %
12574 */
MagickThumbnailImage(MagickWand * wand,const size_t columns,const size_t rows)12575 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12576   const size_t columns,const size_t rows)
12577 {
12578   Image
12579     *thumbnail_image;
12580 
12581   assert(wand != (MagickWand *) NULL);
12582   assert(wand->signature == MagickWandSignature);
12583   if (wand->debug != MagickFalse)
12584     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12585   if (wand->images == (Image *) NULL)
12586     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12587   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12588   if (thumbnail_image == (Image *) NULL)
12589     return(MagickFalse);
12590   ReplaceImageInList(&wand->images,thumbnail_image);
12591   return(MagickTrue);
12592 }
12593 
12594 /*
12595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12596 %                                                                             %
12597 %                                                                             %
12598 %                                                                             %
12599 %   M a g i c k T i n t I m a g e                                             %
12600 %                                                                             %
12601 %                                                                             %
12602 %                                                                             %
12603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12604 %
12605 %  MagickTintImage() applies a color vector to each pixel in the image.  The
12606 %  length of the vector is 0 for black and white and at its maximum for the
12607 %  midtones.  The vector weighting function is
12608 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12609 %
12610 %  The format of the MagickTintImage method is:
12611 %
12612 %      MagickBooleanType MagickTintImage(MagickWand *wand,
12613 %        const PixelWand *tint,const PixelWand *blend)
12614 %
12615 %  A description of each parameter follows:
12616 %
12617 %    o wand: the magick wand.
12618 %
12619 %    o tint: the tint pixel wand.
12620 %
12621 %    o alpha: the alpha pixel wand.
12622 %
12623 */
MagickTintImage(MagickWand * wand,const PixelWand * tint,const PixelWand * blend)12624 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12625   const PixelWand *tint,const PixelWand *blend)
12626 {
12627   char
12628     percent_blend[MagickPathExtent];
12629 
12630   Image
12631     *tint_image;
12632 
12633   PixelInfo
12634     target;
12635 
12636   assert(wand != (MagickWand *) NULL);
12637   assert(wand->signature == MagickWandSignature);
12638   if (wand->debug != MagickFalse)
12639     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12640   if (wand->images == (Image *) NULL)
12641     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12642   if (wand->images->colorspace != CMYKColorspace)
12643     (void) FormatLocaleString(percent_blend,MagickPathExtent,
12644       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12645       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
12646       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
12647       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
12648       PixelGetAlphaQuantum(blend)));
12649   else
12650     (void) FormatLocaleString(percent_blend,MagickPathExtent,
12651       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
12652       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
12653       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
12654       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
12655       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
12656       PixelGetAlphaQuantum(blend)));
12657   target=PixelGetPixel(tint);
12658   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
12659   if (tint_image == (Image *) NULL)
12660     return(MagickFalse);
12661   ReplaceImageInList(&wand->images,tint_image);
12662   return(MagickTrue);
12663 }
12664 
12665 /*
12666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12667 %                                                                             %
12668 %                                                                             %
12669 %                                                                             %
12670 %   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               %
12671 %                                                                             %
12672 %                                                                             %
12673 %                                                                             %
12674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12675 %
12676 %  MagickTransformImageColorspace() transform the image colorspace, setting
12677 %  the images colorspace while transforming the images data to that
12678 %  colorspace.
12679 %
12680 %  The format of the MagickTransformImageColorspace method is:
12681 %
12682 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12683 %        const ColorspaceType colorspace)
12684 %
12685 %  A description of each parameter follows:
12686 %
12687 %    o wand: the magick wand.
12688 %
12689 %    o colorspace: the image colorspace:   UndefinedColorspace,
12690 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
12691 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
12692 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
12693 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
12694 %      HSLColorspace, HWBColorspace.
12695 %
12696 */
MagickTransformImageColorspace(MagickWand * wand,const ColorspaceType colorspace)12697 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12698   const ColorspaceType colorspace)
12699 {
12700   assert(wand != (MagickWand *) NULL);
12701   assert(wand->signature == MagickWandSignature);
12702   if (wand->debug != MagickFalse)
12703     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12704   if (wand->images == (Image *) NULL)
12705     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12706   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
12707 }
12708 
12709 /*
12710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12711 %                                                                             %
12712 %                                                                             %
12713 %                                                                             %
12714 %   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                     %
12715 %                                                                             %
12716 %                                                                             %
12717 %                                                                             %
12718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12719 %
12720 %  MagickTransparentPaintImage() changes any pixel that matches color with the
12721 %  color defined by fill.
12722 %
12723 %  The format of the MagickTransparentPaintImage method is:
12724 %
12725 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12726 %        const PixelWand *target,const double alpha,const double fuzz,
12727 %        const MagickBooleanType invert)
12728 %
12729 %  A description of each parameter follows:
12730 %
12731 %    o wand: the magick wand.
12732 %
12733 %    o target: Change this target color to specified alpha value within
12734 %      the image.
12735 %
12736 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12737 %      transparent.
12738 %
12739 %    o fuzz: By default target must match a particular pixel color
12740 %      exactly.  However, in many cases two colors may differ by a small amount.
12741 %      The fuzz member of image defines how much tolerance is acceptable to
12742 %      consider two colors as the same.  For example, set fuzz to 10 and the
12743 %      color red at intensities of 100 and 102 respectively are now interpreted
12744 %      as the same color for the purposes of the floodfill.
12745 %
12746 %    o invert: paint any pixel that does not match the target color.
12747 %
12748 */
MagickTransparentPaintImage(MagickWand * wand,const PixelWand * target,const double alpha,const double fuzz,const MagickBooleanType invert)12749 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12750   const PixelWand *target,const double alpha,const double fuzz,
12751   const MagickBooleanType invert)
12752 {
12753   MagickBooleanType
12754     status;
12755 
12756   PixelInfo
12757     target_pixel;
12758 
12759   assert(wand != (MagickWand *) NULL);
12760   assert(wand->signature == MagickWandSignature);
12761   if (wand->debug != MagickFalse)
12762     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12763   if (wand->images == (Image *) NULL)
12764     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12765   PixelGetMagickColor(target,&target_pixel);
12766   wand->images->fuzz=fuzz;
12767   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12768     QuantumRange*alpha),invert,wand->exception);
12769   return(status);
12770 }
12771 
12772 /*
12773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12774 %                                                                             %
12775 %                                                                             %
12776 %                                                                             %
12777 %   M a g i c k T r a n s p o s e I m a g e                                   %
12778 %                                                                             %
12779 %                                                                             %
12780 %                                                                             %
12781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12782 %
12783 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
12784 %  pixels around the central x-axis while rotating them 90-degrees.
12785 %
12786 %  The format of the MagickTransposeImage method is:
12787 %
12788 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12789 %
12790 %  A description of each parameter follows:
12791 %
12792 %    o wand: the magick wand.
12793 %
12794 */
MagickTransposeImage(MagickWand * wand)12795 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12796 {
12797   Image
12798     *transpose_image;
12799 
12800   assert(wand != (MagickWand *) NULL);
12801   assert(wand->signature == MagickWandSignature);
12802   if (wand->debug != MagickFalse)
12803     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12804   if (wand->images == (Image *) NULL)
12805     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12806   transpose_image=TransposeImage(wand->images,wand->exception);
12807   if (transpose_image == (Image *) NULL)
12808     return(MagickFalse);
12809   ReplaceImageInList(&wand->images,transpose_image);
12810   return(MagickTrue);
12811 }
12812 
12813 /*
12814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12815 %                                                                             %
12816 %                                                                             %
12817 %                                                                             %
12818 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12819 %                                                                             %
12820 %                                                                             %
12821 %                                                                             %
12822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12823 %
12824 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12825 %  pixels around the central y-axis while rotating them 270-degrees.
12826 %
12827 %  The format of the MagickTransverseImage method is:
12828 %
12829 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12830 %
12831 %  A description of each parameter follows:
12832 %
12833 %    o wand: the magick wand.
12834 %
12835 */
MagickTransverseImage(MagickWand * wand)12836 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12837 {
12838   Image
12839     *transverse_image;
12840 
12841   assert(wand != (MagickWand *) NULL);
12842   assert(wand->signature == MagickWandSignature);
12843   if (wand->debug != MagickFalse)
12844     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12845   if (wand->images == (Image *) NULL)
12846     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12847   transverse_image=TransverseImage(wand->images,wand->exception);
12848   if (transverse_image == (Image *) NULL)
12849     return(MagickFalse);
12850   ReplaceImageInList(&wand->images,transverse_image);
12851   return(MagickTrue);
12852 }
12853 
12854 /*
12855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12856 %                                                                             %
12857 %                                                                             %
12858 %                                                                             %
12859 %   M a g i c k T r i m I m a g e                                             %
12860 %                                                                             %
12861 %                                                                             %
12862 %                                                                             %
12863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12864 %
12865 %  MagickTrimImage() remove edges that are the background color from the image.
12866 %
12867 %  The format of the MagickTrimImage method is:
12868 %
12869 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12870 %
12871 %  A description of each parameter follows:
12872 %
12873 %    o wand: the magick wand.
12874 %
12875 %    o fuzz: By default target must match a particular pixel color
12876 %      exactly.  However, in many cases two colors may differ by a small amount.
12877 %      The fuzz member of image defines how much tolerance is acceptable to
12878 %      consider two colors as the same.  For example, set fuzz to 10 and the
12879 %      color red at intensities of 100 and 102 respectively are now interpreted
12880 %      as the same color for the purposes of the floodfill.
12881 %
12882 */
MagickTrimImage(MagickWand * wand,const double fuzz)12883 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12884 {
12885   Image
12886     *trim_image;
12887 
12888   assert(wand != (MagickWand *) NULL);
12889   assert(wand->signature == MagickWandSignature);
12890   if (wand->debug != MagickFalse)
12891     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12892   if (wand->images == (Image *) NULL)
12893     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12894   wand->images->fuzz=fuzz;
12895   trim_image=TrimImage(wand->images,wand->exception);
12896   if (trim_image == (Image *) NULL)
12897     return(MagickFalse);
12898   ReplaceImageInList(&wand->images,trim_image);
12899   return(MagickTrue);
12900 }
12901 
12902 /*
12903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12904 %                                                                             %
12905 %                                                                             %
12906 %                                                                             %
12907 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
12908 %                                                                             %
12909 %                                                                             %
12910 %                                                                             %
12911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12912 %
12913 %  MagickUniqueImageColors() discards all but one of any pixel color.
12914 %
12915 %  The format of the MagickUniqueImageColors method is:
12916 %
12917 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12918 %
12919 %  A description of each parameter follows:
12920 %
12921 %    o wand: the magick wand.
12922 %
12923 */
MagickUniqueImageColors(MagickWand * wand)12924 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12925 {
12926   Image
12927     *unique_image;
12928 
12929   assert(wand != (MagickWand *) NULL);
12930   assert(wand->signature == MagickWandSignature);
12931   if (wand->debug != MagickFalse)
12932     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12933   if (wand->images == (Image *) NULL)
12934     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12935   unique_image=UniqueImageColors(wand->images,wand->exception);
12936   if (unique_image == (Image *) NULL)
12937     return(MagickFalse);
12938   ReplaceImageInList(&wand->images,unique_image);
12939   return(MagickTrue);
12940 }
12941 
12942 /*
12943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12944 %                                                                             %
12945 %                                                                             %
12946 %                                                                             %
12947 %   M a g i c k U n s h a r p M a s k I m a g e                               %
12948 %                                                                             %
12949 %                                                                             %
12950 %                                                                             %
12951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12952 %
12953 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12954 %  Gaussian operator of the given radius and standard deviation (sigma).
12955 %  For reasonable results, radius should be larger than sigma.  Use a radius
12956 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12957 %
12958 %  The format of the MagickUnsharpMaskImage method is:
12959 %
12960 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12961 %        const double radius,const double sigma,const double gain,
12962 %        const double threshold)
12963 %
12964 %  A description of each parameter follows:
12965 %
12966 %    o wand: the magick wand.
12967 %
12968 %    o radius: the radius of the Gaussian, in pixels, not counting the center
12969 %      pixel.
12970 %
12971 %    o sigma: the standard deviation of the Gaussian, in pixels.
12972 %
12973 %    o gain: the percentage of the difference between the original and the
12974 %      blur image that is added back into the original.
12975 %
12976 %    o threshold: the threshold in pixels needed to apply the diffence gain.
12977 %
12978 */
MagickUnsharpMaskImage(MagickWand * wand,const double radius,const double sigma,const double gain,const double threshold)12979 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12980   const double radius,const double sigma,const double gain,
12981   const double threshold)
12982 {
12983   Image
12984     *unsharp_image;
12985 
12986   assert(wand != (MagickWand *) NULL);
12987   assert(wand->signature == MagickWandSignature);
12988   if (wand->debug != MagickFalse)
12989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12990   if (wand->images == (Image *) NULL)
12991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12992   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
12993     wand->exception);
12994   if (unsharp_image == (Image *) NULL)
12995     return(MagickFalse);
12996   ReplaceImageInList(&wand->images,unsharp_image);
12997   return(MagickTrue);
12998 }
12999 
13000 /*
13001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13002 %                                                                             %
13003 %                                                                             %
13004 %                                                                             %
13005 %   M a g i c k V i g n e t t e I m a g e                                     %
13006 %                                                                             %
13007 %                                                                             %
13008 %                                                                             %
13009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13010 %
13011 %  MagickVignetteImage() softens the edges of the image in vignette style.
13012 %
13013 %  The format of the MagickVignetteImage method is:
13014 %
13015 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
13016 %        const double radius,const double sigma,const ssize_t x,
13017 %        const ssize_t y)
13018 %
13019 %  A description of each parameter follows:
13020 %
13021 %    o wand: the magick wand.
13022 %
13023 %    o radius: the radius.
13024 %
13025 %    o sigma: the sigma.
13026 %
13027 %    o x, y:  Define the x and y ellipse offset.
13028 %
13029 */
MagickVignetteImage(MagickWand * wand,const double radius,const double sigma,const ssize_t x,const ssize_t y)13030 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
13031   const double radius,const double sigma,const ssize_t x,const ssize_t y)
13032 {
13033   Image
13034     *vignette_image;
13035 
13036   assert(wand != (MagickWand *) NULL);
13037   assert(wand->signature == MagickWandSignature);
13038   if (wand->debug != MagickFalse)
13039     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13040   if (wand->images == (Image *) NULL)
13041     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13042   vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
13043   if (vignette_image == (Image *) NULL)
13044     return(MagickFalse);
13045   ReplaceImageInList(&wand->images,vignette_image);
13046   return(MagickTrue);
13047 }
13048 
13049 /*
13050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13051 %                                                                             %
13052 %                                                                             %
13053 %                                                                             %
13054 %   M a g i c k W a v e I m a g e                                             %
13055 %                                                                             %
13056 %                                                                             %
13057 %                                                                             %
13058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13059 %
13060 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
13061 %  the pixels vertically along a sine wave whose amplitude and wavelength
13062 %  is specified by the given parameters.
13063 %
13064 %  The format of the MagickWaveImage method is:
13065 %
13066 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
13067 %        const double amplitude,const double wave_length,
13068 %        const PixelInterpolateMethod method)
13069 %
13070 %  A description of each parameter follows:
13071 %
13072 %    o wand: the magick wand.
13073 %
13074 %    o amplitude, wave_length:  Define the amplitude and wave length of the
13075 %      sine wave.
13076 %
13077 %    o method: the pixel interpolation method.
13078 %
13079 */
MagickWaveImage(MagickWand * wand,const double amplitude,const double wave_length,const PixelInterpolateMethod method)13080 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
13081   const double amplitude,const double wave_length,
13082   const PixelInterpolateMethod method)
13083 {
13084   Image
13085     *wave_image;
13086 
13087   assert(wand != (MagickWand *) NULL);
13088   assert(wand->signature == MagickWandSignature);
13089   if (wand->debug != MagickFalse)
13090     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13091   if (wand->images == (Image *) NULL)
13092     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13093   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
13094     wand->exception);
13095   if (wave_image == (Image *) NULL)
13096     return(MagickFalse);
13097   ReplaceImageInList(&wand->images,wave_image);
13098   return(MagickTrue);
13099 }
13100 
13101 /*
13102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13103 %                                                                             %
13104 %                                                                             %
13105 %                                                                             %
13106 %   M a g i c k W a v e l e t D e n o i s e I m a g e                         %
13107 %                                                                             %
13108 %                                                                             %
13109 %                                                                             %
13110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13111 %
13112 %  MagickWaveletDenoiseImage() removes noise from the image using a wavelet
13113 %  transform.  The wavelet transform is a fast hierarchical scheme for
13114 %  processing an image using a set of consecutive lowpass and high_pass filters,
13115 %  followed by a decimation.  This results in a decomposition into different
13116 %  scales which can be regarded as different “frequency bands”, determined by
13117 %  the mother wavelet.
13118 %
13119 %  The format of the MagickWaveletDenoiseImage method is:
13120 %
13121 %      MagickBooleanType MagickWaveletDenoiseImage(MagickWand *wand,
13122 %        const double threshold,const double softness)
13123 %
13124 %  A description of each parameter follows:
13125 %
13126 %    o wand: the magick wand.
13127 %
13128 %    o threshold: set the threshold for smoothing.
13129 %
13130 %    o softness: attenuate the smoothing threshold.
13131 %
13132 */
MagickWaveletDenoiseImage(MagickWand * wand,const double threshold,const double softness)13133 WandExport MagickBooleanType MagickWaveletDenoiseImage(MagickWand *wand,
13134   const double threshold,const double softness)
13135 {
13136   Image
13137     *noise_image;
13138 
13139   assert(wand != (MagickWand *) NULL);
13140   assert(wand->signature == MagickWandSignature);
13141   if (wand->debug != MagickFalse)
13142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13143   if (wand->images == (Image *) NULL)
13144     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13145   noise_image=WaveletDenoiseImage(wand->images,threshold,softness,
13146     wand->exception);
13147   if (noise_image == (Image *) NULL)
13148     return(MagickFalse);
13149   ReplaceImageInList(&wand->images,noise_image);
13150   return(MagickTrue);
13151 }
13152 
13153 /*
13154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13155 %                                                                             %
13156 %                                                                             %
13157 %                                                                             %
13158 %   M a g i c k W h i t e B a l a n c e I m a g e                             %
13159 %                                                                             %
13160 %                                                                             %
13161 %                                                                             %
13162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13163 %
13164 %  MagickWhiteBalanceImage() applies white balancing to an image according to
13165 %  a grayworld assumption in the LAB colorspace.
13166 %
13167 %  The format of the WhiteBalanceImage method is:
13168 %
13169 %      MagickBooleanType WhiteBalanceImage(MagickWand *wand)
13170 %
13171 %  A description of each parameter follows:
13172 %
13173 %    o wand: the magick wand.
13174 %
13175 */
MagickWhiteBalanceImage(MagickWand * wand)13176 WandExport MagickBooleanType MagickWhiteBalanceImage(MagickWand *wand)
13177 {
13178   MagickBooleanType
13179     status;
13180 
13181   assert(wand != (MagickWand *) NULL);
13182   assert(wand->signature == MagickWandSignature);
13183   if (wand->debug != MagickFalse)
13184     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13185   if (wand->images == (Image *) NULL)
13186     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13187   status=WhiteBalanceImage(wand->images, wand->exception);
13188   return(status);
13189 }
13190 
13191 /*
13192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13193 %                                                                             %
13194 %                                                                             %
13195 %                                                                             %
13196 %   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                         %
13197 %                                                                             %
13198 %                                                                             %
13199 %                                                                             %
13200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13201 %
13202 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
13203 %  above the threshold into white while leaving all pixels below the threshold
13204 %  unchanged.
13205 %
13206 %  The format of the MagickWhiteThresholdImage method is:
13207 %
13208 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13209 %        const PixelWand *threshold)
13210 %
13211 %  A description of each parameter follows:
13212 %
13213 %    o wand: the magick wand.
13214 %
13215 %    o threshold: the pixel wand.
13216 %
13217 */
MagickWhiteThresholdImage(MagickWand * wand,const PixelWand * threshold)13218 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13219   const PixelWand *threshold)
13220 {
13221   char
13222     thresholds[MagickPathExtent];
13223 
13224   assert(wand != (MagickWand *) NULL);
13225   assert(wand->signature == MagickWandSignature);
13226   if (wand->debug != MagickFalse)
13227     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13228   if (wand->images == (Image *) NULL)
13229     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13230   (void) FormatLocaleString(thresholds,MagickPathExtent,
13231     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
13232     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
13233     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
13234   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
13235 }
13236 
13237 /*
13238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13239 %                                                                             %
13240 %                                                                             %
13241 %                                                                             %
13242 %   M a g i c k W r i t e I m a g e                                           %
13243 %                                                                             %
13244 %                                                                             %
13245 %                                                                             %
13246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13247 %
13248 %  MagickWriteImage() writes an image to the specified filename.  If the
13249 %  filename parameter is NULL, the image is written to the filename set
13250 %  by MagickReadImage() or MagickSetImageFilename().
13251 %
13252 %  The format of the MagickWriteImage method is:
13253 %
13254 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
13255 %        const char *filename)
13256 %
13257 %  A description of each parameter follows:
13258 %
13259 %    o wand: the magick wand.
13260 %
13261 %    o filename: the image filename.
13262 %
13263 %
13264 */
MagickWriteImage(MagickWand * wand,const char * filename)13265 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
13266   const char *filename)
13267 {
13268   Image
13269     *image;
13270 
13271   ImageInfo
13272     *write_info;
13273 
13274   MagickBooleanType
13275     status;
13276 
13277   assert(wand != (MagickWand *) NULL);
13278   assert(wand->signature == MagickWandSignature);
13279   if (wand->debug != MagickFalse)
13280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13281   if (wand->images == (Image *) NULL)
13282     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13283   if (filename != (const char *) NULL)
13284     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
13285   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13286   if (image == (Image *) NULL)
13287     return(MagickFalse);
13288   write_info=CloneImageInfo(wand->image_info);
13289   write_info->adjoin=MagickTrue;
13290   status=WriteImage(write_info,image,wand->exception);
13291   image=DestroyImage(image);
13292   write_info=DestroyImageInfo(write_info);
13293   return(status);
13294 }
13295 
13296 /*
13297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13298 %                                                                             %
13299 %                                                                             %
13300 %                                                                             %
13301 %   M a g i c k W r i t e I m a g e F i l e                                   %
13302 %                                                                             %
13303 %                                                                             %
13304 %                                                                             %
13305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13306 %
13307 %  MagickWriteImageFile() writes an image to an open file descriptor.
13308 %
13309 %  The format of the MagickWriteImageFile method is:
13310 %
13311 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13312 %
13313 %  A description of each parameter follows:
13314 %
13315 %    o wand: the magick wand.
13316 %
13317 %    o file: the file descriptor.
13318 %
13319 */
MagickWriteImageFile(MagickWand * wand,FILE * file)13320 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13321 {
13322   Image
13323     *image;
13324 
13325   ImageInfo
13326     *write_info;
13327 
13328   MagickBooleanType
13329     status;
13330 
13331   assert(wand != (MagickWand *) NULL);
13332   assert(wand->signature == MagickWandSignature);
13333   assert(file != (FILE *) NULL);
13334   if (wand->debug != MagickFalse)
13335     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13336   if (wand->images == (Image *) NULL)
13337     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13338   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13339   if (image == (Image *) NULL)
13340     return(MagickFalse);
13341   write_info=CloneImageInfo(wand->image_info);
13342   SetImageInfoFile(write_info,file);
13343   write_info->adjoin=MagickTrue;
13344   status=WriteImage(write_info,image,wand->exception);
13345   write_info=DestroyImageInfo(write_info);
13346   image=DestroyImage(image);
13347   return(status);
13348 }
13349 
13350 /*
13351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13352 %                                                                             %
13353 %                                                                             %
13354 %                                                                             %
13355 %   M a g i c k W r i t e I m a g e s                                         %
13356 %                                                                             %
13357 %                                                                             %
13358 %                                                                             %
13359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13360 %
13361 %  MagickWriteImages() writes an image or image sequence.
13362 %
13363 %  The format of the MagickWriteImages method is:
13364 %
13365 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
13366 %        const char *filename,const MagickBooleanType adjoin)
13367 %
13368 %  A description of each parameter follows:
13369 %
13370 %    o wand: the magick wand.
13371 %
13372 %    o filename: the image filename.
13373 %
13374 %    o adjoin: join images into a single multi-image file.
13375 %
13376 */
MagickWriteImages(MagickWand * wand,const char * filename,const MagickBooleanType adjoin)13377 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
13378   const char *filename,const MagickBooleanType adjoin)
13379 {
13380   ImageInfo
13381     *write_info;
13382 
13383   MagickBooleanType
13384     status;
13385 
13386   assert(wand != (MagickWand *) NULL);
13387   assert(wand->signature == MagickWandSignature);
13388   if (wand->debug != MagickFalse)
13389     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13390   if (wand->images == (Image *) NULL)
13391     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13392   write_info=CloneImageInfo(wand->image_info);
13393   write_info->adjoin=adjoin;
13394   status=WriteImages(write_info,wand->images,filename,wand->exception);
13395   write_info=DestroyImageInfo(write_info);
13396   return(status);
13397 }
13398 
13399 /*
13400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13401 %                                                                             %
13402 %                                                                             %
13403 %                                                                             %
13404 %   M a g i c k W r i t e I m a g e s F i l e                                 %
13405 %                                                                             %
13406 %                                                                             %
13407 %                                                                             %
13408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13409 %
13410 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
13411 %
13412 %  The format of the MagickWriteImagesFile method is:
13413 %
13414 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13415 %
13416 %  A description of each parameter follows:
13417 %
13418 %    o wand: the magick wand.
13419 %
13420 %    o file: the file descriptor.
13421 %
13422 */
MagickWriteImagesFile(MagickWand * wand,FILE * file)13423 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13424 {
13425   ImageInfo
13426     *write_info;
13427 
13428   MagickBooleanType
13429     status;
13430 
13431   assert(wand != (MagickWand *) NULL);
13432   assert(wand->signature == MagickWandSignature);
13433   if (wand->debug != MagickFalse)
13434     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13435   if (wand->images == (Image *) NULL)
13436     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13437   write_info=CloneImageInfo(wand->image_info);
13438   SetImageInfoFile(write_info,file);
13439   write_info->adjoin=MagickTrue;
13440   status=WriteImages(write_info,wand->images,(const char *) NULL,
13441     wand->exception);
13442   write_info=DestroyImageInfo(write_info);
13443   return(status);
13444 }
13445