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