blob: 9c2888170b3dbbd175d718b80284160b0a11a113 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% DDDD EEEEE PPPP RRRR EEEEE CCCC AAA TTTTT EEEEE %
7% D D E P P R R E C A A T E %
8% D D EEE PPPPP RRRR EEE C AAAAA T EEE %
9% D D E P R R E C A A T E %
10% DDDD EEEEE P R R EEEEE CCCC A A T EEEEE %
11% %
12% %
13% MagickWand Deprecated Methods %
14% %
15% Software Design %
16% John Cristy %
17% October 2002 %
18% %
19% %
cristy16af1cb2009-12-11 21:38:29 +000020% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000021% dedicated to making software imaging solutions freely available. %
22% %
23% You may not use this file except in compliance with the License. You may %
24% obtain a copy of the License at %
25% %
26% http://www.imagemagick.org/script/license.php %
27% %
28% Unless required by applicable law or agreed to in writing, software %
29% distributed under the License is distributed on an "AS IS" BASIS, %
30% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31% See the License for the specific language governing permissions and %
32% limitations under the License. %
33% %
34%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35%
36%
37%
38*/
39
40/*
41 Include declarations.
42*/
43#include "wand/studio.h"
44#include "wand/MagickWand.h"
45#include "wand/magick-wand-private.h"
46#include "wand/wand.h"
47
48/*
49 Define declarations.
50*/
51#define ThrowWandException(severity,tag,context) \
52{ \
53 (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
54 tag,"`%s'",context); \
55 return(MagickFalse); \
56}
57
58#if !defined(MAGICKCORE_EXCLUDE_DEPRECATED)
59
60/*
61%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62% %
63% %
64% %
cristyd18ae7c2010-03-07 17:39:52 +000065% M a g i c k A v e r a g e I m a g e s %
66% %
67% %
68% %
69%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70%
71% MagickAverageImages() average a set of images.
72%
73% The format of the MagickAverageImages method is:
74%
75% MagickWand *MagickAverageImages(MagickWand *wand)
76%
77% A description of each parameter follows:
78%
79% o wand: the magick wand.
80%
81*/
82
83static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
84 Image *images)
85{
86 MagickWand
87 *clone_wand;
88
89 assert(wand != (MagickWand *) NULL);
90 assert(wand->signature == WandSignature);
91 if (wand->debug != MagickFalse)
92 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
93 clone_wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*clone_wand));
94 if (clone_wand == (MagickWand *) NULL)
95 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
96 images->filename);
97 (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
98 clone_wand->id=AcquireWandId();
99 (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu",
100 MagickWandId,clone_wand->id);
101 clone_wand->exception=AcquireExceptionInfo();
102 InheritException(clone_wand->exception,wand->exception);
103 clone_wand->image_info=CloneImageInfo(wand->image_info);
104 clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
105 clone_wand->images=images;
106 clone_wand->debug=IsEventLogging();
107 if (clone_wand->debug != MagickFalse)
108 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
109 clone_wand->signature=WandSignature;
110 return(clone_wand);
111}
112
113WandExport MagickWand *MagickAverageImages(MagickWand *wand)
114{
115 Image
116 *average_image;
117
118 assert(wand != (MagickWand *) NULL);
119 assert(wand->signature == WandSignature);
120 if (wand->debug != MagickFalse)
121 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
122 if (wand->images == (Image *) NULL)
123 return((MagickWand *) NULL);
124 average_image=EvaluateImages(wand->images,MeanEvaluateOperator,
125 wand->exception);
126 if (average_image == (Image *) NULL)
127 return((MagickWand *) NULL);
128 return(CloneMagickWandFromImages(wand,average_image));
129}
130
131/*
132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133% %
134% %
135% %
cristy3ed852e2009-09-05 21:47:34 +0000136% M a g i c k C l i p P a t h I m a g e %
137% %
138% %
139% %
140%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
141%
142% MagickClipPathImage() clips along the named paths from the 8BIM profile, if
143% present. Later operations take effect inside the path. Id may be a number
144% if preceded with #, to work on a numbered path, e.g., "#1" to use the first
145% path.
146%
147% The format of the MagickClipPathImage method is:
148%
149% MagickBooleanType MagickClipPathImage(MagickWand *wand,
150% const char *pathname,const MagickBooleanType inside)
151%
152% A description of each parameter follows:
153%
154% o wand: the magick wand.
155%
156% o pathname: name of clipping path resource. If name is preceded by #, use
157% clipping path numbered by name.
158%
159% o inside: if non-zero, later operations take effect inside clipping path.
160% Otherwise later operations take effect outside clipping path.
161%
162*/
163WandExport MagickBooleanType MagickClipPathImage(MagickWand *wand,
164 const char *pathname,const MagickBooleanType inside)
165{
166 return(MagickClipImagePath(wand,pathname,inside));
167}
168/*
169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
170% %
171% %
172% %
173% D r a w G e t F i l l A l p h a %
174% %
175% %
176% %
177%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
178%
179% DrawGetFillAlpha() returns the alpha used when drawing using the fill
180% color or fill texture. Fully opaque is 1.0.
181%
182% The format of the DrawGetFillAlpha method is:
183%
184% double DrawGetFillAlpha(const DrawingWand *wand)
185%
186% A description of each parameter follows:
187%
188% o wand: the drawing wand.
189%
190*/
191WandExport double DrawGetFillAlpha(const DrawingWand *wand)
192{
193 return(DrawGetFillOpacity(wand));
194}
195
196/*
197%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
198% %
199% %
200% %
201% D r a w G e t S t r o k e A l p h a %
202% %
203% %
204% %
205%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206%
207% DrawGetStrokeAlpha() returns the alpha of stroked object outlines.
208%
209% The format of the DrawGetStrokeAlpha method is:
210%
211% double DrawGetStrokeAlpha(const DrawingWand *wand)
212%
213% A description of each parameter follows:
214%
215% o wand: the drawing wand.
216*/
217WandExport double DrawGetStrokeAlpha(const DrawingWand *wand)
218{
219 return(DrawGetStrokeOpacity(wand));
220}
221
222/*
223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
224% %
225% %
226% %
227% D r a w P e e k G r a p h i c W a n d %
228% %
229% %
230% %
231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232%
233% DrawPeekGraphicWand() returns the current drawing wand.
234%
235% The format of the PeekDrawingWand method is:
236%
237% DrawInfo *DrawPeekGraphicWand(const DrawingWand *wand)
238%
239% A description of each parameter follows:
240%
241% o wand: the drawing wand.
242%
243*/
244WandExport DrawInfo *DrawPeekGraphicWand(const DrawingWand *wand)
245{
246 return(PeekDrawingWand(wand));
247}
248
249/*
250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251% %
252% %
253% %
254% D r a w P o p G r a p h i c C o n t e x t %
255% %
256% %
257% %
258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
259%
260% DrawPopGraphicContext() destroys the current drawing wand and returns to the
261% previously pushed drawing wand. Multiple drawing wands may exist. It is an
262% error to attempt to pop more drawing wands than have been pushed, and it is
263% proper form to pop all drawing wands which have been pushed.
264%
265% The format of the DrawPopGraphicContext method is:
266%
267% MagickBooleanType DrawPopGraphicContext(DrawingWand *wand)
268%
269% A description of each parameter follows:
270%
271% o wand: the drawing wand.
272%
273*/
274WandExport void DrawPopGraphicContext(DrawingWand *wand)
275{
276 (void) PopDrawingWand(wand);
277}
278
279/*
280%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
281% %
282% %
283% %
284% D r a w P u s h G r a p h i c C o n t e x t %
285% %
286% %
287% %
288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
289%
290% DrawPushGraphicContext() clones the current drawing wand to create a new
291% drawing wand. The original drawing wand(s) may be returned to by
292% invoking PopDrawingWand(). The drawing wands are stored on a drawing wand
293% stack. For every Pop there must have already been an equivalent Push.
294%
295% The format of the DrawPushGraphicContext method is:
296%
297% MagickBooleanType DrawPushGraphicContext(DrawingWand *wand)
298%
299% A description of each parameter follows:
300%
301% o wand: the drawing wand.
302%
303*/
304WandExport void DrawPushGraphicContext(DrawingWand *wand)
305{
306 (void) PushDrawingWand(wand);
307}
308
309/*
310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311% %
312% %
313% %
314% D r a w S e t F i l l A l p h a %
315% %
316% %
317% %
318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319%
320% DrawSetFillAlpha() sets the alpha to use when drawing using the fill
321% color or fill texture. Fully opaque is 1.0.
322%
323% The format of the DrawSetFillAlpha method is:
324%
325% void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha)
326%
327% A description of each parameter follows:
328%
329% o wand: the drawing wand.
330%
331% o fill_alpha: fill alpha
332%
333*/
334WandExport void DrawSetFillAlpha(DrawingWand *wand,const double fill_alpha)
335{
336 DrawSetFillOpacity(wand,fill_alpha);
337}
338
339/*
340%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
341% %
342% %
343% %
344% D r a w S e t S t r o k e A l p h a %
345% %
346% %
347% %
348%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
349%
350% DrawSetStrokeAlpha() specifies the alpha of stroked object outlines.
351%
352% The format of the DrawSetStrokeAlpha method is:
353%
354% void DrawSetStrokeAlpha(DrawingWand *wand,const double stroke_alpha)
355%
356% A description of each parameter follows:
357%
358% o wand: the drawing wand.
359%
360% o stroke_alpha: stroke alpha. The value 1.0 is opaque.
361%
362*/
363WandExport void DrawSetStrokeAlpha(DrawingWand *wand,const double stroke_alpha)
364{
365 DrawSetStrokeOpacity(wand,stroke_alpha);
366}
367
368/*
369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370% %
371% %
372% %
373% M a g i c k C o l o r F l o o d f i l l I m a g e %
374% %
375% %
376% %
377%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
378%
379% MagickColorFloodfillImage() changes the color value of any pixel that matches
380% target and is an immediate neighbor. If the method FillToBorderMethod is
381% specified, the color value is changed for any neighbor pixel that does not
382% match the bordercolor member of image.
383%
384% The format of the MagickColorFloodfillImage method is:
385%
386% MagickBooleanType MagickColorFloodfillImage(MagickWand *wand,
387% const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
388% const long x,const long y)
389%
390% A description of each parameter follows:
391%
392% o wand: the magick wand.
393%
394% o fill: the floodfill color pixel wand.
395%
396% o fuzz: By default target must match a particular pixel color
397% exactly. However, in many cases two colors may differ by a small amount.
398% The fuzz member of image defines how much tolerance is acceptable to
399% consider two colors as the same. For example, set fuzz to 10 and the
400% color red at intensities of 100 and 102 respectively are now interpreted
401% as the same color for the purposes of the floodfill.
402%
403% o bordercolor: the border color pixel wand.
404%
405% o x,y: the starting location of the operation.
406%
407*/
408WandExport MagickBooleanType MagickColorFloodfillImage(MagickWand *wand,
409 const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
410 const long x,const long y)
411{
412 DrawInfo
413 *draw_info;
414
415 MagickBooleanType
416 status;
417
418 PixelPacket
419 target;
420
421 assert(wand != (MagickWand *) NULL);
422 assert(wand->signature == WandSignature);
423 if (wand->debug != MagickFalse)
424 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
425 if (wand->images == (Image *) NULL)
426 ThrowWandException(WandError,"ContainsNoImages",wand->name);
427 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
428 PixelGetQuantumColor(fill,&draw_info->fill);
429 (void) GetOneVirtualPixel(wand->images,x % wand->images->columns,
430 y % wand->images->rows,&target,wand->exception);
431 if (bordercolor != (PixelWand *) NULL)
432 PixelGetQuantumColor(bordercolor,&target);
433 wand->images->fuzz=fuzz;
434 status=ColorFloodfillImage(wand->images,draw_info,target,x,y,
435 bordercolor != (PixelWand *) NULL ? FillToBorderMethod : FloodfillMethod);
436 if (status == MagickFalse)
437 InheritException(wand->exception,&wand->images->exception);
438 draw_info=DestroyDrawInfo(draw_info);
439 return(status);
440}
441
442/*
443%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
444% %
445% %
446% %
447% M a g i c k D e s c r i b e I m a g e %
448% %
449% %
450% %
451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
452%
453% MagickDescribeImage() identifies an image by printing its attributes to the
454% file. Attributes include the image width, height, size, and others.
455%
456% The format of the MagickDescribeImage method is:
457%
458% const char *MagickDescribeImage(MagickWand *wand)
459%
460% A description of each parameter follows:
461%
462% o wand: the magick wand.
463%
464*/
465WandExport char *MagickDescribeImage(MagickWand *wand)
466{
467 return(MagickIdentifyImage(wand));
468}
469
470/*
471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
472% %
473% %
474% %
475% M a g i c k F l a t t e n I m a g e s %
476% %
477% %
478% %
479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
480%
481% MagickFlattenImages() merges a sequence of images. This useful for
482% combining Photoshop layers into a single image.
483%
484% The format of the MagickFlattenImages method is:
485%
486% MagickWand *MagickFlattenImages(MagickWand *wand)
487%
488% A description of each parameter follows:
489%
490% o wand: the magick wand.
491%
492*/
cristy3ed852e2009-09-05 21:47:34 +0000493WandExport MagickWand *MagickFlattenImages(MagickWand *wand)
494{
495 Image
496 *flatten_image;
497
498 assert(wand != (MagickWand *) NULL);
499 assert(wand->signature == WandSignature);
500 if (wand->debug != MagickFalse)
501 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
502 if (wand->images == (Image *) NULL)
503 return((MagickWand *) NULL);
504 flatten_image=FlattenImages(wand->images,wand->exception);
505 if (flatten_image == (Image *) NULL)
506 return((MagickWand *) NULL);
507 return(CloneMagickWandFromImages(wand,flatten_image));
508}
509
510/*
511%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
512% %
513% %
514% %
515% M a g i c k G e t I m a g e A t t r i b u t e %
516% %
517% %
518% %
519%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520%
521% MagickGetImageAttribute() returns a value associated with the specified
522% property. Use MagickRelinquishMemory() to free the value when you are
523% finished with it.
524%
525% The format of the MagickGetImageAttribute method is:
526%
527% char *MagickGetImageAttribute(MagickWand *wand,const char *property)
528%
529% A description of each parameter follows:
530%
531% o wand: the magick wand.
532%
533% o property: the property.
534%
535*/
536WandExport char *MagickGetImageAttribute(MagickWand *wand,const char *property)
537{
538 return(MagickGetImageProperty(wand,property));
539}
540
541/*
542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
543% %
544% %
545% %
546+ M a g i c k G e t I m a g e I n d e x %
547% %
548% %
549% %
550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
551%
552% MagickGetImageIndex() returns the index of the current image.
553%
554% The format of the MagickGetImageIndex method is:
555%
556% long MagickGetImageIndex(MagickWand *wand)
557%
558% A description of each parameter follows:
559%
560% o wand: the magick wand.
561%
562*/
563WandExport long MagickGetImageIndex(MagickWand *wand)
564{
565 return(MagickGetIteratorIndex(wand));
566}
567
568/*
569%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
570% %
571% %
572% %
573+ M a g i c k G e t I m a g e C h a n n e l E x t r e m a %
574% %
575% %
576% %
577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578%
579% MagickGetImageChannelExtrema() gets the extrema for one or more image
580% channels.
581%
582% The format of the MagickGetImageChannelExtrema method is:
583%
584% MagickBooleanType MagickGetImageChannelExtrema(MagickWand *wand,
585% const ChannelType channel,unsigned long *minima,unsigned long *maxima)
586%
587% A description of each parameter follows:
588%
589% o wand: the magick wand.
590%
591% o channel: the image channel(s).
592%
593% o minima: The minimum pixel value for the specified channel(s).
594%
595% o maxima: The maximum pixel value for the specified channel(s).
596%
597*/
598WandExport MagickBooleanType MagickGetImageChannelExtrema(MagickWand *wand,
599 const ChannelType channel,unsigned long *minima,unsigned long *maxima)
600{
601 MagickBooleanType
602 status;
603
604 assert(wand != (MagickWand *) NULL);
605 assert(wand->signature == WandSignature);
606 if (wand->debug != MagickFalse)
607 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
608 if (wand->images == (Image *) NULL)
609 ThrowWandException(WandError,"ContainsNoImages",wand->name);
610 status=GetImageChannelExtrema(wand->images,channel,minima,maxima,
611 wand->exception);
612 return(status);
613}
614
615/*
616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
617% %
618% %
619% %
620+ M a g i c k G e t I m a g e E x t r e m a %
621% %
622% %
623% %
624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
625%
626% MagickGetImageExtrema() gets the extrema for the image.
627%
628% The format of the MagickGetImageExtrema method is:
629%
630% MagickBooleanType MagickGetImageExtrema(MagickWand *wand,
631% unsigned long *minima,unsigned long *maxima)
632%
633% A description of each parameter follows:
634%
635% o wand: the magick wand.
636%
637% o minima: The minimum pixel value for the specified channel(s).
638%
639% o maxima: The maximum pixel value for the specified channel(s).
640%
641*/
642WandExport MagickBooleanType MagickGetImageExtrema(MagickWand *wand,
643 unsigned long *minima,unsigned long *maxima)
644{
645 MagickBooleanType
646 status;
647
648 assert(wand != (MagickWand *) NULL);
649 assert(wand->signature == WandSignature);
650 if (wand->debug != MagickFalse)
651 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
652 if (wand->images == (Image *) NULL)
653 ThrowWandException(WandError,"ContainsNoImages",wand->name);
654 status=GetImageExtrema(wand->images,minima,maxima,wand->exception);
655 return(status);
656}
657
658/*
659%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
660% %
661% %
662% %
663% M a g i c k G e t I m a g e M a t t e %
664% %
665% %
666% %
667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
668%
669% MagickGetImageMatte() returns MagickTrue if the image has a matte channel
670% otherwise MagickFalse.
671%
672% The format of the MagickGetImageMatte method is:
673%
674% unsigned long MagickGetImageMatte(MagickWand *wand)
675%
676% A description of each parameter follows:
677%
678% o wand: the magick wand.
679%
680*/
681WandExport MagickBooleanType MagickGetImageMatte(MagickWand *wand)
682{
683 assert(wand != (MagickWand *) NULL);
684 assert(wand->signature == WandSignature);
685 if (wand->debug != MagickFalse)
686 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
687 if (wand->images == (Image *) NULL)
688 ThrowWandException(WandError,"ContainsNoImages",wand->name);
689 return(wand->images->matte);
690}
691
692/*
693%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
694% %
695% %
696% %
697% M a g i c k G e t I m a g e P i x e l s %
698% %
699% %
700% %
701%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
702%
703% MagickGetImagePixels() extracts pixel data from an image and returns it to
704% you. The method returns MagickTrue on success otherwise MagickFalse if an
705% error is encountered. The data is returned as char, short int, int, long,
706% float, or double in the order specified by map.
707%
708% Suppose you want to extract the first scanline of a 640x480 image as
709% character data in red-green-blue order:
710%
711% MagickGetImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
712%
713% The format of the MagickGetImagePixels method is:
714%
715% MagickBooleanType MagickGetImagePixels(MagickWand *wand,
716% const long x,const long y,const unsigned long columns,
717% const unsigned long rows,const char *map,const StorageType storage,
718% void *pixels)
719%
720% A description of each parameter follows:
721%
722% o wand: the magick wand.
723%
724% o x, y, columns, rows: These values define the perimeter
725% of a region of pixels you want to extract.
726%
727% o map: This string reflects the expected ordering of the pixel array.
728% It can be any combination or order of R = red, G = green, B = blue,
729% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
730% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
731% P = pad.
732%
733% o storage: Define the data type of the pixels. Float and double types are
734% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
735% these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
736% LongPixel, QuantumPixel, or ShortPixel.
737%
738% o pixels: This array of values contain the pixel components as defined by
739% map and type. You must preallocate this array where the expected
740% length varies depending on the values of width, height, map, and type.
741%
742*/
743WandExport MagickBooleanType MagickGetImagePixels(MagickWand *wand,
744 const long x,const long y,const unsigned long columns,
745 const unsigned long rows,const char *map,const StorageType storage,
746 void *pixels)
747{
748 return(MagickExportImagePixels(wand,x,y,columns,rows,map,storage,pixels));
749}
750
751/*
752%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
753% %
754% %
755% %
756% M a g i c k G e t I m a g e S i z e %
757% %
758% %
759% %
760%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
761%
762% MagickGetImageSize() returns the image length in bytes.
763%
764% The format of the MagickGetImageSize method is:
765%
766% MagickBooleanType MagickGetImageSize(MagickWand *wand,
767% MagickSizeType *length)
768%
769% A description of each parameter follows:
770%
771% o wand: the magick wand.
772%
773% o length: the image length in bytes.
774%
775*/
776WandExport MagickSizeType MagickGetImageSize(MagickWand *wand)
777{
778 assert(wand != (MagickWand *) NULL);
779 assert(wand->signature == WandSignature);
780 if (wand->debug != MagickFalse)
781 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
782 if (wand->images == (Image *) NULL)
783 ThrowWandException(WandError,"ContainsNoImages",wand->name);
784 return(GetBlobSize(wand->images));
785}
786
787/*
788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
789% %
790% %
791% %
792% M a g i c k M a p I m a g e %
793% %
794% %
795% %
796%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
797%
798% MagickMapImage() replaces the colors of an image with the closest color
799% from a reference image.
800%
801% The format of the MagickMapImage method is:
802%
803% MagickBooleanType MagickMapImage(MagickWand *wand,
804% const MagickWand *map_wand,const MagickBooleanType dither)
805%
806% A description of each parameter follows:
807%
808% o wand: the magick wand.
809%
810% o map: the map wand.
811%
812% o dither: Set this integer value to something other than zero to dither
813% the mapped image.
814%
815*/
816WandExport MagickBooleanType MagickMapImage(MagickWand *wand,
817 const MagickWand *map_wand,const MagickBooleanType dither)
818{
819 MagickBooleanType
820 status;
821
822 assert(wand != (MagickWand *) NULL);
823 assert(wand->signature == WandSignature);
824 if (wand->debug != MagickFalse)
825 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826 if ((wand->images == (Image *) NULL) || (map_wand->images == (Image *) NULL))
827 ThrowWandException(WandError,"ContainsNoImages",wand->name);
828 status=MapImage(wand->images,map_wand->images,dither);
829 if (status == MagickFalse)
830 InheritException(wand->exception,&wand->images->exception);
831 return(status);
832}
833
834/*
835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
836% %
837% %
838% %
839% M a g i c k M a t t e F l o o d f i l l I m a g e %
840% %
841% %
842% %
843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
844%
845% MagickMatteFloodfillImage() changes the transparency value of any pixel that
846% matches target and is an immediate neighbor. If the method
847% FillToBorderMethod is specified, the transparency value is changed for any
848% neighbor pixel that does not match the bordercolor member of image.
849%
850% The format of the MagickMatteFloodfillImage method is:
851%
852% MagickBooleanType MagickMatteFloodfillImage(MagickWand *wand,
853% const double alpha,const double fuzz,const PixelWand *bordercolor,
854% const long x,const long y)
855%
856% A description of each parameter follows:
857%
858% o wand: the magick wand.
859%
860% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
861% transparent.
862%
863% o fuzz: By default target must match a particular pixel color
864% exactly. However, in many cases two colors may differ by a small amount.
865% The fuzz member of image defines how much tolerance is acceptable to
866% consider two colors as the same. For example, set fuzz to 10 and the
867% color red at intensities of 100 and 102 respectively are now interpreted
868% as the same color for the purposes of the floodfill.
869%
870% o bordercolor: the border color pixel wand.
871%
872% o x,y: the starting location of the operation.
873%
874*/
875WandExport MagickBooleanType MagickMatteFloodfillImage(MagickWand *wand,
876 const double alpha,const double fuzz,const PixelWand *bordercolor,
877 const long x,const long y)
878{
879 DrawInfo
880 *draw_info;
881
882 MagickBooleanType
883 status;
884
885 PixelPacket
886 target;
887
888 assert(wand != (MagickWand *) NULL);
889 assert(wand->signature == WandSignature);
890 if (wand->debug != MagickFalse)
891 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
892 if (wand->images == (Image *) NULL)
893 ThrowWandException(WandError,"ContainsNoImages",wand->name);
894 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
895 (void) GetOneVirtualPixel(wand->images,x % wand->images->columns,
896 y % wand->images->rows,&target,wand->exception);
897 if (bordercolor != (PixelWand *) NULL)
898 PixelGetQuantumColor(bordercolor,&target);
899 wand->images->fuzz=fuzz;
cristyce70c172010-01-07 17:15:30 +0000900 status=MatteFloodfillImage(wand->images,target,ClampToQuantum(
cristy3ed852e2009-09-05 21:47:34 +0000901 (MagickRealType) QuantumRange-QuantumRange*alpha),x,y,bordercolor !=
902 (PixelWand *) NULL ? FillToBorderMethod : FloodfillMethod);
903 if (status == MagickFalse)
904 InheritException(wand->exception,&wand->images->exception);
905 draw_info=DestroyDrawInfo(draw_info);
906 return(status);
907}
908
909/*
910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
911% %
912% %
913% %
cristyd18ae7c2010-03-07 17:39:52 +0000914% M a g i c k M a x i m u m I m a g e s %
915% %
916% %
917% %
918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
919%
920% MagickMaximumImages() returns the maximum intensity of an image sequence.
921%
922% The format of the MagickMaximumImages method is:
923%
924% MagickWand *MagickMaximumImages(MagickWand *wand)
925%
926% A description of each parameter follows:
927%
928% o wand: the magick wand.
929%
930*/
931WandExport MagickWand *MagickMaximumImages(MagickWand *wand)
932{
933 Image
934 *maximum_image;
935
936 assert(wand != (MagickWand *) NULL);
937 assert(wand->signature == WandSignature);
938 if (wand->debug != MagickFalse)
939 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
940 if (wand->images == (Image *) NULL)
941 return((MagickWand *) NULL);
942 maximum_image=EvaluateImages(wand->images,MaxEvaluateOperator,
943 wand->exception);
944 if (maximum_image == (Image *) NULL)
945 return((MagickWand *) NULL);
946 return(CloneMagickWandFromImages(wand,maximum_image));
947}
948
949/*
950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
951% %
952% %
953% %
954% M a g i c k M i n i m u m I m a g e s %
955% %
956% %
957% %
958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
959%
960% MagickMinimumImages() returns the minimum intensity of an image sequence.
961%
962% The format of the MagickMinimumImages method is:
963%
964% MagickWand *MagickMinimumImages(MagickWand *wand)
965%
966% A description of each parameter follows:
967%
968% o wand: the magick wand.
969%
970*/
971WandExport MagickWand *MagickMinimumImages(MagickWand *wand)
972{
973 Image
974 *minimum_image;
975
976 assert(wand != (MagickWand *) NULL);
977 assert(wand->signature == WandSignature);
978 if (wand->debug != MagickFalse)
979 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
980 if (wand->images == (Image *) NULL)
981 return((MagickWand *) NULL);
982 minimum_image=EvaluateImages(wand->images,MinEvaluateOperator,
983 wand->exception);
984 if (minimum_image == (Image *) NULL)
985 return((MagickWand *) NULL);
986 return(CloneMagickWandFromImages(wand,minimum_image));
987}
988
989/*
990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991% %
992% %
993% %
cristy3ed852e2009-09-05 21:47:34 +0000994% M a g i c k M o s a i c I m a g e s %
995% %
996% %
997% %
998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
999%
1000% MagickMosaicImages() inlays an image sequence to form a single coherent
1001% picture. It returns a wand with each image in the sequence composited at
1002% the location defined by the page offset of the image.
1003%
1004% The format of the MagickMosaicImages method is:
1005%
1006% MagickWand *MagickMosaicImages(MagickWand *wand)
1007%
1008% A description of each parameter follows:
1009%
1010% o wand: the magick wand.
1011%
1012*/
1013WandExport MagickWand *MagickMosaicImages(MagickWand *wand)
1014{
1015 Image
1016 *mosaic_image;
1017
1018 assert(wand != (MagickWand *) NULL);
1019 assert(wand->signature == WandSignature);
1020 if (wand->debug != MagickFalse)
1021 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1022 if (wand->images == (Image *) NULL)
1023 return((MagickWand *) NULL);
1024 mosaic_image=MosaicImages(wand->images,wand->exception);
1025 if (mosaic_image == (Image *) NULL)
1026 return((MagickWand *) NULL);
1027 return(CloneMagickWandFromImages(wand,mosaic_image));
1028}
1029
1030/*
1031%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1032% %
1033% %
1034% %
1035% M a g i c k O p a q u e I m a g e %
1036% %
1037% %
1038% %
1039%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1040%
1041% MagickOpaqueImage() changes any pixel that matches color with the color
1042% defined by fill.
1043%
1044% The format of the MagickOpaqueImage method is:
1045%
1046% MagickBooleanType MagickOpaqueImage(MagickWand *wand,
1047% const PixelWand *target,const PixelWand *fill,const double fuzz)
1048%
1049% A description of each parameter follows:
1050%
1051% o wand: the magick wand.
1052%
1053% o channel: the channel(s).
1054%
1055% o target: Change this target color to the fill color within the image.
1056%
1057% o fill: the fill pixel wand.
1058%
1059% o fuzz: By default target must match a particular pixel color
1060% exactly. However, in many cases two colors may differ by a small amount.
1061% The fuzz member of image defines how much tolerance is acceptable to
1062% consider two colors as the same. For example, set fuzz to 10 and the
1063% color red at intensities of 100 and 102 respectively are now interpreted
1064% as the same color for the purposes of the floodfill.
1065%
1066*/
1067WandExport MagickBooleanType MagickOpaqueImage(MagickWand *wand,
1068 const PixelWand *target,const PixelWand *fill,const double fuzz)
1069{
1070 return(MagickPaintOpaqueImage(wand,target,fill,fuzz));
1071}
1072
1073/*
1074%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1075% %
1076% %
1077% %
1078% M a g i c k P a i n t F l o o d f i l l I m a g e %
1079% %
1080% %
1081% %
1082%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1083%
1084% MagickPaintFloodfillImage() changes the color value of any pixel that matches
1085% target and is an immediate neighbor. If the method FillToBorderMethod is
1086% specified, the color value is changed for any neighbor pixel that does not
1087% match the bordercolor member of image.
1088%
1089% The format of the MagickPaintFloodfillImage method is:
1090%
1091% MagickBooleanType MagickPaintFloodfillImage(MagickWand *wand,
1092% const ChannelType channel,const PixelWand *fill,const double fuzz,
1093% const PixelWand *bordercolor,const long x,const long y)
1094%
1095% A description of each parameter follows:
1096%
1097% o wand: the magick wand.
cristy6a917d92009-10-06 19:23:54 +00001098%
cristy3ed852e2009-09-05 21:47:34 +00001099% o channel: the channel(s).
1100%
1101% o fill: the floodfill color pixel wand.
1102%
1103% o fuzz: By default target must match a particular pixel color
1104% exactly. However, in many cases two colors may differ by a small amount.
1105% The fuzz member of image defines how much tolerance is acceptable to
1106% consider two colors as the same. For example, set fuzz to 10 and the
1107% color red at intensities of 100 and 102 respectively are now interpreted
1108% as the same color for the purposes of the floodfill.
1109%
1110% o bordercolor: the border color pixel wand.
1111%
1112% o x,y: the starting location of the operation.
1113%
1114*/
1115WandExport MagickBooleanType MagickPaintFloodfillImage(MagickWand *wand,
1116 const ChannelType channel,const PixelWand *fill,const double fuzz,
1117 const PixelWand *bordercolor,const long x,const long y)
1118{
1119 MagickBooleanType
1120 status;
1121
1122 status=MagickFloodfillPaintImage(wand,channel,fill,fuzz,bordercolor,x,y,
1123 MagickFalse);
1124 return(status);
1125}
1126
1127/*
1128%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1129% %
1130% %
1131% %
1132% M a g i c k P a i n t O p a q u e I m a g e %
1133% %
1134% %
1135% %
1136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1137%
1138% MagickPaintOpaqueImage() changes any pixel that matches color with the color
1139% defined by fill.
1140%
1141% The format of the MagickPaintOpaqueImage method is:
1142%
1143% MagickBooleanType MagickPaintOpaqueImage(MagickWand *wand,
1144% const PixelWand *target,const PixelWand *fill,const double fuzz)
1145% MagickBooleanType MagickPaintOpaqueImageChannel(MagickWand *wand,
1146% const ChannelType channel,const PixelWand *target,
1147% const PixelWand *fill,const double fuzz)
1148%
1149% A description of each parameter follows:
1150%
1151% o wand: the magick wand.
1152%
1153% o channel: the channel(s).
1154%
1155% o target: Change this target color to the fill color within the image.
1156%
1157% o fill: the fill pixel wand.
1158%
1159% o fuzz: By default target must match a particular pixel color
1160% exactly. However, in many cases two colors may differ by a small amount.
1161% The fuzz member of image defines how much tolerance is acceptable to
1162% consider two colors as the same. For example, set fuzz to 10 and the
1163% color red at intensities of 100 and 102 respectively are now interpreted
1164% as the same color for the purposes of the floodfill.
1165%
1166*/
1167
1168WandExport MagickBooleanType MagickPaintOpaqueImage(MagickWand *wand,
1169 const PixelWand *target,const PixelWand *fill,const double fuzz)
1170{
1171 return(MagickPaintOpaqueImageChannel(wand,DefaultChannels,target,fill,fuzz));
1172}
1173
1174WandExport MagickBooleanType MagickPaintOpaqueImageChannel(MagickWand *wand,
1175 const ChannelType channel,const PixelWand *target,const PixelWand *fill,
1176 const double fuzz)
1177{
1178 MagickBooleanType
1179 status;
1180
1181 status=MagickOpaquePaintImageChannel(wand,channel,target,fill,fuzz,
1182 MagickFalse);
1183 return(status);
1184}
1185
1186/*
1187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1188% %
1189% %
1190% %
1191% M a g i c k P a i n t T r a n s p a r e n t I m a g e %
1192% %
1193% %
1194% %
1195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1196%
1197% MagickPaintTransparentImage() changes any pixel that matches color with the
1198% color defined by fill.
1199%
1200% The format of the MagickPaintTransparentImage method is:
1201%
1202% MagickBooleanType MagickPaintTransparentImage(MagickWand *wand,
1203% const PixelWand *target,const double alpha,const double fuzz)
1204%
1205% A description of each parameter follows:
1206%
1207% o wand: the magick wand.
1208%
1209% o target: Change this target color to specified opacity value within
1210% the image.
1211%
1212% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
1213% transparent.
1214%
1215% o fuzz: By default target must match a particular pixel color
1216% exactly. However, in many cases two colors may differ by a small amount.
1217% The fuzz member of image defines how much tolerance is acceptable to
1218% consider two colors as the same. For example, set fuzz to 10 and the
1219% color red at intensities of 100 and 102 respectively are now interpreted
1220% as the same color for the purposes of the floodfill.
1221%
1222*/
1223WandExport MagickBooleanType MagickPaintTransparentImage(MagickWand *wand,
1224 const PixelWand *target,const double alpha,const double fuzz)
1225{
1226 return(MagickTransparentPaintImage(wand,target,alpha,fuzz,MagickFalse));
1227}
1228
1229/*
1230%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1231% %
1232% %
1233% %
cristye6365592010-04-02 17:31:23 +00001234% M a g i c k R e c o l o r I m a g e %
1235% %
1236% %
1237% %
1238%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1239%
1240% MagickRecolorImage() apply color transformation to an image. The method
1241% permits saturation changes, hue rotation, luminance to alpha, and various
1242% other effects. Although variable-sized transformation matrices can be used,
1243% typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1244% (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
1245% except offsets are in column 6 rather than 5 (in support of CMYKA images)
1246% and offsets are normalized (divide Flash offset by 255).
1247%
1248% The format of the MagickRecolorImage method is:
1249%
1250% MagickBooleanType MagickRecolorImage(MagickWand *wand,
1251% const unsigned long order,const double *color_matrix)
1252%
1253% A description of each parameter follows:
1254%
1255% o wand: the magick wand.
1256%
1257% o order: the number of columns and rows in the color matrix.
1258%
1259% o color_matrix: An array of doubles representing the color matrix.
1260%
1261*/
1262WandExport MagickBooleanType MagickRecolorImage(MagickWand *wand,
1263 const unsigned long order,const double *color_matrix)
1264{
1265 Image
1266 *transform_image;
1267
1268 assert(wand != (MagickWand *) NULL);
1269 assert(wand->signature == WandSignature);
1270 if (wand->debug != MagickFalse)
1271 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1272 if (color_matrix == (const double *) NULL)
1273 return(MagickFalse);
1274 if (wand->images == (Image *) NULL)
1275 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1276 transform_image=RecolorImage(wand->images,order,color_matrix,
1277 wand->exception);
1278 if (transform_image == (Image *) NULL)
1279 return(MagickFalse);
1280 ReplaceImageInList(&wand->images,transform_image);
1281 return(MagickTrue);
1282}
1283
1284/*
1285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1286% %
1287% %
1288% %
cristy3ed852e2009-09-05 21:47:34 +00001289% M a g i c k S e t I m a g e A t t r i b u t e %
1290% %
1291% %
1292% %
1293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1294%
1295% MagickSetImageAttribute() associates a property with an image.
1296%
1297% The format of the MagickSetImageAttribute method is:
1298%
1299% MagickBooleanType MagickSetImageAttribute(MagickWand *wand,
1300% const char *property,const char *value)
1301%
1302% A description of each parameter follows:
1303%
1304% o wand: the magick wand.
1305%
1306% o property: the property.
1307%
1308% o value: the value.
1309%
1310*/
1311WandExport MagickBooleanType MagickSetImageAttribute(MagickWand *wand,
1312 const char *property,const char *value)
1313{
1314 return(SetImageProperty(wand->images,property,value));
1315}
1316
1317/*
1318%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1319% %
1320% %
1321% %
1322% M a g i c k S e t I m a g e I n d e x %
1323% %
1324% %
1325% %
1326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1327%
1328% MagickSetImageIndex() set the current image to the position of the list
1329% specified with the index parameter.
1330%
1331% The format of the MagickSetImageIndex method is:
1332%
1333% MagickBooleanType MagickSetImageIndex(MagickWand *wand,const long index)
1334%
1335% A description of each parameter follows:
1336%
1337% o wand: the magick wand.
1338%
1339% o index: the scene number.
1340%
1341*/
1342WandExport MagickBooleanType MagickSetImageIndex(MagickWand *wand,
1343 const long index)
1344{
1345 return(MagickSetIteratorIndex(wand,index));
1346}
1347
1348/*
1349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1350% %
1351% %
1352% %
1353+ M a g i c k S e t I m a g e O p t i o n %
1354% %
1355% %
1356% %
1357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1358%
1359% MagickSetImageOption() associates one or options with a particular image
1360% format (.e.g MagickSetImageOption(wand,"jpeg","perserve","yes").
1361%
1362% The format of the MagickSetImageOption method is:
1363%
1364% MagickBooleanType MagickSetImageOption(MagickWand *wand,
1365% const char *format,const char *key,const char *value)
1366%
1367% A description of each parameter follows:
1368%
1369% o wand: the magick wand.
1370%
1371% o format: the image format.
1372%
1373% o key: The key.
1374%
1375% o value: The value.
1376%
1377*/
1378WandExport MagickBooleanType MagickSetImageOption(MagickWand *wand,
1379 const char *format,const char *key,const char *value)
1380{
1381 char
1382 option[MaxTextExtent];
1383
1384 assert(wand != (MagickWand *) NULL);
1385 assert(wand->signature == WandSignature);
1386 if (wand->debug != MagickFalse)
1387 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1388 (void) FormatMagickString(option,MaxTextExtent,"%s:%s=%s",format,key,value);
1389 return(DefineImageOption(wand->image_info,option));
1390}
1391
1392/*
1393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1394% %
1395% %
1396% %
1397% M a g i c k T r a n s p a r e n t I m a g e %
1398% %
1399% %
1400% %
1401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1402%
1403% MagickTransparentImage() changes any pixel that matches color with the
1404% color defined by fill.
1405%
1406% The format of the MagickTransparentImage method is:
1407%
1408% MagickBooleanType MagickTransparentImage(MagickWand *wand,
1409% const PixelWand *target,const double alpha,const double fuzz)
1410%
1411% A description of each parameter follows:
1412%
1413% o wand: the magick wand.
1414%
1415% o target: Change this target color to specified opacity value within
1416% the image.
1417%
1418% o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
1419% transparent.
1420%
1421% o fuzz: By default target must match a particular pixel color
1422% exactly. However, in many cases two colors may differ by a small amount.
1423% The fuzz member of image defines how much tolerance is acceptable to
1424% consider two colors as the same. For example, set fuzz to 10 and the
1425% color red at intensities of 100 and 102 respectively are now interpreted
1426% as the same color for the purposes of the floodfill.
1427%
1428*/
1429WandExport MagickBooleanType MagickTransparentImage(MagickWand *wand,
1430 const PixelWand *target,const double alpha,const double fuzz)
1431{
1432 return(MagickPaintTransparentImage(wand,target,alpha,fuzz));
1433}
1434
1435/*
1436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1437% %
1438% %
1439% %
1440% M a g i c k R e g i o n O f I n t e r e s t I m a g e %
1441% %
1442% %
1443% %
1444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1445%
1446% MagickRegionOfInterestImage() extracts a region of the image and returns it
1447% as a new wand.
1448%
1449% The format of the MagickRegionOfInterestImage method is:
1450%
1451% MagickWand *MagickRegionOfInterestImage(MagickWand *wand,
1452% const unsigned long width,const unsigned long height,const long x,
1453% const long y)
1454%
1455% A description of each parameter follows:
1456%
1457% o wand: the magick wand.
1458%
1459% o width: the region width.
1460%
1461% o height: the region height.
1462%
1463% o x: the region x offset.
1464%
1465% o y: the region y offset.
1466%
1467*/
1468WandExport MagickWand *MagickRegionOfInterestImage(MagickWand *wand,
1469 const unsigned long width,const unsigned long height,const long x,
1470 const long y)
1471{
1472 return(MagickGetImageRegion(wand,width,height,x,y));
1473}
1474
1475/*
1476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1477% %
1478% %
1479% %
1480% M a g i c k S e t I m a g e P i x e l s %
1481% %
1482% %
1483% %
1484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1485%
1486% MagickSetImagePixels() accepts pixel datand stores it in the image at the
1487% location you specify. The method returns MagickFalse on success otherwise
1488% MagickTrue if an error is encountered. The pixel data can be either char,
1489% short int, int, long, float, or double in the order specified by map.
1490%
1491% Suppose your want to upload the first scanline of a 640x480 image from
1492% character data in red-green-blue order:
1493%
1494% MagickSetImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
1495%
1496% The format of the MagickSetImagePixels method is:
1497%
1498% MagickBooleanType MagickSetImagePixels(MagickWand *wand,
1499% const long x,const long y,const unsigned long columns,
1500% const unsigned long rows,const char *map,const StorageType storage,
1501% const void *pixels)
1502%
1503% A description of each parameter follows:
1504%
1505% o wand: the magick wand.
1506%
1507% o x, y, columns, rows: These values define the perimeter of a region
1508% of pixels you want to define.
1509%
1510% o map: This string reflects the expected ordering of the pixel array.
1511% It can be any combination or order of R = red, G = green, B = blue,
1512% A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
1513% Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
1514% P = pad.
1515%
1516% o storage: Define the data type of the pixels. Float and double types are
1517% expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from
1518% these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
1519% or DoublePixel.
1520%
1521% o pixels: This array of values contain the pixel components as defined by
1522% map and type. You must preallocate this array where the expected
1523% length varies depending on the values of width, height, map, and type.
1524%
1525*/
1526WandExport MagickBooleanType MagickSetImagePixels(MagickWand *wand,
1527 const long x,const long y,const unsigned long columns,
1528 const unsigned long rows,const char *map,const StorageType storage,
1529 const void *pixels)
1530{
1531 return(MagickImportImagePixels(wand,x,y,columns,rows,map,storage,pixels));
1532}
1533
1534/*
1535%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1536% %
1537% %
1538% %
1539% M a g i c k W r i t e I m a g e B l o b %
1540% %
1541% %
1542% %
1543%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1544%
1545% MagickWriteImageBlob() implements direct to memory image formats. It
1546% returns the image as a blob and its length. Use MagickSetFormat() to
1547% set the format of the returned blob (GIF, JPEG, PNG, etc.).
1548%
1549% Use MagickRelinquishMemory() to free the blob when you are done with it.
1550%
1551% The format of the MagickWriteImageBlob method is:
1552%
1553% unsigned char *MagickWriteImageBlob(MagickWand *wand,size_t *length)
1554%
1555% A description of each parameter follows:
1556%
1557% o wand: the magick wand.
1558%
1559% o length: the length of the blob.
1560%
1561*/
1562WandExport unsigned char *MagickWriteImageBlob(MagickWand *wand,size_t *length)
1563{
1564 return(MagickGetImageBlob(wand,length));
1565}
1566
1567/*
1568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1569% %
1570% %
1571% %
1572% P i x e l G e t N e x t R o w %
1573% %
1574% %
1575% %
1576%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1577%
1578% PixelGetNextRow() returns the next row as an array of pixel wands from the
1579% pixel iterator.
1580%
1581% The format of the PixelGetNextRow method is:
1582%
1583% PixelWand **PixelGetNextRow(PixelIterator *iterator,
1584% unsigned long *number_wands)
1585%
1586% A description of each parameter follows:
1587%
1588% o iterator: the pixel iterator.
1589%
1590% o number_wands: the number of pixel wands.
1591%
1592*/
1593WandExport PixelWand **PixelGetNextRow(PixelIterator *iterator)
1594{
1595 unsigned long
1596 number_wands;
1597
1598 return(PixelGetNextIteratorRow(iterator,&number_wands));
1599}
1600
1601/*
1602%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1603% %
1604% %
1605% %
1606% P i x e l I t e r a t o r G e t E x c e p t i o n %
1607% %
1608% %
1609% %
1610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1611%
1612% PixelIteratorGetException() returns the severity, reason, and description of
1613% any error that occurs when using other methods in this API.
1614%
1615% The format of the PixelIteratorGetException method is:
1616%
1617% char *PixelIteratorGetException(const Pixeliterator *iterator,
1618% ExceptionType *severity)
1619%
1620% A description of each parameter follows:
1621%
1622% o iterator: the pixel iterator.
1623%
1624% o severity: the severity of the error is returned here.
1625%
1626*/
1627WandExport char *PixelIteratorGetException(const PixelIterator *iterator,
1628 ExceptionType *severity)
1629{
1630 return(PixelGetIteratorException(iterator,severity));
1631}
1632#endif