root / ImageMagick / trunk / wand / magick-property.c
| Revision 11008, 98.4 kB (checked in by cristy, 4 months ago) |
|---|
| Line | |
|---|---|
| 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % M M AAA GGGG IIIII CCCC K K % |
| 7 | % MM MM A A G I C K K % |
| 8 | % M M M AAAAA G GGG I C KKK % |
| 9 | % M M A A G G I C K K % |
| 10 | % M M A A GGGG IIIII CCCC K K % |
| 11 | % % |
| 12 | % PPPP RRRR OOO PPPP EEEEE RRRR TTTTT Y Y % |
| 13 | % P P R R O O P P E R R T Y Y % |
| 14 | % PPPP RRRR O O PPPP EEE RRRR T Y % |
| 15 | % P R R O O P E R R T Y % |
| 16 | % P R R OOO P EEEEE R R T Y % |
| 17 | % % |
| 18 | % % |
| 19 | % Set or Get MagickWand Properties, Options, or Profiles % |
| 20 | % % |
| 21 | % Software Design % |
| 22 | % John Cristy % |
| 23 | % August 2003 % |
| 24 | % % |
| 25 | % % |
| 26 | % Copyright 1999-2008 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 "wand/studio.h" |
| 50 | #include "wand/MagickWand.h" |
| 51 | #include "wand/magick-wand-private.h" |
| 52 | #include "wand/wand.h" |
| 53 | |
| 54 | /* |
| 55 | Define declarations. |
| 56 | */ |
| 57 | #define ThrowWandException(severity,tag,context) \ |
| 58 | { \ |
| 59 | (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \ |
| 60 | tag,"`%s'",context); \ |
| 61 | return(MagickFalse); \ |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 66 | % % |
| 67 | % % |
| 68 | % % |
| 69 | % 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 % |
| 70 | % % |
| 71 | % % |
| 72 | % % |
| 73 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 74 | % |
| 75 | % MagickDeleteImageProperty() deletes a wand property. |
| 76 | % |
| 77 | % The format of the MagickDeleteImageProperty method is: |
| 78 | % |
| 79 | % MagickBooleanType MagickDeleteImageProperty(MagickWand *wand, |
| 80 | % const char *property) |
| 81 | % |
| 82 | % A description of each parameter follows: |
| 83 | % |
| 84 | % o image: the image. |
| 85 | % |
| 86 | % o property: the image property. |
| 87 | % |
| 88 | */ |
| 89 | WandExport MagickBooleanType MagickDeleteImageProperty(MagickWand *wand, |
| 90 | const char *property) |
| 91 | { |
| 92 | assert(wand != (MagickWand *) NULL); |
| 93 | assert(wand->signature == WandSignature); |
| 94 | if (wand->debug != MagickFalse) |
| 95 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 96 | if (wand->images == (Image *) NULL) |
| 97 | { |
| 98 | (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, |
| 99 | "ContainsNoImages","`%s'",wand->name); |
| 100 | return(MagickFalse); |
| 101 | } |
| 102 | return(DeleteImageProperty(wand->images,property)); |
| 103 | } |
| 104 | |
| 105 | /* |
| 106 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 107 | % % |
| 108 | % % |
| 109 | % % |
| 110 | % M a g i c k D e l e t e O p t i o n % |
| 111 | % % |
| 112 | % % |
| 113 | % % |
| 114 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 115 | % |
| 116 | % MagickDeleteOption() deletes a wand option. |
| 117 | % |
| 118 | % The format of the MagickDeleteOption method is: |
| 119 | % |
| 120 | % MagickBooleanType MagickDeleteOption(MagickWand *wand, |
| 121 | % const char *option) |
| 122 | % |
| 123 | % A description of each parameter follows: |
| 124 | % |
| 125 | % o image: the image. |
| 126 | % |
| 127 | % o option: the image option. |
| 128 | % |
| 129 | */ |
| 130 | WandExport MagickBooleanType MagickDeleteOption(MagickWand *wand, |
| 131 | const char *option) |
| 132 | { |
| 133 | assert(wand != (MagickWand *) NULL); |
| 134 | assert(wand->signature == WandSignature); |
| 135 | if (wand->debug != MagickFalse) |
| 136 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 137 | return(DeleteImageOption(wand->image_info,option)); |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 142 | % % |
| 143 | % % |
| 144 | % % |
| 145 | % M a g i c k G e t A n t i a l i a s % |
| 146 | % % |
| 147 | % % |
| 148 | % % |
| 149 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 150 | % |
| 151 | % MagickGetAntialias() returns the antialias property associated with the |
| 152 | % wand. |
| 153 | % |
| 154 | % The format of the MagickGetAntialias method is: |
| 155 | % |
| 156 | % MagickBooleanType MagickGetAntialias(const MagickWand *wand) |
| 157 | % |
| 158 | % A description of each parameter follows: |
| 159 | % |
| 160 | % o wand: the magick wand. |
| 161 | % |
| 162 | */ |
| 163 | WandExport MagickBooleanType MagickGetAntialias(const MagickWand *wand) |
| 164 | { |
| 165 | assert(wand != (const MagickWand *) NULL); |
| 166 | assert(wand->signature == WandSignature); |
| 167 | if (wand->debug != MagickFalse) |
| 168 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 169 | return(wand->image_info->antialias); |
| 170 | } |
| 171 | |
| 172 | /* |
| 173 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 174 | % % |
| 175 | % % |
| 176 | % % |
| 177 | % M a g i c k G e t B a c k g r o u n d C o l o r % |
| 178 | % % |
| 179 | % % |
| 180 | % % |
| 181 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 182 | % |
| 183 | % MagickGetBackgroundColor() returns the wand background color. |
| 184 | % |
| 185 | % The format of the MagickGetBackgroundColor method is: |
| 186 | % |
| 187 | % PixelWand *MagickGetBackgroundColor(MagickWand *wand) |
| 188 | % |
| 189 | % A description of each parameter follows: |
| 190 | % |
| 191 | % o wand: the magick wand. |
| 192 | % |
| 193 | */ |
| 194 | WandExport PixelWand *MagickGetBackgroundColor(MagickWand *wand) |
| 195 | { |
| 196 | PixelWand |
| 197 | *background_color; |
| 198 | |
| 199 | assert(wand != (MagickWand *) NULL); |
| 200 | assert(wand->signature == WandSignature); |
| 201 | if (wand->debug != MagickFalse) |
| 202 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 203 | background_color=NewPixelWand(); |
| 204 | PixelSetQuantumColor(background_color,&wand->image_info->background_color); |
| 205 | return(background_color); |
| 206 | } |
| 207 | |
| 208 | /* |
| 209 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 210 | % % |
| 211 | % % |
| 212 | % % |
| 213 | % M a g i c k G e t C o m p r e s s i o n % |
| 214 | % % |
| 215 | % % |
| 216 | % % |
| 217 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 218 | % |
| 219 | % MagickGetCompression() gets the wand compression type. |
| 220 | % |
| 221 | % The format of the MagickGetCompression method is: |
| 222 | % |
| 223 | % CompressionType MagickGetCompression(MagickWand *wand) |
| 224 | % |
| 225 | % A description of each parameter follows: |
| 226 | % |
| 227 | % o wand: the magick wand. |
| 228 | % |
| 229 | */ |
| 230 | WandExport CompressionType MagickGetCompression(MagickWand *wand) |
| 231 | { |
| 232 | assert(wand != (MagickWand *) NULL); |
| 233 | assert(wand->signature == WandSignature); |
| 234 | if (wand->debug != MagickFalse) |
| 235 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 236 | return(wand->image_info->compression); |
| 237 | } |
| 238 | |
| 239 | /* |
| 240 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 241 | % % |
| 242 | % % |
| 243 | % % |
| 244 | % 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 % |
| 245 | % % |
| 246 | % % |
| 247 | % % |
| 248 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 249 | % |
| 250 | % MagickGetCompressionQuality() gets the wand compression quality. |
| 251 | % |
| 252 | % The format of the MagickGetCompressionQuality method is: |
| 253 | % |
| 254 | % unsigned long MagickGetCompressionQuality(MagickWand *wand) |
| 255 | % |
| 256 | % A description of each parameter follows: |
| 257 | % |
| 258 | % o wand: the magick wand. |
| 259 | % |
| 260 | */ |
| 261 | WandExport unsigned long MagickGetCompressionQuality(MagickWand *wand) |
| 262 | { |
| 263 | assert(wand != (MagickWand *) NULL); |
| 264 | assert(wand->signature == WandSignature); |
| 265 | if (wand->debug != MagickFalse) |
| 266 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 267 | return(wand->image_info->quality); |
| 268 | } |
| 269 | |
| 270 | /* |
| 271 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 272 | % % |
| 273 | % % |
| 274 | % % |
| 275 | % M a g i c k G e t C o p y r i g h t % |
| 276 | % % |
| 277 | % % |
| 278 | % % |
| 279 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 280 | % |
| 281 | % MagickGetCopyright() returns the ImageMagick API copyright as a string |
| 282 | % constant. |
| 283 | % |
| 284 | % The format of the MagickGetCopyright method is: |
| 285 | % |
| 286 | % const char *MagickGetCopyright(void) |
| 287 | % |
| 288 | */ |
| 289 | WandExport const char *MagickGetCopyright(void) |
| 290 | { |
| 291 | return(GetMagickCopyright()); |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 296 | % % |
| 297 | % % |
| 298 | % % |
| 299 | % M a g i c k G e t F i l e n a m e % |
| 300 | % % |
| 301 | % % |
| 302 | % % |
| 303 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 304 | % |
| 305 | % MagickGetFilename() returns the filename associated with an image sequence. |
| 306 | % |
| 307 | % The format of the MagickGetFilename method is: |
| 308 | % |
| 309 | % const char *MagickGetFilename(const MagickWand *wand) |
| 310 | % |
| 311 | % A description of each parameter follows: |
| 312 | % |
| 313 | % o wand: the magick wand. |
| 314 | % |
| 315 | */ |
| 316 | WandExport char *MagickGetFilename(const MagickWand *wand) |
| 317 | { |
| 318 | assert(wand != (const MagickWand *) NULL); |
| 319 | assert(wand->signature == WandSignature); |
| 320 | if (wand->debug != MagickFalse) |
| 321 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 322 | return(AcquireString(wand->image_info->filename)); |
| 323 | } |
| 324 | |
| 325 | /* |
| 326 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 327 | % % |
| 328 | % % |
| 329 | % % |
| 330 | % M a g i c k G e t F o n t % |
| 331 | % % |
| 332 | % % |
| 333 | % % |
| 334 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 335 | % |
| 336 | % MagickGetFont() returns the font associated with the MagickWand. |
| 337 | % |
| 338 | % The format of the MagickGetFont method is: |
| 339 | % |
| 340 | % char *MagickGetFont(MagickWand *wand) |
| 341 | % |
| 342 | % A description of each parameter follows: |
| 343 | % |
| 344 | % o wand: the magick wand. |
| 345 | % |
| 346 | */ |
| 347 | WandExport char *MagickGetFont(MagickWand *wand) |
| 348 | { |
| 349 | assert(wand != (MagickWand *) NULL); |
| 350 | assert(wand->signature == WandSignature); |
| 351 | if (wand->debug != MagickFalse) |
| 352 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 353 | if (wand->image_info->font == (char *) NULL) |
| 354 | return((char *) NULL); |
| 355 | return(AcquireString(wand->image_info->font)); |
| 356 | } |
| 357 | |
| 358 | /* |
| 359 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 360 | % % |
| 361 | % % |
| 362 | % % |
| 363 | % M a g i c k G e t F o r m a t % |
| 364 | % % |
| 365 | % % |
| 366 | % % |
| 367 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 368 | % |
| 369 | % MagickGetFormat() returns the format of the magick wand. |
| 370 | % |
| 371 | % The format of the MagickGetFormat method is: |
| 372 | % |
| 373 | % const char MagickGetFormat(MagickWand *wand) |
| 374 | % |
| 375 | % A description of each parameter follows: |
| 376 | % |
| 377 | % o wand: the magick wand. |
| 378 | % |
| 379 | */ |
| 380 | WandExport char *MagickGetFormat(MagickWand *wand) |
| 381 | { |
| 382 | assert(wand != (MagickWand *) NULL); |
| 383 | assert(wand->signature == WandSignature); |
| 384 | if (wand->debug != MagickFalse) |
| 385 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 386 | return(AcquireString(wand->image_info->magick)); |
| 387 | } |
| 388 | |
| 389 | /* |
| 390 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 391 | % % |
| 392 | % % |
| 393 | % % |
| 394 | % M a g i c k G e t G r a v i t y % |
| 395 | % % |
| 396 | % % |
| 397 | % % |
| 398 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 399 | % |
| 400 | % MagickGetGravity() gets the wand gravity. |
| 401 | % |
| 402 | % The format of the MagickGetGravity method is: |
| 403 | % |
| 404 | % GravityType MagickGetGravity(MagickWand *wand) |
| 405 | % |
| 406 | % A description of each parameter follows: |
| 407 | % |
| 408 | % o wand: the magick wand. |
| 409 | % |
| 410 | */ |
| 411 | WandExport GravityType MagickGetGravity(MagickWand *wand) |
| 412 | { |
| 413 | const char |
| 414 | *option; |
| 415 | |
| 416 | GravityType |
| 417 | type; |
| 418 | |
| 419 | assert(wand != (MagickWand *) NULL); |
| 420 | assert(wand->signature == WandSignature); |
| 421 | if (wand->debug != MagickFalse) |
| 422 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 423 | option=GetImageOption(wand->image_info,"gravity"); |
| 424 | if (option == (const char *) NULL) |
| 425 | return(UndefinedGravity); |
| 426 | type=(GravityType) ParseMagickOption(MagickGravityOptions,MagickFalse,option); |
| 427 | return(type); |
| 428 | } |
| 429 | |
| 430 | /* |
| 431 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 432 | % % |
| 433 | % % |
| 434 | % % |
| 435 | % M a g i c k G e t H o m e U R L % |
| 436 | % % |
| 437 | % % |
| 438 | % % |
| 439 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 440 | % |
| 441 | % MagickGetHomeURL() returns the ImageMagick home URL. |
| 442 | % |
| 443 | % The format of the MagickGetHomeURL method is: |
| 444 | % |
| 445 | % char *MagickGetHomeURL(void) |
| 446 | % |
| 447 | */ |
| 448 | WandExport char *MagickGetHomeURL(void) |
| 449 | { |
| 450 | return(GetMagickHomeURL()); |
| 451 | } |
| 452 | |
| 453 | /* |
| 454 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 455 | % % |
| 456 | % % |
| 457 | % % |
| 458 | % M a g i c k G e t I m a g e P r o f i l e % |
| 459 | % % |
| 460 | % % |
| 461 | % % |
| 462 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 463 | % |
| 464 | % MagickGetImageProfile() returns the named image profile. |
| 465 | % |
| 466 | % The format of the MagickGetImageProfile method is: |
| 467 | % |
| 468 | % unsigned char *MagickGetImageProfile(MagickWand *wand,const char *name, |
| 469 | % size_t *length) |
| 470 | % |
| 471 | % A description of each parameter follows: |
| 472 | % |
| 473 | % o wand: the magick wand. |
| 474 | % |
| 475 | % o name: Name of profile to return: ICC, IPTC, or generic profile. |
| 476 | % |
| 477 | % o length: the length of the profile. |
| 478 | % |
| 479 | */ |
| 480 | WandExport unsigned char *MagickGetImageProfile(MagickWand *wand, |
| 481 | const char *name,size_t *length) |
| 482 | { |
| 483 | const StringInfo |
| 484 | *profile; |
| 485 | |
| 486 | unsigned char |
| 487 | *datum; |
| 488 | |
| 489 | assert(wand != (MagickWand *) NULL); |
| 490 | assert(wand->signature == WandSignature); |
| 491 | if (wand->debug != MagickFalse) |
| 492 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 493 | if (wand->images == (Image *) NULL) |
| 494 | { |
| 495 | (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, |
| 496 | "ContainsNoImages","`%s'",wand->name); |
| 497 | return((unsigned char *) NULL); |
| 498 | } |
| 499 | *length=0; |
| 500 | if (wand->images->profiles == (SplayTreeInfo *) NULL) |
| 501 | return((unsigned char *) NULL); |
| 502 | profile=GetImageProfile(wand->images,name); |
| 503 | if (profile == (StringInfo *) NULL) |
| 504 | return((unsigned char *) NULL); |
| 505 | datum=(unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile), |
| 506 | sizeof(*datum)); |
| 507 | if (datum == (unsigned char *) NULL) |
| 508 | return((unsigned char *) NULL); |
| 509 | (void) CopyMagickMemory(datum,GetStringInfoDatum(profile), |
| 510 | GetStringInfoLength(profile)); |
| 511 | *length=(unsigned long) GetStringInfoLength(profile); |
| 512 | return(datum); |
| 513 | } |
| 514 | |
| 515 | /* |
| 516 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 517 | % % |
| 518 | % % |
| 519 | % % |
| 520 | % M a g i c k G e t I m a g e P r o f i l e s % |
| 521 | % % |
| 522 | % % |
| 523 | % % |
| 524 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 525 | % |
| 526 | % MagickGetImageProfiles() returns all the profile names that match the |
| 527 | % specified pattern associated with a wand. Use MagickGetImageProfile() to |
| 528 | % return the value of a particular property. Use MagickRelinquishMemory() to |
| 529 | % free the value when you are finished with it. |
| 530 | % |
| 531 | % The format of the MagickGetImageProfiles method is: |
| 532 | % |
| 533 | % char *MagickGetImageProfiles(MagickWand *wand, |
| 534 | % unsigned long *number_profiles) |
| 535 | % |
| 536 | % A description of each parameter follows: |
| 537 | % |
| 538 | % o wand: the magick wand. |
| 539 | % |
| 540 | % o pattern: Specifies a pointer to a text string containing a pattern. |
| 541 | % |
| 542 | % o number_profiles: the number profiles associated with this wand. |
| 543 | % |
| 544 | */ |
| 545 | WandExport char **MagickGetImageProfiles(MagickWand *wand,const char *pattern, |
| 546 | unsigned long *number_profiles) |
| 547 | { |
| 548 | char |
| 549 | **profiles; |
| 550 | |
| 551 | const char |
| 552 | *property; |
| 553 | |
| 554 | register long |
| 555 | i; |
| 556 | |
| 557 | size_t |
| 558 | length; |
| 559 | |
| 560 | assert(wand != (MagickWand *) NULL); |
| 561 | assert(wand->signature == WandSignature); |
| 562 | if (wand->debug != MagickFalse) |
| 563 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 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 | (void) GetImageProfile(wand->images,"exif:*"); |
| 571 | length=1024; |
| 572 | profiles=(char **) AcquireQuantumMemory(length,sizeof(*profiles)); |
| 573 | if (profiles == (char **) NULL) |
| 574 | return((char **) NULL); |
| 575 | ResetImageProfileIterator(wand->images); |
| 576 | property=GetNextImageProfile(wand->images); |
| 577 | for (i=0; property != (const char *) NULL; ) |
| 578 | { |
| 579 | if ((*property != '[') && |
| 580 | (GlobExpression(property,pattern,MagickFalse) != MagickFalse)) |
| 581 | { |
| 582 | if ((i+1) >= (long) length) |
| 583 | { |
| 584 | length<<=1; |
| 585 | profiles=(char **) ResizeQuantumMemory(profiles,length, |
| 586 | sizeof(*profiles)); |
| 587 | if (profiles == (char **) NULL) |
| 588 | { |
| 589 | (void) ThrowMagickException(wand->exception,GetMagickModule(), |
| 590 | ResourceLimitError,"MemoryAllocationFailed","`%s'", |
| 591 | wand->name); |
| 592 | return((char **) NULL); |
| 593 | } |
| 594 | } |
| 595 | profiles[i]=ConstantString(property); |
| 596 | i++; |
| 597 | } |
| 598 | property=GetNextImageProfile(wand->images); |
| 599 | } |
| 600 | profiles[i]=(char *) NULL; |
| 601 | *number_profiles=(unsigned long) i; |
| 602 | return(profiles); |
| 603 | } |
| 604 | |
| 605 | /* |
| 606 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 607 | % % |
| 608 | % % |
| 609 | % % |
| 610 | % M a g i c k G e t I m a g e P r o p e r t y % |
| 611 | % % |
| 612 | % % |
| 613 | % % |
| 614 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 615 | % |
| 616 | % MagickGetImageProperty() returns a value associated with the specified |
| 617 | % property. Use MagickRelinquishMemory() to free the value when you are |
| 618 | % finished with it. |
| 619 | % |
| 620 | % The format of the MagickGetImageProperty method is: |
| 621 | % |
| 622 | % char *MagickGetImageProperty(MagickWand *wand,const char *property) |
| 623 | % |
| 624 | % A description of each parameter follows: |
| 625 | % |
| 626 | % o wand: the magick wand. |
| 627 | % |
| 628 | % o property: the property. |
| 629 | % |
| 630 | */ |
| 631 | WandExport char *MagickGetImageProperty(MagickWand *wand,const char *property) |
| 632 | { |
| 633 | const char |
| 634 | *value; |
| 635 | |
| 636 | assert(wand != (MagickWand *) NULL); |
| 637 | assert(wand->signature == WandSignature); |
| 638 | if (wand->debug != MagickFalse) |
| 639 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 640 | if (wand->images == (Image *) NULL) |
| 641 | { |
| 642 | (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, |
| 643 | "ContainsNoImages","`%s'",wand->name); |
| 644 | return((char *) NULL); |
| 645 | } |
| 646 | value=GetImageProperty(wand->images,property); |
| 647 | if (value == (const char *) NULL) |
| 648 | return((char *) NULL); |
| 649 | return(ConstantString(value)); |
| 650 | } |
| 651 | |
| 652 | /* |
| 653 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 654 | % % |
| 655 | % % |
| 656 | % % |
| 657 | % M a g i c k G e t I m a g e P r o p e r t i e s % |
| 658 | % % |
| 659 | % % |
| 660 | % % |
| 661 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 662 | % |
| 663 | % MagickGetImageProperties() returns all the property names that match the |
| 664 | % specified pattern associated with a wand. Use MagickGetImageProperty() to |
| 665 | % return the value of a particular property. Use MagickRelinquishMemory() to |
| 666 | % free the value when you are finished with it. |
| 667 | % |
| 668 | % The format of the MagickGetImageProperties method is: |
| 669 | % |
| 670 | % char *MagickGetImageProperties(MagickWand *wand, |
| 671 | % const char *pattern,unsigned long *number_properties) |
| 672 | % |
| 673 | % A description of each parameter follows: |
| 674 | % |
| 675 | % o wand: the magick wand. |
| 676 | % |
| 677 | % o pattern: Specifies a pointer to a text string containing a pattern. |
| 678 | % |
| 679 | % o number_properties: the number properties associated with this wand. |
| 680 | % |
| 681 | */ |
| 682 | WandExport char **MagickGetImageProperties(MagickWand *wand, |
| 683 | const char *pattern,unsigned long *number_properties) |
| 684 | { |
| 685 | char |
| 686 | **properties; |
| 687 | |
| 688 | const char |
| 689 | *property; |
| 690 | |
| 691 | register long |
| 692 | i; |
| 693 | |
| 694 | size_t |
| 695 | length; |
| 696 | |
| 697 | assert(wand != (MagickWand *) NULL); |
| 698 | assert(wand->signature == WandSignature); |
| 699 | if (wand->debug != MagickFalse) |
| 700 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 701 | if (wand->images == (Image *) NULL) |
| 702 | { |
| 703 | (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, |
| 704 | "ContainsNoImages","`%s'",wand->name); |
| 705 | return((char **) NULL); |
| 706 | } |
| 707 | (void) GetImageProperty(wand->images,"exif:*"); |
| 708 | length=1024; |
| 709 | properties=(char **) AcquireQuantumMemory(length,sizeof(*properties)); |
| 710 | if (properties == (char **) NULL) |
| 711 | return((char **) NULL); |
| 712 | ResetImagePropertyIterator(wand->images); |
| 713 | property=GetNextImageProperty(wand->images); |
| 714 | for (i=0; property != (const char *) NULL; ) |
| 715 | { |
| 716 | if ((*property != '[') && |
| 717 | (GlobExpression(property,pattern,MagickFalse) != MagickFalse)) |
| 718 | { |
| 719 | if ((i+1) >= (long) length) |
| 720 | { |
| 721 | length<<=1; |
| 722 | properties=(char **) ResizeQuantumMemory(properties,length, |
| 723 | sizeof(*properties)); |
| 724 | if (properties == (char **) NULL) |
| 725 | { |
| 726 | (void) ThrowMagickException(wand->exception,GetMagickModule(), |
| 727 | ResourceLimitError,"MemoryAllocationFailed","`%s'", |
| 728 | wand->name); |
| 729 | return((char **) NULL); |
| 730 | } |
| 731 | } |
| 732 | properties[i]=ConstantString(property); |
| 733 | i++; |
| 734 | } |
| 735 | property=GetNextImageProperty(wand->images); |
| 736 | } |
| 737 | properties[i]=(char *) NULL; |
| 738 | *number_properties=(unsigned long) i; |
| 739 | return(properties); |
| 740 | } |
| 741 | |
| 742 | /* |
| 743 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 744 | % % |
| 745 | % % |
| 746 | % % |
| 747 | % M a g i c k G e t I n t e r l a c e S c h e m e % |
| 748 | % % |
| 749 | % % |
| 750 | % % |
| 751 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 752 | % |
| 753 | % MagickGetInterlaceScheme() gets the wand interlace scheme. |
| 754 | % |
| 755 | % The format of the MagickGetInterlaceScheme method is: |
| 756 | % |
| 757 | % InterlaceType MagickGetInterlaceScheme(MagickWand *wand) |
| 758 | % |
| 759 | % A description of each parameter follows: |
| 760 | % |
| 761 | % o wand: the magick wand. |
| 762 | % |
| 763 | */ |
| 764 | WandExport InterlaceType MagickGetInterlaceScheme(MagickWand *wand) |
| 765 | { |
| 766 | assert(wand != (MagickWand *) NULL); |
| 767 | assert(wand->signature == WandSignature); |
| 768 | if (wand->debug != MagickFalse) |
| 769 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 770 | return(wand->image_info->interlace); |
| 771 | } |
| 772 | |
| 773 | /* |
| 774 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 775 | % % |
| 776 | % % |
| 777 | % % |
| 778 | % 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 % |
| 779 | % % |
| 780 | % % |
| 781 | % % |
| 782 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 783 | % |
| 784 | % MagickGetInterpolateMethod() gets the wand compression. |
| 785 | % |
| 786 | % The format of the MagickGetInterpolateMethod method is: |
| 787 | % |
| 788 | % InterpolatePixelMethod MagickGetInterpolateMethod(MagickWand *wand) |
| 789 | % |
| 790 | % A description of each parameter follows: |
| 791 | % |
| 792 | % o wand: the magick wand. |
| 793 | % |
| 794 | */ |
| 795 | WandExport InterpolatePixelMethod MagickGetInterpolateMethod(MagickWand *wand) |
| 796 | { |
| 797 | const char |
| 798 | *option; |
| 799 | |
| 800 | InterpolatePixelMethod |
| 801 | method; |
| 802 | |
| 803 | assert(wand != (MagickWand *) NULL); |
| 804 | assert(wand->signature == WandSignature); |
| 805 | if (wand->debug != MagickFalse) |
| 806 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 807 | option=GetImageOption(wand->image_info,"interpolate"); |
| 808 | if (option == (const char *) NULL) |
| 809 | return(UndefinedInterpolatePixel); |
| 810 | method=(InterpolatePixelMethod) ParseMagickOption(MagickInterpolateOptions, |
| 811 | MagickFalse,option); |
| 812 | return(method); |
| 813 | } |
| 814 | |
| 815 | /* |
| 816 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 817 | % % |
| 818 | % % |
| 819 | % % |
| 820 | % M a g i c k G e t O p t i o n % |
| 821 | % % |
| 822 | % % |
| 823 | % % |
| 824 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 825 | % |
| 826 | % MagickGetOption() returns a value associated with a wand and the specified |
| 827 | % key. Use MagickRelinquishMemory() to free the value when you are finished |
| 828 | % with it. |
| 829 | % |
| 830 | % The format of the MagickGetOption method is: |
| 831 | % |
| 832 | % char *MagickGetOption(MagickWand *wand,const char *key) |
| 833 | % |
| 834 | % A description of each parameter follows: |
| 835 | % |
| 836 | % o wand: the magick wand. |
| 837 | % |
| 838 | % o key: the key. |
| 839 | % |
| 840 | */ |
| 841 | WandExport char *MagickGetOption(MagickWand *wand,const char *key) |
| 842 | { |
| 843 | const char |
| 844 | *option; |
| 845 | |
| 846 | assert(wand != (MagickWand *) NULL); |
| 847 | assert(wand->signature == WandSignature); |
| 848 | if (wand->debug != MagickFalse) |
| 849 | (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); |
| 850 | option=GetImageOption(wand->image_info,key); |
| 851 | return(ConstantString(option)); |
| 852 | } |
| 853 | |
| 854 | /* |
| 855 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 856 | % % |
| 857 | % % |
| 858 | % % |
| 859 | % M a g i c k G e t O p t i o n % |
| 860 | % % |
| 861 | % % |
| 862 | % % |
| 863 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 864 | % |
| 865 | % MagickGetOptions() returns all the option names that match the specified |
| 866 | % pattern associated with a wand. Use MagickGetOption() to return the value |
| 867 | % of a particular option. Use MagickRelinquishMemory() to free the value |
| 868 | % when you are finished with it. |
| 869 | % |
| 870 | % The format of the MagickGetOptions method is: |
| 871 | % |
| 872 |
