MagickWand  6.9.12-67
Convert, Edit, Or Compose Bitmap Images
 All Data Structures
magick-image.c
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 */
87 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88  Image *images)
89 {
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 */
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 
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 
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 */
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 
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 
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 */
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 */
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 
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 
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 
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 */
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 */
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 */
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 */
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 */
794 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
795 {
796  MagickBooleanType
797  status;
798 
799  status=MagickAutoGammaImageChannel(wand,DefaultChannels);
800  return(status);
801 }
802 
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 */
848 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
849 {
850  MagickBooleanType
851  status;
852 
853  status=MagickAutoLevelImageChannel(wand,DefaultChannels);
854  return(status);
855 }
856 
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 */
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 */
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 */
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 
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 
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 */
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 
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 
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 */
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 */
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 
1337 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1338 {
1339  MagickBooleanType
1340  status;
1341 
1342  status=MagickClampImageChannel(wand,DefaultChannels);
1343  return(status);
1344 }
1345 
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 */
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 */
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 
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 
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 
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 */
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 */
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 */
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 
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 
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 
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 
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 
3162 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
3163 {
3164  MagickBooleanType
3165  status;
3166 
3167  status=MagickEqualizeImageChannel(wand,DefaultChannels);
3168  return(status);
3169 }
3170 
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 
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 
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 
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 */
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 */
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 
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 
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 */
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 */
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 */
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 */
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 */
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 
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 
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 
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 
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 
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 
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 
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 
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 
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 
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 
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 
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 
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 
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 
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 
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 
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 
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 
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 
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 
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 
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 */
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 */
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 
7899 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7900 {
7901  MagickBooleanType
7902  status;
7903 
7904  status=MagickNormalizeImageChannel(wand,DefaultChannels);
7905  return(status);
7906 }
7907 
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 */
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 
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 
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 */
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 */
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 
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 
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 */
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 */
8291 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
8292  const void *blob,const size_t length)
8293 {
8294  Image
8295  *images;
8296 
8297  assert(wand != (MagickWand *) NULL);
8298  assert(wand->signature == WandSignature);
8299  if (wand->debug != MagickFalse)
8300  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8301  images=PingBlob(wand->image_info,blob,length,wand->exception);
8302  if (images == (Image *) NULL)
8303  return(MagickFalse);
8304  return(InsertImageInWand(wand,images));
8305 }
8306 
8307 /*
8308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8309 % %
8310 % %
8311 % %
8312 % M a g i c k P i n g I m a g e F i l e %
8313 % %
8314 % %
8315 % %
8316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8317 %
8318 % MagickPingImageFile() pings an image or image sequence from an open file
8319 % descriptor.
8320 %
8321 % The format of the MagickPingImageFile method is:
8322 %
8323 % MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8324 %
8325 % A description of each parameter follows:
8326 %
8327 % o wand: the magick wand.
8328 %
8329 % o file: the file descriptor.
8330 %
8331 */
8332 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
8333 {
8334  Image
8335  *images;
8336 
8337  ImageInfo
8338  *read_info;
8339 
8340  assert(wand != (MagickWand *) NULL);
8341  assert(wand->signature == WandSignature);
8342  assert(file != (FILE *) NULL);
8343  if (wand->debug != MagickFalse)
8344  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8345  read_info=CloneImageInfo(wand->image_info);
8346  SetImageInfoFile(read_info,file);
8347  images=PingImage(read_info,wand->exception);
8348  read_info=DestroyImageInfo(read_info);
8349  if (images == (Image *) NULL)
8350  return(MagickFalse);
8351  return(InsertImageInWand(wand,images));
8352 }
8353 
8354 /*
8355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8356 % %
8357 % %
8358 % %
8359 % M a g i c k P o l a r o i d I m a g e %
8360 % %
8361 % %
8362 % %
8363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8364 %
8365 % MagickPolaroidImage() simulates a Polaroid picture.
8366 %
8367 % The format of the MagickPolaroidImage method is:
8368 %
8369 % MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8370 % const DrawingWand *drawing_wand,const double angle)
8371 %
8372 % A description of each parameter follows:
8373 %
8374 % o wand: the magick wand.
8375 %
8376 % o drawing_wand: the draw wand.
8377 %
8378 % o angle: Apply the effect along this angle.
8379 %
8380 */
8381 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
8382  const DrawingWand *drawing_wand,const double angle)
8383 {
8384  DrawInfo
8385  *draw_info;
8386 
8387  Image
8388  *polaroid_image;
8389 
8390  assert(wand != (MagickWand *) NULL);
8391  assert(wand->signature == WandSignature);
8392  if (wand->debug != MagickFalse)
8393  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8394  if (wand->images == (Image *) NULL)
8395  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8396  draw_info=PeekDrawingWand(drawing_wand);
8397  if (draw_info == (DrawInfo *) NULL)
8398  return(MagickFalse);
8399  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
8400  if (polaroid_image == (Image *) NULL)
8401  return(MagickFalse);
8402  ReplaceImageInList(&wand->images,polaroid_image);
8403  return(MagickTrue);
8404 }
8405 
8406 /*
8407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8408 % %
8409 % %
8410 % %
8411 % M a g i c k P o s t e r i z e I m a g e %
8412 % %
8413 % %
8414 % %
8415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8416 %
8417 % MagickPosterizeImage() reduces the image to a limited number of color level.
8418 %
8419 % The format of the MagickPosterizeImage method is:
8420 %
8421 % MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8422 % const size_t levels,const MagickBooleanType dither)
8423 %
8424 % A description of each parameter follows:
8425 %
8426 % o wand: the magick wand.
8427 %
8428 % o levels: Number of color levels allowed in each channel. Very low values
8429 % (2, 3, or 4) have the most visible effect.
8430 %
8431 % o dither: Set this integer value to something other than zero to dither
8432 % the mapped image.
8433 %
8434 */
8435 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8436  const size_t levels,const MagickBooleanType dither)
8437 {
8438  MagickBooleanType
8439  status;
8440 
8441  assert(wand != (MagickWand *) NULL);
8442  assert(wand->signature == WandSignature);
8443  if (wand->debug != MagickFalse)
8444  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8445  if (wand->images == (Image *) NULL)
8446  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8447  status=PosterizeImage(wand->images,levels,dither);
8448  if (status == MagickFalse)
8449  InheritException(wand->exception,&wand->images->exception);
8450  return(status);
8451 }
8452 
8453 /*
8454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8455 % %
8456 % %
8457 % %
8458 % M a g i c k P r e v i e w I m a g e s %
8459 % %
8460 % %
8461 % %
8462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8463 %
8464 % MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8465 % image processing operation applied at varying strengths. This helpful
8466 % to quickly pin-point an appropriate parameter for an image processing
8467 % operation.
8468 %
8469 % The format of the MagickPreviewImages method is:
8470 %
8471 % MagickWand *MagickPreviewImages(MagickWand *wand,
8472 % const PreviewType preview)
8473 %
8474 % A description of each parameter follows:
8475 %
8476 % o wand: the magick wand.
8477 %
8478 % o preview: the preview type.
8479 %
8480 */
8481 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8482  const PreviewType preview)
8483 {
8484  Image
8485  *preview_image;
8486 
8487  assert(wand != (MagickWand *) NULL);
8488  assert(wand->signature == WandSignature);
8489  if (wand->debug != MagickFalse)
8490  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8491  if (wand->images == (Image *) NULL)
8492  return((MagickWand *) NULL);
8493  preview_image=PreviewImage(wand->images,preview,wand->exception);
8494  if (preview_image == (Image *) NULL)
8495  return((MagickWand *) NULL);
8496  return(CloneMagickWandFromImages(wand,preview_image));
8497 }
8498 
8499 /*
8500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8501 % %
8502 % %
8503 % %
8504 % M a g i c k P r e v i o u s I m a g e %
8505 % %
8506 % %
8507 % %
8508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8509 %
8510 % MagickPreviousImage() sets the previous image in the wand as the current
8511 % image.
8512 %
8513 % It is typically used after MagickSetLastIterator(), after which its first
8514 % use will set the last image as the current image (unless the wand is empty).
8515 %
8516 % It will return MagickFalse when no more images are left to be returned
8517 % which happens when the wand is empty, or the current image is the first
8518 % image. At that point the iterator is than reset to again process images in
8519 % the forward direction, again starting with the first image in list. Images
8520 % added at this point are prepended.
8521 %
8522 % Also at that point any images added to the wand using MagickAddImages() or
8523 % MagickReadImages() will be prepended before the first image. In this sense
8524 % the condition is not quite exactly the same as MagickResetIterator().
8525 %
8526 % The format of the MagickPreviousImage method is:
8527 %
8528 % MagickBooleanType MagickPreviousImage(MagickWand *wand)
8529 %
8530 % A description of each parameter follows:
8531 %
8532 % o wand: the magick wand.
8533 %
8534 */
8535 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8536 {
8537  assert(wand != (MagickWand *) NULL);
8538  assert(wand->signature == WandSignature);
8539  if (wand->debug != MagickFalse)
8540  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8541  if (wand->images == (Image *) NULL)
8542  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8543  if (wand->image_pending != MagickFalse)
8544  {
8545  wand->image_pending=MagickFalse; /* image returned no longer pending */
8546  return(MagickTrue);
8547  }
8548  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8549  {
8550  wand->image_pending=MagickTrue; /* Next now re-gets first image */
8551  wand->insert_before=MagickTrue; /* insert/add prepends new images */
8552  return(MagickFalse);
8553  }
8554  wand->images=GetPreviousImageInList(wand->images);
8555  return(MagickTrue);
8556 }
8557 
8558 /*
8559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8560 % %
8561 % %
8562 % %
8563 % M a g i c k Q u a n t i z e I m a g e %
8564 % %
8565 % %
8566 % %
8567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8568 %
8569 % MagickQuantizeImage() analyzes the colors within a reference image and
8570 % chooses a fixed number of colors to represent the image. The goal of the
8571 % algorithm is to minimize the color difference between the input and output
8572 % image while minimizing the processing time.
8573 %
8574 % The format of the MagickQuantizeImage method is:
8575 %
8576 % MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8577 % const size_t number_colors,const ColorspaceType colorspace,
8578 % const size_t treedepth,const MagickBooleanType dither,
8579 % const MagickBooleanType measure_error)
8580 %
8581 % A description of each parameter follows:
8582 %
8583 % o wand: the magick wand.
8584 %
8585 % o number_colors: the number of colors.
8586 %
8587 % o colorspace: Perform color reduction in this colorspace, typically
8588 % RGBColorspace.
8589 %
8590 % o treedepth: Normally, this integer value is zero or one. A zero or
8591 % 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
8592 % reference image with the least amount of memory and the fastest
8593 % computational speed. In some cases, such as an image with low color
8594 % dispersion (a few number of colors), a value other than
8595 % Log4(number_colors) is required. To expand the color tree completely,
8596 % use a value of 8.
8597 %
8598 % o dither: A value other than zero distributes the difference between an
8599 % original image and the corresponding color reduced image to
8600 % neighboring pixels along a Hilbert curve.
8601 %
8602 % o measure_error: A value other than zero measures the difference between
8603 % the original and quantized images. This difference is the total
8604 % quantization error. The error is computed by summing over all pixels
8605 % in an image the distance squared in RGB space between each reference
8606 % pixel value and its quantized value.
8607 %
8608 */
8609 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8610  const size_t number_colors,const ColorspaceType colorspace,
8611  const size_t treedepth,const MagickBooleanType dither,
8612  const MagickBooleanType measure_error)
8613 {
8614  MagickBooleanType
8615  status;
8616 
8617  QuantizeInfo
8618  *quantize_info;
8619 
8620  assert(wand != (MagickWand *) NULL);
8621  assert(wand->signature == WandSignature);
8622  if (wand->debug != MagickFalse)
8623  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8624  if (wand->images == (Image *) NULL)
8625  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8626  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8627  quantize_info->number_colors=number_colors;
8628  quantize_info->dither=dither;
8629  quantize_info->tree_depth=treedepth;
8630  quantize_info->colorspace=colorspace;
8631  quantize_info->measure_error=measure_error;
8632  status=QuantizeImage(quantize_info,wand->images);
8633  if (status == MagickFalse)
8634  InheritException(wand->exception,&wand->images->exception);
8635  quantize_info=DestroyQuantizeInfo(quantize_info);
8636  return(status);
8637 }
8638 
8639 /*
8640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8641 % %
8642 % %
8643 % %
8644 % M a g i c k Q u a n t i z e I m a g e s %
8645 % %
8646 % %
8647 % %
8648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8649 %
8650 % MagickQuantizeImages() analyzes the colors within a sequence of images and
8651 % chooses a fixed number of colors to represent the image. The goal of the
8652 % algorithm is to minimize the color difference between the input and output
8653 % image while minimizing the processing time.
8654 %
8655 % The format of the MagickQuantizeImages method is:
8656 %
8657 % MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8658 % const size_t number_colors,const ColorspaceType colorspace,
8659 % const size_t treedepth,const MagickBooleanType dither,
8660 % const MagickBooleanType measure_error)
8661 %
8662 % A description of each parameter follows:
8663 %
8664 % o wand: the magick wand.
8665 %
8666 % o number_colors: the number of colors.
8667 %
8668 % o colorspace: Perform color reduction in this colorspace, typically
8669 % RGBColorspace.
8670 %
8671 % o treedepth: Normally, this integer value is zero or one. A zero or
8672 % 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
8673 % reference image with the least amount of memory and the fastest
8674 % computational speed. In some cases, such as an image with low color
8675 % dispersion (a few number of colors), a value other than
8676 % Log4(number_colors) is required. To expand the color tree completely,
8677 % use a value of 8.
8678 %
8679 % o dither: A value other than zero distributes the difference between an
8680 % original image and the corresponding color reduced algorithm to
8681 % neighboring pixels along a Hilbert curve.
8682 %
8683 % o measure_error: A value other than zero measures the difference between
8684 % the original and quantized images. This difference is the total
8685 % quantization error. The error is computed by summing over all pixels
8686 % in an image the distance squared in RGB space between each reference
8687 % pixel value and its quantized value.
8688 %
8689 */
8690 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8691  const size_t number_colors,const ColorspaceType colorspace,
8692  const size_t treedepth,const MagickBooleanType dither,
8693  const MagickBooleanType measure_error)
8694 {
8695  MagickBooleanType
8696  status;
8697 
8698  QuantizeInfo
8699  *quantize_info;
8700 
8701  assert(wand != (MagickWand *) NULL);
8702  assert(wand->signature == WandSignature);
8703  if (wand->debug != MagickFalse)
8704  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8705  if (wand->images == (Image *) NULL)
8706  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8707  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8708  quantize_info->number_colors=number_colors;
8709  quantize_info->dither=dither;
8710  quantize_info->tree_depth=treedepth;
8711  quantize_info->colorspace=colorspace;
8712  quantize_info->measure_error=measure_error;
8713  status=QuantizeImages(quantize_info,wand->images);
8714  if (status == MagickFalse)
8715  InheritException(wand->exception,&wand->images->exception);
8716  quantize_info=DestroyQuantizeInfo(quantize_info);
8717  return(status);
8718 }
8719 
8720 /*
8721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8722 % %
8723 % %
8724 % %
8725 % M a g i c k R a i s e I m a g e %
8726 % %
8727 % %
8728 % %
8729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8730 %
8731 % MagickRaiseImage() creates a simulated three-dimensional button-like effect
8732 % by lightening and darkening the edges of the image. Members width and
8733 % height of raise_info define the width of the vertical and horizontal
8734 % edge of the effect.
8735 %
8736 % The format of the MagickRaiseImage method is:
8737 %
8738 % MagickBooleanType MagickRaiseImage(MagickWand *wand,
8739 % const size_t width,const size_t height,const ssize_t x,
8740 % const ssize_t y,const MagickBooleanType raise)
8741 %
8742 % A description of each parameter follows:
8743 %
8744 % o wand: the magick wand.
8745 %
8746 % o width,height,x,y: Define the dimensions of the area to raise.
8747 %
8748 % o raise: A value other than zero creates a 3-D raise effect,
8749 % otherwise it has a lowered effect.
8750 %
8751 */
8752 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8753  const size_t width,const size_t height,const ssize_t x,const ssize_t y,
8754  const MagickBooleanType raise)
8755 {
8756  MagickBooleanType
8757  status;
8758 
8759  RectangleInfo
8760  raise_info;
8761 
8762  assert(wand != (MagickWand *) NULL);
8763  assert(wand->signature == WandSignature);
8764  if (wand->debug != MagickFalse)
8765  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8766  if (wand->images == (Image *) NULL)
8767  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8768  raise_info.width=width;
8769  raise_info.height=height;
8770  raise_info.x=x;
8771  raise_info.y=y;
8772  status=RaiseImage(wand->images,&raise_info,raise);
8773  if (status == MagickFalse)
8774  InheritException(wand->exception,&wand->images->exception);
8775  return(status);
8776 }
8777 
8778 /*
8779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8780 % %
8781 % %
8782 % %
8783 % 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 %
8784 % %
8785 % %
8786 % %
8787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8788 %
8789 % MagickRandomThresholdImage() changes the value of individual pixels based on
8790 % the intensity of each pixel compared to threshold. The result is a
8791 % high-contrast, two color image.
8792 %
8793 % The format of the MagickRandomThresholdImage method is:
8794 %
8795 % MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8796 % const double low,const double high)
8797 % MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8798 % const ChannelType channel,const double low,const double high)
8799 %
8800 % A description of each parameter follows:
8801 %
8802 % o wand: the magick wand.
8803 %
8804 % o channel: the image channel(s).
8805 %
8806 % o low,high: Specify the high and low thresholds. These values range from
8807 % 0 to QuantumRange.
8808 %
8809 */
8810 
8811 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8812  const double low,const double high)
8813 {
8814  MagickBooleanType
8815  status;
8816 
8817  status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8818  return(status);
8819 }
8820 
8821 WandExport MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8822  const ChannelType channel,const double low,const double high)
8823 {
8824  char
8825  threshold[MaxTextExtent];
8826 
8827  MagickBooleanType
8828  status;
8829 
8830  assert(wand != (MagickWand *) NULL);
8831  assert(wand->signature == WandSignature);
8832  if (wand->debug != MagickFalse)
8833  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8834  if (wand->images == (Image *) NULL)
8835  ThrowWandException(WandError,"ContainsNoImages",wand->name);
8836  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
8837  status=RandomThresholdImageChannel(wand->images,channel,threshold,
8838  wand->exception);
8839  if (status == MagickFalse)
8840  InheritException(wand->exception,&wand->images->exception);
8841  return(status);
8842 }
8843 
8844 /*
8845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8846 % %
8847 % %
8848 % %
8849 % M a g i c k R e a d I m a g e %
8850 % %
8851 % %
8852 % %
8853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8854 %
8855 % MagickReadImage() reads an image or image sequence. The images are inserted
8856 % at the current image pointer position. Use MagickSetFirstIterator(),
8857 % MagickSetLastIterator, or MagickSetIteratorIndex() to specify the current
8858 % image pointer position at the beginning of the image list, the end, or
8859 % anywhere in-between respectively.
8860 %
8861 % The format of the MagickReadImage method is:
8862 %
8863 % MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8864 %
8865 % A description of each parameter follows:
8866 %
8867 % o wand: the magick wand.
8868 %
8869 % o filename: the image filename.
8870 %
8871 */
8872 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8873  const char *filename)
8874 {
8875  Image
8876  *images;
8877 
8878  ImageInfo
8879  *read_info;
8880 
8881  assert(wand != (MagickWand *) NULL);
8882  assert(wand->signature == WandSignature);
8883  if (wand->debug != MagickFalse)
8884  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8885  read_info=CloneImageInfo(wand->image_info);
8886  if (filename != (const char *) NULL)
8887  (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8888  images=ReadImage(read_info,wand->exception);
8889  read_info=DestroyImageInfo(read_info);
8890  if (images == (Image *) NULL)
8891  return(MagickFalse);
8892  return(InsertImageInWand(wand,images));
8893 }
8894 
8895 /*
8896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8897 % %
8898 % %
8899 % %
8900 % M a g i c k R e a d I m a g e B l o b %
8901 % %
8902 % %
8903 % %
8904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8905 %
8906 % MagickReadImageBlob() reads an image or image sequence from a blob.
8907 %
8908 % The format of the MagickReadImageBlob method is:
8909 %
8910 % MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8911 % const void *blob,const size_t length)
8912 %
8913 % A description of each parameter follows:
8914 %
8915 % o wand: the magick wand.
8916 %
8917 % o blob: the blob.
8918 %
8919 % o length: the blob length.
8920 %
8921 */
8922 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8923  const void *blob,const size_t length)
8924 {
8925  Image
8926  *images;
8927 
8928  assert(wand != (MagickWand *) NULL);
8929  assert(wand->signature == WandSignature);
8930  if (wand->debug != MagickFalse)
8931  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8932  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8933  if (images == (Image *) NULL)
8934  return(MagickFalse);
8935  return(InsertImageInWand(wand,images));
8936 }
8937 
8938 /*
8939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8940 % %
8941 % %
8942 % %
8943 % M a g i c k R e a d I m a g e F i l e %
8944 % %
8945 % %
8946 % %
8947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8948 %
8949 % MagickReadImageFile() reads an image or image sequence from an open file
8950 % descriptor.
8951 %
8952 % The format of the MagickReadImageFile method is:
8953 %
8954 % MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8955 %
8956 % A description of each parameter follows:
8957 %
8958 % o wand: the magick wand.
8959 %
8960 % o file: the file descriptor.
8961 %
8962 */
8963 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8964 {
8965  Image
8966  *images;
8967 
8968  ImageInfo
8969  *read_info;
8970 
8971  assert(wand != (MagickWand *) NULL);
8972  assert(wand->signature == WandSignature);
8973  assert(file != (FILE *) NULL);
8974  if (wand->debug != MagickFalse)
8975  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8976  read_info=CloneImageInfo(wand->image_info);
8977  SetImageInfoFile(read_info,file);
8978  images=ReadImage(read_info,wand->exception);
8979  read_info=DestroyImageInfo(read_info);
8980  if (images == (Image *) NULL)
8981  return(MagickFalse);
8982  return(InsertImageInWand(wand,images));
8983 }
8984 
8985 /*
8986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8987 % %
8988 % %
8989 % %
8990 % M a g i c k R e m a p I m a g e %
8991 % %
8992 % %
8993 % %
8994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8995 %
8996 % MagickRemapImage() replaces the colors of an image with the closest color
8997 % from a reference image.
8998 %
8999 % The format of the MagickRemapImage method is:
9000 %
9001 % MagickBooleanType MagickRemapImage(MagickWand *wand,
9002 % const MagickWand *remap_wand,const DitherMethod method)
9003 %
9004 % A description of each parameter follows:
9005 %
9006 % o wand: the magick wand.
9007 %
9008 % o affinity: the affinity wand.
9009 %
9010 % o method: choose from these dither methods: NoDitherMethod,
9011 % RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
9012 %
9013 */
9014 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
9015  const MagickWand *remap_wand,const DitherMethod method)
9016 {
9017  MagickBooleanType
9018  status;
9019 
9020  QuantizeInfo
9021  *quantize_info;
9022 
9023  assert(wand != (MagickWand *) NULL);
9024  assert(wand->signature == WandSignature);
9025  if (wand->debug != MagickFalse)
9026  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9027  if ((wand->images == (Image *) NULL) ||
9028  (remap_wand->images == (Image *) NULL))
9029  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9030  quantize_info=AcquireQuantizeInfo(wand->image_info);
9031  quantize_info->dither_method=method;
9032  if (method == NoDitherMethod)
9033  quantize_info->dither=MagickFalse;
9034  status=RemapImage(quantize_info,wand->images,remap_wand->images);
9035  quantize_info=DestroyQuantizeInfo(quantize_info);
9036  if (status == MagickFalse)
9037  InheritException(wand->exception,&wand->images->exception);
9038  return(status);
9039 }
9040 
9041 /*
9042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9043 % %
9044 % %
9045 % %
9046 % M a g i c k R e m o v e I m a g e %
9047 % %
9048 % %
9049 % %
9050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9051 %
9052 % MagickRemoveImage() removes an image from the image list.
9053 %
9054 % The format of the MagickRemoveImage method is:
9055 %
9056 % MagickBooleanType MagickRemoveImage(MagickWand *wand)
9057 %
9058 % A description of each parameter follows:
9059 %
9060 % o wand: the magick wand.
9061 %
9062 % o insert: the splice wand.
9063 %
9064 */
9065 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
9066 {
9067  assert(wand != (MagickWand *) NULL);
9068  assert(wand->signature == WandSignature);
9069  if (wand->debug != MagickFalse)
9070  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9071  if (wand->images == (Image *) NULL)
9072  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9073  DeleteImageFromList(&wand->images);
9074  return(MagickTrue);
9075 }
9076 
9077 /*
9078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9079 % %
9080 % %
9081 % %
9082 % M a g i c k R e s a m p l e I m a g e %
9083 % %
9084 % %
9085 % %
9086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9087 %
9088 % MagickResampleImage() resample image to desired resolution.
9089 %
9090 % Bessel Blackman Box
9091 % Catrom Cubic Gaussian
9092 % Hanning Hermite Lanczos
9093 % Mitchell Point Quandratic
9094 % Sinc Triangle
9095 %
9096 % Most of the filters are FIR (finite impulse response), however, Bessel,
9097 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
9098 % are windowed (brought down to zero) with the Blackman filter.
9099 %
9100 % The format of the MagickResampleImage method is:
9101 %
9102 % MagickBooleanType MagickResampleImage(MagickWand *wand,
9103 % const double x_resolution,const double y_resolution,
9104 % const FilterTypes filter,const double blur)
9105 %
9106 % A description of each parameter follows:
9107 %
9108 % o wand: the magick wand.
9109 %
9110 % o x_resolution: the new image x resolution.
9111 %
9112 % o y_resolution: the new image y resolution.
9113 %
9114 % o filter: Image filter to use.
9115 %
9116 % o blur: the blur factor where > 1 is blurry, < 1 is sharp.
9117 %
9118 */
9119 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
9120  const double x_resolution,const double y_resolution,const FilterTypes filter,
9121  const double blur)
9122 {
9123  Image
9124  *resample_image;
9125 
9126  assert(wand != (MagickWand *) NULL);
9127  assert(wand->signature == WandSignature);
9128  if (wand->debug != MagickFalse)
9129  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9130  if (wand->images == (Image *) NULL)
9131  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9132  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
9133  blur,wand->exception);
9134  if (resample_image == (Image *) NULL)
9135  return(MagickFalse);
9136  ReplaceImageInList(&wand->images,resample_image);
9137  return(MagickTrue);
9138 }
9139 
9140 /*
9141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9142 % %
9143 % %
9144 % %
9145 % M a g i c k R e s e t I m a g e P a g e %
9146 % %
9147 % %
9148 % %
9149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9150 %
9151 % MagickResetImagePage() resets the Wand page canvas and position.
9152 %
9153 % The format of the MagickResetImagePage method is:
9154 %
9155 % MagickBooleanType MagickResetImagePage(MagickWand *wand,
9156 % const char *page)
9157 %
9158 % A description of each parameter follows:
9159 %
9160 % o wand: the magick wand.
9161 %
9162 % o page: the relative page specification.
9163 %
9164 */
9165 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
9166  const char *page)
9167 {
9168  assert(wand != (MagickWand *) NULL);
9169  assert(wand->signature == WandSignature);
9170  if (wand->debug != MagickFalse)
9171  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9172  if (wand->images == (Image *) NULL)
9173  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9174  if ((page == (char *) NULL) || (*page == '\0'))
9175  {
9176  (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
9177  return(MagickTrue);
9178  }
9179  return(ResetImagePage(wand->images,page));
9180 }
9181 
9182 /*
9183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9184 % %
9185 % %
9186 % %
9187 % M a g i c k R e s i z e I m a g e %
9188 % %
9189 % %
9190 % %
9191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9192 %
9193 % MagickResizeImage() scales an image to the desired dimensions with one of
9194 % these filters:
9195 %
9196 % Bessel Blackman Box
9197 % Catrom Cubic Gaussian
9198 % Hanning Hermite Lanczos
9199 % Mitchell Point Quandratic
9200 % Sinc Triangle
9201 %
9202 % Most of the filters are FIR (finite impulse response), however, Bessel,
9203 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc
9204 % are windowed (brought down to zero) with the Blackman filter.
9205 %
9206 % The format of the MagickResizeImage method is:
9207 %
9208 % MagickBooleanType MagickResizeImage(MagickWand *wand,
9209 % const size_t columns,const size_t rows,
9210 % const FilterTypes filter,const double blur)
9211 %
9212 % A description of each parameter follows:
9213 %
9214 % o wand: the magick wand.
9215 %
9216 % o columns: the number of columns in the scaled image.
9217 %
9218 % o rows: the number of rows in the scaled image.
9219 %
9220 % o filter: Image filter to use.
9221 %
9222 % o blur: the blur factor where > 1 is blurry, < 1 is sharp.
9223 %
9224 */
9225 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
9226  const size_t columns,const size_t rows,const FilterTypes filter,
9227  const double blur)
9228 {
9229  Image
9230  *resize_image;
9231 
9232  assert(wand != (MagickWand *) NULL);
9233  assert(wand->signature == WandSignature);
9234  if (wand->debug != MagickFalse)
9235  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9236  if (wand->images == (Image *) NULL)
9237  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9238  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
9239  wand->exception);
9240  if (resize_image == (Image *) NULL)
9241  return(MagickFalse);
9242  ReplaceImageInList(&wand->images,resize_image);
9243  return(MagickTrue);
9244 }
9245 
9246 /*
9247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9248 % %
9249 % %
9250 % %
9251 % M a g i c k R o l l I m a g e %
9252 % %
9253 % %
9254 % %
9255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9256 %
9257 % MagickRollImage() offsets an image as defined by x and y.
9258 %
9259 % The format of the MagickRollImage method is:
9260 %
9261 % MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
9262 % const size_t y)
9263 %
9264 % A description of each parameter follows:
9265 %
9266 % o wand: the magick wand.
9267 %
9268 % o x: the x offset.
9269 %
9270 % o y: the y offset.
9271 %
9272 */
9273 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
9274  const ssize_t y)
9275 {
9276  Image
9277  *roll_image;
9278 
9279  assert(wand != (MagickWand *) NULL);
9280  assert(wand->signature == WandSignature);
9281  if (wand->debug != MagickFalse)
9282  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9283  if (wand->images == (Image *) NULL)
9284  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9285  roll_image=RollImage(wand->images,x,y,wand->exception);
9286  if (roll_image == (Image *) NULL)
9287  return(MagickFalse);
9288  ReplaceImageInList(&wand->images,roll_image);
9289  return(MagickTrue);
9290 }
9291 
9292 /*
9293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9294 % %
9295 % %
9296 % %
9297 % M a g i c k R o t a t e I m a g e %
9298 % %
9299 % %
9300 % %
9301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9302 %
9303 % MagickRotateImage() rotates an image the specified number of degrees. Empty
9304 % triangles left over from rotating the image are filled with the
9305 % background color.
9306 %
9307 % The format of the MagickRotateImage method is:
9308 %
9309 % MagickBooleanType MagickRotateImage(MagickWand *wand,
9310 % const PixelWand *background,const double degrees)
9311 %
9312 % A description of each parameter follows:
9313 %
9314 % o wand: the magick wand.
9315 %
9316 % o background: the background pixel wand.
9317 %
9318 % o degrees: the number of degrees to rotate the image.
9319 %
9320 %
9321 */
9322 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
9323  const PixelWand *background,const double degrees)
9324 {
9325  Image
9326  *rotate_image;
9327 
9328  assert(wand != (MagickWand *) NULL);
9329  assert(wand->signature == WandSignature);
9330  if (wand->debug != MagickFalse)
9331  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9332  if (wand->images == (Image *) NULL)
9333  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9334  PixelGetQuantumColor(background,&wand->images->background_color);
9335  rotate_image=RotateImage(wand->images,degrees,wand->exception);
9336  if (rotate_image == (Image *) NULL)
9337  return(MagickFalse);
9338  ReplaceImageInList(&wand->images,rotate_image);
9339  return(MagickTrue);
9340 }
9341 
9342 /*
9343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9344 % %
9345 % %
9346 % %
9347 % 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 %
9348 % %
9349 % %
9350 % %
9351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9352 %
9353 % MagickRotationalBlurImage() rotational blurs an image.
9354 %
9355 % The format of the MagickRotationalBlurImage method is:
9356 %
9357 % MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
9358 % const double angle)
9359 % MagickBooleanType MagickRotationalBlurImageChannel(MagickWand *wand,
9360 % const ChannelType channel,const double angle)
9361 %
9362 % A description of each parameter follows:
9363 %
9364 % o wand: the magick wand.
9365 %
9366 % o channel: the image channel(s).
9367 %
9368 % o angle: the angle of the blur in degrees.
9369 %
9370 */
9371 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
9372  const double angle)
9373 {
9374  MagickBooleanType
9375  status;
9376 
9377  status=MagickRotationalBlurImageChannel(wand,DefaultChannels,angle);
9378  return(status);
9379 }
9380 
9381 WandExport MagickBooleanType MagickRotationalBlurImageChannel(MagickWand *wand,
9382  const ChannelType channel,const double angle)
9383 {
9384  Image
9385  *blur_image;
9386 
9387  assert(wand != (MagickWand *) NULL);
9388  assert(wand->signature == WandSignature);
9389  if (wand->debug != MagickFalse)
9390  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9391  if (wand->images == (Image *) NULL)
9392  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9393  blur_image=RotationalBlurImageChannel(wand->images,channel,angle,
9394  wand->exception);
9395  if (blur_image == (Image *) NULL)
9396  return(MagickFalse);
9397  ReplaceImageInList(&wand->images,blur_image);
9398  return(MagickTrue);
9399 }
9400 
9401 /*
9402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9403 % %
9404 % %
9405 % %
9406 % M a g i c k S a m p l e I m a g e %
9407 % %
9408 % %
9409 % %
9410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9411 %
9412 % MagickSampleImage() scales an image to the desired dimensions with pixel
9413 % sampling. Unlike other scaling methods, this method does not introduce
9414 % any additional color into the scaled image.
9415 %
9416 % The format of the MagickSampleImage method is:
9417 %
9418 % MagickBooleanType MagickSampleImage(MagickWand *wand,
9419 % const size_t columns,const size_t rows)
9420 %
9421 % A description of each parameter follows:
9422 %
9423 % o wand: the magick wand.
9424 %
9425 % o columns: the number of columns in the scaled image.
9426 %
9427 % o rows: the number of rows in the scaled image.
9428 %
9429 */
9430 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9431  const size_t columns,const size_t rows)
9432 {
9433  Image
9434  *sample_image;
9435 
9436  assert(wand != (MagickWand *) NULL);
9437  assert(wand->signature == WandSignature);
9438  if (wand->debug != MagickFalse)
9439  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9440  if (wand->images == (Image *) NULL)
9441  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9442  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9443  if (sample_image == (Image *) NULL)
9444  return(MagickFalse);
9445  ReplaceImageInList(&wand->images,sample_image);
9446  return(MagickTrue);
9447 }
9448 
9449 /*
9450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9451 % %
9452 % %
9453 % %
9454 % M a g i c k S c a l e I m a g e %
9455 % %
9456 % %
9457 % %
9458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9459 %
9460 % MagickScaleImage() scales the size of an image to the given dimensions.
9461 %
9462 % The format of the MagickScaleImage method is:
9463 %
9464 % MagickBooleanType MagickScaleImage(MagickWand *wand,
9465 % const size_t columns,const size_t rows)
9466 %
9467 % A description of each parameter follows:
9468 %
9469 % o wand: the magick wand.
9470 %
9471 % o columns: the number of columns in the scaled image.
9472 %
9473 % o rows: the number of rows in the scaled image.
9474 %
9475 */
9476 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9477  const size_t columns,const size_t rows)
9478 {
9479  Image
9480  *scale_image;
9481 
9482  assert(wand != (MagickWand *) NULL);
9483  assert(wand->signature == WandSignature);
9484  if (wand->debug != MagickFalse)
9485  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9486  if (wand->images == (Image *) NULL)
9487  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9488  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9489  if (scale_image == (Image *) NULL)
9490  return(MagickFalse);
9491  ReplaceImageInList(&wand->images,scale_image);
9492  return(MagickTrue);
9493 }
9494 
9495 /*
9496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9497 % %
9498 % %
9499 % %
9500 % M a g i c k S e g m e n t I m a g e %
9501 % %
9502 % %
9503 % %
9504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9505 %
9506 % MagickSegmentImage() segments an image by analyzing the histograms of the
9507 % color components and identifying units that are homogeneous with the fuzzy
9508 % C-means technique.
9509 %
9510 % The format of the SegmentImage method is:
9511 %
9512 % MagickBooleanType MagickSegmentImage(MagickWand *wand,
9513 % const ColorspaceType colorspace,const MagickBooleanType verbose,
9514 % const double cluster_threshold,const double smooth_threshold)
9515 %
9516 % A description of each parameter follows.
9517 %
9518 % o wand: the wand.
9519 %
9520 % o colorspace: the image colorspace.
9521 %
9522 % o verbose: Set to MagickTrue to print detailed information about the
9523 % identified classes.
9524 %
9525 % o cluster_threshold: This represents the minimum number of pixels
9526 % contained in a hexahedra before it can be considered valid (expressed as
9527 % a percentage).
9528 %
9529 % o smooth_threshold: the smoothing threshold eliminates noise in the second
9530 % derivative of the histogram. As the value is increased, you can expect a
9531 % smoother second derivative.
9532 %
9533 */
9534 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9535  const ColorspaceType colorspace,const MagickBooleanType verbose,
9536  const double cluster_threshold,const double smooth_threshold)
9537 {
9538  MagickBooleanType
9539  status;
9540 
9541  assert(wand != (MagickWand *) NULL);
9542  assert(wand->signature == WandSignature);
9543  if (wand->debug != MagickFalse)
9544  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9545  if (wand->images == (Image *) NULL)
9546  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9547  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9548  smooth_threshold);
9549  if (status == MagickFalse)
9550  InheritException(wand->exception,&wand->images->exception);
9551  return(status);
9552 }
9553 
9554 /*
9555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9556 % %
9557 % %
9558 % %
9559 % M a g i c k S e l e c t i v e B l u r I m a g e %
9560 % %
9561 % %
9562 % %
9563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9564 %
9565 % MagickSelectiveBlurImage() selectively blur an image within a contrast
9566 % threshold. It is similar to the unsharpen mask that sharpens everything with
9567 % contrast above a certain threshold.
9568 %
9569 % The format of the MagickSelectiveBlurImage method is:
9570 %
9571 % MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9572 % const double radius,const double sigma,const double threshold)
9573 % MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9574 % const ChannelType channel,const double radius,const double sigma,
9575 % const double threshold)
9576 %
9577 % A description of each parameter follows:
9578 %
9579 % o wand: the magick wand.
9580 %
9581 % o channel: the image channel(s).
9582 %
9583 % o radius: the radius of the gaussian, in pixels, not counting the center
9584 % pixel.
9585 %
9586 % o sigma: the standard deviation of the gaussian, in pixels.
9587 %
9588 % o threshold: only pixels within this contrast threshold are included
9589 % in the blur operation.
9590 %
9591 */
9592 
9593 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9594  const double radius,const double sigma,const double threshold)
9595 {
9596  MagickBooleanType
9597  status;
9598 
9599  status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9600  threshold);
9601  return(status);
9602 }
9603 
9604 WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9605  const ChannelType channel,const double radius,const double sigma,
9606  const double threshold)
9607 {
9608  Image
9609  *blur_image;
9610 
9611  assert(wand != (MagickWand *) NULL);
9612  assert(wand->signature == WandSignature);
9613  if (wand->debug != MagickFalse)
9614  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9615  if (wand->images == (Image *) NULL)
9616  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9617  blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9618  threshold,wand->exception);
9619  if (blur_image == (Image *) NULL)
9620  return(MagickFalse);
9621  ReplaceImageInList(&wand->images,blur_image);
9622  return(MagickTrue);
9623 }
9624 
9625 /*
9626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9627 % %
9628 % %
9629 % %
9630 % 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 %
9631 % %
9632 % %
9633 % %
9634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9635 %
9636 % MagickSeparateImageChannel() separates a channel from the image and returns a
9637 % grayscale image. A channel is a particular color component of each pixel
9638 % in the image.
9639 %
9640 % The format of the MagickSeparateImageChannel method is:
9641 %
9642 % MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9643 % const ChannelType channel)
9644 %
9645 % A description of each parameter follows:
9646 %
9647 % o wand: the magick wand.
9648 %
9649 % o channel: the image channel(s).
9650 %
9651 */
9652 WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9653  const ChannelType channel)
9654 {
9655  MagickBooleanType
9656  status;
9657 
9658  assert(wand != (MagickWand *) NULL);
9659  assert(wand->signature == WandSignature);
9660  if (wand->debug != MagickFalse)
9661  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9662  if (wand->images == (Image *) NULL)
9663  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9664  status=SeparateImageChannel(wand->images,channel);
9665  if (status == MagickFalse)
9666  InheritException(wand->exception,&wand->images->exception);
9667  return(status);
9668 }
9669 
9670 /*
9671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9672 % %
9673 % %
9674 % %
9675 % M a g i c k S e p i a T o n e I m a g e %
9676 % %
9677 % %
9678 % %
9679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9680 %
9681 % MagickSepiaToneImage() applies a special effect to the image, similar to the
9682 % effect achieved in a photo darkroom by sepia toning. Threshold ranges from
9683 % 0 to QuantumRange and is a measure of the extent of the sepia toning. A
9684 % threshold of 80% is a good starting point for a reasonable tone.
9685 %
9686 % The format of the MagickSepiaToneImage method is:
9687 %
9688 % MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9689 % const double threshold)
9690 %
9691 % A description of each parameter follows:
9692 %
9693 % o wand: the magick wand.
9694 %
9695 % o threshold: Define the extent of the sepia toning.
9696 %
9697 */
9698 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9699  const double threshold)
9700 {
9701  Image
9702  *sepia_image;
9703 
9704  assert(wand != (MagickWand *) NULL);
9705  assert(wand->signature == WandSignature);
9706  if (wand->debug != MagickFalse)
9707  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9708  if (wand->images == (Image *) NULL)
9709  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9710  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9711  if (sepia_image == (Image *) NULL)
9712  return(MagickFalse);
9713  ReplaceImageInList(&wand->images,sepia_image);
9714  return(MagickTrue);
9715 }
9716 
9717 /*
9718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9719 % %
9720 % %
9721 % %
9722 % M a g i c k S e t I m a g e %
9723 % %
9724 % %
9725 % %
9726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9727 %
9728 % MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
9729 % MagickNextImage(), MagickPreviousImage() with the images from the specified
9730 % wand.
9731 %
9732 % The format of the MagickSetImage method is:
9733 %
9734 % MagickBooleanType MagickSetImage(MagickWand *wand,
9735 % const MagickWand *set_wand)
9736 %
9737 % A description of each parameter follows:
9738 %
9739 % o wand: the magick wand.
9740 %
9741 % o set_wand: the set_wand wand.
9742 %
9743 */
9744 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9745  const MagickWand *set_wand)
9746 {
9747  Image
9748  *images;
9749 
9750  assert(wand != (MagickWand *) NULL);
9751  assert(wand->signature == WandSignature);
9752  if (wand->debug != MagickFalse)
9753  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9754  assert(set_wand != (MagickWand *) NULL);
9755  assert(set_wand->signature == WandSignature);
9756  if (wand->debug != MagickFalse)
9757  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9758  if (set_wand->images == (Image *) NULL)
9759  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9760  images=CloneImageList(set_wand->images,wand->exception);
9761  if (images == (Image *) NULL)
9762  return(MagickFalse);
9763  ReplaceImageInList(&wand->images,images);
9764  return(MagickTrue);
9765 }
9766 
9767 /*
9768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9769 % %
9770 % %
9771 % %
9772 % 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 %
9773 % %
9774 % %
9775 % %
9776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9777 %
9778 % MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9779 % alpha channel.
9780 %
9781 % The format of the MagickSetImageAlphaChannel method is:
9782 %
9783 % MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9784 % const AlphaChannelType alpha_type)
9785 %
9786 % A description of each parameter follows:
9787 %
9788 % o wand: the magick wand.
9789 %
9790 % o alpha_type: the alpha channel type: ActivateAlphaChannel,
9791 % DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9792 %
9793 */
9794 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9795  const AlphaChannelType alpha_type)
9796 {
9797  assert(wand != (MagickWand *) NULL);
9798  assert(wand->signature == WandSignature);
9799  if (wand->debug != MagickFalse)
9800  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9801  if (wand->images == (Image *) NULL)
9802  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9803  return(SetImageAlphaChannel(wand->images,alpha_type));
9804 }
9805 
9806 /*
9807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9808 % %
9809 % %
9810 % %
9811 % 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 %
9812 % %
9813 % %
9814 % %
9815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9816 %
9817 % MagickSetImageBackgroundColor() sets the image background color.
9818 %
9819 % The format of the MagickSetImageBackgroundColor method is:
9820 %
9821 % MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9822 % const PixelWand *background)
9823 %
9824 % A description of each parameter follows:
9825 %
9826 % o wand: the magick wand.
9827 %
9828 % o background: the background pixel wand.
9829 %
9830 */
9831 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9832  const PixelWand *background)
9833 {
9834  assert(wand != (MagickWand *) NULL);
9835  assert(wand->signature == WandSignature);
9836  if (wand->debug != MagickFalse)
9837  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9838  if (wand->images == (Image *) NULL)
9839  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9840  PixelGetQuantumColor(background,&wand->images->background_color);
9841  return(MagickTrue);
9842 }
9843 
9844 /*
9845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9846 % %
9847 % %
9848 % %
9849 % M a g i c k S e t I m a g e B i a s %
9850 % %
9851 % %
9852 % %
9853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9854 %
9855 % MagickSetImageBias() sets the image bias for any method that convolves an
9856 % image (e.g. MagickConvolveImage()).
9857 %
9858 % The format of the MagickSetImageBias method is:
9859 %
9860 % MagickBooleanType MagickSetImageBias(MagickWand *wand,
9861 % const double bias)
9862 %
9863 % A description of each parameter follows:
9864 %
9865 % o wand: the magick wand.
9866 %
9867 % o bias: the image bias.
9868 %
9869 */
9870 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9871  const double bias)
9872 {
9873  char
9874  option[MaxTextExtent];
9875 
9876  assert(wand != (MagickWand *) NULL);
9877  assert(wand->signature == WandSignature);
9878  if (wand->debug != MagickFalse)
9879  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9880  if (wand->images == (Image *) NULL)
9881  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9882  (void) FormatLocaleString(option,MaxTextExtent,"%+g",bias);
9883  (void) SetImageOption(wand->image_info,"bias",option);
9884  return(MagickTrue);
9885 }
9886 
9887 /*
9888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9889 % %
9890 % %
9891 % %
9892 % 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 %
9893 % %
9894 % %
9895 % %
9896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9897 %
9898 % MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9899 %
9900 % The format of the MagickSetImageBluePrimary method is:
9901 %
9902 % MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9903 % const double x,const double y)
9904 %
9905 % A description of each parameter follows:
9906 %
9907 % o wand: the magick wand.
9908 %
9909 % o x: the blue primary x-point.
9910 %
9911 % o y: the blue primary y-point.
9912 %
9913 */
9914 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9915  const double x,const double y)
9916 {
9917  assert(wand != (MagickWand *) NULL);
9918  assert(wand->signature == WandSignature);
9919  if (wand->debug != MagickFalse)
9920  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9921  if (wand->images == (Image *) NULL)
9922  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9923  wand->images->chromaticity.blue_primary.x=x;
9924  wand->images->chromaticity.blue_primary.y=y;
9925  return(MagickTrue);
9926 }
9927 
9928 /*
9929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9930 % %
9931 % %
9932 % %
9933 % 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 %
9934 % %
9935 % %
9936 % %
9937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9938 %
9939 % MagickSetImageBorderColor() sets the image border color.
9940 %
9941 % The format of the MagickSetImageBorderColor method is:
9942 %
9943 % MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9944 % const PixelWand *border)
9945 %
9946 % A description of each parameter follows:
9947 %
9948 % o wand: the magick wand.
9949 %
9950 % o border: the border pixel wand.
9951 %
9952 */
9953 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9954  const PixelWand *border)
9955 {
9956  assert(wand != (MagickWand *) NULL);
9957  assert(wand->signature == WandSignature);
9958  if (wand->debug != MagickFalse)
9959  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9960  if (wand->images == (Image *) NULL)
9961  ThrowWandException(WandError,"ContainsNoImages",wand->name);
9962  PixelGetQuantumColor(border,&wand->images->border_color);
9963  return(MagickTrue);
9964 }
9965 
9966 /*
9967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9968 % %
9969 % %
9970 % %
9971 % 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 %
9972 % %
9973 % %
9974 % %
9975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9976 %
9977 % MagickSetImageChannelDepth() sets the depth of a particular image channel.
9978 %
9979 % The format of the MagickSetImageChannelDepth method is:
9980 %
9981 % MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9982 % const ChannelType channel,const size_t depth)
9983 %
9984 % A description of each parameter follows:
9985 %
9986 % o wand: the magick wand.
9987 %
9988 % o channel: the image channel(s).
9989 %
9990 % o depth: the image depth in bits.
9991 %
9992 */
9993 WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9994  const ChannelType channel,const size_t depth)
9995 {
9996  assert(wand != (MagickWand *) NULL);
9997  assert(wand->signature == WandSignature);
9998  if (wand->debug != MagickFalse)
9999  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10000  if (wand->images == (Image *) NULL)
10001  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10002  return(SetImageChannelDepth(wand->images,channel,depth));
10003 }
10004 
10005 /*
10006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10007 % %
10008 % %
10009 % %
10010 % M a g i c k S e t I m a g e C l i p M a s k %
10011 % %
10012 % %
10013 % %
10014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10015 %
10016 % MagickSetImageClipMask() sets image clip mask.
10017 %
10018 % The format of the MagickSetImageClipMask method is:
10019 %
10020 % MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
10021 % const MagickWand *clip_mask)
10022 %
10023 % A description of each parameter follows:
10024 %
10025 % o wand: the magick wand.
10026 %
10027 % o clip_mask: the clip_mask wand.
10028 %
10029 */
10030 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
10031  const MagickWand *clip_mask)
10032 {
10033  assert(wand != (MagickWand *) NULL);
10034  assert(wand->signature == WandSignature);
10035  if (wand->debug != MagickFalse)
10036  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10037  assert(clip_mask != (MagickWand *) NULL);
10038  assert(clip_mask->signature == WandSignature);
10039  if (clip_mask->debug != MagickFalse)
10040  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
10041  if (clip_mask->images == (Image *) NULL)
10042  ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
10043  return(SetImageClipMask(wand->images,clip_mask->images));
10044 }
10045 
10046 /*
10047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10048 % %
10049 % %
10050 % %
10051 % M a g i c k S e t I m a g e C o l o r %
10052 % %
10053 % %
10054 % %
10055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10056 %
10057 % MagickSetImageColor() set the entire wand canvas to the specified color.
10058 %
10059 % The format of the MagickSetImageColor method is:
10060 %
10061 % MagickBooleanType MagickSetImageColor(MagickWand *wand,
10062 % const PixelWand *color)
10063 %
10064 % A description of each parameter follows:
10065 %
10066 % o wand: the magick wand.
10067 %
10068 % o background: the image color.
10069 %
10070 */
10071 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
10072  const PixelWand *color)
10073 {
10074  MagickBooleanType
10075  status;
10076 
10077  MagickPixelPacket
10078  pixel;
10079 
10080  assert(wand != (MagickWand *) NULL);
10081  assert(wand->signature == WandSignature);
10082  if (wand->debug != MagickFalse)
10083  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10084  PixelGetMagickColor(color,&pixel);
10085  status=SetImageColor(wand->images,&pixel);
10086  if (status == MagickFalse)
10087  InheritException(wand->exception,&wand->images->exception);
10088  return(status);
10089 }
10090 
10091 /*
10092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093 % %
10094 % %
10095 % %
10096 % 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 %
10097 % %
10098 % %
10099 % %
10100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10101 %
10102 % MagickSetImageColormapColor() sets the color of the specified colormap
10103 % index.
10104 %
10105 % The format of the MagickSetImageColormapColor method is:
10106 %
10107 % MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10108 % const size_t index,const PixelWand *color)
10109 %
10110 % A description of each parameter follows:
10111 %
10112 % o wand: the magick wand.
10113 %
10114 % o index: the offset into the image colormap.
10115 %
10116 % o color: Return the colormap color in this wand.
10117 %
10118 */
10119 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
10120  const size_t index,const PixelWand *color)
10121 {
10122  assert(wand != (MagickWand *) NULL);
10123  assert(wand->signature == WandSignature);
10124  if (wand->debug != MagickFalse)
10125  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10126  if (wand->images == (Image *) NULL)
10127  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10128  if ((wand->images->colormap == (PixelPacket *) NULL) ||
10129  (index >= wand->images->colors))
10130  ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
10131  PixelGetQuantumColor(color,wand->images->colormap+index);
10132  return(SyncImage(wand->images));
10133 }
10134 
10135 /*
10136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10137 % %
10138 % %
10139 % %
10140 % M a g i c k S e t I m a g e C o l o r s p a c e %
10141 % %
10142 % %
10143 % %
10144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10145 %
10146 % MagickSetImageColorspace() sets the image colorspace.
10147 %
10148 % The format of the MagickSetImageColorspace method is:
10149 %
10150 % MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10151 % const ColorspaceType colorspace)
10152 %
10153 % A description of each parameter follows:
10154 %
10155 % o wand: the magick wand.
10156 %
10157 % o colorspace: the image colorspace: UndefinedColorspace, RGBColorspace,
10158 % GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
10159 % YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
10160 % YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
10161 % HSLColorspace, or HWBColorspace.
10162 %
10163 */
10164 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
10165  const ColorspaceType colorspace)
10166 {
10167  assert(wand != (MagickWand *) NULL);
10168  assert(wand->signature == WandSignature);
10169  if (wand->debug != MagickFalse)
10170  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10171  if (wand->images == (Image *) NULL)
10172  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10173  return(SetImageColorspace(wand->images,colorspace));
10174 }
10175 
10176 /*
10177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10178 % %
10179 % %
10180 % %
10181 % M a g i c k S e t I m a g e C o m p o s e %
10182 % %
10183 % %
10184 % %
10185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10186 %
10187 % MagickSetImageCompose() sets the image composite operator, useful for
10188 % specifying how to composite the image thumbnail when using the
10189 % MagickMontageImage() method.
10190 %
10191 % The format of the MagickSetImageCompose method is:
10192 %
10193 % MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10194 % const CompositeOperator compose)
10195 %
10196 % A description of each parameter follows:
10197 %
10198 % o wand: the magick wand.
10199 %
10200 % o compose: the image composite operator.
10201 %
10202 */
10203 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
10204  const CompositeOperator compose)
10205 {
10206  assert(wand != (MagickWand *) NULL);
10207  assert(wand->signature == WandSignature);
10208  if (wand->debug != MagickFalse)
10209  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10210  if (wand->images == (Image *) NULL)
10211  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10212  wand->images->compose=compose;
10213  return(MagickTrue);
10214 }
10215 
10216 /*
10217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10218 % %
10219 % %
10220 % %
10221 % 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 %
10222 % %
10223 % %
10224 % %
10225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10226 %
10227 % MagickSetImageCompression() sets the image compression.
10228 %
10229 % The format of the MagickSetImageCompression method is:
10230 %
10231 % MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10232 % const CompressionType compression)
10233 %
10234 % A description of each parameter follows:
10235 %
10236 % o wand: the magick wand.
10237 %
10238 % o compression: the image compression type.
10239 %
10240 */
10241 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
10242  const CompressionType compression)
10243 {
10244  assert(wand != (MagickWand *) NULL);
10245  assert(wand->signature == WandSignature);
10246  if (wand->debug != MagickFalse)
10247  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10248  if (wand->images == (Image *) NULL)
10249  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10250  wand->images->compression=compression;
10251  return(MagickTrue);
10252 }
10253 
10254 /*
10255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10256 % %
10257 % %
10258 % %
10259 % 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 %
10260 % %
10261 % %
10262 % %
10263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10264 %
10265 % MagickSetImageCompressionQuality() sets the image compression quality.
10266 %
10267 % The format of the MagickSetImageCompressionQuality method is:
10268 %
10269 % MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10270 % const size_t quality)
10271 %
10272 % A description of each parameter follows:
10273 %
10274 % o wand: the magick wand.
10275 %
10276 % o quality: the image compression tlityype.
10277 %
10278 */
10279 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
10280  const size_t quality)
10281 {
10282  assert(wand != (MagickWand *) NULL);
10283  assert(wand->signature == WandSignature);
10284  if (wand->debug != MagickFalse)
10285  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10286  if (wand->images == (Image *) NULL)
10287  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10288  wand->images->quality=quality;
10289  return(MagickTrue);
10290 }
10291 
10292 /*
10293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10294 % %
10295 % %
10296 % %
10297 % M a g i c k S e t I m a g e D e l a y %
10298 % %
10299 % %
10300 % %
10301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10302 %
10303 % MagickSetImageDelay() sets the image delay.
10304 %
10305 % The format of the MagickSetImageDelay method is:
10306 %
10307 % MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10308 % const size_t delay)
10309 %
10310 % A description of each parameter follows:
10311 %
10312 % o wand: the magick wand.
10313 %
10314 % o delay: the image delay in ticks-per-second units.
10315 %
10316 */
10317 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
10318  const size_t delay)
10319 {
10320  assert(wand != (MagickWand *) NULL);
10321  assert(wand->signature == WandSignature);
10322  if (wand->debug != MagickFalse)
10323  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10324  if (wand->images == (Image *) NULL)
10325  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10326  wand->images->delay=delay;
10327  return(MagickTrue);
10328 }
10329 
10330 /*
10331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10332 % %
10333 % %
10334 % %
10335 % M a g i c k S e t I m a g e D e p t h %
10336 % %
10337 % %
10338 % %
10339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10340 %
10341 % MagickSetImageDepth() sets the image depth.
10342 %
10343 % The format of the MagickSetImageDepth method is:
10344 %
10345 % MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10346 % const size_t depth)
10347 %
10348 % A description of each parameter follows:
10349 %
10350 % o wand: the magick wand.
10351 %
10352 % o depth: the image depth in bits: 8, 16, or 32.
10353 %
10354 */
10355 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
10356  const size_t depth)
10357 {
10358  assert(wand != (MagickWand *) NULL);
10359  assert(wand->signature == WandSignature);
10360  if (wand->debug != MagickFalse)
10361  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10362  if (wand->images == (Image *) NULL)
10363  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10364  wand->images->depth=depth;
10365  return(MagickTrue);
10366 }
10367 
10368 /*
10369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10370 % %
10371 % %
10372 % %
10373 % M a g i c k S e t I m a g e D i s p o s e %
10374 % %
10375 % %
10376 % %
10377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10378 %
10379 % MagickSetImageDispose() sets the image disposal method.
10380 %
10381 % The format of the MagickSetImageDispose method is:
10382 %
10383 % MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10384 % const DisposeType dispose)
10385 %
10386 % A description of each parameter follows:
10387 %
10388 % o wand: the magick wand.
10389 %
10390 % o dispose: the image disposeal type.
10391 %
10392 */
10393 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10394  const DisposeType dispose)
10395 {
10396  assert(wand != (MagickWand *) NULL);
10397  assert(wand->signature == WandSignature);
10398  if (wand->debug != MagickFalse)
10399  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10400  if (wand->images == (Image *) NULL)
10401  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10402  wand->images->dispose=dispose;
10403  return(MagickTrue);
10404 }
10405 
10406 /*
10407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10408 % %
10409 % %
10410 % %
10411 % M a g i c k S e t I m a g e E n d i a n %
10412 % %
10413 % %
10414 % %
10415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10416 %
10417 % MagickSetImageEndian() sets the image endian method.
10418 %
10419 % The format of the MagickSetImageEndian method is:
10420 %
10421 % MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10422 % const EndianType endian)
10423 %
10424 % A description of each parameter follows:
10425 %
10426 % o wand: the magick wand.
10427 %
10428 % o endian: the image endian type.
10429 %
10430 */
10431 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
10432  const EndianType endian)
10433 {
10434  assert(wand != (MagickWand *) NULL);
10435  assert(wand->signature == WandSignature);
10436  if (wand->debug != MagickFalse)
10437  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10438  if (wand->images == (Image *) NULL)
10439  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10440  wand->images->endian=endian;
10441  return(MagickTrue);
10442 }
10443 
10444 /*
10445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10446 % %
10447 % %
10448 % %
10449 % M a g i c k S e t I m a g e E x t e n t %
10450 % %
10451 % %
10452 % %
10453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10454 %
10455 % MagickSetImageExtent() sets the image size (i.e. columns & rows).
10456 %
10457 % The format of the MagickSetImageExtent method is:
10458 %
10459 % MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10460 % const size_t columns,const unsigned rows)
10461 %
10462 % A description of each parameter follows:
10463 %
10464 % o wand: the magick wand.
10465 %
10466 % o columns: The image width in pixels.
10467 %
10468 % o rows: The image height in pixels.
10469 %
10470 */
10471 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10472  const size_t columns,const size_t rows)
10473 {
10474  assert(wand != (MagickWand *) NULL);
10475  assert(wand->signature == WandSignature);
10476  if (wand->debug != MagickFalse)
10477  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10478  if (wand->images == (Image *) NULL)
10479  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10480  return(SetImageExtent(wand->images,columns,rows));
10481 }
10482 
10483 /*
10484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10485 % %
10486 % %
10487 % %
10488 % M a g i c k S e t I m a g e F i l e n a m e %
10489 % %
10490 % %
10491 % %
10492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10493 %
10494 % MagickSetImageFilename() sets the filename of a particular image in a
10495 % sequence.
10496 %
10497 % The format of the MagickSetImageFilename method is:
10498 %
10499 % MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10500 % const char *filename)
10501 %
10502 % A description of each parameter follows:
10503 %
10504 % o wand: the magick wand.
10505 %
10506 % o filename: the image filename.
10507 %
10508 */
10509 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10510  const char *filename)
10511 {
10512  assert(wand != (MagickWand *) NULL);
10513  assert(wand->signature == WandSignature);
10514  if (wand->debug != MagickFalse)
10515  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10516  if (wand->images == (Image *) NULL)
10517  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10518  if (filename == (const char *) NULL)
10519  return(MagickFalse);
10520  (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
10521  return(MagickTrue);
10522 }
10523 
10524 /*
10525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10526 % %
10527 % %
10528 % %
10529 % M a g i c k S e t I m a g e F o r m a t %
10530 % %
10531 % %
10532 % %
10533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10534 %
10535 % MagickSetImageFormat() sets the format of a particular image in a
10536 % sequence.
10537 %
10538 % The format of the MagickSetImageFormat method is:
10539 %
10540 % MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10541 % const char *format)
10542 %
10543 % A description of each parameter follows:
10544 %
10545 % o wand: the magick wand.
10546 %
10547 % o format: the image format.
10548 %
10549 */
10550 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10551  const char *format)
10552 {
10553  const MagickInfo
10554  *magick_info;
10555 
10556  assert(wand != (MagickWand *) NULL);
10557  assert(wand->signature == WandSignature);
10558  if (wand->debug != MagickFalse)
10559  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10560  if (wand->images == (Image *) NULL)
10561  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10562  if ((format == (char *) NULL) || (*format == '\0'))
10563  {
10564  *wand->images->magick='\0';
10565  return(MagickTrue);
10566  }
10567  magick_info=GetMagickInfo(format,wand->exception);
10568  if (magick_info == (const MagickInfo *) NULL)
10569  return(MagickFalse);
10570  ClearMagickException(wand->exception);
10571  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
10572  LocaleUpper(wand->images->magick);
10573  return(MagickTrue);
10574 }
10575 
10576 /*
10577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10578 % %
10579 % %
10580 % %
10581 % M a g i c k S e t I m a g e F u z z %
10582 % %
10583 % %
10584 % %
10585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10586 %
10587 % MagickSetImageFuzz() sets the image fuzz.
10588 %
10589 % The format of the MagickSetImageFuzz method is:
10590 %
10591 % MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10592 % const double fuzz)
10593 %
10594 % A description of each parameter follows:
10595 %
10596 % o wand: the magick wand.
10597 %
10598 % o fuzz: the image fuzz.
10599 %
10600 */
10601 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10602  const double fuzz)
10603 {
10604  assert(wand != (MagickWand *) NULL);
10605  assert(wand->signature == WandSignature);
10606  if (wand->debug != MagickFalse)
10607  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10608  if (wand->images == (Image *) NULL)
10609  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10610  wand->images->fuzz=fuzz;
10611  return(MagickTrue);
10612 }
10613 
10614 /*
10615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10616 % %
10617 % %
10618 % %
10619 % M a g i c k S e t I m a g e G a m m a %
10620 % %
10621 % %
10622 % %
10623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10624 %
10625 % MagickSetImageGamma() sets the image gamma.
10626 %
10627 % The format of the MagickSetImageGamma method is:
10628 %
10629 % MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10630 % const double gamma)
10631 %
10632 % A description of each parameter follows:
10633 %
10634 % o wand: the magick wand.
10635 %
10636 % o gamma: the image gamma.
10637 %
10638 */
10639 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10640  const double gamma)
10641 {
10642  assert(wand != (MagickWand *) NULL);
10643  assert(wand->signature == WandSignature);
10644  if (wand->debug != MagickFalse)
10645  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10646  if (wand->images == (Image *) NULL)
10647  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10648  wand->images->gamma=gamma;
10649  return(MagickTrue);
10650 }
10651 
10652 /*
10653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10654 % %
10655 % %
10656 % %
10657 % M a g i c k S e t I m a g e G r a v i t y %
10658 % %
10659 % %
10660 % %
10661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10662 %
10663 % MagickSetImageGravity() sets the image gravity type.
10664 %
10665 % The format of the MagickSetImageGravity method is:
10666 %
10667 % MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10668 % const GravityType gravity)
10669 %
10670 % A description of each parameter follows:
10671 %
10672 % o wand: the magick wand.
10673 %
10674 % o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10675 % PlaneInterlace, PartitionInterlace.
10676 %
10677 */
10678 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10679  const GravityType gravity)
10680 {
10681  assert(wand != (MagickWand *) NULL);
10682  assert(wand->signature == WandSignature);
10683  if (wand->debug != MagickFalse)
10684  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10685  if (wand->images == (Image *) NULL)
10686  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10687  wand->images->gravity=gravity;
10688  return(MagickTrue);
10689 }
10690 
10691 /*
10692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10693 % %
10694 % %
10695 % %
10696 % 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 %
10697 % %
10698 % %
10699 % %
10700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10701 %
10702 % MagickSetImageGreenPrimary() sets the image chromaticity green primary
10703 % point.
10704 %
10705 % The format of the MagickSetImageGreenPrimary method is:
10706 %
10707 % MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10708 % const double x,const double y)
10709 %
10710 % A description of each parameter follows:
10711 %
10712 % o wand: the magick wand.
10713 %
10714 % o x: the green primary x-point.
10715 %
10716 % o y: the green primary y-point.
10717 %
10718 %
10719 */
10720 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10721  const double x,const double y)
10722 {
10723  assert(wand != (MagickWand *) NULL);
10724  assert(wand->signature == WandSignature);
10725  if (wand->debug != MagickFalse)
10726  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10727  if (wand->images == (Image *) NULL)
10728  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10729  wand->images->chromaticity.green_primary.x=x;
10730  wand->images->chromaticity.green_primary.y=y;
10731  return(MagickTrue);
10732 }
10733 
10734 /*
10735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10736 % %
10737 % %
10738 % %
10739 % 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 %
10740 % %
10741 % %
10742 % %
10743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10744 %
10745 % MagickSetImageInterlaceScheme() sets the image interlace scheme.
10746 %
10747 % The format of the MagickSetImageInterlaceScheme method is:
10748 %
10749 % MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10750 % const InterlaceType interlace)
10751 %
10752 % A description of each parameter follows:
10753 %
10754 % o wand: the magick wand.
10755 %
10756 % o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10757 % PlaneInterlace, PartitionInterlace.
10758 %
10759 */
10760 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10761  const InterlaceType interlace)
10762 {
10763  assert(wand != (MagickWand *) NULL);
10764  assert(wand->signature == WandSignature);
10765  if (wand->debug != MagickFalse)
10766  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10767  if (wand->images == (Image *) NULL)
10768  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10769  wand->images->interlace=interlace;
10770  return(MagickTrue);
10771 }
10772 
10773 /*
10774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10775 % %
10776 % %
10777 % %
10778 % 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 %
10779 % %
10780 % %
10781 % %
10782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10783 %
10784 % MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10785 %
10786 % The format of the MagickSetImageInterpolateMethod method is:
10787 %
10788 % MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10789 % const InterpolatePixelMethod method)
10790 %
10791 % A description of each parameter follows:
10792 %
10793 % o wand: the magick wand.
10794 %
10795 % o method: the image interpole pixel methods: choose from Undefined,
10796 % Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10797 %
10798 */
10799 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10800  const InterpolatePixelMethod method)
10801 {
10802  assert(wand != (MagickWand *) NULL);
10803  assert(wand->signature == WandSignature);
10804  if (wand->debug != MagickFalse)
10805  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10806  if (wand->images == (Image *) NULL)
10807  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10808  wand->images->interpolate=method;
10809  return(MagickTrue);
10810 }
10811 
10812 /*
10813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10814 % %
10815 % %
10816 % %
10817 % M a g i c k S e t I m a g e I t e r a t i o n s %
10818 % %
10819 % %
10820 % %
10821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10822 %
10823 % MagickSetImageIterations() sets the image iterations.
10824 %
10825 % The format of the MagickSetImageIterations method is:
10826 %
10827 % MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10828 % const size_t iterations)
10829 %
10830 % A description of each parameter follows:
10831 %
10832 % o wand: the magick wand.
10833 %
10834 % o delay: the image delay in 1/100th of a second.
10835 %
10836 */
10837 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10838  const size_t iterations)
10839 {
10840  assert(wand != (MagickWand *) NULL);
10841  assert(wand->signature == WandSignature);
10842  if (wand->debug != MagickFalse)
10843  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10844  if (wand->images == (Image *) NULL)
10845  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10846  wand->images->iterations=iterations;
10847  return(MagickTrue);
10848 }
10849 
10850 /*
10851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10852 % %
10853 % %
10854 % %
10855 % M a g i c k S e t I m a g e M a t t e %
10856 % %
10857 % %
10858 % %
10859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10860 %
10861 % MagickSetImageMatte() sets the image matte channel.
10862 %
10863 % The format of the MagickSetImageMatteColor method is:
10864 %
10865 % MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10866 % const MagickBooleanType *matte)
10867 %
10868 % A description of each parameter follows:
10869 %
10870 % o wand: the magick wand.
10871 %
10872 % o matte: Set to MagickTrue to enable the image matte channel otherwise
10873 % MagickFalse.
10874 %
10875 */
10876 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10877  const MagickBooleanType matte)
10878 {
10879  assert(wand != (MagickWand *) NULL);
10880  assert(wand->signature == WandSignature);
10881  if (wand->debug != MagickFalse)
10882  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10883  if (wand->images == (Image *) NULL)
10884  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10885  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10886  (void) SetImageOpacity(wand->images,OpaqueOpacity);
10887  wand->images->matte=matte;
10888  return(MagickTrue);
10889 }
10890 
10891 /*
10892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10893 % %
10894 % %
10895 % %
10896 % M a g i c k S e t I m a g e M a t t e C o l o r %
10897 % %
10898 % %
10899 % %
10900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10901 %
10902 % MagickSetImageMatteColor() sets the image matte color.
10903 %
10904 % The format of the MagickSetImageMatteColor method is:
10905 %
10906 % MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10907 % const PixelWand *matte)
10908 %
10909 % A description of each parameter follows:
10910 %
10911 % o wand: the magick wand.
10912 %
10913 % o matte: the matte pixel wand.
10914 %
10915 */
10916 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10917  const PixelWand *matte)
10918 {
10919  assert(wand != (MagickWand *) NULL);
10920  assert(wand->signature == WandSignature);
10921  if (wand->debug != MagickFalse)
10922  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10923  if (wand->images == (Image *) NULL)
10924  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10925  PixelGetQuantumColor(matte,&wand->images->matte_color);
10926  return(MagickTrue);
10927 }
10928 
10929 /*
10930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10931 % %
10932 % %
10933 % %
10934 % M a g i c k S e t I m a g e O p a c i t y %
10935 % %
10936 % %
10937 % %
10938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10939 %
10940 % MagickSetImageOpacity() sets the image to the specified opacity level.
10941 %
10942 % The format of the MagickSetImageOpacity method is:
10943 %
10944 % MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10945 % const double alpha)
10946 %
10947 % A description of each parameter follows:
10948 %
10949 % o wand: the magick wand.
10950 %
10951 % o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10952 % transparent.
10953 %
10954 */
10955 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10956  const double alpha)
10957 {
10958  MagickBooleanType
10959  status;
10960 
10961  assert(wand != (MagickWand *) NULL);
10962  assert(wand->signature == WandSignature);
10963  if (wand->debug != MagickFalse)
10964  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10965  if (wand->images == (Image *) NULL)
10966  ThrowWandException(WandError,"ContainsNoImages",wand->name);
10967  status=SetImageOpacity(wand->images,ClampToQuantum((MagickRealType)
10968  QuantumRange-QuantumRange*alpha));
10969  if (status == MagickFalse)
10970  InheritException(wand->exception,&wand->images->exception);
10971  return(status);
10972 }
10973 
10974 /*
10975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10976 % %
10977 % %
10978 % %
10979 % 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 %
10980 % %
10981 % %
10982 % %
10983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10984 %
10985 % MagickSetImageOrientation() sets the image orientation.
10986 %
10987 % The format of the MagickSetImageOrientation method is:
10988 %
10989 % MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10990 % const OrientationType orientation)
10991 %
10992 % A description of each parameter follows:
10993 %
10994 % o wand: the magick wand.
10995 %
10996 % o orientation: the image orientation type.
10997 %
10998 */
10999 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
11000  const OrientationType orientation)
11001 {
11002  assert(wand != (MagickWand *) NULL);
11003  assert(wand->signature == WandSignature);
11004  if (wand->debug != MagickFalse)
11005  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11006  if (wand->images == (Image *) NULL)
11007  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11008  wand->images->orientation=orientation;
11009  return(MagickTrue);
11010 }
11011 
11012 /*
11013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11014 % %
11015 % %
11016 % %
11017 % M a g i c k S e t I m a g e P a g e %
11018 % %
11019 % %
11020 % %
11021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11022 %
11023 % MagickSetImagePage() sets the page geometry of the image.
11024 %
11025 % The format of the MagickSetImagePage method is:
11026 %
11027 % MagickBooleanType MagickSetImagePage(MagickWand *wand,
11028 % const size_t width,const size_t height,const ssize_t x,
11029 % const ssize_t y)
11030 %
11031 % A description of each parameter follows:
11032 %
11033 % o wand: the magick wand.
11034 %
11035 % o width: the page width.
11036 %
11037 % o height: the page height.
11038 %
11039 % o x: the page x-offset.
11040 %
11041 % o y: the page y-offset.
11042 %
11043 */
11044 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
11045  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
11046 {
11047  assert(wand != (MagickWand *) NULL);
11048  assert(wand->signature == WandSignature);
11049  if (wand->debug != MagickFalse)
11050  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11051  if (wand->images == (Image *) NULL)
11052  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11053  wand->images->page.width=width;
11054  wand->images->page.height=height;
11055  wand->images->page.x=x;
11056  wand->images->page.y=y;
11057  return(MagickTrue);
11058 }
11059 
11060 /*
11061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11062 % %
11063 % %
11064 % %
11065 % M a g i c k S e t I m a g e P i x e l C o l o r %
11066 % %
11067 % %
11068 % %
11069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11070 %
11071 % MagickSetImagePixelColor() sets the color of the specified pixel.
11072 %
11073 % The format of the MagickSetImagePixelColor method is:
11074 %
11075 % MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11076 % const ssize_t x,const ssize_t y,const PixelWand *color)
11077 %
11078 % A description of each parameter follows:
11079 %
11080 % o wand: the magick wand.
11081 %
11082 % o x,y: the pixel offset into the image.
11083 %
11084 % o color: Return the colormap color in this wand.
11085 %
11086 */
11087 WandExport MagickBooleanType MagickSetImagePixelColor(MagickWand *wand,
11088  const ssize_t x,const ssize_t y,const PixelWand *color)
11089 {
11090  IndexPacket
11091  *indexes;
11092 
11093  PixelPacket
11094  *q;
11095 
11096  CacheView
11097  *image_view;
11098 
11099  assert(wand != (MagickWand *) NULL);
11100  assert(wand->signature == WandSignature);
11101  if (wand->debug != MagickFalse)
11102  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11103  if (wand->images == (Image *) NULL)
11104  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11105  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
11106  q=GetCacheViewAuthenticPixels(image_view,x,y,1,1,wand->exception);
11107  if (q == (PixelPacket *) NULL)
11108  {
11109  image_view=DestroyCacheView(image_view);
11110  return(MagickFalse);
11111  }
11112  indexes=GetCacheViewAuthenticIndexQueue(image_view);
11113  PixelGetQuantumColor(color,q);
11114  if (GetCacheViewColorspace(image_view) == CMYKColorspace)
11115  *indexes=PixelGetBlackQuantum(color);
11116  else
11117  if (GetCacheViewStorageClass(image_view) == PseudoClass)
11118  *indexes=PixelGetIndex(color);
11119  image_view=DestroyCacheView(image_view);
11120  return(MagickTrue);
11121 }
11122 
11123 /*
11124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11125 % %
11126 % %
11127 % %
11128 % 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 %
11129 % %
11130 % %
11131 % %
11132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11133 %
11134 % MagickSetImageProgressMonitor() sets the wand image progress monitor to the
11135 % specified method and returns the previous progress monitor if any. The
11136 % progress monitor method looks like this:
11137 %
11138 % MagickBooleanType MagickProgressMonitor(const char *text,
11139 % const MagickOffsetType offset,const MagickSizeType span,
11140 % void *client_data)
11141 %
11142 % If the progress monitor returns MagickFalse, the current operation is
11143 % interrupted.
11144 %
11145 % The format of the MagickSetImageProgressMonitor method is:
11146 %
11147 % MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
11148 % const MagickProgressMonitor progress_monitor,void *client_data)
11149 %
11150 % A description of each parameter follows:
11151 %
11152 % o wand: the magick wand.
11153 %
11154 % o progress_monitor: Specifies a pointer to a method to monitor progress
11155 % of an image operation.
11156 %
11157 % o client_data: Specifies a pointer to any client data.
11158 %
11159 */
11160 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
11161  const MagickProgressMonitor progress_monitor,void *client_data)
11162 {
11163  MagickProgressMonitor
11164  previous_monitor;
11165 
11166  assert(wand != (MagickWand *) NULL);
11167  assert(wand->signature == WandSignature);
11168  if (wand->debug != MagickFalse)
11169  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11170  if (wand->images == (Image *) NULL)
11171  {
11172  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11173  "ContainsNoImages","`%s'",wand->name);
11174  return((MagickProgressMonitor) NULL);
11175  }
11176  previous_monitor=SetImageProgressMonitor(wand->images,progress_monitor,
11177  client_data);
11178  return(previous_monitor);
11179 }
11180 
11181 /*
11182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11183 % %
11184 % %
11185 % %
11186 % M a g i c k S e t I m a g e R e d P r i m a r y %
11187 % %
11188 % %
11189 % %
11190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11191 %
11192 % MagickSetImageRedPrimary() sets the image chromaticity red primary point.
11193 %
11194 % The format of the MagickSetImageRedPrimary method is:
11195 %
11196 % MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11197 % const double x,const double y)
11198 %
11199 % A description of each parameter follows:
11200 %
11201 % o wand: the magick wand.
11202 %
11203 % o x: the red primary x-point.
11204 %
11205 % o y: the red primary y-point.
11206 %
11207 */
11208 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
11209  const double x,const double y)
11210 {
11211  assert(wand != (MagickWand *) NULL);
11212  assert(wand->signature == WandSignature);
11213  if (wand->debug != MagickFalse)
11214  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11215  if (wand->images == (Image *) NULL)
11216  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11217  wand->images->chromaticity.red_primary.x=x;
11218  wand->images->chromaticity.red_primary.y=y;
11219  return(MagickTrue);
11220 }
11221 
11222 /*
11223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11224 % %
11225 % %
11226 % %
11227 % 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 %
11228 % %
11229 % %
11230 % %
11231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11232 %
11233 % MagickSetImageRenderingIntent() sets the image rendering intent.
11234 %
11235 % The format of the MagickSetImageRenderingIntent method is:
11236 %
11237 % MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11238 % const RenderingIntent rendering_intent)
11239 %
11240 % A description of each parameter follows:
11241 %
11242 % o wand: the magick wand.
11243 %
11244 % o rendering_intent: the image rendering intent: UndefinedIntent,
11245 % SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
11246 %
11247 */
11248 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
11249  const RenderingIntent rendering_intent)
11250 {
11251  assert(wand != (MagickWand *) NULL);
11252  assert(wand->signature == WandSignature);
11253  if (wand->debug != MagickFalse)
11254  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11255  if (wand->images == (Image *) NULL)
11256  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11257  wand->images->rendering_intent=rendering_intent;
11258  return(MagickTrue);
11259 }
11260 
11261 /*
11262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11263 % %
11264 % %
11265 % %
11266 % M a g i c k S e t I m a g e R e s o l u t i o n %
11267 % %
11268 % %
11269 % %
11270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11271 %
11272 % MagickSetImageResolution() sets the image resolution.
11273 %
11274 % The format of the MagickSetImageResolution method is:
11275 %
11276 % MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11277 % const double x_resolution,const double y_resolution)
11278 %
11279 % A description of each parameter follows:
11280 %
11281 % o wand: the magick wand.
11282 %
11283 % o x_resolution: the image x resolution.
11284 %
11285 % o y_resolution: the image y resolution.
11286 %
11287 */
11288 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
11289  const double x_resolution,const double y_resolution)
11290 {
11291  assert(wand != (MagickWand *) NULL);
11292  assert(wand->signature == WandSignature);
11293  if (wand->debug != MagickFalse)
11294  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11295  if (wand->images == (Image *) NULL)
11296  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11297  wand->images->x_resolution=x_resolution;
11298  wand->images->y_resolution=y_resolution;
11299  return(MagickTrue);
11300 }
11301 
11302 /*
11303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11304 % %
11305 % %
11306 % %
11307 % M a g i c k S e t I m a g e S c e n e %
11308 % %
11309 % %
11310 % %
11311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11312 %
11313 % MagickSetImageScene() sets the image scene.
11314 %
11315 % The format of the MagickSetImageScene method is:
11316 %
11317 % MagickBooleanType MagickSetImageScene(MagickWand *wand,
11318 % const size_t scene)
11319 %
11320 % A description of each parameter follows:
11321 %
11322 % o wand: the magick wand.
11323 %
11324 % o delay: the image scene number.
11325 %
11326 */
11327 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
11328  const size_t scene)
11329 {
11330  assert(wand != (MagickWand *) NULL);
11331  assert(wand->signature == WandSignature);
11332  if (wand->debug != MagickFalse)
11333  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11334  if (wand->images == (Image *) NULL)
11335  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11336  wand->images->scene=scene;
11337  return(MagickTrue);
11338 }
11339 
11340 /*
11341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11342 % %
11343 % %
11344 % %
11345 % 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 %
11346 % %
11347 % %
11348 % %
11349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11350 %
11351 % MagickSetImageTicksPerSecond() sets the image ticks-per-second.
11352 %
11353 % The format of the MagickSetImageTicksPerSecond method is:
11354 %
11355 % MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11356 % const ssize_t ticks_per-second)
11357 %
11358 % A description of each parameter follows:
11359 %
11360 % o wand: the magick wand.
11361 %
11362 % o ticks_per_second: the units to use for the image delay.
11363 %
11364 */
11365 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
11366  const ssize_t ticks_per_second)
11367 {
11368  assert(wand != (MagickWand *) NULL);
11369  assert(wand->signature == WandSignature);
11370  if (wand->debug != MagickFalse)
11371  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11372  if (wand->images == (Image *) NULL)
11373  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11374  wand->images->ticks_per_second=ticks_per_second;
11375  return(MagickTrue);
11376 }
11377 
11378 /*
11379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11380 % %
11381 % %
11382 % %
11383 % M a g i c k S e t I m a g e T y p e %
11384 % %
11385 % %
11386 % %
11387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11388 %
11389 % MagickSetImageType() sets the image type.
11390 %
11391 % The format of the MagickSetImageType method is:
11392 %
11393 % MagickBooleanType MagickSetImageType(MagickWand *wand,
11394 % const ImageType image_type)
11395 %
11396 % A description of each parameter follows:
11397 %
11398 % o wand: the magick wand.
11399 %
11400 % o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
11401 % GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
11402 % TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
11403 % or OptimizeType.
11404 %
11405 */
11406 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
11407  const ImageType image_type)
11408 {
11409  assert(wand != (MagickWand *) NULL);
11410  assert(wand->signature == WandSignature);
11411  if (wand->debug != MagickFalse)
11412  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11413  if (wand->images == (Image *) NULL)
11414  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11415  return(SetImageType(wand->images,image_type));
11416 }
11417 
11418 /*
11419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11420 % %
11421 % %
11422 % %
11423 % M a g i c k S e t I m a g e U n i t s %
11424 % %
11425 % %
11426 % %
11427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11428 %
11429 % MagickSetImageUnits() sets the image units of resolution.
11430 %
11431 % The format of the MagickSetImageUnits method is:
11432 %
11433 % MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11434 % const ResolutionType units)
11435 %
11436 % A description of each parameter follows:
11437 %
11438 % o wand: the magick wand.
11439 %
11440 % o units: the image units of resolution : UndefinedResolution,
11441 % PixelsPerInchResolution, or PixelsPerCentimeterResolution.
11442 %
11443 */
11444 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
11445  const ResolutionType units)
11446 {
11447  assert(wand != (MagickWand *) NULL);
11448  assert(wand->signature == WandSignature);
11449  if (wand->debug != MagickFalse)
11450  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11451  if (wand->images == (Image *) NULL)
11452  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11453  wand->images->units=units;
11454  return(MagickTrue);
11455 }
11456 
11457 /*
11458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11459 % %
11460 % %
11461 % %
11462 % 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 %
11463 % %
11464 % %
11465 % %
11466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11467 %
11468 % MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
11469 %
11470 % The format of the MagickSetImageVirtualPixelMethod method is:
11471 %
11472 % VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11473 % const VirtualPixelMethod method)
11474 %
11475 % A description of each parameter follows:
11476 %
11477 % o wand: the magick wand.
11478 %
11479 % o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
11480 % ConstantVirtualPixelMethod, EdgeVirtualPixelMethod,
11481 % MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
11482 %
11483 */
11484 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
11485  const VirtualPixelMethod method)
11486 {
11487  assert(wand != (MagickWand *) NULL);
11488  assert(wand->signature == WandSignature);
11489  if (wand->debug != MagickFalse)
11490  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11491  if (wand->images == (Image *) NULL)
11492  return(UndefinedVirtualPixelMethod);
11493  return(SetImageVirtualPixelMethod(wand->images,method));
11494 }
11495 
11496 /*
11497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11498 % %
11499 % %
11500 % %
11501 % M a g i c k S e t I m a g e W h i t e P o i n t %
11502 % %
11503 % %
11504 % %
11505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11506 %
11507 % MagickSetImageWhitePoint() sets the image chromaticity white point.
11508 %
11509 % The format of the MagickSetImageWhitePoint method is:
11510 %
11511 % MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11512 % const double x,const double y)
11513 %
11514 % A description of each parameter follows:
11515 %
11516 % o wand: the magick wand.
11517 %
11518 % o x: the white x-point.
11519 %
11520 % o y: the white y-point.
11521 %
11522 */
11523 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11524  const double x,const double y)
11525 {
11526  assert(wand != (MagickWand *) NULL);
11527  assert(wand->signature == WandSignature);
11528  if (wand->debug != MagickFalse)
11529  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11530  if (wand->images == (Image *) NULL)
11531  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11532  wand->images->chromaticity.white_point.x=x;
11533  wand->images->chromaticity.white_point.y=y;
11534  return(MagickTrue);
11535 }
11536 
11537 /*
11538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11539 % %
11540 % %
11541 % %
11542 % M a g i c k S h a d e I m a g e C h a n n e l %
11543 % %
11544 % %
11545 % %
11546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11547 %
11548 % MagickShadeImage() shines a distant light on an image to create a
11549 % three-dimensional effect. You control the positioning of the light with
11550 % azimuth and elevation; azimuth is measured in degrees off the x axis
11551 % and elevation is measured in pixels above the Z axis.
11552 %
11553 % The format of the MagickShadeImage method is:
11554 %
11555 % MagickBooleanType MagickShadeImage(MagickWand *wand,
11556 % const MagickBooleanType gray,const double azimuth,
11557 % const double elevation)
11558 %
11559 % A description of each parameter follows:
11560 %
11561 % o wand: the magick wand.
11562 %
11563 % o gray: A value other than zero shades the intensity of each pixel.
11564 %
11565 % o azimuth, elevation: Define the light source direction.
11566 %
11567 */
11568 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11569  const MagickBooleanType gray,const double asimuth,const double elevation)
11570 {
11571  Image
11572  *shade_image;
11573 
11574  assert(wand != (MagickWand *) NULL);
11575  assert(wand->signature == WandSignature);
11576  if (wand->debug != MagickFalse)
11577  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11578  if (wand->images == (Image *) NULL)
11579  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11580  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
11581  if (shade_image == (Image *) NULL)
11582  return(MagickFalse);
11583  ReplaceImageInList(&wand->images,shade_image);
11584  return(MagickTrue);
11585 }
11586 
11587 /*
11588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11589 % %
11590 % %
11591 % %
11592 % M a g i c k S h a d o w I m a g e %
11593 % %
11594 % %
11595 % %
11596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11597 %
11598 % MagickShadowImage() simulates an image shadow.
11599 %
11600 % The format of the MagickShadowImage method is:
11601 %
11602 % MagickBooleanType MagickShadowImage(MagickWand *wand,
11603 % const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11604 %
11605 % A description of each parameter follows:
11606 %
11607 % o wand: the magick wand.
11608 %
11609 % o opacity: percentage transparency.
11610 %
11611 % o sigma: the standard deviation of the Gaussian, in pixels.
11612 %
11613 % o x: the shadow x-offset.
11614 %
11615 % o y: the shadow y-offset.
11616 %
11617 */
11618 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11619  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11620 {
11621  Image
11622  *shadow_image;
11623 
11624  assert(wand != (MagickWand *) NULL);
11625  assert(wand->signature == WandSignature);
11626  if (wand->debug != MagickFalse)
11627  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11628  if (wand->images == (Image *) NULL)
11629  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11630  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
11631  if (shadow_image == (Image *) NULL)
11632  return(MagickFalse);
11633  ReplaceImageInList(&wand->images,shadow_image);
11634  return(MagickTrue);
11635 }
11636 
11637 /*
11638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11639 % %
11640 % %
11641 % %
11642 % M a g i c k S h a r p e n I m a g e %
11643 % %
11644 % %
11645 % %
11646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11647 %
11648 % MagickSharpenImage() sharpens an image. We convolve the image with a
11649 % Gaussian operator of the given radius and standard deviation (sigma).
11650 % For reasonable results, the radius should be larger than sigma. Use a
11651 % radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11652 %
11653 % The format of the MagickSharpenImage method is:
11654 %
11655 % MagickBooleanType MagickSharpenImage(MagickWand *wand,
11656 % const double radius,const double sigma)
11657 % MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11658 % const ChannelType channel,const double radius,const double sigma)
11659 %
11660 % A description of each parameter follows:
11661 %
11662 % o wand: the magick wand.
11663 %
11664 % o channel: the image channel(s).
11665 %
11666 % o radius: the radius of the Gaussian, in pixels, not counting the center
11667 % pixel.
11668 %
11669 % o sigma: the standard deviation of the Gaussian, in pixels.
11670 %
11671 */
11672 
11673 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11674  const double radius,const double sigma)
11675 {
11676  MagickBooleanType
11677  status;
11678 
11679  status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11680  return(status);
11681 }
11682 
11683 WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11684  const ChannelType channel,const double radius,const double sigma)
11685 {
11686  Image
11687  *sharp_image;
11688 
11689  assert(wand != (MagickWand *) NULL);
11690  assert(wand->signature == WandSignature);
11691  if (wand->debug != MagickFalse)
11692  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11693  if (wand->images == (Image *) NULL)
11694  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11695  sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11696  wand->exception);
11697  if (sharp_image == (Image *) NULL)
11698  return(MagickFalse);
11699  ReplaceImageInList(&wand->images,sharp_image);
11700  return(MagickTrue);
11701 }
11702 
11703 /*
11704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11705 % %
11706 % %
11707 % %
11708 % M a g i c k S h a v e I m a g e %
11709 % %
11710 % %
11711 % %
11712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11713 %
11714 % MagickShaveImage() shaves pixels from the image edges. It allocates the
11715 % memory necessary for the new Image structure and returns a pointer to the
11716 % new image.
11717 %
11718 % The format of the MagickShaveImage method is:
11719 %
11720 % MagickBooleanType MagickShaveImage(MagickWand *wand,
11721 % const size_t columns,const size_t rows)
11722 %
11723 % A description of each parameter follows:
11724 %
11725 % o wand: the magick wand.
11726 %
11727 % o columns: the number of columns in the scaled image.
11728 %
11729 % o rows: the number of rows in the scaled image.
11730 %
11731 %
11732 */
11733 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11734  const size_t columns,const size_t rows)
11735 {
11736  Image
11737  *shave_image;
11738 
11739  RectangleInfo
11740  shave_info;
11741 
11742  assert(wand != (MagickWand *) NULL);
11743  assert(wand->signature == WandSignature);
11744  if (wand->debug != MagickFalse)
11745  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11746  if (wand->images == (Image *) NULL)
11747  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11748  shave_info.width=columns;
11749  shave_info.height=rows;
11750  shave_info.x=0;
11751  shave_info.y=0;
11752  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11753  if (shave_image == (Image *) NULL)
11754  return(MagickFalse);
11755  ReplaceImageInList(&wand->images,shave_image);
11756  return(MagickTrue);
11757 }
11758 
11759 /*
11760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11761 % %
11762 % %
11763 % %
11764 % M a g i c k S h e a r I m a g e %
11765 % %
11766 % %
11767 % %
11768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11769 %
11770 % MagickShearImage() slides one edge of an image along the X or Y axis,
11771 % creating a parallelogram. An X direction shear slides an edge along the X
11772 % axis, while a Y direction shear slides an edge along the Y axis. The amount
11773 % of the shear is controlled by a shear angle. For X direction shears, x_shear
11774 % is measured relative to the Y axis, and similarly, for Y direction shears
11775 % y_shear is measured relative to the X axis. Empty triangles left over from
11776 % shearing the image are filled with the background color.
11777 %
11778 % The format of the MagickShearImage method is:
11779 %
11780 % MagickBooleanType MagickShearImage(MagickWand *wand,
11781 % const PixelWand *background,const double x_shear,const double y_shear)
11782 %
11783 % A description of each parameter follows:
11784 %
11785 % o wand: the magick wand.
11786 %
11787 % o background: the background pixel wand.
11788 %
11789 % o x_shear: the number of degrees to shear the image.
11790 %
11791 % o y_shear: the number of degrees to shear the image.
11792 %
11793 */
11794 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11795  const PixelWand *background,const double x_shear,const double y_shear)
11796 {
11797  Image
11798  *shear_image;
11799 
11800  assert(wand != (MagickWand *) NULL);
11801  assert(wand->signature == WandSignature);
11802  if (wand->debug != MagickFalse)
11803  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11804  if (wand->images == (Image *) NULL)
11805  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11806  PixelGetQuantumColor(background,&wand->images->background_color);
11807  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11808  if (shear_image == (Image *) NULL)
11809  return(MagickFalse);
11810  ReplaceImageInList(&wand->images,shear_image);
11811  return(MagickTrue);
11812 }
11813 
11814 /*
11815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11816 % %
11817 % %
11818 % %
11819 % 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 %
11820 % %
11821 % %
11822 % %
11823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11824 %
11825 % MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11826 % non-linear sigmoidal contrast algorithm. Increase the contrast of the
11827 % image using a sigmoidal transfer function without saturating highlights or
11828 % shadows. Contrast indicates how much to increase the contrast (0 is none;
11829 % 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11830 % the resultant image (0 is white; 50% is middle-gray; 100% is black). Set
11831 % sharpen to MagickTrue to increase the image contrast otherwise the contrast
11832 % is reduced.
11833 %
11834 % The format of the MagickSigmoidalContrastImage method is:
11835 %
11836 % MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11837 % const MagickBooleanType sharpen,const double alpha,const double beta)
11838 % MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11839 % const ChannelType channel,const MagickBooleanType sharpen,
11840 % const double alpha,const double beta)
11841 %
11842 % A description of each parameter follows:
11843 %
11844 % o wand: the magick wand.
11845 %
11846 % o channel: Identify which channel to level: RedChannel, GreenChannel,
11847 %
11848 % o sharpen: Increase or decrease image contrast.
11849 %
11850 % o alpha: strength of the contrast, the larger the number the more
11851 % 'threshold-like' it becomes.
11852 %
11853 % o beta: midpoint of the function as a color value 0 to QuantumRange.
11854 %
11855 */
11856 
11857 WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11858  const MagickBooleanType sharpen,const double alpha,const double beta)
11859 {
11860  MagickBooleanType
11861  status;
11862 
11863  status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11864  alpha,beta);
11865  return(status);
11866 }
11867 
11868 WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11869  MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11870  const double alpha,const double beta)
11871 {
11872  MagickBooleanType
11873  status;
11874 
11875  assert(wand != (MagickWand *) NULL);
11876  assert(wand->signature == WandSignature);
11877  if (wand->debug != MagickFalse)
11878  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11879  if (wand->images == (Image *) NULL)
11880  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11881  status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11882  if (status == MagickFalse)
11883  InheritException(wand->exception,&wand->images->exception);
11884  return(status);
11885 }
11886 
11887 /*
11888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11889 % %
11890 % %
11891 % %
11892 % M a g i c k S i m i l a r i t y I m a g e %
11893 % %
11894 % %
11895 % %
11896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11897 %
11898 % MagickSimilarityImage() compares the reference image of the image and
11899 % returns the best match offset. In addition, it returns a similarity image
11900 % such that an exact match location is completely white and if none of the
11901 % pixels match, black, otherwise some gray level in-between.
11902 %
11903 % The format of the MagickSimilarityImage method is:
11904 %
11905 % MagickWand *MagickSimilarityImage(MagickWand *wand,
11906 % const MagickWand *reference,RectangeInfo *offset,double *similarity)
11907 %
11908 % A description of each parameter follows:
11909 %
11910 % o wand: the magick wand.
11911 %
11912 % o reference: the reference wand.
11913 %
11914 % o offset: the best match offset of the reference image within the image.
11915 %
11916 % o similarity: the computed similarity between the images.
11917 %
11918 */
11919 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11920  const MagickWand *reference,RectangleInfo *offset,double *similarity)
11921 {
11922  Image
11923  *similarity_image;
11924 
11925  assert(wand != (MagickWand *) NULL);
11926  assert(wand->signature == WandSignature);
11927  if (wand->debug != MagickFalse)
11928  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11929  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11930  {
11931  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11932  "ContainsNoImages","`%s'",wand->name);
11933  return((MagickWand *) NULL);
11934  }
11935  similarity_image=SimilarityImage(wand->images,reference->images,offset,
11936  similarity,&wand->images->exception);
11937  if (similarity_image == (Image *) NULL)
11938  return((MagickWand *) NULL);
11939  return(CloneMagickWandFromImages(wand,similarity_image));
11940 }
11941 
11942 /*
11943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11944 % %
11945 % %
11946 % %
11947 % M a g i c k S k e t c h I m a g e %
11948 % %
11949 % %
11950 % %
11951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11952 %
11953 % MagickSketchImage() simulates a pencil sketch. We convolve the image with
11954 % a Gaussian operator of the given radius and standard deviation (sigma).
11955 % For reasonable results, radius should be larger than sigma. Use a
11956 % radius of 0 and SketchImage() selects a suitable radius for you.
11957 % Angle gives the angle of the blurring motion.
11958 %
11959 % The format of the MagickSketchImage method is:
11960 %
11961 % MagickBooleanType MagickSketchImage(MagickWand *wand,
11962 % const double radius,const double sigma,const double angle)
11963 %
11964 % A description of each parameter follows:
11965 %
11966 % o wand: the magick wand.
11967 %
11968 % o radius: the radius of the Gaussian, in pixels, not counting
11969 % the center pixel.
11970 %
11971 % o sigma: the standard deviation of the Gaussian, in pixels.
11972 %
11973 % o angle: Apply the effect along this angle.
11974 %
11975 */
11976 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11977  const double radius,const double sigma,const double angle)
11978 {
11979  Image
11980  *sketch_image;
11981 
11982  assert(wand != (MagickWand *) NULL);
11983  assert(wand->signature == WandSignature);
11984  if (wand->debug != MagickFalse)
11985  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11986  if (wand->images == (Image *) NULL)
11987  ThrowWandException(WandError,"ContainsNoImages",wand->name);
11988  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11989  if (sketch_image == (Image *) NULL)
11990  return(MagickFalse);
11991  ReplaceImageInList(&wand->images,sketch_image);
11992  return(MagickTrue);
11993 }
11994 
11995 /*
11996 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11997 % %
11998 % %
11999 % %
12000 % M a g i c k S m u s h I m a g e s %
12001 % %
12002 % %
12003 % %
12004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12005 %
12006 % MagickSmushImages() takes all images from the current image pointer to the
12007 % end of the image list and smushs them to each other top-to-bottom if the
12008 % stack parameter is true, otherwise left-to-right.
12009 %
12010 % The format of the MagickSmushImages method is:
12011 %
12012 % MagickWand *MagickSmushImages(MagickWand *wand,
12013 % const MagickBooleanType stack,const ssize_t offset)
12014 %
12015 % A description of each parameter follows:
12016 %
12017 % o wand: the magick wand.
12018 %
12019 % o stack: By default, images are stacked left-to-right. Set stack to
12020 % MagickTrue to stack them top-to-bottom.
12021 %
12022 % o offset: minimum distance in pixels between images.
12023 %
12024 */
12025 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
12026  const MagickBooleanType stack,const ssize_t offset)
12027 {
12028  Image
12029  *smush_image;
12030 
12031  assert(wand != (MagickWand *) NULL);
12032  assert(wand->signature == WandSignature);
12033  if (wand->debug != MagickFalse)
12034  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12035  if (wand->images == (Image *) NULL)
12036  return((MagickWand *) NULL);
12037  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
12038  if (smush_image == (Image *) NULL)
12039  return((MagickWand *) NULL);
12040  return(CloneMagickWandFromImages(wand,smush_image));
12041 }
12042 
12043 /*
12044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12045 % %
12046 % %
12047 % %
12048 % M a g i c k S o l a r i z e I m a g e %
12049 % %
12050 % %
12051 % %
12052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12053 %
12054 % MagickSolarizeImage() applies a special effect to the image, similar to the
12055 % effect achieved in a photo darkroom by selectively exposing areas of photo
12056 % sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a
12057 % measure of the extent of the solarization.
12058 %
12059 % The format of the MagickSolarizeImage method is:
12060 %
12061 % MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12062 % const double threshold)
12063 % MagickBooleanType MagickSolarizeImageChannel(MagickWand *wand,
12064 % const ChannelType channel,const double threshold)
12065 %
12066 % A description of each parameter follows:
12067 %
12068 % o wand: the magick wand.
12069 %
12070 % o channel: the image channel(s).
12071 %
12072 % o threshold: Define the extent of the solarization.
12073 %
12074 */
12075 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
12076  const double threshold)
12077 {
12078  MagickBooleanType
12079  status;
12080 
12081  status=MagickSolarizeImageChannel(wand,DefaultChannels,threshold);
12082  return(status);
12083 }
12084 
12085 WandExport MagickBooleanType MagickSolarizeImageChannel(MagickWand *wand,
12086  const ChannelType channel,const double threshold)
12087 {
12088  MagickBooleanType
12089  status;
12090 
12091  assert(wand != (MagickWand *) NULL);
12092  assert(wand->signature == WandSignature);
12093  if (wand->debug != MagickFalse)
12094  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12095  if (wand->images == (Image *) NULL)
12096  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12097  status=SolarizeImageChannel(wand->images,channel,threshold,wand->exception);
12098  return(status);
12099 }
12100 
12101 /*
12102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12103 % %
12104 % %
12105 % %
12106 % M a g i c k S p a r s e C o l o r I m a g e %
12107 % %
12108 % %
12109 % %
12110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12111 %
12112 % MagickSparseColorImage(), given a set of coordinates, interpolates the
12113 % colors found at those coordinates, across the whole image, using various
12114 % methods.
12115 %
12116 % The format of the MagickSparseColorImage method is:
12117 %
12118 % MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12119 % const ChannelType channel,const SparseColorMethod method,
12120 % const size_t number_arguments,const double *arguments)
12121 %
12122 % A description of each parameter follows:
12123 %
12124 % o image: the image to be sparseed.
12125 %
12126 % o method: the method of image sparseion.
12127 %
12128 % ArcSparseColorion will always ignore source image offset, and always
12129 % 'bestfit' the destination image with the top left corner offset
12130 % relative to the polar mapping center.
12131 %
12132 % Bilinear has no simple inverse mapping so will not allow 'bestfit'
12133 % style of image sparseion.
12134 %
12135 % Affine, Perspective, and Bilinear, will do least squares fitting of
12136 % the distrotion when more than the minimum number of control point
12137 % pairs are provided.
12138 %
12139 % Perspective, and Bilinear, will fall back to a Affine sparseion when
12140 % less than 4 control point pairs are provided. While Affine sparseions
12141 % will let you use any number of control point pairs, that is Zero pairs
12142 % is a No-Op (viewport only) distrotion, one pair is a translation and
12143 % two pairs of control points will do a scale-rotate-translate, without
12144 % any shearing.
12145 %
12146 % o number_arguments: the number of arguments given for this sparseion
12147 % method.
12148 %
12149 % o arguments: the arguments for this sparseion method.
12150 %
12151 */
12152 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
12153  const ChannelType channel,const SparseColorMethod method,
12154  const size_t number_arguments,const double *arguments)
12155 {
12156  Image
12157  *sparse_image;
12158 
12159  assert(wand != (MagickWand *) NULL);
12160  assert(wand->signature == WandSignature);
12161  if (wand->debug != MagickFalse)
12162  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12163  if (wand->images == (Image *) NULL)
12164  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12165  sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
12166  arguments,wand->exception);
12167  if (sparse_image == (Image *) NULL)
12168  return(MagickFalse);
12169  ReplaceImageInList(&wand->images,sparse_image);
12170  return(MagickTrue);
12171 }
12172 
12173 /*
12174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12175 % %
12176 % %
12177 % %
12178 % M a g i c k S p l i c e I m a g e %
12179 % %
12180 % %
12181 % %
12182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12183 %
12184 % MagickSpliceImage() splices a solid color into the image.
12185 %
12186 % The format of the MagickSpliceImage method is:
12187 %
12188 % MagickBooleanType MagickSpliceImage(MagickWand *wand,
12189 % const size_t width,const size_t height,const ssize_t x,
12190 % const ssize_t y)
12191 %
12192 % A description of each parameter follows:
12193 %
12194 % o wand: the magick wand.
12195 %
12196 % o width: the region width.
12197 %
12198 % o height: the region height.
12199 %
12200 % o x: the region x offset.
12201 %
12202 % o y: the region y offset.
12203 %
12204 */
12205 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
12206  const size_t width,const size_t height,const ssize_t x,
12207  const ssize_t y)
12208 {
12209  Image
12210  *splice_image;
12211 
12212  RectangleInfo
12213  splice;
12214 
12215  assert(wand != (MagickWand *) NULL);
12216  assert(wand->signature == WandSignature);
12217  if (wand->debug != MagickFalse)
12218  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12219  if (wand->images == (Image *) NULL)
12220  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12221  splice.width=width;
12222  splice.height=height;
12223  splice.x=x;
12224  splice.y=y;
12225  splice_image=SpliceImage(wand->images,&splice,wand->exception);
12226  if (splice_image == (Image *) NULL)
12227  return(MagickFalse);
12228  ReplaceImageInList(&wand->images,splice_image);
12229  return(MagickTrue);
12230 }
12231 
12232 /*
12233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12234 % %
12235 % %
12236 % %
12237 % M a g i c k S p r e a d I m a g e %
12238 % %
12239 % %
12240 % %
12241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12242 %
12243 % MagickSpreadImage() is a special effects method that randomly displaces each
12244 % pixel in a block defined by the radius parameter.
12245 %
12246 % The format of the MagickSpreadImage method is:
12247 %
12248 % MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
12249 %
12250 % A description of each parameter follows:
12251 %
12252 % o wand: the magick wand.
12253 %
12254 % o radius: Choose a random pixel in a neighborhood of this extent.
12255 %
12256 */
12257 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
12258  const double radius)
12259 {
12260  Image
12261  *spread_image;
12262 
12263  assert(wand != (MagickWand *) NULL);
12264  assert(wand->signature == WandSignature);
12265  if (wand->debug != MagickFalse)
12266  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12267  if (wand->images == (Image *) NULL)
12268  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12269  spread_image=SpreadImage(wand->images,radius,wand->exception);
12270  if (spread_image == (Image *) NULL)
12271  return(MagickFalse);
12272  ReplaceImageInList(&wand->images,spread_image);
12273  return(MagickTrue);
12274 }
12275 
12276 /*
12277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12278 % %
12279 % %
12280 % %
12281 % M a g i c k S t a t i s t i c I m a g e %
12282 % %
12283 % %
12284 % %
12285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12286 %
12287 % MagickStatisticImage() replace each pixel with corresponding statistic from
12288 % the neighborhood of the specified width and height.
12289 %
12290 % The format of the MagickStatisticImage method is:
12291 %
12292 % MagickBooleanType MagickStatisticImage(MagickWand *wand,
12293 % const StatisticType type,const double width,const size_t height)
12294 % MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
12295 % const ChannelType channel,const StatisticType type,const double width,
12296 % const size_t height)
12297 %
12298 % A description of each parameter follows:
12299 %
12300 % o wand: the magick wand.
12301 %
12302 % o channel: the image channel(s).
12303 %
12304 % o type: the statistic type (e.g. median, mode, etc.).
12305 %
12306 % o width: the width of the pixel neighborhood.
12307 %
12308 % o height: the height of the pixel neighborhood.
12309 %
12310 */
12311 
12312 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
12313  const StatisticType type,const size_t width,const size_t height)
12314 {
12315  MagickBooleanType
12316  status;
12317 
12318  status=MagickStatisticImageChannel(wand,DefaultChannels,type,width,height);
12319  return(status);
12320 }
12321 
12322 WandExport MagickBooleanType MagickStatisticImageChannel(MagickWand *wand,
12323  const ChannelType channel,const StatisticType type,const size_t width,
12324  const size_t height)
12325 {
12326  Image
12327  *statistic_image;
12328 
12329  assert(wand != (MagickWand *) NULL);
12330  assert(wand->signature == WandSignature);
12331  if (wand->debug != MagickFalse)
12332  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12333  if (wand->images == (Image *) NULL)
12334  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12335  statistic_image=StatisticImageChannel(wand->images,channel,type,width,height,
12336  wand->exception);
12337  if (statistic_image == (Image *) NULL)
12338  return(MagickFalse);
12339  ReplaceImageInList(&wand->images,statistic_image);
12340  return(MagickTrue);
12341 }
12342 
12343 /*
12344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12345 % %
12346 % %
12347 % %
12348 % M a g i c k S t e g a n o I m a g e %
12349 % %
12350 % %
12351 % %
12352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12353 %
12354 % MagickSteganoImage() hides a digital watermark within the image.
12355 % Recover the hidden watermark later to prove that the authenticity of
12356 % an image. Offset defines the start position within the image to hide
12357 % the watermark.
12358 %
12359 % The format of the MagickSteganoImage method is:
12360 %
12361 % MagickWand *MagickSteganoImage(MagickWand *wand,
12362 % const MagickWand *watermark_wand,const ssize_t offset)
12363 %
12364 % A description of each parameter follows:
12365 %
12366 % o wand: the magick wand.
12367 %
12368 % o watermark_wand: the watermark wand.
12369 %
12370 % o offset: Start hiding at this offset into the image.
12371 %
12372 */
12373 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
12374  const MagickWand *watermark_wand,const ssize_t offset)
12375 {
12376  Image
12377  *stegano_image;
12378 
12379  assert(wand != (MagickWand *) NULL);
12380  assert(wand->signature == WandSignature);
12381  if (wand->debug != MagickFalse)
12382  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12383  if ((wand->images == (Image *) NULL) ||
12384  (watermark_wand->images == (Image *) NULL))
12385  {
12386  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12387  "ContainsNoImages","`%s'",wand->name);
12388  return((MagickWand *) NULL);
12389  }
12390  wand->images->offset=offset;
12391  stegano_image=SteganoImage(wand->images,watermark_wand->images,
12392  wand->exception);
12393  if (stegano_image == (Image *) NULL)
12394  return((MagickWand *) NULL);
12395  return(CloneMagickWandFromImages(wand,stegano_image));
12396 }
12397 
12398 /*
12399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12400 % %
12401 % %
12402 % %
12403 % M a g i c k S t e r e o I m a g e %
12404 % %
12405 % %
12406 % %
12407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12408 %
12409 % MagickStereoImage() composites two images and produces a single image that
12410 % is the composite of a left and right image of a stereo pair
12411 %
12412 % The format of the MagickStereoImage method is:
12413 %
12414 % MagickWand *MagickStereoImage(MagickWand *wand,
12415 % const MagickWand *offset_wand)
12416 %
12417 % A description of each parameter follows:
12418 %
12419 % o wand: the magick wand.
12420 %
12421 % o offset_wand: Another image wand.
12422 %
12423 */
12424 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
12425  const MagickWand *offset_wand)
12426 {
12427  Image
12428  *stereo_image;
12429 
12430  assert(wand != (MagickWand *) NULL);
12431  assert(wand->signature == WandSignature);
12432  if (wand->debug != MagickFalse)
12433  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12434  if ((wand->images == (Image *) NULL) ||
12435  (offset_wand->images == (Image *) NULL))
12436  {
12437  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12438  "ContainsNoImages","`%s'",wand->name);
12439  return((MagickWand *) NULL);
12440  }
12441  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
12442  if (stereo_image == (Image *) NULL)
12443  return((MagickWand *) NULL);
12444  return(CloneMagickWandFromImages(wand,stereo_image));
12445 }
12446 
12447 /*
12448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12449 % %
12450 % %
12451 % %
12452 % M a g i c k S t r i p I m a g e %
12453 % %
12454 % %
12455 % %
12456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12457 %
12458 % MagickStripImage() strips an image of all profiles and comments.
12459 %
12460 % The format of the MagickStripImage method is:
12461 %
12462 % MagickBooleanType MagickStripImage(MagickWand *wand)
12463 %
12464 % A description of each parameter follows:
12465 %
12466 % o wand: the magick wand.
12467 %
12468 */
12469 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
12470 {
12471  MagickBooleanType
12472  status;
12473 
12474  assert(wand != (MagickWand *) NULL);
12475  assert(wand->signature == WandSignature);
12476  if (wand->debug != MagickFalse)
12477  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12478  if (wand->images == (Image *) NULL)
12479  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12480  status=StripImage(wand->images);
12481  if (status == MagickFalse)
12482  InheritException(wand->exception,&wand->images->exception);
12483  return(status);
12484 }
12485 
12486 /*
12487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12488 % %
12489 % %
12490 % %
12491 % M a g i c k S w i r l I m a g e %
12492 % %
12493 % %
12494 % %
12495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12496 %
12497 % MagickSwirlImage() swirls the pixels about the center of the image, where
12498 % degrees indicates the sweep of the arc through which each pixel is moved.
12499 % You get a more dramatic effect as the degrees move from 1 to 360.
12500 %
12501 % The format of the MagickSwirlImage method is:
12502 %
12503 % MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
12504 %
12505 % A description of each parameter follows:
12506 %
12507 % o wand: the magick wand.
12508 %
12509 % o degrees: Define the tightness of the swirling effect.
12510 %
12511 */
12512 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
12513  const double degrees)
12514 {
12515  Image
12516  *swirl_image;
12517 
12518  assert(wand != (MagickWand *) NULL);
12519  assert(wand->signature == WandSignature);
12520  if (wand->debug != MagickFalse)
12521  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12522  if (wand->images == (Image *) NULL)
12523  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12524  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
12525  if (swirl_image == (Image *) NULL)
12526  return(MagickFalse);
12527  ReplaceImageInList(&wand->images,swirl_image);
12528  return(MagickTrue);
12529 }
12530 
12531 /*
12532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12533 % %
12534 % %
12535 % %
12536 % M a g i c k T e x t u r e I m a g e %
12537 % %
12538 % %
12539 % %
12540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12541 %
12542 % MagickTextureImage() repeatedly tiles the texture image across and down the
12543 % image canvas.
12544 %
12545 % The format of the MagickTextureImage method is:
12546 %
12547 % MagickWand *MagickTextureImage(MagickWand *wand,
12548 % const MagickWand *texture_wand)
12549 %
12550 % A description of each parameter follows:
12551 %
12552 % o wand: the magick wand.
12553 %
12554 % o texture_wand: the texture wand
12555 %
12556 */
12557 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
12558  const MagickWand *texture_wand)
12559 {
12560  Image
12561  *texture_image;
12562 
12563  MagickBooleanType
12564  status;
12565 
12566  assert(wand != (MagickWand *) NULL);
12567  assert(wand->signature == WandSignature);
12568  if (wand->debug != MagickFalse)
12569  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12570  if ((wand->images == (Image *) NULL) ||
12571  (texture_wand->images == (Image *) NULL))
12572  {
12573  (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
12574  "ContainsNoImages","`%s'",wand->name);
12575  return((MagickWand *) NULL);
12576  }
12577  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12578  if (texture_image == (Image *) NULL)
12579  return((MagickWand *) NULL);
12580  status=TextureImage(texture_image,texture_wand->images);
12581  if (status == MagickFalse)
12582  {
12583  InheritException(wand->exception,&texture_image->exception);
12584  texture_image=DestroyImage(texture_image);
12585  return((MagickWand *) NULL);
12586  }
12587  return(CloneMagickWandFromImages(wand,texture_image));
12588 }
12589 
12590 /*
12591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12592 % %
12593 % %
12594 % %
12595 % M a g i c k T h r e s h o l d I m a g e %
12596 % %
12597 % %
12598 % %
12599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12600 %
12601 % MagickThresholdImage() changes the value of individual pixels based on
12602 % the intensity of each pixel compared to threshold. The result is a
12603 % high-contrast, two color image.
12604 %
12605 % The format of the MagickThresholdImage method is:
12606 %
12607 % MagickBooleanType MagickThresholdImage(MagickWand *wand,
12608 % const double threshold)
12609 % MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12610 % const ChannelType channel,const double threshold)
12611 %
12612 % A description of each parameter follows:
12613 %
12614 % o wand: the magick wand.
12615 %
12616 % o channel: the image channel(s).
12617 %
12618 % o threshold: Define the threshold value.
12619 %
12620 */
12621 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12622  const double threshold)
12623 {
12624  MagickBooleanType
12625  status;
12626 
12627  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12628  return(status);
12629 }
12630 
12631 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12632  const ChannelType channel,const double threshold)
12633 {
12634  MagickBooleanType
12635  status;
12636 
12637  assert(wand != (MagickWand *) NULL);
12638  assert(wand->signature == WandSignature);
12639  if (wand->debug != MagickFalse)
12640  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12641  if (wand->images == (Image *) NULL)
12642  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12643  status=BilevelImageChannel(wand->images,channel,threshold);
12644  if (status == MagickFalse)
12645  InheritException(wand->exception,&wand->images->exception);
12646  return(status);
12647 }
12648 
12649 /*
12650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12651 % %
12652 % %
12653 % %
12654 % M a g i c k T h u m b n a i l I m a g e %
12655 % %
12656 % %
12657 % %
12658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12659 %
12660 % MagickThumbnailImage() changes the size of an image to the given dimensions
12661 % and removes any associated profiles. The goal is to produce small low cost
12662 % thumbnail images suited for display on the Web.
12663 %
12664 % The format of the MagickThumbnailImage method is:
12665 %
12666 % MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12667 % const size_t columns,const size_t rows)
12668 %
12669 % A description of each parameter follows:
12670 %
12671 % o wand: the magick wand.
12672 %
12673 % o columns: the number of columns in the scaled image.
12674 %
12675 % o rows: the number of rows in the scaled image.
12676 %
12677 */
12678 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12679  const size_t columns,const size_t rows)
12680 {
12681  Image
12682  *thumbnail_image;
12683 
12684  assert(wand != (MagickWand *) NULL);
12685  assert(wand->signature == WandSignature);
12686  if (wand->debug != MagickFalse)
12687  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12688  if (wand->images == (Image *) NULL)
12689  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12690  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12691  if (thumbnail_image == (Image *) NULL)
12692  return(MagickFalse);
12693  ReplaceImageInList(&wand->images,thumbnail_image);
12694  return(MagickTrue);
12695 }
12696 
12697 /*
12698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12699 % %
12700 % %
12701 % %
12702 % M a g i c k T i n t I m a g e %
12703 % %
12704 % %
12705 % %
12706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12707 %
12708 % MagickTintImage() applies a color vector to each pixel in the image. The
12709 % length of the vector is 0 for black and white and at its maximum for the
12710 % midtones. The vector weighting function is
12711 % f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12712 %
12713 % The format of the MagickTintImage method is:
12714 %
12715 % MagickBooleanType MagickTintImage(MagickWand *wand,
12716 % const PixelWand *tint,const PixelWand *opacity)
12717 %
12718 % A description of each parameter follows:
12719 %
12720 % o wand: the magick wand.
12721 %
12722 % o tint: the tint pixel wand.
12723 %
12724 % o opacity: the opacity pixel wand.
12725 %
12726 */
12727 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12728  const PixelWand *tint,const PixelWand *opacity)
12729 {
12730  char
12731  percent_opaque[MaxTextExtent];
12732 
12733  Image
12734  *tint_image;
12735 
12736  PixelPacket
12737  target;
12738 
12739  assert(wand != (MagickWand *) NULL);
12740  assert(wand->signature == WandSignature);
12741  if (wand->debug != MagickFalse)
12742  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12743  if (wand->images == (Image *) NULL)
12744  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12745  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
12746  "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12747  PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12748  PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12749  PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12750  PixelGetOpacityQuantum(opacity)));
12751  PixelGetQuantumColor(tint,&target);
12752  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12753  if (tint_image == (Image *) NULL)
12754  return(MagickFalse);
12755  ReplaceImageInList(&wand->images,tint_image);
12756  return(MagickTrue);
12757 }
12758 
12759 /*
12760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12761 % %
12762 % %
12763 % %
12764 % M a g i c k T r a n s f o r m I m a g e %
12765 % %
12766 % %
12767 % %
12768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12769 %
12770 % MagickTransformImage() is a convenience method that behaves like
12771 % MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12772 % information as a region geometry specification. If the operation fails,
12773 % a NULL image handle is returned.
12774 %
12775 % The format of the MagickTransformImage method is:
12776 %
12777 % MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12778 % const char *geometry)
12779 %
12780 % A description of each parameter follows:
12781 %
12782 % o wand: the magick wand.
12783 %
12784 % o crop: A crop geometry string. This geometry defines a subregion of the
12785 % image to crop.
12786 %
12787 % o geometry: An image geometry string. This geometry defines the final
12788 % size of the image.
12789 %
12790 */
12791 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12792  const char *crop,const char *geometry)
12793 {
12794  Image
12795  *transform_image;
12796 
12797  MagickBooleanType
12798  status;
12799 
12800  assert(wand != (MagickWand *) NULL);
12801  assert(wand->signature == WandSignature);
12802  if (wand->debug != MagickFalse)
12803  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12804  if (wand->images == (Image *) NULL)
12805  return((MagickWand *) NULL);
12806  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12807  if (transform_image == (Image *) NULL)
12808  return((MagickWand *) NULL);
12809  status=TransformImage(&transform_image,crop,geometry);
12810  if (status == MagickFalse)
12811  {
12812  InheritException(wand->exception,&transform_image->exception);
12813  transform_image=DestroyImage(transform_image);
12814  return((MagickWand *) NULL);
12815  }
12816  return(CloneMagickWandFromImages(wand,transform_image));
12817 }
12818 
12819 /*
12820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12821 % %
12822 % %
12823 % %
12824 % 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 %
12825 % %
12826 % %
12827 % %
12828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12829 %
12830 % MagickTransformImageColorspace() transform the image colorspace, setting
12831 % the images colorspace while transforming the images data to that
12832 % colorspace.
12833 %
12834 % The format of the MagickTransformImageColorspace method is:
12835 %
12836 % MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12837 % const ColorspaceType colorspace)
12838 %
12839 % A description of each parameter follows:
12840 %
12841 % o wand: the magick wand.
12842 %
12843 % o colorspace: the image colorspace: UndefinedColorspace,
12844 % sRGBColorspace, RGBColorspace, GRAYColorspace,
12845 % OHTAColorspace, XYZColorspace, YCbCrColorspace,
12846 % YCCColorspace, YIQColorspace, YPbPrColorspace,
12847 % YPbPrColorspace, YUVColorspace, CMYKColorspace,
12848 % HSLColorspace, HWBColorspace.
12849 %
12850 */
12851 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12852  const ColorspaceType colorspace)
12853 {
12854  assert(wand != (MagickWand *) NULL);
12855  assert(wand->signature == WandSignature);
12856  if (wand->debug != MagickFalse)
12857  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12858  if (wand->images == (Image *) NULL)
12859  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12860  return(TransformImageColorspace(wand->images,colorspace));
12861 }
12862 
12863 /*
12864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12865 % %
12866 % %
12867 % %
12868 % 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 %
12869 % %
12870 % %
12871 % %
12872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12873 %
12874 % MagickTransparentPaintImage() changes any pixel that matches color with the
12875 % color defined by fill.
12876 %
12877 % The format of the MagickTransparentPaintImage method is:
12878 %
12879 % MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12880 % const PixelWand *target,const double alpha,const double fuzz,
12881 % const MagickBooleanType invert)
12882 %
12883 % A description of each parameter follows:
12884 %
12885 % o wand: the magick wand.
12886 %
12887 % o target: Change this target color to specified opacity value within
12888 % the image.
12889 %
12890 % o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12891 % transparent.
12892 %
12893 % o fuzz: By default target must match a particular pixel color
12894 % exactly. However, in many cases two colors may differ by a small amount.
12895 % The fuzz member of image defines how much tolerance is acceptable to
12896 % consider two colors as the same. For example, set fuzz to 10 and the
12897 % color red at intensities of 100 and 102 respectively are now interpreted
12898 % as the same color for the purposes of the floodfill.
12899 %
12900 % o invert: paint any pixel that does not match the target color.
12901 %
12902 */
12903 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12904  const PixelWand *target,const double alpha,const double fuzz,
12905  const MagickBooleanType invert)
12906 {
12907  MagickBooleanType
12908  status;
12909 
12910  MagickPixelPacket
12911  target_pixel;
12912 
12913  assert(wand != (MagickWand *) NULL);
12914  assert(wand->signature == WandSignature);
12915  if (wand->debug != MagickFalse)
12916  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12917  if (wand->images == (Image *) NULL)
12918  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12919  PixelGetMagickColor(target,&target_pixel);
12920  wand->images->fuzz=fuzz;
12921  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12922  (MagickRealType) QuantumRange-QuantumRange*alpha),invert);
12923  if (status == MagickFalse)
12924  InheritException(wand->exception,&wand->images->exception);
12925  return(status);
12926 }
12927 
12928 /*
12929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12930 % %
12931 % %
12932 % %
12933 % M a g i c k T r a n s p o s e I m a g e %
12934 % %
12935 % %
12936 % %
12937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12938 %
12939 % MagickTransposeImage() creates a vertical mirror image by reflecting the
12940 % pixels around the central x-axis while rotating them 90-degrees.
12941 %
12942 % The format of the MagickTransposeImage method is:
12943 %
12944 % MagickBooleanType MagickTransposeImage(MagickWand *wand)
12945 %
12946 % A description of each parameter follows:
12947 %
12948 % o wand: the magick wand.
12949 %
12950 */
12951 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12952 {
12953  Image
12954  *transpose_image;
12955 
12956  assert(wand != (MagickWand *) NULL);
12957  assert(wand->signature == WandSignature);
12958  if (wand->debug != MagickFalse)
12959  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12960  if (wand->images == (Image *) NULL)
12961  ThrowWandException(WandError,"ContainsNoImages",wand->name);
12962  transpose_image=TransposeImage(wand->images,wand->exception);
12963  if (transpose_image == (Image *) NULL)
12964  return(MagickFalse);
12965  ReplaceImageInList(&wand->images,transpose_image);
12966  return(MagickTrue);
12967 }
12968 
12969 /*
12970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12971 % %
12972 % %
12973 % %
12974 % M a g i c k T r a n s v e r s e I m a g e %
12975 % %
12976 % %
12977 % %
12978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12979 %
12980 % MagickTransverseImage() creates a horizontal mirror image by reflecting the
12981 % pixels around the central y-axis while rotating them 270-degrees.
12982 %
12983 % The format of the MagickTransverseImage method is:
12984 %
12985 % MagickBooleanType MagickTransverseImage(MagickWand *wand)
12986 %
12987 % A description of each parameter follows:
12988 %
12989 % o wand: the magick wand.
12990 %
12991 */
12992 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12993 {
12994  Image
12995  *transverse_image;
12996 
12997  assert(wand != (MagickWand *) NULL);
12998  assert(wand->signature == WandSignature);
12999  if (wand->debug != MagickFalse)
13000  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13001  if (wand->images == (Image *) NULL)
13002  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13003  transverse_image=TransverseImage(wand->images,wand->exception);
13004  if (transverse_image == (Image *) NULL)
13005  return(MagickFalse);
13006  ReplaceImageInList(&wand->images,transverse_image);
13007  return(MagickTrue);
13008 }
13009 
13010 /*
13011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13012 % %
13013 % %
13014 % %
13015 % M a g i c k T r i m I m a g e %
13016 % %
13017 % %
13018 % %
13019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13020 %
13021 % MagickTrimImage() remove edges that are the background color from the image.
13022 %
13023 % The format of the MagickTrimImage method is:
13024 %
13025 % MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
13026 %
13027 % A description of each parameter follows:
13028 %
13029 % o wand: the magick wand.
13030 %
13031 % o fuzz: By default target must match a particular pixel color
13032 % exactly. However, in many cases two colors may differ by a small amount.
13033 % The fuzz member of image defines how much tolerance is acceptable to
13034 % consider two colors as the same. For example, set fuzz to 10 and the
13035 % color red at intensities of 100 and 102 respectively are now interpreted
13036 % as the same color for the purposes of the floodfill.
13037 %
13038 */
13039 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
13040 {
13041  Image
13042  *trim_image;
13043 
13044  assert(wand != (MagickWand *) NULL);
13045  assert(wand->signature == WandSignature);
13046  if (wand->debug != MagickFalse)
13047  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13048  if (wand->images == (Image *) NULL)
13049  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13050  wand->images->fuzz=fuzz;
13051  trim_image=TrimImage(wand->images,wand->exception);
13052  if (trim_image == (Image *) NULL)
13053  return(MagickFalse);
13054  ReplaceImageInList(&wand->images,trim_image);
13055  return(MagickTrue);
13056 }
13057 
13058 /*
13059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13060 % %
13061 % %
13062 % %
13063 % M a g i c k U n i q u e I m a g e C o l o r s %
13064 % %
13065 % %
13066 % %
13067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13068 %
13069 % MagickUniqueImageColors() discards all but one of any pixel color.
13070 %
13071 % The format of the MagickUniqueImageColors method is:
13072 %
13073 % MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
13074 %
13075 % A description of each parameter follows:
13076 %
13077 % o wand: the magick wand.
13078 %
13079 */
13080 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
13081 {
13082  Image
13083  *unique_image;
13084 
13085  assert(wand != (MagickWand *) NULL);
13086  assert(wand->signature == WandSignature);
13087  if (wand->debug != MagickFalse)
13088  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13089  if (wand->images == (Image *) NULL)
13090  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13091  unique_image=UniqueImageColors(wand->images,wand->exception);
13092  if (unique_image == (Image *) NULL)
13093  return(MagickFalse);
13094  ReplaceImageInList(&wand->images,unique_image);
13095  return(MagickTrue);
13096 }
13097 
13098 /*
13099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13100 % %
13101 % %
13102 % %
13103 % M a g i c k U n s h a r p M a s k I m a g e %
13104 % %
13105 % %
13106 % %
13107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13108 %
13109 % MagickUnsharpMaskImage() sharpens an image. We convolve the image with a
13110 % Gaussian operator of the given radius and standard deviation (sigma).
13111 % For reasonable results, radius should be larger than sigma. Use a radius
13112 % of 0 and UnsharpMaskImage() selects a suitable radius for you.
13113 %
13114 % The format of the MagickUnsharpMaskImage method is:
13115 %
13116 % MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13117 % const double radius,const double sigma,const double amount,
13118 % const double threshold)
13119 % MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
13120 % const ChannelType channel,const double radius,const double sigma,
13121 % const double amount,const double threshold)
13122 %
13123 % A description of each parameter follows:
13124 %
13125 % o wand: the magick wand.
13126 %
13127 % o channel: the image channel(s).
13128 %
13129 % o radius: the radius of the Gaussian, in pixels, not counting the center
13130 % pixel.
13131 %
13132 % o sigma: the standard deviation of the Gaussian, in pixels.
13133 %
13134 % o amount: the percentage of the difference between the original and the
13135 % blur image that is added back into the original.
13136 %
13137 % o threshold: the threshold in pixels needed to apply the diffence amount.
13138 %
13139 */
13140 
13141 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
13142  const double radius,const double sigma,const double amount,
13143  const double threshold)
13144 {
13145  MagickBooleanType
13146  status;
13147 
13148  status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
13149  amount,threshold);
13150  return(status);
13151 }
13152 
13153 WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
13154  const ChannelType channel,const double radius,const double sigma,
13155  const double amount,const double threshold)
13156 {
13157  Image
13158  *unsharp_image;
13159 
13160  assert(wand != (MagickWand *) NULL);
13161  assert(wand->signature == WandSignature);
13162  if (wand->debug != MagickFalse)
13163  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13164  if (wand->images == (Image *) NULL)
13165  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13166  unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
13167  amount,threshold,wand->exception);
13168  if (unsharp_image == (Image *) NULL)
13169  return(MagickFalse);
13170  ReplaceImageInList(&wand->images,unsharp_image);
13171  return(MagickTrue);
13172 }
13173 
13174 /*
13175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13176 % %
13177 % %
13178 % %
13179 % M a g i c k V i g n e t t e I m a g e %
13180 % %
13181 % %
13182 % %
13183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13184 %
13185 % MagickVignetteImage() softens the edges of the image in vignette style.
13186 %
13187 % The format of the MagickVignetteImage method is:
13188 %
13189 % MagickBooleanType MagickVignetteImage(MagickWand *wand,
13190 % const double black_point,const double white_point,const ssize_t x,
13191 % const ssize_t y)
13192 %
13193 % A description of each parameter follows:
13194 %
13195 % o wand: the magick wand.
13196 %
13197 % o black_point: the black point.
13198 %
13199 % o white_point: the white point.
13200 %
13201 % o x, y: Define the x and y ellipse offset.
13202 %
13203 */
13204 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
13205  const double black_point,const double white_point,const ssize_t x,
13206  const ssize_t y)
13207 {
13208  Image
13209  *vignette_image;
13210 
13211  assert(wand != (MagickWand *) NULL);
13212  assert(wand->signature == WandSignature);
13213  if (wand->debug != MagickFalse)
13214  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13215  if (wand->images == (Image *) NULL)
13216  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13217  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
13218  wand->exception);
13219  if (vignette_image == (Image *) NULL)
13220  return(MagickFalse);
13221  ReplaceImageInList(&wand->images,vignette_image);
13222  return(MagickTrue);
13223 }
13224 
13225 /*
13226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13227 % %
13228 % %
13229 % %
13230 % M a g i c k W a v e I m a g e %
13231 % %
13232 % %
13233 % %
13234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13235 %
13236 % MagickWaveImage() creates a "ripple" effect in the image by shifting
13237 % the pixels vertically along a sine wave whose amplitude and wavelength
13238 % is specified by the given parameters.
13239 %
13240 % The format of the MagickWaveImage method is:
13241 %
13242 % MagickBooleanType MagickWaveImage(MagickWand *wand,
13243 % const double amplitude,const double wave_length)
13244 %
13245 % A description of each parameter follows:
13246 %
13247 % o wand: the magick wand.
13248 %
13249 % o amplitude, wave_length: Define the amplitude and wave length of the
13250 % sine wave.
13251 %
13252 */
13253 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
13254  const double amplitude,const double wave_length)
13255 {
13256  Image
13257  *wave_image;
13258 
13259  assert(wand != (MagickWand *) NULL);
13260  assert(wand->signature == WandSignature);
13261  if (wand->debug != MagickFalse)
13262  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13263  if (wand->images == (Image *) NULL)
13264  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13265  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
13266  if (wave_image == (Image *) NULL)
13267  return(MagickFalse);
13268  ReplaceImageInList(&wand->images,wave_image);
13269  return(MagickTrue);
13270 }
13271 
13272 /*
13273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13274 % %
13275 % %
13276 % %
13277 % 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 %
13278 % %
13279 % %
13280 % %
13281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13282 %
13283 % MagickWhiteThresholdImage() is like ThresholdImage() but force all pixels
13284 % above the threshold into white while leaving all pixels below the threshold
13285 % unchanged.
13286 %
13287 % The format of the MagickWhiteThresholdImage method is:
13288 %
13289 % MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13290 % const PixelWand *threshold)
13291 %
13292 % A description of each parameter follows:
13293 %
13294 % o wand: the magick wand.
13295 %
13296 % o threshold: the pixel wand.
13297 %
13298 */
13299 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
13300  const PixelWand *threshold)
13301 {
13302  char
13303  thresholds[MaxTextExtent];
13304 
13305  MagickBooleanType
13306  status;
13307 
13308  assert(wand != (MagickWand *) NULL);
13309  assert(wand->signature == WandSignature);
13310  if (wand->debug != MagickFalse)
13311  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13312  if (wand->images == (Image *) NULL)
13313  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13314  (void) FormatLocaleString(thresholds,MaxTextExtent,
13315  QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
13316  PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
13317  PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
13318  status=WhiteThresholdImage(wand->images,thresholds);
13319  if (status == MagickFalse)
13320  InheritException(wand->exception,&wand->images->exception);
13321  return(status);
13322 }
13323 
13324 /*
13325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13326 % %
13327 % %
13328 % %
13329 % M a g i c k W r i t e I m a g e %
13330 % %
13331 % %
13332 % %
13333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13334 %
13335 % MagickWriteImage() writes an image to the specified filename. If the
13336 % filename parameter is NULL, the image is written to the filename set
13337 % by MagickReadImage() or MagickSetImageFilename().
13338 %
13339 % The format of the MagickWriteImage method is:
13340 %
13341 % MagickBooleanType MagickWriteImage(MagickWand *wand,
13342 % const char *filename)
13343 %
13344 % A description of each parameter follows:
13345 %
13346 % o wand: the magick wand.
13347 %
13348 % o filename: the image filename.
13349 %
13350 %
13351 */
13352 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
13353  const char *filename)
13354 {
13355  Image
13356  *image;
13357 
13358  ImageInfo
13359  *write_info;
13360 
13361  MagickBooleanType
13362  status;
13363 
13364  assert(wand != (MagickWand *) NULL);
13365  assert(wand->signature == WandSignature);
13366  if (wand->debug != MagickFalse)
13367  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13368  if (wand->images == (Image *) NULL)
13369  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13370  if (filename != (const char *) NULL)
13371  (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
13372  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13373  if (image == (Image *) NULL)
13374  return(MagickFalse);
13375  write_info=CloneImageInfo(wand->image_info);
13376  write_info->adjoin=MagickTrue;
13377  status=WriteImage(write_info,image);
13378  if (status == MagickFalse)
13379  InheritException(wand->exception,&image->exception);
13380  image=DestroyImage(image);
13381  write_info=DestroyImageInfo(write_info);
13382  return(status);
13383 }
13384 
13385 /*
13386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13387 % %
13388 % %
13389 % %
13390 % M a g i c k W r i t e I m a g e F i l e %
13391 % %
13392 % %
13393 % %
13394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13395 %
13396 % MagickWriteImageFile() writes an image to an open file descriptor.
13397 %
13398 % The format of the MagickWriteImageFile method is:
13399 %
13400 % MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13401 %
13402 % A description of each parameter follows:
13403 %
13404 % o wand: the magick wand.
13405 %
13406 % o file: the file descriptor.
13407 %
13408 */
13409 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
13410 {
13411  Image
13412  *image;
13413 
13414  ImageInfo
13415  *write_info;
13416 
13417  MagickBooleanType
13418  status;
13419 
13420  assert(wand != (MagickWand *) NULL);
13421  assert(wand->signature == WandSignature);
13422  assert(file != (FILE *) NULL);
13423  if (wand->debug != MagickFalse)
13424  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13425  if (wand->images == (Image *) NULL)
13426  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13427  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
13428  if (image == (Image *) NULL)
13429  return(MagickFalse);
13430  write_info=CloneImageInfo(wand->image_info);
13431  SetImageInfoFile(write_info,file);
13432  write_info->adjoin=MagickTrue;
13433  status=WriteImage(write_info,image);
13434  write_info=DestroyImageInfo(write_info);
13435  if (status == MagickFalse)
13436  InheritException(wand->exception,&image->exception);
13437  image=DestroyImage(image);
13438  return(status);
13439 }
13440 
13441 /*
13442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13443 % %
13444 % %
13445 % %
13446 % M a g i c k W r i t e I m a g e s %
13447 % %
13448 % %
13449 % %
13450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13451 %
13452 % MagickWriteImages() writes an image or image sequence.
13453 %
13454 % The format of the MagickWriteImages method is:
13455 %
13456 % MagickBooleanType MagickWriteImages(MagickWand *wand,
13457 % const char *filename,const MagickBooleanType adjoin)
13458 %
13459 % A description of each parameter follows:
13460 %
13461 % o wand: the magick wand.
13462 %
13463 % o filename: the image filename.
13464 %
13465 % o adjoin: join images into a single multi-image file.
13466 %
13467 */
13468 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
13469  const char *filename,const MagickBooleanType adjoin)
13470 {
13471  ImageInfo
13472  *write_info;
13473 
13474  MagickBooleanType
13475  status;
13476 
13477  assert(wand != (MagickWand *) NULL);
13478  assert(wand->signature == WandSignature);
13479  if (wand->debug != MagickFalse)
13480  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13481  if (wand->images == (Image *) NULL)
13482  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13483  write_info=CloneImageInfo(wand->image_info);
13484  write_info->adjoin=adjoin;
13485  status=WriteImages(write_info,wand->images,filename,wand->exception);
13486  if (status == MagickFalse)
13487  InheritException(wand->exception,&wand->images->exception);
13488  write_info=DestroyImageInfo(write_info);
13489  return(status);
13490 }
13491 
13492 /*
13493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13494 % %
13495 % %
13496 % %
13497 % M a g i c k W r i t e I m a g e s F i l e %
13498 % %
13499 % %
13500 % %
13501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13502 %
13503 % MagickWriteImagesFile() writes an image sequence to an open file descriptor.
13504 %
13505 % The format of the MagickWriteImagesFile method is:
13506 %
13507 % MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13508 %
13509 % A description of each parameter follows:
13510 %
13511 % o wand: the magick wand.
13512 %
13513 % o file: the file descriptor.
13514 %
13515 */
13516 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
13517 {
13518  ImageInfo
13519  *write_info;
13520 
13521  MagickBooleanType
13522  status;
13523 
13524  assert(wand != (MagickWand *) NULL);
13525  assert(wand->signature == WandSignature);
13526  if (wand->debug != MagickFalse)
13527  (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
13528  if (wand->images == (Image *) NULL)
13529  ThrowWandException(WandError,"ContainsNoImages",wand->name);
13530  write_info=CloneImageInfo(wand->image_info);
13531  SetImageInfoFile(write_info,file);
13532  write_info->adjoin=MagickTrue;
13533  status=WriteImages(write_info,wand->images,(const char *) NULL,
13534  wand->exception);
13535  write_info=DestroyImageInfo(write_info);
13536  if (status == MagickFalse)
13537  InheritException(wand->exception,&wand->images->exception);
13538  return(status);
13539 }