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