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