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 % PPPP RRRR OOO PPPP EEEEE RRRR TTTTT Y Y %
13 % P P R R O O P P E R R T Y Y %
14 % PPPP RRRR O O PPPP EEE RRRR T Y %
15 % P R R O O P E R R T Y %
16 % P R R OOO P EEEEE R R T Y %
17 % %
18 % %
19 % Set or Get MagickWand Properties, Options, or Profiles %
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 "magick/image-private.h"
54 #include "magick/string-private.h"
55
56 /*
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 % %
59 % %
60 % %
61 % M a g i c k D e l e t e I m a g e A r t i f a c t %
62 % %
63 % %
64 % %
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 %
67 % MagickDeleteImageArtifact() deletes a wand artifact.
68 %
69 % The format of the MagickDeleteImageArtifact method is:
70 %
71 % MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand,
72 % const char *artifact)
73 %
74 % A description of each parameter follows:
75 %
76 % o image: the image.
77 %
78 % o artifact: the image artifact.
79 %
80 */
MagickDeleteImageArtifact(MagickWand * wand,const char * artifact)81 WandExport MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand,
82 const char *artifact)
83 {
84 assert(wand != (MagickWand *) NULL);
85 assert(wand->signature == WandSignature);
86 if (wand->debug != MagickFalse)
87 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
88 if (wand->images == (Image *) NULL)
89 {
90 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
91 "ContainsNoImages","`%s'",wand->name);
92 return(MagickFalse);
93 }
94 return(DeleteImageArtifact(wand->images,artifact));
95 }
96
97 /*
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 % %
100 % %
101 % %
102 % M a g i c k D e l e t e I m a g e P r o p e r t y %
103 % %
104 % %
105 % %
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107 %
108 % MagickDeleteImageProperty() deletes a wand property.
109 %
110 % The format of the MagickDeleteImageProperty method is:
111 %
112 % MagickBooleanType MagickDeleteImageProperty(MagickWand *wand,
113 % const char *property)
114 %
115 % A description of each parameter follows:
116 %
117 % o image: the image.
118 %
119 % o property: the image property.
120 %
121 */
MagickDeleteImageProperty(MagickWand * wand,const char * property)122 WandExport MagickBooleanType MagickDeleteImageProperty(MagickWand *wand,
123 const char *property)
124 {
125 assert(wand != (MagickWand *) NULL);
126 assert(wand->signature == WandSignature);
127 if (wand->debug != MagickFalse)
128 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
129 if (wand->images == (Image *) NULL)
130 {
131 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
132 "ContainsNoImages","`%s'",wand->name);
133 return(MagickFalse);
134 }
135 return(DeleteImageProperty(wand->images,property));
136 }
137
138 /*
139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
140 % %
141 % %
142 % %
143 % M a g i c k D e l e t e O p t i o n %
144 % %
145 % %
146 % %
147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
148 %
149 % MagickDeleteOption() deletes a wand option.
150 %
151 % The format of the MagickDeleteOption method is:
152 %
153 % MagickBooleanType MagickDeleteOption(MagickWand *wand,
154 % const char *option)
155 %
156 % A description of each parameter follows:
157 %
158 % o image: the image.
159 %
160 % o option: the image option.
161 %
162 */
MagickDeleteOption(MagickWand * wand,const char * option)163 WandExport MagickBooleanType MagickDeleteOption(MagickWand *wand,
164 const char *option)
165 {
166 assert(wand != (MagickWand *) NULL);
167 assert(wand->signature == WandSignature);
168 if (wand->debug != MagickFalse)
169 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
170 return(DeleteImageOption(wand->image_info,option));
171 }
172
173 /*
174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
175 % %
176 % %
177 % %
178 % M a g i c k G e t A n t i a l i a s %
179 % %
180 % %
181 % %
182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183 %
184 % MagickGetAntialias() returns the antialias property associated with the
185 % wand.
186 %
187 % The format of the MagickGetAntialias method is:
188 %
189 % MagickBooleanType MagickGetAntialias(const MagickWand *wand)
190 %
191 % A description of each parameter follows:
192 %
193 % o wand: the magick wand.
194 %
195 */
MagickGetAntialias(const MagickWand * wand)196 WandExport MagickBooleanType MagickGetAntialias(const MagickWand *wand)
197 {
198 assert(wand != (const MagickWand *) NULL);
199 assert(wand->signature == WandSignature);
200 if (wand->debug != MagickFalse)
201 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
202 return(wand->image_info->antialias);
203 }
204
205 /*
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 % %
208 % %
209 % %
210 % M a g i c k G e t B a c k g r o u n d C o l o r %
211 % %
212 % %
213 % %
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %
216 % MagickGetBackgroundColor() returns the wand background color.
217 %
218 % The format of the MagickGetBackgroundColor method is:
219 %
220 % PixelWand *MagickGetBackgroundColor(MagickWand *wand)
221 %
222 % A description of each parameter follows:
223 %
224 % o wand: the magick wand.
225 %
226 */
MagickGetBackgroundColor(MagickWand * wand)227 WandExport PixelWand *MagickGetBackgroundColor(MagickWand *wand)
228 {
229 PixelWand
230 *background_color;
231
232 assert(wand != (MagickWand *) NULL);
233 assert(wand->signature == WandSignature);
234 if (wand->debug != MagickFalse)
235 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
236 background_color=NewPixelWand();
237 PixelSetQuantumColor(background_color,&wand->image_info->background_color);
238 return(background_color);
239 }
240
241 /*
242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
243 % %
244 % %
245 % %
246 % M a g i c k G e t C o l o r s p a c e %
247 % %
248 % %
249 % %
250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251 %
252 % MagickGetColorspace() gets the wand colorspace type.
253 %
254 % The format of the MagickGetColorspace method is:
255 %
256 % ColorspaceType MagickGetColorspace(MagickWand *wand)
257 %
258 % A description of each parameter follows:
259 %
260 % o wand: the magick wand.
261 %
262 */
MagickGetColorspace(MagickWand * wand)263 WandExport ColorspaceType MagickGetColorspace(MagickWand *wand)
264 {
265 assert(wand != (MagickWand *) NULL);
266 assert(wand->signature == WandSignature);
267 if (wand->debug != MagickFalse)
268 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
269 return(wand->image_info->colorspace);
270 }
271
272 /*
273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274 % %
275 % %
276 % %
277 % M a g i c k G e t C o m p r e s s i o n %
278 % %
279 % %
280 % %
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282 %
283 % MagickGetCompression() gets the wand compression type.
284 %
285 % The format of the MagickGetCompression method is:
286 %
287 % CompressionType MagickGetCompression(MagickWand *wand)
288 %
289 % A description of each parameter follows:
290 %
291 % o wand: the magick wand.
292 %
293 */
MagickGetCompression(MagickWand * wand)294 WandExport CompressionType MagickGetCompression(MagickWand *wand)
295 {
296 assert(wand != (MagickWand *) NULL);
297 assert(wand->signature == WandSignature);
298 if (wand->debug != MagickFalse)
299 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
300 return(wand->image_info->compression);
301 }
302
303 /*
304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
305 % %
306 % %
307 % %
308 % M a g i c k G e t C o m p r e s s i o n Q u a l i t y %
309 % %
310 % %
311 % %
312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
313 %
314 % MagickGetCompressionQuality() gets the wand compression quality.
315 %
316 % The format of the MagickGetCompressionQuality method is:
317 %
318 % size_t MagickGetCompressionQuality(MagickWand *wand)
319 %
320 % A description of each parameter follows:
321 %
322 % o wand: the magick wand.
323 %
324 */
MagickGetCompressionQuality(MagickWand * wand)325 WandExport size_t MagickGetCompressionQuality(MagickWand *wand)
326 {
327 assert(wand != (MagickWand *) NULL);
328 assert(wand->signature == WandSignature);
329 if (wand->debug != MagickFalse)
330 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
331 return(wand->image_info->quality);
332 }
333
334 /*
335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
336 % %
337 % %
338 % %
339 % M a g i c k G e t C o p y r i g h t %
340 % %
341 % %
342 % %
343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
344 %
345 % MagickGetCopyright() returns the ImageMagick API copyright as a string
346 % constant.
347 %
348 % The format of the MagickGetCopyright method is:
349 %
350 % const char *MagickGetCopyright(void)
351 %
352 */
MagickGetCopyright(void)353 WandExport const char *MagickGetCopyright(void)
354 {
355 return(GetMagickCopyright());
356 }
357
358 /*
359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
360 % %
361 % %
362 % %
363 % M a g i c k G e t F i l e n a m e %
364 % %
365 % %
366 % %
367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
368 %
369 % MagickGetFilename() returns the filename associated with an image sequence.
370 %
371 % The format of the MagickGetFilename method is:
372 %
373 % const char *MagickGetFilename(const MagickWand *wand)
374 %
375 % A description of each parameter follows:
376 %
377 % o wand: the magick wand.
378 %
379 */
MagickGetFilename(const MagickWand * wand)380 WandExport char *MagickGetFilename(const MagickWand *wand)
381 {
382 assert(wand != (const MagickWand *) NULL);
383 assert(wand->signature == WandSignature);
384 if (wand->debug != MagickFalse)
385 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
386 return(AcquireString(wand->image_info->filename));
387 }
388
389 /*
390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391 % %
392 % %
393 % %
394 % M a g i c k G e t F o n t %
395 % %
396 % %
397 % %
398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399 %
400 % MagickGetFont() returns the font associated with the MagickWand.
401 %
402 % The format of the MagickGetFont method is:
403 %
404 % char *MagickGetFont(MagickWand *wand)
405 %
406 % A description of each parameter follows:
407 %
408 % o wand: the magick wand.
409 %
410 */
MagickGetFont(MagickWand * wand)411 WandExport char *MagickGetFont(MagickWand *wand)
412 {
413 assert(wand != (MagickWand *) NULL);
414 assert(wand->signature == WandSignature);
415 if (wand->debug != MagickFalse)
416 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
417 if (wand->image_info->font == (char *) NULL)
418 return((char *) NULL);
419 return(AcquireString(wand->image_info->font));
420 }
421
422 /*
423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
424 % %
425 % %
426 % %
427 % M a g i c k G e t F o r m a t %
428 % %
429 % %
430 % %
431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
432 %
433 % MagickGetFormat() returns the format of the magick wand.
434 %
435 % The format of the MagickGetFormat method is:
436 %
437 % const char MagickGetFormat(MagickWand *wand)
438 %
439 % A description of each parameter follows:
440 %
441 % o wand: the magick wand.
442 %
443 */
MagickGetFormat(MagickWand * wand)444 WandExport char *MagickGetFormat(MagickWand *wand)
445 {
446 assert(wand != (MagickWand *) NULL);
447 assert(wand->signature == WandSignature);
448 if (wand->debug != MagickFalse)
449 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
450 return(AcquireString(wand->image_info->magick));
451 }
452
453 /*
454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455 % %
456 % %
457 % %
458 % M a g i c k G e t G r a v i t y %
459 % %
460 % %
461 % %
462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
463 %
464 % MagickGetGravity() gets the wand gravity.
465 %
466 % The format of the MagickGetGravity method is:
467 %
468 % GravityType MagickGetGravity(MagickWand *wand)
469 %
470 % A description of each parameter follows:
471 %
472 % o wand: the magick wand.
473 %
474 */
MagickGetGravity(MagickWand * wand)475 WandExport GravityType MagickGetGravity(MagickWand *wand)
476 {
477 const char
478 *option;
479
480 GravityType
481 type;
482
483 assert(wand != (MagickWand *) NULL);
484 assert(wand->signature == WandSignature);
485 if (wand->debug != MagickFalse)
486 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
487 option=GetImageOption(wand->image_info,"gravity");
488 if (option == (const char *) NULL)
489 return(UndefinedGravity);
490 type=(GravityType) ParseCommandOption(MagickGravityOptions,MagickFalse,option);
491 return(type);
492 }
493
494 /*
495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
496 % %
497 % %
498 % %
499 % M a g i c k G e t H o m e U R L %
500 % %
501 % %
502 % %
503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
504 %
505 % MagickGetHomeURL() returns the ImageMagick home URL.
506 %
507 % The format of the MagickGetHomeURL method is:
508 %
509 % char *MagickGetHomeURL(void)
510 %
511 */
MagickGetHomeURL(void)512 WandExport char *MagickGetHomeURL(void)
513 {
514 return(GetMagickHomeURL());
515 }
516
517 /*
518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
519 % %
520 % %
521 % %
522 % M a g i c k G e t I m a g e A r t i f a c t %
523 % %
524 % %
525 % %
526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
527 %
528 % MagickGetImageArtifact() returns a value associated with the specified
529 % artifact. Use MagickRelinquishMemory() to free the value when you are
530 % finished with it.
531 %
532 % The format of the MagickGetImageArtifact method is:
533 %
534 % char *MagickGetImageArtifact(MagickWand *wand,const char *artifact)
535 %
536 % A description of each parameter follows:
537 %
538 % o wand: the magick wand.
539 %
540 % o artifact: the artifact.
541 %
542 */
MagickGetImageArtifact(MagickWand * wand,const char * artifact)543 WandExport char *MagickGetImageArtifact(MagickWand *wand,const char *artifact)
544 {
545 const char
546 *value;
547
548 assert(wand != (MagickWand *) NULL);
549 assert(wand->signature == WandSignature);
550 if (wand->debug != MagickFalse)
551 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
552 if (wand->images == (Image *) NULL)
553 {
554 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
555 "ContainsNoImages","`%s'",wand->name);
556 return((char *) NULL);
557 }
558 value=GetImageArtifact(wand->images,artifact);
559 if (value == (const char *) NULL)
560 return((char *) NULL);
561 return(ConstantString(value));
562 }
563
564 /*
565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
566 % %
567 % %
568 % %
569 % M a g i c k G e t I m a g e P r o p e r t i e s %
570 % %
571 % %
572 % %
573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
574 %
575 % MagickGetImageArtifacts() returns all the artifact names that match the
576 % specified pattern associated with a wand. Use MagickGetImageProperty() to
577 % return the value of a particular artifact. Use MagickRelinquishMemory() to
578 % free the value when you are finished with it.
579 %
580 % The format of the MagickGetImageArtifacts method is:
581 %
582 % char *MagickGetImageArtifacts(MagickWand *wand,
583 % const char *pattern,size_t *number_artifacts)
584 %
585 % A description of each parameter follows:
586 %
587 % o wand: the magick wand.
588 %
589 % o pattern: Specifies a pointer to a text string containing a pattern.
590 %
591 % o number_artifacts: the number artifacts associated with this wand.
592 %
593 */
MagickGetImageArtifacts(MagickWand * wand,const char * pattern,size_t * number_artifacts)594 WandExport char **MagickGetImageArtifacts(MagickWand *wand,
595 const char *pattern,size_t *number_artifacts)
596 {
597 char
598 **artifacts;
599
600 const char
601 *artifact;
602
603 ssize_t
604 i;
605
606 size_t
607 length;
608
609 assert(wand != (MagickWand *) NULL);
610 assert(wand->signature == WandSignature);
611 if (wand->debug != MagickFalse)
612 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
613 if (wand->images == (Image *) NULL)
614 {
615 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
616 "ContainsNoImages","`%s'",wand->name);
617 return((char **) NULL);
618 }
619 (void) GetImageProperty(wand->images,"exif:*");
620 length=1024;
621 artifacts=(char **) AcquireQuantumMemory(length,sizeof(*artifacts));
622 if (artifacts == (char **) NULL)
623 return((char **) NULL);
624 ResetImagePropertyIterator(wand->images);
625 artifact=GetNextImageProperty(wand->images);
626 for (i=0; artifact != (const char *) NULL; )
627 {
628 if ((*artifact != '[') &&
629 (GlobExpression(artifact,pattern,MagickFalse) != MagickFalse))
630 {
631 if ((i+1) >= (ssize_t) length)
632 {
633 length<<=1;
634 artifacts=(char **) ResizeQuantumMemory(artifacts,length,
635 sizeof(*artifacts));
636 if (artifacts == (char **) NULL)
637 {
638 (void) ThrowMagickException(wand->exception,GetMagickModule(),
639 ResourceLimitError,"MemoryAllocationFailed","`%s'",
640 wand->name);
641 return((char **) NULL);
642 }
643 }
644 artifacts[i]=ConstantString(artifact);
645 i++;
646 }
647 artifact=GetNextImageProperty(wand->images);
648 }
649 artifacts[i]=(char *) NULL;
650 *number_artifacts=(size_t) i;
651 return(artifacts);
652 }
653
654 /*
655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
656 % %
657 % %
658 % %
659 % M a g i c k G e t I m a g e P r o f i l e %
660 % %
661 % %
662 % %
663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
664 %
665 % MagickGetImageProfile() returns the named image profile.
666 %
667 % The format of the MagickGetImageProfile method is:
668 %
669 % unsigned char *MagickGetImageProfile(MagickWand *wand,const char *name,
670 % size_t *length)
671 %
672 % A description of each parameter follows:
673 %
674 % o wand: the magick wand.
675 %
676 % o name: Name of profile to return: ICC, IPTC, or generic profile.
677 %
678 % o length: the length of the profile.
679 %
680 */
MagickGetImageProfile(MagickWand * wand,const char * name,size_t * length)681 WandExport unsigned char *MagickGetImageProfile(MagickWand *wand,
682 const char *name,size_t *length)
683 {
684 const StringInfo
685 *profile;
686
687 unsigned char
688 *datum;
689
690 assert(wand != (MagickWand *) NULL);
691 assert(wand->signature == WandSignature);
692 if (wand->debug != MagickFalse)
693 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
694 if (wand->images == (Image *) NULL)
695 {
696 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
697 "ContainsNoImages","`%s'",wand->name);
698 return((unsigned char *) NULL);
699 }
700 *length=0;
701 if (wand->images->profiles == (SplayTreeInfo *) NULL)
702 return((unsigned char *) NULL);
703 profile=GetImageProfile(wand->images,name);
704 if (profile == (StringInfo *) NULL)
705 return((unsigned char *) NULL);
706 datum=(unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile),
707 sizeof(*datum));
708 if (datum == (unsigned char *) NULL)
709 return((unsigned char *) NULL);
710 (void) memcpy(datum,GetStringInfoDatum(profile),GetStringInfoLength(profile));
711 *length=(size_t) GetStringInfoLength(profile);
712 return(datum);
713 }
714
715 /*
716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
717 % %
718 % %
719 % %
720 % M a g i c k G e t I m a g e P r o f i l e s %
721 % %
722 % %
723 % %
724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
725 %
726 % MagickGetImageProfiles() returns all the profile names that match the
727 % specified pattern associated with a wand. Use MagickGetImageProfile() to
728 % return the value of a particular property. Use MagickRelinquishMemory() to
729 % free the value when you are finished with it.
730 %
731 % The format of the MagickGetImageProfiles method is:
732 %
733 % char *MagickGetImageProfiles(MagickWand *wand,const char *pattern,
734 % size_t *number_profiles)
735 %
736 % A description of each parameter follows:
737 %
738 % o wand: the magick wand.
739 %
740 % o pattern: Specifies a pointer to a text string containing a pattern.
741 %
742 % o number_profiles: the number profiles associated with this wand.
743 %
744 */
MagickGetImageProfiles(MagickWand * wand,const char * pattern,size_t * number_profiles)745 WandExport char **MagickGetImageProfiles(MagickWand *wand,const char *pattern,
746 size_t *number_profiles)
747 {
748 char
749 **profiles;
750
751 const char
752 *property;
753
754 ssize_t
755 i;
756
757 size_t
758 length;
759
760 assert(wand != (MagickWand *) NULL);
761 assert(wand->signature == WandSignature);
762 if (wand->debug != MagickFalse)
763 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
764 if (wand->images == (Image *) NULL)
765 {
766 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
767 "ContainsNoImages","`%s'",wand->name);
768 return((char **) NULL);
769 }
770 (void) GetImageProfile(wand->images,"exif:*");
771 length=1024;
772 profiles=(char **) AcquireQuantumMemory(length,sizeof(*profiles));
773 if (profiles == (char **) NULL)
774 return((char **) NULL);
775 ResetImageProfileIterator(wand->images);
776 property=GetNextImageProfile(wand->images);
777 for (i=0; property != (const char *) NULL; )
778 {
779 if ((*property != '[') &&
780 (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
781 {
782 if ((i+1) >= (ssize_t) length)
783 {
784 length<<=1;
785 profiles=(char **) ResizeQuantumMemory(profiles,length,
786 sizeof(*profiles));
787 if (profiles == (char **) NULL)
788 {
789 (void) ThrowMagickException(wand->exception,GetMagickModule(),
790 ResourceLimitError,"MemoryAllocationFailed","`%s'",
791 wand->name);
792 return((char **) NULL);
793 }
794 }
795 profiles[i]=ConstantString(property);
796 i++;
797 }
798 property=GetNextImageProfile(wand->images);
799 }
800 profiles[i]=(char *) NULL;
801 *number_profiles=(size_t) i;
802 return(profiles);
803 }
804
805 /*
806 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
807 % %
808 % %
809 % %
810 % M a g i c k G e t I m a g e P r o p e r t y %
811 % %
812 % %
813 % %
814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
815 %
816 % MagickGetImageProperty() returns a value associated with the specified
817 % property. Use MagickRelinquishMemory() to free the value when you are
818 % finished with it.
819 %
820 % The format of the MagickGetImageProperty method is:
821 %
822 % char *MagickGetImageProperty(MagickWand *wand,const char *property)
823 %
824 % A description of each parameter follows:
825 %
826 % o wand: the magick wand.
827 %
828 % o property: the property.
829 %
830 */
MagickGetImageProperty(MagickWand * wand,const char * property)831 WandExport char *MagickGetImageProperty(MagickWand *wand,const char *property)
832 {
833 const char
834 *value;
835
836 assert(wand != (MagickWand *) NULL);
837 assert(wand->signature == WandSignature);
838 if (wand->debug != MagickFalse)
839 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
840 if (wand->images == (Image *) NULL)
841 {
842 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
843 "ContainsNoImages","`%s'",wand->name);
844 return((char *) NULL);
845 }
846 value=GetImageProperty(wand->images,property);
847 if (value == (const char *) NULL)
848 return((char *) NULL);
849 return(ConstantString(value));
850 }
851
852 /*
853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
854 % %
855 % %
856 % %
857 % M a g i c k G e t I m a g e P r o p e r t i e s %
858 % %
859 % %
860 % %
861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
862 %
863 % MagickGetImageProperties() returns all the property names that match the
864 % specified pattern associated with a wand. Use MagickGetImageProperty() to
865 % return the value of a particular property. Use MagickRelinquishMemory() to
866 % free the value when you are finished with it.
867 %
868 % The format of the MagickGetImageProperties method is:
869 %
870 % char *MagickGetImageProperties(MagickWand *wand,
871 % const char *pattern,size_t *number_properties)
872 %
873 % A description of each parameter follows:
874 %
875 % o wand: the magick wand.
876 %
877 % o pattern: Specifies a pointer to a text string containing a pattern.
878 %
879 % o number_properties: the number properties associated with this wand.
880 %
881 */
MagickGetImageProperties(MagickWand * wand,const char * pattern,size_t * number_properties)882 WandExport char **MagickGetImageProperties(MagickWand *wand,
883 const char *pattern,size_t *number_properties)
884 {
885 char
886 **properties;
887
888 const char
889 *property;
890
891 ssize_t
892 i;
893
894 size_t
895 length;
896
897 assert(wand != (MagickWand *) NULL);
898 assert(wand->signature == WandSignature);
899 if (wand->debug != MagickFalse)
900 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
901 if (wand->images == (Image *) NULL)
902 {
903 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
904 "ContainsNoImages","`%s'",wand->name);
905 return((char **) NULL);
906 }
907 (void) GetImageProperty(wand->images,"exif:*");
908 length=1024;
909 properties=(char **) AcquireQuantumMemory(length,sizeof(*properties));
910 if (properties == (char **) NULL)
911 return((char **) NULL);
912 ResetImagePropertyIterator(wand->images);
913 property=GetNextImageProperty(wand->images);
914 for (i=0; property != (const char *) NULL; )
915 {
916 if ((*property != '[') &&
917 (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
918 {
919 if ((i+1) >= (ssize_t) length)
920 {
921 length<<=1;
922 properties=(char **) ResizeQuantumMemory(properties,length,
923 sizeof(*properties));
924 if (properties == (char **) NULL)
925 {
926 (void) ThrowMagickException(wand->exception,GetMagickModule(),
927 ResourceLimitError,"MemoryAllocationFailed","`%s'",
928 wand->name);
929 return((char **) NULL);
930 }
931 }
932 properties[i]=ConstantString(property);
933 i++;
934 }
935 property=GetNextImageProperty(wand->images);
936 }
937 properties[i]=(char *) NULL;
938 *number_properties=(size_t) i;
939 return(properties);
940 }
941
942 /*
943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
944 % %
945 % %
946 % %
947 % M a g i c k G e t I n t e r l a c e S c h e m e %
948 % %
949 % %
950 % %
951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
952 %
953 % MagickGetInterlaceScheme() gets the wand interlace scheme.
954 %
955 % The format of the MagickGetInterlaceScheme method is:
956 %
957 % InterlaceType MagickGetInterlaceScheme(MagickWand *wand)
958 %
959 % A description of each parameter follows:
960 %
961 % o wand: the magick wand.
962 %
963 */
MagickGetInterlaceScheme(MagickWand * wand)964 WandExport InterlaceType MagickGetInterlaceScheme(MagickWand *wand)
965 {
966 assert(wand != (MagickWand *) NULL);
967 assert(wand->signature == WandSignature);
968 if (wand->debug != MagickFalse)
969 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
970 return(wand->image_info->interlace);
971 }
972
973 /*
974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
975 % %
976 % %
977 % %
978 % M a g i c k G e t I n t e r p o l a t e M e t h o d %
979 % %
980 % %
981 % %
982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983 %
984 % MagickGetInterpolateMethod() gets the wand compression.
985 %
986 % The format of the MagickGetInterpolateMethod method is:
987 %
988 % InterpolatePixelMethod MagickGetInterpolateMethod(MagickWand *wand)
989 %
990 % A description of each parameter follows:
991 %
992 % o wand: the magick wand.
993 %
994 */
MagickGetInterpolateMethod(MagickWand * wand)995 WandExport InterpolatePixelMethod MagickGetInterpolateMethod(MagickWand *wand)
996 {
997 const char
998 *option;
999
1000 InterpolatePixelMethod
1001 method;
1002
1003 assert(wand != (MagickWand *) NULL);
1004 assert(wand->signature == WandSignature);
1005 if (wand->debug != MagickFalse)
1006 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1007 option=GetImageOption(wand->image_info,"interpolate");
1008 if (option == (const char *) NULL)
1009 return(UndefinedInterpolatePixel);
1010 method=(InterpolatePixelMethod) ParseCommandOption(MagickInterpolateOptions,
1011 MagickFalse,option);
1012 return(method);
1013 }
1014
1015 /*
1016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017 % %
1018 % %
1019 % %
1020 % M a g i c k G e t O p t i o n %
1021 % %
1022 % %
1023 % %
1024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025 %
1026 % MagickGetOption() returns a value associated with a wand and the specified
1027 % key. Use MagickRelinquishMemory() to free the value when you are finished
1028 % with it.
1029 %
1030 % The format of the MagickGetOption method is:
1031 %
1032 % char *MagickGetOption(MagickWand *wand,const char *key)
1033 %
1034 % A description of each parameter follows:
1035 %
1036 % o wand: the magick wand.
1037 %
1038 % o key: the key.
1039 %
1040 */
MagickGetOption(MagickWand * wand,const char * key)1041 WandExport char *MagickGetOption(MagickWand *wand,const char *key)
1042 {
1043 const char
1044 *option;
1045
1046 assert(wand != (MagickWand *) NULL);
1047 assert(wand->signature == WandSignature);
1048 if (wand->debug != MagickFalse)
1049 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1050 option=GetImageOption(wand->image_info,key);
1051 return(ConstantString(option));
1052 }
1053
1054 /*
1055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1056 % %
1057 % %
1058 % %
1059 % M a g i c k G e t O p t i o n s %
1060 % %
1061 % %
1062 % %
1063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1064 %
1065 % MagickGetOptions() returns all the option names that match the specified
1066 % pattern associated with a wand. Use MagickGetOption() to return the value
1067 % of a particular option. Use MagickRelinquishMemory() to free the value
1068 % when you are finished with it.
1069 %
1070 % The format of the MagickGetOptions method is:
1071 %
1072 % char *MagickGetOptions(MagickWand *wand,const char *pattern,,
1073 % size_t *number_options)
1074 %
1075 % A description of each parameter follows:
1076 %
1077 % o wand: the magick wand.
1078 %
1079 % o pattern: Specifies a pointer to a text string containing a pattern.
1080 %
1081 % o number_options: the number options associated with this wand.
1082 %
1083 */
MagickGetOptions(MagickWand * wand,const char * pattern,size_t * number_options)1084 WandExport char **MagickGetOptions(MagickWand *wand,const char *pattern,
1085 size_t *number_options)
1086 {
1087 char
1088 **options;
1089
1090 const char
1091 *option;
1092
1093 ssize_t
1094 i;
1095
1096 size_t
1097 length;
1098
1099 assert(wand != (MagickWand *) NULL);
1100 assert(wand->signature == WandSignature);
1101 if (wand->debug != MagickFalse)
1102 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1103 if (wand->images == (Image *) NULL)
1104 {
1105 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1106 "ContainsNoImages","`%s'",wand->name);
1107 return((char **) NULL);
1108 }
1109 length=1024;
1110 options=(char **) AcquireQuantumMemory(length,sizeof(*options));
1111 if (options == (char **) NULL)
1112 return((char **) NULL);
1113 ResetImageOptionIterator(wand->image_info);
1114 option=GetNextImageOption(wand->image_info);
1115 for (i=0; option != (const char *) NULL; )
1116 {
1117 if ((*option != '[') &&
1118 (GlobExpression(option,pattern,MagickFalse) != MagickFalse))
1119 {
1120 if ((i+1) >= (ssize_t) length)
1121 {
1122 length<<=1;
1123 options=(char **) ResizeQuantumMemory(options,length,
1124 sizeof(*options));
1125 if (options == (char **) NULL)
1126 {
1127 (void) ThrowMagickException(wand->exception,GetMagickModule(),
1128 ResourceLimitError,"MemoryAllocationFailed","`%s'",
1129 wand->name);
1130 return((char **) NULL);
1131 }
1132 }
1133 options[i]=ConstantString(option);
1134 i++;
1135 }
1136 option=GetNextImageOption(wand->image_info);
1137 }
1138 options[i]=(char *) NULL;
1139 *number_options=(size_t) i;
1140 return(options);
1141 }
1142
1143 /*
1144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1145 % %
1146 % %
1147 % %
1148 % M a g i c k G e t O r i e n t a t i o n %
1149 % %
1150 % %
1151 % %
1152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1153 %
1154 % MagickGetOrientation() gets the wand orientation type.
1155 %
1156 % The format of the MagickGetOrientation method is:
1157 %
1158 % OrientationType MagickGetOrientation(MagickWand *wand)
1159 %
1160 % A description of each parameter follows:
1161 %
1162 % o wand: the magick wand.
1163 %
1164 */
MagickGetOrientation(MagickWand * wand)1165 WandExport OrientationType MagickGetOrientation(MagickWand *wand)
1166 {
1167 assert(wand != (MagickWand *) NULL);
1168 assert(wand->signature == WandSignature);
1169 if (wand->debug != MagickFalse)
1170 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1171 return(wand->image_info->orientation);
1172 }
1173
1174 /*
1175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1176 % %
1177 % %
1178 % %
1179 % M a g i c k G e t P a c k a g e N a m e %
1180 % %
1181 % %
1182 % %
1183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184 %
1185 % MagickGetPackageName() returns the ImageMagick package name as a string
1186 % constant.
1187 %
1188 % The format of the MagickGetPackageName method is:
1189 %
1190 % const char *MagickGetPackageName(void)
1191 %
1192 %
1193 */
MagickGetPackageName(void)1194 WandExport const char *MagickGetPackageName(void)
1195 {
1196 return(GetMagickPackageName());
1197 }
1198
1199 /*
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201 % %
1202 % %
1203 % %
1204 % M a g i c k G e t P a g e %
1205 % %
1206 % %
1207 % %
1208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1209 %
1210 % MagickGetPage() returns the page geometry associated with the magick wand.
1211 %
1212 % The format of the MagickGetPage method is:
1213 %
1214 % MagickBooleanType MagickGetPage(const MagickWand *wand,
1215 % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
1216 %
1217 % A description of each parameter follows:
1218 %
1219 % o wand: the magick wand.
1220 %
1221 % o width: the page width.
1222 %
1223 % o height: page height.
1224 %
1225 % o x: the page x-offset.
1226 %
1227 % o y: the page y-offset.
1228 %
1229 */
MagickGetPage(const MagickWand * wand,size_t * width,size_t * height,ssize_t * x,ssize_t * y)1230 WandExport MagickBooleanType MagickGetPage(const MagickWand *wand,
1231 size_t *width,size_t *height,ssize_t *x,ssize_t *y)
1232 {
1233 RectangleInfo
1234 geometry;
1235
1236 assert(wand != (const MagickWand *) NULL);
1237 assert(wand->signature == WandSignature);
1238 if (wand->debug != MagickFalse)
1239 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1240 (void) memset(&geometry,0,sizeof(geometry));
1241 (void) ParseAbsoluteGeometry(wand->image_info->page,&geometry);
1242 *width=geometry.width;
1243 *height=geometry.height;
1244 *x=geometry.x;
1245 *y=geometry.y;
1246 return(MagickTrue);
1247 }
1248
1249 /*
1250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1251 % %
1252 % %
1253 % %
1254 % M a g i c k G e t P o i n t s i z e %
1255 % %
1256 % %
1257 % %
1258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1259 %
1260 % MagickGetPointsize() returns the font pointsize associated with the
1261 % MagickWand.
1262 %
1263 % The format of the MagickGetPointsize method is:
1264 %
1265 % double MagickGetPointsize(MagickWand *wand)
1266 %
1267 % A description of each parameter follows:
1268 %
1269 % o wand: the magick wand.
1270 %
1271 */
MagickGetPointsize(MagickWand * wand)1272 WandExport double MagickGetPointsize(MagickWand *wand)
1273 {
1274 assert(wand != (MagickWand *) NULL);
1275 assert(wand->signature == WandSignature);
1276 if (wand->debug != MagickFalse)
1277 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1278 return(wand->image_info->pointsize);
1279 }
1280
1281 /*
1282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1283 % %
1284 % %
1285 % %
1286 % M a g i c k G e t Q u a n t u m D e p t h %
1287 % %
1288 % %
1289 % %
1290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1291 %
1292 % MagickGetQuantumDepth() returns the ImageMagick quantum depth as a string
1293 % constant.
1294 %
1295 % The format of the MagickGetQuantumDepth method is:
1296 %
1297 % const char *MagickGetQuantumDepth(size_t *depth)
1298 %
1299 % A description of each parameter follows:
1300 %
1301 % o depth: the quantum depth is returned as a number.
1302 %
1303 */
MagickGetQuantumDepth(size_t * depth)1304 WandExport const char *MagickGetQuantumDepth(size_t *depth)
1305 {
1306 return(GetMagickQuantumDepth(depth));
1307 }
1308
1309 /*
1310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1311 % %
1312 % %
1313 % %
1314 % M a g i c k G e t Q u a n t u m R a n g e %
1315 % %
1316 % %
1317 % %
1318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1319 %
1320 % MagickGetQuantumRange() returns the ImageMagick quantum range as a string
1321 % constant.
1322 %
1323 % The format of the MagickGetQuantumRange method is:
1324 %
1325 % const char *MagickGetQuantumRange(size_t *range)
1326 %
1327 % A description of each parameter follows:
1328 %
1329 % o range: the quantum range is returned as a number.
1330 %
1331 */
MagickGetQuantumRange(size_t * range)1332 WandExport const char *MagickGetQuantumRange(size_t *range)
1333 {
1334 return(GetMagickQuantumRange(range));
1335 }
1336
1337 /*
1338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1339 % %
1340 % %
1341 % %
1342 % M a g i c k G e t R e l e a s e D a t e %
1343 % %
1344 % %
1345 % %
1346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1347 %
1348 % MagickGetReleaseDate() returns the ImageMagick release date as a string
1349 % constant.
1350 %
1351 % The format of the MagickGetReleaseDate method is:
1352 %
1353 % const char *MagickGetReleaseDate(void)
1354 %
1355 */
MagickGetReleaseDate(void)1356 WandExport const char *MagickGetReleaseDate(void)
1357 {
1358 return(GetMagickReleaseDate());
1359 }
1360
1361 /*
1362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1363 % %
1364 % %
1365 % %
1366 % M a g i c k G e t R e s o l u t i o n %
1367 % %
1368 % %
1369 % %
1370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1371 %
1372 % MagickGetResolution() gets the image X and Y resolution.
1373 %
1374 % The format of the MagickGetResolution method is:
1375 %
1376 % MagickBooleanType MagickGetResolution(const MagickWand *wand,double *x,
1377 % double *y)
1378 %
1379 % A description of each parameter follows:
1380 %
1381 % o wand: the magick wand.
1382 %
1383 % o x: the x-resolution.
1384 %
1385 % o y: the y-resolution.
1386 %
1387 */
MagickGetResolution(const MagickWand * wand,double * x,double * y)1388 WandExport MagickBooleanType MagickGetResolution(const MagickWand *wand,
1389 double *x,double *y)
1390 {
1391 assert(wand != (MagickWand *) NULL);
1392 assert(wand->signature == WandSignature);
1393 if (wand->debug != MagickFalse)
1394 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1395 *x=DefaultResolution;
1396 *y=DefaultResolution;
1397 if (wand->image_info->density != (char *) NULL)
1398 {
1399 GeometryInfo
1400 geometry_info;
1401
1402 MagickStatusType
1403 flags;
1404
1405 flags=ParseGeometry(wand->image_info->density,&geometry_info);
1406 *x=geometry_info.rho;
1407 *y=geometry_info.sigma;
1408 if ((flags & SigmaValue) == MagickFalse)
1409 *y=(*x);
1410 }
1411 return(MagickTrue);
1412 }
1413
1414 /*
1415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1416 % %
1417 % %
1418 % %
1419 % M a g i c k G e t R e s o u r c e %
1420 % %
1421 % %
1422 % %
1423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1424 %
1425 % MagickGetResource() returns the specified resource in megabytes.
1426 %
1427 % The format of the MagickGetResource method is:
1428 %
1429 % MagickSizeType MagickGetResource(const ResourceType type)
1430 %
1431 % A description of each parameter follows:
1432 %
1433 % o wand: the magick wand.
1434 %
1435 */
MagickGetResource(const ResourceType type)1436 WandExport MagickSizeType MagickGetResource(const ResourceType type)
1437 {
1438 return(GetMagickResource(type));
1439 }
1440
1441 /*
1442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1443 % %
1444 % %
1445 % %
1446 % M a g i c k G e t R e s o u r c e L i m i t %
1447 % %
1448 % %
1449 % %
1450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1451 %
1452 % MagickGetResourceLimit() returns the specified resource limit in megabytes.
1453 %
1454 % The format of the MagickGetResourceLimit method is:
1455 %
1456 % MagickSizeType MagickGetResourceLimit(const ResourceType type)
1457 %
1458 % A description of each parameter follows:
1459 %
1460 % o wand: the magick wand.
1461 %
1462 */
MagickGetResourceLimit(const ResourceType type)1463 WandExport MagickSizeType MagickGetResourceLimit(const ResourceType type)
1464 {
1465 return(GetMagickResourceLimit(type));
1466 }
1467
1468 /*
1469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1470 % %
1471 % %
1472 % %
1473 % M a g i c k G e t S a m p l i n g F a c t o r s %
1474 % %
1475 % %
1476 % %
1477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1478 %
1479 % MagickGetSamplingFactors() gets the horizontal and vertical sampling factor.
1480 %
1481 % The format of the MagickGetSamplingFactors method is:
1482 %
1483 % double *MagickGetSamplingFactor(MagickWand *wand,
1484 % size_t *number_factors)
1485 %
1486 % A description of each parameter follows:
1487 %
1488 % o wand: the magick wand.
1489 %
1490 % o number_factors: the number of factors in the returned array.
1491 %
1492 */
MagickGetSamplingFactors(MagickWand * wand,size_t * number_factors)1493 WandExport double *MagickGetSamplingFactors(MagickWand *wand,
1494 size_t *number_factors)
1495 {
1496 double
1497 *sampling_factors;
1498
1499 const char
1500 *p;
1501
1502 ssize_t
1503 i;
1504
1505 assert(wand != (MagickWand *) NULL);
1506 assert(wand->signature == WandSignature);
1507 if (wand->debug != MagickFalse)
1508 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1509 *number_factors=0;
1510 sampling_factors=(double *) NULL;
1511 if (wand->image_info->sampling_factor == (char *) NULL)
1512 return(sampling_factors);
1513 i=0;
1514 for (p=wand->image_info->sampling_factor; p != (char *) NULL; p=strchr(p,','))
1515 {
1516 while (((int) *p != 0) && ((isspace((int) ((unsigned char) *p)) != 0) ||
1517 (*p == ',')))
1518 p++;
1519 i++;
1520 }
1521 sampling_factors=(double *) AcquireQuantumMemory((size_t) i+1,
1522 sizeof(*sampling_factors));
1523 if (sampling_factors == (double *) NULL)
1524 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
1525 wand->image_info->filename);
1526 i=0;
1527 for (p=wand->image_info->sampling_factor; p != (char *) NULL; p=strchr(p,','))
1528 {
1529 while (((int) *p != 0) && ((isspace((int) ((unsigned char) *p)) != 0) ||
1530 (*p == ',')))
1531 p++;
1532 sampling_factors[i]=StringToDouble(p,(char **) NULL);
1533 i++;
1534 }
1535 *number_factors=(size_t) i;
1536 return(sampling_factors);
1537 }
1538
1539 /*
1540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1541 % %
1542 % %
1543 % %
1544 % M a g i c k G e t S i z e %
1545 % %
1546 % %
1547 % %
1548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1549 %
1550 % MagickGetSize() returns the size associated with the magick wand.
1551 %
1552 % The format of the MagickGetSize method is:
1553 %
1554 % MagickBooleanType MagickGetSize(const MagickWand *wand,
1555 % size_t *columns,size_t *rows)
1556 %
1557 % A description of each parameter follows:
1558 %
1559 % o wand: the magick wand.
1560 %
1561 % o columns: the width in pixels.
1562 %
1563 % o height: the height in pixels.
1564 %
1565 */
MagickGetSize(const MagickWand * wand,size_t * columns,size_t * rows)1566 WandExport MagickBooleanType MagickGetSize(const MagickWand *wand,
1567 size_t *columns,size_t *rows)
1568 {
1569 RectangleInfo
1570 geometry;
1571
1572 assert(wand != (const MagickWand *) NULL);
1573 assert(wand->signature == WandSignature);
1574 if (wand->debug != MagickFalse)
1575 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1576 (void) memset(&geometry,0,sizeof(geometry));
1577 (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
1578 *columns=geometry.width;
1579 *rows=geometry.height;
1580 return(MagickTrue);
1581 }
1582
1583 /*
1584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1585 % %
1586 % %
1587 % %
1588 % M a g i c k G e t S i z e O f f s e t %
1589 % %
1590 % %
1591 % %
1592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1593 %
1594 % MagickGetSizeOffset() returns the size offset associated with the magick
1595 % wand.
1596 %
1597 % The format of the MagickGetSizeOffset method is:
1598 %
1599 % MagickBooleanType MagickGetSizeOffset(const MagickWand *wand,
1600 % ssize_t *offset)
1601 %
1602 % A description of each parameter follows:
1603 %
1604 % o wand: the magick wand.
1605 %
1606 % o offset: the image offset.
1607 %
1608 */
MagickGetSizeOffset(const MagickWand * wand,ssize_t * offset)1609 WandExport MagickBooleanType MagickGetSizeOffset(const MagickWand *wand,
1610 ssize_t *offset)
1611 {
1612 RectangleInfo
1613 geometry;
1614
1615 assert(wand != (const MagickWand *) NULL);
1616 assert(wand->signature == WandSignature);
1617 if (wand->debug != MagickFalse)
1618 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1619 (void) memset(&geometry,0,sizeof(geometry));
1620 (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
1621 *offset=geometry.x;
1622 return(MagickTrue);
1623 }
1624
1625 /*
1626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1627 % %
1628 % %
1629 % %
1630 % M a g i c k G e t T y p e %
1631 % %
1632 % %
1633 % %
1634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1635 %
1636 % MagickGetType() returns the wand type.
1637 %
1638 % The format of the MagickGetType method is:
1639 %
1640 % ImageType MagickGetType(MagickWand *wand)
1641 %
1642 % A description of each parameter follows:
1643 %
1644 % o wand: the magick wand.
1645 %
1646 */
MagickGetType(MagickWand * wand)1647 WandExport ImageType MagickGetType(MagickWand *wand)
1648 {
1649 assert(wand != (MagickWand *) NULL);
1650 assert(wand->signature == WandSignature);
1651 if (wand->debug != MagickFalse)
1652 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1653 return(wand->image_info->type);
1654 }
1655
1656 /*
1657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1658 % %
1659 % %
1660 % %
1661 % M a g i c k G e t V e r s i o n %
1662 % %
1663 % %
1664 % %
1665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1666 %
1667 % MagickGetVersion() returns the ImageMagick API version as a string constant
1668 % and as a number.
1669 %
1670 % The format of the MagickGetVersion method is:
1671 %
1672 % const char *MagickGetVersion(size_t *version)
1673 %
1674 % A description of each parameter follows:
1675 %
1676 % o version: the ImageMagick version is returned as a number.
1677 %
1678 */
MagickGetVersion(size_t * version)1679 WandExport const char *MagickGetVersion(size_t *version)
1680 {
1681 return(GetMagickVersion(version));
1682 }
1683
1684 /*
1685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1686 % %
1687 % %
1688 % %
1689 % M a g i c k P r o f i l e I m a g e %
1690 % %
1691 % %
1692 % %
1693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1694 %
1695 % MagickProfileImage() adds or removes a ICC, IPTC, or generic profile
1696 % from an image. If the profile is NULL, it is removed from the image
1697 % otherwise added. Use a name of '*' and a profile of NULL to remove all
1698 % profiles from the image.
1699 %
1700 % The format of the MagickProfileImage method is:
1701 %
1702 % MagickBooleanType MagickProfileImage(MagickWand *wand,const char *name,
1703 % const void *profile,const size_t length)
1704 %
1705 % A description of each parameter follows:
1706 %
1707 % o wand: the magick wand.
1708 %
1709 % o name: Name of profile to add or remove: ICC, IPTC, or generic profile.
1710 %
1711 % o profile: the profile.
1712 %
1713 % o length: the length of the profile.
1714 %
1715 */
MagickProfileImage(MagickWand * wand,const char * name,const void * profile,const size_t length)1716 WandExport MagickBooleanType MagickProfileImage(MagickWand *wand,
1717 const char *name,const void *profile,const size_t length)
1718 {
1719 MagickBooleanType
1720 status;
1721
1722 assert(wand != (MagickWand *) NULL);
1723 assert(wand->signature == WandSignature);
1724 if (wand->debug != MagickFalse)
1725 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1726 if (wand->images == (Image *) NULL)
1727 ThrowWandException(WandError,"ContainsNoImages",wand->name);
1728 status=ProfileImage(wand->images,name,profile,length,MagickTrue);
1729 if (status == MagickFalse)
1730 InheritException(wand->exception,&wand->images->exception);
1731 return(status);
1732 }
1733
1734 /*
1735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1736 % %
1737 % %
1738 % %
1739 % M a g i c k R e m o v e I m a g e P r o f i l e %
1740 % %
1741 % %
1742 % %
1743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1744 %
1745 % MagickRemoveImageProfile() removes the named image profile and returns it.
1746 %
1747 % The format of the MagickRemoveImageProfile method is:
1748 %
1749 % unsigned char *MagickRemoveImageProfile(MagickWand *wand,
1750 % const char *name,size_t *length)
1751 %
1752 % A description of each parameter follows:
1753 %
1754 % o wand: the magick wand.
1755 %
1756 % o name: Name of profile to return: ICC, IPTC, or generic profile.
1757 %
1758 % o length: the length of the profile.
1759 %
1760 */
MagickRemoveImageProfile(MagickWand * wand,const char * name,size_t * length)1761 WandExport unsigned char *MagickRemoveImageProfile(MagickWand *wand,
1762 const char *name,size_t *length)
1763 {
1764 StringInfo
1765 *profile;
1766
1767 unsigned char
1768 *datum;
1769
1770 assert(wand != (MagickWand *) NULL);
1771 assert(wand->signature == WandSignature);
1772 if (wand->debug != MagickFalse)
1773 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1774 if (wand->images == (Image *) NULL)
1775 {
1776 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1777 "ContainsNoImages","`%s'",wand->name);
1778 return((unsigned char *) NULL);
1779 }
1780 *length=0;
1781 profile=RemoveImageProfile(wand->images,name);
1782 if (profile == (StringInfo *) NULL)
1783 return((unsigned char *) NULL);
1784 datum=(unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile),
1785 sizeof(*datum));
1786 if (datum == (unsigned char *) NULL)
1787 return((unsigned char *) NULL);
1788 (void) memcpy(datum,GetStringInfoDatum(profile),
1789 GetStringInfoLength(profile));
1790 *length=GetStringInfoLength(profile);
1791 profile=DestroyStringInfo(profile);
1792 return(datum);
1793 }
1794
1795 /*
1796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1797 % %
1798 % %
1799 % %
1800 % M a g i c k S e t A n t i a l i a s %
1801 % %
1802 % %
1803 % %
1804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1805 %
1806 % MagickSetAntialias() sets the antialias propery of the wand.
1807 %
1808 % The format of the MagickSetAntialias method is:
1809 %
1810 % MagickBooleanType MagickSetAntialias(MagickWand *wand,
1811 % const MagickBooleanType antialias)
1812 %
1813 % A description of each parameter follows:
1814 %
1815 % o wand: the magick wand.
1816 %
1817 % o antialias: the antialias property.
1818 %
1819 */
MagickSetAntialias(MagickWand * wand,const MagickBooleanType antialias)1820 WandExport MagickBooleanType MagickSetAntialias(MagickWand *wand,
1821 const MagickBooleanType antialias)
1822 {
1823 assert(wand != (MagickWand *) NULL);
1824 assert(wand->signature == WandSignature);
1825 if (wand->debug != MagickFalse)
1826 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1827 wand->image_info->antialias=antialias;
1828 return(MagickTrue);
1829 }
1830
1831 /*
1832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1833 % %
1834 % %
1835 % %
1836 % M a g i c k S e t B a c k g r o u n d C o l o r %
1837 % %
1838 % %
1839 % %
1840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1841 %
1842 % MagickSetBackgroundColor() sets the wand background color.
1843 %
1844 % The format of the MagickSetBackgroundColor method is:
1845 %
1846 % MagickBooleanType MagickSetBackgroundColor(MagickWand *wand,
1847 % const PixelWand *background)
1848 %
1849 % A description of each parameter follows:
1850 %
1851 % o wand: the magick wand.
1852 %
1853 % o background: the background pixel wand.
1854 %
1855 */
MagickSetBackgroundColor(MagickWand * wand,const PixelWand * background)1856 WandExport MagickBooleanType MagickSetBackgroundColor(MagickWand *wand,
1857 const PixelWand *background)
1858 {
1859 assert(wand != (MagickWand *) NULL);
1860 assert(wand->signature == WandSignature);
1861 if (wand->debug != MagickFalse)
1862 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1863 PixelGetQuantumColor(background,&wand->image_info->background_color);
1864 return(MagickTrue);
1865 }
1866
1867 /*
1868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1869 % %
1870 % %
1871 % %
1872 % M a g i c k S e t C o l o r s p a c e %
1873 % %
1874 % %
1875 % %
1876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1877 %
1878 % MagickSetColorspace() sets the wand colorspace type.
1879 %
1880 % The format of the MagickSetColorspace method is:
1881 %
1882 % MagickBooleanType MagickSetColorspace(MagickWand *wand,
1883 % const ColorspaceType colorspace)
1884 %
1885 % A description of each parameter follows:
1886 %
1887 % o wand: the magick wand.
1888 %
1889 % o colorspace: the wand colorspace.
1890 %
1891 */
MagickSetColorspace(MagickWand * wand,const ColorspaceType colorspace)1892 WandExport MagickBooleanType MagickSetColorspace(MagickWand *wand,
1893 const ColorspaceType colorspace)
1894 {
1895 assert(wand != (MagickWand *) NULL);
1896 assert(wand->signature == WandSignature);
1897 if (wand->debug != MagickFalse)
1898 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1899 wand->image_info->colorspace=colorspace;
1900 return(MagickTrue);
1901 }
1902
1903 /*
1904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1905 % %
1906 % %
1907 % %
1908 % M a g i c k S e t C o m p r e s s i o n %
1909 % %
1910 % %
1911 % %
1912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1913 %
1914 % MagickSetCompression() sets the wand compression type.
1915 %
1916 % The format of the MagickSetCompression method is:
1917 %
1918 % MagickBooleanType MagickSetCompression(MagickWand *wand,
1919 % const CompressionType compression)
1920 %
1921 % A description of each parameter follows:
1922 %
1923 % o wand: the magick wand.
1924 %
1925 % o compression: the wand compression.
1926 %
1927 */
MagickSetCompression(MagickWand * wand,const CompressionType compression)1928 WandExport MagickBooleanType MagickSetCompression(MagickWand *wand,
1929 const CompressionType compression)
1930 {
1931 assert(wand != (MagickWand *) NULL);
1932 assert(wand->signature == WandSignature);
1933 if (wand->debug != MagickFalse)
1934 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1935 wand->image_info->compression=compression;
1936 return(MagickTrue);
1937 }
1938
1939 /*
1940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1941 % %
1942 % %
1943 % %
1944 % M a g i c k S e t C o m p r e s s i o n Q u a l i t y %
1945 % %
1946 % %
1947 % %
1948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1949 %
1950 % MagickSetCompressionQuality() sets the wand compression quality.
1951 %
1952 % The format of the MagickSetCompressionQuality method is:
1953 %
1954 % MagickBooleanType MagickSetCompressionQuality(MagickWand *wand,
1955 % const size_t quality)
1956 %
1957 % A description of each parameter follows:
1958 %
1959 % o wand: the magick wand.
1960 %
1961 % o quality: the wand compression quality.
1962 %
1963 */
MagickSetCompressionQuality(MagickWand * wand,const size_t quality)1964 WandExport MagickBooleanType MagickSetCompressionQuality(MagickWand *wand,
1965 const size_t quality)
1966 {
1967 assert(wand != (MagickWand *) NULL);
1968 assert(wand->signature == WandSignature);
1969 if (wand->debug != MagickFalse)
1970 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1971 wand->image_info->quality=quality;
1972 return(MagickTrue);
1973 }
1974
1975 /*
1976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1977 % %
1978 % %
1979 % %
1980 % M a g i c k S e t D e p t h %
1981 % %
1982 % %
1983 % %
1984 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1985 %
1986 % MagickSetDepth() sets the wand pixel depth.
1987 %
1988 % The format of the MagickSetDepth method is:
1989 %
1990 % MagickBooleanType MagickSetDepth(MagickWand *wand,
1991 % const size_t depth)
1992 %
1993 % A description of each parameter follows:
1994 %
1995 % o wand: the magick wand.
1996 %
1997 % o depth: the wand pixel depth.
1998 %
1999 */
MagickSetDepth(MagickWand * wand,const size_t depth)2000 WandExport MagickBooleanType MagickSetDepth(MagickWand *wand,
2001 const size_t depth)
2002 {
2003 assert(wand != (MagickWand *) NULL);
2004 assert(wand->signature == WandSignature);
2005 if (wand->debug != MagickFalse)
2006 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2007 wand->image_info->depth=depth;
2008 return(MagickTrue);
2009 }
2010
2011 /*
2012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2013 % %
2014 % %
2015 % %
2016 % M a g i c k S e t E x t r a c t %
2017 % %
2018 % %
2019 % %
2020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2021 %
2022 % MagickSetExtract() sets the extract geometry before you read or write an
2023 % image file. Use it for inline cropping (e.g. 200x200+0+0) or resizing
2024 % (e.g.200x200).
2025 %
2026 % The format of the MagickSetExtract method is:
2027 %
2028 % MagickBooleanType MagickSetExtract(MagickWand *wand,
2029 % const char *geometry)
2030 %
2031 % A description of each parameter follows:
2032 %
2033 % o wand: the magick wand.
2034 %
2035 % o geometry: the extract geometry.
2036 %
2037 */
MagickSetExtract(MagickWand * wand,const char * geometry)2038 WandExport MagickBooleanType MagickSetExtract(MagickWand *wand,
2039 const char *geometry)
2040 {
2041 assert(wand != (MagickWand *) NULL);
2042 assert(wand->signature == WandSignature);
2043 if (wand->debug != MagickFalse)
2044 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2045 if (wand->image_info->extract != (char *) NULL)
2046 wand->image_info->extract=DestroyString(wand->image_info->extract);
2047 if (geometry != (const char *) NULL)
2048 (void) CloneString(&wand->image_info->extract,geometry);
2049 return(MagickTrue);
2050 }
2051
2052 /*
2053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2054 % %
2055 % %
2056 % %
2057 % M a g i c k S e t F i l e n a m e %
2058 % %
2059 % %
2060 % %
2061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2062 %
2063 % MagickSetFilename() sets the filename before you read or write an image file.
2064 %
2065 % The format of the MagickSetFilename method is:
2066 %
2067 % MagickBooleanType MagickSetFilename(MagickWand *wand,
2068 % const char *filename)
2069 %
2070 % A description of each parameter follows:
2071 %
2072 % o wand: the magick wand.
2073 %
2074 % o filename: the image filename.
2075 %
2076 */
MagickSetFilename(MagickWand * wand,const char * filename)2077 WandExport MagickBooleanType MagickSetFilename(MagickWand *wand,
2078 const char *filename)
2079 {
2080 assert(wand != (MagickWand *) NULL);
2081 assert(wand->signature == WandSignature);
2082 if (wand->debug != MagickFalse)
2083 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2084 if (filename != (const char *) NULL)
2085 (void) CopyMagickString(wand->image_info->filename,filename,MaxTextExtent);
2086 return(MagickTrue);
2087 }
2088
2089 /*
2090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2091 % %
2092 % %
2093 % %
2094 % M a g i c k S e t F o n t %
2095 % %
2096 % %
2097 % %
2098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2099 %
2100 % MagickSetFont() sets the font associated with the MagickWand.
2101 %
2102 % The format of the MagickSetFont method is:
2103 %
2104 % MagickBooleanType MagickSetFont(MagickWand *wand, const char *font)
2105 %
2106 % A description of each parameter follows:
2107 %
2108 % o wand: the magick wand.
2109 %
2110 % o font: the font
2111 %
2112 */
MagickSetFont(MagickWand * wand,const char * font)2113 WandExport MagickBooleanType MagickSetFont(MagickWand *wand,const char *font)
2114 {
2115 if ((font == (const char *) NULL) || (*font == '\0'))
2116 return(MagickFalse);
2117 assert(wand != (MagickWand *) NULL);
2118 assert(wand->signature == WandSignature);
2119 if (wand->debug != MagickFalse)
2120 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2121 (void) CloneString(&wand->image_info->font,font);
2122 return(MagickTrue);
2123 }
2124
2125 /*
2126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2127 % %
2128 % %
2129 % %
2130 % M a g i c k S e t F o r m a t %
2131 % %
2132 % %
2133 % %
2134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2135 %
2136 % MagickSetFormat() sets the format of the magick wand.
2137 %
2138 % The format of the MagickSetFormat method is:
2139 %
2140 % MagickBooleanType MagickSetFormat(MagickWand *wand,const char *format)
2141 %
2142 % A description of each parameter follows:
2143 %
2144 % o wand: the magick wand.
2145 %
2146 % o format: the image format.
2147 %
2148 */
MagickSetFormat(MagickWand * wand,const char * format)2149 WandExport MagickBooleanType MagickSetFormat(MagickWand *wand,
2150 const char *format)
2151 {
2152 const MagickInfo
2153 *magick_info;
2154
2155 assert(wand != (MagickWand *) NULL);
2156 assert(wand->signature == WandSignature);
2157 if (wand->debug != MagickFalse)
2158 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2159 if ((format == (char *) NULL) || (*format == '\0'))
2160 {
2161 *wand->image_info->magick='\0';
2162 return(MagickTrue);
2163 }
2164 magick_info=GetMagickInfo(format,wand->exception);
2165 if (magick_info == (const MagickInfo *) NULL)
2166 return(MagickFalse);
2167 ClearMagickException(wand->exception);
2168 (void) CopyMagickString(wand->image_info->magick,format,MaxTextExtent);
2169 return(MagickTrue);
2170 }
2171
2172 /*
2173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2174 % %
2175 % %
2176 % %
2177 % M a g i c k S e t G r a v i t y %
2178 % %
2179 % %
2180 % %
2181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2182 %
2183 % MagickSetGravity() sets the gravity type.
2184 %
2185 % The format of the MagickSetGravity type is:
2186 %
2187 % MagickBooleanType MagickSetGravity(MagickWand *wand,
2188 % const GravityType type)
2189 %
2190 % A description of each parameter follows:
2191 %
2192 % o wand: the magick wand.
2193 %
2194 % o type: the gravity type.
2195 %
2196 */
MagickSetGravity(MagickWand * wand,const GravityType type)2197 WandExport MagickBooleanType MagickSetGravity(MagickWand *wand,
2198 const GravityType type)
2199 {
2200 MagickBooleanType
2201 status;
2202
2203 assert(wand != (MagickWand *) NULL);
2204 assert(wand->signature == WandSignature);
2205 if (wand->debug != MagickFalse)
2206 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2207 status=SetImageOption(wand->image_info,"gravity",CommandOptionToMnemonic(
2208 MagickGravityOptions,(ssize_t) type));
2209 return(status);
2210 }
2211
2212 /*
2213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2214 % %
2215 % %
2216 % %
2217 % M a g i c k S e t I m a g e A r t i f r c t %
2218 % %
2219 % %
2220 % %
2221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2222 %
2223 % MagickSetImageArtifact() sets a key-value pair in the image artifact
2224 % namespace. Artifacts differ from properties. Properties are public and are
2225 % generally exported to an external image format if the format supports it.
2226 % Artifacts are private and are utilized by the internal ImageMagick API to
2227 % modify the behavior of certain algorithms.
2228 %
2229 % The format of the MagickSetImageArtifact method is:
2230 %
2231 % MagickBooleanType MagickSetImageArtifact(MagickWand *wand,
2232 % const char *artifact,const char *value)
2233 %
2234 % A description of each parameter follows:
2235 %
2236 % o wand: the magick wand.
2237 %
2238 % o artifact: the artifact.
2239 %
2240 % o value: the value.
2241 %
2242 */
MagickSetImageArtifact(MagickWand * wand,const char * artifact,const char * value)2243 WandExport MagickBooleanType MagickSetImageArtifact(MagickWand *wand,
2244 const char *artifact,const char *value)
2245 {
2246 MagickBooleanType
2247 status;
2248
2249 assert(wand != (MagickWand *) NULL);
2250 assert(wand->signature == WandSignature);
2251 if (wand->debug != MagickFalse)
2252 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2253 if (wand->images == (Image *) NULL)
2254 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2255 status=SetImageArtifact(wand->images,artifact,value);
2256 if (status == MagickFalse)
2257 InheritException(wand->exception,&wand->images->exception);
2258 return(status);
2259 }
2260
2261 /*
2262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2263 % %
2264 % %
2265 % %
2266 % M a g i c k S e t P r o f i l e I m a g e %
2267 % %
2268 % %
2269 % %
2270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2271 %
2272 % MagickSetImageProfile() adds a named profile to the magick wand. If a
2273 % profile with the same name already exists, it is replaced. This method
2274 % differs from the MagickProfileImage() method in that it does not apply any
2275 % CMS color profiles.
2276 %
2277 % The format of the MagickSetImageProfile method is:
2278 %
2279 % MagickBooleanType MagickSetImageProfile(MagickWand *wand,
2280 % const char *name,const void *profile,const size_t length)
2281 %
2282 % A description of each parameter follows:
2283 %
2284 % o wand: the magick wand.
2285 %
2286 % o name: Name of profile to add or remove: ICC, IPTC, or generic profile.
2287 %
2288 % o profile: the profile.
2289 %
2290 % o length: the length of the profile.
2291 %
2292 */
MagickSetImageProfile(MagickWand * wand,const char * name,const void * profile,const size_t length)2293 WandExport MagickBooleanType MagickSetImageProfile(MagickWand *wand,
2294 const char *name,const void *profile,const size_t length)
2295 {
2296 MagickBooleanType
2297 status;
2298
2299 StringInfo
2300 *profile_info;
2301
2302 assert(wand != (MagickWand *) NULL);
2303 assert(wand->signature == WandSignature);
2304 if (wand->debug != MagickFalse)
2305 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2306 if (wand->images == (Image *) NULL)
2307 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2308 profile_info=AcquireStringInfo((size_t) length);
2309 SetStringInfoDatum(profile_info,(unsigned char *) profile);
2310 status=SetImageProfile(wand->images,name,profile_info);
2311 profile_info=DestroyStringInfo(profile_info);
2312 if (status == MagickFalse)
2313 InheritException(wand->exception,&wand->images->exception);
2314 return(status);
2315 }
2316
2317 /*
2318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2319 % %
2320 % %
2321 % %
2322 % M a g i c k S e t I m a g e P r o p e r t y %
2323 % %
2324 % %
2325 % %
2326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2327 %
2328 % MagickSetImageProperty() associates a property with an image.
2329 %
2330 % The format of the MagickSetImageProperty method is:
2331 %
2332 % MagickBooleanType MagickSetImageProperty(MagickWand *wand,
2333 % const char *property,const char *value)
2334 %
2335 % A description of each parameter follows:
2336 %
2337 % o wand: the magick wand.
2338 %
2339 % o property: the property.
2340 %
2341 % o value: the value.
2342 %
2343 */
MagickSetImageProperty(MagickWand * wand,const char * property,const char * value)2344 WandExport MagickBooleanType MagickSetImageProperty(MagickWand *wand,
2345 const char *property,const char *value)
2346 {
2347 MagickBooleanType
2348 status;
2349
2350 assert(wand != (MagickWand *) NULL);
2351 assert(wand->signature == WandSignature);
2352 if (wand->debug != MagickFalse)
2353 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2354 if (wand->images == (Image *) NULL)
2355 ThrowWandException(WandError,"ContainsNoImages",wand->name);
2356 status=SetImageProperty(wand->images,property,value);
2357 if (status == MagickFalse)
2358 InheritException(wand->exception,&wand->images->exception);
2359 return(status);
2360 }
2361
2362 /*
2363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2364 % %
2365 % %
2366 % %
2367 % M a g i c k S e t I n t e r l a c e S c h e m e %
2368 % %
2369 % %
2370 % %
2371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2372 %
2373 % MagickSetInterlaceScheme() sets the image compression.
2374 %
2375 % The format of the MagickSetInterlaceScheme method is:
2376 %
2377 % MagickBooleanType MagickSetInterlaceScheme(MagickWand *wand,
2378 % const InterlaceType interlace_scheme)
2379 %
2380 % A description of each parameter follows:
2381 %
2382 % o wand: the magick wand.
2383 %
2384 % o interlace_scheme: the image interlace scheme: NoInterlace, LineInterlace,
2385 % PlaneInterlace, PartitionInterlace.
2386 %
2387 */
MagickSetInterlaceScheme(MagickWand * wand,const InterlaceType interlace_scheme)2388 WandExport MagickBooleanType MagickSetInterlaceScheme(MagickWand *wand,
2389 const InterlaceType interlace_scheme)
2390 {
2391 assert(wand != (MagickWand *) NULL);
2392 assert(wand->signature == WandSignature);
2393 if (wand->debug != MagickFalse)
2394 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2395 wand->image_info->interlace=interlace_scheme;
2396 return(MagickTrue);
2397 }
2398
2399 /*
2400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2401 % %
2402 % %
2403 % %
2404 % M a g i c k S e t I n t e r p o l a t e M e t h o d %
2405 % %
2406 % %
2407 % %
2408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2409 %
2410 % MagickSetInterpolateMethod() sets the interpolate pixel method.
2411 %
2412 % The format of the MagickSetInterpolateMethod method is:
2413 %
2414 % MagickBooleanType MagickSetInterpolateMethod(MagickWand *wand,
2415 % const InterpolateMethodPixel method)
2416 %
2417 % A description of each parameter follows:
2418 %
2419 % o wand: the magick wand.
2420 %
2421 % o method: the interpolate pixel method.
2422 %
2423 */
MagickSetInterpolateMethod(MagickWand * wand,const InterpolatePixelMethod method)2424 WandExport MagickBooleanType MagickSetInterpolateMethod(MagickWand *wand,
2425 const InterpolatePixelMethod method)
2426 {
2427 MagickBooleanType
2428 status;
2429
2430 assert(wand != (MagickWand *) NULL);
2431 assert(wand->signature == WandSignature);
2432 if (wand->debug != MagickFalse)
2433 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2434 status=SetImageOption(wand->image_info,"interpolate",
2435 CommandOptionToMnemonic(MagickInterpolateOptions,(ssize_t) method));
2436 return(status);
2437 }
2438
2439 /*
2440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2441 % %
2442 % %
2443 % %
2444 % M a g i c k S e t O p t i o n %
2445 % %
2446 % %
2447 % %
2448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2449 %
2450 % MagickSetOption() associates one or options with the wand (.e.g
2451 % MagickSetOption(wand,"jpeg:perserve","yes")).
2452 %
2453 % The format of the MagickSetOption method is:
2454 %
2455 % MagickBooleanType MagickSetOption(MagickWand *wand,const char *key,
2456 % const char *value)
2457 %
2458 % A description of each parameter follows:
2459 %
2460 % o wand: the magick wand.
2461 %
2462 % o key: The key.
2463 %
2464 % o value: The value.
2465 %
2466 */
MagickSetOption(MagickWand * wand,const char * key,const char * value)2467 WandExport MagickBooleanType MagickSetOption(MagickWand *wand,const char *key,
2468 const char *value)
2469 {
2470 assert(wand != (MagickWand *) NULL);
2471 assert(wand->signature == WandSignature);
2472 if (wand->debug != MagickFalse)
2473 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2474 return(SetImageOption(wand->image_info,key,value));
2475 }
2476
2477 /*
2478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2479 % %
2480 % %
2481 % %
2482 % M a g i c k S e t O r i e n t a t i o n %
2483 % %
2484 % %
2485 % %
2486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2487 %
2488 % MagickSetOrientation() sets the wand orientation type.
2489 %
2490 % The format of the MagickSetOrientation method is:
2491 %
2492 % MagickBooleanType MagickSetOrientation(MagickWand *wand,
2493 % const OrientationType orientation)
2494 %
2495 % A description of each parameter follows:
2496 %
2497 % o wand: the magick wand.
2498 %
2499 % o orientation: the wand orientation.
2500 %
2501 */
MagickSetOrientation(MagickWand * wand,const OrientationType orientation)2502 WandExport MagickBooleanType MagickSetOrientation(MagickWand *wand,
2503 const OrientationType orientation)
2504 {
2505 assert(wand != (MagickWand *) NULL);
2506 assert(wand->signature == WandSignature);
2507 if (wand->debug != MagickFalse)
2508 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2509 wand->image_info->orientation=orientation;
2510 return(MagickTrue);
2511 }
2512
2513 /*
2514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2515 % %
2516 % %
2517 % %
2518 % M a g i c k S e t P a g e %
2519 % %
2520 % %
2521 % %
2522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2523 %
2524 % MagickSetPage() sets the page geometry of the magick wand.
2525 %
2526 % The format of the MagickSetPage method is:
2527 %
2528 % MagickBooleanType MagickSetPage(MagickWand *wand,
2529 % const size_t width,const size_t height,const ssize_t x,
2530 % const ssize_t y)
2531 %
2532 % A description of each parameter follows:
2533 %
2534 % o wand: the magick wand.
2535 %
2536 % o width: the page width.
2537 %
2538 % o height: the page height.
2539 %
2540 % o x: the page x-offset.
2541 %
2542 % o y: the page y-offset.
2543 %
2544 */
MagickSetPage(MagickWand * wand,const size_t width,const size_t height,const ssize_t x,const ssize_t y)2545 WandExport MagickBooleanType MagickSetPage(MagickWand *wand,
2546 const size_t width,const size_t height,const ssize_t x,
2547 const ssize_t y)
2548 {
2549 char
2550 geometry[MaxTextExtent];
2551
2552 assert(wand != (MagickWand *) NULL);
2553 assert(wand->signature == WandSignature);
2554 if (wand->debug != MagickFalse)
2555 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2556 (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
2557 (double) width,(double) height,(double) x,(double) y);
2558 (void) CloneString(&wand->image_info->page,geometry);
2559 return(MagickTrue);
2560 }
2561
2562 /*
2563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2564 % %
2565 % %
2566 % %
2567 % M a g i c k S e t P a s s p h r a s e %
2568 % %
2569 % %
2570 % %
2571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2572 %
2573 % MagickSetPassphrase() sets the passphrase.
2574 %
2575 % The format of the MagickSetPassphrase method is:
2576 %
2577 % MagickBooleanType MagickSetPassphrase(MagickWand *wand,
2578 % const char *passphrase)
2579 %
2580 % A description of each parameter follows:
2581 %
2582 % o wand: the magick wand.
2583 %
2584 % o passphrase: the passphrase.
2585 %
2586 */
MagickSetPassphrase(MagickWand * wand,const char * passphrase)2587 WandExport MagickBooleanType MagickSetPassphrase(MagickWand *wand,
2588 const char *passphrase)
2589 {
2590 assert(wand != (MagickWand *) NULL);
2591 assert(wand->signature == WandSignature);
2592 if (wand->debug != MagickFalse)
2593 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2594 (void) CloneString(&wand->image_info->authenticate,passphrase);
2595 return(MagickTrue);
2596 }
2597
2598 /*
2599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2600 % %
2601 % %
2602 % %
2603 % M a g i c k S e t P o i n t s i z e %
2604 % %
2605 % %
2606 % %
2607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2608 %
2609 % MagickSetPointsize() sets the font pointsize associated with the MagickWand.
2610 %
2611 % The format of the MagickSetPointsize method is:
2612 %
2613 % MagickBooleanType MagickSetPointsize(MagickWand *wand,
2614 % const double pointsize)
2615 %
2616 % A description of each parameter follows:
2617 %
2618 % o wand: the magick wand.
2619 %
2620 % o pointsize: the size of the font
2621 %
2622 */
MagickSetPointsize(MagickWand * wand,const double pointsize)2623 WandExport MagickBooleanType MagickSetPointsize(MagickWand *wand,
2624 const double pointsize)
2625 {
2626 assert(wand != (MagickWand *) NULL);
2627 assert(wand->signature == WandSignature);
2628 if (wand->debug != MagickFalse)
2629 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2630 wand->image_info->pointsize=pointsize;
2631 return(MagickTrue);
2632 }
2633
2634 /*
2635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2636 % %
2637 % %
2638 % %
2639 % M a g i c k S e t P r o g r e s s M o n i t o r %
2640 % %
2641 % %
2642 % %
2643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2644 %
2645 % MagickSetProgressMonitor() sets the wand progress monitor to the specified
2646 % method and returns the previous progress monitor if any. The progress
2647 % monitor method looks like this:
2648 %
2649 % MagickBooleanType MagickProgressMonitor(const char *text,
2650 % const MagickOffsetType offset,const MagickSizeType span,
2651 % void *client_data)
2652 %
2653 % If the progress monitor returns MagickFalse, the current operation is
2654 % interrupted.
2655 %
2656 % The format of the MagickSetProgressMonitor method is:
2657 %
2658 % MagickProgressMonitor MagickSetProgressMonitor(MagickWand *wand
2659 % const MagickProgressMonitor progress_monitor,void *client_data)
2660 %
2661 % A description of each parameter follows:
2662 %
2663 % o wand: the magick wand.
2664 %
2665 % o progress_monitor: Specifies a pointer to a method to monitor progress
2666 % of an image operation.
2667 %
2668 % o client_data: Specifies a pointer to any client data.
2669 %
2670 */
MagickSetProgressMonitor(MagickWand * wand,const MagickProgressMonitor progress_monitor,void * client_data)2671 WandExport MagickProgressMonitor MagickSetProgressMonitor(MagickWand *wand,
2672 const MagickProgressMonitor progress_monitor,void *client_data)
2673 {
2674 MagickProgressMonitor
2675 previous_monitor;
2676
2677 assert(wand != (MagickWand *) NULL);
2678 assert(wand->signature == WandSignature);
2679 if (wand->debug != MagickFalse)
2680 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2681 previous_monitor=SetImageInfoProgressMonitor(wand->image_info,
2682 progress_monitor,client_data);
2683 return(previous_monitor);
2684 }
2685
2686 /*
2687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2688 % %
2689 % %
2690 % %
2691 % M a g i c k S e t R e s o u r c e L i m i t %
2692 % %
2693 % %
2694 % %
2695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2696 %
2697 % MagickSetResourceLimit() sets the limit for a particular resource in
2698 % megabytes.
2699 %
2700 % The format of the MagickSetResourceLimit method is:
2701 %
2702 % MagickBooleanType MagickSetResourceLimit(const ResourceType type,
2703 % const MagickSizeType limit)
2704 %
2705 % A description of each parameter follows:
2706 %
2707 % o type: the type of resource: AreaResource, MemoryResource, MapResource,
2708 % DiskResource, FileResource.
2709 %
2710 % o The maximum limit for the resource.
2711 %
2712 */
MagickSetResourceLimit(const ResourceType type,const MagickSizeType limit)2713 WandExport MagickBooleanType MagickSetResourceLimit(const ResourceType type,
2714 const MagickSizeType limit)
2715 {
2716 return(SetMagickResourceLimit(type,limit));
2717 }
2718
2719 /*
2720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2721 % %
2722 % %
2723 % %
2724 % M a g i c k S e t R e s o l u t i o n %
2725 % %
2726 % %
2727 % %
2728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2729 %
2730 % MagickSetResolution() sets the image resolution.
2731 %
2732 % The format of the MagickSetResolution method is:
2733 %
2734 % MagickBooleanType MagickSetResolution(MagickWand *wand,
2735 % const double x_resolution,const double y_resolution)
2736 %
2737 % A description of each parameter follows:
2738 %
2739 % o wand: the magick wand.
2740 %
2741 % o x_resolution: the image x resolution.
2742 %
2743 % o y_resolution: the image y resolution.
2744 %
2745 */
MagickSetResolution(MagickWand * wand,const double x_resolution,const double y_resolution)2746 WandExport MagickBooleanType MagickSetResolution(MagickWand *wand,
2747 const double x_resolution,const double y_resolution)
2748 {
2749 char
2750 density[MaxTextExtent];
2751
2752 assert(wand != (MagickWand *) NULL);
2753 assert(wand->signature == WandSignature);
2754 if (wand->debug != MagickFalse)
2755 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2756 (void) FormatLocaleString(density,MaxTextExtent,"%gx%g",x_resolution,
2757 y_resolution);
2758 (void) CloneString(&wand->image_info->density,density);
2759 return(MagickTrue);
2760 }
2761
2762 /*
2763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2764 % %
2765 % %
2766 % %
2767 % M a g i c k S e t S a m p l i n g F a c t o r s %
2768 % %
2769 % %
2770 % %
2771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2772 %
2773 % MagickSetSamplingFactors() sets the image sampling factors.
2774 %
2775 % The format of the MagickSetSamplingFactors method is:
2776 %
2777 % MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
2778 % const size_t number_factors,const double *sampling_factors)
2779 %
2780 % A description of each parameter follows:
2781 %
2782 % o wand: the magick wand.
2783 %
2784 % o number_factoes: the number of factors.
2785 %
2786 % o sampling_factors: An array of doubles representing the sampling factor
2787 % for each color component (in RGB order).
2788 %
2789 */
MagickSetSamplingFactors(MagickWand * wand,const size_t number_factors,const double * sampling_factors)2790 WandExport MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
2791 const size_t number_factors,const double *sampling_factors)
2792 {
2793 char
2794 sampling_factor[MaxTextExtent];
2795
2796 ssize_t
2797 i;
2798
2799 assert(wand != (MagickWand *) NULL);
2800 assert(wand->signature == WandSignature);
2801 if (wand->debug != MagickFalse)
2802 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2803 if (wand->image_info->sampling_factor != (char *) NULL)
2804 wand->image_info->sampling_factor=(char *)
2805 RelinquishMagickMemory(wand->image_info->sampling_factor);
2806 if (number_factors == 0)
2807 return(MagickTrue);
2808 for (i=0; i < (ssize_t) (number_factors-1); i++)
2809 {
2810 (void) FormatLocaleString(sampling_factor,MaxTextExtent,"%g,",
2811 sampling_factors[i]);
2812 (void) ConcatenateString(&wand->image_info->sampling_factor,
2813 sampling_factor);
2814 }
2815 (void) FormatLocaleString(sampling_factor,MaxTextExtent,"%g",
2816 sampling_factors[i]);
2817 (void) ConcatenateString(&wand->image_info->sampling_factor,sampling_factor);
2818 return(MagickTrue);
2819 }
2820
2821 /*
2822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2823 % %
2824 % %
2825 % %
2826 % M a g i c k S e t S e c u r i t y P o l i c y %
2827 % %
2828 % %
2829 % %
2830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2831 %
2832 % MagickSetSecurityPolicy() sets the ImageMagick security policy. It returns
2833 % MagickFalse if the policy is already set or if the policy does not parse.
2834 %
2835 % The format of the MagickSetAntialias method is:
2836 %
2837 % MagickBooleanType MagickSetAntialias(MagickWand *wand,
2838 % const char *policy)
2839 %
2840 % A description of each parameter follows:
2841 %
2842 % o wand: the magick wand.
2843 %
2844 % o policy: the security policy in the XML format.
2845 %
2846 */
MagickSetSecurityPolicy(MagickWand * wand,const char * policy)2847 WandExport MagickBooleanType MagickSetSecurityPolicy(MagickWand *wand,
2848 const char *policy)
2849 {
2850 assert(wand != (MagickWand *) NULL);
2851 assert(wand->signature == WandSignature);
2852 if (wand->debug != MagickFalse)
2853 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2854
2855 return(SetMagickSecurityPolicy(policy,wand->exception));
2856 }
2857
2858 /*
2859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2860 % %
2861 % %
2862 % %
2863 % M a g i c k S e t S i z e %
2864 % %
2865 % %
2866 % %
2867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2868 %
2869 % MagickSetSize() sets the size of the magick wand. Set it before you
2870 % read a raw image format such as RGB, GRAY, or CMYK.
2871 %
2872 % The format of the MagickSetSize method is:
2873 %
2874 % MagickBooleanType MagickSetSize(MagickWand *wand,
2875 % const size_t columns,const size_t rows)
2876 %
2877 % A description of each parameter follows:
2878 %
2879 % o wand: the magick wand.
2880 %
2881 % o columns: the width in pixels.
2882 %
2883 % o rows: the rows in pixels.
2884 %
2885 */
MagickSetSize(MagickWand * wand,const size_t columns,const size_t rows)2886 WandExport MagickBooleanType MagickSetSize(MagickWand *wand,
2887 const size_t columns,const size_t rows)
2888 {
2889 char
2890 geometry[MaxTextExtent];
2891
2892 assert(wand != (MagickWand *) NULL);
2893 assert(wand->signature == WandSignature);
2894 if (wand->debug != MagickFalse)
2895 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2896 (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g",(double)
2897 columns,(double) rows);
2898 (void) CloneString(&wand->image_info->size,geometry);
2899 return(MagickTrue);
2900 }
2901
2902 /*
2903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2904 % %
2905 % %
2906 % %
2907 % M a g i c k S e t S i z e O f f s e t %
2908 % %
2909 % %
2910 % %
2911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2912 %
2913 % MagickSetSizeOffset() sets the size and offset of the magick wand. Set it
2914 % before you read a raw image format such as RGB, GRAY, or CMYK.
2915 %
2916 % The format of the MagickSetSizeOffset method is:
2917 %
2918 % MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
2919 % const size_t columns,const size_t rows,
2920 % const ssize_t offset)
2921 %
2922 % A description of each parameter follows:
2923 %
2924 % o wand: the magick wand.
2925 %
2926 % o columns: the image width in pixels.
2927 %
2928 % o rows: the image rows in pixels.
2929 %
2930 % o offset: the image offset.
2931 %
2932 */
MagickSetSizeOffset(MagickWand * wand,const size_t columns,const size_t rows,const ssize_t offset)2933 WandExport MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
2934 const size_t columns,const size_t rows,const ssize_t offset)
2935 {
2936 char
2937 geometry[MaxTextExtent];
2938
2939 assert(wand != (MagickWand *) NULL);
2940 assert(wand->signature == WandSignature);
2941 if (wand->debug != MagickFalse)
2942 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2943 (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g%+.20g",
2944 (double) columns,(double) rows,(double) offset);
2945 (void) CloneString(&wand->image_info->size,geometry);
2946 return(MagickTrue);
2947 }
2948
2949 /*
2950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2951 % %
2952 % %
2953 % %
2954 % M a g i c k S e t T y p e %
2955 % %
2956 % %
2957 % %
2958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2959 %
2960 % MagickSetType() sets the image type attribute.
2961 %
2962 % The format of the MagickSetType method is:
2963 %
2964 % MagickBooleanType MagickSetType(MagickWand *wand,
2965 % const ImageType image_type)
2966 %
2967 % A description of each parameter follows:
2968 %
2969 % o wand: the magick wand.
2970 %
2971 % o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
2972 % GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
2973 % TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
2974 % or OptimizeType.
2975 %
2976 */
MagickSetType(MagickWand * wand,const ImageType image_type)2977 WandExport MagickBooleanType MagickSetType(MagickWand *wand,
2978 const ImageType image_type)
2979 {
2980 assert(wand != (MagickWand *) NULL);
2981 assert(wand->signature == WandSignature);
2982 if (wand->debug != MagickFalse)
2983 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2984 wand->image_info->type=image_type;
2985 return(MagickTrue);
2986 }
2987