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 "wand/studio.h"
50 #include "wand/MagickWand.h"
51 #include "wand/magick-wand-private.h"
52 #include "wand/wand.h"
53 #include "wand/pixel-wand-private.h"
54 #include "magick/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 == WandSignature);
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,MaxTextExtent,"%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->quantize_info=CloneQuantizeInfo(wand->quantize_info);
106   clone_wand->images=images;
107   clone_wand->debug=IsEventLogging();
108   if (clone_wand->debug != MagickFalse)
109     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
110   clone_wand->signature=WandSignature;
111   return(clone_wand);
112 }
113 
114 /*
115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
116 %                                                                             %
117 %                                                                             %
118 %                                                                             %
119 %   G e t I m a g e F r o m M a g i c k W a n d                               %
120 %                                                                             %
121 %                                                                             %
122 %                                                                             %
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 %
125 %  GetImageFromMagickWand() returns the current image from the magick wand.
126 %
127 %  The format of the GetImageFromMagickWand method is:
128 %
129 %      Image *GetImageFromMagickWand(const MagickWand *wand)
130 %
131 %  A description of each parameter follows:
132 %
133 %    o wand: the magick wand.
134 %
135 */
GetImageFromMagickWand(const MagickWand * wand)136 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
137 {
138   assert(wand != (MagickWand *) NULL);
139   assert(wand->signature == WandSignature);
140   if (wand->debug != MagickFalse)
141     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
142   if (wand->images == (Image *) NULL)
143     {
144       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
145         "ContainsNoImages","`%s'",wand->name);
146       return((Image *) NULL);
147     }
148   return(wand->images);
149 }
150 
151 /*
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153 %                                                                             %
154 %                                                                             %
155 %                                                                             %
156 %   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                       %
157 %                                                                             %
158 %                                                                             %
159 %                                                                             %
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %
162 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
163 %  less intensely near image edges and more intensely far from edges. We
164 %  blur the image with a Gaussian operator of the given radius and standard
165 %  deviation (sigma).  For reasonable results, radius should be larger than
166 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
167 %  suitable radius for you.
168 %
169 %  The format of the MagickAdaptiveBlurImage method is:
170 %
171 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
172 %        const double radius,const double sigma)
173 %      MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
174 %        const ChannelType channel,const double radius,const double sigma)
175 %
176 %  A description of each parameter follows:
177 %
178 %    o wand: the magick wand.
179 %
180 %    o channel: the image channel(s).
181 %
182 %    o radius: the radius of the Gaussian, in pixels, not counting the center
183 %      pixel.
184 %
185 %    o sigma: the standard deviation of the Gaussian, in pixels.
186 %
187 */
188 
MagickAdaptiveBlurImage(MagickWand * wand,const double radius,const double sigma)189 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
190   const double radius,const double sigma)
191 {
192   MagickBooleanType
193     status;
194 
195   status=MagickAdaptiveBlurImageChannel(wand,DefaultChannels,radius,sigma);
196   return(status);
197 }
198 
MagickAdaptiveBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)199 WandExport MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
200   const ChannelType channel,const double radius,const double sigma)
201 {
202   Image
203     *sharp_image;
204 
205   assert(wand != (MagickWand *) NULL);
206   assert(wand->signature == WandSignature);
207   if (wand->debug != MagickFalse)
208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
209   if (wand->images == (Image *) NULL)
210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
211   sharp_image=AdaptiveBlurImageChannel(wand->images,channel,radius,sigma,
212     wand->exception);
213   if (sharp_image == (Image *) NULL)
214     return(MagickFalse);
215   ReplaceImageInList(&wand->images,sharp_image);
216   return(MagickTrue);
217 }
218 
219 /*
220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221 %                                                                             %
222 %                                                                             %
223 %                                                                             %
224 %   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                         %
225 %                                                                             %
226 %                                                                             %
227 %                                                                             %
228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229 %
230 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
231 %  triangulation.
232 %
233 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
234 %        const size_t columns,const size_t rows)
235 %
236 %  A description of each parameter follows:
237 %
238 %    o wand: the magick wand.
239 %
240 %    o columns: the number of columns in the scaled image.
241 %
242 %    o rows: the number of rows in the scaled image.
243 %
244 */
MagickAdaptiveResizeImage(MagickWand * wand,const size_t columns,const size_t rows)245 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
246   const size_t columns,const size_t rows)
247 {
248   Image
249     *resize_image;
250 
251   assert(wand != (MagickWand *) NULL);
252   assert(wand->signature == WandSignature);
253   if (wand->debug != MagickFalse)
254     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
255   if (wand->images == (Image *) NULL)
256     ThrowWandException(WandError,"ContainsNoImages",wand->name);
257   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
258   if (resize_image == (Image *) NULL)
259     return(MagickFalse);
260   ReplaceImageInList(&wand->images,resize_image);
261   return(MagickTrue);
262 }
263 
264 /*
265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266 %                                                                             %
267 %                                                                             %
268 %                                                                             %
269 %   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                       %
270 %                                                                             %
271 %                                                                             %
272 %                                                                             %
273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274 %
275 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
276 %  more intensely near image edges and less intensely far from edges. We
277 %  sharpen the image with a Gaussian operator of the given radius and standard
278 %  deviation (sigma).  For reasonable results, radius should be larger than
279 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
280 %  suitable radius for you.
281 %
282 %  The format of the MagickAdaptiveSharpenImage method is:
283 %
284 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
285 %        const double radius,const double sigma)
286 %      MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
287 %        const ChannelType channel,const double radius,const double sigma)
288 %
289 %  A description of each parameter follows:
290 %
291 %    o wand: the magick wand.
292 %
293 %    o channel: the image channel(s).
294 %
295 %    o radius: the radius of the Gaussian, in pixels, not counting the center
296 %      pixel.
297 %
298 %    o sigma: the standard deviation of the Gaussian, in pixels.
299 %
300 */
301 
MagickAdaptiveSharpenImage(MagickWand * wand,const double radius,const double sigma)302 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
303   const double radius,const double sigma)
304 {
305   MagickBooleanType
306     status;
307 
308   status=MagickAdaptiveSharpenImageChannel(wand,DefaultChannels,radius,sigma);
309   return(status);
310 }
311 
MagickAdaptiveSharpenImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)312 WandExport MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
313   const ChannelType channel,const double radius,const double sigma)
314 {
315   Image
316     *sharp_image;
317 
318   assert(wand != (MagickWand *) NULL);
319   assert(wand->signature == WandSignature);
320   if (wand->debug != MagickFalse)
321     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
322   if (wand->images == (Image *) NULL)
323     ThrowWandException(WandError,"ContainsNoImages",wand->name);
324   sharp_image=AdaptiveSharpenImageChannel(wand->images,channel,radius,sigma,
325     wand->exception);
326   if (sharp_image == (Image *) NULL)
327     return(MagickFalse);
328   ReplaceImageInList(&wand->images,sharp_image);
329   return(MagickTrue);
330 }
331 
332 /*
333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
334 %                                                                             %
335 %                                                                             %
336 %                                                                             %
337 %   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                   %
338 %                                                                             %
339 %                                                                             %
340 %                                                                             %
341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342 %
343 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
344 %  based on the range of intensity values in its local neighborhood.  This
345 %  allows for thresholding of an image whose global intensity histogram
346 %  doesn't contain distinctive peaks.
347 %
348 %  The format of the AdaptiveThresholdImage method is:
349 %
350 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
351 %        const size_t width,const size_t height,const ssize_t offset)
352 %
353 %  A description of each parameter follows:
354 %
355 %    o wand: the magick wand.
356 %
357 %    o width: the width of the local neighborhood.
358 %
359 %    o height: the height of the local neighborhood.
360 %
361 %    o offset: the mean offset.
362 %
363 */
MagickAdaptiveThresholdImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t offset)364 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
365   const size_t width,const size_t height,const ssize_t offset)
366 {
367   Image
368     *threshold_image;
369 
370   assert(wand != (MagickWand *) NULL);
371   assert(wand->signature == WandSignature);
372   if (wand->debug != MagickFalse)
373     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
374   if (wand->images == (Image *) NULL)
375     ThrowWandException(WandError,"ContainsNoImages",wand->name);
376   threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
377     wand->exception);
378   if (threshold_image == (Image *) NULL)
379     return(MagickFalse);
380   ReplaceImageInList(&wand->images,threshold_image);
381   return(MagickTrue);
382 }
383 
384 /*
385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
386 %                                                                             %
387 %                                                                             %
388 %                                                                             %
389 %   M a g i c k A d d I m a g e                                               %
390 %                                                                             %
391 %                                                                             %
392 %                                                                             %
393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394 %
395 %  MagickAddImage() adds a clone of the images from the second wand and
396 %  inserts them into the first wand.
397 %
398 %  Use MagickSetLastIterator(), to append new images into an existing wand,
399 %  current image will be set to last image so later adds with also be
400 %  appened to end of wand.
401 %
402 %  Use MagickSetFirstIterator() to prepend new images into wand, any more
403 %  images added will also be prepended before other images in the wand.
404 %  However the order of a list of new images will not change.
405 %
406 %  Otherwise the new images will be inserted just after the current image,
407 %  and any later image will also be added after this current image but
408 %  before the previously added images.  Caution is advised when multiple
409 %  image adds are inserted into the middle of the wand image list.
410 %
411 %  The format of the MagickAddImage method is:
412 %
413 %      MagickBooleanType MagickAddImage(MagickWand *wand,
414 %        const MagickWand *add_wand)
415 %
416 %  A description of each parameter follows:
417 %
418 %    o wand: the magick wand.
419 %
420 %    o add_wand: A wand that contains the image list to be added
421 %
422 */
InsertImageInWand(MagickWand * wand,Image * images)423 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
424   Image *images)
425 {
426   if (wand->images == (Image *) NULL)
427     {
428       /*
429         No images in wand, just add them, set current as appropriate.
430       */
431       if (wand->insert_before != MagickFalse)
432         wand->images=GetFirstImageInList(images);
433       else
434         wand->images=GetLastImageInList(images);
435       return(MagickTrue);
436     }
437   if ((wand->insert_before != MagickFalse) &&
438       (wand->images->previous == (Image *) NULL) )
439     {
440       /*
441         Jumped to first image, so prepend new images - remain active.
442       */
443       PrependImageToList(&wand->images,images);
444       wand->images=GetFirstImageInList(images);
445       return(MagickTrue);
446     }
447   /*
448     Note you should never have 'insert_before' true when current image is not
449     the first image in the wand!  That is no insert before current image, only
450     after current image.
451   */
452   if (wand->images->next == (Image *) NULL)
453     {
454       /*
455         At last image, append new images.
456       */
457       InsertImageInList(&wand->images,images);
458       wand->images=GetLastImageInList(images);
459       return(MagickTrue);
460     }
461   /*
462     Insert new images, just after the current image.
463   */
464   InsertImageInList(&wand->images,images);
465   return(MagickTrue);
466 }
467 
MagickAddImage(MagickWand * wand,const MagickWand * add_wand)468 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
469   const MagickWand *add_wand)
470 {
471   Image
472     *images;
473 
474   assert(wand != (MagickWand *) NULL);
475   assert(wand->signature == WandSignature);
476   if (wand->debug != MagickFalse)
477     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
478   assert(add_wand != (MagickWand *) NULL);
479   assert(add_wand->signature == WandSignature);
480   if (add_wand->images == (Image *) NULL)
481     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
482   /*
483     Clone images in second wand, and insert into first.
484   */
485   images=CloneImageList(add_wand->images,wand->exception);
486   if (images == (Image *) NULL)
487     return(MagickFalse);
488   return(InsertImageInWand(wand,images));
489 }
490 
491 /*
492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
493 %                                                                             %
494 %                                                                             %
495 %                                                                             %
496 %     M a g i c k A d d N o i s e I m a g e                                   %
497 %                                                                             %
498 %                                                                             %
499 %                                                                             %
500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501 %
502 %  MagickAddNoiseImage() adds random noise to the image.
503 %
504 %  The format of the MagickAddNoiseImage method is:
505 %
506 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
507 %        const NoiseType noise_type)
508 %      MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
509 %        const ChannelType channel,const NoiseType noise_type)
510 %
511 %  A description of each parameter follows:
512 %
513 %    o wand: the magick wand.
514 %
515 %    o channel: the image channel(s).
516 %
517 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
518 %      Impulse, Laplacian, or Poisson.
519 %
520 */
521 
MagickAddNoiseImage(MagickWand * wand,const NoiseType noise_type)522 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
523   const NoiseType noise_type)
524 {
525   MagickBooleanType
526     status;
527 
528   status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
529   return(status);
530 }
531 
MagickAddNoiseImageChannel(MagickWand * wand,const ChannelType channel,const NoiseType noise_type)532 WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
533   const ChannelType channel,const NoiseType noise_type)
534 {
535   Image
536     *noise_image;
537 
538   assert(wand != (MagickWand *) NULL);
539   assert(wand->signature == WandSignature);
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   noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
545     wand->exception);
546   if (noise_image == (Image *) NULL)
547     return(MagickFalse);
548   ReplaceImageInList(&wand->images,noise_image);
549   return(MagickTrue);
550 }
551 
552 /*
553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554 %                                                                             %
555 %                                                                             %
556 %                                                                             %
557 %   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                       %
558 %                                                                             %
559 %                                                                             %
560 %                                                                             %
561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
562 %
563 %  MagickAffineTransformImage() transforms an image as dictated by the affine
564 %  matrix of the drawing wand.
565 %
566 %  The format of the MagickAffineTransformImage method is:
567 %
568 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
569 %        const DrawingWand *drawing_wand)
570 %
571 %  A description of each parameter follows:
572 %
573 %    o wand: the magick wand.
574 %
575 %    o drawing_wand: the draw wand.
576 %
577 */
MagickAffineTransformImage(MagickWand * wand,const DrawingWand * drawing_wand)578 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
579   const DrawingWand *drawing_wand)
580 {
581   DrawInfo
582     *draw_info;
583 
584   Image
585     *affine_image;
586 
587   assert(wand != (MagickWand *) NULL);
588   assert(wand->signature == WandSignature);
589   if (wand->debug != MagickFalse)
590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
591   if (wand->images == (Image *) NULL)
592     ThrowWandException(WandError,"ContainsNoImages",wand->name);
593   draw_info=PeekDrawingWand(drawing_wand);
594   if (draw_info == (DrawInfo *) NULL)
595     return(MagickFalse);
596   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
597     wand->exception);
598   draw_info=DestroyDrawInfo(draw_info);
599   if (affine_image == (Image *) NULL)
600     return(MagickFalse);
601   ReplaceImageInList(&wand->images,affine_image);
602   return(MagickTrue);
603 }
604 
605 /*
606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607 %                                                                             %
608 %                                                                             %
609 %                                                                             %
610 %   M a g i c k A n n o t a t e I m a g e                                     %
611 %                                                                             %
612 %                                                                             %
613 %                                                                             %
614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615 %
616 %  MagickAnnotateImage() annotates an image with text.
617 %
618 %  The format of the MagickAnnotateImage method is:
619 %
620 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
621 %        const DrawingWand *drawing_wand,const double x,const double y,
622 %        const double angle,const char *text)
623 %
624 %  A description of each parameter follows:
625 %
626 %    o wand: the magick wand.
627 %
628 %    o drawing_wand: the draw wand.
629 %
630 %    o x: x ordinate to left of text
631 %
632 %    o y: y ordinate to text baseline
633 %
634 %    o angle: rotate text relative to this angle.
635 %
636 %    o text: text to draw
637 %
638 */
MagickAnnotateImage(MagickWand * wand,const DrawingWand * drawing_wand,const double x,const double y,const double angle,const char * text)639 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
640   const DrawingWand *drawing_wand,const double x,const double y,
641   const double angle,const char *text)
642 {
643   char
644     geometry[MaxTextExtent];
645 
646   DrawInfo
647     *draw_info;
648 
649   MagickBooleanType
650     status;
651 
652   assert(wand != (MagickWand *) NULL);
653   assert(wand->signature == WandSignature);
654   if (wand->debug != MagickFalse)
655     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
656   if (wand->images == (Image *) NULL)
657     ThrowWandException(WandError,"ContainsNoImages",wand->name);
658   draw_info=PeekDrawingWand(drawing_wand);
659   if (draw_info == (DrawInfo *) NULL)
660     return(MagickFalse);
661   (void) CloneString(&draw_info->text,text);
662   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
663   draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
664   draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
665   draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
666   draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
667   (void) CloneString(&draw_info->geometry,geometry);
668   status=AnnotateImage(wand->images,draw_info);
669   draw_info=DestroyDrawInfo(draw_info);
670   if (status == MagickFalse)
671     InheritException(wand->exception,&wand->images->exception);
672   return(status);
673 }
674 
675 /*
676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677 %                                                                             %
678 %                                                                             %
679 %                                                                             %
680 %   M a g i c k A n i m a t e I m a g e s                                     %
681 %                                                                             %
682 %                                                                             %
683 %                                                                             %
684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
685 %
686 %  MagickAnimateImages() animates an image or image sequence.
687 %
688 %  The format of the MagickAnimateImages method is:
689 %
690 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
691 %        const char *server_name)
692 %
693 %  A description of each parameter follows:
694 %
695 %    o wand: the magick wand.
696 %
697 %    o server_name: the X server name.
698 %
699 */
MagickAnimateImages(MagickWand * wand,const char * server_name)700 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
701   const char *server_name)
702 {
703   MagickBooleanType
704     status;
705 
706   assert(wand != (MagickWand *) NULL);
707   assert(wand->signature == WandSignature);
708   if (wand->debug != MagickFalse)
709     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
710   (void) CloneString(&wand->image_info->server_name,server_name);
711   status=AnimateImages(wand->image_info,wand->images);
712   if (status == MagickFalse)
713     InheritException(wand->exception,&wand->images->exception);
714   return(status);
715 }
716 
717 /*
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 %                                                                             %
720 %                                                                             %
721 %                                                                             %
722 %   M a g i c k A p p e n d I m a g e s                                       %
723 %                                                                             %
724 %                                                                             %
725 %                                                                             %
726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727 %
728 %  MagickAppendImages() append the images in a wand from the current image
729 %  onwards, creating a new wand with the single image result.  This is
730 %  affected by the gravity and background settings of the first image.
731 %
732 %  Typically you would call either MagickResetIterator() or
733 %  MagickSetFirstImage() before calling this function to ensure that all
734 %  the images in the wand's image list will be appended together.
735 %
736 %  The format of the MagickAppendImages method is:
737 %
738 %      MagickWand *MagickAppendImages(MagickWand *wand,
739 %        const MagickBooleanType stack)
740 %
741 %  A description of each parameter follows:
742 %
743 %    o wand: the magick wand.
744 %
745 %    o stack: By default, images are stacked left-to-right. Set stack to
746 %      MagickTrue to stack them top-to-bottom.
747 %
748 */
MagickAppendImages(MagickWand * wand,const MagickBooleanType stack)749 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
750   const MagickBooleanType stack)
751 {
752   Image
753     *append_image;
754 
755   assert(wand != (MagickWand *) NULL);
756   assert(wand->signature == WandSignature);
757   if (wand->debug != MagickFalse)
758     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
759   if (wand->images == (Image *) NULL)
760     return((MagickWand *) NULL);
761   append_image=AppendImages(wand->images,stack,wand->exception);
762   if (append_image == (Image *) NULL)
763     return((MagickWand *) NULL);
764   return(CloneMagickWandFromImages(wand,append_image));
765 }
766 
767 /*
768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
769 %                                                                             %
770 %                                                                             %
771 %                                                                             %
772 %   M a g i c k A u t o G a m m a I m a g e                                   %
773 %                                                                             %
774 %                                                                             %
775 %                                                                             %
776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
777 %
778 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
779 %  image to try make set its gamma appropriatally.
780 %
781 %  The format of the MagickAutoGammaImage method is:
782 %
783 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
784 %      MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
785 %        const ChannelType channel)
786 %
787 %  A description of each parameter follows:
788 %
789 %    o wand: the magick wand.
790 %
791 %    o channel: the image channel(s).
792 %
793 */
MagickAutoGammaImage(MagickWand * wand)794 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
795 {
796   MagickBooleanType
797     status;
798 
799   status=MagickAutoGammaImageChannel(wand,DefaultChannels);
800   return(status);
801 }
802 
MagickAutoGammaImageChannel(MagickWand * wand,const ChannelType channel)803 WandExport MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
804   const ChannelType channel)
805 {
806   MagickBooleanType
807     status;
808 
809   assert(wand != (MagickWand *) NULL);
810   assert(wand->signature == WandSignature);
811   if (wand->debug != MagickFalse)
812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
813   if (wand->images == (Image *) NULL)
814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
815   status=AutoGammaImageChannel(wand->images,channel);
816   if (status == MagickFalse)
817     InheritException(wand->exception,&wand->images->exception);
818   return(status);
819 }
820 
821 /*
822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
823 %                                                                             %
824 %                                                                             %
825 %                                                                             %
826 %   M a g i c k A u t o L e v e l I m a g e                                   %
827 %                                                                             %
828 %                                                                             %
829 %                                                                             %
830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
831 %
832 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
833 %  scaling the minimum and maximum values to the full quantum range.
834 %
835 %  The format of the MagickAutoLevelImage method is:
836 %
837 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
838 %      MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
839 %        const ChannelType channel)
840 %
841 %  A description of each parameter follows:
842 %
843 %    o wand: the magick wand.
844 %
845 %    o channel: the image channel(s).
846 %
847 */
MagickAutoLevelImage(MagickWand * wand)848 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
849 {
850   MagickBooleanType
851     status;
852 
853   status=MagickAutoLevelImageChannel(wand,DefaultChannels);
854   return(status);
855 }
856 
MagickAutoLevelImageChannel(MagickWand * wand,const ChannelType channel)857 WandExport MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
858   const ChannelType channel)
859 {
860   MagickBooleanType
861     status;
862 
863   assert(wand != (MagickWand *) NULL);
864   assert(wand->signature == WandSignature);
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   status=AutoLevelImageChannel(wand->images,channel);
870   if (status == MagickFalse)
871     InheritException(wand->exception,&wand->images->exception);
872   return(status);
873 }
874 
875 /*
876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
877 %                                                                             %
878 %                                                                             %
879 %                                                                             %
880 %   M a g i c k A u t o O r i e n t I m a g e                                 %
881 %                                                                             %
882 %                                                                             %
883 %                                                                             %
884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
885 %
886 %  MagickAutoOrientImage() adjusts an image so that its orientation is suitable
887 $  for viewing (i.e. top-left orientation).
888 %
889 %  The format of the MagickAutoOrientImage method is:
890 %
891 %      MagickBooleanType MagickAutoOrientImage(MagickWand *image)
892 %
893 %  A description of each parameter follows:
894 %
895 %    o wand: the magick wand.
896 %
897 */
MagickAutoOrientImage(MagickWand * wand)898 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
899 {
900 
901   Image
902     *orient_image;
903 
904   assert(wand != (MagickWand *) NULL);
905   assert(wand->signature == WandSignature);
906   if (wand->debug != MagickFalse)
907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
908   if (wand->images == (Image *) NULL)
909     ThrowWandException(WandError,"ContainsNoImages",wand->name);
910   orient_image=AutoOrientImage(wand->images,wand->images->orientation,
911     wand->exception);
912   if (orient_image == (Image *) NULL)
913     return(MagickFalse);
914   ReplaceImageInList(&wand->images,orient_image);
915   return(MagickTrue);
916 }
917 
918 /*
919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
920 %                                                                             %
921 %                                                                             %
922 %                                                                             %
923 %   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                         %
924 %                                                                             %
925 %                                                                             %
926 %                                                                             %
927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
928 %
929 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
930 %  pixels below the threshold into black while leaving all pixels above the
931 %  threshold unchanged.
932 %
933 %  The format of the MagickBlackThresholdImage method is:
934 %
935 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
936 %        const PixelWand *threshold)
937 %
938 %  A description of each parameter follows:
939 %
940 %    o wand: the magick wand.
941 %
942 %    o threshold: the pixel wand.
943 %
944 */
MagickBlackThresholdImage(MagickWand * wand,const PixelWand * threshold)945 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
946   const PixelWand *threshold)
947 {
948   char
949     thresholds[MaxTextExtent];
950 
951   MagickBooleanType
952     status;
953 
954   assert(wand != (MagickWand *) NULL);
955   assert(wand->signature == WandSignature);
956   if (wand->debug != MagickFalse)
957     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
958   if (wand->images == (Image *) NULL)
959     ThrowWandException(WandError,"ContainsNoImages",wand->name);
960   (void) FormatLocaleString(thresholds,MaxTextExtent,QuantumFormat ","
961     QuantumFormat "," QuantumFormat "," QuantumFormat,PixelGetRedQuantum(
962     threshold),PixelGetGreenQuantum(threshold),PixelGetBlueQuantum(threshold),
963     PixelGetOpacityQuantum(threshold));
964   status=BlackThresholdImage(wand->images,thresholds);
965   if (status == MagickFalse)
966     InheritException(wand->exception,&wand->images->exception);
967   return(status);
968 }
969 
970 /*
971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
972 %                                                                             %
973 %                                                                             %
974 %                                                                             %
975 %   M a g i c k B l u e S h i f t I m a g e                                   %
976 %                                                                             %
977 %                                                                             %
978 %                                                                             %
979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
980 %
981 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
982 %  nighttime in the moonlight.
983 %
984 %  The format of the MagickBlueShiftImage method is:
985 %
986 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
987 %        const double factor)
988 %
989 %  A description of each parameter follows:
990 %
991 %    o wand: the magick wand.
992 %
993 %    o factor: the blue shift factor (default 1.5)
994 %
995 */
MagickBlueShiftImage(MagickWand * wand,const double factor)996 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
997   const double factor)
998 {
999   Image
1000     *shift_image;
1001 
1002   assert(wand != (MagickWand *) NULL);
1003   assert(wand->signature == WandSignature);
1004   if (wand->debug != MagickFalse)
1005     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1006   if (wand->images == (Image *) NULL)
1007     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1008   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
1009   if (shift_image == (Image *) NULL)
1010     return(MagickFalse);
1011   ReplaceImageInList(&wand->images,shift_image);
1012   return(MagickTrue);
1013 }
1014 
1015 /*
1016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017 %                                                                             %
1018 %                                                                             %
1019 %                                                                             %
1020 %   M a g i c k B l u r I m a g e                                             %
1021 %                                                                             %
1022 %                                                                             %
1023 %                                                                             %
1024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025 %
1026 %  MagickBlurImage() blurs an image.  We convolve the image with a gaussian
1027 %  operator of the given radius and standard deviation (sigma).  For reasonable
1028 %  results, the radius should be larger than sigma.  Use a radius of 0 and
1029 %  BlurImage() selects a suitable radius for you.
1030 %
1031 %  The format of the MagickBlurImage method is:
1032 %
1033 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
1034 %        const double sigma)
1035 %      MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
1036 %        const ChannelType channel,const double radius,const double sigma)
1037 %
1038 %  A description of each parameter follows:
1039 %
1040 %    o wand: the magick wand.
1041 %
1042 %    o channel: the image channel(s).
1043 %
1044 %    o radius: the radius of the , in pixels, not counting the center
1045 %      pixel.
1046 %
1047 %    o sigma: the standard deviation of the , in pixels.
1048 %
1049 */
1050 
MagickBlurImage(MagickWand * wand,const double radius,const double sigma)1051 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
1052   const double radius,const double sigma)
1053 {
1054   MagickBooleanType
1055     status;
1056 
1057   status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
1058   return(status);
1059 }
1060 
MagickBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)1061 WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
1062   const ChannelType channel,const double radius,const double sigma)
1063 {
1064   Image
1065     *blur_image;
1066 
1067   assert(wand != (MagickWand *) NULL);
1068   assert(wand->signature == WandSignature);
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=BlurImageChannel(wand->images,channel,radius,sigma,
1074     wand->exception);
1075   if (blur_image == (Image *) NULL)
1076     return(MagickFalse);
1077   ReplaceImageInList(&wand->images,blur_image);
1078   return(MagickTrue);
1079 }
1080 
1081 /*
1082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1083 %                                                                             %
1084 %                                                                             %
1085 %                                                                             %
1086 %   M a g i c k B o r d e r I m a g e                                         %
1087 %                                                                             %
1088 %                                                                             %
1089 %                                                                             %
1090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1091 %
1092 %  MagickBorderImage() surrounds the image with a border of the color defined
1093 %  by the bordercolor pixel wand.
1094 %
1095 %  The format of the MagickBorderImage method is:
1096 %
1097 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
1098 %        const PixelWand *bordercolor,const size_t width,
1099 %        const size_t height)
1100 %
1101 %  A description of each parameter follows:
1102 %
1103 %    o wand: the magick wand.
1104 %
1105 %    o bordercolor: the border color pixel wand.
1106 %
1107 %    o width: the border width.
1108 %
1109 %    o height: the border height.
1110 %
1111 */
MagickBorderImage(MagickWand * wand,const PixelWand * bordercolor,const size_t width,const size_t height)1112 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1113   const PixelWand *bordercolor,const size_t width,const size_t height)
1114 {
1115   Image
1116     *border_image;
1117 
1118   RectangleInfo
1119     border_info;
1120 
1121   assert(wand != (MagickWand *) NULL);
1122   assert(wand->signature == WandSignature);
1123   if (wand->debug != MagickFalse)
1124     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1125   if (wand->images == (Image *) NULL)
1126     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1127   border_info.width=width;
1128   border_info.height=height;
1129   border_info.x=0;
1130   border_info.y=0;
1131   PixelGetQuantumColor(bordercolor,&wand->images->border_color);
1132   border_image=BorderImage(wand->images,&border_info,wand->exception);
1133   if (border_image == (Image *) NULL)
1134     return(MagickFalse);
1135   ReplaceImageInList(&wand->images,border_image);
1136   return(MagickTrue);
1137 }
1138 
1139 /*
1140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1141 %                                                                             %
1142 %                                                                             %
1143 %                                                                             %
1144 %   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   %
1145 %                                                                             %
1146 %                                                                             %
1147 %                                                                             %
1148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1149 %
1150 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1151 %  of an image.  It converts the brightness and contrast parameters into slope
1152 %  and intercept and calls a polynomical function to apply to the image.
1153 %
1154 %  The format of the MagickBrightnessContrastImage method is:
1155 %
1156 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1157 %        const double brightness,const double contrast)
1158 %      MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand,
1159 %        const ChannelType channel,const double brightness,
1160 %        const double contrast)
1161 %
1162 %  A description of each parameter follows:
1163 %
1164 %    o wand: the magick wand.
1165 %
1166 %    o channel: the image channel(s).
1167 %
1168 %    o brightness: the brightness percent (-100 .. 100).
1169 %
1170 %    o contrast: the contrast percent (-100 .. 100).
1171 %
1172 */
1173 
MagickBrightnessContrastImage(MagickWand * wand,const double brightness,const double contrast)1174 WandExport MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1175   const double brightness,const double contrast)
1176 {
1177   MagickBooleanType
1178     status;
1179 
1180   status=MagickBrightnessContrastImageChannel(wand,DefaultChannels,brightness,
1181     contrast);
1182   return(status);
1183 }
1184 
MagickBrightnessContrastImageChannel(MagickWand * wand,const ChannelType channel,const double brightness,const double contrast)1185 WandExport MagickBooleanType MagickBrightnessContrastImageChannel(
1186   MagickWand *wand,const ChannelType channel,const double brightness,
1187   const double contrast)
1188 {
1189   MagickBooleanType
1190     status;
1191 
1192   assert(wand != (MagickWand *) NULL);
1193   assert(wand->signature == WandSignature);
1194   if (wand->debug != MagickFalse)
1195     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1196   if (wand->images == (Image *) NULL)
1197     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1198   status=BrightnessContrastImageChannel(wand->images,channel,brightness,
1199     contrast);
1200   if (status == MagickFalse)
1201     InheritException(wand->exception,&wand->images->exception);
1202   return(status);
1203 }
1204 
1205 /*
1206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1207 %                                                                             %
1208 %                                                                             %
1209 %                                                                             %
1210 %   M a g i c k C h a r c o a l I m a g e                                     %
1211 %                                                                             %
1212 %                                                                             %
1213 %                                                                             %
1214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1215 %
1216 %  MagickCharcoalImage() simulates a charcoal drawing.
1217 %
1218 %  The format of the MagickCharcoalImage method is:
1219 %
1220 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1221 %        const double radius,const double sigma)
1222 %
1223 %  A description of each parameter follows:
1224 %
1225 %    o wand: the magick wand.
1226 %
1227 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1228 %      pixel.
1229 %
1230 %    o sigma: the standard deviation of the Gaussian, in pixels.
1231 %
1232 */
MagickCharcoalImage(MagickWand * wand,const double radius,const double sigma)1233 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1234   const double radius,const double sigma)
1235 {
1236   Image
1237     *charcoal_image;
1238 
1239   assert(wand != (MagickWand *) NULL);
1240   assert(wand->signature == WandSignature);
1241   if (wand->debug != MagickFalse)
1242     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1243   if (wand->images == (Image *) NULL)
1244     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1245   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1246   if (charcoal_image == (Image *) NULL)
1247     return(MagickFalse);
1248   ReplaceImageInList(&wand->images,charcoal_image);
1249   return(MagickTrue);
1250 }
1251 
1252 /*
1253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254 %                                                                             %
1255 %                                                                             %
1256 %                                                                             %
1257 %   M a g i c k C h o p I m a g e                                             %
1258 %                                                                             %
1259 %                                                                             %
1260 %                                                                             %
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262 %
1263 %  MagickChopImage() removes a region of an image and collapses the image to
1264 %  occupy the removed portion
1265 %
1266 %  The format of the MagickChopImage method is:
1267 %
1268 %      MagickBooleanType MagickChopImage(MagickWand *wand,const size_t width,
1269 %        const size_t height,const ssize_t x,const ssize_t y)
1270 %
1271 %  A description of each parameter follows:
1272 %
1273 %    o wand: the magick wand.
1274 %
1275 %    o width: the region width.
1276 %
1277 %    o height: the region height.
1278 %
1279 %    o x: the region x offset.
1280 %
1281 %    o y: the region y offset.
1282 %
1283 */
MagickChopImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)1284 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1285   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1286 {
1287   Image
1288     *chop_image;
1289 
1290   RectangleInfo
1291     chop;
1292 
1293   assert(wand != (MagickWand *) NULL);
1294   assert(wand->signature == WandSignature);
1295   if (wand->debug != MagickFalse)
1296     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1297   if (wand->images == (Image *) NULL)
1298     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1299   chop.width=width;
1300   chop.height=height;
1301   chop.x=x;
1302   chop.y=y;
1303   chop_image=ChopImage(wand->images,&chop,wand->exception);
1304   if (chop_image == (Image *) NULL)
1305     return(MagickFalse);
1306   ReplaceImageInList(&wand->images,chop_image);
1307   return(MagickTrue);
1308 }
1309 
1310 /*
1311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1312 %                                                                             %
1313 %                                                                             %
1314 %                                                                             %
1315 %   M a g i c k C l a m p I m a g e                                           %
1316 %                                                                             %
1317 %                                                                             %
1318 %                                                                             %
1319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1320 %
1321 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1322 %
1323 %  The format of the MagickClampImage method is:
1324 %
1325 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1326 %      MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1327 %        const ChannelType channel)
1328 %
1329 %  A description of each parameter follows:
1330 %
1331 %    o wand: the magick wand.
1332 %
1333 %    o channel: the channel.
1334 %
1335 */
1336 
MagickClampImage(MagickWand * wand)1337 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1338 {
1339   MagickBooleanType
1340     status;
1341 
1342   status=MagickClampImageChannel(wand,DefaultChannels);
1343   return(status);
1344 }
1345 
MagickClampImageChannel(MagickWand * wand,const ChannelType channel)1346 WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1347   const ChannelType channel)
1348 {
1349   MagickBooleanType
1350     status;
1351 
1352   assert(wand != (MagickWand *) NULL);
1353   assert(wand->signature == WandSignature);
1354   if (wand->debug != MagickFalse)
1355     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1356   if (wand->images == (Image *) NULL)
1357     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1358   status=ClampImageChannel(wand->images,channel);
1359   if (status == MagickFalse)
1360     InheritException(wand->exception,&wand->images->exception);
1361   return(status);
1362 }
1363 
1364 /*
1365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1366 %                                                                             %
1367 %                                                                             %
1368 %                                                                             %
1369 %   M a g i c k C l i p I m a g e                                             %
1370 %                                                                             %
1371 %                                                                             %
1372 %                                                                             %
1373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1374 %
1375 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1376 %  present.
1377 %
1378 %  The format of the MagickClipImage method is:
1379 %
1380 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1381 %
1382 %  A description of each parameter follows:
1383 %
1384 %    o wand: the magick wand.
1385 %
1386 */
MagickClipImage(MagickWand * wand)1387 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1388 {
1389   MagickBooleanType
1390     status;
1391 
1392   assert(wand != (MagickWand *) NULL);
1393   assert(wand->signature == WandSignature);
1394   if (wand->debug != MagickFalse)
1395     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1396   if (wand->images == (Image *) NULL)
1397     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1398   status=ClipImage(wand->images);
1399   if (status == MagickFalse)
1400     InheritException(wand->exception,&wand->images->exception);
1401   return(status);
1402 }
1403 
1404 /*
1405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1406 %                                                                             %
1407 %                                                                             %
1408 %                                                                             %
1409 %   M a g i c k C l i p I m a g e P a t h                                     %
1410 %                                                                             %
1411 %                                                                             %
1412 %                                                                             %
1413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1414 %
1415 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1416 %  present. Later operations take effect inside the path.  Id may be a number
1417 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1418 %  path.
1419 %
1420 %  The format of the MagickClipImagePath method is:
1421 %
1422 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1423 %        const char *pathname,const MagickBooleanType inside)
1424 %
1425 %  A description of each parameter follows:
1426 %
1427 %    o wand: the magick wand.
1428 %
1429 %    o pathname: name of clipping path resource. If name is preceded by #, use
1430 %      clipping path numbered by name.
1431 %
1432 %    o inside: if non-zero, later operations take effect inside clipping path.
1433 %      Otherwise later operations take effect outside clipping path.
1434 %
1435 */
MagickClipImagePath(MagickWand * wand,const char * pathname,const MagickBooleanType inside)1436 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1437   const char *pathname,const MagickBooleanType inside)
1438 {
1439   MagickBooleanType
1440     status;
1441 
1442   assert(wand != (MagickWand *) NULL);
1443   assert(wand->signature == WandSignature);
1444   if (wand->debug != MagickFalse)
1445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1446   if (wand->images == (Image *) NULL)
1447     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1448   status=ClipImagePath(wand->images,pathname,inside);
1449   if (status == MagickFalse)
1450     InheritException(wand->exception,&wand->images->exception);
1451   return(status);
1452 }
1453 
1454 /*
1455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1456 %                                                                             %
1457 %                                                                             %
1458 %                                                                             %
1459 %   M a g i c k C l u t I m a g e                                             %
1460 %                                                                             %
1461 %                                                                             %
1462 %                                                                             %
1463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1464 %
1465 %  MagickClutImage() replaces colors in the image from a color lookup table.
1466 %
1467 %  The format of the MagickClutImage method is:
1468 %
1469 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1470 %        const MagickWand *clut_wand)
1471 %      MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1472 %        const ChannelType channel,const MagickWand *clut_wand)
1473 %
1474 %  A description of each parameter follows:
1475 %
1476 %    o wand: the magick wand.
1477 %
1478 %    o clut_image: the clut image.
1479 %
1480 */
1481 
MagickClutImage(MagickWand * wand,const MagickWand * clut_wand)1482 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1483   const MagickWand *clut_wand)
1484 {
1485   MagickBooleanType
1486     status;
1487 
1488   status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
1489   return(status);
1490 }
1491 
MagickClutImageChannel(MagickWand * wand,const ChannelType channel,const MagickWand * clut_wand)1492 WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1493   const ChannelType channel,const MagickWand *clut_wand)
1494 {
1495   MagickBooleanType
1496     status;
1497 
1498   assert(wand != (MagickWand *) NULL);
1499   assert(wand->signature == WandSignature);
1500   if (wand->debug != MagickFalse)
1501     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1502   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1503     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1504   status=ClutImageChannel(wand->images,channel,clut_wand->images);
1505   if (status == MagickFalse)
1506     InheritException(wand->exception,&wand->images->exception);
1507   return(status);
1508 }
1509 
1510 /*
1511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1512 %                                                                             %
1513 %                                                                             %
1514 %                                                                             %
1515 %   M a g i c k C o a l e s c e I m a g e s                                   %
1516 %                                                                             %
1517 %                                                                             %
1518 %                                                                             %
1519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520 %
1521 %  MagickCoalesceImages() composites a set of images while respecting any page
1522 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1523 %  typically start with an image background and each subsequent image
1524 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1525 %  where each image in the sequence is the same size as the first and
1526 %  composited with the next image in the sequence.
1527 %
1528 %  The format of the MagickCoalesceImages method is:
1529 %
1530 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1531 %
1532 %  A description of each parameter follows:
1533 %
1534 %    o wand: the magick wand.
1535 %
1536 */
MagickCoalesceImages(MagickWand * wand)1537 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1538 {
1539   Image
1540     *coalesce_image;
1541 
1542   assert(wand != (MagickWand *) NULL);
1543   assert(wand->signature == WandSignature);
1544   if (wand->debug != MagickFalse)
1545     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1546   if (wand->images == (Image *) NULL)
1547     return((MagickWand *) NULL);
1548   coalesce_image=CoalesceImages(wand->images,wand->exception);
1549   if (coalesce_image == (Image *) NULL)
1550     return((MagickWand *) NULL);
1551   return(CloneMagickWandFromImages(wand,coalesce_image));
1552 }
1553 
1554 /*
1555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1556 %                                                                             %
1557 %                                                                             %
1558 %                                                                             %
1559 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1560 %                                                                             %
1561 %                                                                             %
1562 %                                                                             %
1563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564 %
1565 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1566 %  Collection (CCC) file which solely contains one or more color corrections
1567 %  and applies the color correction to the image.  Here is a sample CCC file:
1568 %
1569 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1570 %          <ColorCorrection id="cc03345">
1571 %                <SOPNode>
1572 %                     <Slope> 0.9 1.2 0.5 </Slope>
1573 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1574 %                     <Power> 1.0 0.8 1.5 </Power>
1575 %                </SOPNode>
1576 %                <SATNode>
1577 %                     <Saturation> 0.85 </Saturation>
1578 %                </SATNode>
1579 %          </ColorCorrection>
1580 %    </ColorCorrectionCollection>
1581 %
1582 %  which includes the offset, slope, and power for each of the RGB channels
1583 %  as well as the saturation.
1584 %
1585 %  The format of the MagickColorDecisionListImage method is:
1586 %
1587 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1588 %        const char *color_correction_collection)
1589 %
1590 %  A description of each parameter follows:
1591 %
1592 %    o wand: the magick wand.
1593 %
1594 %    o color_correction_collection: the color correction collection in XML.
1595 %
1596 */
MagickColorDecisionListImage(MagickWand * wand,const char * color_correction_collection)1597 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1598   const char *color_correction_collection)
1599 {
1600   MagickBooleanType
1601     status;
1602 
1603   assert(wand != (MagickWand *) NULL);
1604   assert(wand->signature == WandSignature);
1605   if (wand->debug != MagickFalse)
1606     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1607   if (wand->images == (Image *) NULL)
1608     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1609   status=ColorDecisionListImage(wand->images,color_correction_collection);
1610   if (status == MagickFalse)
1611     InheritException(wand->exception,&wand->images->exception);
1612   return(status);
1613 }
1614 
1615 /*
1616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1617 %                                                                             %
1618 %                                                                             %
1619 %                                                                             %
1620 %   M a g i c k C o l o r i z e I m a g e                                     %
1621 %                                                                             %
1622 %                                                                             %
1623 %                                                                             %
1624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1625 %
1626 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1627 %
1628 %  The format of the MagickColorizeImage method is:
1629 %
1630 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1631 %        const PixelWand *colorize,const PixelWand *opacity)
1632 %
1633 %  A description of each parameter follows:
1634 %
1635 %    o wand: the magick wand.
1636 %
1637 %    o colorize: the colorize pixel wand.
1638 %
1639 %    o opacity: the opacity pixel wand.
1640 %
1641 */
MagickColorizeImage(MagickWand * wand,const PixelWand * colorize,const PixelWand * opacity)1642 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1643   const PixelWand *colorize,const PixelWand *opacity)
1644 {
1645   char
1646     percent_opaque[MaxTextExtent];
1647 
1648   Image
1649     *colorize_image;
1650 
1651   PixelPacket
1652     target;
1653 
1654   assert(wand != (MagickWand *) NULL);
1655   assert(wand->signature == WandSignature);
1656   if (wand->debug != MagickFalse)
1657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1658   if (wand->images == (Image *) NULL)
1659     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1660   (void) FormatLocaleString(percent_opaque,MaxTextExtent,"%g,%g,%g,%g",(double)
1661     (100.0*QuantumScale*PixelGetRedQuantum(opacity)),(double) (100.0*
1662     QuantumScale*PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1663     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1664     PixelGetOpacityQuantum(opacity)));
1665   PixelGetQuantumColor(colorize,&target);
1666   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1667     wand->exception);
1668   if (colorize_image == (Image *) NULL)
1669     return(MagickFalse);
1670   ReplaceImageInList(&wand->images,colorize_image);
1671   return(MagickTrue);
1672 }
1673 
1674 /*
1675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1676 %                                                                             %
1677 %                                                                             %
1678 %                                                                             %
1679 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1680 %                                                                             %
1681 %                                                                             %
1682 %                                                                             %
1683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1684 %
1685 %  MagickColorMatrixImage() apply color transformation to an image. The method
1686 %  permits saturation changes, hue rotation, luminance to alpha, and various
1687 %  other effects.  Although variable-sized transformation matrices can be used,
1688 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1689 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1690 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1691 %  and offsets are normalized (divide Flash offset by 255).
1692 %
1693 %  The format of the MagickColorMatrixImage method is:
1694 %
1695 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1696 %        const KernelInfo *color_matrix)
1697 %
1698 %  A description of each parameter follows:
1699 %
1700 %    o wand: the magick wand.
1701 %
1702 %    o color_matrix:  the color matrix.
1703 %
1704 */
MagickColorMatrixImage(MagickWand * wand,const KernelInfo * color_matrix)1705 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1706   const KernelInfo *color_matrix)
1707 {
1708   Image
1709     *color_image;
1710 
1711   assert(wand != (MagickWand *) NULL);
1712   assert(wand->signature == WandSignature);
1713   if (wand->debug != MagickFalse)
1714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1715   if (color_matrix == (const KernelInfo *) NULL)
1716     return(MagickFalse);
1717   if (wand->images == (Image *) NULL)
1718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1719   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1720   if (color_image == (Image *) NULL)
1721     return(MagickFalse);
1722   ReplaceImageInList(&wand->images,color_image);
1723   return(MagickTrue);
1724 }
1725 
1726 /*
1727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1728 %                                                                             %
1729 %                                                                             %
1730 %                                                                             %
1731 %   M a g i c k C o m b i n e I m a g e s                                     %
1732 %                                                                             %
1733 %                                                                             %
1734 %                                                                             %
1735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1736 %
1737 %  MagickCombineImages() combines one or more images into a single image.  The
1738 %  grayscale value of the pixels of each image in the sequence is assigned in
1739 %  order to the specified  hannels of the combined image.   The typical
1740 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1741 %
1742 %  The format of the MagickCombineImages method is:
1743 %
1744 %      MagickWand *MagickCombineImages(MagickWand *wand,
1745 %        const ChannelType channel)
1746 %
1747 %  A description of each parameter follows:
1748 %
1749 %    o wand: the magick wand.
1750 %
1751 %    o channel: the channel.
1752 %
1753 */
MagickCombineImages(MagickWand * wand,const ChannelType channel)1754 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1755   const ChannelType channel)
1756 {
1757   Image
1758     *combine_image;
1759 
1760   assert(wand != (MagickWand *) NULL);
1761   assert(wand->signature == WandSignature);
1762   if (wand->debug != MagickFalse)
1763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1764   if (wand->images == (Image *) NULL)
1765     return((MagickWand *) NULL);
1766   combine_image=CombineImages(wand->images,channel,wand->exception);
1767   if (combine_image == (Image *) NULL)
1768     return((MagickWand *) NULL);
1769   return(CloneMagickWandFromImages(wand,combine_image));
1770 }
1771 
1772 /*
1773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1774 %                                                                             %
1775 %                                                                             %
1776 %                                                                             %
1777 %   M a g i c k C o m m e n t I m a g e                                       %
1778 %                                                                             %
1779 %                                                                             %
1780 %                                                                             %
1781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1782 %
1783 %  MagickCommentImage() adds a comment to your image.
1784 %
1785 %  The format of the MagickCommentImage method is:
1786 %
1787 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1788 %        const char *comment)
1789 %
1790 %  A description of each parameter follows:
1791 %
1792 %    o wand: the magick wand.
1793 %
1794 %    o comment: the image comment.
1795 %
1796 */
MagickCommentImage(MagickWand * wand,const char * comment)1797 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1798   const char *comment)
1799 {
1800   MagickBooleanType
1801     status;
1802 
1803   assert(wand != (MagickWand *) NULL);
1804   assert(wand->signature == WandSignature);
1805   if (wand->debug != MagickFalse)
1806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1807   if (wand->images == (Image *) NULL)
1808     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1809   status=SetImageProperty(wand->images,"comment",comment);
1810   if (status == MagickFalse)
1811     InheritException(wand->exception,&wand->images->exception);
1812   return(status);
1813 }
1814 
1815 /*
1816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1817 %                                                                             %
1818 %                                                                             %
1819 %                                                                             %
1820 %   M a g i c k C o m p a r e I m a g e C h a n n e l s                       %
1821 %                                                                             %
1822 %                                                                             %
1823 %                                                                             %
1824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1825 %
1826 %  MagickCompareImageChannels() compares one or more image channels of an image
1827 %  to a reconstructed image and returns the difference image.
1828 %
1829 %  The format of the MagickCompareImageChannels method is:
1830 %
1831 %      MagickWand *MagickCompareImageChannels(MagickWand *wand,
1832 %        const MagickWand *reference,const ChannelType channel,
1833 %        const MetricType metric,double *distortion)
1834 %
1835 %  A description of each parameter follows:
1836 %
1837 %    o wand: the magick wand.
1838 %
1839 %    o reference: the reference wand.
1840 %
1841 %    o channel: the channel.
1842 %
1843 %    o metric: the metric.
1844 %
1845 %    o distortion: the computed distortion between the images.
1846 %
1847 */
MagickCompareImageChannels(MagickWand * wand,const MagickWand * reference,const ChannelType channel,const MetricType metric,double * distortion)1848 WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
1849   const MagickWand *reference,const ChannelType channel,const MetricType metric,
1850   double *distortion)
1851 {
1852   Image
1853     *compare_image;
1854 
1855   assert(wand != (MagickWand *) NULL);
1856   assert(wand->signature == WandSignature);
1857   if (wand->debug != MagickFalse)
1858     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1859   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1860     {
1861       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1862         "ContainsNoImages","`%s'",wand->name);
1863       return((MagickWand *) NULL);
1864     }
1865   compare_image=CompareImageChannels(wand->images,reference->images,channel,
1866     metric,distortion,&wand->images->exception);
1867   if (compare_image == (Image *) NULL)
1868     return((MagickWand *) NULL);
1869   return(CloneMagickWandFromImages(wand,compare_image));
1870 }
1871 
1872 /*
1873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1874 %                                                                             %
1875 %                                                                             %
1876 %                                                                             %
1877 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1878 %                                                                             %
1879 %                                                                             %
1880 %                                                                             %
1881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1882 %
1883 %  MagickCompareImageLayers() compares each image with the next in a sequence
1884 %  and returns the maximum bounding region of any pixel differences it
1885 %  discovers.
1886 %
1887 %  The format of the MagickCompareImageLayers method is:
1888 %
1889 %      MagickWand *MagickCompareImageLayers(MagickWand *wand,
1890 %        const ImageLayerMethod method)
1891 %
1892 %  A description of each parameter follows:
1893 %
1894 %    o wand: the magick wand.
1895 %
1896 %    o method: the compare method.
1897 %
1898 */
MagickCompareImageLayers(MagickWand * wand,const ImageLayerMethod method)1899 WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
1900   const ImageLayerMethod method)
1901 {
1902   Image
1903     *layers_image;
1904 
1905   assert(wand != (MagickWand *) NULL);
1906   assert(wand->signature == WandSignature);
1907   if (wand->debug != MagickFalse)
1908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1909   if (wand->images == (Image *) NULL)
1910     return((MagickWand *) NULL);
1911   layers_image=CompareImageLayers(wand->images,method,wand->exception);
1912   if (layers_image == (Image *) NULL)
1913     return((MagickWand *) NULL);
1914   return(CloneMagickWandFromImages(wand,layers_image));
1915 }
1916 
1917 /*
1918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1919 %                                                                             %
1920 %                                                                             %
1921 %                                                                             %
1922 %   M a g i c k C o m p a r e I m a g e s                                     %
1923 %                                                                             %
1924 %                                                                             %
1925 %                                                                             %
1926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1927 %
1928 %  MagickCompareImages() compares an image to a reconstructed image and returns
1929 %  the specified difference image.
1930 %
1931 %  The format of the MagickCompareImages method is:
1932 %
1933 %      MagickWand *MagickCompareImages(MagickWand *wand,
1934 %        const MagickWand *reference,const MetricType metric,double *distortion)
1935 %
1936 %  A description of each parameter follows:
1937 %
1938 %    o wand: the magick wand.
1939 %
1940 %    o reference: the reference wand.
1941 %
1942 %    o metric: the metric.
1943 %
1944 %    o distortion: the computed distortion between the images.
1945 %
1946 */
MagickCompareImages(MagickWand * wand,const MagickWand * reference,const MetricType metric,double * distortion)1947 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1948   const MagickWand *reference,const MetricType metric,double *distortion)
1949 {
1950   Image
1951     *compare_image;
1952 
1953 
1954   assert(wand != (MagickWand *) NULL);
1955   assert(wand->signature == WandSignature);
1956   if (wand->debug != MagickFalse)
1957     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1958   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1959     {
1960       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1961         "ContainsNoImages","`%s'",wand->name);
1962       return((MagickWand *) NULL);
1963     }
1964   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1965     &wand->images->exception);
1966   if (compare_image == (Image *) NULL)
1967     return((MagickWand *) NULL);
1968   return(CloneMagickWandFromImages(wand,compare_image));
1969 }
1970 
1971 /*
1972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1973 %                                                                             %
1974 %                                                                             %
1975 %                                                                             %
1976 %   M a g i c k C o m p o s i t e I m a g e                                   %
1977 %                                                                             %
1978 %                                                                             %
1979 %                                                                             %
1980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1981 %
1982 %  MagickCompositeImage() composite one image onto another at the specified
1983 %  offset.
1984 %
1985 %  The format of the MagickCompositeImage method is:
1986 %
1987 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1988 %        const MagickWand *source_wand,const CompositeOperator compose,
1989 %        const ssize_t x,const ssize_t y)
1990 %      MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1991 %        const ChannelType channel,const MagickWand *composite_wand,
1992 %        const CompositeOperator compose,const ssize_t x,const ssize_t y)
1993 %
1994 %  A description of each parameter follows:
1995 %
1996 %    o wand: the magick wand holding the destination images
1997 %
1998 %    o source_image: the magick wand holding source image.
1999 %
2000 %    o compose: This operator affects how the composite is applied to the
2001 %      image.  The default is Over.  These are some of the compose methods
2002 %      availble.
2003 %
2004 %        OverCompositeOp       InCompositeOp         OutCompositeOp
2005 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
2006 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
2007 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
2008 %        DisplaceCompositeOp
2009 %
2010 %    o x: the column offset of the composited image.
2011 %
2012 %    o y: the row offset of the composited image.
2013 %
2014 */
MagickCompositeImage(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const ssize_t x,const ssize_t y)2015 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
2016   const MagickWand *source_wand,const CompositeOperator compose,const ssize_t x,
2017   const ssize_t y)
2018 {
2019   MagickBooleanType
2020     status;
2021 
2022   status=MagickCompositeImageChannel(wand,DefaultChannels,source_wand,
2023     compose,x,y);
2024   return(status);
2025 }
2026 
MagickCompositeImageChannel(MagickWand * wand,const ChannelType channel,const MagickWand * source_wand,const CompositeOperator compose,const ssize_t x,const ssize_t y)2027 WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
2028   const ChannelType channel,const MagickWand *source_wand,
2029   const CompositeOperator compose,const ssize_t x,const ssize_t y)
2030 {
2031   MagickBooleanType
2032     status;
2033 
2034   assert(wand != (MagickWand *) NULL);
2035   assert(wand->signature == WandSignature);
2036   if (wand->debug != MagickFalse)
2037     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2038   if ((wand->images == (Image *) NULL) ||
2039       (source_wand->images == (Image *) NULL))
2040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2041   status=CompositeImageChannel(wand->images,channel,compose,
2042     source_wand->images,x,y);
2043   if (status == MagickFalse)
2044     InheritException(wand->exception,&wand->images->exception);
2045   return(status);
2046 }
2047 
2048 /*
2049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2050 %                                                                             %
2051 %                                                                             %
2052 %                                                                             %
2053 %   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                     %
2054 %                                                                             %
2055 %                                                                             %
2056 %                                                                             %
2057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2058 %
2059 %  MagickCompositeImageGravity() composite one image onto another using the
2060 %  specified gravity.
2061 %
2062 %  The format of the MagickCompositeImageGravity method is:
2063 %
2064 %      MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2065 %        const MagickWand *source_wand,const CompositeOperator compose,
2066 %        const GravityType gravity)
2067 %
2068 %  A description of each parameter follows:
2069 %
2070 %    o wand: the magick wand holding the destination images
2071 %
2072 %    o source_image: the magick wand holding source image.
2073 %
2074 %    o compose: This operator affects how the composite is applied to the
2075 %      image.  The default is Over.  These are some of the compose methods
2076 %      availble.
2077 %
2078 %        OverCompositeOp       InCompositeOp         OutCompositeOp
2079 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
2080 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
2081 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
2082 %        DisplaceCompositeOp
2083 %
2084 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
2085 %               NorthEastGravity, WestGravity, CenterGravity,
2086 %               EastGravity, SouthWestGravity, SouthGravity,
2087 %               SouthEastGravity)
2088 %
2089 */
MagickCompositeImageGravity(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const GravityType gravity)2090 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
2091   const MagickWand *source_wand,const CompositeOperator compose,
2092   const GravityType gravity)
2093 {
2094   MagickBooleanType
2095     status;
2096 
2097   RectangleInfo
2098     geometry;
2099 
2100   assert(wand != (MagickWand *) NULL);
2101   assert(wand->signature == WandSignature);
2102   if (wand->debug != MagickFalse)
2103     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2104   if ((wand->images == (Image *) NULL) ||
2105       (source_wand->images == (Image *) NULL))
2106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2107   SetGeometry(source_wand->images,&geometry);
2108   GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
2109     &geometry);
2110   status=CompositeImage(wand->images,compose,source_wand->images,geometry.x,
2111     geometry.y);
2112   return(status);
2113 }
2114 
2115 /*
2116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2117 %                                                                             %
2118 %                                                                             %
2119 %                                                                             %
2120 %   M a g i c k C o m p o s i t e L a y e r s                                 %
2121 %                                                                             %
2122 %                                                                             %
2123 %                                                                             %
2124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2125 %
2126 %  MagickCompositeLayers() composite the images in the source wand over the
2127 %  images in the destination wand in sequence, starting with the current
2128 %  image in both lists.
2129 %
2130 %  Each layer from the two image lists are composted together until the end of
2131 %  one of the image lists is reached.  The offset of each composition is also
2132 %  adjusted to match the virtual canvas offsets of each layer. As such the
2133 %  given offset is relative to the virtual canvas, and not the actual image.
2134 %
2135 %  Composition uses given x and y offsets, as the 'origin' location of the
2136 %  source images virtual canvas (not the real image) allowing you to compose a
2137 %  list of 'layer images' into the destiantioni images.  This makes it well
2138 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
2139 %  Animations' onto a static or other 'Coaleased Animation' destination image
2140 %  list.  GIF disposal handling is not looked at.
2141 %
2142 %  Special case:- If one of the image sequences is the last image (just a
2143 %  single image remaining), that image is repeatally composed with all the
2144 %  images in the other image list.  Either the source or destination lists may
2145 %  be the single image, for this situation.
2146 %
2147 %  In the case of a single destination image (or last image given), that image
2148 %  will ve cloned to match the number of images remaining in the source image
2149 %  list.
2150 %
2151 %  This is equivelent to the "-layer Composite" Shell API operator.
2152 %
2153 %  The format of the MagickCompositeLayers method is:
2154 %
2155 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2156 %        const MagickWand *source_wand, const CompositeOperator compose,
2157 %        const ssize_t x,const ssize_t y)
2158 %
2159 %  A description of each parameter follows:
2160 %
2161 %    o wand: the magick wand holding destaintion images
2162 %
2163 %    o source_wand: the wand holding the source images
2164 %
2165 %    o compose, x, y:  composition arguments
2166 %
2167 */
MagickCompositeLayers(MagickWand * wand,const MagickWand * source_wand,const CompositeOperator compose,const ssize_t x,const ssize_t y)2168 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2169   const MagickWand *source_wand,const CompositeOperator compose,const ssize_t x,
2170   const ssize_t y)
2171 {
2172   MagickBooleanType
2173     status;
2174 
2175   assert(wand != (MagickWand *) NULL);
2176   assert(wand->signature == WandSignature);
2177   if (wand->debug != MagickFalse)
2178     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2179   if ((wand->images == (Image *) NULL) ||
2180       (source_wand->images == (Image *) NULL))
2181     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2182   CompositeLayers(wand->images,compose,source_wand->images,x,y,
2183     &wand->images->exception);
2184   status=MagickTrue;  /* FUTURE: determine status from exceptions */
2185   return(status);
2186 }
2187 
2188 /*
2189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2190 %                                                                             %
2191 %                                                                             %
2192 %                                                                             %
2193 %   M a g i c k C o n t r a s t I m a g e                                     %
2194 %                                                                             %
2195 %                                                                             %
2196 %                                                                             %
2197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2198 %
2199 %  MagickContrastImage() enhances the intensity differences between the lighter
2200 %  and darker elements of the image.  Set sharpen to a value other than 0 to
2201 %  increase the image contrast otherwise the contrast is reduced.
2202 %
2203 %  The format of the MagickContrastImage method is:
2204 %
2205 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
2206 %        const MagickBooleanType sharpen)
2207 %
2208 %  A description of each parameter follows:
2209 %
2210 %    o wand: the magick wand.
2211 %
2212 %    o sharpen: Increase or decrease image contrast.
2213 %
2214 %
2215 */
MagickContrastImage(MagickWand * wand,const MagickBooleanType sharpen)2216 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2217   const MagickBooleanType sharpen)
2218 {
2219   MagickBooleanType
2220     status;
2221 
2222   assert(wand != (MagickWand *) NULL);
2223   assert(wand->signature == WandSignature);
2224   if (wand->debug != MagickFalse)
2225     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2226   if (wand->images == (Image *) NULL)
2227     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2228   status=ContrastImage(wand->images,sharpen);
2229   if (status == MagickFalse)
2230     InheritException(wand->exception,&wand->images->exception);
2231   return(status);
2232 }
2233 
2234 /*
2235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2236 %                                                                             %
2237 %                                                                             %
2238 %                                                                             %
2239 %   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                       %
2240 %                                                                             %
2241 %                                                                             %
2242 %                                                                             %
2243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2244 %
2245 %  MagickContrastStretchImage() enhances the contrast of a color image by
2246 %  adjusting the pixels color to span the entire range of colors available.
2247 %  You can also reduce the influence of a particular channel with a gamma
2248 %  value of 0.
2249 %
2250 %  The format of the MagickContrastStretchImage method is:
2251 %
2252 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2253 %        const double black_point,const double white_point)
2254 %      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2255 %        const ChannelType channel,const double black_point,
2256 %        const double white_point)
2257 %
2258 %  A description of each parameter follows:
2259 %
2260 %    o wand: the magick wand.
2261 %
2262 %    o channel: the image channel(s).
2263 %
2264 %    o black_point: the black point.
2265 %
2266 %    o white_point: the white point.
2267 %
2268 */
2269 
MagickContrastStretchImage(MagickWand * wand,const double black_point,const double white_point)2270 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2271   const double black_point,const double white_point)
2272 {
2273   MagickBooleanType
2274     status;
2275 
2276   status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
2277     white_point);
2278   return(status);
2279 }
2280 
MagickContrastStretchImageChannel(MagickWand * wand,const ChannelType channel,const double black_point,const double white_point)2281 WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2282   const ChannelType channel,const double black_point,const double white_point)
2283 {
2284   MagickBooleanType
2285     status;
2286 
2287   assert(wand != (MagickWand *) NULL);
2288   assert(wand->signature == WandSignature);
2289   if (wand->debug != MagickFalse)
2290     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2291   if (wand->images == (Image *) NULL)
2292     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2293   status=ContrastStretchImageChannel(wand->images,channel,black_point,
2294     white_point);
2295   if (status == MagickFalse)
2296     InheritException(wand->exception,&wand->images->exception);
2297   return(status);
2298 }
2299 
2300 /*
2301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2302 %                                                                             %
2303 %                                                                             %
2304 %                                                                             %
2305 %   M a g i c k C o n v o l v e I m a g e                                     %
2306 %                                                                             %
2307 %                                                                             %
2308 %                                                                             %
2309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2310 %
2311 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2312 %
2313 %  The format of the MagickConvolveImage method is:
2314 %
2315 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2316 %        const size_t order,const double *kernel)
2317 %      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2318 %        const ChannelType channel,const size_t order,
2319 %        const double *kernel)
2320 %
2321 %  A description of each parameter follows:
2322 %
2323 %    o wand: the magick wand.
2324 %
2325 %    o channel: the image channel(s).
2326 %
2327 %    o order: the number of columns and rows in the filter kernel.
2328 %
2329 %    o kernel: An array of doubles representing the convolution kernel.
2330 %
2331 */
2332 
MagickConvolveImage(MagickWand * wand,const size_t order,const double * kernel)2333 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2334   const size_t order,const double *kernel)
2335 {
2336   MagickBooleanType
2337     status;
2338 
2339   status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2340   return(status);
2341 }
2342 
MagickConvolveImageChannel(MagickWand * wand,const ChannelType channel,const size_t order,const double * kernel)2343 WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2344   const ChannelType channel,const size_t order,const double *kernel)
2345 {
2346   Image
2347     *convolve_image;
2348 
2349   assert(wand != (MagickWand *) NULL);
2350   assert(wand->signature == WandSignature);
2351   if (wand->debug != MagickFalse)
2352     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2353   if (kernel == (const double *) NULL)
2354     return(MagickFalse);
2355   if (wand->images == (Image *) NULL)
2356     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2357   convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2358     wand->exception);
2359   if (convolve_image == (Image *) NULL)
2360     return(MagickFalse);
2361   ReplaceImageInList(&wand->images,convolve_image);
2362   return(MagickTrue);
2363 }
2364 
2365 /*
2366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2367 %                                                                             %
2368 %                                                                             %
2369 %                                                                             %
2370 %   M a g i c k C r o p I m a g e                                             %
2371 %                                                                             %
2372 %                                                                             %
2373 %                                                                             %
2374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375 %
2376 %  MagickCropImage() extracts a region of the image.
2377 %
2378 %  The format of the MagickCropImage method is:
2379 %
2380 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2381 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2382 %
2383 %  A description of each parameter follows:
2384 %
2385 %    o wand: the magick wand.
2386 %
2387 %    o width: the region width.
2388 %
2389 %    o height: the region height.
2390 %
2391 %    o x: the region x-offset.
2392 %
2393 %    o y: the region y-offset.
2394 %
2395 */
MagickCropImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)2396 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2397   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2398 {
2399   Image
2400     *crop_image;
2401 
2402   RectangleInfo
2403     crop;
2404 
2405   assert(wand != (MagickWand *) NULL);
2406   assert(wand->signature == WandSignature);
2407   if (wand->debug != MagickFalse)
2408     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2409   if (wand->images == (Image *) NULL)
2410     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2411   crop.width=width;
2412   crop.height=height;
2413   crop.x=x;
2414   crop.y=y;
2415   crop_image=CropImage(wand->images,&crop,wand->exception);
2416   if (crop_image == (Image *) NULL)
2417     return(MagickFalse);
2418   ReplaceImageInList(&wand->images,crop_image);
2419   return(MagickTrue);
2420 }
2421 
2422 /*
2423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2424 %                                                                             %
2425 %                                                                             %
2426 %                                                                             %
2427 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2428 %                                                                             %
2429 %                                                                             %
2430 %                                                                             %
2431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2432 %
2433 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2434 %  of positions.  If you cycle the colormap a number of times you can produce
2435 %  a psychodelic effect.
2436 %
2437 %  The format of the MagickCycleColormapImage method is:
2438 %
2439 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2440 %        const ssize_t displace)
2441 %
2442 %  A description of each parameter follows:
2443 %
2444 %    o wand: the magick wand.
2445 %
2446 %    o pixel_wand: the pixel wand.
2447 %
2448 */
MagickCycleColormapImage(MagickWand * wand,const ssize_t displace)2449 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2450   const ssize_t displace)
2451 {
2452   MagickBooleanType
2453     status;
2454 
2455   assert(wand != (MagickWand *) NULL);
2456   assert(wand->signature == WandSignature);
2457   if (wand->debug != MagickFalse)
2458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2459   if (wand->images == (Image *) NULL)
2460     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2461   status=CycleColormapImage(wand->images,displace);
2462   if (status == MagickFalse)
2463     InheritException(wand->exception,&wand->images->exception);
2464   return(status);
2465 }
2466 
2467 /*
2468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2469 %                                                                             %
2470 %                                                                             %
2471 %                                                                             %
2472 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2473 %                                                                             %
2474 %                                                                             %
2475 %                                                                             %
2476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2477 %
2478 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2479 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2480 %  The data can be char, short int, int, float, or double.  Float and double
2481 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2482 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2483 %  example, to create a 640x480 image from unsigned red-green-blue character
2484 %  data, use
2485 %
2486 %      MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2487 %
2488 %  The format of the MagickConstituteImage method is:
2489 %
2490 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2491 %        const size_t columns,const size_t rows,const char *map,
2492 %        const StorageType storage,void *pixels)
2493 %
2494 %  A description of each parameter follows:
2495 %
2496 %    o wand: the magick wand.
2497 %
2498 %    o columns: width in pixels of the image.
2499 %
2500 %    o rows: height in pixels of the image.
2501 %
2502 %    o map:  This string reflects the expected ordering of the pixel array.
2503 %      It can be any combination or order of R = red, G = green, B = blue,
2504 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2505 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2506 %      P = pad.
2507 %
2508 %    o storage: Define the data type of the pixels.  Float and double types are
2509 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2510 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2511 %      LongPixel, QuantumPixel, or ShortPixel.
2512 %
2513 %    o pixels: This array of values contain the pixel components as defined by
2514 %      map and type.  You must preallocate this array where the expected
2515 %      length varies depending on the values of width, height, map, and type.
2516 %
2517 */
MagickConstituteImage(MagickWand * wand,const size_t columns,const size_t rows,const char * map,const StorageType storage,const void * pixels)2518 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2519   const size_t columns,const size_t rows,const char *map,
2520   const StorageType storage,const void *pixels)
2521 {
2522   Image
2523     *images;
2524 
2525   assert(wand != (MagickWand *) NULL);
2526   assert(wand->signature == WandSignature);
2527   if (wand->debug != MagickFalse)
2528     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2529   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2530   if (images == (Image *) NULL)
2531     return(MagickFalse);
2532   return(InsertImageInWand(wand,images));
2533 }
2534 
2535 /*
2536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2537 %                                                                             %
2538 %                                                                             %
2539 %                                                                             %
2540 %   M a g i c k D e c i p h e r I m a g e                                     %
2541 %                                                                             %
2542 %                                                                             %
2543 %                                                                             %
2544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2545 %
2546 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2547 %
2548 %  The format of the MagickDecipherImage method is:
2549 %
2550 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2551 %        const char *passphrase)
2552 %
2553 %  A description of each parameter follows:
2554 %
2555 %    o wand: the magick wand.
2556 %
2557 %    o passphrase: the passphrase.
2558 %
2559 */
MagickDecipherImage(MagickWand * wand,const char * passphrase)2560 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2561   const char *passphrase)
2562 {
2563   assert(wand != (MagickWand *) NULL);
2564   assert(wand->signature == WandSignature);
2565   if (wand->debug != MagickFalse)
2566     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2567   if (wand->images == (Image *) NULL)
2568     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2569   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2570 }
2571 
2572 /*
2573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2574 %                                                                             %
2575 %                                                                             %
2576 %                                                                             %
2577 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2578 %                                                                             %
2579 %                                                                             %
2580 %                                                                             %
2581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2582 %
2583 %  MagickDeconstructImages() compares each image with the next in a sequence
2584 %  and returns the maximum bounding region of any pixel differences it
2585 %  discovers.
2586 %
2587 %  The format of the MagickDeconstructImages method is:
2588 %
2589 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2590 %
2591 %  A description of each parameter follows:
2592 %
2593 %    o wand: the magick wand.
2594 %
2595 */
MagickDeconstructImages(MagickWand * wand)2596 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2597 {
2598   Image
2599     *deconstruct_image;
2600 
2601   assert(wand != (MagickWand *) NULL);
2602   assert(wand->signature == WandSignature);
2603   if (wand->debug != MagickFalse)
2604     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2605   if (wand->images == (Image *) NULL)
2606     return((MagickWand *) NULL);
2607   deconstruct_image=DeconstructImages(wand->images,wand->exception);
2608   if (deconstruct_image == (Image *) NULL)
2609     return((MagickWand *) NULL);
2610   return(CloneMagickWandFromImages(wand,deconstruct_image));
2611 }
2612 
2613 /*
2614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2615 %                                                                             %
2616 %                                                                             %
2617 %                                                                             %
2618 %     M a g i c k D e s k e w I m a g e                                       %
2619 %                                                                             %
2620 %                                                                             %
2621 %                                                                             %
2622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2623 %
2624 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2625 %  occurs in scanned images because of the camera being misaligned,
2626 %  imperfections in the scanning or surface, or simply because the paper was
2627 %  not placed completely flat when scanned.
2628 %
2629 %  The format of the MagickDeskewImage method is:
2630 %
2631 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2632 %        const double threshold)
2633 %
2634 %  A description of each parameter follows:
2635 %
2636 %    o wand: the magick wand.
2637 %
2638 %    o threshold: separate background from foreground.
2639 %
2640 */
MagickDeskewImage(MagickWand * wand,const double threshold)2641 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2642   const double threshold)
2643 {
2644   Image
2645     *sepia_image;
2646 
2647   assert(wand != (MagickWand *) NULL);
2648   assert(wand->signature == WandSignature);
2649   if (wand->debug != MagickFalse)
2650     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2651   if (wand->images == (Image *) NULL)
2652     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2653   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2654   if (sepia_image == (Image *) NULL)
2655     return(MagickFalse);
2656   ReplaceImageInList(&wand->images,sepia_image);
2657   return(MagickTrue);
2658 }
2659 
2660 /*
2661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2662 %                                                                             %
2663 %                                                                             %
2664 %                                                                             %
2665 %     M a g i c k D e s p e c k l e I m a g e                                 %
2666 %                                                                             %
2667 %                                                                             %
2668 %                                                                             %
2669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2670 %
2671 %  MagickDespeckleImage() reduces the speckle noise in an image while
2672 %  perserving the edges of the original image.
2673 %
2674 %  The format of the MagickDespeckleImage method is:
2675 %
2676 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2677 %
2678 %  A description of each parameter follows:
2679 %
2680 %    o wand: the magick wand.
2681 %
2682 */
MagickDespeckleImage(MagickWand * wand)2683 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2684 {
2685   Image
2686     *despeckle_image;
2687 
2688   assert(wand != (MagickWand *) NULL);
2689   assert(wand->signature == WandSignature);
2690   if (wand->debug != MagickFalse)
2691     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2692   if (wand->images == (Image *) NULL)
2693     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2694   despeckle_image=DespeckleImage(wand->images,wand->exception);
2695   if (despeckle_image == (Image *) NULL)
2696     return(MagickFalse);
2697   ReplaceImageInList(&wand->images,despeckle_image);
2698   return(MagickTrue);
2699 }
2700 
2701 /*
2702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2703 %                                                                             %
2704 %                                                                             %
2705 %                                                                             %
2706 %   M a g i c k D e s t r o y I m a g e                                       %
2707 %                                                                             %
2708 %                                                                             %
2709 %                                                                             %
2710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2711 %
2712 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2713 %  with the image if the reference count becomes zero.
2714 %
2715 %  The format of the MagickDestroyImage method is:
2716 %
2717 %      Image *MagickDestroyImage(Image *image)
2718 %
2719 %  A description of each parameter follows:
2720 %
2721 %    o image: the image.
2722 %
2723 */
MagickDestroyImage(Image * image)2724 WandExport Image *MagickDestroyImage(Image *image)
2725 {
2726   return(DestroyImage(image));
2727 }
2728 
2729 /*
2730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2731 %                                                                             %
2732 %                                                                             %
2733 %                                                                             %
2734 %   M a g i c k D i s p l a y I m a g e                                       %
2735 %                                                                             %
2736 %                                                                             %
2737 %                                                                             %
2738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2739 %
2740 %  MagickDisplayImage() displays an image.
2741 %
2742 %  The format of the MagickDisplayImage method is:
2743 %
2744 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2745 %        const char *server_name)
2746 %
2747 %  A description of each parameter follows:
2748 %
2749 %    o wand: the magick wand.
2750 %
2751 %    o server_name: the X server name.
2752 %
2753 */
MagickDisplayImage(MagickWand * wand,const char * server_name)2754 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2755   const char *server_name)
2756 {
2757   Image
2758     *image;
2759 
2760   MagickBooleanType
2761     status;
2762 
2763   assert(wand != (MagickWand *) NULL);
2764   assert(wand->signature == WandSignature);
2765   if (wand->debug != MagickFalse)
2766     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2767   if (wand->images == (Image *) NULL)
2768     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2769   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2770   if (image == (Image *) NULL)
2771     return(MagickFalse);
2772   (void) CloneString(&wand->image_info->server_name,server_name);
2773   status=DisplayImages(wand->image_info,image);
2774   if (status == MagickFalse)
2775     InheritException(wand->exception,&image->exception);
2776   image=DestroyImage(image);
2777   return(status);
2778 }
2779 
2780 /*
2781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2782 %                                                                             %
2783 %                                                                             %
2784 %                                                                             %
2785 %   M a g i c k D i s p l a y I m a g e s                                     %
2786 %                                                                             %
2787 %                                                                             %
2788 %                                                                             %
2789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2790 %
2791 %  MagickDisplayImages() displays an image or image sequence.
2792 %
2793 %  The format of the MagickDisplayImages method is:
2794 %
2795 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2796 %        const char *server_name)
2797 %
2798 %  A description of each parameter follows:
2799 %
2800 %    o wand: the magick wand.
2801 %
2802 %    o server_name: the X server name.
2803 %
2804 */
MagickDisplayImages(MagickWand * wand,const char * server_name)2805 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2806   const char *server_name)
2807 {
2808   MagickBooleanType
2809     status;
2810 
2811   assert(wand != (MagickWand *) NULL);
2812   assert(wand->signature == WandSignature);
2813   if (wand->debug != MagickFalse)
2814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2815   (void) CloneString(&wand->image_info->server_name,server_name);
2816   status=DisplayImages(wand->image_info,wand->images);
2817   if (status == MagickFalse)
2818     InheritException(wand->exception,&wand->images->exception);
2819   return(status);
2820 }
2821 
2822 /*
2823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2824 %                                                                             %
2825 %                                                                             %
2826 %                                                                             %
2827 %   M a g i c k D i s t o r t I m a g e                                       %
2828 %                                                                             %
2829 %                                                                             %
2830 %                                                                             %
2831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2832 %
2833 %  MagickDistortImage() distorts an image using various distortion methods, by
2834 %  mapping color lookups of the source image to a new destination image
2835 %  usally of the same size as the source image, unless 'bestfit' is set to
2836 %  true.
2837 %
2838 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2839 %  adjusted to ensure the whole source 'image' will just fit within the final
2840 %  destination image, which will be sized and offset accordingly.  Also in
2841 %  many cases the virtual offset of the source image will be taken into
2842 %  account in the mapping.
2843 %
2844 %  The format of the MagickDistortImage method is:
2845 %
2846 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2847 %        const DistortImageMethod method,const size_t number_arguments,
2848 %        const double *arguments,const MagickBooleanType bestfit)
2849 %
2850 %  A description of each parameter follows:
2851 %
2852 %    o image: the image to be distorted.
2853 %
2854 %    o method: the method of image distortion.
2855 %
2856 %        ArcDistortion always ignores the source image offset, and always
2857 %        'bestfit' the destination image with the top left corner offset
2858 %        relative to the polar mapping center.
2859 %
2860 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2861 %        style of image distortion.
2862 %
2863 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2864 %        distortion when more than the minimum number of control point pairs
2865 %        are provided.
2866 %
2867 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2868 %        that 4 control point pairs are provided. While Affine distortions let
2869 %        you use any number of control point pairs, that is Zero pairs is a
2870 %        no-Op (viewport only) distrotion, one pair is a translation and two
2871 %        pairs of control points do a scale-rotate-translate, without any
2872 %        shearing.
2873 %
2874 %    o number_arguments: the number of arguments given for this distortion
2875 %      method.
2876 %
2877 %    o arguments: the arguments for this distortion method.
2878 %
2879 %    o bestfit: Attempt to resize destination to fit distorted source.
2880 %
2881 */
MagickDistortImage(MagickWand * wand,const DistortImageMethod method,const size_t number_arguments,const double * arguments,const MagickBooleanType bestfit)2882 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2883   const DistortImageMethod method,const size_t number_arguments,
2884   const double *arguments,const MagickBooleanType bestfit)
2885 {
2886   Image
2887     *distort_image;
2888 
2889   assert(wand != (MagickWand *) NULL);
2890   assert(wand->signature == WandSignature);
2891   if (wand->debug != MagickFalse)
2892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2893   if (wand->images == (Image *) NULL)
2894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2895   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2896     bestfit,wand->exception);
2897   if (distort_image == (Image *) NULL)
2898     return(MagickFalse);
2899   ReplaceImageInList(&wand->images,distort_image);
2900   return(MagickTrue);
2901 }
2902 
2903 /*
2904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2905 %                                                                             %
2906 %                                                                             %
2907 %                                                                             %
2908 %   M a g i c k D r a w I m a g e                                             %
2909 %                                                                             %
2910 %                                                                             %
2911 %                                                                             %
2912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2913 %
2914 %  MagickDrawImage() renders the drawing wand on the current image.
2915 %
2916 %  The format of the MagickDrawImage method is:
2917 %
2918 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2919 %        const DrawingWand *drawing_wand)
2920 %
2921 %  A description of each parameter follows:
2922 %
2923 %    o wand: the magick wand.
2924 %
2925 %    o drawing_wand: the draw wand.
2926 %
2927 */
MagickDrawImage(MagickWand * wand,const DrawingWand * drawing_wand)2928 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2929   const DrawingWand *drawing_wand)
2930 {
2931   char
2932     *primitive;
2933 
2934   DrawInfo
2935     *draw_info;
2936 
2937   MagickBooleanType
2938     status;
2939 
2940   assert(wand != (MagickWand *) NULL);
2941   assert(wand->signature == WandSignature);
2942   if (wand->debug != MagickFalse)
2943     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2944   if (wand->images == (Image *) NULL)
2945     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2946   draw_info=PeekDrawingWand(drawing_wand);
2947   if ((draw_info == (DrawInfo *) NULL) ||
2948       (draw_info->primitive == (char *) NULL))
2949     return(MagickFalse);
2950   primitive=AcquireString(draw_info->primitive);
2951   draw_info=DestroyDrawInfo(draw_info);
2952   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2953   draw_info->primitive=primitive;
2954   status=DrawImage(wand->images,draw_info);
2955   if (status == MagickFalse)
2956     InheritException(wand->exception,&wand->images->exception);
2957   draw_info=DestroyDrawInfo(draw_info);
2958   return(status);
2959 }
2960 
2961 /*
2962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2963 %                                                                             %
2964 %                                                                             %
2965 %                                                                             %
2966 %   M a g i c k E d g e I m a g e                                             %
2967 %                                                                             %
2968 %                                                                             %
2969 %                                                                             %
2970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2971 %
2972 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2973 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2974 %  radius for you.
2975 %
2976 %  The format of the MagickEdgeImage method is:
2977 %
2978 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2979 %
2980 %  A description of each parameter follows:
2981 %
2982 %    o wand: the magick wand.
2983 %
2984 %    o radius: the radius of the pixel neighborhood.
2985 %
2986 */
MagickEdgeImage(MagickWand * wand,const double radius)2987 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2988   const double radius)
2989 {
2990   Image
2991     *edge_image;
2992 
2993   assert(wand != (MagickWand *) NULL);
2994   assert(wand->signature == WandSignature);
2995   if (wand->debug != MagickFalse)
2996     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2997   if (wand->images == (Image *) NULL)
2998     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2999   edge_image=EdgeImage(wand->images,radius,wand->exception);
3000   if (edge_image == (Image *) NULL)
3001     return(MagickFalse);
3002   ReplaceImageInList(&wand->images,edge_image);
3003   return(MagickTrue);
3004 }
3005 
3006 /*
3007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3008 %                                                                             %
3009 %                                                                             %
3010 %                                                                             %
3011 %   M a g i c k E m b o s s I m a g e                                         %
3012 %                                                                             %
3013 %                                                                             %
3014 %                                                                             %
3015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3016 %
3017 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
3018 %  effect.  We convolve the image with a Gaussian operator of the given radius
3019 %  and standard deviation (sigma).  For reasonable results, radius should be
3020 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
3021 %  radius for you.
3022 %
3023 %  The format of the MagickEmbossImage method is:
3024 %
3025 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
3026 %        const double sigma)
3027 %
3028 %  A description of each parameter follows:
3029 %
3030 %    o wand: the magick wand.
3031 %
3032 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3033 %      pixel.
3034 %
3035 %    o sigma: the standard deviation of the Gaussian, in pixels.
3036 %
3037 */
MagickEmbossImage(MagickWand * wand,const double radius,const double sigma)3038 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
3039   const double radius,const double sigma)
3040 {
3041   Image
3042     *emboss_image;
3043 
3044   assert(wand != (MagickWand *) NULL);
3045   assert(wand->signature == WandSignature);
3046   if (wand->debug != MagickFalse)
3047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3048   if (wand->images == (Image *) NULL)
3049     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3050   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
3051   if (emboss_image == (Image *) NULL)
3052     return(MagickFalse);
3053   ReplaceImageInList(&wand->images,emboss_image);
3054   return(MagickTrue);
3055 }
3056 
3057 /*
3058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3059 %                                                                             %
3060 %                                                                             %
3061 %                                                                             %
3062 %   M a g i c k E n c i p h e r I m a g e                                     %
3063 %                                                                             %
3064 %                                                                             %
3065 %                                                                             %
3066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3067 %
3068 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
3069 %
3070 %  The format of the MagickEncipherImage method is:
3071 %
3072 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
3073 %        const char *passphrase)
3074 %
3075 %  A description of each parameter follows:
3076 %
3077 %    o wand: the magick wand.
3078 %
3079 %    o passphrase: the passphrase.
3080 %
3081 */
MagickEncipherImage(MagickWand * wand,const char * passphrase)3082 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
3083   const char *passphrase)
3084 {
3085   assert(wand != (MagickWand *) NULL);
3086   assert(wand->signature == WandSignature);
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   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
3092 }
3093 
3094 /*
3095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3096 %                                                                             %
3097 %                                                                             %
3098 %                                                                             %
3099 %   M a g i c k E n h a n c e I m a g e                                       %
3100 %                                                                             %
3101 %                                                                             %
3102 %                                                                             %
3103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3104 %
3105 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
3106 %  noisy image.
3107 %
3108 %  The format of the MagickEnhanceImage method is:
3109 %
3110 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3111 %
3112 %  A description of each parameter follows:
3113 %
3114 %    o wand: the magick wand.
3115 %
3116 */
MagickEnhanceImage(MagickWand * wand)3117 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
3118 {
3119   Image
3120     *enhance_image;
3121 
3122   assert(wand != (MagickWand *) NULL);
3123   assert(wand->signature == WandSignature);
3124   if (wand->debug != MagickFalse)
3125     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3126   if (wand->images == (Image *) NULL)
3127     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3128   enhance_image=EnhanceImage(wand->images,wand->exception);
3129   if (enhance_image == (Image *) NULL)
3130     return(MagickFalse);
3131   ReplaceImageInList(&wand->images,enhance_image);
3132   return(MagickTrue);
3133 }
3134 
3135 /*
3136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3137 %                                                                             %
3138 %                                                                             %
3139 %                                                                             %
3140 %   M a g i c k E q u a l i z e I m a g e                                     %
3141 %                                                                             %
3142 %                                                                             %
3143 %                                                                             %
3144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3145 %
3146 %  MagickEqualizeImage() equalizes the image histogram.
3147 %
3148 %  The format of the MagickEqualizeImage method is:
3149 %
3150 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3151 %      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
3152 %        const ChannelType channel)
3153 %
3154 %  A description of each parameter follows:
3155 %
3156 %    o wand: the magick wand.
3157 %
3158 %    o channel: the image channel(s).
3159 %
3160 */
3161 
MagickEqualizeImage(MagickWand * wand)3162 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3163 {
3164   MagickBooleanType
3165     status;
3166 
3167   status=MagickEqualizeImageChannel(wand,DefaultChannels);
3168   return(status);
3169 }
3170 
MagickEqualizeImageChannel(MagickWand * wand,const ChannelType channel)3171 WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
3172   const ChannelType channel)
3173 {
3174   MagickBooleanType
3175     status;
3176 
3177   assert(wand != (MagickWand *) NULL);
3178   assert(wand->signature == WandSignature);
3179   if (wand->debug != MagickFalse)
3180     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3181   if (wand->images == (Image *) NULL)
3182     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3183   status=EqualizeImageChannel(wand->images,channel);
3184   if (status == MagickFalse)
3185     InheritException(wand->exception,&wand->images->exception);
3186   return(status);
3187 }
3188 
3189 /*
3190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3191 %                                                                             %
3192 %                                                                             %
3193 %                                                                             %
3194 %   M a g i c k E v a l u a t e I m a g e                                     %
3195 %                                                                             %
3196 %                                                                             %
3197 %                                                                             %
3198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3199 %
3200 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
3201 %  expression to an image.  Use these operators to lighten or darken an image,
3202 %  to increase or decrease contrast in an image, or to produce the "negative"
3203 %  of an image.
3204 %
3205 %  The format of the MagickEvaluateImage method is:
3206 %
3207 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3208 %        const MagickEvaluateOperator operator,const double value)
3209 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3210 %        const MagickEvaluateOperator operator)
3211 %      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3212 %        const ChannelType channel,const MagickEvaluateOperator op,
3213 %        const double value)
3214 %
3215 %  A description of each parameter follows:
3216 %
3217 %    o wand: the magick wand.
3218 %
3219 %    o channel: the channel(s).
3220 %
3221 %    o op: A channel operator.
3222 %
3223 %    o value: A value value.
3224 %
3225 */
3226 
MagickEvaluateImage(MagickWand * wand,const MagickEvaluateOperator op,const double value)3227 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3228   const MagickEvaluateOperator op,const double value)
3229 {
3230   MagickBooleanType
3231     status;
3232 
3233   assert(wand != (MagickWand *) NULL);
3234   assert(wand->signature == WandSignature);
3235   if (wand->debug != MagickFalse)
3236     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3237   if (wand->images == (Image *) NULL)
3238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3239   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
3240   if (status == MagickFalse)
3241     InheritException(wand->exception,&wand->images->exception);
3242   return(status);
3243 }
3244 
MagickEvaluateImages(MagickWand * wand,const MagickEvaluateOperator op)3245 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3246   const MagickEvaluateOperator op)
3247 {
3248   Image
3249     *evaluate_image;
3250 
3251   assert(wand != (MagickWand *) NULL);
3252   assert(wand->signature == WandSignature);
3253   if (wand->debug != MagickFalse)
3254     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3255   if (wand->images == (Image *) NULL)
3256     return((MagickWand *) NULL);
3257   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3258   if (evaluate_image == (Image *) NULL)
3259     return((MagickWand *) NULL);
3260   return(CloneMagickWandFromImages(wand,evaluate_image));
3261 }
3262 
MagickEvaluateImageChannel(MagickWand * wand,const ChannelType channel,const MagickEvaluateOperator op,const double value)3263 WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3264   const ChannelType channel,const MagickEvaluateOperator op,const double value)
3265 {
3266   MagickBooleanType
3267     status;
3268 
3269   assert(wand != (MagickWand *) NULL);
3270   assert(wand->signature == WandSignature);
3271   if (wand->debug != MagickFalse)
3272     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3273   if (wand->images == (Image *) NULL)
3274     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3275   status=EvaluateImageChannel(wand->images,channel,op,value,
3276     &wand->images->exception);
3277   return(status);
3278 }
3279 
3280 /*
3281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3282 %                                                                             %
3283 %                                                                             %
3284 %                                                                             %
3285 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
3286 %                                                                             %
3287 %                                                                             %
3288 %                                                                             %
3289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3290 %
3291 %  MagickExportImagePixels() extracts pixel data from an image and returns it
3292 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3293 %  an error is encountered.  The data is returned as char, short int, int,
3294 %  ssize_t, float, or double in the order specified by map.
3295 %
3296 %  Suppose you want to extract the first scanline of a 640x480 image as
3297 %  character data in red-green-blue order:
3298 %
3299 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3300 %
3301 %  The format of the MagickExportImagePixels method is:
3302 %
3303 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3304 %        const ssize_t x,const ssize_t y,const size_t columns,
3305 %        const size_t rows,const char *map,const StorageType storage,
3306 %        void *pixels)
3307 %
3308 %  A description of each parameter follows:
3309 %
3310 %    o wand: the magick wand.
3311 %
3312 %    o x, y, columns, rows:  These values define the perimeter
3313 %      of a region of pixels you want to extract.
3314 %
3315 %    o map:  This string reflects the expected ordering of the pixel array.
3316 %      It can be any combination or order of R = red, G = green, B = blue,
3317 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3318 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3319 %      P = pad.
3320 %
3321 %    o storage: Define the data type of the pixels.  Float and double types are
3322 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3323 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3324 %      LongPixel, QuantumPixel, or ShortPixel.
3325 %
3326 %    o pixels: This array of values contain the pixel components as defined by
3327 %      map and type.  You must preallocate this array where the expected
3328 %      length varies depending on the values of width, height, map, and type.
3329 %
3330 */
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)3331 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3332   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
3333   const char *map,const StorageType storage,void *pixels)
3334 {
3335   MagickBooleanType
3336     status;
3337 
3338   assert(wand != (MagickWand *) NULL);
3339   assert(wand->signature == WandSignature);
3340   if (wand->debug != MagickFalse)
3341     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3342   if (wand->images == (Image *) NULL)
3343     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3344   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3345     storage,pixels,wand->exception);
3346   if (status == MagickFalse)
3347     InheritException(wand->exception,&wand->images->exception);
3348   return(status);
3349 }
3350 
3351 /*
3352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3353 %                                                                             %
3354 %                                                                             %
3355 %                                                                             %
3356 %   M a g i c k E x t e n t I m a g e                                         %
3357 %                                                                             %
3358 %                                                                             %
3359 %                                                                             %
3360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3361 %
3362 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3363 %  and wand background color.  Set the (x,y) offset of the geometry to move
3364 %  the original wand relative to the extended wand.
3365 %
3366 %  The format of the MagickExtentImage method is:
3367 %
3368 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3369 %        const size_t height,const ssize_t x,const ssize_t y)
3370 %
3371 %  A description of each parameter follows:
3372 %
3373 %    o wand: the magick wand.
3374 %
3375 %    o width: the region width.
3376 %
3377 %    o height: the region height.
3378 %
3379 %    o x: the region x offset.
3380 %
3381 %    o y: the region y offset.
3382 %
3383 */
MagickExtentImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)3384 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3385   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3386 {
3387   Image
3388     *extent_image;
3389 
3390   RectangleInfo
3391     extent;
3392 
3393   assert(wand != (MagickWand *) NULL);
3394   assert(wand->signature == WandSignature);
3395   if (wand->debug != MagickFalse)
3396     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3397   if (wand->images == (Image *) NULL)
3398     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3399   extent.width=width;
3400   extent.height=height;
3401   extent.x=x;
3402   extent.y=y;
3403   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3404   if (extent_image == (Image *) NULL)
3405     return(MagickFalse);
3406   ReplaceImageInList(&wand->images,extent_image);
3407   return(MagickTrue);
3408 }
3409 
3410 /*
3411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3412 %                                                                             %
3413 %                                                                             %
3414 %                                                                             %
3415 %   M a g i c k F i l t e r I m a g e                                         %
3416 %                                                                             %
3417 %                                                                             %
3418 %                                                                             %
3419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3420 %
3421 %  MagickFilterImage() applies a custom convolution kernel to the image.
3422 %
3423 %  The format of the MagickFilterImage method is:
3424 %
3425 %      MagickBooleanType MagickFilterImage(MagickWand *wand,
3426 %        const KernelInfo *kernel)
3427 %      MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3428 %        const ChannelType channel,const KernelInfo *kernel)
3429 %
3430 %  A description of each parameter follows:
3431 %
3432 %    o wand: the magick wand.
3433 %
3434 %    o channel: the image channel(s).
3435 %
3436 %    o kernel: An array of doubles representing the convolution kernel.
3437 %
3438 */
3439 
MagickFilterImage(MagickWand * wand,const KernelInfo * kernel)3440 WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
3441   const KernelInfo *kernel)
3442 {
3443   MagickBooleanType
3444     status;
3445 
3446   status=MagickFilterImageChannel(wand,DefaultChannels,kernel);
3447   return(status);
3448 }
3449 
MagickFilterImageChannel(MagickWand * wand,const ChannelType channel,const KernelInfo * kernel)3450 WandExport MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3451   const ChannelType channel,const KernelInfo *kernel)
3452 {
3453   Image
3454     *filter_image;
3455 
3456   assert(wand != (MagickWand *) NULL);
3457   assert(wand->signature == WandSignature);
3458   if (wand->debug != MagickFalse)
3459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3460   if (kernel == (const KernelInfo *) NULL)
3461     return(MagickFalse);
3462   if (wand->images == (Image *) NULL)
3463     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3464   filter_image=FilterImageChannel(wand->images,channel,kernel,wand->exception);
3465   if (filter_image == (Image *) NULL)
3466     return(MagickFalse);
3467   ReplaceImageInList(&wand->images,filter_image);
3468   return(MagickTrue);
3469 }
3470 
3471 /*
3472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3473 %                                                                             %
3474 %                                                                             %
3475 %                                                                             %
3476 %   M a g i c k F l i p I m a g e                                             %
3477 %                                                                             %
3478 %                                                                             %
3479 %                                                                             %
3480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3481 %
3482 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3483 %  around the central x-axis.
3484 %
3485 %  The format of the MagickFlipImage method is:
3486 %
3487 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3488 %
3489 %  A description of each parameter follows:
3490 %
3491 %    o wand: the magick wand.
3492 %
3493 */
MagickFlipImage(MagickWand * wand)3494 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3495 {
3496   Image
3497     *flip_image;
3498 
3499   assert(wand != (MagickWand *) NULL);
3500   assert(wand->signature == WandSignature);
3501   if (wand->debug != MagickFalse)
3502     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3503   if (wand->images == (Image *) NULL)
3504     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3505   flip_image=FlipImage(wand->images,wand->exception);
3506   if (flip_image == (Image *) NULL)
3507     return(MagickFalse);
3508   ReplaceImageInList(&wand->images,flip_image);
3509   return(MagickTrue);
3510 }
3511 
3512 /*
3513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3514 %                                                                             %
3515 %                                                                             %
3516 %                                                                             %
3517 %   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                         %
3518 %                                                                             %
3519 %                                                                             %
3520 %                                                                             %
3521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3522 %
3523 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3524 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3525 %  specified, the color value is changed for any neighbor pixel that does not
3526 %  match the bordercolor member of image.
3527 %
3528 %  The format of the MagickFloodfillPaintImage method is:
3529 %
3530 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3531 %        const ChannelType channel,const PixelWand *fill,const double fuzz,
3532 %        const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3533 %        const MagickBooleanType invert)
3534 %
3535 %  A description of each parameter follows:
3536 %
3537 %    o wand: the magick wand.
3538 %
3539 %    o channel: the channel(s).
3540 %
3541 %    o fill: the floodfill color pixel wand.
3542 %
3543 %    o fuzz: By default target must match a particular pixel color
3544 %      exactly.  However, in many cases two colors may differ by a small amount.
3545 %      The fuzz member of image defines how much tolerance is acceptable to
3546 %      consider two colors as the same.  For example, set fuzz to 10 and the
3547 %      color red at intensities of 100 and 102 respectively are now interpreted
3548 %      as the same color for the purposes of the floodfill.
3549 %
3550 %    o bordercolor: the border color pixel wand.
3551 %
3552 %    o x,y: the starting location of the operation.
3553 %
3554 %    o invert: paint any pixel that does not match the target color.
3555 %
3556 */
MagickFloodfillPaintImage(MagickWand * wand,const ChannelType channel,const PixelWand * fill,const double fuzz,const PixelWand * bordercolor,const ssize_t x,const ssize_t y,const MagickBooleanType invert)3557 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3558   const ChannelType channel,const PixelWand *fill,const double fuzz,
3559   const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3560   const MagickBooleanType invert)
3561 {
3562   DrawInfo
3563     *draw_info;
3564 
3565   MagickBooleanType
3566     status;
3567 
3568   MagickPixelPacket
3569     target;
3570 
3571   assert(wand != (MagickWand *) NULL);
3572   assert(wand->signature == WandSignature);
3573   if (wand->debug != MagickFalse)
3574     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3575   if (wand->images == (Image *) NULL)
3576     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3577   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3578   PixelGetQuantumColor(fill,&draw_info->fill);
3579   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3580     y % wand->images->rows,&target,wand->exception);
3581   if (bordercolor != (PixelWand *) NULL)
3582     PixelGetMagickColor(bordercolor,&target);
3583   wand->images->fuzz=fuzz;
3584   status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,invert);
3585   if (status == MagickFalse)
3586     InheritException(wand->exception,&wand->images->exception);
3587   draw_info=DestroyDrawInfo(draw_info);
3588   return(status);
3589 }
3590 
3591 /*
3592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3593 %                                                                             %
3594 %                                                                             %
3595 %                                                                             %
3596 %   M a g i c k F l o p I m a g e                                             %
3597 %                                                                             %
3598 %                                                                             %
3599 %                                                                             %
3600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3601 %
3602 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3603 %  around the central y-axis.
3604 %
3605 %  The format of the MagickFlopImage method is:
3606 %
3607 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3608 %
3609 %  A description of each parameter follows:
3610 %
3611 %    o wand: the magick wand.
3612 %
3613 */
MagickFlopImage(MagickWand * wand)3614 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3615 {
3616   Image
3617     *flop_image;
3618 
3619   assert(wand != (MagickWand *) NULL);
3620   assert(wand->signature == WandSignature);
3621   if (wand->debug != MagickFalse)
3622     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3623   if (wand->images == (Image *) NULL)
3624     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3625   flop_image=FlopImage(wand->images,wand->exception);
3626   if (flop_image == (Image *) NULL)
3627     return(MagickFalse);
3628   ReplaceImageInList(&wand->images,flop_image);
3629   return(MagickTrue);
3630 }
3631 
3632 /*
3633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3634 %                                                                             %
3635 %                                                                             %
3636 %                                                                             %
3637 %   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                     %
3638 %                                                                             %
3639 %                                                                             %
3640 %                                                                             %
3641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3642 %
3643 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3644 %  transform (DFT) of the image either as a magnitude / phase or real /
3645 %  imaginary image pair.
3646 %
3647 %  The format of the MagickForwardFourierTransformImage method is:
3648 %
3649 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3650 %        const MagickBooleanType magnitude)
3651 %
3652 %  A description of each parameter follows:
3653 %
3654 %    o wand: the magick wand.
3655 %
3656 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3657 %      imaginary image pair.
3658 %
3659 */
MagickForwardFourierTransformImage(MagickWand * wand,const MagickBooleanType magnitude)3660 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3661   MagickWand *wand,const MagickBooleanType magnitude)
3662 {
3663   Image
3664     *forward_image;
3665 
3666   assert(wand != (MagickWand *) NULL);
3667   assert(wand->signature == WandSignature);
3668   if (wand->debug != MagickFalse)
3669     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3670   if (wand->images == (Image *) NULL)
3671     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3672   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3673     wand->exception);
3674   if (forward_image == (Image *) NULL)
3675     return(MagickFalse);
3676   ReplaceImageInList(&wand->images,forward_image);
3677   return(MagickTrue);
3678 }
3679 
3680 /*
3681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3682 %                                                                             %
3683 %                                                                             %
3684 %                                                                             %
3685 %   M a g i c k F r a m e I m a g e                                           %
3686 %                                                                             %
3687 %                                                                             %
3688 %                                                                             %
3689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3690 %
3691 %  MagickFrameImage() adds a simulated three-dimensional border around the
3692 %  image.  The width and height specify the border width of the vertical and
3693 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3694 %  width of the inner and outer shadows of the frame.
3695 %
3696 %  The format of the MagickFrameImage method is:
3697 %
3698 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3699 %        const PixelWand *matte_color,const size_t width,
3700 %        const size_t height,const ssize_t inner_bevel,
3701 %        const ssize_t outer_bevel)
3702 %
3703 %  A description of each parameter follows:
3704 %
3705 %    o wand: the magick wand.
3706 %
3707 %    o matte_color: the frame color pixel wand.
3708 %
3709 %    o width: the border width.
3710 %
3711 %    o height: the border height.
3712 %
3713 %    o inner_bevel: the inner bevel width.
3714 %
3715 %    o outer_bevel: the outer bevel width.
3716 %
3717 */
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)3718 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3719   const PixelWand *matte_color,const size_t width,const size_t height,
3720   const ssize_t inner_bevel,const ssize_t outer_bevel)
3721 {
3722   Image
3723     *frame_image;
3724 
3725   FrameInfo
3726     frame_info;
3727 
3728   assert(wand != (MagickWand *) NULL);
3729   assert(wand->signature == WandSignature);
3730   if (wand->debug != MagickFalse)
3731     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3732   if (wand->images == (Image *) NULL)
3733     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3734   (void) memset(&frame_info,0,sizeof(frame_info));
3735   frame_info.width=wand->images->columns+2*width;
3736   frame_info.height=wand->images->rows+2*height;
3737   frame_info.x=(ssize_t) width;
3738   frame_info.y=(ssize_t) height;
3739   frame_info.inner_bevel=inner_bevel;
3740   frame_info.outer_bevel=outer_bevel;
3741   PixelGetQuantumColor(matte_color,&wand->images->matte_color);
3742   frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3743   if (frame_image == (Image *) NULL)
3744     return(MagickFalse);
3745   ReplaceImageInList(&wand->images,frame_image);
3746   return(MagickTrue);
3747 }
3748 
3749 /*
3750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3751 %                                                                             %
3752 %                                                                             %
3753 %                                                                             %
3754 %   M a g i c k F u n c t i o n I m a g e                                     %
3755 %                                                                             %
3756 %                                                                             %
3757 %                                                                             %
3758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3759 %
3760 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3761 %  expression to an image.  Use these operators to lighten or darken an image,
3762 %  to increase or decrease contrast in an image, or to produce the "negative"
3763 %  of an image.
3764 %
3765 %  The format of the MagickFunctionImage method is:
3766 %
3767 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3768 %        const MagickFunction function,const size_t number_arguments,
3769 %        const double *arguments)
3770 %      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3771 %        const ChannelType channel,const MagickFunction function,
3772 %        const size_t number_arguments,const double *arguments)
3773 %
3774 %  A description of each parameter follows:
3775 %
3776 %    o wand: the magick wand.
3777 %
3778 %    o channel: the channel(s).
3779 %
3780 %    o function: the image function.
3781 %
3782 %    o number_arguments: the number of function arguments.
3783 %
3784 %    o arguments: the function arguments.
3785 %
3786 */
3787 
MagickFunctionImage(MagickWand * wand,const MagickFunction function,const size_t number_arguments,const double * arguments)3788 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3789   const MagickFunction function,const size_t number_arguments,
3790   const double *arguments)
3791 {
3792   MagickBooleanType
3793     status;
3794 
3795   assert(wand != (MagickWand *) NULL);
3796   assert(wand->signature == WandSignature);
3797   if (wand->debug != MagickFalse)
3798     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3799   if (wand->images == (Image *) NULL)
3800     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3801   status=FunctionImage(wand->images,function,number_arguments,arguments,
3802     &wand->images->exception);
3803   if (status == MagickFalse)
3804     InheritException(wand->exception,&wand->images->exception);
3805   return(status);
3806 }
3807 
MagickFunctionImageChannel(MagickWand * wand,const ChannelType channel,const MagickFunction function,const size_t number_arguments,const double * arguments)3808 WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3809   const ChannelType channel,const MagickFunction function,
3810   const size_t number_arguments,const double *arguments)
3811 {
3812   MagickBooleanType
3813     status;
3814 
3815   assert(wand != (MagickWand *) NULL);
3816   assert(wand->signature == WandSignature);
3817   if (wand->debug != MagickFalse)
3818     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3819   if (wand->images == (Image *) NULL)
3820     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3821   status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3822     arguments,&wand->images->exception);
3823   return(status);
3824 }
3825 
3826 /*
3827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3828 %                                                                             %
3829 %                                                                             %
3830 %                                                                             %
3831 %   M a g i c k F x I m a g e                                                 %
3832 %                                                                             %
3833 %                                                                             %
3834 %                                                                             %
3835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3836 %
3837 %  MagickFxImage() evaluate expression for each pixel in the image.
3838 %
3839 %  The format of the MagickFxImage method is:
3840 %
3841 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3842 %      MagickWand *MagickFxImageChannel(MagickWand *wand,
3843 %        const ChannelType channel,const char *expression)
3844 %
3845 %  A description of each parameter follows:
3846 %
3847 %    o wand: the magick wand.
3848 %
3849 %    o channel: the image channel(s).
3850 %
3851 %    o expression: the expression.
3852 %
3853 */
3854 
MagickFxImage(MagickWand * wand,const char * expression)3855 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3856 {
3857   MagickWand
3858     *fx_wand;
3859 
3860   fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3861   return(fx_wand);
3862 }
3863 
MagickFxImageChannel(MagickWand * wand,const ChannelType channel,const char * expression)3864 WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3865   const ChannelType channel,const char *expression)
3866 {
3867   Image
3868     *fx_image;
3869 
3870   assert(wand != (MagickWand *) NULL);
3871   assert(wand->signature == WandSignature);
3872   if (wand->debug != MagickFalse)
3873     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3874   if (wand->images == (Image *) NULL)
3875     return((MagickWand *) NULL);
3876   fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3877   if (fx_image == (Image *) NULL)
3878     return((MagickWand *) NULL);
3879   return(CloneMagickWandFromImages(wand,fx_image));
3880 }
3881 
3882 /*
3883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3884 %                                                                             %
3885 %                                                                             %
3886 %                                                                             %
3887 %   M a g i c k G a m m a I m a g e                                           %
3888 %                                                                             %
3889 %                                                                             %
3890 %                                                                             %
3891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3892 %
3893 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3894 %  different devices will have perceptual differences in the way the image's
3895 %  intensities are represented on the screen.  Specify individual gamma levels
3896 %  for the red, green, and blue channels, or adjust all three with the gamma
3897 %  parameter.  Values typically range from 0.8 to 2.3.
3898 %
3899 %  You can also reduce the influence of a particular channel with a gamma
3900 %  value of 0.
3901 %
3902 %  The format of the MagickGammaImage method is:
3903 %
3904 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3905 %      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3906 %        const ChannelType channel,const double gamma)
3907 %
3908 %  A description of each parameter follows:
3909 %
3910 %    o wand: the magick wand.
3911 %
3912 %    o channel: the channel.
3913 %
3914 %    o level: Define the level of gamma correction.
3915 %
3916 */
3917 
MagickGammaImage(MagickWand * wand,const double gamma)3918 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3919   const double gamma)
3920 {
3921   MagickBooleanType
3922     status;
3923 
3924   status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3925   return(status);
3926 }
3927 
MagickGammaImageChannel(MagickWand * wand,const ChannelType channel,const double gamma)3928 WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3929   const ChannelType channel,const double gamma)
3930 {
3931   MagickBooleanType
3932     status;
3933 
3934   assert(wand != (MagickWand *) NULL);
3935   assert(wand->signature == WandSignature);
3936   if (wand->debug != MagickFalse)
3937     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3938   if (wand->images == (Image *) NULL)
3939     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3940   status=GammaImageChannel(wand->images,channel,gamma);
3941   if (status == MagickFalse)
3942     InheritException(wand->exception,&wand->images->exception);
3943   return(status);
3944 }
3945 
3946 /*
3947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3948 %                                                                             %
3949 %                                                                             %
3950 %                                                                             %
3951 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3952 %                                                                             %
3953 %                                                                             %
3954 %                                                                             %
3955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3956 %
3957 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3958 %  Gaussian operator of the given radius and standard deviation (sigma).
3959 %  For reasonable results, the radius should be larger than sigma.  Use a
3960 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3961 %
3962 %  The format of the MagickGaussianBlurImage method is:
3963 %
3964 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3965 %        const double radius,const double sigma)
3966 %      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3967 %        const ChannelType channel,const double radius,const double sigma)
3968 %
3969 %  A description of each parameter follows:
3970 %
3971 %    o wand: the magick wand.
3972 %
3973 %    o channel: the image channel(s).
3974 %
3975 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3976 %      pixel.
3977 %
3978 %    o sigma: the standard deviation of the Gaussian, in pixels.
3979 %
3980 */
3981 
MagickGaussianBlurImage(MagickWand * wand,const double radius,const double sigma)3982 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3983   const double radius,const double sigma)
3984 {
3985   MagickBooleanType
3986     status;
3987 
3988   status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3989   return(status);
3990 }
3991 
MagickGaussianBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)3992 WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3993   const ChannelType channel,const double radius,const double sigma)
3994 {
3995   Image
3996     *blur_image;
3997 
3998   assert(wand != (MagickWand *) NULL);
3999   assert(wand->signature == WandSignature);
4000   if (wand->debug != MagickFalse)
4001     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4002   if (wand->images == (Image *) NULL)
4003     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4004   blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
4005     wand->exception);
4006   if (blur_image == (Image *) NULL)
4007     return(MagickFalse);
4008   ReplaceImageInList(&wand->images,blur_image);
4009   return(MagickTrue);
4010 }
4011 
4012 /*
4013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4014 %                                                                             %
4015 %                                                                             %
4016 %                                                                             %
4017 %   M a g i c k G e t I m a g e                                               %
4018 %                                                                             %
4019 %                                                                             %
4020 %                                                                             %
4021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4022 %
4023 %  MagickGetImage() gets the image at the current image index.
4024 %
4025 %  The format of the MagickGetImage method is:
4026 %
4027 %      MagickWand *MagickGetImage(MagickWand *wand)
4028 %
4029 %  A description of each parameter follows:
4030 %
4031 %    o wand: the magick wand.
4032 %
4033 */
MagickGetImage(MagickWand * wand)4034 WandExport MagickWand *MagickGetImage(MagickWand *wand)
4035 {
4036   Image
4037     *image;
4038 
4039   assert(wand != (MagickWand *) NULL);
4040   assert(wand->signature == WandSignature);
4041   if (wand->debug != MagickFalse)
4042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4043   if (wand->images == (Image *) NULL)
4044     {
4045       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4046         "ContainsNoImages","`%s'",wand->name);
4047       return((MagickWand *) NULL);
4048     }
4049   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
4050   if (image == (Image *) NULL)
4051     return((MagickWand *) NULL);
4052   return(CloneMagickWandFromImages(wand,image));
4053 }
4054 
4055 /*
4056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4057 %                                                                             %
4058 %                                                                             %
4059 %                                                                             %
4060 %   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                       %
4061 %                                                                             %
4062 %                                                                             %
4063 %                                                                             %
4064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4065 %
4066 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
4067 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
4068 %  than CMYKA.
4069 %
4070 %  The format of the MagickGetImageAlphaChannel method is:
4071 %
4072 %      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4073 %
4074 %  A description of each parameter follows:
4075 %
4076 %    o wand: the magick wand.
4077 %
4078 */
MagickGetImageAlphaChannel(MagickWand * wand)4079 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
4080 {
4081   assert(wand != (MagickWand *) NULL);
4082   assert(wand->signature == WandSignature);
4083   if (wand->debug != MagickFalse)
4084     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4085   if (wand->images == (Image *) NULL)
4086     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4087   return(GetImageAlphaChannel(wand->images));
4088 }
4089 
4090 /*
4091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4092 %                                                                             %
4093 %                                                                             %
4094 %                                                                             %
4095 %   M a g i c k G e t I m a g e C l i p M a s k                               %
4096 %                                                                             %
4097 %                                                                             %
4098 %                                                                             %
4099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4100 %
4101 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
4102 %
4103 %  The format of the MagickGetImageClipMask method is:
4104 %
4105 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
4106 %
4107 %  A description of each parameter follows:
4108 %
4109 %    o wand: the magick wand.
4110 %
4111 */
MagickGetImageClipMask(MagickWand * wand)4112 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
4113 {
4114   Image
4115     *image;
4116 
4117   assert(wand != (MagickWand *) NULL);
4118   assert(wand->signature == WandSignature);
4119   if (wand->debug != MagickFalse)
4120     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4121   if (wand->images == (Image *) NULL)
4122     {
4123       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4124         "ContainsNoImages","`%s'",wand->name);
4125       return((MagickWand *) NULL);
4126     }
4127   image=GetImageClipMask(wand->images,wand->exception);
4128   if (image == (Image *) NULL)
4129     return((MagickWand *) NULL);
4130   return(CloneMagickWandFromImages(wand,image));
4131 }
4132 
4133 /*
4134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4135 %                                                                             %
4136 %                                                                             %
4137 %                                                                             %
4138 %   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                 %
4139 %                                                                             %
4140 %                                                                             %
4141 %                                                                             %
4142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4143 %
4144 %  MagickGetImageBackgroundColor() returns the image background color.
4145 %
4146 %  The format of the MagickGetImageBackgroundColor method is:
4147 %
4148 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4149 %        PixelWand *background_color)
4150 %
4151 %  A description of each parameter follows:
4152 %
4153 %    o wand: the magick wand.
4154 %
4155 %    o background_color: Return the background color.
4156 %
4157 */
MagickGetImageBackgroundColor(MagickWand * wand,PixelWand * background_color)4158 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
4159   PixelWand *background_color)
4160 {
4161   assert(wand != (MagickWand *) NULL);
4162   assert(wand->signature == WandSignature);
4163   if (wand->debug != MagickFalse)
4164     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4165   if (wand->images == (Image *) NULL)
4166     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4167   PixelSetQuantumColor(background_color,&wand->images->background_color);
4168   return(MagickTrue);
4169 }
4170 
4171 /*
4172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4173 %                                                                             %
4174 %                                                                             %
4175 %                                                                             %
4176 %   M a g i c k G e t I m a g e B l o b                                       %
4177 %                                                                             %
4178 %                                                                             %
4179 %                                                                             %
4180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4181 %
4182 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
4183 %  the image as a blob (a formatted "file" in memory) and its length, starting
4184 %  from the current position in the image sequence.  Use MagickSetImageFormat()
4185 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
4186 %
4187 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
4188 %  the image sequence.
4189 %
4190 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
4191 %
4192 %  The format of the MagickGetImageBlob method is:
4193 %
4194 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4195 %
4196 %  A description of each parameter follows:
4197 %
4198 %    o wand: the magick wand.
4199 %
4200 %    o length: the length of the blob.
4201 %
4202 */
MagickGetImageBlob(MagickWand * wand,size_t * length)4203 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4204 {
4205   assert(wand != (MagickWand *) NULL);
4206   assert(wand->signature == WandSignature);
4207   if (wand->debug != MagickFalse)
4208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4209   if (wand->images == (Image *) NULL)
4210     {
4211       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4212         "ContainsNoImages","`%s'",wand->name);
4213       return((unsigned char *) NULL);
4214     }
4215   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
4216 }
4217 
4218 /*
4219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4220 %                                                                             %
4221 %                                                                             %
4222 %                                                                             %
4223 %   M a g i c k G e t I m a g e s B l o b                                     %
4224 %                                                                             %
4225 %                                                                             %
4226 %                                                                             %
4227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4228 %
4229 %  MagickGetImagesBlob() implements direct to memory image formats.  It
4230 %  returns the image sequence as a blob and its length.  The format of the image
4231 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
4232 %  return a different image format, use MagickSetImageFormat().
4233 %
4234 %  Note, some image formats do not permit multiple images to the same image
4235 %  stream (e.g. JPEG).  in this instance, just the first image of the
4236 %  sequence is returned as a blob.
4237 %
4238 %  The format of the MagickGetImagesBlob method is:
4239 %
4240 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4241 %
4242 %  A description of each parameter follows:
4243 %
4244 %    o wand: the magick wand.
4245 %
4246 %    o length: the length of the blob.
4247 %
4248 */
MagickGetImagesBlob(MagickWand * wand,size_t * length)4249 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4250 {
4251   unsigned char
4252     *blob;
4253 
4254   assert(wand != (MagickWand *) NULL);
4255   assert(wand->signature == WandSignature);
4256   if (wand->debug != MagickFalse)
4257     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4258   if (wand->images == (Image *) NULL)
4259     {
4260       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4261         "ContainsNoImages","`%s'",wand->name);
4262       return((unsigned char *) NULL);
4263     }
4264   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
4265     wand->exception);
4266   return(blob);
4267 }
4268 
4269 /*
4270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4271 %                                                                             %
4272 %                                                                             %
4273 %                                                                             %
4274 %   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                         %
4275 %                                                                             %
4276 %                                                                             %
4277 %                                                                             %
4278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4279 %
4280 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4281 %  image.
4282 %
4283 %  The format of the MagickGetImageBluePrimary method is:
4284 %
4285 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4286 %        double *y)
4287 %
4288 %  A description of each parameter follows:
4289 %
4290 %    o wand: the magick wand.
4291 %
4292 %    o x: the chromaticity blue primary x-point.
4293 %
4294 %    o y: the chromaticity blue primary y-point.
4295 %
4296 */
MagickGetImageBluePrimary(MagickWand * wand,double * x,double * y)4297 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4298   double *x,double *y)
4299 {
4300   assert(wand != (MagickWand *) NULL);
4301   assert(wand->signature == WandSignature);
4302   if (wand->debug != MagickFalse)
4303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4304   if (wand->images == (Image *) NULL)
4305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4306   *x=wand->images->chromaticity.blue_primary.x;
4307   *y=wand->images->chromaticity.blue_primary.y;
4308   return(MagickTrue);
4309 }
4310 
4311 /*
4312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4313 %                                                                             %
4314 %                                                                             %
4315 %                                                                             %
4316 %   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                         %
4317 %                                                                             %
4318 %                                                                             %
4319 %                                                                             %
4320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4321 %
4322 %  MagickGetImageBorderColor() returns the image border color.
4323 %
4324 %  The format of the MagickGetImageBorderColor method is:
4325 %
4326 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4327 %        PixelWand *border_color)
4328 %
4329 %  A description of each parameter follows:
4330 %
4331 %    o wand: the magick wand.
4332 %
4333 %    o border_color: Return the border color.
4334 %
4335 */
MagickGetImageBorderColor(MagickWand * wand,PixelWand * border_color)4336 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4337   PixelWand *border_color)
4338 {
4339   assert(wand != (MagickWand *) NULL);
4340   assert(wand->signature == WandSignature);
4341   if (wand->debug != MagickFalse)
4342     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4343   if (wand->images == (Image *) NULL)
4344     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4345   PixelSetQuantumColor(border_color,&wand->images->border_color);
4346   return(MagickTrue);
4347 }
4348 
4349 /*
4350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4351 %                                                                             %
4352 %                                                                             %
4353 %                                                                             %
4354 %   M a g i c k G e t I m a g e C h a n n e l D e p t h                       %
4355 %                                                                             %
4356 %                                                                             %
4357 %                                                                             %
4358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4359 %
4360 %  MagickGetImageChannelDepth() gets the depth for one or more image channels.
4361 %
4362 %  The format of the MagickGetImageChannelDepth method is:
4363 %
4364 %      size_t MagickGetImageChannelDepth(MagickWand *wand,
4365 %        const ChannelType channel)
4366 %
4367 %  A description of each parameter follows:
4368 %
4369 %    o wand: the magick wand.
4370 %
4371 %    o channel: the image channel(s).
4372 %
4373 */
MagickGetImageChannelDepth(MagickWand * wand,const ChannelType channel)4374 WandExport size_t MagickGetImageChannelDepth(MagickWand *wand,
4375   const ChannelType channel)
4376 {
4377   assert(wand != (MagickWand *) NULL);
4378   assert(wand->signature == WandSignature);
4379   if (wand->debug != MagickFalse)
4380     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4381   if (wand->images == (Image *) NULL)
4382     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4383   return(GetImageChannelDepth(wand->images,channel,wand->exception));
4384 }
4385 
4386 /*
4387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4388 %                                                                             %
4389 %                                                                             %
4390 %                                                                             %
4391 %   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n             %
4392 %                                                                             %
4393 %                                                                             %
4394 %                                                                             %
4395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4396 %
4397 %  MagickGetImageChannelDistortion() compares one or more image channels of an
4398 %  image to a reconstructed image and returns the specified distortion metric.
4399 %
4400 %  The format of the MagickGetImageChannelDistortion method is:
4401 %
4402 %      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4403 %        const MagickWand *reference,const ChannelType channel,
4404 %        const MetricType metric,double *distortion)
4405 %
4406 %  A description of each parameter follows:
4407 %
4408 %    o wand: the magick wand.
4409 %
4410 %    o reference: the reference wand.
4411 %
4412 %    o channel: the channel.
4413 %
4414 %    o metric: the metric.
4415 %
4416 %    o distortion: the computed distortion between the images.
4417 %
4418 */
MagickGetImageChannelDistortion(MagickWand * wand,const MagickWand * reference,const ChannelType channel,const MetricType metric,double * distortion)4419 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4420   const MagickWand *reference,const ChannelType channel,const MetricType metric,
4421   double *distortion)
4422 {
4423   MagickBooleanType
4424     status;
4425 
4426   assert(wand != (MagickWand *) NULL);
4427   assert(wand->signature == WandSignature);
4428   if (wand->debug != MagickFalse)
4429     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4430   assert(reference != (MagickWand *) NULL);
4431   assert(reference->signature == WandSignature);
4432   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4433     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4434   status=GetImageChannelDistortion(wand->images,reference->images,channel,
4435     metric,distortion,&wand->images->exception);
4436   return(status);
4437 }
4438 
4439 /*
4440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4441 %                                                                             %
4442 %                                                                             %
4443 %                                                                             %
4444 %   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n s           %
4445 %                                                                             %
4446 %                                                                             %
4447 %                                                                             %
4448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4449 %
4450 %  MagickGetImageChannelDistortions() compares one or more image channels of an
4451 %  image to a reconstructed image and returns the specified distortion metrics.
4452 %
4453 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4454 %
4455 %  The format of the MagickGetImageChannelDistortion method is:
4456 %
4457 %      double *MagickGetImageChannelDistortion(MagickWand *wand,
4458 %        const MagickWand *reference,const MetricType metric)
4459 %
4460 %  A description of each parameter follows:
4461 %
4462 %    o wand: the magick wand.
4463 %
4464 %    o reference: the reference wand.
4465 %
4466 %    o metric: the metric.
4467 %
4468 */
MagickGetImageChannelDistortions(MagickWand * wand,const MagickWand * reference,const MetricType metric)4469 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4470   const MagickWand *reference,const MetricType metric)
4471 {
4472   double
4473     *channel_distortion;
4474 
4475   assert(wand != (MagickWand *) NULL);
4476   assert(wand->signature == WandSignature);
4477   if (wand->debug != MagickFalse)
4478     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4479   assert(reference != (MagickWand *) NULL);
4480   assert(reference->signature == WandSignature);
4481   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4482     {
4483       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4484         "ContainsNoImages","`%s'",wand->name);
4485       return((double *) NULL);
4486     }
4487   channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4488     metric,&wand->images->exception);
4489   return(channel_distortion);
4490 }
4491 
4492 /*
4493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4494 %                                                                             %
4495 %                                                                             %
4496 %                                                                             %
4497 %   M a g i c k G e t I m a g e C h a n n e l F e a t u r e s                 %
4498 %                                                                             %
4499 %                                                                             %
4500 %                                                                             %
4501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4502 %
4503 %  MagickGetImageChannelFeatures() returns features for each channel in the
4504 %  image in each of four directions (horizontal, vertical, left and right
4505 %  diagonals) for the specified distance.  The features include the angular
4506 %  second moment, contrast, correlation, sum of squares: variance, inverse
4507 %  difference moment, sum average, sum varience, sum entropy, entropy,
4508 %  difference variance, difference entropy, information measures of
4509 %  correlation 1, information measures of correlation 2, and maximum
4510 %  correlation coefficient.  You can access the red channel contrast, for
4511 %  example, like this:
4512 %
4513 %      channel_features=MagickGetImageChannelFeatures(wand,1);
4514 %      contrast=channel_features[RedChannel].contrast[0];
4515 %
4516 %  Use MagickRelinquishMemory() to free the statistics buffer.
4517 %
4518 %  The format of the MagickGetImageChannelFeatures method is:
4519 %
4520 %      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4521 %        const size_t distance)
4522 %
4523 %  A description of each parameter follows:
4524 %
4525 %    o wand: the magick wand.
4526 %
4527 %    o distance: the distance.
4528 %
4529 */
MagickGetImageChannelFeatures(MagickWand * wand,const size_t distance)4530 WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4531   const size_t distance)
4532 {
4533   assert(wand != (MagickWand *) NULL);
4534   assert(wand->signature == WandSignature);
4535   if (wand->debug != MagickFalse)
4536     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4537   if (wand->images == (Image *) NULL)
4538     {
4539       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4540         "ContainsNoImages","`%s'",wand->name);
4541       return((ChannelFeatures *) NULL);
4542     }
4543   return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4544 }
4545 
4546 /*
4547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4548 %                                                                             %
4549 %                                                                             %
4550 %                                                                             %
4551 %   M a g i c k G e t I m a g e C h a n n e l K u r t o s i s                 %
4552 %                                                                             %
4553 %                                                                             %
4554 %                                                                             %
4555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4556 %
4557 %  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4558 %  more image channels.
4559 %
4560 %  The format of the MagickGetImageChannelKurtosis method is:
4561 %
4562 %      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4563 %        const ChannelType channel,double *kurtosis,double *skewness)
4564 %
4565 %  A description of each parameter follows:
4566 %
4567 %    o wand: the magick wand.
4568 %
4569 %    o channel: the image channel(s).
4570 %
4571 %    o kurtosis:  The kurtosis for the specified channel(s).
4572 %
4573 %    o skewness:  The skewness for the specified channel(s).
4574 %
4575 */
MagickGetImageChannelKurtosis(MagickWand * wand,const ChannelType channel,double * kurtosis,double * skewness)4576 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4577   const ChannelType channel,double *kurtosis,double *skewness)
4578 {
4579   MagickBooleanType
4580     status;
4581 
4582   assert(wand != (MagickWand *) NULL);
4583   assert(wand->signature == WandSignature);
4584   if (wand->debug != MagickFalse)
4585     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4586   if (wand->images == (Image *) NULL)
4587     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4588   status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4589     wand->exception);
4590   return(status);
4591 }
4592 
4593 /*
4594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4595 %                                                                             %
4596 %                                                                             %
4597 %                                                                             %
4598 %   M a g i c k G e t I m a g e C h a n n e l M e a n                         %
4599 %                                                                             %
4600 %                                                                             %
4601 %                                                                             %
4602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4603 %
4604 %  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4605 %  more image channels.
4606 %
4607 %  The format of the MagickGetImageChannelMean method is:
4608 %
4609 %      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4610 %        const ChannelType channel,double *mean,double *standard_deviation)
4611 %
4612 %  A description of each parameter follows:
4613 %
4614 %    o wand: the magick wand.
4615 %
4616 %    o channel: the image channel(s).
4617 %
4618 %    o mean:  The mean pixel value for the specified channel(s).
4619 %
4620 %    o standard_deviation:  The standard deviation for the specified channel(s).
4621 %
4622 */
MagickGetImageChannelMean(MagickWand * wand,const ChannelType channel,double * mean,double * standard_deviation)4623 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4624   const ChannelType channel,double *mean,double *standard_deviation)
4625 {
4626   MagickBooleanType
4627     status;
4628 
4629   assert(wand != (MagickWand *) NULL);
4630   assert(wand->signature == WandSignature);
4631   if (wand->debug != MagickFalse)
4632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4633   if (wand->images == (Image *) NULL)
4634     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4635   status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4636     wand->exception);
4637   return(status);
4638 }
4639 
4640 /*
4641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4642 %                                                                             %
4643 %                                                                             %
4644 %                                                                             %
4645 %   M a g i c k G e t I m a g e C h a n n e l R a n g e                       %
4646 %                                                                             %
4647 %                                                                             %
4648 %                                                                             %
4649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4650 %
4651 %  MagickGetImageChannelRange() gets the range for one or more image channels.
4652 %
4653 %  The format of the MagickGetImageChannelRange method is:
4654 %
4655 %      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4656 %        const ChannelType channel,double *minima,double *maxima)
4657 %
4658 %  A description of each parameter follows:
4659 %
4660 %    o wand: the magick wand.
4661 %
4662 %    o channel: the image channel(s).
4663 %
4664 %    o minima:  The minimum pixel value for the specified channel(s).
4665 %
4666 %    o maxima:  The maximum pixel value for the specified channel(s).
4667 %
4668 */
MagickGetImageChannelRange(MagickWand * wand,const ChannelType channel,double * minima,double * maxima)4669 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4670   const ChannelType channel,double *minima,double *maxima)
4671 {
4672   MagickBooleanType
4673     status;
4674 
4675   assert(wand != (MagickWand *) NULL);
4676   assert(wand->signature == WandSignature);
4677   if (wand->debug != MagickFalse)
4678     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4679   if (wand->images == (Image *) NULL)
4680     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4681   status=GetImageChannelRange(wand->images,channel,minima,maxima,
4682     wand->exception);
4683   return(status);
4684 }
4685 
4686 /*
4687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4688 %                                                                             %
4689 %                                                                             %
4690 %                                                                             %
4691 %   M a g i c k G e t I m a g e C h a n n e l S t a t i s t i c s             %
4692 %                                                                             %
4693 %                                                                             %
4694 %                                                                             %
4695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4696 %
4697 %  MagickGetImageChannelStatistics() returns statistics for each channel in the
4698 %  image.  The statistics include the channel depth, its minima and
4699 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4700 %  You can access the red channel mean, for example, like this:
4701 %
4702 %      channel_statistics=MagickGetImageChannelStatistics(wand);
4703 %      red_mean=channel_statistics[RedChannel].mean;
4704 %
4705 %  Use MagickRelinquishMemory() to free the statistics buffer.
4706 %
4707 %  The format of the MagickGetImageChannelStatistics method is:
4708 %
4709 %      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4710 %
4711 %  A description of each parameter follows:
4712 %
4713 %    o wand: the magick wand.
4714 %
4715 */
MagickGetImageChannelStatistics(MagickWand * wand)4716 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4717 {
4718   assert(wand != (MagickWand *) NULL);
4719   assert(wand->signature == WandSignature);
4720   if (wand->debug != MagickFalse)
4721     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4722   if (wand->images == (Image *) NULL)
4723     {
4724       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4725         "ContainsNoImages","`%s'",wand->name);
4726       return((ChannelStatistics *) NULL);
4727     }
4728   return(GetImageChannelStatistics(wand->images,wand->exception));
4729 }
4730 
4731 /*
4732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4733 %                                                                             %
4734 %                                                                             %
4735 %                                                                             %
4736 %   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                     %
4737 %                                                                             %
4738 %                                                                             %
4739 %                                                                             %
4740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4741 %
4742 %  MagickGetImageColormapColor() returns the color of the specified colormap
4743 %  index.
4744 %
4745 %  The format of the MagickGetImageColormapColor method is:
4746 %
4747 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4748 %        const size_t index,PixelWand *color)
4749 %
4750 %  A description of each parameter follows:
4751 %
4752 %    o wand: the magick wand.
4753 %
4754 %    o index: the offset into the image colormap.
4755 %
4756 %    o color: Return the colormap color in this wand.
4757 %
4758 */
MagickGetImageColormapColor(MagickWand * wand,const size_t index,PixelWand * color)4759 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4760   const size_t index,PixelWand *color)
4761 {
4762   assert(wand != (MagickWand *) NULL);
4763   assert(wand->signature == WandSignature);
4764   if (wand->debug != MagickFalse)
4765     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4766   if (wand->images == (Image *) NULL)
4767     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4768   if ((wand->images->colormap == (PixelPacket *) NULL) ||
4769       (index >= wand->images->colors))
4770     {
4771       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4772         "InvalidColormapIndex","`%s'",wand->name);
4773       return(MagickFalse);
4774     }
4775   PixelSetQuantumColor(color,wand->images->colormap+index);
4776   return(MagickTrue);
4777 }
4778 
4779 /*
4780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4781 %                                                                             %
4782 %                                                                             %
4783 %                                                                             %
4784 %   M a g i c k G e t I m a g e C o l o r s                                   %
4785 %                                                                             %
4786 %                                                                             %
4787 %                                                                             %
4788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4789 %
4790 %  MagickGetImageColors() gets the number of unique colors in the image.
4791 %
4792 %  The format of the MagickGetImageColors method is:
4793 %
4794 %      size_t MagickGetImageColors(MagickWand *wand)
4795 %
4796 %  A description of each parameter follows:
4797 %
4798 %    o wand: the magick wand.
4799 %
4800 */
MagickGetImageColors(MagickWand * wand)4801 WandExport size_t MagickGetImageColors(MagickWand *wand)
4802 {
4803   assert(wand != (MagickWand *) NULL);
4804   assert(wand->signature == WandSignature);
4805   if (wand->debug != MagickFalse)
4806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4807   if (wand->images == (Image *) NULL)
4808     {
4809       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4810         "ContainsNoImages","`%s'",wand->name);
4811       return(0);
4812     }
4813   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4814 }
4815 
4816 /*
4817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4818 %                                                                             %
4819 %                                                                             %
4820 %                                                                             %
4821 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4822 %                                                                             %
4823 %                                                                             %
4824 %                                                                             %
4825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4826 %
4827 %  MagickGetImageColorspace() gets the image colorspace.
4828 %
4829 %  The format of the MagickGetImageColorspace method is:
4830 %
4831 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4832 %
4833 %  A description of each parameter follows:
4834 %
4835 %    o wand: the magick wand.
4836 %
4837 */
MagickGetImageColorspace(MagickWand * wand)4838 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4839 {
4840   assert(wand != (MagickWand *) NULL);
4841   assert(wand->signature == WandSignature);
4842   if (wand->debug != MagickFalse)
4843     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4844   if (wand->images == (Image *) NULL)
4845     {
4846       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4847         "ContainsNoImages","`%s'",wand->name);
4848       return(UndefinedColorspace);
4849     }
4850   return(wand->images->colorspace);
4851 }
4852 
4853 /*
4854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4855 %                                                                             %
4856 %                                                                             %
4857 %                                                                             %
4858 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4859 %                                                                             %
4860 %                                                                             %
4861 %                                                                             %
4862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4863 %
4864 %  MagickGetImageCompose() returns the composite operator associated with the
4865 %  image.
4866 %
4867 %  The format of the MagickGetImageCompose method is:
4868 %
4869 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4870 %
4871 %  A description of each parameter follows:
4872 %
4873 %    o wand: the magick wand.
4874 %
4875 */
MagickGetImageCompose(MagickWand * wand)4876 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4877 {
4878   assert(wand != (MagickWand *) NULL);
4879   assert(wand->signature == WandSignature);
4880   if (wand->debug != MagickFalse)
4881     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4882   if (wand->images == (Image *) NULL)
4883     {
4884       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4885         "ContainsNoImages","`%s'",wand->name);
4886       return(UndefinedCompositeOp);
4887     }
4888   return(wand->images->compose);
4889 }
4890 
4891 /*
4892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4893 %                                                                             %
4894 %                                                                             %
4895 %                                                                             %
4896 %   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                         %
4897 %                                                                             %
4898 %                                                                             %
4899 %                                                                             %
4900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4901 %
4902 %  MagickGetImageCompression() gets the image compression.
4903 %
4904 %  The format of the MagickGetImageCompression method is:
4905 %
4906 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4907 %
4908 %  A description of each parameter follows:
4909 %
4910 %    o wand: the magick wand.
4911 %
4912 */
MagickGetImageCompression(MagickWand * wand)4913 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4914 {
4915   assert(wand != (MagickWand *) NULL);
4916   assert(wand->signature == WandSignature);
4917   if (wand->debug != MagickFalse)
4918     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4919   if (wand->images == (Image *) NULL)
4920     {
4921       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4922         "ContainsNoImages","`%s'",wand->name);
4923       return(UndefinedCompression);
4924     }
4925   return(wand->images->compression);
4926 }
4927 
4928 /*
4929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4930 %                                                                             %
4931 %                                                                             %
4932 %                                                                             %
4933 %   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           %
4934 %                                                                             %
4935 %                                                                             %
4936 %                                                                             %
4937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4938 %
4939 %  MagickGetImageCompressionQuality() gets the image compression quality.
4940 %
4941 %  The format of the MagickGetImageCompressionQuality method is:
4942 %
4943 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4944 %
4945 %  A description of each parameter follows:
4946 %
4947 %    o wand: the magick wand.
4948 %
4949 */
MagickGetImageCompressionQuality(MagickWand * wand)4950 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4951 {
4952   assert(wand != (MagickWand *) NULL);
4953   assert(wand->signature == WandSignature);
4954   if (wand->debug != MagickFalse)
4955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4956   if (wand->images == (Image *) NULL)
4957     {
4958       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4959         "ContainsNoImages","`%s'",wand->name);
4960       return(0UL);
4961     }
4962   return(wand->images->quality);
4963 }
4964 
4965 /*
4966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4967 %                                                                             %
4968 %                                                                             %
4969 %                                                                             %
4970 %   M a g i c k G e t I m a g e D e l a y                                     %
4971 %                                                                             %
4972 %                                                                             %
4973 %                                                                             %
4974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4975 %
4976 %  MagickGetImageDelay() gets the image delay.
4977 %
4978 %  The format of the MagickGetImageDelay method is:
4979 %
4980 %      size_t MagickGetImageDelay(MagickWand *wand)
4981 %
4982 %  A description of each parameter follows:
4983 %
4984 %    o wand: the magick wand.
4985 %
4986 */
MagickGetImageDelay(MagickWand * wand)4987 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4988 {
4989   assert(wand != (MagickWand *) NULL);
4990   assert(wand->signature == WandSignature);
4991   if (wand->debug != MagickFalse)
4992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4993   if (wand->images == (Image *) NULL)
4994     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4995   return(wand->images->delay);
4996 }
4997 
4998 /*
4999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5000 %                                                                             %
5001 %                                                                             %
5002 %                                                                             %
5003 %   M a g i c k G e t I m a g e D e p t h                                     %
5004 %                                                                             %
5005 %                                                                             %
5006 %                                                                             %
5007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5008 %
5009 %  MagickGetImageDepth() gets the image depth.
5010 %
5011 %  The format of the MagickGetImageDepth method is:
5012 %
5013 %      size_t MagickGetImageDepth(MagickWand *wand)
5014 %
5015 %  A description of each parameter follows:
5016 %
5017 %    o wand: the magick wand.
5018 %
5019 */
MagickGetImageDepth(MagickWand * wand)5020 WandExport size_t MagickGetImageDepth(MagickWand *wand)
5021 {
5022   assert(wand != (MagickWand *) NULL);
5023   assert(wand->signature == WandSignature);
5024   if (wand->debug != MagickFalse)
5025     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5026   if (wand->images == (Image *) NULL)
5027     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5028   return(wand->images->depth);
5029 }
5030 
5031 /*
5032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5033 %                                                                             %
5034 %                                                                             %
5035 %                                                                             %
5036 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
5037 %                                                                             %
5038 %                                                                             %
5039 %                                                                             %
5040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5041 %
5042 %  MagickGetImageDistortion() compares an image to a reconstructed image and
5043 %  returns the specified distortion metric.
5044 %
5045 %  The format of the MagickGetImageDistortion method is:
5046 %
5047 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
5048 %        const MagickWand *reference,const MetricType metric,
5049 %        double *distortion)
5050 %
5051 %  A description of each parameter follows:
5052 %
5053 %    o wand: the magick wand.
5054 %
5055 %    o reference: the reference wand.
5056 %
5057 %    o metric: the metric.
5058 %
5059 %    o distortion: the computed distortion between the images.
5060 %
5061 */
MagickGetImageDistortion(MagickWand * wand,const MagickWand * reference,const MetricType metric,double * distortion)5062 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
5063   const MagickWand *reference,const MetricType metric,double *distortion)
5064 {
5065   MagickBooleanType
5066     status;
5067 
5068   assert(wand != (MagickWand *) NULL);
5069   assert(wand->signature == WandSignature);
5070   if (wand->debug != MagickFalse)
5071     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5072   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
5073     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5074   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
5075     &wand->images->exception);
5076   return(status);
5077 }
5078 
5079 /*
5080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5081 %                                                                             %
5082 %                                                                             %
5083 %                                                                             %
5084 %   M a g i c k G e t I m a g e D i s p o s e                                 %
5085 %                                                                             %
5086 %                                                                             %
5087 %                                                                             %
5088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5089 %
5090 %  MagickGetImageDispose() gets the image disposal method.
5091 %
5092 %  The format of the MagickGetImageDispose method is:
5093 %
5094 %      DisposeType MagickGetImageDispose(MagickWand *wand)
5095 %
5096 %  A description of each parameter follows:
5097 %
5098 %    o wand: the magick wand.
5099 %
5100 */
MagickGetImageDispose(MagickWand * wand)5101 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
5102 {
5103   assert(wand != (MagickWand *) NULL);
5104   assert(wand->signature == WandSignature);
5105   if (wand->debug != MagickFalse)
5106     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5107   if (wand->images == (Image *) NULL)
5108     {
5109       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5110         "ContainsNoImages","`%s'",wand->name);
5111       return(UndefinedDispose);
5112     }
5113   return((DisposeType) wand->images->dispose);
5114 }
5115 
5116 /*
5117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5118 %                                                                             %
5119 %                                                                             %
5120 %                                                                             %
5121 %   M a g i c k G e t I m a g e E n d i a n                                   %
5122 %                                                                             %
5123 %                                                                             %
5124 %                                                                             %
5125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5126 %
5127 %  MagickGetImageEndian() gets the image endian.
5128 %
5129 %  The format of the MagickGetImageEndian method is:
5130 %
5131 %      EndianType MagickGetImageEndian(MagickWand *wand)
5132 %
5133 %  A description of each parameter follows:
5134 %
5135 %    o wand: the magick wand.
5136 %
5137 */
MagickGetImageEndian(MagickWand * wand)5138 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
5139 {
5140   assert(wand != (MagickWand *) NULL);
5141   assert(wand->signature == WandSignature);
5142   if (wand->debug != MagickFalse)
5143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5144   if (wand->images == (Image *) NULL)
5145     {
5146       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5147         "ContainsNoImages","`%s'",wand->name);
5148       return(UndefinedEndian);
5149     }
5150   return(wand->images->endian);
5151 }
5152 
5153 /*
5154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5155 %                                                                             %
5156 %                                                                             %
5157 %                                                                             %
5158 %   M a g i c k G e t I m a g e F i l e n a m e                               %
5159 %                                                                             %
5160 %                                                                             %
5161 %                                                                             %
5162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5163 %
5164 %  MagickGetImageFilename() returns the filename of a particular image in a
5165 %  sequence.
5166 %
5167 %  The format of the MagickGetImageFilename method is:
5168 %
5169 %      char *MagickGetImageFilename(MagickWand *wand)
5170 %
5171 %  A description of each parameter follows:
5172 %
5173 %    o wand: the magick wand.
5174 %
5175 */
MagickGetImageFilename(MagickWand * wand)5176 WandExport char *MagickGetImageFilename(MagickWand *wand)
5177 {
5178   assert(wand != (MagickWand *) NULL);
5179   assert(wand->signature == WandSignature);
5180   if (wand->debug != MagickFalse)
5181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5182   if (wand->images == (Image *) NULL)
5183     {
5184       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5185         "ContainsNoImages","`%s'",wand->name);
5186       return((char *) NULL);
5187     }
5188   return(AcquireString(wand->images->filename));
5189 }
5190 
5191 /*
5192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5193 %                                                                             %
5194 %                                                                             %
5195 %                                                                             %
5196 %   M a g i c k G e t I m a g e F o r m a t                                   %
5197 %                                                                             %
5198 %                                                                             %
5199 %                                                                             %
5200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5201 %
5202 %  MagickGetImageFormat() returns the format of a particular image in a
5203 %  sequence.
5204 %
5205 %  The format of the MagickGetImageFormat method is:
5206 %
5207 %      char *MagickGetImageFormat(MagickWand *wand)
5208 %
5209 %  A description of each parameter follows:
5210 %
5211 %    o wand: the magick wand.
5212 %
5213 */
MagickGetImageFormat(MagickWand * wand)5214 WandExport char *MagickGetImageFormat(MagickWand *wand)
5215 {
5216   assert(wand != (MagickWand *) NULL);
5217   assert(wand->signature == WandSignature);
5218   if (wand->debug != MagickFalse)
5219     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5220   if (wand->images == (Image *) NULL)
5221     {
5222       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5223         "ContainsNoImages","`%s'",wand->name);
5224       return((char *) NULL);
5225     }
5226   return(AcquireString(wand->images->magick));
5227 }
5228 
5229 /*
5230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5231 %                                                                             %
5232 %                                                                             %
5233 %                                                                             %
5234 %   M a g i c k G e t I m a g e F u z z                                       %
5235 %                                                                             %
5236 %                                                                             %
5237 %                                                                             %
5238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5239 %
5240 %  MagickGetImageFuzz() gets the image fuzz.
5241 %
5242 %  The format of the MagickGetImageFuzz method is:
5243 %
5244 %      double MagickGetImageFuzz(MagickWand *wand)
5245 %
5246 %  A description of each parameter follows:
5247 %
5248 %    o wand: the magick wand.
5249 %
5250 */
MagickGetImageFuzz(MagickWand * wand)5251 WandExport double MagickGetImageFuzz(MagickWand *wand)
5252 {
5253   assert(wand != (MagickWand *) NULL);
5254   assert(wand->signature == WandSignature);
5255   if (wand->debug != MagickFalse)
5256     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5257   if (wand->images == (Image *) NULL)
5258     {
5259       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5260         "ContainsNoImages","`%s'",wand->name);
5261       return(0.0);
5262     }
5263   return(wand->images->fuzz);
5264 }
5265 
5266 /*
5267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5268 %                                                                             %
5269 %                                                                             %
5270 %                                                                             %
5271 %   M a g i c k G e t I m a g e G a m m a                                     %
5272 %                                                                             %
5273 %                                                                             %
5274 %                                                                             %
5275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5276 %
5277 %  MagickGetImageGamma() gets the image gamma.
5278 %
5279 %  The format of the MagickGetImageGamma method is:
5280 %
5281 %      double MagickGetImageGamma(MagickWand *wand)
5282 %
5283 %  A description of each parameter follows:
5284 %
5285 %    o wand: the magick wand.
5286 %
5287 */
MagickGetImageGamma(MagickWand * wand)5288 WandExport double MagickGetImageGamma(MagickWand *wand)
5289 {
5290   assert(wand != (MagickWand *) NULL);
5291   assert(wand->signature == WandSignature);
5292   if (wand->debug != MagickFalse)
5293     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5294   if (wand->images == (Image *) NULL)
5295     {
5296       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5297         "ContainsNoImages","`%s'",wand->name);
5298       return(0.0);
5299     }
5300   return(wand->images->gamma);
5301 }
5302 
5303 /*
5304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5305 %                                                                             %
5306 %                                                                             %
5307 %                                                                             %
5308 %   M a g i c k G e t I m a g e G r a v i t y                                 %
5309 %                                                                             %
5310 %                                                                             %
5311 %                                                                             %
5312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5313 %
5314 %  MagickGetImageGravity() gets the image gravity.
5315 %
5316 %  The format of the MagickGetImageGravity method is:
5317 %
5318 %      GravityType MagickGetImageGravity(MagickWand *wand)
5319 %
5320 %  A description of each parameter follows:
5321 %
5322 %    o wand: the magick wand.
5323 %
5324 */
MagickGetImageGravity(MagickWand * wand)5325 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5326 {
5327   assert(wand != (MagickWand *) NULL);
5328   assert(wand->signature == WandSignature);
5329   if (wand->debug != MagickFalse)
5330     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5331   if (wand->images == (Image *) NULL)
5332     {
5333       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5334         "ContainsNoImages","`%s'",wand->name);
5335       return(UndefinedGravity);
5336     }
5337   return(wand->images->gravity);
5338 }
5339 
5340 /*
5341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5342 %                                                                             %
5343 %                                                                             %
5344 %                                                                             %
5345 %   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                       %
5346 %                                                                             %
5347 %                                                                             %
5348 %                                                                             %
5349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5350 %
5351 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5352 %
5353 %  The format of the MagickGetImageGreenPrimary method is:
5354 %
5355 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5356 %        double *y)
5357 %
5358 %  A description of each parameter follows:
5359 %
5360 %    o wand: the magick wand.
5361 %
5362 %    o x: the chromaticity green primary x-point.
5363 %
5364 %    o y: the chromaticity green primary y-point.
5365 %
5366 */
MagickGetImageGreenPrimary(MagickWand * wand,double * x,double * y)5367 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5368   double *x,double *y)
5369 {
5370   assert(wand != (MagickWand *) NULL);
5371   assert(wand->signature == WandSignature);
5372   if (wand->debug != MagickFalse)
5373     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5374   if (wand->images == (Image *) NULL)
5375     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5376   *x=wand->images->chromaticity.green_primary.x;
5377   *y=wand->images->chromaticity.green_primary.y;
5378   return(MagickTrue);
5379 }
5380 
5381 /*
5382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5383 %                                                                             %
5384 %                                                                             %
5385 %                                                                             %
5386 %   M a g i c k G e t I m a g e H e i g h t                                   %
5387 %                                                                             %
5388 %                                                                             %
5389 %                                                                             %
5390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5391 %
5392 %  MagickGetImageHeight() returns the image height.
5393 %
5394 %  The format of the MagickGetImageHeight method is:
5395 %
5396 %      size_t MagickGetImageHeight(MagickWand *wand)
5397 %
5398 %  A description of each parameter follows:
5399 %
5400 %    o wand: the magick wand.
5401 %
5402 */
MagickGetImageHeight(MagickWand * wand)5403 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5404 {
5405   assert(wand != (MagickWand *) NULL);
5406   assert(wand->signature == WandSignature);
5407   if (wand->debug != MagickFalse)
5408     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5409   if (wand->images == (Image *) NULL)
5410     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5411   return(wand->images->rows);
5412 }
5413 
5414 /*
5415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5416 %                                                                             %
5417 %                                                                             %
5418 %                                                                             %
5419 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
5420 %                                                                             %
5421 %                                                                             %
5422 %                                                                             %
5423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5424 %
5425 %  MagickGetImageHistogram() returns the image histogram as an array of
5426 %  PixelWand wands.
5427 %
5428 %  The format of the MagickGetImageHistogram method is:
5429 %
5430 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5431 %        size_t *number_colors)
5432 %
5433 %  A description of each parameter follows:
5434 %
5435 %    o wand: the magick wand.
5436 %
5437 %    o number_colors: the number of unique colors in the image and the number
5438 %      of pixel wands returned.
5439 %
5440 */
MagickGetImageHistogram(MagickWand * wand,size_t * number_colors)5441 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5442   size_t *number_colors)
5443 {
5444   ColorPacket
5445     *histogram;
5446 
5447   PixelWand
5448     **pixel_wands;
5449 
5450   ssize_t
5451     i;
5452 
5453   assert(wand != (MagickWand *) NULL);
5454   assert(wand->signature == WandSignature);
5455   if (wand->debug != MagickFalse)
5456     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5457   if (wand->images == (Image *) NULL)
5458     {
5459       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5460         "ContainsNoImages","`%s'",wand->name);
5461       return((PixelWand **) NULL);
5462     }
5463   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5464   if (histogram == (ColorPacket *) NULL)
5465     return((PixelWand **) NULL);
5466   pixel_wands=NewPixelWands(*number_colors);
5467   for (i=0; i < (ssize_t) *number_colors; i++)
5468   {
5469     PixelSetQuantumColor(pixel_wands[i],&histogram[i].pixel);
5470     PixelSetIndex(pixel_wands[i],histogram[i].index);
5471     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5472   }
5473   histogram=(ColorPacket *) RelinquishMagickMemory(histogram);
5474   return(pixel_wands);
5475 }
5476 
5477 /*
5478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5479 %                                                                             %
5480 %                                                                             %
5481 %                                                                             %
5482 %   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                 %
5483 %                                                                             %
5484 %                                                                             %
5485 %                                                                             %
5486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5487 %
5488 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5489 %
5490 %  The format of the MagickGetImageInterlaceScheme method is:
5491 %
5492 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5493 %
5494 %  A description of each parameter follows:
5495 %
5496 %    o wand: the magick wand.
5497 %
5498 */
MagickGetImageInterlaceScheme(MagickWand * wand)5499 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5500 {
5501   assert(wand != (MagickWand *) NULL);
5502   assert(wand->signature == WandSignature);
5503   if (wand->debug != MagickFalse)
5504     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5505   if (wand->images == (Image *) NULL)
5506     {
5507       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5508         "ContainsNoImages","`%s'",wand->name);
5509       return(UndefinedInterlace);
5510     }
5511   return(wand->images->interlace);
5512 }
5513 
5514 /*
5515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5516 %                                                                             %
5517 %                                                                             %
5518 %                                                                             %
5519 %   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             %
5520 %                                                                             %
5521 %                                                                             %
5522 %                                                                             %
5523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5524 %
5525 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5526 %  sepcified image.
5527 %
5528 %  The format of the MagickGetImageInterpolateMethod method is:
5529 %
5530 %      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5531 %
5532 %  A description of each parameter follows:
5533 %
5534 %    o wand: the magick wand.
5535 %
5536 */
MagickGetImageInterpolateMethod(MagickWand * wand)5537 WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5538   MagickWand *wand)
5539 {
5540   assert(wand != (MagickWand *) NULL);
5541   assert(wand->signature == WandSignature);
5542   if (wand->debug != MagickFalse)
5543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5544   if (wand->images == (Image *) NULL)
5545     {
5546       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5547         "ContainsNoImages","`%s'",wand->name);
5548       return(UndefinedInterpolatePixel);
5549     }
5550   return(wand->images->interpolate);
5551 }
5552 
5553 /*
5554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5555 %                                                                             %
5556 %                                                                             %
5557 %                                                                             %
5558 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5559 %                                                                             %
5560 %                                                                             %
5561 %                                                                             %
5562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5563 %
5564 %  MagickGetImageIterations() gets the image iterations.
5565 %
5566 %  The format of the MagickGetImageIterations method is:
5567 %
5568 %      size_t MagickGetImageIterations(MagickWand *wand)
5569 %
5570 %  A description of each parameter follows:
5571 %
5572 %    o wand: the magick wand.
5573 %
5574 */
MagickGetImageIterations(MagickWand * wand)5575 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5576 {
5577   assert(wand != (MagickWand *) NULL);
5578   assert(wand->signature == WandSignature);
5579   if (wand->debug != MagickFalse)
5580     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5581   if (wand->images == (Image *) NULL)
5582     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5583   return(wand->images->iterations);
5584 }
5585 
5586 /*
5587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5588 %                                                                             %
5589 %                                                                             %
5590 %                                                                             %
5591 %   M a g i c k G e t I m a g e L e n g t h                                   %
5592 %                                                                             %
5593 %                                                                             %
5594 %                                                                             %
5595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5596 %
5597 %  MagickGetImageLength() returns the image length in bytes.
5598 %
5599 %  The format of the MagickGetImageLength method is:
5600 %
5601 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5602 %        MagickSizeType *length)
5603 %
5604 %  A description of each parameter follows:
5605 %
5606 %    o wand: the magick wand.
5607 %
5608 %    o length: the image length in bytes.
5609 %
5610 */
MagickGetImageLength(MagickWand * wand,MagickSizeType * length)5611 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5612   MagickSizeType *length)
5613 {
5614   assert(wand != (MagickWand *) NULL);
5615   assert(wand->signature == WandSignature);
5616   if (wand->debug != MagickFalse)
5617     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5618   if (wand->images == (Image *) NULL)
5619     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5620   *length=GetBlobSize(wand->images);
5621   return(MagickTrue);
5622 }
5623 
5624 /*
5625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5626 %                                                                             %
5627 %                                                                             %
5628 %                                                                             %
5629 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5630 %                                                                             %
5631 %                                                                             %
5632 %                                                                             %
5633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634 %
5635 %  MagickGetImageMatteColor() returns the image matte color.
5636 %
5637 %  The format of the MagickGetImageMatteColor method is:
5638 %
5639 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5640 %        PixelWand *matte_color)
5641 %
5642 %  A description of each parameter follows:
5643 %
5644 %    o wand: the magick wand.
5645 %
5646 %    o matte_color: Return the matte color.
5647 %
5648 */
MagickGetImageMatteColor(MagickWand * wand,PixelWand * matte_color)5649 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5650   PixelWand *matte_color)
5651 {
5652   assert(wand != (MagickWand *) NULL);
5653   assert(wand->signature == WandSignature);
5654   if (wand->debug != MagickFalse)
5655     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5656   if (wand->images == (Image *) NULL)
5657     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5658   PixelSetQuantumColor(matte_color,&wand->images->matte_color);
5659   return(MagickTrue);
5660 }
5661 
5662 /*
5663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5664 %                                                                             %
5665 %                                                                             %
5666 %                                                                             %
5667 %   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                         %
5668 %                                                                             %
5669 %                                                                             %
5670 %                                                                             %
5671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5672 %
5673 %  MagickGetImageOrientation() returns the image orientation.
5674 %
5675 %  The format of the MagickGetImageOrientation method is:
5676 %
5677 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5678 %
5679 %  A description of each parameter follows:
5680 %
5681 %    o wand: the magick wand.
5682 %
5683 */
MagickGetImageOrientation(MagickWand * wand)5684 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5685 {
5686   assert(wand != (MagickWand *) NULL);
5687   assert(wand->signature == WandSignature);
5688   if (wand->debug != MagickFalse)
5689     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5690   if (wand->images == (Image *) NULL)
5691     {
5692       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5693         "ContainsNoImages","`%s'",wand->name);
5694       return(UndefinedOrientation);
5695     }
5696   return(wand->images->orientation);
5697 }
5698 
5699 /*
5700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5701 %                                                                             %
5702 %                                                                             %
5703 %                                                                             %
5704 %   M a g i c k G e t I m a g e P a g e                                       %
5705 %                                                                             %
5706 %                                                                             %
5707 %                                                                             %
5708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5709 %
5710 %  MagickGetImagePage() returns the page geometry associated with the image.
5711 %
5712 %  The format of the MagickGetImagePage method is:
5713 %
5714 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5715 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5716 %
5717 %  A description of each parameter follows:
5718 %
5719 %    o wand: the magick wand.
5720 %
5721 %    o width: the page width.
5722 %
5723 %    o height: the page height.
5724 %
5725 %    o x: the page x-offset.
5726 %
5727 %    o y: the page y-offset.
5728 %
5729 */
MagickGetImagePage(MagickWand * wand,size_t * width,size_t * height,ssize_t * x,ssize_t * y)5730 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5731   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5732 {
5733   assert(wand != (const MagickWand *) NULL);
5734   assert(wand->signature == WandSignature);
5735   if (wand->debug != MagickFalse)
5736     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5737   if (wand->images == (Image *) NULL)
5738     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5739   *width=wand->images->page.width;
5740   *height=wand->images->page.height;
5741   *x=wand->images->page.x;
5742   *y=wand->images->page.y;
5743   return(MagickTrue);
5744 }
5745 
5746 /*
5747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5748 %                                                                             %
5749 %                                                                             %
5750 %                                                                             %
5751 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5752 %                                                                             %
5753 %                                                                             %
5754 %                                                                             %
5755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5756 %
5757 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5758 %
5759 %  The format of the MagickGetImagePixelColor method is:
5760 %
5761 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5762 %        const ssize_t x,const ssize_t y,PixelWand *color)
5763 %
5764 %  A description of each parameter follows:
5765 %
5766 %    o wand: the magick wand.
5767 %
5768 %    o x,y: the pixel offset into the image.
5769 %
5770 %    o color: Return the colormap color in this wand.
5771 %
5772 */
MagickGetImagePixelColor(MagickWand * wand,const ssize_t x,const ssize_t y,PixelWand * color)5773 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5774   const ssize_t x,const ssize_t y,PixelWand *color)
5775 {
5776   IndexPacket
5777     *indexes;
5778 
5779   const PixelPacket
5780     *p;
5781 
5782   CacheView
5783     *image_view;
5784 
5785   assert(wand != (MagickWand *) NULL);
5786   assert(wand->signature == WandSignature);
5787   if (wand->debug != MagickFalse)
5788     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5789   if (wand->images == (Image *) NULL)
5790     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5791   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5792   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5793   if (p == (const PixelPacket *) NULL)
5794     {
5795       image_view=DestroyCacheView(image_view);
5796       return(MagickFalse);
5797     }
5798   indexes=GetCacheViewAuthenticIndexQueue(image_view);
5799   PixelSetQuantumColor(color,p);
5800   if (GetCacheViewColorspace(image_view) == CMYKColorspace)
5801     PixelSetBlackQuantum(color,*indexes);
5802   else
5803     if (GetCacheViewStorageClass(image_view) == PseudoClass)
5804       PixelSetIndex(color,*indexes);
5805   image_view=DestroyCacheView(image_view);
5806   return(MagickTrue);
5807 }
5808 
5809 /*
5810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5811 %                                                                             %
5812 %                                                                             %
5813 %                                                                             %
5814 +   M a g i c k G e t I m a g e R a n g e                                     %
5815 %                                                                             %
5816 %                                                                             %
5817 %                                                                             %
5818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5819 %
5820 %  MagickGetImageRange() gets the pixel range for the image.
5821 %
5822 %  The format of the MagickGetImageRange method is:
5823 %
5824 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5825 %        double *maxima)
5826 %
5827 %  A description of each parameter follows:
5828 %
5829 %    o wand: the magick wand.
5830 %
5831 %    o minima:  The minimum pixel value for the specified channel(s).
5832 %
5833 %    o maxima:  The maximum pixel value for the specified channel(s).
5834 %
5835 */
MagickGetImageRange(MagickWand * wand,double * minima,double * maxima)5836 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5837   double *minima,double *maxima)
5838 {
5839   MagickBooleanType
5840     status;
5841 
5842   assert(wand != (MagickWand *) NULL);
5843   assert(wand->signature == WandSignature);
5844   if (wand->debug != MagickFalse)
5845     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5846   if (wand->images == (Image *) NULL)
5847     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5848   status=GetImageRange(wand->images,minima,maxima,wand->exception);
5849   return(status);
5850 }
5851 
5852 /*
5853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5854 %                                                                             %
5855 %                                                                             %
5856 %                                                                             %
5857 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5858 %                                                                             %
5859 %                                                                             %
5860 %                                                                             %
5861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5862 %
5863 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5864 %
5865 %  The format of the MagickGetImageRedPrimary method is:
5866 %
5867 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5868 %        double *y)
5869 %
5870 %  A description of each parameter follows:
5871 %
5872 %    o wand: the magick wand.
5873 %
5874 %    o x: the chromaticity red primary x-point.
5875 %
5876 %    o y: the chromaticity red primary y-point.
5877 %
5878 */
MagickGetImageRedPrimary(MagickWand * wand,double * x,double * y)5879 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5880   double *x,double *y)
5881 {
5882   assert(wand != (MagickWand *) NULL);
5883   assert(wand->signature == WandSignature);
5884   if (wand->debug != MagickFalse)
5885     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5886   if (wand->images == (Image *) NULL)
5887     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5888   *x=wand->images->chromaticity.red_primary.x;
5889   *y=wand->images->chromaticity.red_primary.y;
5890   return(MagickTrue);
5891 }
5892 
5893 /*
5894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5895 %                                                                             %
5896 %                                                                             %
5897 %                                                                             %
5898 %   M a g i c k G e t I m a g e R e g i o n                                   %
5899 %                                                                             %
5900 %                                                                             %
5901 %                                                                             %
5902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5903 %
5904 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5905 %  a new wand.
5906 %
5907 %  The format of the MagickGetImageRegion method is:
5908 %
5909 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5910 %        const size_t width,const size_t height,const ssize_t x,
5911 %        const ssize_t y)
5912 %
5913 %  A description of each parameter follows:
5914 %
5915 %    o wand: the magick wand.
5916 %
5917 %    o width: the region width.
5918 %
5919 %    o height: the region height.
5920 %
5921 %    o x: the region x offset.
5922 %
5923 %    o y: the region y offset.
5924 %
5925 */
MagickGetImageRegion(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)5926 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,const size_t width,
5927   const size_t height,const ssize_t x,const ssize_t y)
5928 {
5929   Image
5930     *region_image;
5931 
5932   RectangleInfo
5933     region;
5934 
5935   assert(wand != (MagickWand *) NULL);
5936   assert(wand->signature == WandSignature);
5937   if (wand->debug != MagickFalse)
5938     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5939   if (wand->images == (Image *) NULL)
5940     return((MagickWand *) NULL);
5941   region.width=width;
5942   region.height=height;
5943   region.x=x;
5944   region.y=y;
5945   region_image=CropImage(wand->images,&region,wand->exception);
5946   if (region_image == (Image *) NULL)
5947     return((MagickWand *) NULL);
5948   return(CloneMagickWandFromImages(wand,region_image));
5949 }
5950 
5951 /*
5952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5953 %                                                                             %
5954 %                                                                             %
5955 %                                                                             %
5956 %   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                 %
5957 %                                                                             %
5958 %                                                                             %
5959 %                                                                             %
5960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5961 %
5962 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5963 %
5964 %  The format of the MagickGetImageRenderingIntent method is:
5965 %
5966 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5967 %
5968 %  A description of each parameter follows:
5969 %
5970 %    o wand: the magick wand.
5971 %
5972 */
MagickGetImageRenderingIntent(MagickWand * wand)5973 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5974 {
5975   assert(wand != (MagickWand *) NULL);
5976   assert(wand->signature == WandSignature);
5977   if (wand->debug != MagickFalse)
5978     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5979   if (wand->images == (Image *) NULL)
5980     {
5981       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5982         "ContainsNoImages","`%s'",wand->name);
5983       return(UndefinedIntent);
5984     }
5985   return((RenderingIntent) wand->images->rendering_intent);
5986 }
5987 
5988 /*
5989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5990 %                                                                             %
5991 %                                                                             %
5992 %                                                                             %
5993 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5994 %                                                                             %
5995 %                                                                             %
5996 %                                                                             %
5997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5998 %
5999 %  MagickGetImageResolution() gets the image X and Y resolution.
6000 %
6001 %  The format of the MagickGetImageResolution method is:
6002 %
6003 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
6004 %        double *y)
6005 %
6006 %  A description of each parameter follows:
6007 %
6008 %    o wand: the magick wand.
6009 %
6010 %    o x: the image x-resolution.
6011 %
6012 %    o y: the image y-resolution.
6013 %
6014 */
MagickGetImageResolution(MagickWand * wand,double * x,double * y)6015 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
6016   double *x,double *y)
6017 {
6018   assert(wand != (MagickWand *) NULL);
6019   assert(wand->signature == WandSignature);
6020   if (wand->debug != MagickFalse)
6021     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6022   if (wand->images == (Image *) NULL)
6023     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6024   *x=wand->images->x_resolution;
6025   *y=wand->images->y_resolution;
6026   return(MagickTrue);
6027 }
6028 
6029 /*
6030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6031 %                                                                             %
6032 %                                                                             %
6033 %                                                                             %
6034 %   M a g i c k G e t I m a g e S c e n e                                     %
6035 %                                                                             %
6036 %                                                                             %
6037 %                                                                             %
6038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6039 %
6040 %  MagickGetImageScene() gets the image scene.
6041 %
6042 %  The format of the MagickGetImageScene method is:
6043 %
6044 %      size_t MagickGetImageScene(MagickWand *wand)
6045 %
6046 %  A description of each parameter follows:
6047 %
6048 %    o wand: the magick wand.
6049 %
6050 */
MagickGetImageScene(MagickWand * wand)6051 WandExport size_t MagickGetImageScene(MagickWand *wand)
6052 {
6053   assert(wand != (MagickWand *) NULL);
6054   assert(wand->signature == WandSignature);
6055   if (wand->debug != MagickFalse)
6056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6057   if (wand->images == (Image *) NULL)
6058     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6059   return(wand->images->scene);
6060 }
6061 
6062 /*
6063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6064 %                                                                             %
6065 %                                                                             %
6066 %                                                                             %
6067 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
6068 %                                                                             %
6069 %                                                                             %
6070 %                                                                             %
6071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6072 %
6073 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
6074 %  pixel stream.
6075 %
6076 %  The format of the MagickGetImageSignature method is:
6077 %
6078 %      char *MagickGetImageSignature(MagickWand *wand)
6079 %
6080 %  A description of each parameter follows:
6081 %
6082 %    o wand: the magick wand.
6083 %
6084 */
MagickGetImageSignature(MagickWand * wand)6085 WandExport char *MagickGetImageSignature(MagickWand *wand)
6086 {
6087   const char
6088     *value;
6089 
6090   MagickBooleanType
6091     status;
6092 
6093   assert(wand != (MagickWand *) NULL);
6094   assert(wand->signature == WandSignature);
6095   if (wand->debug != MagickFalse)
6096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6097   if (wand->images == (Image *) NULL)
6098     {
6099       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6100         "ContainsNoImages","`%s'",wand->name);
6101       return((char *) NULL);
6102     }
6103   status=SignatureImage(wand->images);
6104   if (status == MagickFalse)
6105     InheritException(wand->exception,&wand->images->exception);
6106   value=GetImageProperty(wand->images,"signature");
6107   if (value != (const char *) NULL)
6108     return(AcquireString(value));
6109   InheritException(wand->exception,&wand->images->exception);
6110   return((char *) NULL);
6111 }
6112 
6113 /*
6114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6115 %                                                                             %
6116 %                                                                             %
6117 %                                                                             %
6118 %   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                   %
6119 %                                                                             %
6120 %                                                                             %
6121 %                                                                             %
6122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6123 %
6124 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
6125 %
6126 %  The format of the MagickGetImageTicksPerSecond method is:
6127 %
6128 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
6129 %
6130 %  A description of each parameter follows:
6131 %
6132 %    o wand: the magick wand.
6133 %
6134 */
MagickGetImageTicksPerSecond(MagickWand * wand)6135 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
6136 {
6137   assert(wand != (MagickWand *) NULL);
6138   assert(wand->signature == WandSignature);
6139   if (wand->debug != MagickFalse)
6140     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6141   if (wand->images == (Image *) NULL)
6142     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6143   return((size_t) wand->images->ticks_per_second);
6144 }
6145 
6146 /*
6147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6148 %                                                                             %
6149 %                                                                             %
6150 %                                                                             %
6151 %   M a g i c k G e t I m a g e T y p e                                       %
6152 %                                                                             %
6153 %                                                                             %
6154 %                                                                             %
6155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6156 %
6157 %  MagickGetImageType() gets the potential image type:
6158 %
6159 %        Bilevel        Grayscale       GrayscaleMatte
6160 %        Palette        PaletteMatte    TrueColor
6161 %        TrueColorMatte ColorSeparation ColorSeparationMatte
6162 %
6163 %  To ensure the image type matches its potential, use MagickSetImageType():
6164 %
6165 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
6166 %
6167 %  The format of the MagickGetImageType method is:
6168 %
6169 %      ImageType MagickGetImageType(MagickWand *wand)
6170 %
6171 %  A description of each parameter follows:
6172 %
6173 %    o wand: the magick wand.
6174 %
6175 */
MagickGetImageType(MagickWand * wand)6176 WandExport ImageType MagickGetImageType(MagickWand *wand)
6177 {
6178   assert(wand != (MagickWand *) NULL);
6179   assert(wand->signature == WandSignature);
6180   if (wand->debug != MagickFalse)
6181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6182   if (wand->images == (Image *) NULL)
6183     {
6184       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6185         "ContainsNoImages","`%s'",wand->name);
6186       return(UndefinedType);
6187     }
6188   return(GetImageType(wand->images,wand->exception));
6189 }
6190 
6191 /*
6192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6193 %                                                                             %
6194 %                                                                             %
6195 %                                                                             %
6196 %   M a g i c k G e t I m a g e U n i t s                                     %
6197 %                                                                             %
6198 %                                                                             %
6199 %                                                                             %
6200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6201 %
6202 %  MagickGetImageUnits() gets the image units of resolution.
6203 %
6204 %  The format of the MagickGetImageUnits method is:
6205 %
6206 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
6207 %
6208 %  A description of each parameter follows:
6209 %
6210 %    o wand: the magick wand.
6211 %
6212 */
MagickGetImageUnits(MagickWand * wand)6213 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
6214 {
6215   assert(wand != (MagickWand *) NULL);
6216   assert(wand->signature == WandSignature);
6217   if (wand->debug != MagickFalse)
6218     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6219   if (wand->images == (Image *) NULL)
6220     {
6221       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6222         "ContainsNoImages","`%s'",wand->name);
6223       return(UndefinedResolution);
6224     }
6225   return(wand->images->units);
6226 }
6227 
6228 /*
6229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6230 %                                                                             %
6231 %                                                                             %
6232 %                                                                             %
6233 %   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           %
6234 %                                                                             %
6235 %                                                                             %
6236 %                                                                             %
6237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6238 %
6239 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6240 %  sepcified image.
6241 %
6242 %  The format of the MagickGetImageVirtualPixelMethod method is:
6243 %
6244 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6245 %
6246 %  A description of each parameter follows:
6247 %
6248 %    o wand: the magick wand.
6249 %
6250 */
MagickGetImageVirtualPixelMethod(MagickWand * wand)6251 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6252 {
6253   assert(wand != (MagickWand *) NULL);
6254   assert(wand->signature == WandSignature);
6255   if (wand->debug != MagickFalse)
6256     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6257   if (wand->images == (Image *) NULL)
6258     {
6259       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6260         "ContainsNoImages","`%s'",wand->name);
6261       return(UndefinedVirtualPixelMethod);
6262     }
6263   return(GetImageVirtualPixelMethod(wand->images));
6264 }
6265 
6266 /*
6267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6268 %                                                                             %
6269 %                                                                             %
6270 %                                                                             %
6271 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
6272 %                                                                             %
6273 %                                                                             %
6274 %                                                                             %
6275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6276 %
6277 %  MagickGetImageWhitePoint() returns the chromaticy white point.
6278 %
6279 %  The format of the MagickGetImageWhitePoint method is:
6280 %
6281 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6282 %        double *y)
6283 %
6284 %  A description of each parameter follows:
6285 %
6286 %    o wand: the magick wand.
6287 %
6288 %    o x: the chromaticity white x-point.
6289 %
6290 %    o y: the chromaticity white y-point.
6291 %
6292 */
MagickGetImageWhitePoint(MagickWand * wand,double * x,double * y)6293 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6294   double *x,double *y)
6295 {
6296   assert(wand != (MagickWand *) NULL);
6297   assert(wand->signature == WandSignature);
6298   if (wand->debug != MagickFalse)
6299     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6300   if (wand->images == (Image *) NULL)
6301     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6302   *x=wand->images->chromaticity.white_point.x;
6303   *y=wand->images->chromaticity.white_point.y;
6304   return(MagickTrue);
6305 }
6306 
6307 /*
6308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6309 %                                                                             %
6310 %                                                                             %
6311 %                                                                             %
6312 %   M a g i c k G e t I m a g e W i d t h                                     %
6313 %                                                                             %
6314 %                                                                             %
6315 %                                                                             %
6316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6317 %
6318 %  MagickGetImageWidth() returns the image width.
6319 %
6320 %  The format of the MagickGetImageWidth method is:
6321 %
6322 %      size_t MagickGetImageWidth(MagickWand *wand)
6323 %
6324 %  A description of each parameter follows:
6325 %
6326 %    o wand: the magick wand.
6327 %
6328 */
MagickGetImageWidth(MagickWand * wand)6329 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6330 {
6331   assert(wand != (MagickWand *) NULL);
6332   assert(wand->signature == WandSignature);
6333   if (wand->debug != MagickFalse)
6334     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6335   if (wand->images == (Image *) NULL)
6336     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6337   return(wand->images->columns);
6338 }
6339 
6340 /*
6341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6342 %                                                                             %
6343 %                                                                             %
6344 %                                                                             %
6345 %   M a g i c k G e t N u m b e r I m a g e s                                 %
6346 %                                                                             %
6347 %                                                                             %
6348 %                                                                             %
6349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6350 %
6351 %  MagickGetNumberImages() returns the number of images associated with a
6352 %  magick wand.
6353 %
6354 %  The format of the MagickGetNumberImages method is:
6355 %
6356 %      size_t MagickGetNumberImages(MagickWand *wand)
6357 %
6358 %  A description of each parameter follows:
6359 %
6360 %    o wand: the magick wand.
6361 %
6362 */
MagickGetNumberImages(MagickWand * wand)6363 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6364 {
6365   assert(wand != (MagickWand *) NULL);
6366   assert(wand->signature == WandSignature);
6367   if (wand->debug != MagickFalse)
6368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6369   return(GetImageListLength(wand->images));
6370 }
6371 
6372 /*
6373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6374 %                                                                             %
6375 %                                                                             %
6376 %                                                                             %
6377 %   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                 %
6378 %                                                                             %
6379 %                                                                             %
6380 %                                                                             %
6381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6382 %
6383 %  MagickGetImageTotalInkDensity() gets the image total ink density.
6384 %
6385 %  The format of the MagickGetImageTotalInkDensity method is:
6386 %
6387 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
6388 %
6389 %  A description of each parameter follows:
6390 %
6391 %    o wand: the magick wand.
6392 %
6393 */
MagickGetImageTotalInkDensity(MagickWand * wand)6394 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6395 {
6396   assert(wand != (MagickWand *) NULL);
6397   assert(wand->signature == WandSignature);
6398   if (wand->debug != MagickFalse)
6399     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6400   if (wand->images == (Image *) NULL)
6401     {
6402       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6403         "ContainsNoImages","`%s'",wand->name);
6404       return(0.0);
6405     }
6406   return(GetImageTotalInkDensity(wand->images));
6407 }
6408 
6409 /*
6410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6411 %                                                                             %
6412 %                                                                             %
6413 %                                                                             %
6414 %   M a g i c k H a l d C l u t I m a g e                                     %
6415 %                                                                             %
6416 %                                                                             %
6417 %                                                                             %
6418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6419 %
6420 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6421 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6422 %  dimensions.  Create it with the HALD coder.  You can apply any color
6423 %  transformation to the Hald image and then use this method to apply the
6424 %  transform to the image.
6425 %
6426 %  The format of the MagickHaldClutImage method is:
6427 %
6428 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6429 %        const MagickWand *hald_wand)
6430 %      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6431 %        const ChannelType channel,const MagickWand *hald_wand)
6432 %
6433 %  A description of each parameter follows:
6434 %
6435 %    o wand: the magick wand.
6436 %
6437 %    o hald_image: the hald CLUT image.
6438 %
6439 */
6440 
MagickHaldClutImage(MagickWand * wand,const MagickWand * hald_wand)6441 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6442   const MagickWand *hald_wand)
6443 {
6444   MagickBooleanType
6445     status;
6446 
6447   status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6448   return(status);
6449 }
6450 
MagickHaldClutImageChannel(MagickWand * wand,const ChannelType channel,const MagickWand * hald_wand)6451 WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6452   const ChannelType channel,const MagickWand *hald_wand)
6453 {
6454   MagickBooleanType
6455     status;
6456 
6457   assert(wand != (MagickWand *) NULL);
6458   assert(wand->signature == WandSignature);
6459   if (wand->debug != MagickFalse)
6460     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6461   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6462     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6463   status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6464   if (status == MagickFalse)
6465     InheritException(wand->exception,&wand->images->exception);
6466   return(status);
6467 }
6468 
6469 /*
6470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6471 %                                                                             %
6472 %                                                                             %
6473 %                                                                             %
6474 %   M a g i c k H a s N e x t I m a g e                                       %
6475 %                                                                             %
6476 %                                                                             %
6477 %                                                                             %
6478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6479 %
6480 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
6481 %  traversing the list in the forward direction
6482 %
6483 %  The format of the MagickHasNextImage method is:
6484 %
6485 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6486 %
6487 %  A description of each parameter follows:
6488 %
6489 %    o wand: the magick wand.
6490 %
6491 */
MagickHasNextImage(MagickWand * wand)6492 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6493 {
6494   assert(wand != (MagickWand *) NULL);
6495   assert(wand->signature == WandSignature);
6496   if (wand->debug != MagickFalse)
6497     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6498   if (wand->images == (Image *) NULL)
6499     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6500   if (GetNextImageInList(wand->images) == (Image *) NULL)
6501     return(MagickFalse);
6502   return(MagickTrue);
6503 }
6504 
6505 /*
6506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6507 %                                                                             %
6508 %                                                                             %
6509 %                                                                             %
6510 %   M a g i c k H a s P r e v i o u s I m a g e                               %
6511 %                                                                             %
6512 %                                                                             %
6513 %                                                                             %
6514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6515 %
6516 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6517 %  traversing the list in the reverse direction
6518 %
6519 %  The format of the MagickHasPreviousImage method is:
6520 %
6521 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6522 %
6523 %  A description of each parameter follows:
6524 %
6525 %    o wand: the magick wand.
6526 %
6527 */
MagickHasPreviousImage(MagickWand * wand)6528 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6529 {
6530   assert(wand != (MagickWand *) NULL);
6531   assert(wand->signature == WandSignature);
6532   if (wand->debug != MagickFalse)
6533     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6534   if (wand->images == (Image *) NULL)
6535     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6536   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6537     return(MagickFalse);
6538   return(MagickTrue);
6539 }
6540 
6541 /*
6542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6543 %                                                                             %
6544 %                                                                             %
6545 %                                                                             %
6546 %   M a g i c k I d e n t i f y I m a g e                                     %
6547 %                                                                             %
6548 %                                                                             %
6549 %                                                                             %
6550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6551 %
6552 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6553 %  file.  Attributes include the image width, height, size, and others.
6554 %
6555 %  The format of the MagickIdentifyImage method is:
6556 %
6557 %      const char *MagickIdentifyImage(MagickWand *wand)
6558 %
6559 %  A description of each parameter follows:
6560 %
6561 %    o wand: the magick wand.
6562 %
6563 */
MagickIdentifyImage(MagickWand * wand)6564 WandExport char *MagickIdentifyImage(MagickWand *wand)
6565 {
6566   char
6567     *description,
6568     filename[MaxTextExtent];
6569 
6570   FILE
6571     *file;
6572 
6573   int
6574     unique_file;
6575 
6576   assert(wand != (MagickWand *) NULL);
6577   assert(wand->signature == WandSignature);
6578   if (wand->debug != MagickFalse)
6579     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6580   if (wand->images == (Image *) NULL)
6581     {
6582       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6583         "ContainsNoImages","`%s'",wand->name);
6584       return((char *) NULL);
6585     }
6586   description=(char *) NULL;
6587   unique_file=AcquireUniqueFileResource(filename);
6588   file=(FILE *) NULL;
6589   if (unique_file != -1)
6590     file=fdopen(unique_file,"wb");
6591   if ((unique_file == -1) || (file == (FILE *) NULL))
6592     {
6593       (void) RelinquishUniqueFileResource(filename);
6594       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6595         "UnableToCreateTemporaryFile","`%s'",wand->name);
6596       return((char *) NULL);
6597     }
6598   (void) IdentifyImage(wand->images,file,MagickTrue);
6599   (void) fclose(file);
6600   description=FileToString(filename,~0UL,wand->exception);
6601   (void) RelinquishUniqueFileResource(filename);
6602   return(description);
6603 }
6604 
6605 /*
6606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6607 %                                                                             %
6608 %                                                                             %
6609 %                                                                             %
6610 %   M a g i c k I m p l o d e I m a g e                                       %
6611 %                                                                             %
6612 %                                                                             %
6613 %                                                                             %
6614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6615 %
6616 %  MagickImplodeImage() creates a new image that is a copy of an existing
6617 %  one with the image pixels "implode" by the specified percentage.  It
6618 %  allocates the memory necessary for the new Image structure and returns a
6619 %  pointer to the new image.
6620 %
6621 %  The format of the MagickImplodeImage method is:
6622 %
6623 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6624 %        const double radius)
6625 %
6626 %  A description of each parameter follows:
6627 %
6628 %    o wand: the magick wand.
6629 %
6630 %    o amount: Define the extent of the implosion.
6631 %
6632 */
MagickImplodeImage(MagickWand * wand,const double amount)6633 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6634   const double amount)
6635 {
6636   Image
6637     *implode_image;
6638 
6639   assert(wand != (MagickWand *) NULL);
6640   assert(wand->signature == WandSignature);
6641   if (wand->debug != MagickFalse)
6642     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6643   if (wand->images == (Image *) NULL)
6644     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6645   implode_image=ImplodeImage(wand->images,amount,wand->exception);
6646   if (implode_image == (Image *) NULL)
6647     return(MagickFalse);
6648   ReplaceImageInList(&wand->images,implode_image);
6649   return(MagickTrue);
6650 }
6651 
6652 /*
6653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6654 %                                                                             %
6655 %                                                                             %
6656 %                                                                             %
6657 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6658 %                                                                             %
6659 %                                                                             %
6660 %                                                                             %
6661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6662 %
6663 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6664 %  location you specify.  The method returns MagickTrue on success otherwise
6665 %  MagickFalse if an error is encountered.  The pixel data can be either char,
6666 %  short int, int, ssize_t, float, or double in the order specified by map.
6667 %
6668 %  Suppose your want to upload the first scanline of a 640x480 image from
6669 %  character data in red-green-blue order:
6670 %
6671 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6672 %
6673 %  The format of the MagickImportImagePixels method is:
6674 %
6675 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6676 %        const ssize_t x,const ssize_t y,const size_t columns,
6677 %        const size_t rows,const char *map,const StorageType storage,
6678 %        const void *pixels)
6679 %
6680 %  A description of each parameter follows:
6681 %
6682 %    o wand: the magick wand.
6683 %
6684 %    o x, y, columns, rows:  These values define the perimeter of a region
6685 %      of pixels you want to define.
6686 %
6687 %    o map:  This string reflects the expected ordering of the pixel array.
6688 %      It can be any combination or order of R = red, G = green, B = blue,
6689 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6690 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6691 %      P = pad.
6692 %
6693 %    o storage: Define the data type of the pixels.  Float and double types are
6694 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6695 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6696 %      or DoublePixel.
6697 %
6698 %    o pixels: This array of values contain the pixel components as defined by
6699 %      map and type.  You must preallocate this array where the expected
6700 %      length varies depending on the values of width, height, map, and type.
6701 %
6702 */
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)6703 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6704   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6705   const char *map,const StorageType storage,const void *pixels)
6706 {
6707   MagickBooleanType
6708     status;
6709 
6710   assert(wand != (MagickWand *) NULL);
6711   assert(wand->signature == WandSignature);
6712   if (wand->debug != MagickFalse)
6713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6714   if (wand->images == (Image *) NULL)
6715     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6716   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6717   if (status == MagickFalse)
6718     InheritException(wand->exception,&wand->images->exception);
6719   return(status);
6720 }
6721 
6722 /*
6723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6724 %                                                                             %
6725 %                                                                             %
6726 %                                                                             %
6727 %   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       %
6728 %                                                                             %
6729 %                                                                             %
6730 %                                                                             %
6731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6732 %
6733 %  MagickInverseFourierTransformImage() implements the inverse discrete
6734 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6735 %  imaginary image pair.
6736 %
6737 %  The format of the MagickInverseFourierTransformImage method is:
6738 %
6739 %      MagickBooleanType MagickInverseFourierTransformImage(
6740 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6741 %        const MagickBooleanType magnitude)
6742 %
6743 %  A description of each parameter follows:
6744 %
6745 %    o magnitude_wand: the magnitude or real wand.
6746 %
6747 %    o phase_wand: the phase or imaginary wand.
6748 %
6749 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6750 %      imaginary image pair.
6751 %
6752 */
MagickInverseFourierTransformImage(MagickWand * magnitude_wand,MagickWand * phase_wand,const MagickBooleanType magnitude)6753 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6754   MagickWand *magnitude_wand,MagickWand *phase_wand,
6755   const MagickBooleanType magnitude)
6756 {
6757   Image
6758     *inverse_image;
6759 
6760   MagickWand
6761     *wand;
6762 
6763   assert(magnitude_wand != (MagickWand *) NULL);
6764   assert(magnitude_wand->signature == WandSignature);
6765   if (magnitude_wand->debug != MagickFalse)
6766     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6767       magnitude_wand->name);
6768   wand=magnitude_wand;
6769   if (magnitude_wand->images == (Image *) NULL)
6770     ThrowWandException(WandError,"ContainsNoImages",
6771       magnitude_wand->name);
6772   assert(phase_wand != (MagickWand *) NULL);
6773   assert(phase_wand->signature == WandSignature);
6774   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6775     phase_wand->images,magnitude,wand->exception);
6776   if (inverse_image == (Image *) NULL)
6777     return(MagickFalse);
6778   ReplaceImageInList(&wand->images,inverse_image);
6779   return(MagickTrue);
6780 }
6781 
6782 /*
6783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6784 %                                                                             %
6785 %                                                                             %
6786 %                                                                             %
6787 %   M a g i c k L a b e l I m a g e                                           %
6788 %                                                                             %
6789 %                                                                             %
6790 %                                                                             %
6791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6792 %
6793 %  MagickLabelImage() adds a label to your image.
6794 %
6795 %  The format of the MagickLabelImage method is:
6796 %
6797 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6798 %
6799 %  A description of each parameter follows:
6800 %
6801 %    o wand: the magick wand.
6802 %
6803 %    o label: the image label.
6804 %
6805 */
MagickLabelImage(MagickWand * wand,const char * label)6806 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6807   const char *label)
6808 {
6809   MagickBooleanType
6810     status;
6811 
6812   assert(wand != (MagickWand *) NULL);
6813   assert(wand->signature == WandSignature);
6814   if (wand->debug != MagickFalse)
6815     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6816   if (wand->images == (Image *) NULL)
6817     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6818   status=SetImageProperty(wand->images,"label",label);
6819   if (status == MagickFalse)
6820     InheritException(wand->exception,&wand->images->exception);
6821   return(status);
6822 }
6823 
6824 /*
6825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6826 %                                                                             %
6827 %                                                                             %
6828 %                                                                             %
6829 %   M a g i c k L e v e l I m a g e                                           %
6830 %                                                                             %
6831 %                                                                             %
6832 %                                                                             %
6833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6834 %
6835 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6836 %  falling between specified white and black points to the full available
6837 %  quantum range. The parameters provided represent the black, mid, and white
6838 %  points. The black point specifies the darkest color in the image. Colors
6839 %  darker than the black point are set to zero. Mid point specifies a gamma
6840 %  correction to apply to the image.  White point specifies the lightest color
6841 %  in the image. Colors brighter than the white point are set to the maximum
6842 %  quantum value.
6843 %
6844 %  The format of the MagickLevelImage method is:
6845 %
6846 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6847 %        const double black_point,const double gamma,const double white_point)
6848 %      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6849 %        const ChannelType channel,const double black_point,const double gamma,
6850 %        const double white_point)
6851 %
6852 %  A description of each parameter follows:
6853 %
6854 %    o wand: the magick wand.
6855 %
6856 %    o channel: Identify which channel to level: RedChannel, GreenChannel, etc.
6857 %
6858 %    o black_point: the black point.
6859 %
6860 %    o gamma: the gamma.
6861 %
6862 %    o white_point: the white point.
6863 %
6864 */
6865 
MagickLevelImage(MagickWand * wand,const double black_point,const double gamma,const double white_point)6866 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6867   const double black_point,const double gamma,const double white_point)
6868 {
6869   MagickBooleanType
6870     status;
6871 
6872   status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6873     white_point);
6874   return(status);
6875 }
6876 
MagickLevelImageChannel(MagickWand * wand,const ChannelType channel,const double black_point,const double gamma,const double white_point)6877 WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6878   const ChannelType channel,const double black_point,const double gamma,
6879   const double white_point)
6880 {
6881   MagickBooleanType
6882     status;
6883 
6884   assert(wand != (MagickWand *) NULL);
6885   assert(wand->signature == WandSignature);
6886   if (wand->debug != MagickFalse)
6887     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6888   if (wand->images == (Image *) NULL)
6889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6890   status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6891   if (status == MagickFalse)
6892     InheritException(wand->exception,&wand->images->exception);
6893   return(status);
6894 }
6895 
6896 /*
6897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6898 %                                                                             %
6899 %                                                                             %
6900 %                                                                             %
6901 %   M a g i c k L e v e l I m a g e C o l o r s                               %
6902 %                                                                             %
6903 %                                                                             %
6904 %                                                                             %
6905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6906 %
6907 %  MagickLevelImageColors() maps the given color to "black" and "white" values,
6908 %  linearly spreading out the colors, and level values on a channel by channel
6909 %  bases, as per LevelImage().  The given colors allows you to specify
6910 %  different level ranges for each of the color channels separately.
6911 %
6912 %  The format of the MagickLevelImageColors method is:
6913 %
6914 %      MagickBooleanType MagickLevelImageColors(MagickWand *wand,
6915 %        const PixelWand *black_color,const PixelWand *white_color,
6916 %        const MagickBooleanType invert)
6917 %      MagickBooleanType MagickLevelImageColorsChannel(MagickWand *wand,
6918 %        const ChannelType channel,const PixelWand *black_color,
6919 %        const PixelWand *white_color,const MagickBooleanType invert)
6920 %
6921 %  A description of each parameter follows:
6922 %
6923 %    o wand: the magick wand.
6924 %
6925 %    o channel: Identify which channel to level: RedChannel, GreenChannel, etc.
6926 %
6927 %    o black_color: the black color.
6928 %
6929 %    o white_color: the white color.
6930 %
6931 %    o invert: if true map the colors (levelize), rather than from (level)
6932 %
6933 */
6934 
MagickLevelImageColors(MagickWand * wand,const PixelWand * black_color,const PixelWand * white_color,const MagickBooleanType invert)6935 WandExport MagickBooleanType MagickLevelImageColors(MagickWand *wand,
6936   const PixelWand *black_color,const PixelWand *white_color,
6937   const MagickBooleanType invert)
6938 {
6939   MagickBooleanType
6940     status;
6941 
6942   status=MagickLevelImageColorsChannel(wand,DefaultChannels,black_color,
6943     white_color,invert);
6944   return(status);
6945 }
6946 
MagickLevelImageColorsChannel(MagickWand * wand,const ChannelType channel,const PixelWand * black_color,const PixelWand * white_color,const MagickBooleanType invert)6947 WandExport MagickBooleanType MagickLevelImageColorsChannel(MagickWand *wand,
6948   const ChannelType channel,const PixelWand *black_color,
6949   const PixelWand *white_color,const MagickBooleanType invert)
6950 {
6951   MagickBooleanType
6952     status;
6953 
6954   MagickPixelPacket
6955     black,
6956     white;
6957 
6958   assert(wand != (MagickWand *) NULL);
6959   assert(wand->signature == WandSignature);
6960   if (wand->debug != MagickFalse)
6961     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6962   if (wand->images == (Image *) NULL)
6963     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6964   PixelGetMagickColor(black_color,&black);
6965   PixelGetMagickColor(white_color,&white);
6966   status=LevelColorsImageChannel(wand->images,channel,&black,&white,invert);
6967   if (status == MagickFalse)
6968     InheritException(wand->exception,&wand->images->exception);
6969   return(status);
6970 }
6971 
6972 /*
6973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6974 %                                                                             %
6975 %                                                                             %
6976 %                                                                             %
6977 %   M a g i c k L e v e l i z e I m a g e                                     %
6978 %                                                                             %
6979 %                                                                             %
6980 %                                                                             %
6981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6982 %
6983 %  MagickLevelizeImage() applies the reversed MagickLevelImage(). It compresses
6984 %  the full range of color values, so that they lie between the given black and
6985 %  white points.  Gamma is applied before the values are mapped.  It can be
6986 %  used to de-contrast a greyscale image to the exact levels specified.
6987 %
6988 %  The format of the MagickLevelizeImage method is:
6989 %
6990 %      MagickBooleanType MagickLevelizeImage(MagickWand *wand,
6991 %        const double black_point,const double gamma,const double white_point)
6992 %      MagickBooleanType MagickLevelizeImageChannel(MagickWand *wand,
6993 %        const ChannelType channel,const double black_point,const double gamma,
6994 %        const double white_point)
6995 %
6996 %  A description of each parameter follows:
6997 %
6998 %    o wand: the magick wand.
6999 %
7000 %    o channel: Identify which channel to level: RedChannel, GreenChannel, etc.
7001 %
7002 %    o black_point: The level to map zero (black) to.
7003 %
7004 %    o gamma: adjust gamma by this factor before mapping values.
7005 %
7006 %    o white_point: The level to map QuantumRange (white) to.
7007 %
7008 */
7009 
MagickLevelizeImage(MagickWand * wand,const double black_point,const double gamma,const double white_point)7010 WandExport MagickBooleanType MagickLevelizeImage(MagickWand *wand,
7011   const double black_point,const double gamma,const double white_point)
7012 {
7013   MagickBooleanType
7014     status;
7015 
7016   status=MagickLevelizeImageChannel(wand,DefaultChannels,black_point,gamma,
7017     white_point);
7018   return(status);
7019 }
7020 
MagickLevelizeImageChannel(MagickWand * wand,const ChannelType channel,const double black_point,const double gamma,const double white_point)7021 WandExport MagickBooleanType MagickLevelizeImageChannel(MagickWand *wand,
7022   const ChannelType channel,const double black_point,const double gamma,
7023   const double white_point)
7024 {
7025   MagickBooleanType
7026     status;
7027 
7028   assert(wand != (MagickWand *) NULL);
7029   assert(wand->signature == WandSignature);
7030   if (wand->debug != MagickFalse)
7031     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7032   if (wand->images == (Image *) NULL)
7033     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7034   status=LevelizeImageChannel(wand->images,channel,black_point,white_point,
7035     gamma);
7036   if (status == MagickFalse)
7037     InheritException(wand->exception,&wand->images->exception);
7038   return(status);
7039 }
7040 
7041 /*
7042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7043 %                                                                             %
7044 %                                                                             %
7045 %                                                                             %
7046 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
7047 %                                                                             %
7048 %                                                                             %
7049 %                                                                             %
7050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7051 %
7052 %  MagickLinearStretchImage() stretches with saturation the image intensity.
7053 %
7054 %  You can also reduce the influence of a particular channel with a gamma
7055 %  value of 0.
7056 %
7057 %  The format of the MagickLinearStretchImage method is:
7058 %
7059 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7060 %        const double black_point,const double white_point)
7061 %
7062 %  A description of each parameter follows:
7063 %
7064 %    o wand: the magick wand.
7065 %
7066 %    o black_point: the black point.
7067 %
7068 %    o white_point: the white point.
7069 %
7070 */
MagickLinearStretchImage(MagickWand * wand,const double black_point,const double white_point)7071 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
7072   const double black_point,const double white_point)
7073 {
7074   MagickBooleanType
7075     status;
7076 
7077   assert(wand != (MagickWand *) NULL);
7078   assert(wand->signature == WandSignature);
7079   if (wand->debug != MagickFalse)
7080     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7081   if (wand->images == (Image *) NULL)
7082     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7083   status=LinearStretchImage(wand->images,black_point,white_point);
7084   if (status == MagickFalse)
7085     InheritException(wand->exception,&wand->images->exception);
7086   return(status);
7087 }
7088 
7089 /*
7090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7091 %                                                                             %
7092 %                                                                             %
7093 %                                                                             %
7094 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
7095 %                                                                             %
7096 %                                                                             %
7097 %                                                                             %
7098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7099 %
7100 %  MagickLiquidRescaleImage() rescales image with seam carving.
7101 %
7102 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7103 %        const size_t columns,const size_t rows,const double delta_x,
7104 %        const double rigidity)
7105 %
7106 %  A description of each parameter follows:
7107 %
7108 %    o wand: the magick wand.
7109 %
7110 %    o columns: the number of columns in the scaled image.
7111 %
7112 %    o rows: the number of rows in the scaled image.
7113 %
7114 %    o delta_x: maximum seam transversal step (0 means straight seams).
7115 %
7116 %    o rigidity: introduce a bias for non-straight seams (typically 0).
7117 %
7118 */
MagickLiquidRescaleImage(MagickWand * wand,const size_t columns,const size_t rows,const double delta_x,const double rigidity)7119 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
7120   const size_t columns,const size_t rows,const double delta_x,
7121   const double rigidity)
7122 {
7123   Image
7124     *rescale_image;
7125 
7126   assert(wand != (MagickWand *) NULL);
7127   assert(wand->signature == WandSignature);
7128   if (wand->debug != MagickFalse)
7129     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7130   if (wand->images == (Image *) NULL)
7131     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7132   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
7133     rigidity,wand->exception);
7134   if (rescale_image == (Image *) NULL)
7135     return(MagickFalse);
7136   ReplaceImageInList(&wand->images,rescale_image);
7137   return(MagickTrue);
7138 }
7139 
7140 /*
7141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7142 %                                                                             %
7143 %                                                                             %
7144 %                                                                             %
7145 %     M a g i c k L o c a l C o n t r a s t I m a g e                         %
7146 %                                                                             %
7147 %                                                                             %
7148 %                                                                             %
7149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7150 %
7151 %  MagickLocalContrastImage() attempts to increase the appearance of
7152 %  large-scale light-dark transitions. Local contrast enhancement works
7153 %  similarly to sharpening with an unsharp mask, however the mask is instead
7154 %  created using an image with a greater blur distance.
7155 %
7156 %      MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7157 %        const double radius,const double strength)
7158 %
7159 %  A description of each parameter follows:
7160 %
7161 %    o image: the image.
7162 %
7163 %    o radius: the radius of the Gaussian, in pixels, not counting
7164 %      the center pixel.
7165 %
7166 %    o strength: the strength of the blur mask in percentage.
7167 %
7168 */
MagickLocalContrastImage(MagickWand * wand,const double radius,const double strength)7169 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
7170   const double radius,const double strength)
7171 {
7172   Image
7173     *contrast_image;
7174 
7175   assert(wand != (MagickWand *) NULL);
7176   assert(wand->signature == WandSignature);
7177   if (wand->debug != MagickFalse)
7178     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7179   if (wand->images == (Image *) NULL)
7180     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7181   contrast_image=LocalContrastImage(wand->images,radius,strength,
7182     wand->exception);
7183   if (contrast_image == (Image *) NULL)
7184     return(MagickFalse);
7185   ReplaceImageInList(&wand->images,contrast_image);
7186   return(MagickTrue);
7187 }
7188 
7189 /*
7190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7191 %                                                                             %
7192 %                                                                             %
7193 %                                                                             %
7194 %   M a g i c k M a g n i f y I m a g e                                       %
7195 %                                                                             %
7196 %                                                                             %
7197 %                                                                             %
7198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7199 %
7200 %  MagickMagnifyImage() is a convenience method that scales an image
7201 %  proportionally to twice its original size.
7202 %
7203 %  The format of the MagickMagnifyImage method is:
7204 %
7205 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7206 %
7207 %  A description of each parameter follows:
7208 %
7209 %    o wand: the magick wand.
7210 %
7211 */
MagickMagnifyImage(MagickWand * wand)7212 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
7213 {
7214   Image
7215     *magnify_image;
7216 
7217   assert(wand != (MagickWand *) NULL);
7218   assert(wand->signature == WandSignature);
7219   if (wand->debug != MagickFalse)
7220     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7221   if (wand->images == (Image *) NULL)
7222     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7223   magnify_image=MagnifyImage(wand->images,wand->exception);
7224   if (magnify_image == (Image *) NULL)
7225     return(MagickFalse);
7226   ReplaceImageInList(&wand->images,magnify_image);
7227   return(MagickTrue);
7228 }
7229 
7230 /*
7231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7232 %                                                                             %
7233 %                                                                             %
7234 %                                                                             %
7235 %   M a g i c k M e r g e I m a g e L a y e r s                               %
7236 %                                                                             %
7237 %                                                                             %
7238 %                                                                             %
7239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7240 %
7241 %  MagickMergeImageLayers() composes all the image layers from the current
7242 %  given image onward to produce a single image of the merged layers.
7243 %
7244 %  The inital canvas's size depends on the given ImageLayerMethod, and is
7245 %  initialized using the first images background color.  The images
7246 %  are then compositied onto that image in sequence using the given
7247 %  composition that has been assigned to each individual image.
7248 %
7249 %  The format of the MagickMergeImageLayers method is:
7250 %
7251 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
7252 %        const ImageLayerMethod method)
7253 %
7254 %  A description of each parameter follows:
7255 %
7256 %    o wand: the magick wand.
7257 %
7258 %    o method: the method of selecting the size of the initial canvas.
7259 %
7260 %        MergeLayer: Merge all layers onto a canvas just large enough
7261 %           to hold all the actual images. The virtual canvas of the
7262 %           first image is preserved but otherwise ignored.
7263 %
7264 %        FlattenLayer: Use the virtual canvas size of first image.
7265 %           Images which fall outside this canvas is clipped.
7266 %           This can be used to 'fill out' a given virtual canvas.
7267 %
7268 %        MosaicLayer: Start with the virtual canvas of the first image,
7269 %           enlarging left and right edges to contain all images.
7270 %           Images with negative offsets will be clipped.
7271 %
7272 */
MagickMergeImageLayers(MagickWand * wand,const ImageLayerMethod method)7273 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
7274   const ImageLayerMethod method)
7275 {
7276   Image
7277     *mosaic_image;
7278 
7279   assert(wand != (MagickWand *) NULL);
7280   assert(wand->signature == WandSignature);
7281   if (wand->debug != MagickFalse)
7282     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7283   if (wand->images == (Image *) NULL)
7284     return((MagickWand *) NULL);
7285   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
7286   if (mosaic_image == (Image *) NULL)
7287     return((MagickWand *) NULL);
7288   return(CloneMagickWandFromImages(wand,mosaic_image));
7289 }
7290 
7291 /*
7292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7293 %                                                                             %
7294 %                                                                             %
7295 %                                                                             %
7296 %   M a g i c k M i n i f y I m a g e                                         %
7297 %                                                                             %
7298 %                                                                             %
7299 %                                                                             %
7300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7301 %
7302 %  MagickMinifyImage() is a convenience method that scales an image
7303 %  proportionally to one-half its original size
7304 %
7305 %  The format of the MagickMinifyImage method is:
7306 %
7307 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
7308 %
7309 %  A description of each parameter follows:
7310 %
7311 %    o wand: the magick wand.
7312 %
7313 */
MagickMinifyImage(MagickWand * wand)7314 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
7315 {
7316   Image
7317     *minify_image;
7318 
7319   assert(wand != (MagickWand *) NULL);
7320   assert(wand->signature == WandSignature);
7321   if (wand->debug != MagickFalse)
7322     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7323   if (wand->images == (Image *) NULL)
7324     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7325   minify_image=MinifyImage(wand->images,wand->exception);
7326   if (minify_image == (Image *) NULL)
7327     return(MagickFalse);
7328   ReplaceImageInList(&wand->images,minify_image);
7329   return(MagickTrue);
7330 }
7331 
7332 /*
7333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7334 %                                                                             %
7335 %                                                                             %
7336 %                                                                             %
7337 %   M a g i c k M o d u l a t e I m a g e                                     %
7338 %                                                                             %
7339 %                                                                             %
7340 %                                                                             %
7341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7342 %
7343 %  MagickModulateImage() lets you control the brightness, saturation, and hue
7344 %  of an image.  Hue is the percentage of absolute rotation from the current
7345 %  position.  For example 50 results in a counter-clockwise rotation of 90
7346 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
7347 %  both resulting in a rotation of 180 degrees.
7348 %
7349 %  To increase the color brightness by 20% and decrease the color saturation by
7350 %  10% and leave the hue unchanged, use: 120,90,100.
7351 %
7352 %  The format of the MagickModulateImage method is:
7353 %
7354 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
7355 %        const double brightness,const double saturation,const double hue)
7356 %
7357 %  A description of each parameter follows:
7358 %
7359 %    o wand: the magick wand.
7360 %
7361 %    o brightness: the percent change in brighness.
7362 %
7363 %    o saturation: the percent change in saturation.
7364 %
7365 %    o hue: the percent change in hue.
7366 %
7367 */
MagickModulateImage(MagickWand * wand,const double brightness,const double saturation,const double hue)7368 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
7369   const double brightness,const double saturation,const double hue)
7370 {
7371   char
7372     modulate[MaxTextExtent];
7373 
7374   MagickBooleanType
7375     status;
7376 
7377   assert(wand != (MagickWand *) NULL);
7378   assert(wand->signature == WandSignature);
7379   if (wand->debug != MagickFalse)
7380     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7381   if (wand->images == (Image *) NULL)
7382     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7383   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
7384     brightness,saturation,hue);
7385   status=ModulateImage(wand->images,modulate);
7386   if (status == MagickFalse)
7387     InheritException(wand->exception,&wand->images->exception);
7388   return(status);
7389 }
7390 
7391 /*
7392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7393 %                                                                             %
7394 %                                                                             %
7395 %                                                                             %
7396 %   M a g i c k M o n t a g e I m a g e                                       %
7397 %                                                                             %
7398 %                                                                             %
7399 %                                                                             %
7400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7401 %
7402 %  MagickMontageImage() creates a composite image by combining several
7403 %  separate images. The images are tiled on the composite image with the name
7404 %  of the image optionally appearing just below the individual tile.
7405 %
7406 %  The format of the MagickMontageImage method is:
7407 %
7408 %      MagickWand *MagickMontageImage(MagickWand *wand,
7409 %        const DrawingWand drawing_wand,const char *tile_geometry,
7410 %        const char *thumbnail_geometry,const MontageMode mode,
7411 %        const char *frame)
7412 %
7413 %  A description of each parameter follows:
7414 %
7415 %    o wand: the magick wand.
7416 %
7417 %    o drawing_wand: the drawing wand.  The font name, size, and color are
7418 %      obtained from this wand.
7419 %
7420 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7421 %
7422 %    o thumbnail_geometry: Preferred image size and border size of each
7423 %      thumbnail (e.g. 120x120+4+3>).
7424 %
7425 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7426 %
7427 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7428 %      The frame color is that of the thumbnail's matte color.
7429 %
7430 */
MagickMontageImage(MagickWand * wand,const DrawingWand * drawing_wand,const char * tile_geometry,const char * thumbnail_geometry,const MontageMode mode,const char * frame)7431 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7432   const DrawingWand *drawing_wand,const char *tile_geometry,
7433   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7434 {
7435   char
7436     *font;
7437 
7438   Image
7439     *montage_image;
7440 
7441   MontageInfo
7442     *montage_info;
7443 
7444   PixelWand
7445     *pixel_wand;
7446 
7447   assert(wand != (MagickWand *) NULL);
7448   assert(wand->signature == WandSignature);
7449   if (wand->debug != MagickFalse)
7450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7451   if (wand->images == (Image *) NULL)
7452     return((MagickWand *) NULL);
7453   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7454   switch (mode)
7455   {
7456     case FrameMode:
7457     {
7458       (void) CloneString(&montage_info->frame,"15x15+3+3");
7459       montage_info->shadow=MagickTrue;
7460       break;
7461     }
7462     case UnframeMode:
7463     {
7464       montage_info->frame=(char *) NULL;
7465       montage_info->shadow=MagickFalse;
7466       montage_info->border_width=0;
7467       break;
7468     }
7469     case ConcatenateMode:
7470     {
7471       montage_info->frame=(char *) NULL;
7472       montage_info->shadow=MagickFalse;
7473       (void) CloneString(&montage_info->geometry,"+0+0");
7474       montage_info->border_width=0;
7475       break;
7476     }
7477     default:
7478       break;
7479   }
7480   font=DrawGetFont(drawing_wand);
7481   if (font != (char *) NULL)
7482     (void) CloneString(&montage_info->font,font);
7483   if (frame != (char *) NULL)
7484     (void) CloneString(&montage_info->frame,frame);
7485   montage_info->pointsize=DrawGetFontSize(drawing_wand);
7486   pixel_wand=NewPixelWand();
7487   DrawGetFillColor(drawing_wand,pixel_wand);
7488   PixelGetQuantumColor(pixel_wand,&montage_info->fill);
7489   DrawGetStrokeColor(drawing_wand,pixel_wand);
7490   PixelGetQuantumColor(pixel_wand,&montage_info->stroke);
7491   pixel_wand=DestroyPixelWand(pixel_wand);
7492   if (thumbnail_geometry != (char *) NULL)
7493     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7494   if (tile_geometry != (char *) NULL)
7495     (void) CloneString(&montage_info->tile,tile_geometry);
7496   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7497     wand->exception);
7498   montage_info=DestroyMontageInfo(montage_info);
7499   if (montage_image == (Image *) NULL)
7500     return((MagickWand *) NULL);
7501   return(CloneMagickWandFromImages(wand,montage_image));
7502 }
7503 
7504 /*
7505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7506 %                                                                             %
7507 %                                                                             %
7508 %                                                                             %
7509 %   M a g i c k M o r p h I m a g e s                                         %
7510 %                                                                             %
7511 %                                                                             %
7512 %                                                                             %
7513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7514 %
7515 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
7516 %  and size are linearly interpolated to give the appearance of a
7517 %  meta-morphosis from one image to the next.
7518 %
7519 %  The format of the MagickMorphImages method is:
7520 %
7521 %      MagickWand *MagickMorphImages(MagickWand *wand,
7522 %        const size_t number_frames)
7523 %
7524 %  A description of each parameter follows:
7525 %
7526 %    o wand: the magick wand.
7527 %
7528 %    o number_frames: the number of in-between images to generate.
7529 %
7530 */
MagickMorphImages(MagickWand * wand,const size_t number_frames)7531 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7532   const size_t number_frames)
7533 {
7534   Image
7535     *morph_image;
7536 
7537   assert(wand != (MagickWand *) NULL);
7538   assert(wand->signature == WandSignature);
7539   if (wand->debug != MagickFalse)
7540     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7541   if (wand->images == (Image *) NULL)
7542     return((MagickWand *) NULL);
7543   morph_image=MorphImages(wand->images,number_frames,wand->exception);
7544   if (morph_image == (Image *) NULL)
7545     return((MagickWand *) NULL);
7546   return(CloneMagickWandFromImages(wand,morph_image));
7547 }
7548 
7549 /*
7550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7551 %                                                                             %
7552 %                                                                             %
7553 %                                                                             %
7554 %   M a g i c k M o r p h o l o g y I m a g e                                 %
7555 %                                                                             %
7556 %                                                                             %
7557 %                                                                             %
7558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7559 %
7560 %  MagickMorphologyImage() applies a user supplied kernel to the image
7561 %  according to the given mophology method.
7562 %
7563 %  The format of the MagickMorphologyImage method is:
7564 %
7565 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7566 %        const MorphologyMethod method,const ssize_t iterations,
7567 %        const KernelInfo *kernel)
7568 %      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7569 %        ChannelType channel,const MorphologyMethod method,
7570 %        const ssize_t iterations,const KernelInfo *kernel)
7571 %
7572 %  A description of each parameter follows:
7573 %
7574 %    o wand: the magick wand.
7575 %
7576 %    o channel: the image channel(s).
7577 %
7578 %    o method: the morphology method to be applied.
7579 %
7580 %    o iterations: apply the operation this many times (or no change).
7581 %      A value of -1 means loop until no change found.  How this is applied
7582 %      may depend on the morphology method.  Typically this is a value of 1.
7583 %
7584 %    o kernel: An array of doubles representing the morphology kernel.
7585 %
7586 */
7587 
MagickMorphologyImage(MagickWand * wand,const MorphologyMethod method,const ssize_t iterations,const KernelInfo * kernel)7588 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7589   const MorphologyMethod method,const ssize_t iterations,
7590   const KernelInfo *kernel)
7591 {
7592   MagickBooleanType
7593     status;
7594 
7595   status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7596     kernel);
7597   return(status);
7598 }
7599 
MagickMorphologyImageChannel(MagickWand * wand,const ChannelType channel,const MorphologyMethod method,const ssize_t iterations,const KernelInfo * kernel)7600 WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7601   const ChannelType channel,const MorphologyMethod method,
7602   const ssize_t iterations,const KernelInfo *kernel)
7603 {
7604   Image
7605     *morphology_image;
7606 
7607   assert(wand != (MagickWand *) NULL);
7608   assert(wand->signature == WandSignature);
7609   if (wand->debug != MagickFalse)
7610     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7611   if (kernel == (const KernelInfo *) NULL)
7612     return(MagickFalse);
7613   if (wand->images == (Image *) NULL)
7614     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7615   morphology_image=MorphologyImageChannel(wand->images,channel,method,
7616     iterations,kernel,wand->exception);
7617   if (morphology_image == (Image *) NULL)
7618     return(MagickFalse);
7619   ReplaceImageInList(&wand->images,morphology_image);
7620   return(MagickTrue);
7621 }
7622 
7623 /*
7624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7625 %                                                                             %
7626 %                                                                             %
7627 %                                                                             %
7628 %   M a g i c k M o t i o n B l u r I m a g e                                 %
7629 %                                                                             %
7630 %                                                                             %
7631 %                                                                             %
7632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7633 %
7634 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7635 %  Gaussian operator of the given radius and standard deviation (sigma).
7636 %  For reasonable results, radius should be larger than sigma.  Use a
7637 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7638 %  Angle gives the angle of the blurring motion.
7639 %
7640 %  The format of the MagickMotionBlurImage method is:
7641 %
7642 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7643 %        const double radius,const double sigma,const double angle)
7644 %      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7645 %        const ChannelType channel,const double radius,const double sigma,
7646 %        const double angle)
7647 %
7648 %  A description of each parameter follows:
7649 %
7650 %    o wand: the magick wand.
7651 %
7652 %    o channel: the image channel(s).
7653 %
7654 %    o radius: the radius of the Gaussian, in pixels, not counting
7655 %      the center pixel.
7656 %
7657 %    o sigma: the standard deviation of the Gaussian, in pixels.
7658 %
7659 %    o angle: Apply the effect along this angle.
7660 %
7661 */
7662 
MagickMotionBlurImage(MagickWand * wand,const double radius,const double sigma,const double angle)7663 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7664   const double radius,const double sigma,const double angle)
7665 {
7666   MagickBooleanType
7667     status;
7668 
7669   status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7670   return(status);
7671 }
7672 
MagickMotionBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma,const double angle)7673 WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7674   const ChannelType channel,const double radius,const double sigma,
7675   const double angle)
7676 {
7677   Image
7678     *blur_image;
7679 
7680   assert(wand != (MagickWand *) NULL);
7681   assert(wand->signature == WandSignature);
7682   if (wand->debug != MagickFalse)
7683     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7684   if (wand->images == (Image *) NULL)
7685     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7686   blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7687     wand->exception);
7688   if (blur_image == (Image *) NULL)
7689     return(MagickFalse);
7690   ReplaceImageInList(&wand->images,blur_image);
7691   return(MagickTrue);
7692 }
7693 
7694 /*
7695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7696 %                                                                             %
7697 %                                                                             %
7698 %                                                                             %
7699 %   M a g i c k N e g a t e I m a g e                                         %
7700 %                                                                             %
7701 %                                                                             %
7702 %                                                                             %
7703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7704 %
7705 %  MagickNegateImage() negates the colors in the reference image.  The
7706 %  Grayscale option means that only grayscale values within the image are
7707 %  negated.
7708 %
7709 %  You can also reduce the influence of a particular channel with a gamma
7710 %  value of 0.
7711 %
7712 %  The format of the MagickNegateImage method is:
7713 %
7714 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7715 %        const MagickBooleanType gray)
7716 %      MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7717 %        const ChannelType channel,const MagickBooleanType gray)
7718 %
7719 %  A description of each parameter follows:
7720 %
7721 %    o wand: the magick wand.
7722 %
7723 %    o channel: the image channel(s).
7724 %
7725 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7726 %
7727 */
7728 
MagickNegateImage(MagickWand * wand,const MagickBooleanType gray)7729 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7730   const MagickBooleanType gray)
7731 {
7732   MagickBooleanType
7733     status;
7734 
7735   status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7736   return(status);
7737 }
7738 
MagickNegateImageChannel(MagickWand * wand,const ChannelType channel,const MagickBooleanType gray)7739 WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7740   const ChannelType channel,const MagickBooleanType gray)
7741 {
7742   MagickBooleanType
7743     status;
7744 
7745   assert(wand != (MagickWand *) NULL);
7746   assert(wand->signature == WandSignature);
7747   if (wand->debug != MagickFalse)
7748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7749   if (wand->images == (Image *) NULL)
7750     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7751   status=NegateImageChannel(wand->images,channel,gray);
7752   if (status == MagickFalse)
7753     InheritException(wand->exception,&wand->images->exception);
7754   return(status);
7755 }
7756 
7757 /*
7758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7759 %                                                                             %
7760 %                                                                             %
7761 %                                                                             %
7762 %   M a g i c k N e w I m a g e                                               %
7763 %                                                                             %
7764 %                                                                             %
7765 %                                                                             %
7766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7767 %
7768 %  MagickNewImage() adds a blank image canvas of the specified size and
7769 %  background color to the wand.
7770 %
7771 %  The format of the MagickNewImage method is:
7772 %
7773 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7774 %        const size_t columns,const size_t rows,
7775 %        const PixelWand *background)
7776 %
7777 %  A description of each parameter follows:
7778 %
7779 %    o wand: the magick wand.
7780 %
7781 %    o width: the image width.
7782 %
7783 %    o height: the image height.
7784 %
7785 %    o background: the image color.
7786 %
7787 */
MagickNewImage(MagickWand * wand,const size_t width,const size_t height,const PixelWand * background)7788 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7789   const size_t height,const PixelWand *background)
7790 {
7791   Image
7792     *images;
7793 
7794   MagickPixelPacket
7795     pixel;
7796 
7797   assert(wand != (MagickWand *) NULL);
7798   assert(wand->signature == WandSignature);
7799   if (wand->debug != MagickFalse)
7800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7801   PixelGetMagickColor(background,&pixel);
7802   images=NewMagickImage(wand->image_info,width,height,&pixel);
7803   if (images == (Image *) NULL)
7804     return(MagickFalse);
7805   if (images->exception.severity != UndefinedException)
7806     InheritException(wand->exception,&images->exception);
7807   return(InsertImageInWand(wand,images));
7808 }
7809 
7810 /*
7811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7812 %                                                                             %
7813 %                                                                             %
7814 %                                                                             %
7815 %   M a g i c k N e x t I m a g e                                             %
7816 %                                                                             %
7817 %                                                                             %
7818 %                                                                             %
7819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7820 %
7821 %  MagickNextImage() sets the next image in the wand as the current image.
7822 %
7823 %  It is typically used after MagickResetIterator(), after which its first use
7824 %  will set the first image as the current image (unless the wand is empty).
7825 %
7826 %  It will return MagickFalse when no more images are left to be returned
7827 %  which happens when the wand is empty, or the current image is the last
7828 %  image.
7829 %
7830 %  When the above condition (end of image list) is reached, the iterator is
7831 %  automaticall set so that you can start using MagickPreviousImage() to
7832 %  again iterate over the images in the reverse direction, starting with the
7833 %  last image (again).  You can jump to this condition immeditally using
7834 %  MagickSetLastIterator().
7835 %
7836 %  The format of the MagickNextImage method is:
7837 %
7838 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7839 %
7840 %  A description of each parameter follows:
7841 %
7842 %    o wand: the magick wand.
7843 %
7844 */
MagickNextImage(MagickWand * wand)7845 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7846 {
7847   assert(wand != (MagickWand *) NULL);
7848   assert(wand->signature == WandSignature);
7849   if (wand->debug != MagickFalse)
7850     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7851   if (wand->images == (Image *) NULL)
7852     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7853   wand->insert_before=MagickFalse; /* Inserts is now appended */
7854   if (wand->image_pending != MagickFalse)
7855     {
7856       wand->image_pending=MagickFalse;
7857       return(MagickTrue);
7858     }
7859   if (GetNextImageInList(wand->images) == (Image *) NULL)
7860     {
7861       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7862       return(MagickFalse);
7863     }
7864   wand->images=GetNextImageInList(wand->images);
7865   return(MagickTrue);
7866 }
7867 
7868 /*
7869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7870 %                                                                             %
7871 %                                                                             %
7872 %                                                                             %
7873 %   M a g i c k N o r m a l i z e I m a g e                                   %
7874 %                                                                             %
7875 %                                                                             %
7876 %                                                                             %
7877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7878 %
7879 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7880 %  the pixels color to span the entire range of colors available
7881 %
7882 %  You can also reduce the influence of a particular channel with a gamma
7883 %  value of 0.
7884 %
7885 %  The format of the MagickNormalizeImage method is:
7886 %
7887 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7888 %      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7889 %        const ChannelType channel)
7890 %
7891 %  A description of each parameter follows:
7892 %
7893 %    o wand: the magick wand.
7894 %
7895 %    o channel: the image channel(s).
7896 %
7897 */
7898 
MagickNormalizeImage(MagickWand * wand)7899 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7900 {
7901   MagickBooleanType
7902     status;
7903 
7904   status=MagickNormalizeImageChannel(wand,DefaultChannels);
7905   return(status);
7906 }
7907 
MagickNormalizeImageChannel(MagickWand * wand,const ChannelType channel)7908 WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7909   const ChannelType channel)
7910 {
7911   MagickBooleanType
7912     status;
7913 
7914   assert(wand != (MagickWand *) NULL);
7915   assert(wand->signature == WandSignature);
7916   if (wand->debug != MagickFalse)
7917     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7918   if (wand->images == (Image *) NULL)
7919     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7920   status=NormalizeImageChannel(wand->images,channel);
7921   if (status == MagickFalse)
7922     InheritException(wand->exception,&wand->images->exception);
7923   return(status);
7924 }
7925 
7926 /*
7927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7928 %                                                                             %
7929 %                                                                             %
7930 %                                                                             %
7931 %   M a g i c k O i l P a i n t I m a g e                                     %
7932 %                                                                             %
7933 %                                                                             %
7934 %                                                                             %
7935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7936 %
7937 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7938 %  painting.  Each pixel is replaced by the most frequent color occurring
7939 %  in a circular region defined by radius.
7940 %
7941 %  The format of the MagickOilPaintImage method is:
7942 %
7943 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7944 %        const double radius)
7945 %
7946 %  A description of each parameter follows:
7947 %
7948 %    o wand: the magick wand.
7949 %
7950 %    o radius: the radius of the circular neighborhood.
7951 %
7952 */
MagickOilPaintImage(MagickWand * wand,const double radius)7953 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7954   const double radius)
7955 {
7956   Image
7957     *paint_image;
7958 
7959   assert(wand != (MagickWand *) NULL);
7960   assert(wand->signature == WandSignature);
7961   if (wand->debug != MagickFalse)
7962     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7963   if (wand->images == (Image *) NULL)
7964     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7965   paint_image=OilPaintImage(wand->images,radius,wand->exception);
7966   if (paint_image == (Image *) NULL)
7967     return(MagickFalse);
7968   ReplaceImageInList(&wand->images,paint_image);
7969   return(MagickTrue);
7970 }
7971 
7972 /*
7973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7974 %                                                                             %
7975 %                                                                             %
7976 %                                                                             %
7977 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7978 %                                                                             %
7979 %                                                                             %
7980 %                                                                             %
7981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7982 %
7983 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7984 %  defined by fill.
7985 %
7986 %  The format of the MagickOpaquePaintImage method is:
7987 %
7988 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7989 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7990 %        const MagickBooleanType invert)
7991 %      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7992 %        const ChannelType channel,const PixelWand *target,
7993 %        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7994 %
7995 %  A description of each parameter follows:
7996 %
7997 %    o wand: the magick wand.
7998 %
7999 %    o channel: the channel(s).
8000 %
8001 %    o target: Change this target color to the fill color within the image.
8002 %
8003 %    o fill: the fill pixel wand.
8004 %
8005 %    o fuzz: By default target must match a particular pixel color
8006 %      exactly.  However, in many cases two colors may differ by a small amount.
8007 %      The fuzz member of image defines how much tolerance is acceptable to
8008 %      consider two colors as the same.  For example, set fuzz to 10 and the
8009 %      color red at intensities of 100 and 102 respectively are now interpreted
8010 %      as the same color for the purposes of the floodfill.
8011 %
8012 %    o invert: paint any pixel that does not match the target color.
8013 %
8014 */
8015 
MagickOpaquePaintImage(MagickWand * wand,const PixelWand * target,const PixelWand * fill,const double fuzz,const MagickBooleanType invert)8016 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
8017   const PixelWand *target,const PixelWand *fill,const double fuzz,
8018   const MagickBooleanType invert)
8019 {
8020   MagickBooleanType
8021     status;
8022 
8023   status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
8024     invert);
8025   return(status);
8026 }
8027 
MagickOpaquePaintImageChannel(MagickWand * wand,const ChannelType channel,const PixelWand * target,const PixelWand * fill,const double fuzz,const MagickBooleanType invert)8028 WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
8029   const ChannelType channel,const PixelWand *target,const PixelWand *fill,
8030   const double fuzz,const MagickBooleanType invert)
8031 {
8032   MagickBooleanType
8033     status;
8034 
8035   MagickPixelPacket
8036     fill_pixel,
8037     target_pixel;
8038 
8039   assert(wand != (MagickWand *) NULL);
8040   assert(wand->signature == WandSignature);
8041   if (wand->debug != MagickFalse)
8042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8043   if (wand->images == (Image *) NULL)
8044     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8045   PixelGetMagickColor(target,&target_pixel);
8046   PixelGetMagickColor(fill,&fill_pixel);
8047   wand->images->fuzz=fuzz;
8048   status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
8049     &fill_pixel,invert);
8050   if (status == MagickFalse)
8051     InheritException(wand->exception,&wand->images->exception);
8052   return(status);
8053 }
8054 
8055 /*
8056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8057 %                                                                             %
8058 %                                                                             %
8059 %                                                                             %
8060 %   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                         %
8061 %                                                                             %
8062 %                                                                             %
8063 %                                                                             %
8064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8065 %
8066 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
8067 %  previous image in the sequence.  From this it attempts to select the
8068 %  smallest cropped image to replace each frame, while preserving the results
8069 %  of the animation.
8070 %
8071 %  The format of the MagickOptimizeImageLayers method is:
8072 %
8073 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8074 %
8075 %  A description of each parameter follows:
8076 %
8077 %    o wand: the magick wand.
8078 %
8079 */
MagickOptimizeImageLayers(MagickWand * wand)8080 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
8081 {
8082   Image
8083     *optimize_image;
8084 
8085   assert(wand != (MagickWand *) NULL);
8086   assert(wand->signature == WandSignature);
8087   if (wand->debug != MagickFalse)
8088     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8089   if (wand->images == (Image *) NULL)
8090     return((MagickWand *) NULL);
8091   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
8092   if (optimize_image == (Image *) NULL)
8093     return((MagickWand *) NULL);
8094   return(CloneMagickWandFromImages(wand,optimize_image));
8095 }
8096 
8097 /*
8098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8099 %                                                                             %
8100 %                                                                             %
8101 %                                                                             %
8102 %   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             %
8103 %                                                                             %
8104 %                                                                             %
8105 %                                                                             %
8106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8107 %
8108 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
8109 %  compares the overlayed pixels against the disposal image resulting from all
8110 %  the previous frames in the animation.  Any pixel that does not change the
8111 %  disposal image (and thus does not effect the outcome of an overlay) is made
8112 %  transparent.
8113 %
8114 %  WARNING: This modifies the current images directly, rather than generate
8115 %  a new image sequence.
8116 %  The format of the MagickOptimizeImageTransparency method is:
8117 %
8118 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8119 %
8120 %  A description of each parameter follows:
8121 %
8122 %    o wand: the magick wand.
8123 %
8124 */
MagickOptimizeImageTransparency(MagickWand * wand)8125 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
8126 {
8127   assert(wand != (MagickWand *) NULL);
8128   assert(wand->signature == WandSignature);
8129   if(wand->debug != MagickFalse)
8130     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8131   if (wand->images == (Image *) NULL)
8132     return(MagickFalse);
8133   OptimizeImageTransparency(wand->images,wand->exception);
8134   return(MagickTrue);
8135 }
8136 
8137 /*
8138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8139 %                                                                             %
8140 %                                                                             %
8141 %                                                                             %
8142 %     M a g i c k O r d e r e d P o s t e r i z e I m a g e                   %
8143 %                                                                             %
8144 %                                                                             %
8145 %                                                                             %
8146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8147 %
8148 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
8149 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
8150 %  which can be different for different channels, according to the input
8151 %  arguments.
8152 %
8153 %  The format of the MagickOrderedPosterizeImage method is:
8154 %
8155 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
8156 %        const char *threshold_map)
8157 %      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
8158 %        const ChannelType channel,const char *threshold_map)
8159 %
8160 %  A description of each parameter follows:
8161 %
8162 %    o image: the image.
8163 %
8164 %    o channel: the channel or channels to be thresholded.
8165 %
8166 %    o threshold_map: A string containing the name of the threshold dither
8167 %      map to use, followed by zero or more numbers representing the number of
8168 %      color levels tho dither between.
8169 %
8170 %      Any level number less than 2 is equivalent to 2, and means only binary
8171 %      dithering will be applied to each color channel.
8172 %
8173 %      No numbers also means a 2 level (bitmap) dither will be applied to all
8174 %      channels, while a single number is the number of levels applied to each
8175 %      channel in sequence.  More numbers will be applied in turn to each of
8176 %      the color channels.
8177 %
8178 %      For example: "o3x3,6" generates a 6 level posterization of the image
8179 %      with a ordered 3x3 diffused pixel dither being applied between each
8180 %      level. While checker,8,8,4 will produce a 332 colormaped image with
8181 %      only a single checkerboard hash pattern (50% grey) between each color
8182 %      level, to basically double the number of color levels with a bare
8183 %      minimim of dithering.
8184 %
8185 */
8186 
MagickOrderedPosterizeImage(MagickWand * wand,const char * threshold_map)8187 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
8188   const char *threshold_map)
8189 {
8190   MagickBooleanType
8191     status;
8192 
8193   status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
8194   return(status);
8195 }
8196 
MagickOrderedPosterizeImageChannel(MagickWand * wand,const ChannelType channel,const char * threshold_map)8197 WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
8198   MagickWand *wand,const ChannelType channel,const char *threshold_map)
8199 {
8200   MagickBooleanType
8201     status;
8202 
8203   assert(wand != (MagickWand *) NULL);
8204   assert(wand->signature == WandSignature);
8205   if (wand->debug != MagickFalse)
8206     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8207   if (wand->images == (Image *) NULL)
8208     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8209   status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
8210     wand->exception);
8211   return(status);
8212 }
8213 
8214 /*
8215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8216 %                                                                             %
8217 %                                                                             %
8218 %                                                                             %
8219 %   M a g i c k P i n g I m a g e                                             %
8220 %                                                                             %
8221 %                                                                             %
8222 %                                                                             %
8223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8224 %
8225 %  MagickPingImage() is like MagickReadImage() except the only valid
8226 %  information returned is the image width, height, size, and format.  It
8227 %  is designed to efficiently obtain this information from a file without
8228 %  reading the entire image sequence into memory.
8229 %
8230 %  The format of the MagickPingImage method is:
8231 %
8232 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
8233 %
8234 %  A description of each parameter follows:
8235 %
8236 %    o wand: the magick wand.
8237 %
8238 %    o filename: the image filename.
8239 %
8240 */
MagickPingImage(MagickWand * wand,const char * filename)8241 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
8242   const char *filename)
8243 {
8244   Image
8245     *images;
8246 
8247   ImageInfo
8248     *ping_info;
8249 
8250   assert(wand != (MagickWand *) NULL);
8251   assert(wand->signature == WandSignature);
8252   if (wand->debug != MagickFalse)
8253     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8254   ping_info=CloneImageInfo(wand->image_info);
8255   if (filename != (const char *) NULL)
8256     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
8257   images=PingImage(ping_info,wand->exception);
8258   ping_info=DestroyImageInfo(ping_info);
8259   if (images == (Image *) NULL)
8260     return(MagickFalse);
8261   return(InsertImageInWand(wand,images));
8262 }
8263 
8264 /*
8265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8266 %                                                                             %
8267 %                                                                             %
8268 %                                                                             %
8269 %   M a g i c k P i n g I m a g e B l o b                                     %
8270 %                                                                             %
8271 %                                                                             %
8272 %                                                                             %
8273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8274 %
8275 %  MagickPingImageBlob() pings an image or image sequence from a blob.
8276 %
8277 %  The format of the MagickPingImageBlob method is:
8278 %
8279 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8280 %        const void *blob,const size_t length)
8281 %
8282 %  A description of each parameter follows:
8283 %
8284 %    o wand: the magick wand.
8285 %
8286 %    o blob: the blob.
8287 %
8288 %    o length: the blob length.
8289 %
8290 */
MagickPingImageBlob(MagickWand * wand,const void * blob,const size_t length)8291 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8292   const void *blob,const size_t length)
8293 {
8294   Image
8295     *images;
8296 
8297   ImageInfo
8298     *read_info;
8299 
8300   assert(wand != (MagickWand *) NULL);
8301   assert(wand->signature == WandSignature);
8302   if (wand->debug != MagickFalse)
8303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8304   read_info=CloneImageInfo(wand->image_info);
8305   SetImageInfoBlob(read_info,blob,length);
8306   images=PingImage(read_info,wand->exception);
8307   read_info=DestroyImageInfo(read_info);
8308   if (images == (Image *) NULL)
8309     return(MagickFalse);
8310   return(InsertImageInWand(wand,images));
8311 }
8312 
8313 /*
8314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8315 %                                                                             %
8316 %                                                                             %
8317 %                                                                             %
8318 %   M a g i c k P i n g I m a g e F i l e                                     %
8319 %                                                                             %
8320 %                                                                             %
8321 %                                                                             %
8322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8323 %
8324 %  MagickPingImageFile() pings an image or image sequence from an open file
8325 %  descriptor.
8326 %
8327 %  The format of the MagickPingImageFile method is:
8328 %
8329 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8330 %
8331 %  A description of each parameter follows:
8332 %
8333 %    o wand: the magick wand.
8334 %
8335 %    o file: the file descriptor.
8336 %
8337 */
MagickPingImageFile(MagickWand * wand,FILE * file)8338 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8339 {
8340   Image
8341     *images;
8342 
8343   ImageInfo
8344     *read_info;
8345 
8346   assert(wand != (MagickWand *) NULL);
8347   assert(wand->signature == WandSignature);
8348   assert(file != (FILE *) NULL);
8349   if (wand->debug != MagickFalse)
8350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8351   read_info=CloneImageInfo(wand->image_info);
8352   SetImageInfoFile(read_info,file);
8353   images=PingImage(read_info,wand->exception);
8354   read_info=DestroyImageInfo(read_info);
8355   if (images == (Image *) NULL)
8356     return(MagickFalse);
8357   return(InsertImageInWand(wand,images));
8358 }
8359 
8360 /*
8361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8362 %                                                                             %
8363 %                                                                             %
8364 %                                                                             %
8365 %   M a g i c k P o l a r o i d I m a g e                                     %
8366 %                                                                             %
8367 %                                                                             %
8368 %                                                                             %
8369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8370 %
8371 %  MagickPolaroidImage() simulates a Polaroid picture.
8372 %
8373 %  The format of the MagickPolaroidImage method is:
8374 %
8375 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8376 %        const DrawingWand *drawing_wand,const double angle)
8377 %
8378 %  A description of each parameter follows:
8379 %
8380 %    o wand: the magick wand.
8381 %
8382 %    o drawing_wand: the draw wand.
8383 %
8384 %    o angle: Apply the effect along this angle.
8385 %
8386 */
MagickPolaroidImage(MagickWand * wand,const DrawingWand * drawing_wand,const double angle)8387 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8388   const DrawingWand *drawing_wand,const double angle)
8389 {
8390   DrawInfo
8391     *draw_info;
8392 
8393   Image
8394     *polaroid_image;
8395 
8396   assert(wand != (MagickWand *) NULL);
8397   assert(wand->signature == WandSignature);
8398   if (wand->debug != MagickFalse)
8399     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8400   if (wand->images == (Image *) NULL)
8401     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8402   draw_info=PeekDrawingWand(drawing_wand);
8403   if (draw_info == (DrawInfo *) NULL)
8404     return(MagickFalse);
8405   polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
8406   if (polaroid_image == (Image *) NULL)
8407     return(MagickFalse);
8408   ReplaceImageInList(&wand->images,polaroid_image);
8409   return(MagickTrue);
8410 }
8411 
8412 /*
8413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8414 %                                                                             %
8415 %                                                                             %
8416 %                                                                             %
8417 %   M a g i c k P o s t e r i z e I m a g e                                   %
8418 %                                                                             %
8419 %                                                                             %
8420 %                                                                             %
8421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8422 %
8423 %  MagickPosterizeImage() reduces the image to a limited number of color level.
8424 %
8425 %  The format of the MagickPosterizeImage method is:
8426 %
8427 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8428 %        const size_t levels,const MagickBooleanType dither)
8429 %
8430 %  A description of each parameter follows:
8431 %
8432 %    o wand: the magick wand.
8433 %
8434 %    o levels: Number of color levels allowed in each channel.  Very low values
8435 %      (2, 3, or 4) have the most visible effect.
8436 %
8437 %    o dither: Set this integer value to something other than zero to dither
8438 %      the mapped image.
8439 %
8440 */
MagickPosterizeImage(MagickWand * wand,const size_t levels,const MagickBooleanType dither)8441 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8442   const size_t levels,const MagickBooleanType dither)
8443 {
8444   MagickBooleanType
8445     status;
8446 
8447   assert(wand != (MagickWand *) NULL);
8448   assert(wand->signature == WandSignature);
8449   if (wand->debug != MagickFalse)
8450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8451   if (wand->images == (Image *) NULL)
8452     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8453   status=PosterizeImage(wand->images,levels,dither);
8454   if (status == MagickFalse)
8455     InheritException(wand->exception,&wand->images->exception);
8456   return(status);
8457 }
8458 
8459 /*
8460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8461 %                                                                             %
8462 %                                                                             %
8463 %                                                                             %
8464 %   M a g i c k P r e v i e w I m a g e s                                     %
8465 %                                                                             %
8466 %                                                                             %
8467 %                                                                             %
8468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8469 %
8470 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8471 %  image processing operation applied at varying strengths.  This helpful
8472 %  to quickly pin-point an appropriate parameter for an image processing
8473 %  operation.
8474 %
8475 %  The format of the MagickPreviewImages method is:
8476 %
8477 %      MagickWand *MagickPreviewImages(MagickWand *wand,
8478 %        const PreviewType preview)
8479 %
8480 %  A description of each parameter follows:
8481 %
8482 %    o wand: the magick wand.
8483 %
8484 %    o preview: the preview type.
8485 %
8486 */
MagickPreviewImages(MagickWand * wand,const PreviewType preview)8487 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8488   const PreviewType preview)
8489 {
8490   Image
8491     *preview_image;
8492 
8493   assert(wand != (MagickWand *) NULL);
8494   assert(wand->signature == WandSignature);
8495   if (wand->debug != MagickFalse)
8496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8497   if (wand->images == (Image *) NULL)
8498     return((MagickWand *) NULL);
8499   preview_image=PreviewImage(wand->images,preview,wand->exception);
8500   if (preview_image == (Image *) NULL)
8501     return((MagickWand *) NULL);
8502   return(CloneMagickWandFromImages(wand,preview_image));
8503 }
8504 
8505 /*
8506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8507 %                                                                             %
8508 %                                                                             %
8509 %                                                                             %
8510 %   M a g i c k P r e v i o u s I m a g e                                     %
8511 %                                                                             %
8512 %                                                                             %
8513 %                                                                             %
8514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8515 %
8516 %  MagickPreviousImage() sets the previous image in the wand as the current
8517 %  image.
8518 %
8519 %  It is typically used after MagickSetLastIterator(), after which its first
8520 %  use will set the last image as the current image (unless the wand is empty).
8521 %
8522 %  It will return MagickFalse when no more images are left to be returned
8523 %  which happens when the wand is empty, or the current image is the first
8524 %  image.  At that point the iterator is than reset to again process images in
8525 %  the forward direction, again starting with the first image in list. Images
8526 %  added at this point are prepended.
8527 %
8528 %  Also at that point any images added to the wand using MagickAddImages() or
8529 %  MagickReadImages() will be prepended before the first image. In this sense
8530 %  the condition is not quite exactly the same as MagickResetIterator().
8531 %
8532 %  The format of the MagickPreviousImage method is:
8533 %
8534 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
8535 %
8536 %  A description of each parameter follows:
8537 %
8538 %    o wand: the magick wand.
8539 %
8540 */
MagickPreviousImage(MagickWand * wand)8541 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8542 {
8543   assert(wand != (MagickWand *) NULL);
8544   assert(wand->signature == WandSignature);
8545   if (wand->debug != MagickFalse)
8546     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8547   if (wand->images == (Image *) NULL)
8548     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8549   if (wand->image_pending != MagickFalse)
8550     {
8551       wand->image_pending=MagickFalse;  /* image returned no longer pending */
8552       return(MagickTrue);
8553     }
8554   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8555     {
8556       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
8557       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
8558       return(MagickFalse);
8559     }
8560   wand->images=GetPreviousImageInList(wand->images);
8561   return(MagickTrue);
8562 }
8563 
8564 /*
8565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8566 %                                                                             %
8567 %                                                                             %
8568 %                                                                             %
8569 %   M a g i c k Q u a n t i z e I m a g e                                     %
8570 %                                                                             %
8571 %                                                                             %
8572 %                                                                             %
8573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8574 %
8575 %  MagickQuantizeImage() analyzes the colors within a reference image and
8576 %  chooses a fixed number of colors to represent the image.  The goal of the
8577 %  algorithm is to minimize the color difference between the input and output
8578 %  image while minimizing the processing time.
8579 %
8580 %  The format of the MagickQuantizeImage method is:
8581 %
8582 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8583 %        const size_t number_colors,const ColorspaceType colorspace,
8584 %        const size_t treedepth,const MagickBooleanType dither,
8585 %        const MagickBooleanType measure_error)
8586 %
8587 %  A description of each parameter follows:
8588 %
8589 %    o wand: the magick wand.
8590 %
8591 %    o number_colors: the number of colors.
8592 %
8593 %    o colorspace: Perform color reduction in this colorspace, typically
8594 %      RGBColorspace.
8595 %
8596 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8597 %      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
8598 %      reference image with the least amount of memory and the fastest
8599 %      computational speed.  In some cases, such as an image with low color
8600 %      dispersion (a few number of colors), a value other than
8601 %      Log4(number_colors) is required.  To expand the color tree completely,
8602 %      use a value of 8.
8603 %
8604 %    o dither: A value other than zero distributes the difference between an
8605 %      original image and the corresponding color reduced image to
8606 %      neighboring pixels along a Hilbert curve.
8607 %
8608 %    o measure_error: A value other than zero measures the difference between
8609 %      the original and quantized images.  This difference is the total
8610 %      quantization error.  The error is computed by summing over all pixels
8611 %      in an image the distance squared in RGB space between each reference
8612 %      pixel value and its quantized value.
8613 %
8614 */
MagickQuantizeImage(MagickWand * wand,const size_t number_colors,const ColorspaceType colorspace,const size_t treedepth,const MagickBooleanType dither,const MagickBooleanType measure_error)8615 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8616   const size_t number_colors,const ColorspaceType colorspace,
8617   const size_t treedepth,const MagickBooleanType dither,
8618   const MagickBooleanType measure_error)
8619 {
8620   MagickBooleanType
8621     status;
8622 
8623   QuantizeInfo
8624     *quantize_info;
8625 
8626   assert(wand != (MagickWand *) NULL);
8627   assert(wand->signature == WandSignature);
8628   if (wand->debug != MagickFalse)
8629     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8630   if (wand->images == (Image *) NULL)
8631     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8632   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8633   quantize_info->number_colors=number_colors;
8634   quantize_info->dither=dither;
8635   quantize_info->tree_depth=treedepth;
8636   quantize_info->colorspace=colorspace;
8637   quantize_info->measure_error=measure_error;
8638   status=QuantizeImage(quantize_info,wand->images);
8639   if (status == MagickFalse)
8640     InheritException(wand->exception,&wand->images->exception);
8641   quantize_info=DestroyQuantizeInfo(quantize_info);
8642   return(status);
8643 }
8644 
8645 /*
8646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8647 %                                                                             %
8648 %                                                                             %
8649 %                                                                             %
8650 %   M a g i c k Q u a n t i z e I m a g e s                                   %
8651 %                                                                             %
8652 %                                                                             %
8653 %                                                                             %
8654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8655 %
8656 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
8657 %  chooses a fixed number of colors to represent the image.  The goal of the
8658 %  algorithm is to minimize the color difference between the input and output
8659 %  image while minimizing the processing time.
8660 %
8661 %  The format of the MagickQuantizeImages method is:
8662 %
8663 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8664 %        const size_t number_colors,const ColorspaceType colorspace,
8665 %        const size_t treedepth,const MagickBooleanType dither,
8666 %        const MagickBooleanType measure_error)
8667 %
8668 %  A description of each parameter follows:
8669 %
8670 %    o wand: the magick wand.
8671 %
8672 %    o number_colors: the number of colors.
8673 %
8674 %    o colorspace: Perform color reduction in this colorspace, typically
8675 %      RGBColorspace.
8676 %
8677 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8678 %      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
8679 %      reference image with the least amount of memory and the fastest
8680 %      computational speed.  In some cases, such as an image with low color
8681 %      dispersion (a few number of colors), a value other than
8682 %      Log4(number_colors) is required.  To expand the color tree completely,
8683 %      use a value of 8.
8684 %
8685 %    o dither: A value other than zero distributes the difference between an
8686 %      original image and the corresponding color reduced algorithm to
8687 %      neighboring pixels along a Hilbert curve.
8688 %
8689 %    o measure_error: A value other than zero measures the difference between
8690 %      the original and quantized images.  This difference is the total
8691 %      quantization error.  The error is computed by summing over all pixels
8692 %      in an image the distance squared in RGB space between each reference
8693 %      pixel value and its quantized value.
8694 %
8695 */
MagickQuantizeImages(MagickWand * wand,const size_t number_colors,const ColorspaceType colorspace,const size_t treedepth,const MagickBooleanType dither,const MagickBooleanType measure_error)8696 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8697   const size_t number_colors,const ColorspaceType colorspace,
8698   const size_t treedepth,const MagickBooleanType dither,
8699   const MagickBooleanType measure_error)
8700 {
8701   MagickBooleanType
8702     status;
8703 
8704   QuantizeInfo
8705     *quantize_info;
8706 
8707   assert(wand != (MagickWand *) NULL);
8708   assert(wand->signature == WandSignature);
8709   if (wand->debug != MagickFalse)
8710     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8711   if (wand->images == (Image *) NULL)
8712     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8713   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8714   quantize_info->number_colors=number_colors;
8715   quantize_info->dither=dither;
8716   quantize_info->tree_depth=treedepth;
8717   quantize_info->colorspace=colorspace;
8718   quantize_info->measure_error=measure_error;
8719   status=QuantizeImages(quantize_info,wand->images);
8720   if (status == MagickFalse)
8721     InheritException(wand->exception,&wand->images->exception);
8722   quantize_info=DestroyQuantizeInfo(quantize_info);
8723   return(status);
8724 }
8725 
8726 /*
8727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8728 %                                                                             %
8729 %                                                                             %
8730 %                                                                             %
8731 %   M a g i c k R a i s e I m a g e                                           %
8732 %                                                                             %
8733 %                                                                             %
8734 %                                                                             %
8735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8736 %
8737 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8738 %  by lightening and darkening the edges of the image.  Members width and
8739 %  height of raise_info define the width of the vertical and horizontal
8740 %  edge of the effect.
8741 %
8742 %  The format of the MagickRaiseImage method is:
8743 %
8744 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8745 %        const size_t width,const size_t height,const ssize_t x,
8746 %        const ssize_t y,const MagickBooleanType raise)
8747 %
8748 %  A description of each parameter follows:
8749 %
8750 %    o wand: the magick wand.
8751 %
8752 %    o width,height,x,y:  Define the dimensions of the area to raise.
8753 %
8754 %    o raise: A value other than zero creates a 3-D raise effect,
8755 %      otherwise it has a lowered effect.
8756 %
8757 */
MagickRaiseImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y,const MagickBooleanType raise)8758 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8759   const size_t width,const size_t height,const ssize_t x,const ssize_t y,
8760   const MagickBooleanType raise)
8761 {
8762   MagickBooleanType
8763     status;
8764 
8765   RectangleInfo
8766     raise_info;
8767 
8768   assert(wand != (MagickWand *) NULL);
8769   assert(wand->signature == WandSignature);
8770   if (wand->debug != MagickFalse)
8771     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8772   if (wand->images == (Image *) NULL)
8773     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8774   raise_info.width=width;
8775   raise_info.height=height;
8776   raise_info.x=x;
8777   raise_info.y=y;
8778   status=RaiseImage(wand->images,&raise_info,raise);
8779   if (status == MagickFalse)
8780     InheritException(wand->exception,&wand->images->exception);
8781   return(status);
8782 }
8783 
8784 /*
8785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8786 %                                                                             %
8787 %                                                                             %
8788 %                                                                             %
8789 %   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                       %
8790 %                                                                             %
8791 %                                                                             %
8792 %                                                                             %
8793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8794 %
8795 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8796 %  the intensity of each pixel compared to threshold.  The result is a
8797 %  high-contrast, two color image.
8798 %
8799 %  The format of the MagickRandomThresholdImage method is:
8800 %
8801 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8802 %        const double low,const double high)
8803 %      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8804 %        const ChannelType channel,const double low,const double high)
8805 %
8806 %  A description of each parameter follows:
8807 %
8808 %    o wand: the magick wand.
8809 %
8810 %    o channel: the image channel(s).
8811 %
8812 %    o low,high: Specify the high and low thresholds.  These values range from
8813 %      0 to QuantumRange.
8814 %
8815 */
8816 
MagickRandomThresholdImage(MagickWand * wand,const double low,const double high)8817 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8818   const double low,const double high)
8819 {
8820   MagickBooleanType
8821     status;
8822 
8823   status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8824   return(status);
8825 }
8826 
MagickRandomThresholdImageChannel(MagickWand * wand,const ChannelType channel,const double low,const double high)8827 WandExport MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8828   const ChannelType channel,const double low,const double high)
8829 {
8830   char
8831     threshold[MaxTextExtent];
8832 
8833   MagickBooleanType
8834     status;
8835 
8836   assert(wand != (MagickWand *) NULL);
8837   assert(wand->signature == WandSignature);
8838   if (wand->debug != MagickFalse)
8839     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8840   if (wand->images == (Image *) NULL)
8841     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8842   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8843   status=RandomThresholdImageChannel(wand->images,channel,threshold,
8844     wand->exception);
8845   if (status == MagickFalse)
8846     InheritException(wand->exception,&wand->images->exception);
8847   return(status);
8848 }
8849 
8850 /*
8851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8852 %                                                                             %
8853 %                                                                             %
8854 %                                                                             %
8855 %   M a g i c k R e a d I m a g e                                             %
8856 %                                                                             %
8857 %                                                                             %
8858 %                                                                             %
8859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8860 %
8861 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8862 %  at the current image pointer position.   Use MagickSetFirstIterator(),
8863 %  MagickSetLastIterator, or MagickSetIteratorIndex() to specify the current
8864 %  image pointer position at the beginning of the image list, the end, or
8865 %  anywhere in-between respectively.
8866 %
8867 %  The format of the MagickReadImage method is:
8868 %
8869 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8870 %
8871 %  A description of each parameter follows:
8872 %
8873 %    o wand: the magick wand.
8874 %
8875 %    o filename: the image filename.
8876 %
8877 */
MagickReadImage(MagickWand * wand,const char * filename)8878 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8879   const char *filename)
8880 {
8881   Image
8882     *images;
8883 
8884   ImageInfo
8885     *read_info;
8886 
8887   assert(wand != (MagickWand *) NULL);
8888   assert(wand->signature == WandSignature);
8889   if (wand->debug != MagickFalse)
8890     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8891   read_info=CloneImageInfo(wand->image_info);
8892   if (filename != (const char *) NULL)
8893     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8894   images=ReadImage(read_info,wand->exception);
8895   read_info=DestroyImageInfo(read_info);
8896   if (images == (Image *) NULL)
8897     return(MagickFalse);
8898   return(InsertImageInWand(wand,images));
8899 }
8900 
8901 /*
8902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8903 %                                                                             %
8904 %                                                                             %
8905 %                                                                             %
8906 %   M a g i c k R e a d I m a g e B l o b                                     %
8907 %                                                                             %
8908 %                                                                             %
8909 %                                                                             %
8910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8911 %
8912 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8913 %
8914 %  The format of the MagickReadImageBlob method is:
8915 %
8916 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8917 %        const void *blob,const size_t length)
8918 %
8919 %  A description of each parameter follows:
8920 %
8921 %    o wand: the magick wand.
8922 %
8923 %    o blob: the blob.
8924 %
8925 %    o length: the blob length.
8926 %
8927 */
MagickReadImageBlob(MagickWand * wand,const void * blob,const size_t length)8928 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8929   const void *blob,const size_t length)
8930 {
8931   Image
8932     *images;
8933 
8934   assert(wand != (MagickWand *) NULL);
8935   assert(wand->signature == WandSignature);
8936   if (wand->debug != MagickFalse)
8937     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8938   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8939   if (images == (Image *) NULL)
8940     return(MagickFalse);
8941   return(InsertImageInWand(wand,images));
8942 }
8943 
8944 /*
8945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8946 %                                                                             %
8947 %                                                                             %
8948 %                                                                             %
8949 %   M a g i c k R e a d I m a g e F i l e                                     %
8950 %                                                                             %
8951 %                                                                             %
8952 %                                                                             %
8953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8954 %
8955 %  MagickReadImageFile() reads an image or image sequence from an open file
8956 %  descriptor.
8957 %
8958 %  The format of the MagickReadImageFile method is:
8959 %
8960 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8961 %
8962 %  A description of each parameter follows:
8963 %
8964 %    o wand: the magick wand.
8965 %
8966 %    o file: the file descriptor.
8967 %
8968 */
MagickReadImageFile(MagickWand * wand,FILE * file)8969 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8970 {
8971   Image
8972     *images;
8973 
8974   ImageInfo
8975     *read_info;
8976 
8977   assert(wand != (MagickWand *) NULL);
8978   assert(wand->signature == WandSignature);
8979   assert(file != (FILE *) NULL);
8980   if (wand->debug != MagickFalse)
8981     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8982   read_info=CloneImageInfo(wand->image_info);
8983   SetImageInfoFile(read_info,file);
8984   images=ReadImage(read_info,wand->exception);
8985   read_info=DestroyImageInfo(read_info);
8986   if (images == (Image *) NULL)
8987     return(MagickFalse);
8988   return(InsertImageInWand(wand,images));
8989 }
8990 
8991 /*
8992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8993 %                                                                             %
8994 %                                                                             %
8995 %                                                                             %
8996 %   M a g i c k R e m a p I m a g e                                           %
8997 %                                                                             %
8998 %                                                                             %
8999 %                                                                             %
9000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9001 %
9002 %  MagickRemapImage() replaces the colors of an image with the closest color
9003 %  from a reference image.
9004 %
9005 %  The format of the MagickRemapImage method is:
9006 %
9007 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
9008 %        const MagickWand *remap_wand,const DitherMethod method)
9009 %
9010 %  A description of each parameter follows:
9011 %
9012 %    o wand: the magick wand.
9013 %
9014 %    o affinity: the affinity wand.
9015 %
9016 %    o method: choose from these dither methods: NoDitherMethod,
9017 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
9018 %
9019 */
MagickRemapImage(MagickWand * wand,const MagickWand * remap_wand,const DitherMethod method)9020 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
9021   const MagickWand *remap_wand,const DitherMethod method)
9022 {
9023   MagickBooleanType
9024     status;
9025 
9026   QuantizeInfo
9027     *quantize_info;
9028 
9029   assert(wand != (MagickWand *) NULL);
9030   assert(wand->signature == WandSignature);
9031   if (wand->debug != MagickFalse)
9032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9033   if ((wand->images == (Image *) NULL) ||
9034       (remap_wand->images == (Image *) NULL))
9035     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9036   quantize_info=AcquireQuantizeInfo(wand->image_info);
9037   quantize_info->dither_method=method;
9038   if (method == NoDitherMethod)
9039     quantize_info->dither=MagickFalse;
9040   status=RemapImage(quantize_info,wand->images,remap_wand->images);
9041   quantize_info=DestroyQuantizeInfo(quantize_info);
9042   if (status == MagickFalse)
9043     InheritException(wand->exception,&wand->images->exception);
9044   return(status);
9045 }
9046 
9047 /*
9048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9049 %                                                                             %
9050 %                                                                             %
9051 %                                                                             %
9052 %   M a g i c k R e m o v e I m a g e                                         %
9053 %                                                                             %
9054 %                                                                             %
9055 %                                                                             %
9056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9057 %
9058 %  MagickRemoveImage() removes an image from the image list.
9059 %
9060 %  The format of the MagickRemoveImage method is:
9061 %
9062 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
9063 %
9064 %  A description of each parameter follows:
9065 %
9066 %    o wand: the magick wand.
9067 %
9068 %    o insert: the splice wand.
9069 %
9070 */
MagickRemoveImage(MagickWand * wand)9071 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
9072 {
9073   assert(wand != (MagickWand *) NULL);
9074   assert(wand->signature == WandSignature);
9075   if (wand->debug != MagickFalse)
9076     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9077   if (wand->images == (Image *) NULL)
9078     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9079   DeleteImageFromList(&wand->images);
9080   return(MagickTrue);
9081 }
9082 
9083 /*
9084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9085 %                                                                             %
9086 %                                                                             %
9087 %                                                                             %
9088 %   M a g i c k R e s a m p l e I m a g e                                     %
9089 %                                                                             %
9090 %                                                                             %
9091 %                                                                             %
9092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9093 %
9094 %  MagickResampleImage() resample image to desired resolution.
9095 %
9096 %    Bessel   Blackman   Box
9097 %    Catrom   Cubic      Gaussian
9098 %    Hanning  Hermite    Lanczos
9099 %    Mitchell Point      Quandratic
9100 %    Sinc     Triangle
9101 %
9102 %  Most of the filters are FIR (finite impulse response), however, Bessel,
9103 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
9104 %  are windowed (brought down to zero) with the Blackman filter.
9105 %
9106 %  The format of the MagickResampleImage method is:
9107 %
9108 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
9109 %        const double x_resolution,const double y_resolution,
9110 %        const FilterTypes filter,const double blur)
9111 %
9112 %  A description of each parameter follows:
9113 %
9114 %    o wand: the magick wand.
9115 %
9116 %    o x_resolution: the new image x resolution.
9117 %
9118 %    o y_resolution: the new image y resolution.
9119 %
9120 %    o filter: Image filter to use.
9121 %
9122 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
9123 %
9124 */
MagickResampleImage(MagickWand * wand,const double x_resolution,const double y_resolution,const FilterTypes filter,const double blur)9125 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
9126   const double x_resolution,const double y_resolution,const FilterTypes filter,
9127   const double blur)
9128 {
9129   Image
9130     *resample_image;
9131 
9132   assert(wand != (MagickWand *) NULL);
9133   assert(wand->signature == WandSignature);
9134   if (wand->debug != MagickFalse)
9135     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9136   if (wand->images == (Image *) NULL)
9137     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9138   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
9139     blur,wand->exception);
9140   if (resample_image == (Image *) NULL)
9141     return(MagickFalse);
9142   ReplaceImageInList(&wand->images,resample_image);
9143   return(MagickTrue);
9144 }
9145 
9146 /*
9147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9148 %                                                                             %
9149 %                                                                             %
9150 %                                                                             %
9151 %   M a g i c k R e s e t I m a g e P a g e                                   %
9152 %                                                                             %
9153 %                                                                             %
9154 %                                                                             %
9155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9156 %
9157 %  MagickResetImagePage() resets the Wand page canvas and position.
9158 %
9159 %  The format of the MagickResetImagePage method is:
9160 %
9161 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
9162 %        const char *page)
9163 %
9164 %  A description of each parameter follows:
9165 %
9166 %    o wand: the magick wand.
9167 %
9168 %    o page: the relative page specification.
9169 %
9170 */
MagickResetImagePage(MagickWand * wand,const char * page)9171 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
9172   const char *page)
9173 {
9174   assert(wand != (MagickWand *) NULL);
9175   assert(wand->signature == WandSignature);
9176   if (wand->debug != MagickFalse)
9177     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9178   if (wand->images == (Image *) NULL)
9179     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9180   if ((page == (char *) NULL) || (*page == '\0'))
9181     {
9182       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
9183       return(MagickTrue);
9184     }
9185   return(ResetImagePage(wand->images,page));
9186 }
9187 
9188 /*
9189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9190 %                                                                             %
9191 %                                                                             %
9192 %                                                                             %
9193 %   M a g i c k R e s i z e I m a g e                                         %
9194 %                                                                             %
9195 %                                                                             %
9196 %                                                                             %
9197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9198 %
9199 %  MagickResizeImage() scales an image to the desired dimensions with one of
9200 %  these filters:
9201 %
9202 %    Bessel   Blackman   Box
9203 %    Catrom   Cubic      Gaussian
9204 %    Hanning  Hermite    Lanczos
9205 %    Mitchell Point      Quandratic
9206 %    Sinc     Triangle
9207 %
9208 %  Most of the filters are FIR (finite impulse response), however, Bessel,
9209 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
9210 %  are windowed (brought down to zero) with the Blackman filter.
9211 %
9212 %  The format of the MagickResizeImage method is:
9213 %
9214 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
9215 %        const size_t columns,const size_t rows,
9216 %        const FilterTypes filter,const double blur)
9217 %
9218 %  A description of each parameter follows:
9219 %
9220 %    o wand: the magick wand.
9221 %
9222 %    o columns: the number of columns in the scaled image.
9223 %
9224 %    o rows: the number of rows in the scaled image.
9225 %
9226 %    o filter: Image filter to use.
9227 %
9228 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
9229 %
9230 */
MagickResizeImage(MagickWand * wand,const size_t columns,const size_t rows,const FilterTypes filter,const double blur)9231 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
9232   const size_t columns,const size_t rows,const FilterTypes filter,
9233   const double blur)
9234 {
9235   Image
9236     *resize_image;
9237 
9238   assert(wand != (MagickWand *) NULL);
9239   assert(wand->signature == WandSignature);
9240   if (wand->debug != MagickFalse)
9241     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9242   if (wand->images == (Image *) NULL)
9243     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9244   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
9245     wand->exception);
9246   if (resize_image == (Image *) NULL)
9247     return(MagickFalse);
9248   ReplaceImageInList(&wand->images,resize_image);
9249   return(MagickTrue);
9250 }
9251 
9252 /*
9253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9254 %                                                                             %
9255 %                                                                             %
9256 %                                                                             %
9257 %   M a g i c k R o l l I m a g e                                             %
9258 %                                                                             %
9259 %                                                                             %
9260 %                                                                             %
9261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9262 %
9263 %  MagickRollImage() offsets an image as defined by x and y.
9264 %
9265 %  The format of the MagickRollImage method is:
9266 %
9267 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
9268 %        const size_t y)
9269 %
9270 %  A description of each parameter follows:
9271 %
9272 %    o wand: the magick wand.
9273 %
9274 %    o x: the x offset.
9275 %
9276 %    o y: the y offset.
9277 %
9278 */
MagickRollImage(MagickWand * wand,const ssize_t x,const ssize_t y)9279 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
9280   const ssize_t y)
9281 {
9282   Image
9283     *roll_image;
9284 
9285   assert(wand != (MagickWand *) NULL);
9286   assert(wand->signature == WandSignature);
9287   if (wand->debug != MagickFalse)
9288     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9289   if (wand->images == (Image *) NULL)
9290     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9291   roll_image=RollImage(wand->images,x,y,wand->exception);
9292   if (roll_image == (Image *) NULL)
9293     return(MagickFalse);
9294   ReplaceImageInList(&wand->images,roll_image);
9295   return(MagickTrue);
9296 }
9297 
9298 /*
9299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9300 %                                                                             %
9301 %                                                                             %
9302 %                                                                             %
9303 %   M a g i c k R o t a t e I m a g e                                         %
9304 %                                                                             %
9305 %                                                                             %
9306 %                                                                             %
9307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9308 %
9309 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
9310 %  triangles left over from rotating the image are filled with the
9311 %  background color.
9312 %
9313 %  The format of the MagickRotateImage method is:
9314 %
9315 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
9316 %        const PixelWand *background,const double degrees)
9317 %
9318 %  A description of each parameter follows:
9319 %
9320 %    o wand: the magick wand.
9321 %
9322 %    o background: the background pixel wand.
9323 %
9324 %    o degrees: the number of degrees to rotate the image.
9325 %
9326 %
9327 */
MagickRotateImage(MagickWand * wand,const PixelWand * background,const double degrees)9328 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
9329   const PixelWand *background,const double degrees)
9330 {
9331   Image
9332     *rotate_image;
9333 
9334   assert(wand != (MagickWand *) NULL);
9335   assert(wand->signature == WandSignature);
9336   if (wand->debug != MagickFalse)
9337     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9338   if (wand->images == (Image *) NULL)
9339     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9340   PixelGetQuantumColor(background,&wand->images->background_color);
9341   rotate_image=RotateImage(wand->images,degrees,wand->exception);
9342   if (rotate_image == (Image *) NULL)
9343     return(MagickFalse);
9344   ReplaceImageInList(&wand->images,rotate_image);
9345   return(MagickTrue);
9346 }
9347 
9348 /*
9349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9350 %                                                                             %
9351 %                                                                             %
9352 %                                                                             %
9353 %   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                         %
9354 %                                                                             %
9355 %                                                                             %
9356 %                                                                             %
9357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9358 %
9359 %  MagickRotationalBlurImage() rotational blurs an image.
9360 %
9361 %  The format of the MagickRotationalBlurImage method is:
9362 %
9363 %      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
9364 %        const double angle)
9365 %      MagickBooleanType MagickRotationalBlurImageChannel(MagickWand *wand,
9366 %        const ChannelType channel,const double angle)
9367 %
9368 %  A description of each parameter follows:
9369 %
9370 %    o wand: the magick wand.
9371 %
9372 %    o channel: the image channel(s).
9373 %
9374 %    o angle: the angle of the blur in degrees.
9375 %
9376 */
MagickRotationalBlurImage(MagickWand * wand,const double angle)9377 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
9378   const double angle)
9379 {
9380   MagickBooleanType
9381     status;
9382 
9383   status=MagickRotationalBlurImageChannel(wand,DefaultChannels,angle);
9384   return(status);
9385 }
9386 
MagickRotationalBlurImageChannel(MagickWand * wand,const ChannelType channel,const double angle)9387 WandExport MagickBooleanType MagickRotationalBlurImageChannel(MagickWand *wand,
9388   const ChannelType channel,const double angle)
9389 {
9390   Image
9391     *blur_image;
9392 
9393   assert(wand != (MagickWand *) NULL);
9394   assert(wand->signature == WandSignature);
9395   if (wand->debug != MagickFalse)
9396     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9397   if (wand->images == (Image *) NULL)
9398     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9399   blur_image=RotationalBlurImageChannel(wand->images,channel,angle,
9400     wand->exception);
9401   if (blur_image == (Image *) NULL)
9402     return(MagickFalse);
9403   ReplaceImageInList(&wand->images,blur_image);
9404   return(MagickTrue);
9405 }
9406 
9407 /*
9408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9409 %                                                                             %
9410 %                                                                             %
9411 %                                                                             %
9412 %   M a g i c k S a m p l e I m a g e                                         %
9413 %                                                                             %
9414 %                                                                             %
9415 %                                                                             %
9416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9417 %
9418 %  MagickSampleImage() scales an image to the desired dimensions with pixel
9419 %  sampling.  Unlike other scaling methods, this method does not introduce
9420 %  any additional color into the scaled image.
9421 %
9422 %  The format of the MagickSampleImage method is:
9423 %
9424 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
9425 %        const size_t columns,const size_t rows)
9426 %
9427 %  A description of each parameter follows:
9428 %
9429 %    o wand: the magick wand.
9430 %
9431 %    o columns: the number of columns in the scaled image.
9432 %
9433 %    o rows: the number of rows in the scaled image.
9434 %
9435 */
MagickSampleImage(MagickWand * wand,const size_t columns,const size_t rows)9436 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9437   const size_t columns,const size_t rows)
9438 {
9439   Image
9440     *sample_image;
9441 
9442   assert(wand != (MagickWand *) NULL);
9443   assert(wand->signature == WandSignature);
9444   if (wand->debug != MagickFalse)
9445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9446   if (wand->images == (Image *) NULL)
9447     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9448   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9449   if (sample_image == (Image *) NULL)
9450     return(MagickFalse);
9451   ReplaceImageInList(&wand->images,sample_image);
9452   return(MagickTrue);
9453 }
9454 
9455 /*
9456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9457 %                                                                             %
9458 %                                                                             %
9459 %                                                                             %
9460 %   M a g i c k S c a l e I m a g e                                           %
9461 %                                                                             %
9462 %                                                                             %
9463 %                                                                             %
9464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9465 %
9466 %  MagickScaleImage() scales the size of an image to the given dimensions.
9467 %
9468 %  The format of the MagickScaleImage method is:
9469 %
9470 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
9471 %        const size_t columns,const size_t rows)
9472 %
9473 %  A description of each parameter follows:
9474 %
9475 %    o wand: the magick wand.
9476 %
9477 %    o columns: the number of columns in the scaled image.
9478 %
9479 %    o rows: the number of rows in the scaled image.
9480 %
9481 */
MagickScaleImage(MagickWand * wand,const size_t columns,const size_t rows)9482 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9483   const size_t columns,const size_t rows)
9484 {
9485   Image
9486     *scale_image;
9487 
9488   assert(wand != (MagickWand *) NULL);
9489   assert(wand->signature == WandSignature);
9490   if (wand->debug != MagickFalse)
9491     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9492   if (wand->images == (Image *) NULL)
9493     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9494   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9495   if (scale_image == (Image *) NULL)
9496     return(MagickFalse);
9497   ReplaceImageInList(&wand->images,scale_image);
9498   return(MagickTrue);
9499 }
9500 
9501 /*
9502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503 %                                                                             %
9504 %                                                                             %
9505 %                                                                             %
9506 %   M a g i c k S e g m e n t I m a g e                                       %
9507 %                                                                             %
9508 %                                                                             %
9509 %                                                                             %
9510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9511 %
9512 %  MagickSegmentImage() segments an image by analyzing the histograms of the
9513 %  color components and identifying units that are homogeneous with the fuzzy
9514 %  C-means technique.
9515 %
9516 %  The format of the SegmentImage method is:
9517 %
9518 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
9519 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
9520 %        const double cluster_threshold,const double smooth_threshold)
9521 %
9522 %  A description of each parameter follows.
9523 %
9524 %    o wand: the wand.
9525 %
9526 %    o colorspace: the image colorspace.
9527 %
9528 %    o verbose:  Set to MagickTrue to print detailed information about the
9529 %      identified classes.
9530 %
9531 %    o cluster_threshold:  This represents the minimum number of pixels
9532 %      contained in a hexahedra before it can be considered valid (expressed as
9533 %      a percentage).
9534 %
9535 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
9536 %      derivative of the histogram.  As the value is increased, you can expect a
9537 %      smoother second derivative.
9538 %
9539 */
MagickSegmentImage(MagickWand * wand,const ColorspaceType colorspace,const MagickBooleanType verbose,const double cluster_threshold,const double smooth_threshold)9540 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9541   const ColorspaceType colorspace,const MagickBooleanType verbose,
9542   const double cluster_threshold,const double smooth_threshold)
9543 {
9544   MagickBooleanType
9545     status;
9546 
9547   assert(wand != (MagickWand *) NULL);
9548   assert(wand->signature == WandSignature);
9549   if (wand->debug != MagickFalse)
9550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9551   if (wand->images == (Image *) NULL)
9552     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9553   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9554     smooth_threshold);
9555   if (status == MagickFalse)
9556     InheritException(wand->exception,&wand->images->exception);
9557   return(status);
9558 }
9559 
9560 /*
9561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9562 %                                                                             %
9563 %                                                                             %
9564 %                                                                             %
9565 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
9566 %                                                                             %
9567 %                                                                             %
9568 %                                                                             %
9569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9570 %
9571 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
9572 %  threshold. It is similar to the unsharpen mask that sharpens everything with
9573 %  contrast above a certain threshold.
9574 %
9575 %  The format of the MagickSelectiveBlurImage method is:
9576 %
9577 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9578 %        const double radius,const double sigma,const double threshold)
9579 %      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9580 %        const ChannelType channel,const double radius,const double sigma,
9581 %        const double threshold)
9582 %
9583 %  A description of each parameter follows:
9584 %
9585 %    o wand: the magick wand.
9586 %
9587 %    o channel: the image channel(s).
9588 %
9589 %    o radius: the radius of the gaussian, in pixels, not counting the center
9590 %      pixel.
9591 %
9592 %    o sigma: the standard deviation of the gaussian, in pixels.
9593 %
9594 %    o threshold: only pixels within this contrast threshold are included
9595 %      in the blur operation.
9596 %
9597 */
9598 
MagickSelectiveBlurImage(MagickWand * wand,const double radius,const double sigma,const double threshold)9599 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9600   const double radius,const double sigma,const double threshold)
9601 {
9602   MagickBooleanType
9603     status;
9604 
9605   status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9606     threshold);
9607   return(status);
9608 }
9609 
MagickSelectiveBlurImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma,const double threshold)9610 WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9611   const ChannelType channel,const double radius,const double sigma,
9612   const double threshold)
9613 {
9614   Image
9615     *blur_image;
9616 
9617   assert(wand != (MagickWand *) NULL);
9618   assert(wand->signature == WandSignature);
9619   if (wand->debug != MagickFalse)
9620     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9621   if (wand->images == (Image *) NULL)
9622     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9623   blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9624     threshold,wand->exception);
9625   if (blur_image == (Image *) NULL)
9626     return(MagickFalse);
9627   ReplaceImageInList(&wand->images,blur_image);
9628   return(MagickTrue);
9629 }
9630 
9631 /*
9632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9633 %                                                                             %
9634 %                                                                             %
9635 %                                                                             %
9636 %   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                       %
9637 %                                                                             %
9638 %                                                                             %
9639 %                                                                             %
9640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9641 %
9642 %  MagickSeparateImageChannel() separates a channel from the image and returns a
9643 %  grayscale image.  A channel is a particular color component of each pixel
9644 %  in the image.
9645 %
9646 %  The format of the MagickSeparateImageChannel method is:
9647 %
9648 %      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9649 %        const ChannelType channel)
9650 %
9651 %  A description of each parameter follows:
9652 %
9653 %    o wand: the magick wand.
9654 %
9655 %    o channel: the image channel(s).
9656 %
9657 */
MagickSeparateImageChannel(MagickWand * wand,const ChannelType channel)9658 WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9659   const ChannelType channel)
9660 {
9661   MagickBooleanType
9662     status;
9663 
9664   assert(wand != (MagickWand *) NULL);
9665   assert(wand->signature == WandSignature);
9666   if (wand->debug != MagickFalse)
9667     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9668   if (wand->images == (Image *) NULL)
9669     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9670   status=SeparateImageChannel(wand->images,channel);
9671   if (status == MagickFalse)
9672     InheritException(wand->exception,&wand->images->exception);
9673   return(status);
9674 }
9675 
9676 /*
9677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9678 %                                                                             %
9679 %                                                                             %
9680 %                                                                             %
9681 %     M a g i c k S e p i a T o n e I m a g e                                 %
9682 %                                                                             %
9683 %                                                                             %
9684 %                                                                             %
9685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9686 %
9687 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
9688 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9689 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9690 %  threshold of 80% is a good starting point for a reasonable tone.
9691 %
9692 %  The format of the MagickSepiaToneImage method is:
9693 %
9694 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9695 %        const double threshold)
9696 %
9697 %  A description of each parameter follows:
9698 %
9699 %    o wand: the magick wand.
9700 %
9701 %    o threshold:  Define the extent of the sepia toning.
9702 %
9703 */
MagickSepiaToneImage(MagickWand * wand,const double threshold)9704 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9705   const double threshold)
9706 {
9707   Image
9708     *sepia_image;
9709 
9710   assert(wand != (MagickWand *) NULL);
9711   assert(wand->signature == WandSignature);
9712   if (wand->debug != MagickFalse)
9713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9714   if (wand->images == (Image *) NULL)
9715     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9716   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9717   if (sepia_image == (Image *) NULL)
9718     return(MagickFalse);
9719   ReplaceImageInList(&wand->images,sepia_image);
9720   return(MagickTrue);
9721 }
9722 
9723 /*
9724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9725 %                                                                             %
9726 %                                                                             %
9727 %                                                                             %
9728 %   M a g i c k S e t I m a g e                                               %
9729 %                                                                             %
9730 %                                                                             %
9731 %                                                                             %
9732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9733 %
9734 %  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
9735 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
9736 %  wand.
9737 %
9738 %  The format of the MagickSetImage method is:
9739 %
9740 %      MagickBooleanType MagickSetImage(MagickWand *wand,
9741 %        const MagickWand *set_wand)
9742 %
9743 %  A description of each parameter follows:
9744 %
9745 %    o wand: the magick wand.
9746 %
9747 %    o set_wand: the set_wand wand.
9748 %
9749 */
MagickSetImage(MagickWand * wand,const MagickWand * set_wand)9750 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9751   const MagickWand *set_wand)
9752 {
9753   Image
9754     *images;
9755 
9756   assert(wand != (MagickWand *) NULL);
9757   assert(wand->signature == WandSignature);
9758   if (wand->debug != MagickFalse)
9759     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9760   assert(set_wand != (MagickWand *) NULL);
9761   assert(set_wand->signature == WandSignature);
9762   if (wand->debug != MagickFalse)
9763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9764   if (set_wand->images == (Image *) NULL)
9765     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9766   images=CloneImageList(set_wand->images,wand->exception);
9767   if (images == (Image *) NULL)
9768     return(MagickFalse);
9769   ReplaceImageInList(&wand->images,images);
9770   return(MagickTrue);
9771 }
9772 
9773 /*
9774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9775 %                                                                             %
9776 %                                                                             %
9777 %                                                                             %
9778 %   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                       %
9779 %                                                                             %
9780 %                                                                             %
9781 %                                                                             %
9782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9783 %
9784 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9785 %  alpha channel.
9786 %
9787 %  The format of the MagickSetImageAlphaChannel method is:
9788 %
9789 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9790 %        const AlphaChannelType alpha_type)
9791 %
9792 %  A description of each parameter follows:
9793 %
9794 %    o wand: the magick wand.
9795 %
9796 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9797 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9798 %
9799 */
MagickSetImageAlphaChannel(MagickWand * wand,const AlphaChannelType alpha_type)9800 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9801   const AlphaChannelType alpha_type)
9802 {
9803   assert(wand != (MagickWand *) NULL);
9804   assert(wand->signature == WandSignature);
9805   if (wand->debug != MagickFalse)
9806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9807   if (wand->images == (Image *) NULL)
9808     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9809   return(SetImageAlphaChannel(wand->images,alpha_type));
9810 }
9811 
9812 /*
9813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9814 %                                                                             %
9815 %                                                                             %
9816 %                                                                             %
9817 %   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                 %
9818 %                                                                             %
9819 %                                                                             %
9820 %                                                                             %
9821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9822 %
9823 %  MagickSetImageBackgroundColor() sets the image background color.
9824 %
9825 %  The format of the MagickSetImageBackgroundColor method is:
9826 %
9827 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9828 %        const PixelWand *background)
9829 %
9830 %  A description of each parameter follows:
9831 %
9832 %    o wand: the magick wand.
9833 %
9834 %    o background: the background pixel wand.
9835 %
9836 */
MagickSetImageBackgroundColor(MagickWand * wand,const PixelWand * background)9837 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9838   const PixelWand *background)
9839 {
9840   assert(wand != (MagickWand *) NULL);
9841   assert(wand->signature == WandSignature);
9842   if (wand->debug != MagickFalse)
9843     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9844   if (wand->images == (Image *) NULL)
9845     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9846   PixelGetQuantumColor(background,&wand->images->background_color);
9847   return(MagickTrue);
9848 }
9849 
9850 /*
9851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9852 %                                                                             %
9853 %                                                                             %
9854 %                                                                             %
9855 %   M a g i c k S e t I m a g e B i a s                                       %
9856 %                                                                             %
9857 %                                                                             %
9858 %                                                                             %
9859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9860 %
9861 %  MagickSetImageBias() sets the image bias for any method that convolves an
9862 %  image (e.g. MagickConvolveImage()).
9863 %
9864 %  The format of the MagickSetImageBias method is:
9865 %
9866 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9867 %        const double bias)
9868 %
9869 %  A description of each parameter follows:
9870 %
9871 %    o wand: the magick wand.
9872 %
9873 %    o bias: the image bias.
9874 %
9875 */
MagickSetImageBias(MagickWand * wand,const double bias)9876 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9877   const double bias)
9878 {
9879   char
9880     option[MaxTextExtent];
9881 
9882   assert(wand != (MagickWand *) NULL);
9883   assert(wand->signature == WandSignature);
9884   if (wand->debug != MagickFalse)
9885     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9886   if (wand->images == (Image *) NULL)
9887     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9888   (void) FormatLocaleString(option,MaxTextExtent,"%+g",bias);
9889   (void) SetImageOption(wand->image_info,"bias",option);
9890   return(MagickTrue);
9891 }
9892 
9893 /*
9894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9895 %                                                                             %
9896 %                                                                             %
9897 %                                                                             %
9898 %   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                         %
9899 %                                                                             %
9900 %                                                                             %
9901 %                                                                             %
9902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9903 %
9904 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9905 %
9906 %  The format of the MagickSetImageBluePrimary method is:
9907 %
9908 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9909 %        const double x,const double y)
9910 %
9911 %  A description of each parameter follows:
9912 %
9913 %    o wand: the magick wand.
9914 %
9915 %    o x: the blue primary x-point.
9916 %
9917 %    o y: the blue primary y-point.
9918 %
9919 */
MagickSetImageBluePrimary(MagickWand * wand,const double x,const double y)9920 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9921   const double x,const double y)
9922 {
9923   assert(wand != (MagickWand *) NULL);
9924   assert(wand->signature == WandSignature);
9925   if (wand->debug != MagickFalse)
9926     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9927   if (wand->images == (Image *) NULL)
9928     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9929   wand->images->chromaticity.blue_primary.x=x;
9930   wand->images->chromaticity.blue_primary.y=y;
9931   return(MagickTrue);
9932 }
9933 
9934 /*
9935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9936 %                                                                             %
9937 %                                                                             %
9938 %                                                                             %
9939 %   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                         %
9940 %                                                                             %
9941 %                                                                             %
9942 %                                                                             %
9943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9944 %
9945 %  MagickSetImageBorderColor() sets the image border color.
9946 %
9947 %  The format of the MagickSetImageBorderColor method is:
9948 %
9949 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9950 %        const PixelWand *border)
9951 %
9952 %  A description of each parameter follows:
9953 %
9954 %    o wand: the magick wand.
9955 %
9956 %    o border: the border pixel wand.
9957 %
9958 */
MagickSetImageBorderColor(MagickWand * wand,const PixelWand * border)9959 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9960   const PixelWand *border)
9961 {
9962   assert(wand != (MagickWand *) NULL);
9963   assert(wand->signature == WandSignature);
9964   if (wand->debug != MagickFalse)
9965     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9966   if (wand->images == (Image *) NULL)
9967     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9968   PixelGetQuantumColor(border,&wand->images->border_color);
9969   return(MagickTrue);
9970 }
9971 
9972 /*
9973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9974 %                                                                             %
9975 %                                                                             %
9976 %                                                                             %
9977 %   M a g i c k S e t I m a g e C h a n n e l D e p t h                       %
9978 %                                                                             %
9979 %                                                                             %
9980 %                                                                             %
9981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9982 %
9983 %  MagickSetImageChannelDepth() sets the depth of a particular image channel.
9984 %
9985 %  The format of the MagickSetImageChannelDepth method is:
9986 %
9987 %      MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9988 %        const ChannelType channel,const size_t depth)
9989 %
9990 %  A description of each parameter follows:
9991 %
9992 %    o wand: the magick wand.
9993 %
9994 %    o channel: the image channel(s).
9995 %
9996 %    o depth: the image depth in bits.
9997 %
9998 */
MagickSetImageChannelDepth(MagickWand * wand,const ChannelType channel,const size_t depth)9999 WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
10000   const ChannelType channel,const size_t depth)
10001 {
10002   assert(wand != (MagickWand *) NULL);
10003   assert(wand->signature == WandSignature);
10004   if (wand->debug != MagickFalse)
10005     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10006   if (wand->images == (Image *) NULL)
10007     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10008   return(SetImageChannelDepth(wand->images,channel,depth));
10009 }
10010 
10011 /*
10012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10013 %                                                                             %
10014 %                                                                             %
10015 %                                                                             %
10016 %   M a g i c k S e t I m a g e C l i p M a s k                               %
10017 %                                                                             %
10018 %                                                                             %
10019 %                                                                             %
10020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10021 %
10022 %  MagickSetImageClipMask() sets image clip mask.
10023 %
10024 %  The format of the MagickSetImageClipMask method is:
10025 %
10026 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
10027 %        const MagickWand *clip_mask)
10028 %
10029 %  A description of each parameter follows:
10030 %
10031 %    o wand: the magick wand.
10032 %
10033 %    o clip_mask: the clip_mask wand.
10034 %
10035 */
MagickSetImageClipMask(MagickWand * wand,const MagickWand * clip_mask)10036 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
10037   const MagickWand *clip_mask)
10038 {
10039   assert(wand != (MagickWand *) NULL);
10040   assert(wand->signature == WandSignature);
10041   if (wand->debug != MagickFalse)
10042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10043   assert(clip_mask != (MagickWand *) NULL);
10044   assert(clip_mask->signature == WandSignature);
10045   if (clip_mask->debug != MagickFalse)
10046     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
10047   if (clip_mask->images == (Image *) NULL)
10048     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
10049   return(SetImageClipMask(wand->images,clip_mask->images));
10050 }
10051 
10052 /*
10053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10054 %                                                                             %
10055 %                                                                             %
10056 %                                                                             %
10057 %   M a g i c k S e t I m a g e C o l o r                                     %
10058 %                                                                             %
10059 %                                                                             %
10060 %                                                                             %
10061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10062 %
10063 %  MagickSetImageColor() set the entire wand canvas to the specified color.
10064 %
10065 %  The format of the MagickSetImageColor method is:
10066 %
10067 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
10068 %        const PixelWand *color)
10069 %
10070 %  A description of each parameter follows:
10071 %
10072 %    o wand: the magick wand.
10073 %
10074 %    o background: the image color.
10075 %
10076 */
MagickSetImageColor(MagickWand * wand,const PixelWand * color)10077 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
10078   const PixelWand *color)
10079 {
10080   MagickBooleanType
10081     status;
10082 
10083   MagickPixelPacket
10084     pixel;
10085 
10086   assert(wand != (MagickWand *) NULL);
10087   assert(wand->signature == WandSignature);
10088   if (wand->debug != MagickFalse)
10089     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10090   PixelGetMagickColor(color,&pixel);
10091   status=SetImageColor(wand->images,&pixel);
10092   if (status == MagickFalse)
10093     InheritException(wand->exception,&wand->images->exception);
10094   return(status);
10095 }
10096 
10097 /*
10098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10099 %                                                                             %
10100 %                                                                             %
10101 %                                                                             %
10102 %   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                     %
10103 %                                                                             %
10104 %                                                                             %
10105 %                                                                             %
10106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10107 %
10108 %  MagickSetImageColormapColor() sets the color of the specified colormap
10109 %  index.
10110 %
10111 %  The format of the MagickSetImageColormapColor method is:
10112 %
10113 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10114 %        const size_t index,const PixelWand *color)
10115 %
10116 %  A description of each parameter follows:
10117 %
10118 %    o wand: the magick wand.
10119 %
10120 %    o index: the offset into the image colormap.
10121 %
10122 %    o color: Return the colormap color in this wand.
10123 %
10124 */
MagickSetImageColormapColor(MagickWand * wand,const size_t index,const PixelWand * color)10125 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10126   const size_t index,const PixelWand *color)
10127 {
10128   assert(wand != (MagickWand *) NULL);
10129   assert(wand->signature == WandSignature);
10130   if (wand->debug != MagickFalse)
10131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10132   if (wand->images == (Image *) NULL)
10133     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10134   if ((wand->images->colormap == (PixelPacket *) NULL) ||
10135       (index >= wand->images->colors))
10136     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
10137   PixelGetQuantumColor(color,wand->images->colormap+index);
10138   return(SyncImage(wand->images));
10139 }
10140 
10141 /*
10142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10143 %                                                                             %
10144 %                                                                             %
10145 %                                                                             %
10146 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
10147 %                                                                             %
10148 %                                                                             %
10149 %                                                                             %
10150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10151 %
10152 %  MagickSetImageColorspace() sets the image colorspace.
10153 %
10154 %  The format of the MagickSetImageColorspace method is:
10155 %
10156 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10157 %        const ColorspaceType colorspace)
10158 %
10159 %  A description of each parameter follows:
10160 %
10161 %    o wand: the magick wand.
10162 %
10163 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
10164 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
10165 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
10166 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
10167 %      HSLColorspace, or HWBColorspace.
10168 %
10169 */
MagickSetImageColorspace(MagickWand * wand,const ColorspaceType colorspace)10170 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10171   const ColorspaceType colorspace)
10172 {
10173   assert(wand != (MagickWand *) NULL);
10174   assert(wand->signature == WandSignature);
10175   if (wand->debug != MagickFalse)
10176     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10177   if (wand->images == (Image *) NULL)
10178     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10179   return(SetImageColorspace(wand->images,colorspace));
10180 }
10181 
10182 /*
10183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10184 %                                                                             %
10185 %                                                                             %
10186 %                                                                             %
10187 %   M a g i c k S e t I m a g e C o m p o s e                                 %
10188 %                                                                             %
10189 %                                                                             %
10190 %                                                                             %
10191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10192 %
10193 %  MagickSetImageCompose() sets the image composite operator, useful for
10194 %  specifying how to composite the image thumbnail when using the
10195 %  MagickMontageImage() method.
10196 %
10197 %  The format of the MagickSetImageCompose method is:
10198 %
10199 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10200 %        const CompositeOperator compose)
10201 %
10202 %  A description of each parameter follows:
10203 %
10204 %    o wand: the magick wand.
10205 %
10206 %    o compose: the image composite operator.
10207 %
10208 */
MagickSetImageCompose(MagickWand * wand,const CompositeOperator compose)10209 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10210   const CompositeOperator compose)
10211 {
10212   assert(wand != (MagickWand *) NULL);
10213   assert(wand->signature == WandSignature);
10214   if (wand->debug != MagickFalse)
10215     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10216   if (wand->images == (Image *) NULL)
10217     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10218   wand->images->compose=compose;
10219   return(MagickTrue);
10220 }
10221 
10222 /*
10223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10224 %                                                                             %
10225 %                                                                             %
10226 %                                                                             %
10227 %   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                         %
10228 %                                                                             %
10229 %                                                                             %
10230 %                                                                             %
10231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10232 %
10233 %  MagickSetImageCompression() sets the image compression.
10234 %
10235 %  The format of the MagickSetImageCompression method is:
10236 %
10237 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10238 %        const CompressionType compression)
10239 %
10240 %  A description of each parameter follows:
10241 %
10242 %    o wand: the magick wand.
10243 %
10244 %    o compression: the image compression type.
10245 %
10246 */
MagickSetImageCompression(MagickWand * wand,const CompressionType compression)10247 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10248   const CompressionType compression)
10249 {
10250   assert(wand != (MagickWand *) NULL);
10251   assert(wand->signature == WandSignature);
10252   if (wand->debug != MagickFalse)
10253     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10254   if (wand->images == (Image *) NULL)
10255     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10256   wand->images->compression=compression;
10257   return(MagickTrue);
10258 }
10259 
10260 /*
10261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10262 %                                                                             %
10263 %                                                                             %
10264 %                                                                             %
10265 %   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           %
10266 %                                                                             %
10267 %                                                                             %
10268 %                                                                             %
10269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10270 %
10271 %  MagickSetImageCompressionQuality() sets the image compression quality.
10272 %
10273 %  The format of the MagickSetImageCompressionQuality method is:
10274 %
10275 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10276 %        const size_t quality)
10277 %
10278 %  A description of each parameter follows:
10279 %
10280 %    o wand: the magick wand.
10281 %
10282 %    o quality: the image compression tlityype.
10283 %
10284 */
MagickSetImageCompressionQuality(MagickWand * wand,const size_t quality)10285 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10286   const size_t quality)
10287 {
10288   assert(wand != (MagickWand *) NULL);
10289   assert(wand->signature == WandSignature);
10290   if (wand->debug != MagickFalse)
10291     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10292   if (wand->images == (Image *) NULL)
10293     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10294   wand->images->quality=quality;
10295   return(MagickTrue);
10296 }
10297 
10298 /*
10299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10300 %                                                                             %
10301 %                                                                             %
10302 %                                                                             %
10303 %   M a g i c k S e t I m a g e D e l a y                                     %
10304 %                                                                             %
10305 %                                                                             %
10306 %                                                                             %
10307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10308 %
10309 %  MagickSetImageDelay() sets the image delay.
10310 %
10311 %  The format of the MagickSetImageDelay method is:
10312 %
10313 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10314 %        const size_t delay)
10315 %
10316 %  A description of each parameter follows:
10317 %
10318 %    o wand: the magick wand.
10319 %
10320 %    o delay: the image delay in ticks-per-second units.
10321 %
10322 */
MagickSetImageDelay(MagickWand * wand,const size_t delay)10323 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10324   const size_t delay)
10325 {
10326   assert(wand != (MagickWand *) NULL);
10327   assert(wand->signature == WandSignature);
10328   if (wand->debug != MagickFalse)
10329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10330   if (wand->images == (Image *) NULL)
10331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10332   wand->images->delay=delay;
10333   return(MagickTrue);
10334 }
10335 
10336 /*
10337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10338 %                                                                             %
10339 %                                                                             %
10340 %                                                                             %
10341 %   M a g i c k S e t I m a g e D e p t h                                     %
10342 %                                                                             %
10343 %                                                                             %
10344 %                                                                             %
10345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10346 %
10347 %  MagickSetImageDepth() sets the image depth.
10348 %
10349 %  The format of the MagickSetImageDepth method is:
10350 %
10351 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10352 %        const size_t depth)
10353 %
10354 %  A description of each parameter follows:
10355 %
10356 %    o wand: the magick wand.
10357 %
10358 %    o depth: the image depth in bits: 8, 16, or 32.
10359 %
10360 */
MagickSetImageDepth(MagickWand * wand,const size_t depth)10361 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10362   const size_t depth)
10363 {
10364   assert(wand != (MagickWand *) NULL);
10365   assert(wand->signature == WandSignature);
10366   if (wand->debug != MagickFalse)
10367     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10368   if (wand->images == (Image *) NULL)
10369     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10370   wand->images->depth=depth;
10371   return(MagickTrue);
10372 }
10373 
10374 /*
10375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10376 %                                                                             %
10377 %                                                                             %
10378 %                                                                             %
10379 %   M a g i c k S e t I m a g e D i s p o s e                                 %
10380 %                                                                             %
10381 %                                                                             %
10382 %                                                                             %
10383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10384 %
10385 %  MagickSetImageDispose() sets the image disposal method.
10386 %
10387 %  The format of the MagickSetImageDispose method is:
10388 %
10389 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10390 %        const DisposeType dispose)
10391 %
10392 %  A description of each parameter follows:
10393 %
10394 %    o wand: the magick wand.
10395 %
10396 %    o dispose: the image disposeal type.
10397 %
10398 */
MagickSetImageDispose(MagickWand * wand,const DisposeType dispose)10399 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10400   const DisposeType dispose)
10401 {
10402   assert(wand != (MagickWand *) NULL);
10403   assert(wand->signature == WandSignature);
10404   if (wand->debug != MagickFalse)
10405     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10406   if (wand->images == (Image *) NULL)
10407     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10408   wand->images->dispose=dispose;
10409   return(MagickTrue);
10410 }
10411 
10412 /*
10413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10414 %                                                                             %
10415 %                                                                             %
10416 %                                                                             %
10417 %   M a g i c k S e t I m a g e E n d i a n                                   %
10418 %                                                                             %
10419 %                                                                             %
10420 %                                                                             %
10421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10422 %
10423 %  MagickSetImageEndian() sets the image endian method.
10424 %
10425 %  The format of the MagickSetImageEndian method is:
10426 %
10427 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10428 %        const EndianType endian)
10429 %
10430 %  A description of each parameter follows:
10431 %
10432 %    o wand: the magick wand.
10433 %
10434 %    o endian: the image endian type.
10435 %
10436 */
MagickSetImageEndian(MagickWand * wand,const EndianType endian)10437 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10438   const EndianType endian)
10439 {
10440   assert(wand != (MagickWand *) NULL);
10441   assert(wand->signature == WandSignature);
10442   if (wand->debug != MagickFalse)
10443     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10444   if (wand->images == (Image *) NULL)
10445     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10446   wand->images->endian=endian;
10447   return(MagickTrue);
10448 }
10449 
10450 /*
10451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10452 %                                                                             %
10453 %                                                                             %
10454 %                                                                             %
10455 %   M a g i c k S e t I m a g e E x t e n t                                   %
10456 %                                                                             %
10457 %                                                                             %
10458 %                                                                             %
10459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10460 %
10461 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
10462 %
10463 %  The format of the MagickSetImageExtent method is:
10464 %
10465 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10466 %        const size_t columns,const unsigned rows)
10467 %
10468 %  A description of each parameter follows:
10469 %
10470 %    o wand: the magick wand.
10471 %
10472 %    o columns:  The image width in pixels.
10473 %
10474 %    o rows:  The image height in pixels.
10475 %
10476 */
MagickSetImageExtent(MagickWand * wand,const size_t columns,const size_t rows)10477 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10478   const size_t columns,const size_t rows)
10479 {
10480   assert(wand != (MagickWand *) NULL);
10481   assert(wand->signature == WandSignature);
10482   if (wand->debug != MagickFalse)
10483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10484   if (wand->images == (Image *) NULL)
10485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10486   return(SetImageExtent(wand->images,columns,rows));
10487 }
10488 
10489 /*
10490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10491 %                                                                             %
10492 %                                                                             %
10493 %                                                                             %
10494 %   M a g i c k S e t I m a g e F i l e n a m e                               %
10495 %                                                                             %
10496 %                                                                             %
10497 %                                                                             %
10498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10499 %
10500 %  MagickSetImageFilename() sets the filename of a particular image in a
10501 %  sequence.
10502 %
10503 %  The format of the MagickSetImageFilename method is:
10504 %
10505 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10506 %        const char *filename)
10507 %
10508 %  A description of each parameter follows:
10509 %
10510 %    o wand: the magick wand.
10511 %
10512 %    o filename: the image filename.
10513 %
10514 */
MagickSetImageFilename(MagickWand * wand,const char * filename)10515 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10516   const char *filename)
10517 {
10518   assert(wand != (MagickWand *) NULL);
10519   assert(wand->signature == WandSignature);
10520   if (wand->debug != MagickFalse)
10521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10522   if (wand->images == (Image *) NULL)
10523     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10524   if (filename == (const char *) NULL)
10525     return(MagickFalse);
10526   (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
10527   return(MagickTrue);
10528 }
10529 
10530 /*
10531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10532 %                                                                             %
10533 %                                                                             %
10534 %                                                                             %
10535 %   M a g i c k S e t I m a g e F o r m a t                                   %
10536 %                                                                             %
10537 %                                                                             %
10538 %                                                                             %
10539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10540 %
10541 %  MagickSetImageFormat() sets the format of a particular image in a
10542 %  sequence.
10543 %
10544 %  The format of the MagickSetImageFormat method is:
10545 %
10546 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10547 %        const char *format)
10548 %
10549 %  A description of each parameter follows:
10550 %
10551 %    o wand: the magick wand.
10552 %
10553 %    o format: the image format.
10554 %
10555 */
MagickSetImageFormat(MagickWand * wand,const char * format)10556 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10557   const char *format)
10558 {
10559   const MagickInfo
10560     *magick_info;
10561 
10562   assert(wand != (MagickWand *) NULL);
10563   assert(wand->signature == WandSignature);
10564   if (wand->debug != MagickFalse)
10565     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10566   if (wand->images == (Image *) NULL)
10567     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10568   if ((format == (char *) NULL) || (*format == '\0'))
10569     {
10570       *wand->images->magick='\0';
10571       return(MagickTrue);
10572     }
10573   magick_info=GetMagickInfo(format,wand->exception);
10574   if (magick_info == (const MagickInfo *) NULL)
10575     return(MagickFalse);
10576   ClearMagickException(wand->exception);
10577   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
10578   LocaleUpper(wand->images->magick);
10579   return(MagickTrue);
10580 }
10581 
10582 /*
10583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10584 %                                                                             %
10585 %                                                                             %
10586 %                                                                             %
10587 %   M a g i c k S e t I m a g e F u z z                                       %
10588 %                                                                             %
10589 %                                                                             %
10590 %                                                                             %
10591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10592 %
10593 %  MagickSetImageFuzz() sets the image fuzz.
10594 %
10595 %  The format of the MagickSetImageFuzz method is:
10596 %
10597 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10598 %        const double fuzz)
10599 %
10600 %  A description of each parameter follows:
10601 %
10602 %    o wand: the magick wand.
10603 %
10604 %    o fuzz: the image fuzz.
10605 %
10606 */
MagickSetImageFuzz(MagickWand * wand,const double fuzz)10607 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10608   const double fuzz)
10609 {
10610   assert(wand != (MagickWand *) NULL);
10611   assert(wand->signature == WandSignature);
10612   if (wand->debug != MagickFalse)
10613     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10614   if (wand->images == (Image *) NULL)
10615     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10616   wand->images->fuzz=fuzz;
10617   return(MagickTrue);
10618 }
10619 
10620 /*
10621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10622 %                                                                             %
10623 %                                                                             %
10624 %                                                                             %
10625 %   M a g i c k S e t I m a g e G a m m a                                     %
10626 %                                                                             %
10627 %                                                                             %
10628 %                                                                             %
10629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10630 %
10631 %  MagickSetImageGamma() sets the image gamma.
10632 %
10633 %  The format of the MagickSetImageGamma method is:
10634 %
10635 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10636 %        const double gamma)
10637 %
10638 %  A description of each parameter follows:
10639 %
10640 %    o wand: the magick wand.
10641 %
10642 %    o gamma: the image gamma.
10643 %
10644 */
MagickSetImageGamma(MagickWand * wand,const double gamma)10645 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10646   const double gamma)
10647 {
10648   assert(wand != (MagickWand *) NULL);
10649   assert(wand->signature == WandSignature);
10650   if (wand->debug != MagickFalse)
10651     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10652   if (wand->images == (Image *) NULL)
10653     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10654   wand->images->gamma=gamma;
10655   return(MagickTrue);
10656 }
10657 
10658 /*
10659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10660 %                                                                             %
10661 %                                                                             %
10662 %                                                                             %
10663 %   M a g i c k S e t I m a g e G r a v i t y                                 %
10664 %                                                                             %
10665 %                                                                             %
10666 %                                                                             %
10667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10668 %
10669 %  MagickSetImageGravity() sets the image gravity type.
10670 %
10671 %  The format of the MagickSetImageGravity method is:
10672 %
10673 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10674 %        const GravityType gravity)
10675 %
10676 %  A description of each parameter follows:
10677 %
10678 %    o wand: the magick wand.
10679 %
10680 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10681 %      PlaneInterlace, PartitionInterlace.
10682 %
10683 */
MagickSetImageGravity(MagickWand * wand,const GravityType gravity)10684 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10685   const GravityType gravity)
10686 {
10687   assert(wand != (MagickWand *) NULL);
10688   assert(wand->signature == WandSignature);
10689   if (wand->debug != MagickFalse)
10690     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10691   if (wand->images == (Image *) NULL)
10692     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10693   wand->images->gravity=gravity;
10694   return(MagickTrue);
10695 }
10696 
10697 /*
10698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10699 %                                                                             %
10700 %                                                                             %
10701 %                                                                             %
10702 %   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                       %
10703 %                                                                             %
10704 %                                                                             %
10705 %                                                                             %
10706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10707 %
10708 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
10709 %  point.
10710 %
10711 %  The format of the MagickSetImageGreenPrimary method is:
10712 %
10713 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10714 %        const double x,const double y)
10715 %
10716 %  A description of each parameter follows:
10717 %
10718 %    o wand: the magick wand.
10719 %
10720 %    o x: the green primary x-point.
10721 %
10722 %    o y: the green primary y-point.
10723 %
10724 %
10725 */
MagickSetImageGreenPrimary(MagickWand * wand,const double x,const double y)10726 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10727   const double x,const double y)
10728 {
10729   assert(wand != (MagickWand *) NULL);
10730   assert(wand->signature == WandSignature);
10731   if (wand->debug != MagickFalse)
10732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10733   if (wand->images == (Image *) NULL)
10734     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10735   wand->images->chromaticity.green_primary.x=x;
10736   wand->images->chromaticity.green_primary.y=y;
10737   return(MagickTrue);
10738 }
10739 
10740 /*
10741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10742 %                                                                             %
10743 %                                                                             %
10744 %                                                                             %
10745 %   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                 %
10746 %                                                                             %
10747 %                                                                             %
10748 %                                                                             %
10749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10750 %
10751 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10752 %
10753 %  The format of the MagickSetImageInterlaceScheme method is:
10754 %
10755 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10756 %        const InterlaceType interlace)
10757 %
10758 %  A description of each parameter follows:
10759 %
10760 %    o wand: the magick wand.
10761 %
10762 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10763 %      PlaneInterlace, PartitionInterlace.
10764 %
10765 */
MagickSetImageInterlaceScheme(MagickWand * wand,const InterlaceType interlace)10766 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10767   const InterlaceType interlace)
10768 {
10769   assert(wand != (MagickWand *) NULL);
10770   assert(wand->signature == WandSignature);
10771   if (wand->debug != MagickFalse)
10772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10773   if (wand->images == (Image *) NULL)
10774     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10775   wand->images->interlace=interlace;
10776   return(MagickTrue);
10777 }
10778 
10779 /*
10780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10781 %                                                                             %
10782 %                                                                             %
10783 %                                                                             %
10784 %   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             %
10785 %                                                                             %
10786 %                                                                             %
10787 %                                                                             %
10788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10789 %
10790 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10791 %
10792 %  The format of the MagickSetImageInterpolateMethod method is:
10793 %
10794 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10795 %        const InterpolatePixelMethod method)
10796 %
10797 %  A description of each parameter follows:
10798 %
10799 %    o wand: the magick wand.
10800 %
10801 %    o method: the image interpole pixel methods: choose from Undefined,
10802 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10803 %
10804 */
MagickSetImageInterpolateMethod(MagickWand * wand,const InterpolatePixelMethod method)10805 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10806   const InterpolatePixelMethod method)
10807 {
10808   assert(wand != (MagickWand *) NULL);
10809   assert(wand->signature == WandSignature);
10810   if (wand->debug != MagickFalse)
10811     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10812   if (wand->images == (Image *) NULL)
10813     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10814   wand->images->interpolate=method;
10815   return(MagickTrue);
10816 }
10817 
10818 /*
10819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10820 %                                                                             %
10821 %                                                                             %
10822 %                                                                             %
10823 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10824 %                                                                             %
10825 %                                                                             %
10826 %                                                                             %
10827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10828 %
10829 %  MagickSetImageIterations() sets the image iterations.
10830 %
10831 %  The format of the MagickSetImageIterations method is:
10832 %
10833 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10834 %        const size_t iterations)
10835 %
10836 %  A description of each parameter follows:
10837 %
10838 %    o wand: the magick wand.
10839 %
10840 %    o delay: the image delay in 1/100th of a second.
10841 %
10842 */
MagickSetImageIterations(MagickWand * wand,const size_t iterations)10843 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10844   const size_t iterations)
10845 {
10846   assert(wand != (MagickWand *) NULL);
10847   assert(wand->signature == WandSignature);
10848   if (wand->debug != MagickFalse)
10849     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10850   if (wand->images == (Image *) NULL)
10851     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10852   wand->images->iterations=iterations;
10853   return(MagickTrue);
10854 }
10855 
10856 /*
10857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10858 %                                                                             %
10859 %                                                                             %
10860 %                                                                             %
10861 %   M a g i c k S e t I m a g e M a t t e                                     %
10862 %                                                                             %
10863 %                                                                             %
10864 %                                                                             %
10865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10866 %
10867 %  MagickSetImageMatte() sets the image matte channel.
10868 %
10869 %  The format of the MagickSetImageMatteColor method is:
10870 %
10871 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10872 %        const MagickBooleanType *matte)
10873 %
10874 %  A description of each parameter follows:
10875 %
10876 %    o wand: the magick wand.
10877 %
10878 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10879 %      MagickFalse.
10880 %
10881 */
MagickSetImageMatte(MagickWand * wand,const MagickBooleanType matte)10882 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10883   const MagickBooleanType matte)
10884 {
10885   assert(wand != (MagickWand *) NULL);
10886   assert(wand->signature == WandSignature);
10887   if (wand->debug != MagickFalse)
10888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10889   if (wand->images == (Image *) NULL)
10890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10891   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10892     (void) SetImageOpacity(wand->images,OpaqueOpacity);
10893   wand->images->matte=matte;
10894   return(MagickTrue);
10895 }
10896 
10897 /*
10898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10899 %                                                                             %
10900 %                                                                             %
10901 %                                                                             %
10902 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10903 %                                                                             %
10904 %                                                                             %
10905 %                                                                             %
10906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10907 %
10908 %  MagickSetImageMatteColor() sets the image matte color.
10909 %
10910 %  The format of the MagickSetImageMatteColor method is:
10911 %
10912 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10913 %        const PixelWand *matte)
10914 %
10915 %  A description of each parameter follows:
10916 %
10917 %    o wand: the magick wand.
10918 %
10919 %    o matte: the matte pixel wand.
10920 %
10921 */
MagickSetImageMatteColor(MagickWand * wand,const PixelWand * matte)10922 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10923   const PixelWand *matte)
10924 {
10925   assert(wand != (MagickWand *) NULL);
10926   assert(wand->signature == WandSignature);
10927   if (wand->debug != MagickFalse)
10928     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10929   if (wand->images == (Image *) NULL)
10930     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10931   PixelGetQuantumColor(matte,&wand->images->matte_color);
10932   return(MagickTrue);
10933 }
10934 
10935 /*
10936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10937 %                                                                             %
10938 %                                                                             %
10939 %                                                                             %
10940 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10941 %                                                                             %
10942 %                                                                             %
10943 %                                                                             %
10944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10945 %
10946 %  MagickSetImageOpacity() sets the image to the specified opacity level.
10947 %
10948 %  The format of the MagickSetImageOpacity method is:
10949 %
10950 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10951 %        const double alpha)
10952 %
10953 %  A description of each parameter follows:
10954 %
10955 %    o wand: the magick wand.
10956 %
10957 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10958 %      transparent.
10959 %
10960 */
MagickSetImageOpacity(MagickWand * wand,const double alpha)10961 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10962   const double alpha)
10963 {
10964   MagickBooleanType
10965     status;
10966 
10967   assert(wand != (MagickWand *) NULL);
10968   assert(wand->signature == WandSignature);
10969   if (wand->debug != MagickFalse)
10970     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10971   if (wand->images == (Image *) NULL)
10972     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10973   status=SetImageOpacity(wand->images,ClampToQuantum((MagickRealType)
10974     QuantumRange-QuantumRange*alpha));
10975   if (status == MagickFalse)
10976     InheritException(wand->exception,&wand->images->exception);
10977   return(status);
10978 }
10979 
10980 /*
10981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10982 %                                                                             %
10983 %                                                                             %
10984 %                                                                             %
10985 %   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                         %
10986 %                                                                             %
10987 %                                                                             %
10988 %                                                                             %
10989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10990 %
10991 %  MagickSetImageOrientation() sets the image orientation.
10992 %
10993 %  The format of the MagickSetImageOrientation method is:
10994 %
10995 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10996 %        const OrientationType orientation)
10997 %
10998 %  A description of each parameter follows:
10999 %
11000 %    o wand: the magick wand.
11001 %
11002 %    o orientation: the image orientation type.
11003 %
11004 */
MagickSetImageOrientation(MagickWand * wand,const OrientationType orientation)11005 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
11006   const OrientationType orientation)
11007 {
11008   assert(wand != (MagickWand *) NULL);
11009   assert(wand->signature == WandSignature);
11010   if (wand->debug != MagickFalse)
11011     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11012   if (wand->images == (Image *) NULL)
11013     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11014   wand->images->orientation=orientation;
11015   return(MagickTrue);
11016 }
11017 
11018 /*
11019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11020 %                                                                             %
11021 %                                                                             %
11022 %                                                                             %
11023 %   M a g i c k S e t I m a g e P a g e                                       %
11024 %                                                                             %
11025 %                                                                             %
11026 %                                                                             %
11027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11028 %
11029 %  MagickSetImagePage() sets the page geometry of the image.
11030 %
11031 %  The format of the MagickSetImagePage method is:
11032 %
11033 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
11034 %        const size_t width,const size_t height,const ssize_t x,
11035 %        const ssize_t y)
11036 %
11037 %  A description of each parameter follows:
11038 %
11039 %    o wand: the magick wand.
11040 %
11041 %    o width: the page width.
11042 %
11043 %    o height: the page height.
11044 %
11045 %    o x: the page x-offset.
11046 %
11047 %    o y: the page y-offset.
11048 %
11049 */
MagickSetImagePage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)11050 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
11051   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
11052 {
11053   assert(wand != (MagickWand *) NULL);
11054   assert(wand->signature == WandSignature);
11055   if (wand->debug != MagickFalse)
11056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11057   if (wand->images == (Image *) NULL)
11058     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11059   wand->images->page.width=width;
11060   wand->images->page.height=height;
11061   wand->images->page.x=x;
11062   wand->images->page.y=y;
11063   return(MagickTrue);
11064 }
11065 
11066 /*
11067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11068 %                                                                             %
11069 %                                                                             %
11070 %                                                                             %
11071 %   M a g i c k S e t I m a g e P i x e l C o l o r                           %
11072 %                                                                             %
11073 %                                                                             %
11074 %                                                                             %
11075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11076 %
11077 %  MagickSetImagePixelColor() sets the color of the specified pixel.
11078 %
11079 %  The format of the MagickSetImagePixelColor method is:
11080 %
11081 %      MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11082 %        const ssize_t x,const ssize_t y,const PixelWand *color)
11083 %
11084 %  A description of each parameter follows:
11085 %
11086 %    o wand: the magick wand.
11087 %
11088 %    o x,y: the pixel offset into the image.
11089 %
11090 %    o color: Return the colormap color in this wand.
11091 %
11092 */
MagickSetImagePixelColor(MagickWand * wand,const ssize_t x,const ssize_t y,const PixelWand * color)11093 WandExport MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11094   const ssize_t x,const ssize_t y,const PixelWand *color)
11095 {
11096   IndexPacket
11097     *indexes;
11098 
11099   PixelPacket
11100     *q;
11101 
11102   CacheView
11103     *image_view;
11104 
11105   assert(wand != (MagickWand *) NULL);
11106   assert(wand->signature == WandSignature);
11107   if (wand->debug != MagickFalse)
11108     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11109   if (wand->images == (Image *) NULL)
11110     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11111   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
11112   q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,wand->exception);
11113   if (q == (PixelPacket *) NULL)
11114     {
11115       image_view=DestroyCacheView(image_view);
11116       return(MagickFalse);
11117     }
11118   indexes=GetCacheViewAuthenticIndexQueue(image_view);
11119   PixelGetQuantumColor(color,q);
11120   if (GetCacheViewColorspace(image_view) == CMYKColorspace)
11121     *indexes=PixelGetBlackQuantum(color);
11122   else
11123     if (GetCacheViewStorageClass(image_view) == PseudoClass)
11124       *indexes=PixelGetIndex(color);
11125   image_view=DestroyCacheView(image_view);
11126   return(MagickTrue);
11127 }
11128 
11129 /*
11130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11131 %                                                                             %
11132 %                                                                             %
11133 %                                                                             %
11134 %   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                 %
11135 %                                                                             %
11136 %                                                                             %
11137 %                                                                             %
11138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11139 %
11140 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
11141 %  specified method and returns the previous progress monitor if any.  The
11142 %  progress monitor method looks like this:
11143 %
11144 %    MagickBooleanType MagickProgressMonitor(const char *text,
11145 %      const MagickOffsetType offset,const MagickSizeType span,
11146 %      void *client_data)
11147 %
11148 %  If the progress monitor returns MagickFalse, the current operation is
11149 %  interrupted.
11150 %
11151 %  The format of the MagickSetImageProgressMonitor method is:
11152 %
11153 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
11154 %        const MagickProgressMonitor progress_monitor,void *client_data)
11155 %
11156 %  A description of each parameter follows:
11157 %
11158 %    o wand: the magick wand.
11159 %
11160 %    o progress_monitor: Specifies a pointer to a method to monitor progress
11161 %      of an image operation.
11162 %
11163 %    o client_data: Specifies a pointer to any client data.
11164 %
11165 */
MagickSetImageProgressMonitor(MagickWand * wand,const MagickProgressMonitor progress_monitor,void * client_data)11166 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
11167   const MagickProgressMonitor progress_monitor,void *client_data)
11168 {
11169   MagickProgressMonitor
11170     previous_monitor;
11171 
11172   assert(wand != (MagickWand *) NULL);
11173   assert(wand->signature == WandSignature);
11174   if (wand->debug != MagickFalse)
11175     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11176   if (wand->images == (Image *) NULL)
11177     {
11178       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11179         "ContainsNoImages","`%s'",wand->name);
11180       return((MagickProgressMonitor) NULL);
11181     }
11182   previous_monitor=SetImageProgressMonitor(wand->images,progress_monitor,
11183     client_data);
11184   return(previous_monitor);
11185 }
11186 
11187 /*
11188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11189 %                                                                             %
11190 %                                                                             %
11191 %                                                                             %
11192 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
11193 %                                                                             %
11194 %                                                                             %
11195 %                                                                             %
11196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11197 %
11198 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
11199 %
11200 %  The format of the MagickSetImageRedPrimary method is:
11201 %
11202 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11203 %        const double x,const double y)
11204 %
11205 %  A description of each parameter follows:
11206 %
11207 %    o wand: the magick wand.
11208 %
11209 %    o x: the red primary x-point.
11210 %
11211 %    o y: the red primary y-point.
11212 %
11213 */
MagickSetImageRedPrimary(MagickWand * wand,const double x,const double y)11214 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11215   const double x,const double y)
11216 {
11217   assert(wand != (MagickWand *) NULL);
11218   assert(wand->signature == WandSignature);
11219   if (wand->debug != MagickFalse)
11220     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11221   if (wand->images == (Image *) NULL)
11222     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11223   wand->images->chromaticity.red_primary.x=x;
11224   wand->images->chromaticity.red_primary.y=y;
11225   return(MagickTrue);
11226 }
11227 
11228 /*
11229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11230 %                                                                             %
11231 %                                                                             %
11232 %                                                                             %
11233 %   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                 %
11234 %                                                                             %
11235 %                                                                             %
11236 %                                                                             %
11237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11238 %
11239 %  MagickSetImageRenderingIntent() sets the image rendering intent.
11240 %
11241 %  The format of the MagickSetImageRenderingIntent method is:
11242 %
11243 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11244 %        const RenderingIntent rendering_intent)
11245 %
11246 %  A description of each parameter follows:
11247 %
11248 %    o wand: the magick wand.
11249 %
11250 %    o rendering_intent: the image rendering intent: UndefinedIntent,
11251 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
11252 %
11253 */
MagickSetImageRenderingIntent(MagickWand * wand,const RenderingIntent rendering_intent)11254 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11255   const RenderingIntent rendering_intent)
11256 {
11257   assert(wand != (MagickWand *) NULL);
11258   assert(wand->signature == WandSignature);
11259   if (wand->debug != MagickFalse)
11260     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11261   if (wand->images == (Image *) NULL)
11262     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11263   wand->images->rendering_intent=rendering_intent;
11264   return(MagickTrue);
11265 }
11266 
11267 /*
11268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11269 %                                                                             %
11270 %                                                                             %
11271 %                                                                             %
11272 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
11273 %                                                                             %
11274 %                                                                             %
11275 %                                                                             %
11276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11277 %
11278 %  MagickSetImageResolution() sets the image resolution.
11279 %
11280 %  The format of the MagickSetImageResolution method is:
11281 %
11282 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11283 %        const double x_resolution,const double y_resolution)
11284 %
11285 %  A description of each parameter follows:
11286 %
11287 %    o wand: the magick wand.
11288 %
11289 %    o x_resolution: the image x resolution.
11290 %
11291 %    o y_resolution: the image y resolution.
11292 %
11293 */
MagickSetImageResolution(MagickWand * wand,const double x_resolution,const double y_resolution)11294 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11295   const double x_resolution,const double y_resolution)
11296 {
11297   assert(wand != (MagickWand *) NULL);
11298   assert(wand->signature == WandSignature);
11299   if (wand->debug != MagickFalse)
11300     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11301   if (wand->images == (Image *) NULL)
11302     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11303   wand->images->x_resolution=x_resolution;
11304   wand->images->y_resolution=y_resolution;
11305   return(MagickTrue);
11306 }
11307 
11308 /*
11309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11310 %                                                                             %
11311 %                                                                             %
11312 %                                                                             %
11313 %   M a g i c k S e t I m a g e S c e n e                                     %
11314 %                                                                             %
11315 %                                                                             %
11316 %                                                                             %
11317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11318 %
11319 %  MagickSetImageScene() sets the image scene.
11320 %
11321 %  The format of the MagickSetImageScene method is:
11322 %
11323 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
11324 %        const size_t scene)
11325 %
11326 %  A description of each parameter follows:
11327 %
11328 %    o wand: the magick wand.
11329 %
11330 %    o delay: the image scene number.
11331 %
11332 */
MagickSetImageScene(MagickWand * wand,const size_t scene)11333 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
11334   const size_t scene)
11335 {
11336   assert(wand != (MagickWand *) NULL);
11337   assert(wand->signature == WandSignature);
11338   if (wand->debug != MagickFalse)
11339     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11340   if (wand->images == (Image *) NULL)
11341     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11342   wand->images->scene=scene;
11343   return(MagickTrue);
11344 }
11345 
11346 /*
11347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11348 %                                                                             %
11349 %                                                                             %
11350 %                                                                             %
11351 %   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                   %
11352 %                                                                             %
11353 %                                                                             %
11354 %                                                                             %
11355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11356 %
11357 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
11358 %
11359 %  The format of the MagickSetImageTicksPerSecond method is:
11360 %
11361 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11362 %        const ssize_t ticks_per-second)
11363 %
11364 %  A description of each parameter follows:
11365 %
11366 %    o wand: the magick wand.
11367 %
11368 %    o ticks_per_second: the units to use for the image delay.
11369 %
11370 */
MagickSetImageTicksPerSecond(MagickWand * wand,const ssize_t ticks_per_second)11371 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11372   const ssize_t ticks_per_second)
11373 {
11374   assert(wand != (MagickWand *) NULL);
11375   assert(wand->signature == WandSignature);
11376   if (wand->debug != MagickFalse)
11377     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11378   if (wand->images == (Image *) NULL)
11379     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11380   wand->images->ticks_per_second=ticks_per_second;
11381   return(MagickTrue);
11382 }
11383 
11384 /*
11385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11386 %                                                                             %
11387 %                                                                             %
11388 %                                                                             %
11389 %   M a g i c k S e t I m a g e T y p e                                       %
11390 %                                                                             %
11391 %                                                                             %
11392 %                                                                             %
11393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11394 %
11395 %  MagickSetImageType() sets the image type.
11396 %
11397 %  The format of the MagickSetImageType method is:
11398 %
11399 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
11400 %        const ImageType image_type)
11401 %
11402 %  A description of each parameter follows:
11403 %
11404 %    o wand: the magick wand.
11405 %
11406 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
11407 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
11408 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
11409 %      or OptimizeType.
11410 %
11411 */
MagickSetImageType(MagickWand * wand,const ImageType image_type)11412 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
11413   const ImageType image_type)
11414 {
11415   assert(wand != (MagickWand *) NULL);
11416   assert(wand->signature == WandSignature);
11417   if (wand->debug != MagickFalse)
11418     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11419   if (wand->images == (Image *) NULL)
11420     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11421   return(SetImageType(wand->images,image_type));
11422 }
11423 
11424 /*
11425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11426 %                                                                             %
11427 %                                                                             %
11428 %                                                                             %
11429 %   M a g i c k S e t I m a g e U n i t s                                     %
11430 %                                                                             %
11431 %                                                                             %
11432 %                                                                             %
11433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11434 %
11435 %  MagickSetImageUnits() sets the image units of resolution.
11436 %
11437 %  The format of the MagickSetImageUnits method is:
11438 %
11439 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11440 %        const ResolutionType units)
11441 %
11442 %  A description of each parameter follows:
11443 %
11444 %    o wand: the magick wand.
11445 %
11446 %    o units: the image units of resolution : UndefinedResolution,
11447 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
11448 %
11449 */
MagickSetImageUnits(MagickWand * wand,const ResolutionType units)11450 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11451   const ResolutionType units)
11452 {
11453   assert(wand != (MagickWand *) NULL);
11454   assert(wand->signature == WandSignature);
11455   if (wand->debug != MagickFalse)
11456     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11457   if (wand->images == (Image *) NULL)
11458     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11459   wand->images->units=units;
11460   return(MagickTrue);
11461 }
11462 
11463 /*
11464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11465 %                                                                             %
11466 %                                                                             %
11467 %                                                                             %
11468 %   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           %
11469 %                                                                             %
11470 %                                                                             %
11471 %                                                                             %
11472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11473 %
11474 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
11475 %
11476 %  The format of the MagickSetImageVirtualPixelMethod method is:
11477 %
11478 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11479 %        const VirtualPixelMethod method)
11480 %
11481 %  A description of each parameter follows:
11482 %
11483 %    o wand: the magick wand.
11484 %
11485 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
11486 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
11487 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
11488 %
11489 */
MagickSetImageVirtualPixelMethod(MagickWand * wand,const VirtualPixelMethod method)11490 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11491   const VirtualPixelMethod method)
11492 {
11493   assert(wand != (MagickWand *) NULL);
11494   assert(wand->signature == WandSignature);
11495   if (wand->debug != MagickFalse)
11496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11497   if (wand->images == (Image *) NULL)
11498     return(UndefinedVirtualPixelMethod);
11499   return(SetImageVirtualPixelMethod(wand->images,method));
11500 }
11501 
11502 /*
11503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11504 %                                                                             %
11505 %                                                                             %
11506 %                                                                             %
11507 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
11508 %                                                                             %
11509 %                                                                             %
11510 %                                                                             %
11511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11512 %
11513 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
11514 %
11515 %  The format of the MagickSetImageWhitePoint method is:
11516 %
11517 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11518 %        const double x,const double y)
11519 %
11520 %  A description of each parameter follows:
11521 %
11522 %    o wand: the magick wand.
11523 %
11524 %    o x: the white x-point.
11525 %
11526 %    o y: the white y-point.
11527 %
11528 */
MagickSetImageWhitePoint(MagickWand * wand,const double x,const double y)11529 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11530   const double x,const double y)
11531 {
11532   assert(wand != (MagickWand *) NULL);
11533   assert(wand->signature == WandSignature);
11534   if (wand->debug != MagickFalse)
11535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11536   if (wand->images == (Image *) NULL)
11537     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11538   wand->images->chromaticity.white_point.x=x;
11539   wand->images->chromaticity.white_point.y=y;
11540   return(MagickTrue);
11541 }
11542 
11543 /*
11544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11545 %                                                                             %
11546 %                                                                             %
11547 %                                                                             %
11548 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
11549 %                                                                             %
11550 %                                                                             %
11551 %                                                                             %
11552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11553 %
11554 %  MagickShadeImage() shines a distant light on an image to create a
11555 %  three-dimensional effect. You control the positioning of the light with
11556 %  azimuth and elevation; azimuth is measured in degrees off the x axis
11557 %  and elevation is measured in pixels above the Z axis.
11558 %
11559 %  The format of the MagickShadeImage method is:
11560 %
11561 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
11562 %        const MagickBooleanType gray,const double azimuth,
11563 %        const double elevation)
11564 %
11565 %  A description of each parameter follows:
11566 %
11567 %    o wand: the magick wand.
11568 %
11569 %    o gray: A value other than zero shades the intensity of each pixel.
11570 %
11571 %    o azimuth, elevation:  Define the light source direction.
11572 %
11573 */
MagickShadeImage(MagickWand * wand,const MagickBooleanType gray,const double asimuth,const double elevation)11574 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11575   const MagickBooleanType gray,const double asimuth,const double elevation)
11576 {
11577   Image
11578     *shade_image;
11579 
11580   assert(wand != (MagickWand *) NULL);
11581   assert(wand->signature == WandSignature);
11582   if (wand->debug != MagickFalse)
11583     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11584   if (wand->images == (Image *) NULL)
11585     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11586   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
11587   if (shade_image == (Image *) NULL)
11588     return(MagickFalse);
11589   ReplaceImageInList(&wand->images,shade_image);
11590   return(MagickTrue);
11591 }
11592 
11593 /*
11594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11595 %                                                                             %
11596 %                                                                             %
11597 %                                                                             %
11598 %   M a g i c k S h a d o w I m a g e                                         %
11599 %                                                                             %
11600 %                                                                             %
11601 %                                                                             %
11602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11603 %
11604 %  MagickShadowImage() simulates an image shadow.
11605 %
11606 %  The format of the MagickShadowImage method is:
11607 %
11608 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
11609 %        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11610 %
11611 %  A description of each parameter follows:
11612 %
11613 %    o wand: the magick wand.
11614 %
11615 %    o opacity: percentage transparency.
11616 %
11617 %    o sigma: the standard deviation of the Gaussian, in pixels.
11618 %
11619 %    o x: the shadow x-offset.
11620 %
11621 %    o y: the shadow y-offset.
11622 %
11623 */
MagickShadowImage(MagickWand * wand,const double opacity,const double sigma,const ssize_t x,const ssize_t y)11624 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11625   const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11626 {
11627   Image
11628     *shadow_image;
11629 
11630   assert(wand != (MagickWand *) NULL);
11631   assert(wand->signature == WandSignature);
11632   if (wand->debug != MagickFalse)
11633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11634   if (wand->images == (Image *) NULL)
11635     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11636   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
11637   if (shadow_image == (Image *) NULL)
11638     return(MagickFalse);
11639   ReplaceImageInList(&wand->images,shadow_image);
11640   return(MagickTrue);
11641 }
11642 
11643 /*
11644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11645 %                                                                             %
11646 %                                                                             %
11647 %                                                                             %
11648 %   M a g i c k S h a r p e n I m a g e                                       %
11649 %                                                                             %
11650 %                                                                             %
11651 %                                                                             %
11652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11653 %
11654 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
11655 %  Gaussian operator of the given radius and standard deviation (sigma).
11656 %  For reasonable results, the radius should be larger than sigma.  Use a
11657 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11658 %
11659 %  The format of the MagickSharpenImage method is:
11660 %
11661 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
11662 %        const double radius,const double sigma)
11663 %      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11664 %        const ChannelType channel,const double radius,const double sigma)
11665 %
11666 %  A description of each parameter follows:
11667 %
11668 %    o wand: the magick wand.
11669 %
11670 %    o channel: the image channel(s).
11671 %
11672 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11673 %      pixel.
11674 %
11675 %    o sigma: the standard deviation of the Gaussian, in pixels.
11676 %
11677 */
11678 
MagickSharpenImage(MagickWand * wand,const double radius,const double sigma)11679 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11680   const double radius,const double sigma)
11681 {
11682   MagickBooleanType
11683     status;
11684 
11685   status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11686   return(status);
11687 }
11688 
MagickSharpenImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma)11689 WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11690   const ChannelType channel,const double radius,const double sigma)
11691 {
11692   Image
11693     *sharp_image;
11694 
11695   assert(wand != (MagickWand *) NULL);
11696   assert(wand->signature == WandSignature);
11697   if (wand->debug != MagickFalse)
11698     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11699   if (wand->images == (Image *) NULL)
11700     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11701   sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11702     wand->exception);
11703   if (sharp_image == (Image *) NULL)
11704     return(MagickFalse);
11705   ReplaceImageInList(&wand->images,sharp_image);
11706   return(MagickTrue);
11707 }
11708 
11709 /*
11710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11711 %                                                                             %
11712 %                                                                             %
11713 %                                                                             %
11714 %   M a g i c k S h a v e I m a g e                                           %
11715 %                                                                             %
11716 %                                                                             %
11717 %                                                                             %
11718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11719 %
11720 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
11721 %  memory necessary for the new Image structure and returns a pointer to the
11722 %  new image.
11723 %
11724 %  The format of the MagickShaveImage method is:
11725 %
11726 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
11727 %        const size_t columns,const size_t rows)
11728 %
11729 %  A description of each parameter follows:
11730 %
11731 %    o wand: the magick wand.
11732 %
11733 %    o columns: the number of columns in the scaled image.
11734 %
11735 %    o rows: the number of rows in the scaled image.
11736 %
11737 %
11738 */
MagickShaveImage(MagickWand * wand,const size_t columns,const size_t rows)11739 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11740   const size_t columns,const size_t rows)
11741 {
11742   Image
11743     *shave_image;
11744 
11745   RectangleInfo
11746     shave_info;
11747 
11748   assert(wand != (MagickWand *) NULL);
11749   assert(wand->signature == WandSignature);
11750   if (wand->debug != MagickFalse)
11751     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11752   if (wand->images == (Image *) NULL)
11753     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11754   shave_info.width=columns;
11755   shave_info.height=rows;
11756   shave_info.x=0;
11757   shave_info.y=0;
11758   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11759   if (shave_image == (Image *) NULL)
11760     return(MagickFalse);
11761   ReplaceImageInList(&wand->images,shave_image);
11762   return(MagickTrue);
11763 }
11764 
11765 /*
11766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11767 %                                                                             %
11768 %                                                                             %
11769 %                                                                             %
11770 %   M a g i c k S h e a r I m a g e                                           %
11771 %                                                                             %
11772 %                                                                             %
11773 %                                                                             %
11774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11775 %
11776 %  MagickShearImage() slides one edge of an image along the X or Y axis,
11777 %  creating a parallelogram.  An X direction shear slides an edge along the X
11778 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
11779 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
11780 %  is measured relative to the Y axis, and similarly, for Y direction shears
11781 %  y_shear is measured relative to the X axis.  Empty triangles left over from
11782 %  shearing the image are filled with the background color.
11783 %
11784 %  The format of the MagickShearImage method is:
11785 %
11786 %      MagickBooleanType MagickShearImage(MagickWand *wand,
11787 %        const PixelWand *background,const double x_shear,const double y_shear)
11788 %
11789 %  A description of each parameter follows:
11790 %
11791 %    o wand: the magick wand.
11792 %
11793 %    o background: the background pixel wand.
11794 %
11795 %    o x_shear: the number of degrees to shear the image.
11796 %
11797 %    o y_shear: the number of degrees to shear the image.
11798 %
11799 */
MagickShearImage(MagickWand * wand,const PixelWand * background,const double x_shear,const double y_shear)11800 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11801   const PixelWand *background,const double x_shear,const double y_shear)
11802 {
11803   Image
11804     *shear_image;
11805 
11806   assert(wand != (MagickWand *) NULL);
11807   assert(wand->signature == WandSignature);
11808   if (wand->debug != MagickFalse)
11809     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11810   if (wand->images == (Image *) NULL)
11811     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11812   PixelGetQuantumColor(background,&wand->images->background_color);
11813   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11814   if (shear_image == (Image *) NULL)
11815     return(MagickFalse);
11816   ReplaceImageInList(&wand->images,shear_image);
11817   return(MagickTrue);
11818 }
11819 
11820 /*
11821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11822 %                                                                             %
11823 %                                                                             %
11824 %                                                                             %
11825 %   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                   %
11826 %                                                                             %
11827 %                                                                             %
11828 %                                                                             %
11829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11830 %
11831 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11832 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11833 %  image using a sigmoidal transfer function without saturating highlights or
11834 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11835 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11836 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11837 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11838 %  is reduced.
11839 %
11840 %  The format of the MagickSigmoidalContrastImage method is:
11841 %
11842 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11843 %        const MagickBooleanType sharpen,const double alpha,const double beta)
11844 %      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11845 %        const ChannelType channel,const MagickBooleanType sharpen,
11846 %        const double alpha,const double beta)
11847 %
11848 %  A description of each parameter follows:
11849 %
11850 %    o wand: the magick wand.
11851 %
11852 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
11853 %
11854 %    o sharpen: Increase or decrease image contrast.
11855 %
11856 %    o alpha: strength of the contrast, the larger the number the more
11857 %      'threshold-like' it becomes.
11858 %
11859 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
11860 %
11861 */
11862 
MagickSigmoidalContrastImage(MagickWand * wand,const MagickBooleanType sharpen,const double alpha,const double beta)11863 WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11864   const MagickBooleanType sharpen,const double alpha,const double beta)
11865 {
11866   MagickBooleanType
11867     status;
11868 
11869   status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11870     alpha,beta);
11871   return(status);
11872 }
11873 
MagickSigmoidalContrastImageChannel(MagickWand * wand,const ChannelType channel,const MagickBooleanType sharpen,const double alpha,const double beta)11874 WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11875   MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11876   const double alpha,const double beta)
11877 {
11878   MagickBooleanType
11879     status;
11880 
11881   assert(wand != (MagickWand *) NULL);
11882   assert(wand->signature == WandSignature);
11883   if (wand->debug != MagickFalse)
11884     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11885   if (wand->images == (Image *) NULL)
11886     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11887   status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11888   if (status == MagickFalse)
11889     InheritException(wand->exception,&wand->images->exception);
11890   return(status);
11891 }
11892 
11893 /*
11894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11895 %                                                                             %
11896 %                                                                             %
11897 %                                                                             %
11898 %   M a g i c k S i m i l a r i t y I m a g e                                 %
11899 %                                                                             %
11900 %                                                                             %
11901 %                                                                             %
11902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11903 %
11904 %  MagickSimilarityImage() compares the reference image of the image and
11905 %  returns the best match offset.  In addition, it returns a similarity image
11906 %  such that an exact match location is completely white and if none of the
11907 %  pixels match, black, otherwise some gray level in-between.
11908 %
11909 %  The format of the MagickSimilarityImage method is:
11910 %
11911 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
11912 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11913 %
11914 %  A description of each parameter follows:
11915 %
11916 %    o wand: the magick wand.
11917 %
11918 %    o reference: the reference wand.
11919 %
11920 %    o offset: the best match offset of the reference image within the image.
11921 %
11922 %    o similarity: the computed similarity between the images.
11923 %
11924 */
MagickSimilarityImage(MagickWand * wand,const MagickWand * reference,RectangleInfo * offset,double * similarity)11925 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11926   const MagickWand *reference,RectangleInfo *offset,double *similarity)
11927 {
11928   Image
11929     *similarity_image;
11930 
11931   assert(wand != (MagickWand *) NULL);
11932   assert(wand->signature == WandSignature);
11933   if (wand->debug != MagickFalse)
11934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11935   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11936     {
11937       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11938         "ContainsNoImages","`%s'",wand->name);
11939       return((MagickWand *) NULL);
11940     }
11941   similarity_image=SimilarityImage(wand->images,reference->images,offset,
11942     similarity,&wand->images->exception);
11943   if (similarity_image == (Image *) NULL)
11944     return((MagickWand *) NULL);
11945   return(CloneMagickWandFromImages(wand,similarity_image));
11946 }
11947 
11948 /*
11949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11950 %                                                                             %
11951 %                                                                             %
11952 %                                                                             %
11953 %   M a g i c k S k e t c h I m a g e                                         %
11954 %                                                                             %
11955 %                                                                             %
11956 %                                                                             %
11957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11958 %
11959 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11960 %  a Gaussian operator of the given radius and standard deviation (sigma).
11961 %  For reasonable results, radius should be larger than sigma.  Use a
11962 %  radius of 0 and SketchImage() selects a suitable radius for you.
11963 %  Angle gives the angle of the blurring motion.
11964 %
11965 %  The format of the MagickSketchImage method is:
11966 %
11967 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11968 %        const double radius,const double sigma,const double angle)
11969 %
11970 %  A description of each parameter follows:
11971 %
11972 %    o wand: the magick wand.
11973 %
11974 %    o radius: the radius of the Gaussian, in pixels, not counting
11975 %      the center pixel.
11976 %
11977 %    o sigma: the standard deviation of the Gaussian, in pixels.
11978 %
11979 %    o angle: Apply the effect along this angle.
11980 %
11981 */
MagickSketchImage(MagickWand * wand,const double radius,const double sigma,const double angle)11982 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11983   const double radius,const double sigma,const double angle)
11984 {
11985   Image
11986     *sketch_image;
11987 
11988   assert(wand != (MagickWand *) NULL);
11989   assert(wand->signature == WandSignature);
11990   if (wand->debug != MagickFalse)
11991     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11992   if (wand->images == (Image *) NULL)
11993     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11994   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11995   if (sketch_image == (Image *) NULL)
11996     return(MagickFalse);
11997   ReplaceImageInList(&wand->images,sketch_image);
11998   return(MagickTrue);
11999 }
12000 
12001 /*
12002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12003 %                                                                             %
12004 %                                                                             %
12005 %                                                                             %
12006 %   M a g i c k S m u s h I m a g e s                                         %
12007 %                                                                             %
12008 %                                                                             %
12009 %                                                                             %
12010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12011 %
12012 %  MagickSmushImages() takes all images from the current image pointer to the
12013 %  end of the image list and smushs them to each other top-to-bottom if the
12014 %  stack parameter is true, otherwise left-to-right.
12015 %
12016 %  The format of the MagickSmushImages method is:
12017 %
12018 %      MagickWand *MagickSmushImages(MagickWand *wand,
12019 %        const MagickBooleanType stack,const ssize_t offset)
12020 %
12021 %  A description of each parameter follows:
12022 %
12023 %    o wand: the magick wand.
12024 %
12025 %    o stack: By default, images are stacked left-to-right. Set stack to
12026 %      MagickTrue to stack them top-to-bottom.
12027 %
12028 %    o offset: minimum distance in pixels between images.
12029 %
12030 */
MagickSmushImages(MagickWand * wand,const MagickBooleanType stack,const ssize_t offset)12031 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
12032   const MagickBooleanType stack,const ssize_t offset)
12033 {
12034   Image
12035     *smush_image;
12036 
12037   assert(wand != (MagickWand *) NULL);
12038   assert(wand->signature == WandSignature);
12039   if (wand->debug != MagickFalse)
12040     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12041   if (wand->images == (Image *) NULL)
12042     return((MagickWand *) NULL);
12043   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
12044   if (smush_image == (Image *) NULL)
12045     return((MagickWand *) NULL);
12046   return(CloneMagickWandFromImages(wand,smush_image));
12047 }
12048 
12049 /*
12050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12051 %                                                                             %
12052 %                                                                             %
12053 %                                                                             %
12054 %     M a g i c k S o l a r i z e I m a g e                                   %
12055 %                                                                             %
12056 %                                                                             %
12057 %                                                                             %
12058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12059 %
12060 %  MagickSolarizeImage() applies a special effect to the image, similar to the
12061 %  effect achieved in a photo darkroom by selectively exposing areas of photo
12062 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
12063 %  measure of the extent of the solarization.
12064 %
12065 %  The format of the MagickSolarizeImage method is:
12066 %
12067 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12068 %        const double threshold)
12069 %      MagickBooleanType MagickSolarizeImageChannel(MagickWand *wand,
12070 %        const ChannelType channel,const double threshold)
12071 %
12072 %  A description of each parameter follows:
12073 %
12074 %    o wand: the magick wand.
12075 %
12076 %    o channel: the image channel(s).
12077 %
12078 %    o threshold:  Define the extent of the solarization.
12079 %
12080 */
MagickSolarizeImage(MagickWand * wand,const double threshold)12081 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12082   const double threshold)
12083 {
12084   MagickBooleanType
12085     status;
12086 
12087   status=MagickSolarizeImageChannel(wand,DefaultChannels,threshold);
12088   return(status);
12089 }
12090 
MagickSolarizeImageChannel(MagickWand * wand,const ChannelType channel,const double threshold)12091 WandExport MagickBooleanType MagickSolarizeImageChannel(MagickWand *wand,
12092   const ChannelType channel,const double threshold)
12093 {
12094   MagickBooleanType
12095     status;
12096 
12097   assert(wand != (MagickWand *) NULL);
12098   assert(wand->signature == WandSignature);
12099   if (wand->debug != MagickFalse)
12100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12101   if (wand->images == (Image *) NULL)
12102     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12103   status=SolarizeImageChannel(wand->images,channel,threshold,wand->exception);
12104   return(status);
12105 }
12106 
12107 /*
12108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12109 %                                                                             %
12110 %                                                                             %
12111 %                                                                             %
12112 %   M a g i c k S p a r s e C o l o r I m a g e                               %
12113 %                                                                             %
12114 %                                                                             %
12115 %                                                                             %
12116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12117 %
12118 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
12119 %  colors found at those coordinates, across the whole image, using various
12120 %  methods.
12121 %
12122 %  The format of the MagickSparseColorImage method is:
12123 %
12124 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12125 %        const ChannelType channel,const SparseColorMethod method,
12126 %        const size_t number_arguments,const double *arguments)
12127 %
12128 %  A description of each parameter follows:
12129 %
12130 %    o image: the image to be sparseed.
12131 %
12132 %    o method: the method of image sparseion.
12133 %
12134 %        ArcSparseColorion will always ignore source image offset, and always
12135 %        'bestfit' the destination image with the top left corner offset
12136 %        relative to the polar mapping center.
12137 %
12138 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
12139 %        style of image sparseion.
12140 %
12141 %        Affine, Perspective, and Bilinear, will do least squares fitting of
12142 %        the distrotion when more than the minimum number of control point
12143 %        pairs are provided.
12144 %
12145 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
12146 %        less than 4 control point pairs are provided. While Affine sparseions
12147 %        will let you use any number of control point pairs, that is Zero pairs
12148 %        is a No-Op (viewport only) distrotion, one pair is a translation and
12149 %        two pairs of control points will do a scale-rotate-translate, without
12150 %        any shearing.
12151 %
12152 %    o number_arguments: the number of arguments given for this sparseion
12153 %      method.
12154 %
12155 %    o arguments: the arguments for this sparseion method.
12156 %
12157 */
MagickSparseColorImage(MagickWand * wand,const ChannelType channel,const SparseColorMethod method,const size_t number_arguments,const double * arguments)12158 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12159   const ChannelType channel,const SparseColorMethod method,
12160   const size_t number_arguments,const double *arguments)
12161 {
12162   Image
12163     *sparse_image;
12164 
12165   assert(wand != (MagickWand *) NULL);
12166   assert(wand->signature == WandSignature);
12167   if (wand->debug != MagickFalse)
12168     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12169   if (wand->images == (Image *) NULL)
12170     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12171   sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
12172     arguments,wand->exception);
12173   if (sparse_image == (Image *) NULL)
12174     return(MagickFalse);
12175   ReplaceImageInList(&wand->images,sparse_image);
12176   return(MagickTrue);
12177 }
12178 
12179 /*
12180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12181 %                                                                             %
12182 %                                                                             %
12183 %                                                                             %
12184 %   M a g i c k S p l i c e I m a g e                                         %
12185 %                                                                             %
12186 %                                                                             %
12187 %                                                                             %
12188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12189 %
12190 %  MagickSpliceImage() splices a solid color into the image.
12191 %
12192 %  The format of the MagickSpliceImage method is:
12193 %
12194 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
12195 %        const size_t width,const size_t height,const ssize_t x,
12196 %        const ssize_t y)
12197 %
12198 %  A description of each parameter follows:
12199 %
12200 %    o wand: the magick wand.
12201 %
12202 %    o width: the region width.
12203 %
12204 %    o height: the region height.
12205 %
12206 %    o x: the region x offset.
12207 %
12208 %    o y: the region y offset.
12209 %
12210 */
MagickSpliceImage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)12211 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
12212   const size_t width,const size_t height,const ssize_t x,
12213   const ssize_t y)
12214 {
12215   Image
12216     *splice_image;
12217 
12218   RectangleInfo
12219     splice;
12220 
12221   assert(wand != (MagickWand *) NULL);
12222   assert(wand->signature == WandSignature);
12223   if (wand->debug != MagickFalse)
12224     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12225   if (wand->images == (Image *) NULL)
12226     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12227   splice.width=width;
12228   splice.height=height;
12229   splice.x=x;
12230   splice.y=y;
12231   splice_image=SpliceImage(wand->images,&splice,wand->exception);
12232   if (splice_image == (Image *) NULL)
12233     return(MagickFalse);
12234   ReplaceImageInList(&wand->images,splice_image);
12235   return(MagickTrue);
12236 }
12237 
12238 /*
12239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12240 %                                                                             %
12241 %                                                                             %
12242 %                                                                             %
12243 %   M a g i c k S p r e a d I m a g e                                         %
12244 %                                                                             %
12245 %                                                                             %
12246 %                                                                             %
12247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12248 %
12249 %  MagickSpreadImage() is a special effects method that randomly displaces each
12250 %  pixel in a block defined by the radius parameter.
12251 %
12252 %  The format of the MagickSpreadImage method is:
12253 %
12254 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
12255 %
12256 %  A description of each parameter follows:
12257 %
12258 %    o wand: the magick wand.
12259 %
12260 %    o radius:  Choose a random pixel in a neighborhood of this extent.
12261 %
12262 */
MagickSpreadImage(MagickWand * wand,const double radius)12263 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
12264   const double radius)
12265 {
12266   Image
12267     *spread_image;
12268 
12269   assert(wand != (MagickWand *) NULL);
12270   assert(wand->signature == WandSignature);
12271   if (wand->debug != MagickFalse)
12272     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12273   if (wand->images == (Image *) NULL)
12274     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12275   spread_image=SpreadImage(wand->images,radius,wand->exception);
12276   if (spread_image == (Image *) NULL)
12277     return(MagickFalse);
12278   ReplaceImageInList(&wand->images,spread_image);
12279   return(MagickTrue);
12280 }
12281 
12282 /*
12283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12284 %                                                                             %
12285 %                                                                             %
12286 %                                                                             %
12287 %   M a g i c k S t a t i s t i c I m a g e                                   %
12288 %                                                                             %
12289 %                                                                             %
12290 %                                                                             %
12291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12292 %
12293 %  MagickStatisticImage() replace each pixel with corresponding statistic from
12294 %  the neighborhood of the specified width and height.
12295 %
12296 %  The format of the MagickStatisticImage method is:
12297 %
12298 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
12299 %        const StatisticType type,const double width,const size_t height)
12300 %      MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
12301 %        const ChannelType channel,const StatisticType type,const double width,
12302 %        const size_t height)
12303 %
12304 %  A description of each parameter follows:
12305 %
12306 %    o wand: the magick wand.
12307 %
12308 %    o channel: the image channel(s).
12309 %
12310 %    o type: the statistic type (e.g. median, mode, etc.).
12311 %
12312 %    o width: the width of the pixel neighborhood.
12313 %
12314 %    o height: the height of the pixel neighborhood.
12315 %
12316 */
12317 
MagickStatisticImage(MagickWand * wand,const StatisticType type,const size_t width,const size_t height)12318 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
12319   const StatisticType type,const size_t width,const size_t height)
12320 {
12321   MagickBooleanType
12322     status;
12323 
12324   status=MagickStatisticImageChannel(wand,DefaultChannels,type,width,height);
12325   return(status);
12326 }
12327 
MagickStatisticImageChannel(MagickWand * wand,const ChannelType channel,const StatisticType type,const size_t width,const size_t height)12328 WandExport MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
12329   const ChannelType channel,const StatisticType type,const size_t width,
12330   const size_t height)
12331 {
12332   Image
12333     *statistic_image;
12334 
12335   assert(wand != (MagickWand *) NULL);
12336   assert(wand->signature == WandSignature);
12337   if (wand->debug != MagickFalse)
12338     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12339   if (wand->images == (Image *) NULL)
12340     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12341   statistic_image=StatisticImageChannel(wand->images,channel,type,width,height,
12342     wand->exception);
12343   if (statistic_image == (Image *) NULL)
12344     return(MagickFalse);
12345   ReplaceImageInList(&wand->images,statistic_image);
12346   return(MagickTrue);
12347 }
12348 
12349 /*
12350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12351 %                                                                             %
12352 %                                                                             %
12353 %                                                                             %
12354 %   M a g i c k S t e g a n o I m a g e                                       %
12355 %                                                                             %
12356 %                                                                             %
12357 %                                                                             %
12358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12359 %
12360 %  MagickSteganoImage() hides a digital watermark within the image.
12361 %  Recover the hidden watermark later to prove that the authenticity of
12362 %  an image.  Offset defines the start position within the image to hide
12363 %  the watermark.
12364 %
12365 %  The format of the MagickSteganoImage method is:
12366 %
12367 %      MagickWand *MagickSteganoImage(MagickWand *wand,
12368 %        const MagickWand *watermark_wand,const ssize_t offset)
12369 %
12370 %  A description of each parameter follows:
12371 %
12372 %    o wand: the magick wand.
12373 %
12374 %    o watermark_wand: the watermark wand.
12375 %
12376 %    o offset: Start hiding at this offset into the image.
12377 %
12378 */
MagickSteganoImage(MagickWand * wand,const MagickWand * watermark_wand,const ssize_t offset)12379 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
12380   const MagickWand *watermark_wand,const ssize_t offset)
12381 {
12382   Image
12383     *stegano_image;
12384 
12385   assert(wand != (MagickWand *) NULL);
12386   assert(wand->signature == WandSignature);
12387   if (wand->debug != MagickFalse)
12388     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12389   if ((wand->images == (Image *) NULL) ||
12390       (watermark_wand->images == (Image *) NULL))
12391     {
12392       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12393         "ContainsNoImages","`%s'",wand->name);
12394       return((MagickWand *) NULL);
12395     }
12396   wand->images->offset=offset;
12397   stegano_image=SteganoImage(wand->images,watermark_wand->images,
12398     wand->exception);
12399   if (stegano_image == (Image *) NULL)
12400     return((MagickWand *) NULL);
12401   return(CloneMagickWandFromImages(wand,stegano_image));
12402 }
12403 
12404 /*
12405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12406 %                                                                             %
12407 %                                                                             %
12408 %                                                                             %
12409 %   M a g i c k S t e r e o I m a g e                                         %
12410 %                                                                             %
12411 %                                                                             %
12412 %                                                                             %
12413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12414 %
12415 %  MagickStereoImage() composites two images and produces a single image that
12416 %  is the composite of a left and right image of a stereo pair
12417 %
12418 %  The format of the MagickStereoImage method is:
12419 %
12420 %      MagickWand *MagickStereoImage(MagickWand *wand,
12421 %        const MagickWand *offset_wand)
12422 %
12423 %  A description of each parameter follows:
12424 %
12425 %    o wand: the magick wand.
12426 %
12427 %    o offset_wand: Another image wand.
12428 %
12429 */
MagickStereoImage(MagickWand * wand,const MagickWand * offset_wand)12430 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
12431   const MagickWand *offset_wand)
12432 {
12433   Image
12434     *stereo_image;
12435 
12436   assert(wand != (MagickWand *) NULL);
12437   assert(wand->signature == WandSignature);
12438   if (wand->debug != MagickFalse)
12439     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12440   if ((wand->images == (Image *) NULL) ||
12441       (offset_wand->images == (Image *) NULL))
12442     {
12443       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12444         "ContainsNoImages","`%s'",wand->name);
12445       return((MagickWand *) NULL);
12446     }
12447   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
12448   if (stereo_image == (Image *) NULL)
12449     return((MagickWand *) NULL);
12450   return(CloneMagickWandFromImages(wand,stereo_image));
12451 }
12452 
12453 /*
12454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12455 %                                                                             %
12456 %                                                                             %
12457 %                                                                             %
12458 %   M a g i c k S t r i p I m a g e                                           %
12459 %                                                                             %
12460 %                                                                             %
12461 %                                                                             %
12462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12463 %
12464 %  MagickStripImage() strips an image of all profiles and comments.
12465 %
12466 %  The format of the MagickStripImage method is:
12467 %
12468 %      MagickBooleanType MagickStripImage(MagickWand *wand)
12469 %
12470 %  A description of each parameter follows:
12471 %
12472 %    o wand: the magick wand.
12473 %
12474 */
MagickStripImage(MagickWand * wand)12475 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
12476 {
12477   MagickBooleanType
12478     status;
12479 
12480   assert(wand != (MagickWand *) NULL);
12481   assert(wand->signature == WandSignature);
12482   if (wand->debug != MagickFalse)
12483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12484   if (wand->images == (Image *) NULL)
12485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12486   status=StripImage(wand->images);
12487   if (status == MagickFalse)
12488     InheritException(wand->exception,&wand->images->exception);
12489   return(status);
12490 }
12491 
12492 /*
12493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12494 %                                                                             %
12495 %                                                                             %
12496 %                                                                             %
12497 %   M a g i c k S w i r l I m a g e                                           %
12498 %                                                                             %
12499 %                                                                             %
12500 %                                                                             %
12501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12502 %
12503 %  MagickSwirlImage() swirls the pixels about the center of the image, where
12504 %  degrees indicates the sweep of the arc through which each pixel is moved.
12505 %  You get a more dramatic effect as the degrees move from 1 to 360.
12506 %
12507 %  The format of the MagickSwirlImage method is:
12508 %
12509 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
12510 %
12511 %  A description of each parameter follows:
12512 %
12513 %    o wand: the magick wand.
12514 %
12515 %    o degrees: Define the tightness of the swirling effect.
12516 %
12517 */
MagickSwirlImage(MagickWand * wand,const double degrees)12518 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
12519   const double degrees)
12520 {
12521   Image
12522     *swirl_image;
12523 
12524   assert(wand != (MagickWand *) NULL);
12525   assert(wand->signature == WandSignature);
12526   if (wand->debug != MagickFalse)
12527     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12528   if (wand->images == (Image *) NULL)
12529     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12530   swirl_image=SwirlImage(wand->images,degrees,wand->exception);
12531   if (swirl_image == (Image *) NULL)
12532     return(MagickFalse);
12533   ReplaceImageInList(&wand->images,swirl_image);
12534   return(MagickTrue);
12535 }
12536 
12537 /*
12538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12539 %                                                                             %
12540 %                                                                             %
12541 %                                                                             %
12542 %   M a g i c k T e x t u r e I m a g e                                       %
12543 %                                                                             %
12544 %                                                                             %
12545 %                                                                             %
12546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12547 %
12548 %  MagickTextureImage() repeatedly tiles the texture image across and down the
12549 %  image canvas.
12550 %
12551 %  The format of the MagickTextureImage method is:
12552 %
12553 %      MagickWand *MagickTextureImage(MagickWand *wand,
12554 %        const MagickWand *texture_wand)
12555 %
12556 %  A description of each parameter follows:
12557 %
12558 %    o wand: the magick wand.
12559 %
12560 %    o texture_wand: the texture wand
12561 %
12562 */
MagickTextureImage(MagickWand * wand,const MagickWand * texture_wand)12563 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
12564   const MagickWand *texture_wand)
12565 {
12566   Image
12567     *texture_image;
12568 
12569   MagickBooleanType
12570     status;
12571 
12572   assert(wand != (MagickWand *) NULL);
12573   assert(wand->signature == WandSignature);
12574   if (wand->debug != MagickFalse)
12575     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12576   if ((wand->images == (Image *) NULL) ||
12577       (texture_wand->images == (Image *) NULL))
12578     {
12579       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12580         "ContainsNoImages","`%s'",wand->name);
12581       return((MagickWand *) NULL);
12582     }
12583   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12584   if (texture_image == (Image *) NULL)
12585     return((MagickWand *) NULL);
12586   status=TextureImage(texture_image,texture_wand->images);
12587   if (status == MagickFalse)
12588     {
12589       InheritException(wand->exception,&texture_image->exception);
12590       texture_image=DestroyImage(texture_image);
12591       return((MagickWand *) NULL);
12592     }
12593   return(CloneMagickWandFromImages(wand,texture_image));
12594 }
12595 
12596 /*
12597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12598 %                                                                             %
12599 %                                                                             %
12600 %                                                                             %
12601 %   M a g i c k T h r e s h o l d I m a g e                                   %
12602 %                                                                             %
12603 %                                                                             %
12604 %                                                                             %
12605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12606 %
12607 %  MagickThresholdImage() changes the value of individual pixels based on
12608 %  the intensity of each pixel compared to threshold.  The result is a
12609 %  high-contrast, two color image.
12610 %
12611 %  The format of the MagickThresholdImage method is:
12612 %
12613 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
12614 %        const double threshold)
12615 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12616 %        const ChannelType channel,const double threshold)
12617 %
12618 %  A description of each parameter follows:
12619 %
12620 %    o wand: the magick wand.
12621 %
12622 %    o channel: the image channel(s).
12623 %
12624 %    o threshold: Define the threshold value.
12625 %
12626 */
MagickThresholdImage(MagickWand * wand,const double threshold)12627 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12628   const double threshold)
12629 {
12630   MagickBooleanType
12631     status;
12632 
12633   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12634   return(status);
12635 }
12636 
MagickThresholdImageChannel(MagickWand * wand,const ChannelType channel,const double threshold)12637 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12638   const ChannelType channel,const double threshold)
12639 {
12640   MagickBooleanType
12641     status;
12642 
12643   assert(wand != (MagickWand *) NULL);
12644   assert(wand->signature == WandSignature);
12645   if (wand->debug != MagickFalse)
12646     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12647   if (wand->images == (Image *) NULL)
12648     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12649   status=BilevelImageChannel(wand->images,channel,threshold);
12650   if (status == MagickFalse)
12651     InheritException(wand->exception,&wand->images->exception);
12652   return(status);
12653 }
12654 
12655 /*
12656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12657 %                                                                             %
12658 %                                                                             %
12659 %                                                                             %
12660 %   M a g i c k T h u m b n a i l I m a g e                                   %
12661 %                                                                             %
12662 %                                                                             %
12663 %                                                                             %
12664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12665 %
12666 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
12667 %  and removes any associated profiles.  The goal is to produce small low cost
12668 %  thumbnail images suited for display on the Web.
12669 %
12670 %  The format of the MagickThumbnailImage method is:
12671 %
12672 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12673 %        const size_t columns,const size_t rows)
12674 %
12675 %  A description of each parameter follows:
12676 %
12677 %    o wand: the magick wand.
12678 %
12679 %    o columns: the number of columns in the scaled image.
12680 %
12681 %    o rows: the number of rows in the scaled image.
12682 %
12683 */
MagickThumbnailImage(MagickWand * wand,const size_t columns,const size_t rows)12684 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12685   const size_t columns,const size_t rows)
12686 {
12687   Image
12688     *thumbnail_image;
12689 
12690   assert(wand != (MagickWand *) NULL);
12691   assert(wand->signature == WandSignature);
12692   if (wand->debug != MagickFalse)
12693     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12694   if (wand->images == (Image *) NULL)
12695     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12696   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12697   if (thumbnail_image == (Image *) NULL)
12698     return(MagickFalse);
12699   ReplaceImageInList(&wand->images,thumbnail_image);
12700   return(MagickTrue);
12701 }
12702 
12703 /*
12704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12705 %                                                                             %
12706 %                                                                             %
12707 %                                                                             %
12708 %   M a g i c k T i n t I m a g e                                             %
12709 %                                                                             %
12710 %                                                                             %
12711 %                                                                             %
12712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12713 %
12714 %  MagickTintImage() applies a color vector to each pixel in the image.  The
12715 %  length of the vector is 0 for black and white and at its maximum for the
12716 %  midtones.  The vector weighting function is
12717 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12718 %
12719 %  The format of the MagickTintImage method is:
12720 %
12721 %      MagickBooleanType MagickTintImage(MagickWand *wand,
12722 %        const PixelWand *tint,const PixelWand *opacity)
12723 %
12724 %  A description of each parameter follows:
12725 %
12726 %    o wand: the magick wand.
12727 %
12728 %    o tint: the tint pixel wand.
12729 %
12730 %    o opacity: the opacity pixel wand.
12731 %
12732 */
MagickTintImage(MagickWand * wand,const PixelWand * tint,const PixelWand * opacity)12733 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12734   const PixelWand *tint,const PixelWand *opacity)
12735 {
12736   char
12737     percent_opaque[MaxTextExtent];
12738 
12739   Image
12740     *tint_image;
12741 
12742   PixelPacket
12743     target;
12744 
12745   assert(wand != (MagickWand *) NULL);
12746   assert(wand->signature == WandSignature);
12747   if (wand->debug != MagickFalse)
12748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12749   if (wand->images == (Image *) NULL)
12750     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12751   (void) FormatLocaleString(percent_opaque,MaxTextExtent,
12752     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12753     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12754     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12755     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12756     PixelGetOpacityQuantum(opacity)));
12757   PixelGetQuantumColor(tint,&target);
12758   tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12759   if (tint_image == (Image *) NULL)
12760     return(MagickFalse);
12761   ReplaceImageInList(&wand->images,tint_image);
12762   return(MagickTrue);
12763 }
12764 
12765 /*
12766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12767 %                                                                             %
12768 %                                                                             %
12769 %                                                                             %
12770 %   M a g i c k T r a n s f o r m I m a g e                                   %
12771 %                                                                             %
12772 %                                                                             %
12773 %                                                                             %
12774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12775 %
12776 %  MagickTransformImage() is a convenience method that behaves like
12777 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12778 %  information as a region geometry specification.  If the operation fails,
12779 %  a NULL image handle is returned.
12780 %
12781 %  The format of the MagickTransformImage method is:
12782 %
12783 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12784 %        const char *geometry)
12785 %
12786 %  A description of each parameter follows:
12787 %
12788 %    o wand: the magick wand.
12789 %
12790 %    o crop: A crop geometry string.  This geometry defines a subregion of the
12791 %      image to crop.
12792 %
12793 %    o geometry: An image geometry string.  This geometry defines the final
12794 %      size of the image.
12795 %
12796 */
MagickTransformImage(MagickWand * wand,const char * crop,const char * geometry)12797 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12798   const char *crop,const char *geometry)
12799 {
12800   Image
12801     *transform_image;
12802 
12803   MagickBooleanType
12804     status;
12805 
12806   assert(wand != (MagickWand *) NULL);
12807   assert(wand->signature == WandSignature);
12808   if (wand->debug != MagickFalse)
12809     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12810   if (wand->images == (Image *) NULL)
12811     return((MagickWand *) NULL);
12812   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12813   if (transform_image == (Image *) NULL)
12814     return((MagickWand *) NULL);
12815   status=TransformImage(&transform_image,crop,geometry);
12816   if (status == MagickFalse)
12817     {
12818       InheritException(wand->exception,&transform_image->exception);
12819       transform_image=DestroyImage(transform_image);
12820       return((MagickWand *) NULL);
12821     }
12822   return(CloneMagickWandFromImages(wand,transform_image));
12823 }
12824 
12825 /*
12826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12827 %                                                                             %
12828 %                                                                             %
12829 %                                                                             %
12830 %   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               %
12831 %                                                                             %
12832 %                                                                             %
12833 %                                                                             %
12834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12835 %
12836 %  MagickTransformImageColorspace() transform the image colorspace, setting
12837 %  the images colorspace while transforming the images data to that
12838 %  colorspace.
12839 %
12840 %  The format of the MagickTransformImageColorspace method is:
12841 %
12842 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12843 %        const ColorspaceType colorspace)
12844 %
12845 %  A description of each parameter follows:
12846 %
12847 %    o wand: the magick wand.
12848 %
12849 %    o colorspace: the image colorspace:   UndefinedColorspace,
12850 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
12851 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
12852 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
12853 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
12854 %      HSLColorspace, HWBColorspace.
12855 %
12856 */
MagickTransformImageColorspace(MagickWand * wand,const ColorspaceType colorspace)12857 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12858   const ColorspaceType colorspace)
12859 {
12860   assert(wand != (MagickWand *) NULL);
12861   assert(wand->signature == WandSignature);
12862   if (wand->debug != MagickFalse)
12863     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12864   if (wand->images == (Image *) NULL)
12865     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12866   return(TransformImageColorspace(wand->images,colorspace));
12867 }
12868 
12869 /*
12870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12871 %                                                                             %
12872 %                                                                             %
12873 %                                                                             %
12874 %   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                     %
12875 %                                                                             %
12876 %                                                                             %
12877 %                                                                             %
12878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12879 %
12880 %  MagickTransparentPaintImage() changes any pixel that matches color with the
12881 %  color defined by fill.
12882 %
12883 %  The format of the MagickTransparentPaintImage method is:
12884 %
12885 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12886 %        const PixelWand *target,const double alpha,const double fuzz,
12887 %        const MagickBooleanType invert)
12888 %
12889 %  A description of each parameter follows:
12890 %
12891 %    o wand: the magick wand.
12892 %
12893 %    o target: Change this target color to specified opacity value within
12894 %      the image.
12895 %
12896 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12897 %      transparent.
12898 %
12899 %    o fuzz: By default target must match a particular pixel color
12900 %      exactly.  However, in many cases two colors may differ by a small amount.
12901 %      The fuzz member of image defines how much tolerance is acceptable to
12902 %      consider two colors as the same.  For example, set fuzz to 10 and the
12903 %      color red at intensities of 100 and 102 respectively are now interpreted
12904 %      as the same color for the purposes of the floodfill.
12905 %
12906 %    o invert: paint any pixel that does not match the target color.
12907 %
12908 */
MagickTransparentPaintImage(MagickWand * wand,const PixelWand * target,const double alpha,const double fuzz,const MagickBooleanType invert)12909 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12910   const PixelWand *target,const double alpha,const double fuzz,
12911   const MagickBooleanType invert)
12912 {
12913   MagickBooleanType
12914     status;
12915 
12916   MagickPixelPacket
12917     target_pixel;
12918 
12919   assert(wand != (MagickWand *) NULL);
12920   assert(wand->signature == WandSignature);
12921   if (wand->debug != MagickFalse)
12922     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12923   if (wand->images == (Image *) NULL)
12924     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12925   PixelGetMagickColor(target,&target_pixel);
12926   wand->images->fuzz=fuzz;
12927   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12928     (MagickRealType) QuantumRange-QuantumRange*alpha),invert);
12929   if (status == MagickFalse)
12930     InheritException(wand->exception,&wand->images->exception);
12931   return(status);
12932 }
12933 
12934 /*
12935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12936 %                                                                             %
12937 %                                                                             %
12938 %                                                                             %
12939 %   M a g i c k T r a n s p o s e I m a g e                                   %
12940 %                                                                             %
12941 %                                                                             %
12942 %                                                                             %
12943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12944 %
12945 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
12946 %  pixels around the central x-axis while rotating them 90-degrees.
12947 %
12948 %  The format of the MagickTransposeImage method is:
12949 %
12950 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12951 %
12952 %  A description of each parameter follows:
12953 %
12954 %    o wand: the magick wand.
12955 %
12956 */
MagickTransposeImage(MagickWand * wand)12957 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12958 {
12959   Image
12960     *transpose_image;
12961 
12962   assert(wand != (MagickWand *) NULL);
12963   assert(wand->signature == WandSignature);
12964   if (wand->debug != MagickFalse)
12965     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12966   if (wand->images == (Image *) NULL)
12967     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12968   transpose_image=TransposeImage(wand->images,wand->exception);
12969   if (transpose_image == (Image *) NULL)
12970     return(MagickFalse);
12971   ReplaceImageInList(&wand->images,transpose_image);
12972   return(MagickTrue);
12973 }
12974 
12975 /*
12976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12977 %                                                                             %
12978 %                                                                             %
12979 %                                                                             %
12980 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12981 %                                                                             %
12982 %                                                                             %
12983 %                                                                             %
12984 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12985 %
12986 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12987 %  pixels around the central y-axis while rotating them 270-degrees.
12988 %
12989 %  The format of the MagickTransverseImage method is:
12990 %
12991 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12992 %
12993 %  A description of each parameter follows:
12994 %
12995 %    o wand: the magick wand.
12996 %
12997 */
MagickTransverseImage(MagickWand * wand)12998 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12999 {
13000   Image
13001     *transverse_image;
13002 
13003   assert(wand != (MagickWand *) NULL);
13004   assert(wand->signature == WandSignature);
13005   if (wand->debug != MagickFalse)
13006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13007   if (wand->images == (Image *) NULL)
13008     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13009   transverse_image=TransverseImage(wand->images,wand->exception);
13010   if (transverse_image == (Image *) NULL)
13011     return(MagickFalse);
13012   ReplaceImageInList(&wand->images,transverse_image);
13013   return(MagickTrue);
13014 }
13015 
13016 /*
13017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13018 %                                                                             %
13019 %                                                                             %
13020 %                                                                             %
13021 %   M a g i c k T r i m I m a g e                                             %
13022 %                                                                             %
13023 %                                                                             %
13024 %                                                                             %
13025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13026 %
13027 %  MagickTrimImage() remove edges that are the background color from the image.
13028 %
13029 %  The format of the MagickTrimImage method is:
13030 %
13031 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
13032 %
13033 %  A description of each parameter follows:
13034 %
13035 %    o wand: the magick wand.
13036 %
13037 %    o fuzz: By default target must match a particular pixel color
13038 %      exactly.  However, in many cases two colors may differ by a small amount.
13039 %      The fuzz member of image defines how much tolerance is acceptable to
13040 %      consider two colors as the same.  For example, set fuzz to 10 and the
13041 %      color red at intensities of 100 and 102 respectively are now interpreted
13042 %      as the same color for the purposes of the floodfill.
13043 %
13044 */
MagickTrimImage(MagickWand * wand,const double fuzz)13045 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
13046 {
13047   Image
13048     *trim_image;
13049 
13050   assert(wand != (MagickWand *) NULL);
13051   assert(wand->signature == WandSignature);
13052   if (wand->debug != MagickFalse)
13053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13054   if (wand->images == (Image *) NULL)
13055     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13056   wand->images->fuzz=fuzz;
13057   trim_image=TrimImage(wand->images,wand->exception);
13058   if (trim_image == (Image *) NULL)
13059     return(MagickFalse);
13060   ReplaceImageInList(&wand->images,trim_image);
13061   return(MagickTrue);
13062 }
13063 
13064 /*
13065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13066 %                                                                             %
13067 %                                                                             %
13068 %                                                                             %
13069 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
13070 %                                                                             %
13071 %                                                                             %
13072 %                                                                             %
13073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13074 %
13075 %  MagickUniqueImageColors() discards all but one of any pixel color.
13076 %
13077 %  The format of the MagickUniqueImageColors method is:
13078 %
13079 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
13080 %
13081 %  A description of each parameter follows:
13082 %
13083 %    o wand: the magick wand.
13084 %
13085 */
MagickUniqueImageColors(MagickWand * wand)13086 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
13087 {
13088   Image
13089     *unique_image;
13090 
13091   assert(wand != (MagickWand *) NULL);
13092   assert(wand->signature == WandSignature);
13093   if (wand->debug != MagickFalse)
13094     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13095   if (wand->images == (Image *) NULL)
13096     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13097   unique_image=UniqueImageColors(wand->images,wand->exception);
13098   if (unique_image == (Image *) NULL)
13099     return(MagickFalse);
13100   ReplaceImageInList(&wand->images,unique_image);
13101   return(MagickTrue);
13102 }
13103 
13104 /*
13105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13106 %                                                                             %
13107 %                                                                             %
13108 %                                                                             %
13109 %   M a g i c k U n s h a r p M a s k I m a g e                               %
13110 %                                                                             %
13111 %                                                                             %
13112 %                                                                             %
13113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13114 %
13115 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
13116 %  Gaussian operator of the given radius and standard deviation (sigma).
13117 %  For reasonable results, radius should be larger than sigma.  Use a radius
13118 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
13119 %
13120 %  The format of the MagickUnsharpMaskImage method is:
13121 %
13122 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13123 %        const double radius,const double sigma,const double amount,
13124 %        const double threshold)
13125 %      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
13126 %        const ChannelType channel,const double radius,const double sigma,
13127 %        const double amount,const double threshold)
13128 %
13129 %  A description of each parameter follows:
13130 %
13131 %    o wand: the magick wand.
13132 %
13133 %    o channel: the image channel(s).
13134 %
13135 %    o radius: the radius of the Gaussian, in pixels, not counting the center
13136 %      pixel.
13137 %
13138 %    o sigma: the standard deviation of the Gaussian, in pixels.
13139 %
13140 %    o amount: the percentage of the difference between the original and the
13141 %      blur image that is added back into the original.
13142 %
13143 %    o threshold: the threshold in pixels needed to apply the diffence amount.
13144 %
13145 */
13146 
MagickUnsharpMaskImage(MagickWand * wand,const double radius,const double sigma,const double amount,const double threshold)13147 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13148   const double radius,const double sigma,const double amount,
13149   const double threshold)
13150 {
13151   MagickBooleanType
13152     status;
13153 
13154   status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
13155     amount,threshold);
13156   return(status);
13157 }
13158 
MagickUnsharpMaskImageChannel(MagickWand * wand,const ChannelType channel,const double radius,const double sigma,const double amount,const double threshold)13159 WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
13160   const ChannelType channel,const double radius,const double sigma,
13161   const double amount,const double threshold)
13162 {
13163   Image
13164     *unsharp_image;
13165 
13166   assert(wand != (MagickWand *) NULL);
13167   assert(wand->signature == WandSignature);
13168   if (wand->debug != MagickFalse)
13169     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13170   if (wand->images == (Image *) NULL)
13171     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13172   unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
13173     amount,threshold,wand->exception);
13174   if (unsharp_image == (Image *) NULL)
13175     return(MagickFalse);
13176   ReplaceImageInList(&wand->images,unsharp_image);
13177   return(MagickTrue);
13178 }
13179 
13180 /*
13181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13182 %                                                                             %
13183 %                                                                             %
13184 %                                                                             %
13185 %   M a g i c k V i g n e t t e I m a g e                                     %
13186 %                                                                             %
13187 %                                                                             %
13188 %                                                                             %
13189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13190 %
13191 %  MagickVignetteImage() softens the edges of the image in vignette style.
13192 %
13193 %  The format of the MagickVignetteImage method is:
13194 %
13195 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
13196 %        const double black_point,const double white_point,const ssize_t x,
13197 %        const ssize_t y)
13198 %
13199 %  A description of each parameter follows:
13200 %
13201 %    o wand: the magick wand.
13202 %
13203 %    o black_point: the black point.
13204 %
13205 %    o white_point: the white point.
13206 %
13207 %    o x, y:  Define the x and y ellipse offset.
13208 %
13209 */
MagickVignetteImage(MagickWand * wand,const double black_point,const double white_point,const ssize_t x,const ssize_t y)13210 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
13211   const double black_point,const double white_point,const ssize_t x,
13212   const ssize_t y)
13213 {
13214   Image
13215     *vignette_image;
13216 
13217   assert(wand != (MagickWand *) NULL);
13218   assert(wand->signature == WandSignature);
13219   if (wand->debug != MagickFalse)
13220     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13221   if (wand->images == (Image *) NULL)
13222     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13223   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
13224     wand->exception);
13225   if (vignette_image == (Image *) NULL)
13226     return(MagickFalse);
13227   ReplaceImageInList(&wand->images,vignette_image);
13228   return(MagickTrue);
13229 }
13230 
13231 /*
13232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13233 %                                                                             %
13234 %                                                                             %
13235 %                                                                             %
13236 %   M a g i c k W a v e I m a g e                                             %
13237 %                                                                             %
13238 %                                                                             %
13239 %                                                                             %
13240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13241 %
13242 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
13243 %  the pixels vertically along a sine wave whose amplitude and wavelength
13244 %  is specified by the given parameters.
13245 %
13246 %  The format of the MagickWaveImage method is:
13247 %
13248 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
13249 %        const double amplitude,const double wave_length)
13250 %
13251 %  A description of each parameter follows:
13252 %
13253 %    o wand: the magick wand.
13254 %
13255 %    o amplitude, wave_length:  Define the amplitude and wave length of the
13256 %      sine wave.
13257 %
13258 */
MagickWaveImage(MagickWand * wand,const double amplitude,const double wave_length)13259 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
13260   const double amplitude,const double wave_length)
13261 {
13262   Image
13263     *wave_image;
13264 
13265   assert(wand != (MagickWand *) NULL);
13266   assert(wand->signature == WandSignature);
13267   if (wand->debug != MagickFalse)
13268     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13269   if (wand->images == (Image *) NULL)
13270     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13271   wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
13272   if (wave_image == (Image *) NULL)
13273     return(MagickFalse);
13274   ReplaceImageInList(&wand->images,wave_image);
13275   return(MagickTrue);
13276 }
13277 
13278 /*
13279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13280 %                                                                             %
13281 %                                                                             %
13282 %                                                                             %
13283 %   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                         %
13284 %                                                                             %
13285 %                                                                             %
13286 %                                                                             %
13287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13288 %
13289 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
13290 %  above the threshold into white while leaving all pixels below the threshold
13291 %  unchanged.
13292 %
13293 %  The format of the MagickWhiteThresholdImage method is:
13294 %
13295 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13296 %        const PixelWand *threshold)
13297 %
13298 %  A description of each parameter follows:
13299 %
13300 %    o wand: the magick wand.
13301 %
13302 %    o threshold: the pixel wand.
13303 %
13304 */
MagickWhiteThresholdImage(MagickWand * wand,const PixelWand * threshold)13305 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13306   const PixelWand *threshold)
13307 {
13308   char
13309     thresholds[MaxTextExtent];
13310 
13311   MagickBooleanType
13312     status;
13313 
13314   assert(wand != (MagickWand *) NULL);
13315   assert(wand->signature == WandSignature);
13316   if (wand->debug != MagickFalse)
13317     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13318   if (wand->images == (Image *) NULL)
13319     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13320   (void) FormatLocaleString(thresholds,MaxTextExtent,
13321     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
13322     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
13323     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
13324   status=WhiteThresholdImage(wand->images,thresholds);
13325   if (status == MagickFalse)
13326     InheritException(wand->exception,&wand->images->exception);
13327   return(status);
13328 }
13329 
13330 /*
13331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13332 %                                                                             %
13333 %                                                                             %
13334 %                                                                             %
13335 %   M a g i c k W r i t e I m a g e                                           %
13336 %                                                                             %
13337 %                                                                             %
13338 %                                                                             %
13339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13340 %
13341 %  MagickWriteImage() writes an image to the specified filename.  If the
13342 %  filename parameter is NULL, the image is written to the filename set
13343 %  by MagickReadImage() or MagickSetImageFilename().
13344 %
13345 %  The format of the MagickWriteImage method is:
13346 %
13347 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
13348 %        const char *filename)
13349 %
13350 %  A description of each parameter follows:
13351 %
13352 %    o wand: the magick wand.
13353 %
13354 %    o filename: the image filename.
13355 %
13356 %
13357 */
MagickWriteImage(MagickWand * wand,const char * filename)13358 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
13359   const char *filename)
13360 {
13361   Image
13362     *image;
13363 
13364   ImageInfo
13365     *write_info;
13366 
13367   MagickBooleanType
13368     status;
13369 
13370   assert(wand != (MagickWand *) NULL);
13371   assert(wand->signature == WandSignature);
13372   if (wand->debug != MagickFalse)
13373     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13374   if (wand->images == (Image *) NULL)
13375     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13376   if (filename != (const char *) NULL)
13377     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
13378   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13379   if (image == (Image *) NULL)
13380     return(MagickFalse);
13381   write_info=CloneImageInfo(wand->image_info);
13382   write_info->adjoin=MagickTrue;
13383   status=WriteImage(write_info,image);
13384   if (status == MagickFalse)
13385     InheritException(wand->exception,&image->exception);
13386   image=DestroyImage(image);
13387   write_info=DestroyImageInfo(write_info);
13388   return(status);
13389 }
13390 
13391 /*
13392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13393 %                                                                             %
13394 %                                                                             %
13395 %                                                                             %
13396 %   M a g i c k W r i t e I m a g e F i l e                                   %
13397 %                                                                             %
13398 %                                                                             %
13399 %                                                                             %
13400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13401 %
13402 %  MagickWriteImageFile() writes an image to an open file descriptor.
13403 %
13404 %  The format of the MagickWriteImageFile method is:
13405 %
13406 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13407 %
13408 %  A description of each parameter follows:
13409 %
13410 %    o wand: the magick wand.
13411 %
13412 %    o file: the file descriptor.
13413 %
13414 */
MagickWriteImageFile(MagickWand * wand,FILE * file)13415 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13416 {
13417   Image
13418     *image;
13419 
13420   ImageInfo
13421     *write_info;
13422 
13423   MagickBooleanType
13424     status;
13425 
13426   assert(wand != (MagickWand *) NULL);
13427   assert(wand->signature == WandSignature);
13428   assert(file != (FILE *) NULL);
13429   if (wand->debug != MagickFalse)
13430     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13431   if (wand->images == (Image *) NULL)
13432     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13433   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13434   if (image == (Image *) NULL)
13435     return(MagickFalse);
13436   write_info=CloneImageInfo(wand->image_info);
13437   SetImageInfoFile(write_info,file);
13438   write_info->adjoin=MagickTrue;
13439   status=WriteImage(write_info,image);
13440   write_info=DestroyImageInfo(write_info);
13441   if (status == MagickFalse)
13442     InheritException(wand->exception,&image->exception);
13443   image=DestroyImage(image);
13444   return(status);
13445 }
13446 
13447 /*
13448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13449 %                                                                             %
13450 %                                                                             %
13451 %                                                                             %
13452 %   M a g i c k W r i t e I m a g e s                                         %
13453 %                                                                             %
13454 %                                                                             %
13455 %                                                                             %
13456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13457 %
13458 %  MagickWriteImages() writes an image or image sequence.
13459 %
13460 %  The format of the MagickWriteImages method is:
13461 %
13462 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
13463 %        const char *filename,const MagickBooleanType adjoin)
13464 %
13465 %  A description of each parameter follows:
13466 %
13467 %    o wand: the magick wand.
13468 %
13469 %    o filename: the image filename.
13470 %
13471 %    o adjoin: join images into a single multi-image file.
13472 %
13473 */
MagickWriteImages(MagickWand * wand,const char * filename,const MagickBooleanType adjoin)13474 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
13475   const char *filename,const MagickBooleanType adjoin)
13476 {
13477   ImageInfo
13478     *write_info;
13479 
13480   MagickBooleanType
13481     status;
13482 
13483   assert(wand != (MagickWand *) NULL);
13484   assert(wand->signature == WandSignature);
13485   if (wand->debug != MagickFalse)
13486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13487   if (wand->images == (Image *) NULL)
13488     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13489   write_info=CloneImageInfo(wand->image_info);
13490   write_info->adjoin=adjoin;
13491   status=WriteImages(write_info,wand->images,filename,wand->exception);
13492   if (status == MagickFalse)
13493     InheritException(wand->exception,&wand->images->exception);
13494   write_info=DestroyImageInfo(write_info);
13495   return(status);
13496 }
13497 
13498 /*
13499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13500 %                                                                             %
13501 %                                                                             %
13502 %                                                                             %
13503 %   M a g i c k W r i t e I m a g e s F i l e                                 %
13504 %                                                                             %
13505 %                                                                             %
13506 %                                                                             %
13507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13508 %
13509 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
13510 %
13511 %  The format of the MagickWriteImagesFile method is:
13512 %
13513 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13514 %
13515 %  A description of each parameter follows:
13516 %
13517 %    o wand: the magick wand.
13518 %
13519 %    o file: the file descriptor.
13520 %
13521 */
MagickWriteImagesFile(MagickWand * wand,FILE * file)13522 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13523 {
13524   ImageInfo
13525     *write_info;
13526 
13527   MagickBooleanType
13528     status;
13529 
13530   assert(wand != (MagickWand *) NULL);
13531   assert(wand->signature == WandSignature);
13532   if (wand->debug != MagickFalse)
13533     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13534   if (wand->images == (Image *) NULL)
13535     ThrowWandException(WandError,"ContainsNoImages",wand->name);
13536   write_info=CloneImageInfo(wand->image_info);
13537   SetImageInfoFile(write_info,file);
13538   write_info->adjoin=MagickTrue;
13539   status=WriteImages(write_info,wand->images,(const char *) NULL,
13540     wand->exception);
13541   write_info=DestroyImageInfo(write_info);
13542   if (status == MagickFalse)
13543     InheritException(wand->exception,&wand->images->exception);
13544   return(status);
13545 }
13546