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