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 % IIIII M M AAA GGGG EEEEE % 13 % I MM MM A A G E % 14 % I M M M AAAAA G GG EEE % 15 % I M M A A G G E % 16 % IIIII M M A A GGGG EEEEE % 17 % % 18 % % 19 % MagickWand Image Methods % 20 % % 21 % Software Design % 22 % Cristy % 23 % August 2003 % 24 % % 25 % % 26 % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization % 27 % dedicated to making software imaging solutions freely available. % 28 % % 29 % You may not use this file except in compliance with the License. You may % 30 % obtain a copy of the License at % 31 % % 32 % https://imagemagick.org/script/license.php % 33 % % 34 % Unless required by applicable law or agreed to in writing, software % 35 % distributed under the License is distributed on an "AS IS" BASIS, % 36 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % 37 % See the License for the specific language governing permissions and % 38 % limitations under the License. % 39 % % 40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 41 % 42 % 43 % 44 */ 45 46 /* 48 Include declarations. 49 */ 50 #include "MagickWand/studio.h" 51 #include "MagickWand/MagickWand.h" 52 #include "MagickWand/magick-wand-private.h" 53 #include "MagickWand/wand.h" 54 #include "MagickWand/pixel-wand-private.h" 55 #include "MagickCore/image-private.h" 56 57 /* 59 Define declarations. 60 */ 61 #define MagickWandId "MagickWand" 62 63 /* 65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66 % % 67 % % 68 % % 69 + C l o n e M a g i c k W a n d F r o m I m a g e s % 70 % % 71 % % 72 % % 73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 74 % 75 % CloneMagickWandFromImages() clones the magick wand and inserts a new image 76 % list. 77 % 78 % The format of the CloneMagickWandFromImages method is: 79 % 80 % MagickWand *CloneMagickWandFromImages(const MagickWand *wand, 81 % Image *images) 82 % 83 % A description of each parameter follows: 84 % 85 % o wand: the magick wand. 86 % 87 % o images: replace the image list with these image(s). 88 % 89 */ 90 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand, 91 Image *images) 92 { 93 MagickWand 94 *clone_wand; 95 96 assert(wand != (MagickWand *) NULL); 97 assert(wand->signature == MagickWandSignature); 98 if (wand->debug != MagickFalse) 99 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 100 clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand)); 101 if (clone_wand == (MagickWand *) NULL) 102 ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", 103 images->filename); 104 (void) memset(clone_wand,0,sizeof(*clone_wand)); 105 clone_wand->id=AcquireWandId(); 106 (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g", 107 MagickWandId,(double) clone_wand->id); 108 clone_wand->exception=AcquireExceptionInfo(); 109 InheritException(clone_wand->exception,wand->exception); 110 clone_wand->image_info=CloneImageInfo(wand->image_info); 111 clone_wand->images=images; 112 clone_wand->debug=IsEventLogging(); 113 clone_wand->signature=MagickWandSignature; 114 if (clone_wand->debug != MagickFalse) 115 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name); 116 return(clone_wand); 117 } 118 119 /* 121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 122 % % 123 % % 124 % % 125 % G e t I m a g e F r o m M a g i c k W a n d % 126 % % 127 % % 128 % % 129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 130 % 131 % GetImageFromMagickWand() returns the current image from the magick wand. 132 % 133 % The format of the GetImageFromMagickWand method is: 134 % 135 % Image *GetImageFromMagickWand(const MagickWand *wand) 136 % 137 % A description of each parameter follows: 138 % 139 % o wand: the magick wand. 140 % 141 */ 142 WandExport Image *GetImageFromMagickWand(const MagickWand *wand) 143 { 144 assert(wand != (MagickWand *) NULL); 145 assert(wand->signature == MagickWandSignature); 146 if (wand->debug != MagickFalse) 147 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 148 if (wand->images == (Image *) NULL) 149 { 150 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 151 "ContainsNoImages","`%s'",wand->name); 152 return((Image *) NULL); 153 } 154 return(wand->images); 155 } 156 157 /* 159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 160 % % 161 % % 162 % % 163 % M a g i c k A d a p t i v e S h a r p e n I m a g e % 164 % % 165 % % 166 % % 167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 168 % 169 % MagickAdaptiveBlurImage() adaptively blurs the image by blurring 170 % less intensely near image edges and more intensely far from edges. We 171 % blur the image with a Gaussian operator of the given radius and standard 172 % deviation (sigma). For reasonable results, radius should be larger than 173 % sigma. Use a radius of 0 and MagickAdaptiveBlurImage() selects a 174 % suitable radius for you. 175 % 176 % The format of the MagickAdaptiveBlurImage method is: 177 % 178 % MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand, 179 % const double radius,const double sigma) 180 % 181 % A description of each parameter follows: 182 % 183 % o wand: the magick wand. 184 % 185 % o radius: the radius of the Gaussian, in pixels, not counting the center 186 % pixel. 187 % 188 % o sigma: the standard deviation of the Gaussian, in pixels. 189 % 190 */ 191 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand, 192 const double radius,const double sigma) 193 { 194 Image 195 *sharp_image; 196 197 assert(wand != (MagickWand *) NULL); 198 assert(wand->signature == MagickWandSignature); 199 if (wand->debug != MagickFalse) 200 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 201 if (wand->images == (Image *) NULL) 202 ThrowWandException(WandError,"ContainsNoImages",wand->name); 203 sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception); 204 if (sharp_image == (Image *) NULL) 205 return(MagickFalse); 206 ReplaceImageInList(&wand->images,sharp_image); 207 return(MagickTrue); 208 } 209 210 /* 212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 213 % % 214 % % 215 % % 216 % M a g i c k A d a p t i v e R e s i z e I m a g e % 217 % % 218 % % 219 % % 220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 221 % 222 % MagickAdaptiveResizeImage() adaptively resize image with data dependent 223 % triangulation. 224 % 225 % MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand, 226 % const size_t columns,const size_t rows) 227 % 228 % A description of each parameter follows: 229 % 230 % o wand: the magick wand. 231 % 232 % o columns: the number of columns in the scaled image. 233 % 234 % o rows: the number of rows in the scaled image. 235 % 236 */ 237 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand, 238 const size_t columns,const size_t rows) 239 { 240 Image 241 *resize_image; 242 243 assert(wand != (MagickWand *) NULL); 244 assert(wand->signature == MagickWandSignature); 245 if (wand->debug != MagickFalse) 246 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 247 if (wand->images == (Image *) NULL) 248 ThrowWandException(WandError,"ContainsNoImages",wand->name); 249 resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception); 250 if (resize_image == (Image *) NULL) 251 return(MagickFalse); 252 ReplaceImageInList(&wand->images,resize_image); 253 return(MagickTrue); 254 } 255 256 /* 258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 259 % % 260 % % 261 % % 262 % M a g i c k A d a p t i v e S h a r p e n I m a g e % 263 % % 264 % % 265 % % 266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 267 % 268 % MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening 269 % more intensely near image edges and less intensely far from edges. We 270 % sharpen the image with a Gaussian operator of the given radius and standard 271 % deviation (sigma). For reasonable results, radius should be larger than 272 % sigma. Use a radius of 0 and MagickAdaptiveSharpenImage() selects a 273 % suitable radius for you. 274 % 275 % The format of the MagickAdaptiveSharpenImage method is: 276 % 277 % MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand, 278 % const double radius,const double sigma) 279 % 280 % A description of each parameter follows: 281 % 282 % o wand: the magick wand. 283 % 284 % o radius: the radius of the Gaussian, in pixels, not counting the center 285 % pixel. 286 % 287 % o sigma: the standard deviation of the Gaussian, in pixels. 288 % 289 */ 290 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand, 291 const double radius,const double sigma) 292 { 293 Image 294 *sharp_image; 295 296 assert(wand != (MagickWand *) NULL); 297 assert(wand->signature == MagickWandSignature); 298 if (wand->debug != MagickFalse) 299 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 300 if (wand->images == (Image *) NULL) 301 ThrowWandException(WandError,"ContainsNoImages",wand->name); 302 sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception); 303 if (sharp_image == (Image *) NULL) 304 return(MagickFalse); 305 ReplaceImageInList(&wand->images,sharp_image); 306 return(MagickTrue); 307 } 308 309 /* 311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 312 % % 313 % % 314 % % 315 % M a g i c k A d a p t i v e T h r e s h o l d I m a g e % 316 % % 317 % % 318 % % 319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 320 % 321 % MagickAdaptiveThresholdImage() selects an individual threshold for each pixel 322 % based on the range of intensity values in its local neighborhood. This 323 % allows for thresholding of an image whose global intensity histogram 324 % doesn't contain distinctive peaks. 325 % 326 % The format of the AdaptiveThresholdImage method is: 327 % 328 % MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand, 329 % const size_t width,const size_t height,const double bias) 330 % 331 % A description of each parameter follows: 332 % 333 % o wand: the magick wand. 334 % 335 % o width: the width of the local neighborhood. 336 % 337 % o height: the height of the local neighborhood. 338 % 339 % o offset: the mean bias. 340 % 341 */ 342 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand, 343 const size_t width,const size_t height,const double bias) 344 { 345 Image 346 *threshold_image; 347 348 assert(wand != (MagickWand *) NULL); 349 assert(wand->signature == MagickWandSignature); 350 if (wand->debug != MagickFalse) 351 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 352 if (wand->images == (Image *) NULL) 353 ThrowWandException(WandError,"ContainsNoImages",wand->name); 354 threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias, 355 wand->exception); 356 if (threshold_image == (Image *) NULL) 357 return(MagickFalse); 358 ReplaceImageInList(&wand->images,threshold_image); 359 return(MagickTrue); 360 } 361 362 /* 364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 365 % % 366 % % 367 % % 368 % M a g i c k A d d I m a g e % 369 % % 370 % % 371 % % 372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 373 % 374 % MagickAddImage() adds a clone of the images from the second wand and 375 % inserts them into the first wand. 376 % 377 % Use MagickSetLastIterator(), to append new images into an existing wand, 378 % current image will be set to last image so later adds with also be 379 % appened to end of wand. 380 % 381 % Use MagickSetFirstIterator() to prepend new images into wand, any more 382 % images added will also be prepended before other images in the wand. 383 % However the order of a list of new images will not change. 384 % 385 % Otherwise the new images will be inserted just after the current image, 386 % and any later image will also be added after this current image but 387 % before the previously added images. Caution is advised when multiple 388 % image adds are inserted into the middle of the wand image list. 389 % 390 % The format of the MagickAddImage method is: 391 % 392 % MagickBooleanType MagickAddImage(MagickWand *wand, 393 % const MagickWand *add_wand) 394 % 395 % A description of each parameter follows: 396 % 397 % o wand: the magick wand. 398 % 399 % o add_wand: A wand that contains the image list to be added 400 % 401 */ 402 static inline MagickBooleanType InsertImageInWand(MagickWand *wand, 403 Image *images) 404 { 405 if (wand->images == (Image *) NULL) 406 { 407 /* 408 No images in wand, just add them, set current as appropriate. 409 */ 410 if (wand->insert_before != MagickFalse) 411 wand->images=GetFirstImageInList(images); 412 else 413 wand->images=GetLastImageInList(images); 414 return(MagickTrue); 415 } 416 /* user jumped to first image, so prepend new images - remain active */ 417 if ((wand->insert_before != MagickFalse) && 418 (wand->images->previous == (Image *) NULL)) 419 { 420 PrependImageToList(&wand->images,images); 421 wand->images=GetFirstImageInList(images); 422 return(MagickTrue); 423 } 424 /* 425 Note you should never have 'insert_before' true when current image is not 426 the first image in the wand! That is no insert before current image, only 427 after current image 428 */ 429 if (wand->images->next == (Image *) NULL) 430 { 431 /* 432 At last image, append new images. 433 */ 434 InsertImageInList(&wand->images,images); 435 wand->images=GetLastImageInList(images); 436 return(MagickTrue); 437 } 438 /* 439 Insert new images, just after the current image. 440 */ 441 InsertImageInList(&wand->images,images); 442 return(MagickTrue); 443 } 444 445 WandExport MagickBooleanType MagickAddImage(MagickWand *wand, 446 const MagickWand *add_wand) 447 { 448 Image 449 *images; 450 451 assert(wand != (MagickWand *) NULL); 452 assert(wand->signature == MagickWandSignature); 453 if (wand->debug != MagickFalse) 454 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 455 assert(add_wand != (MagickWand *) NULL); 456 assert(add_wand->signature == MagickWandSignature); 457 if (add_wand->images == (Image *) NULL) 458 ThrowWandException(WandError,"ContainsNoImages",add_wand->name); 459 /* 460 Clone images in second wand, and insert into first. 461 */ 462 images=CloneImageList(add_wand->images,wand->exception); 463 if (images == (Image *) NULL) 464 return(MagickFalse); 465 return(InsertImageInWand(wand,images)); 466 } 467 468 /* 470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 471 % % 472 % % 473 % % 474 % M a g i c k A d d N o i s e I m a g e % 475 % % 476 % % 477 % % 478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 479 % 480 % MagickAddNoiseImage() adds random noise to the image. 481 % 482 % The format of the MagickAddNoiseImage method is: 483 % 484 % MagickBooleanType MagickAddNoiseImage(MagickWand *wand, 485 % const NoiseType noise_type,const double attenuate) 486 % 487 % A description of each parameter follows: 488 % 489 % o wand: the magick wand. 490 % 491 % o noise_type: The type of noise: Uniform, Gaussian, Multiplicative, 492 % Impulse, Laplacian, or Poisson. 493 % 494 % o attenuate: attenuate the random distribution. 495 % 496 */ 497 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand, 498 const NoiseType noise_type,const double attenuate) 499 { 500 Image 501 *noise_image; 502 503 assert(wand != (MagickWand *) NULL); 504 assert(wand->signature == MagickWandSignature); 505 if (wand->debug != MagickFalse) 506 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 507 if (wand->images == (Image *) NULL) 508 ThrowWandException(WandError,"ContainsNoImages",wand->name); 509 noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception); 510 if (noise_image == (Image *) NULL) 511 return(MagickFalse); 512 ReplaceImageInList(&wand->images,noise_image); 513 return(MagickTrue); 514 } 515 516 /* 518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 519 % % 520 % % 521 % % 522 % M a g i c k A f f i n e T r a n s f o r m I m a g e % 523 % % 524 % % 525 % % 526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 527 % 528 % MagickAffineTransformImage() transforms an image as dictated by the affine 529 % matrix of the drawing wand. 530 % 531 % The format of the MagickAffineTransformImage method is: 532 % 533 % MagickBooleanType MagickAffineTransformImage(MagickWand *wand, 534 % const DrawingWand *drawing_wand) 535 % 536 % A description of each parameter follows: 537 % 538 % o wand: the magick wand. 539 % 540 % o drawing_wand: the draw wand. 541 % 542 */ 543 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand, 544 const DrawingWand *drawing_wand) 545 { 546 DrawInfo 547 *draw_info; 548 549 Image 550 *affine_image; 551 552 assert(wand != (MagickWand *) NULL); 553 assert(wand->signature == MagickWandSignature); 554 if (wand->debug != MagickFalse) 555 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 556 if (wand->images == (Image *) NULL) 557 ThrowWandException(WandError,"ContainsNoImages",wand->name); 558 draw_info=PeekDrawingWand(drawing_wand); 559 if (draw_info == (DrawInfo *) NULL) 560 return(MagickFalse); 561 affine_image=AffineTransformImage(wand->images,&draw_info->affine, 562 wand->exception); 563 draw_info=DestroyDrawInfo(draw_info); 564 if (affine_image == (Image *) NULL) 565 return(MagickFalse); 566 ReplaceImageInList(&wand->images,affine_image); 567 return(MagickTrue); 568 } 569 570 /* 572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 573 % % 574 % % 575 % % 576 % M a g i c k A n n o t a t e I m a g e % 577 % % 578 % % 579 % % 580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 581 % 582 % MagickAnnotateImage() annotates an image with text. 583 % 584 % The format of the MagickAnnotateImage method is: 585 % 586 % MagickBooleanType MagickAnnotateImage(MagickWand *wand, 587 % const DrawingWand *drawing_wand,const double x,const double y, 588 % const double angle,const char *text) 589 % 590 % A description of each parameter follows: 591 % 592 % o wand: the magick wand. 593 % 594 % o drawing_wand: the draw wand. 595 % 596 % o x: x ordinate to left of text 597 % 598 % o y: y ordinate to text baseline 599 % 600 % o angle: rotate text relative to this angle. 601 % 602 % o text: text to draw 603 % 604 */ 605 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand, 606 const DrawingWand *drawing_wand,const double x,const double y, 607 const double angle,const char *text) 608 { 609 char 610 geometry[MagickPathExtent]; 611 612 DrawInfo 613 *draw_info; 614 615 MagickBooleanType 616 status; 617 618 assert(wand != (MagickWand *) NULL); 619 assert(wand->signature == MagickWandSignature); 620 if (wand->debug != MagickFalse) 621 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 622 if (wand->images == (Image *) NULL) 623 ThrowWandException(WandError,"ContainsNoImages",wand->name); 624 draw_info=PeekDrawingWand(drawing_wand); 625 if (draw_info == (DrawInfo *) NULL) 626 return(MagickFalse); 627 (void) CloneString(&draw_info->text,text); 628 (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y); 629 draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0))); 630 draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0))); 631 draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0)))); 632 draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0))); 633 (void) CloneString(&draw_info->geometry,geometry); 634 status=AnnotateImage(wand->images,draw_info,wand->exception); 635 draw_info=DestroyDrawInfo(draw_info); 636 return(status); 637 } 638 639 /* 641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 642 % % 643 % % 644 % % 645 % M a g i c k A n i m a t e I m a g e s % 646 % % 647 % % 648 % % 649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 650 % 651 % MagickAnimateImages() animates an image or image sequence. 652 % 653 % The format of the MagickAnimateImages method is: 654 % 655 % MagickBooleanType MagickAnimateImages(MagickWand *wand, 656 % const char *server_name) 657 % 658 % A description of each parameter follows: 659 % 660 % o wand: the magick wand. 661 % 662 % o server_name: the X server name. 663 % 664 */ 665 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand, 666 const char *server_name) 667 { 668 MagickBooleanType 669 status; 670 671 assert(wand != (MagickWand *) NULL); 672 assert(wand->signature == MagickWandSignature); 673 if (wand->debug != MagickFalse) 674 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 675 (void) CloneString(&wand->image_info->server_name,server_name); 676 status=AnimateImages(wand->image_info,wand->images,wand->exception); 677 return(status); 678 } 679 680 /* 682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 683 % % 684 % % 685 % % 686 % M a g i c k A p p e n d I m a g e s % 687 % % 688 % % 689 % % 690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 691 % 692 % MagickAppendImages() append the images in a wand from the current image 693 % onwards, creating a new wand with the single image result. This is 694 % affected by the gravity and background settings of the first image. 695 % 696 % Typically you would call either MagickResetIterator() or 697 % MagickSetFirstImage() before calling this function to ensure that all 698 % the images in the wand's image list will be appended together. 699 % 700 % The format of the MagickAppendImages method is: 701 % 702 % MagickWand *MagickAppendImages(MagickWand *wand, 703 % const MagickBooleanType stack) 704 % 705 % A description of each parameter follows: 706 % 707 % o wand: the magick wand. 708 % 709 % o stack: By default, images are stacked left-to-right. Set stack to 710 % MagickTrue to stack them top-to-bottom. 711 % 712 */ 713 WandExport MagickWand *MagickAppendImages(MagickWand *wand, 714 const MagickBooleanType stack) 715 { 716 Image 717 *append_image; 718 719 assert(wand != (MagickWand *) NULL); 720 assert(wand->signature == MagickWandSignature); 721 if (wand->debug != MagickFalse) 722 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 723 if (wand->images == (Image *) NULL) 724 return((MagickWand *) NULL); 725 append_image=AppendImages(wand->images,stack,wand->exception); 726 if (append_image == (Image *) NULL) 727 return((MagickWand *) NULL); 728 return(CloneMagickWandFromImages(wand,append_image)); 729 } 730 731 /* 733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 734 % % 735 % % 736 % % 737 % M a g i c k A u t o G a m m a I m a g e % 738 % % 739 % % 740 % % 741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 742 % 743 % MagickAutoGammaImage() extracts the 'mean' from the image and adjust the 744 % image to try make set its gamma appropriatally. 745 % 746 % The format of the MagickAutoGammaImage method is: 747 % 748 % MagickBooleanType MagickAutoGammaImage(MagickWand *wand) 749 % 750 % A description of each parameter follows: 751 % 752 % o wand: the magick wand. 753 % 754 */ 755 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand) 756 { 757 MagickBooleanType 758 status; 759 760 assert(wand != (MagickWand *) NULL); 761 assert(wand->signature == MagickWandSignature); 762 if (wand->debug != MagickFalse) 763 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 764 if (wand->images == (Image *) NULL) 765 ThrowWandException(WandError,"ContainsNoImages",wand->name); 766 status=AutoGammaImage(wand->images,wand->exception); 767 return(status); 768 } 769 770 /* 772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 773 % % 774 % % 775 % % 776 % M a g i c k A u t o L e v e l I m a g e % 777 % % 778 % % 779 % % 780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 781 % 782 % MagickAutoLevelImage() adjusts the levels of a particular image channel by 783 % scaling the minimum and maximum values to the full quantum range. 784 % 785 % The format of the MagickAutoLevelImage method is: 786 % 787 % MagickBooleanType MagickAutoLevelImage(MagickWand *wand) 788 % 789 % A description of each parameter follows: 790 % 791 % o wand: the magick wand. 792 % 793 */ 794 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand) 795 { 796 MagickBooleanType 797 status; 798 799 assert(wand != (MagickWand *) NULL); 800 assert(wand->signature == MagickWandSignature); 801 if (wand->debug != MagickFalse) 802 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 803 if (wand->images == (Image *) NULL) 804 ThrowWandException(WandError,"ContainsNoImages",wand->name); 805 status=AutoLevelImage(wand->images,wand->exception); 806 return(status); 807 } 808 809 /* 810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 811 % % 812 % % 813 % % 814 % M a g i c k A u t o O r i e n t I m a g e % 815 % % 816 % % 817 % % 818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 819 % 820 % MagickAutoOrientImage() adjusts an image so that its orientation is suitable 821 $ for viewing (i.e. top-left orientation). 822 % 823 % The format of the MagickAutoOrientImage method is: 824 % 825 % MagickBooleanType MagickAutoOrientImage(MagickWand *image) 826 % 827 % A description of each parameter follows: 828 % 829 % o wand: the magick wand. 830 % 831 */ 832 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand) 833 { 834 835 Image 836 *orient_image; 837 838 assert(wand != (MagickWand *) NULL); 839 assert(wand->signature == MagickWandSignature); 840 if (wand->debug != MagickFalse) 841 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 842 if (wand->images == (Image *) NULL) 843 ThrowWandException(WandError,"ContainsNoImages",wand->name); 844 orient_image=AutoOrientImage(wand->images,wand->images->orientation, 845 wand->exception); 846 if (orient_image == (Image *) NULL) 847 return(MagickFalse); 848 ReplaceImageInList(&wand->images,orient_image); 849 return(MagickTrue); 850 } 851 852 /* 854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 855 % % 856 % % 857 % % 858 % M a g i c k B l a c k T h r e s h o l d I m a g e % 859 % % 860 % % 861 % % 862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 863 % 864 % MagickBlackThresholdImage() is like MagickThresholdImage() but forces all 865 % pixels below the threshold into black while leaving all pixels above the 866 % threshold unchanged. 867 % 868 % The format of the MagickBlackThresholdImage method is: 869 % 870 % MagickBooleanType MagickBlackThresholdImage(MagickWand *wand, 871 % const PixelWand *threshold) 872 % 873 % A description of each parameter follows: 874 % 875 % o wand: the magick wand. 876 % 877 % o threshold: the pixel wand. 878 % 879 */ 880 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand, 881 const PixelWand *threshold) 882 { 883 char 884 thresholds[MagickPathExtent]; 885 886 MagickBooleanType 887 status; 888 889 assert(wand != (MagickWand *) NULL); 890 assert(wand->signature == MagickWandSignature); 891 if (wand->debug != MagickFalse) 892 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 893 if (wand->images == (Image *) NULL) 894 ThrowWandException(WandError,"ContainsNoImages",wand->name); 895 (void) FormatLocaleString(thresholds,MagickPathExtent, 896 QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat, 897 PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold), 898 PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold)); 899 status=BlackThresholdImage(wand->images,thresholds,wand->exception); 900 return(status); 901 } 902 903 /* 905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 906 % % 907 % % 908 % % 909 % M a g i c k B l u e S h i f t I m a g e % 910 % % 911 % % 912 % % 913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 914 % 915 % MagickBlueShiftImage() mutes the colors of the image to simulate a scene at 916 % nighttime in the moonlight. 917 % 918 % The format of the MagickBlueShiftImage method is: 919 % 920 % MagickBooleanType MagickBlueShiftImage(MagickWand *wand, 921 % const double factor) 922 % 923 % A description of each parameter follows: 924 % 925 % o wand: the magick wand. 926 % 927 % o factor: the blue shift factor (default 1.5) 928 % 929 */ 930 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand, 931 const double factor) 932 { 933 Image 934 *shift_image; 935 936 assert(wand != (MagickWand *) NULL); 937 assert(wand->signature == MagickWandSignature); 938 if (wand->debug != MagickFalse) 939 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 940 if (wand->images == (Image *) NULL) 941 ThrowWandException(WandError,"ContainsNoImages",wand->name); 942 shift_image=BlueShiftImage(wand->images,factor,wand->exception); 943 if (shift_image == (Image *) NULL) 944 return(MagickFalse); 945 ReplaceImageInList(&wand->images,shift_image); 946 return(MagickTrue); 947 } 948 949 /* 951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 952 % % 953 % % 954 % % 955 % M a g i c k B l u r I m a g e % 956 % % 957 % % 958 % % 959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 960 % 961 % MagickBlurImage() blurs an image. We convolve the image with a 962 % gaussian operator of the given radius and standard deviation (sigma). 963 % For reasonable results, the radius should be larger than sigma. Use a 964 % radius of 0 and BlurImage() selects a suitable radius for you. 965 % 966 % The format of the MagickBlurImage method is: 967 % 968 % MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius, 969 % const double sigma) 970 % 971 % A description of each parameter follows: 972 % 973 % o wand: the magick wand. 974 % 975 % o radius: the radius of the , in pixels, not counting the center 976 % pixel. 977 % 978 % o sigma: the standard deviation of the , in pixels. 979 % 980 */ 981 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand, 982 const double radius,const double sigma) 983 { 984 Image 985 *blur_image; 986 987 assert(wand != (MagickWand *) NULL); 988 assert(wand->signature == MagickWandSignature); 989 if (wand->debug != MagickFalse) 990 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 991 if (wand->images == (Image *) NULL) 992 ThrowWandException(WandError,"ContainsNoImages",wand->name); 993 blur_image=BlurImage(wand->images,radius,sigma,wand->exception); 994 if (blur_image == (Image *) NULL) 995 return(MagickFalse); 996 ReplaceImageInList(&wand->images,blur_image); 997 return(MagickTrue); 998 } 999 1000 /* 1002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1003 % % 1004 % % 1005 % % 1006 % M a g i c k B o r d e r I m a g e % 1007 % % 1008 % % 1009 % % 1010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1011 % 1012 % MagickBorderImage() surrounds the image with a border of the color defined 1013 % by the bordercolor pixel wand. 1014 % 1015 % The format of the MagickBorderImage method is: 1016 % 1017 % MagickBooleanType MagickBorderImage(MagickWand *wand, 1018 % const PixelWand *bordercolor,const size_t width, 1019 % const size_t height,const CompositeOperator compose) 1020 % 1021 % A description of each parameter follows: 1022 % 1023 % o wand: the magick wand. 1024 % 1025 % o bordercolor: the border color pixel wand. 1026 % 1027 % o width: the border width. 1028 % 1029 % o height: the border height. 1030 % 1031 % o compose: the composite operator. 1032 % 1033 */ 1034 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand, 1035 const PixelWand *bordercolor,const size_t width,const size_t height, 1036 const CompositeOperator compose) 1037 { 1038 Image 1039 *border_image; 1040 1041 RectangleInfo 1042 border_info; 1043 1044 assert(wand != (MagickWand *) NULL); 1045 assert(wand->signature == MagickWandSignature); 1046 if (wand->debug != MagickFalse) 1047 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1048 if (wand->images == (Image *) NULL) 1049 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1050 border_info.width=width; 1051 border_info.height=height; 1052 border_info.x=0; 1053 border_info.y=0; 1054 PixelGetQuantumPacket(bordercolor,&wand->images->border_color); 1055 border_image=BorderImage(wand->images,&border_info,compose,wand->exception); 1056 if (border_image == (Image *) NULL) 1057 return(MagickFalse); 1058 ReplaceImageInList(&wand->images,border_image); 1059 return(MagickTrue); 1060 } 1061 1062 /* 1064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1065 % % 1066 % % 1067 % % 1068 % M a g i c k B r i g h t n e s s C o n t r a s t S t r e t c h I m a g e % 1069 % % 1070 % % 1071 % % 1072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1073 % 1074 % Use MagickBrightnessContrastImage() to change the brightness and/or contrast 1075 % of an image. It converts the brightness and contrast parameters into slope 1076 % and intercept and calls a polynomical function to apply to the image. 1077 1078 % 1079 % The format of the MagickBrightnessContrastImage method is: 1080 % 1081 % MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand, 1082 % const double brightness,const double contrast) 1083 % 1084 % A description of each parameter follows: 1085 % 1086 % o wand: the magick wand. 1087 % 1088 % o brightness: the brightness percent (-100 .. 100). 1089 % 1090 % o contrast: the contrast percent (-100 .. 100). 1091 % 1092 */ 1093 WandExport MagickBooleanType MagickBrightnessContrastImage( 1094 MagickWand *wand,const double brightness,const double contrast) 1095 { 1096 MagickBooleanType 1097 status; 1098 1099 assert(wand != (MagickWand *) NULL); 1100 assert(wand->signature == MagickWandSignature); 1101 if (wand->debug != MagickFalse) 1102 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1103 if (wand->images == (Image *) NULL) 1104 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1105 status=BrightnessContrastImage(wand->images,brightness,contrast, 1106 wand->exception); 1107 return(status); 1108 } 1109 1110 /* 1112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1113 % % 1114 % % 1115 % % 1116 % M a g i c k C h a n n e l F x I m a g e % 1117 % % 1118 % % 1119 % % 1120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1121 % 1122 % MagickChannelFxImage() applies a channel expression to the specified image. 1123 % The expression consists of one or more channels, either mnemonic or numeric 1124 % (e.g. red, 1), separated by actions as follows: 1125 % 1126 % <=> exchange two channels (e.g. red<=>blue) 1127 % => transfer a channel to another (e.g. red=>green) 1128 % , separate channel operations (e.g. red, green) 1129 % | read channels from next input image (e.g. red | green) 1130 % ; write channels to next output image (e.g. red; green; blue) 1131 % 1132 % A channel without a operation symbol implies extract. For example, to create 1133 % 3 grayscale images from the red, green, and blue channels of an image, use: 1134 % 1135 % -channel-fx "red; green; blue" 1136 % 1137 % The format of the MagickChannelFxImage method is: 1138 % 1139 % MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression) 1140 % 1141 % A description of each parameter follows: 1142 % 1143 % o wand: the magick wand. 1144 % 1145 % o expression: the expression. 1146 % 1147 */ 1148 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand, 1149 const char *expression) 1150 { 1151 Image 1152 *fx_image; 1153 1154 assert(wand != (MagickWand *) NULL); 1155 assert(wand->signature == MagickWandSignature); 1156 if (wand->debug != MagickFalse) 1157 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1158 if (wand->images == (Image *) NULL) 1159 return((MagickWand *) NULL); 1160 fx_image=ChannelFxImage(wand->images,expression,wand->exception); 1161 if (fx_image == (Image *) NULL) 1162 return((MagickWand *) NULL); 1163 return(CloneMagickWandFromImages(wand,fx_image)); 1164 } 1165 1166 /* 1168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1169 % % 1170 % % 1171 % % 1172 % M a g i c k C h a r c o a l I m a g e % 1173 % % 1174 % % 1175 % % 1176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1177 % 1178 % MagickCharcoalImage() simulates a charcoal drawing. 1179 % 1180 % The format of the MagickCharcoalImage method is: 1181 % 1182 % MagickBooleanType MagickCharcoalImage(MagickWand *wand, 1183 % const double radius,const double sigma) 1184 % 1185 % A description of each parameter follows: 1186 % 1187 % o wand: the magick wand. 1188 % 1189 % o radius: the radius of the Gaussian, in pixels, not counting the center 1190 % pixel. 1191 % 1192 % o sigma: the standard deviation of the Gaussian, in pixels. 1193 % 1194 */ 1195 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand, 1196 const double radius,const double sigma) 1197 { 1198 Image 1199 *charcoal_image; 1200 1201 assert(wand != (MagickWand *) NULL); 1202 assert(wand->signature == MagickWandSignature); 1203 if (wand->debug != MagickFalse) 1204 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1205 if (wand->images == (Image *) NULL) 1206 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1207 charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception); 1208 if (charcoal_image == (Image *) NULL) 1209 return(MagickFalse); 1210 ReplaceImageInList(&wand->images,charcoal_image); 1211 return(MagickTrue); 1212 } 1213 1214 /* 1216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1217 % % 1218 % % 1219 % % 1220 % M a g i c k C h o p I m a g e % 1221 % % 1222 % % 1223 % % 1224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1225 % 1226 % MagickChopImage() removes a region of an image and collapses the image to 1227 % occupy the removed portion 1228 % 1229 % The format of the MagickChopImage method is: 1230 % 1231 % MagickBooleanType MagickChopImage(MagickWand *wand, 1232 % const size_t width,const size_t height,const ssize_t x, 1233 % const ssize_t y) 1234 % 1235 % A description of each parameter follows: 1236 % 1237 % o wand: the magick wand. 1238 % 1239 % o width: the region width. 1240 % 1241 % o height: the region height. 1242 % 1243 % o x: the region x offset. 1244 % 1245 % o y: the region y offset. 1246 % 1247 % 1248 */ 1249 WandExport MagickBooleanType MagickChopImage(MagickWand *wand, 1250 const size_t width,const size_t height,const ssize_t x, 1251 const ssize_t y) 1252 { 1253 Image 1254 *chop_image; 1255 1256 RectangleInfo 1257 chop; 1258 1259 assert(wand != (MagickWand *) NULL); 1260 assert(wand->signature == MagickWandSignature); 1261 if (wand->debug != MagickFalse) 1262 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1263 if (wand->images == (Image *) NULL) 1264 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1265 chop.width=width; 1266 chop.height=height; 1267 chop.x=x; 1268 chop.y=y; 1269 chop_image=ChopImage(wand->images,&chop,wand->exception); 1270 if (chop_image == (Image *) NULL) 1271 return(MagickFalse); 1272 ReplaceImageInList(&wand->images,chop_image); 1273 return(MagickTrue); 1274 } 1275 1276 /* 1278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1279 % % 1280 % % 1281 % % 1282 % M a g i c k C L A H E I m a g e % 1283 % % 1284 % % 1285 % % 1286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1287 % 1288 % MagickCLAHEImage() selects an individual threshold for each pixel 1289 % based on the range of intensity values in its local neighborhood. This 1290 % allows for thresholding of an image whose global intensity histogram 1291 % doesn't contain distinctive peaks. 1292 % 1293 % The format of the CLAHEImage method is: 1294 % 1295 % MagickBooleanType MagickCLAHEImage(MagickWand *wand,const size_t width, 1296 % const size_t height,const double bias,const double sans) 1297 % 1298 % A description of each parameter follows: 1299 % 1300 % o wand: the magick wand. 1301 % 1302 % o width: the width of the local neighborhood. 1303 % 1304 % o height: the height of the local neighborhood. 1305 % 1306 % o offset: the mean bias. 1307 % 1308 % o sans: not used. 1309 % 1310 */ 1311 WandExport MagickBooleanType MagickCLAHEImage(MagickWand *wand, 1312 const size_t width,const size_t height,const double bias,const double sans) 1313 { 1314 MagickBooleanType 1315 status; 1316 1317 assert(wand != (MagickWand *) NULL); 1318 assert(wand->signature == MagickWandSignature); 1319 if (wand->debug != MagickFalse) 1320 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1321 if (wand->images == (Image *) NULL) 1322 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1323 status=CLAHEImage(wand->images,width,height,bias,sans,wand->exception); 1324 return(status); 1325 } 1326 1327 /* 1329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1330 % % 1331 % % 1332 % % 1333 % M a g i c k C l a m p I m a g e % 1334 % % 1335 % % 1336 % % 1337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1338 % 1339 % MagickClampImage() restricts the color range from 0 to the quantum depth. 1340 % 1341 % The format of the MagickClampImage method is: 1342 % 1343 % MagickBooleanType MagickClampImage(MagickWand *wand) 1344 % 1345 % A description of each parameter follows: 1346 % 1347 % o wand: the magick wand. 1348 % 1349 % o channel: the channel. 1350 % 1351 */ 1352 WandExport MagickBooleanType MagickClampImage(MagickWand *wand) 1353 { 1354 assert(wand != (MagickWand *) NULL); 1355 assert(wand->signature == MagickWandSignature); 1356 if (wand->debug != MagickFalse) 1357 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1358 if (wand->images == (Image *) NULL) 1359 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1360 return(ClampImage(wand->images,wand->exception)); 1361 } 1362 1363 /* 1365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1366 % % 1367 % % 1368 % % 1369 % M a g i c k C l i p I m a g e % 1370 % % 1371 % % 1372 % % 1373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1374 % 1375 % MagickClipImage() clips along the first path from the 8BIM profile, if 1376 % present. 1377 % 1378 % The format of the MagickClipImage method is: 1379 % 1380 % MagickBooleanType MagickClipImage(MagickWand *wand) 1381 % 1382 % A description of each parameter follows: 1383 % 1384 % o wand: the magick wand. 1385 % 1386 */ 1387 WandExport MagickBooleanType MagickClipImage(MagickWand *wand) 1388 { 1389 MagickBooleanType 1390 status; 1391 1392 assert(wand != (MagickWand *) NULL); 1393 assert(wand->signature == MagickWandSignature); 1394 if (wand->debug != MagickFalse) 1395 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1396 if (wand->images == (Image *) NULL) 1397 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1398 status=ClipImage(wand->images,wand->exception); 1399 return(status); 1400 } 1401 1402 /* 1404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1405 % % 1406 % % 1407 % % 1408 % M a g i c k C l i p I m a g e P a t h % 1409 % % 1410 % % 1411 % % 1412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1413 % 1414 % MagickClipImagePath() clips along the named paths from the 8BIM profile, if 1415 % present. Later operations take effect inside the path. Id may be a number 1416 % if preceded with #, to work on a numbered path, e.g., "#1" to use the first 1417 % path. 1418 % 1419 % The format of the MagickClipImagePath method is: 1420 % 1421 % MagickBooleanType MagickClipImagePath(MagickWand *wand, 1422 % const char *pathname,const MagickBooleanType inside) 1423 % 1424 % A description of each parameter follows: 1425 % 1426 % o wand: the magick wand. 1427 % 1428 % o pathname: name of clipping path resource. If name is preceded by #, use 1429 % clipping path numbered by name. 1430 % 1431 % o inside: if non-zero, later operations take effect inside clipping path. 1432 % Otherwise later operations take effect outside clipping path. 1433 % 1434 */ 1435 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand, 1436 const char *pathname,const MagickBooleanType inside) 1437 { 1438 MagickBooleanType 1439 status; 1440 1441 assert(wand != (MagickWand *) NULL); 1442 assert(wand->signature == MagickWandSignature); 1443 if (wand->debug != MagickFalse) 1444 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1445 if (wand->images == (Image *) NULL) 1446 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1447 status=ClipImagePath(wand->images,pathname,inside,wand->exception); 1448 return(status); 1449 } 1450 1451 /* 1453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1454 % % 1455 % % 1456 % % 1457 % M a g i c k C l u t I m a g e % 1458 % % 1459 % % 1460 % % 1461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1462 % 1463 % MagickClutImage() replaces colors in the image from a color lookup table. 1464 % 1465 % The format of the MagickClutImage method is: 1466 % 1467 % MagickBooleanType MagickClutImage(MagickWand *wand, 1468 % const MagickWand *clut_wand,const PixelInterpolateMethod method) 1469 % 1470 % A description of each parameter follows: 1471 % 1472 % o wand: the magick wand. 1473 % 1474 % o clut_image: the clut image. 1475 % 1476 % o method: the pixel interpolation method. 1477 % 1478 */ 1479 WandExport MagickBooleanType MagickClutImage(MagickWand *wand, 1480 const MagickWand *clut_wand,const PixelInterpolateMethod method) 1481 { 1482 MagickBooleanType 1483 status; 1484 1485 assert(wand != (MagickWand *) NULL); 1486 assert(wand->signature == MagickWandSignature); 1487 if (wand->debug != MagickFalse) 1488 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1489 if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL)) 1490 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1491 status=ClutImage(wand->images,clut_wand->images,method,wand->exception); 1492 return(status); 1493 } 1494 1495 /* 1497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1498 % % 1499 % % 1500 % % 1501 % M a g i c k C o a l e s c e I m a g e s % 1502 % % 1503 % % 1504 % % 1505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1506 % 1507 % MagickCoalesceImages() composites a set of images while respecting any page 1508 % offsets and disposal methods. GIF, MIFF, and MNG animation sequences 1509 % typically start with an image background and each subsequent image 1510 % varies in size and offset. MagickCoalesceImages() returns a new sequence 1511 % where each image in the sequence is the same size as the first and 1512 % composited with the next image in the sequence. 1513 % 1514 % The format of the MagickCoalesceImages method is: 1515 % 1516 % MagickWand *MagickCoalesceImages(MagickWand *wand) 1517 % 1518 % A description of each parameter follows: 1519 % 1520 % o wand: the magick wand. 1521 % 1522 */ 1523 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand) 1524 { 1525 Image 1526 *coalesce_image; 1527 1528 assert(wand != (MagickWand *) NULL); 1529 assert(wand->signature == MagickWandSignature); 1530 if (wand->debug != MagickFalse) 1531 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1532 if (wand->images == (Image *) NULL) 1533 return((MagickWand *) NULL); 1534 coalesce_image=CoalesceImages(wand->images,wand->exception); 1535 if (coalesce_image == (Image *) NULL) 1536 return((MagickWand *) NULL); 1537 return(CloneMagickWandFromImages(wand,coalesce_image)); 1538 } 1539 1540 /* 1542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1543 % % 1544 % % 1545 % % 1546 % M a g i c k C o l o r D e c i s i o n I m a g e % 1547 % % 1548 % % 1549 % % 1550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1551 % 1552 % MagickColorDecisionListImage() accepts a lightweight Color Correction 1553 % Collection (CCC) file which solely contains one or more color corrections 1554 % and applies the color correction to the image. Here is a sample CCC file: 1555 % 1556 % <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2"> 1557 % <ColorCorrection id="cc03345"> 1558 % <SOPNode> 1559 % <Slope> 0.9 1.2 0.5 </Slope> 1560 % <Offset> 0.4 -0.5 0.6 </Offset> 1561 % <Power> 1.0 0.8 1.5 </Power> 1562 % </SOPNode> 1563 % <SATNode> 1564 % <Saturation> 0.85 </Saturation> 1565 % </SATNode> 1566 % </ColorCorrection> 1567 % </ColorCorrectionCollection> 1568 % 1569 % which includes the offset, slope, and power for each of the RGB channels 1570 % as well as the saturation. 1571 % 1572 % The format of the MagickColorDecisionListImage method is: 1573 % 1574 % MagickBooleanType MagickColorDecisionListImage(MagickWand *wand, 1575 % const char *color_correction_collection) 1576 % 1577 % A description of each parameter follows: 1578 % 1579 % o wand: the magick wand. 1580 % 1581 % o color_correction_collection: the color correction collection in XML. 1582 % 1583 */ 1584 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand, 1585 const char *color_correction_collection) 1586 { 1587 MagickBooleanType 1588 status; 1589 1590 assert(wand != (MagickWand *) NULL); 1591 assert(wand->signature == MagickWandSignature); 1592 if (wand->debug != MagickFalse) 1593 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1594 if (wand->images == (Image *) NULL) 1595 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1596 status=ColorDecisionListImage(wand->images,color_correction_collection, 1597 wand->exception); 1598 return(status); 1599 } 1600 1601 /* 1603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1604 % % 1605 % % 1606 % % 1607 % M a g i c k C o l o r i z e I m a g e % 1608 % % 1609 % % 1610 % % 1611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1612 % 1613 % MagickColorizeImage() blends the fill color with each pixel in the image. 1614 % 1615 % The format of the MagickColorizeImage method is: 1616 % 1617 % MagickBooleanType MagickColorizeImage(MagickWand *wand, 1618 % const PixelWand *colorize,const PixelWand *blend) 1619 % 1620 % A description of each parameter follows: 1621 % 1622 % o wand: the magick wand. 1623 % 1624 % o colorize: the colorize pixel wand. 1625 % 1626 % o alpha: the alpha pixel wand. 1627 % 1628 */ 1629 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand, 1630 const PixelWand *colorize,const PixelWand *blend) 1631 { 1632 char 1633 percent_blend[MagickPathExtent]; 1634 1635 Image 1636 *colorize_image; 1637 1638 PixelInfo 1639 target; 1640 1641 assert(wand != (MagickWand *) NULL); 1642 assert(wand->signature == MagickWandSignature); 1643 if (wand->debug != MagickFalse) 1644 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1645 if (wand->images == (Image *) NULL) 1646 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1647 GetPixelInfo(wand->images,&target); 1648 if (target.colorspace != CMYKColorspace) 1649 (void) FormatLocaleString(percent_blend,MagickPathExtent, 1650 "%g,%g,%g,%g",(double) (100.0*QuantumScale* 1651 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale* 1652 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale* 1653 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale* 1654 PixelGetAlphaQuantum(blend))); 1655 else 1656 (void) FormatLocaleString(percent_blend,MagickPathExtent, 1657 "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale* 1658 PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale* 1659 PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale* 1660 PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale* 1661 PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale* 1662 PixelGetAlphaQuantum(blend))); 1663 target=PixelGetPixel(colorize); 1664 colorize_image=ColorizeImage(wand->images,percent_blend,&target, 1665 wand->exception); 1666 if (colorize_image == (Image *) NULL) 1667 return(MagickFalse); 1668 ReplaceImageInList(&wand->images,colorize_image); 1669 return(MagickTrue); 1670 } 1671 1672 /* 1674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1675 % % 1676 % % 1677 % % 1678 % M a g i c k C o l o r M a t r i x I m a g e % 1679 % % 1680 % % 1681 % % 1682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1683 % 1684 % MagickColorMatrixImage() apply color transformation to an image. The method 1685 % permits saturation changes, hue rotation, luminance to alpha, and various 1686 % other effects. Although variable-sized transformation matrices can be used, 1687 % typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA 1688 % (or RGBA with offsets). The matrix is similar to those used by Adobe Flash 1689 % except offsets are in column 6 rather than 5 (in support of CMYKA images) 1690 % and offsets are normalized (divide Flash offset by 255). 1691 % 1692 % The format of the MagickColorMatrixImage method is: 1693 % 1694 % MagickBooleanType MagickColorMatrixImage(MagickWand *wand, 1695 % const KernelInfo *color_matrix) 1696 % 1697 % A description of each parameter follows: 1698 % 1699 % o wand: the magick wand. 1700 % 1701 % o color_matrix: the color matrix. 1702 % 1703 */ 1704 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand, 1705 const KernelInfo *color_matrix) 1706 { 1707 Image 1708 *color_image; 1709 1710 assert(wand != (MagickWand *) NULL); 1711 assert(wand->signature == MagickWandSignature); 1712 if (wand->debug != MagickFalse) 1713 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1714 if (color_matrix == (const KernelInfo *) NULL) 1715 return(MagickFalse); 1716 if (wand->images == (Image *) NULL) 1717 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1718 color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception); 1719 if (color_image == (Image *) NULL) 1720 return(MagickFalse); 1721 ReplaceImageInList(&wand->images,color_image); 1722 return(MagickTrue); 1723 } 1724 1725 /* 1727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1728 % % 1729 % % 1730 % % 1731 % M a g i c k C o m b i n e I m a g e s % 1732 % % 1733 % % 1734 % % 1735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1736 % 1737 % MagickCombineImages() combines one or more images into a single image. The 1738 % grayscale value of the pixels of each image in the sequence is assigned in 1739 % order to the specified hannels of the combined image. The typical 1740 % ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc. 1741 % 1742 % The format of the MagickCombineImages method is: 1743 % 1744 % MagickWand *MagickCombineImages(MagickWand *wand, 1745 % const ColorspaceType colorspace) 1746 % 1747 % A description of each parameter follows: 1748 % 1749 % o wand: the magick wand. 1750 % 1751 % o colorspace: the colorspace. 1752 % 1753 */ 1754 WandExport MagickWand *MagickCombineImages(MagickWand *wand, 1755 const ColorspaceType colorspace) 1756 { 1757 Image 1758 *combine_image; 1759 1760 assert(wand != (MagickWand *) NULL); 1761 assert(wand->signature == MagickWandSignature); 1762 if (wand->debug != MagickFalse) 1763 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1764 if (wand->images == (Image *) NULL) 1765 return((MagickWand *) NULL); 1766 combine_image=CombineImages(wand->images,colorspace,wand->exception); 1767 if (combine_image == (Image *) NULL) 1768 return((MagickWand *) NULL); 1769 return(CloneMagickWandFromImages(wand,combine_image)); 1770 } 1771 1772 /* 1774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1775 % % 1776 % % 1777 % % 1778 % M a g i c k C o m m e n t I m a g e % 1779 % % 1780 % % 1781 % % 1782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1783 % 1784 % MagickCommentImage() adds a comment to your image. 1785 % 1786 % The format of the MagickCommentImage method is: 1787 % 1788 % MagickBooleanType MagickCommentImage(MagickWand *wand, 1789 % const char *comment) 1790 % 1791 % A description of each parameter follows: 1792 % 1793 % o wand: the magick wand. 1794 % 1795 % o comment: the image comment. 1796 % 1797 */ 1798 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand, 1799 const char *comment) 1800 { 1801 MagickBooleanType 1802 status; 1803 1804 assert(wand != (MagickWand *) NULL); 1805 assert(wand->signature == MagickWandSignature); 1806 if (wand->debug != MagickFalse) 1807 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1808 if (wand->images == (Image *) NULL) 1809 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1810 status=SetImageProperty(wand->images,"comment",comment,wand->exception); 1811 return(status); 1812 } 1813 1814 /* 1816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1817 % % 1818 % % 1819 % % 1820 % M a g i c k C o m p a r e I m a g e L a y e r s % 1821 % % 1822 % % 1823 % % 1824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1825 % 1826 % MagickCompareImagesLayers() compares each image with the next in a sequence 1827 % and returns the maximum bounding region of any pixel differences it 1828 % discovers. 1829 % 1830 % The format of the MagickCompareImagesLayers method is: 1831 % 1832 % MagickWand *MagickCompareImagesLayers(MagickWand *wand, 1833 % const LayerMethod method) 1834 % 1835 % A description of each parameter follows: 1836 % 1837 % o wand: the magick wand. 1838 % 1839 % o method: the compare method. 1840 % 1841 */ 1842 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand, 1843 const LayerMethod method) 1844 { 1845 Image 1846 *layers_image; 1847 1848 assert(wand != (MagickWand *) NULL); 1849 assert(wand->signature == MagickWandSignature); 1850 if (wand->debug != MagickFalse) 1851 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1852 if (wand->images == (Image *) NULL) 1853 return((MagickWand *) NULL); 1854 layers_image=CompareImagesLayers(wand->images,method,wand->exception); 1855 if (layers_image == (Image *) NULL) 1856 return((MagickWand *) NULL); 1857 return(CloneMagickWandFromImages(wand,layers_image)); 1858 } 1859 1860 /* 1862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1863 % % 1864 % % 1865 % % 1866 % M a g i c k C o m p a r e I m a g e s % 1867 % % 1868 % % 1869 % % 1870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1871 % 1872 % MagickCompareImages() compares an image to a reconstructed image and returns 1873 % the specified difference image. 1874 % 1875 % The format of the MagickCompareImages method is: 1876 % 1877 % MagickWand *MagickCompareImages(MagickWand *wand, 1878 % const MagickWand *reference,const MetricType metric, 1879 % double *distortion) 1880 % 1881 % A description of each parameter follows: 1882 % 1883 % o wand: the magick wand. 1884 % 1885 % o reference: the reference wand. 1886 % 1887 % o metric: the metric. 1888 % 1889 % o distortion: the computed distortion between the images. 1890 % 1891 */ 1892 WandExport MagickWand *MagickCompareImages(MagickWand *wand, 1893 const MagickWand *reference,const MetricType metric,double *distortion) 1894 { 1895 Image 1896 *compare_image; 1897 1898 1899 assert(wand != (MagickWand *) NULL); 1900 assert(wand->signature == MagickWandSignature); 1901 if (wand->debug != MagickFalse) 1902 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1903 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL)) 1904 { 1905 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 1906 "ContainsNoImages","`%s'",wand->name); 1907 return((MagickWand *) NULL); 1908 } 1909 compare_image=CompareImages(wand->images,reference->images,metric,distortion, 1910 wand->exception); 1911 if (compare_image == (Image *) NULL) 1912 return((MagickWand *) NULL); 1913 return(CloneMagickWandFromImages(wand,compare_image)); 1914 } 1915 1916 /* 1918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1919 % % 1920 % % 1921 % % 1922 % M a g i c k C o m p o s i t e I m a g e % 1923 % % 1924 % % 1925 % % 1926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1927 % 1928 % MagickCompositeImage() composite one image onto another at the specified 1929 % offset. 1930 % 1931 % The format of the MagickCompositeImage method is: 1932 % 1933 % MagickBooleanType MagickCompositeImage(MagickWand *wand, 1934 % const MagickWand *source_wand,const CompositeOperator compose, 1935 % const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y) 1936 % 1937 % A description of each parameter follows: 1938 % 1939 % o wand: the magick wand holding the destination images 1940 % 1941 % o source_image: the magick wand holding source image. 1942 % 1943 % o compose: This operator affects how the composite is applied to the 1944 % image. The default is Over. These are some of the compose methods 1945 % availble. 1946 % 1947 % OverCompositeOp InCompositeOp OutCompositeOp 1948 % AtopCompositeOp XorCompositeOp PlusCompositeOp 1949 % MinusCompositeOp AddCompositeOp SubtractCompositeOp 1950 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp 1951 % DisplaceCompositeOp 1952 % 1953 % o clip_to_self: set to MagickTrue to limit composition to area composed. 1954 % 1955 % o x: the column offset of the composited image. 1956 % 1957 % o y: the row offset of the composited image. 1958 % 1959 */ 1960 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand, 1961 const MagickWand *source_wand,const CompositeOperator compose, 1962 const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y) 1963 { 1964 MagickBooleanType 1965 status; 1966 1967 assert(wand != (MagickWand *) NULL); 1968 assert(wand->signature == MagickWandSignature); 1969 if (wand->debug != MagickFalse) 1970 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 1971 if ((wand->images == (Image *) NULL) || 1972 (source_wand->images == (Image *) NULL)) 1973 ThrowWandException(WandError,"ContainsNoImages",wand->name); 1974 status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self, 1975 x,y,wand->exception); 1976 return(status); 1977 } 1978 1979 /* 1981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1982 % % 1983 % % 1984 % % 1985 % M a g i c k C o m p o s i t e I m a g e G r a v i t y % 1986 % % 1987 % % 1988 % % 1989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1990 % 1991 % MagickCompositeImageGravity() composite one image onto another using the 1992 % specified gravity. 1993 % 1994 % The format of the MagickCompositeImageGravity method is: 1995 % 1996 % MagickBooleanType MagickCompositeImageGravity(MagickWand *wand, 1997 % const MagickWand *source_wand,const CompositeOperator compose, 1998 % const GravityType gravity) 1999 % 2000 % A description of each parameter follows: 2001 % 2002 % o wand: the magick wand holding the destination images 2003 % 2004 % o source_image: the magick wand holding source image. 2005 % 2006 % o compose: This operator affects how the composite is applied to the 2007 % image. The default is Over. These are some of the compose methods 2008 % availble. 2009 % 2010 % OverCompositeOp InCompositeOp OutCompositeOp 2011 % AtopCompositeOp XorCompositeOp PlusCompositeOp 2012 % MinusCompositeOp AddCompositeOp SubtractCompositeOp 2013 % DifferenceCompositeOp BumpmapCompositeOp CopyCompositeOp 2014 % DisplaceCompositeOp 2015 % 2016 % o gravity: positioning gravity (NorthWestGravity, NorthGravity, 2017 % NorthEastGravity, WestGravity, CenterGravity, 2018 % EastGravity, SouthWestGravity, SouthGravity, 2019 % SouthEastGravity) 2020 % 2021 */ 2022 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand, 2023 const MagickWand *source_wand,const CompositeOperator compose, 2024 const GravityType gravity) 2025 { 2026 MagickBooleanType 2027 status; 2028 2029 RectangleInfo 2030 geometry; 2031 2032 assert(wand != (MagickWand *) NULL); 2033 assert(wand->signature == MagickWandSignature); 2034 if (wand->debug != MagickFalse) 2035 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2036 if ((wand->images == (Image *) NULL) || 2037 (source_wand->images == (Image *) NULL)) 2038 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2039 SetGeometry(source_wand->images,&geometry); 2040 GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity, 2041 &geometry); 2042 status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue, 2043 geometry.x,geometry.y,wand->exception); 2044 return(status); 2045 } 2046 2047 /* 2049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2050 % % 2051 % % 2052 % % 2053 % M a g i c k C o m p o s i t e L a y e r s % 2054 % % 2055 % % 2056 % % 2057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2058 % 2059 % MagickCompositeLayers() composite the images in the source wand over the 2060 % images in the destination wand in sequence, starting with the current 2061 % image in both lists. 2062 % 2063 % Each layer from the two image lists are composted together until the end of 2064 % one of the image lists is reached. The offset of each composition is also 2065 % adjusted to match the virtual canvas offsets of each layer. As such the 2066 % given offset is relative to the virtual canvas, and not the actual image. 2067 % 2068 % Composition uses given x and y offsets, as the 'origin' location of the 2069 % source images virtual canvas (not the real image) allowing you to compose a 2070 % list of 'layer images' into the destiantioni images. This makes it well 2071 % sutiable for directly composing 'Clears Frame Animations' or 'Coaleased 2072 % Animations' onto a static or other 'Coaleased Animation' destination image 2073 % list. GIF disposal handling is not looked at. 2074 % 2075 % Special case:- If one of the image sequences is the last image (just a 2076 % single image remaining), that image is repeatally composed with all the 2077 % images in the other image list. Either the source or destination lists may 2078 % be the single image, for this situation. 2079 % 2080 % In the case of a single destination image (or last image given), that image 2081 % will ve cloned to match the number of images remaining in the source image 2082 % list. 2083 % 2084 % This is equivelent to the "-layer Composite" Shell API operator. 2085 % 2086 % The format of the MagickCompositeLayers method is: 2087 % 2088 % MagickBooleanType MagickCompositeLayers(MagickWand *wand, 2089 % const MagickWand *source_wand, const CompositeOperator compose, 2090 % const ssize_t x,const ssize_t y) 2091 % 2092 % A description of each parameter follows: 2093 % 2094 % o wand: the magick wand holding destaintion images 2095 % 2096 % o source_wand: the wand holding the source images 2097 % 2098 % o compose, x, y: composition arguments 2099 % 2100 */ 2101 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand, 2102 const MagickWand *source_wand,const CompositeOperator compose, 2103 const ssize_t x,const ssize_t y) 2104 { 2105 MagickBooleanType 2106 status; 2107 2108 assert(wand != (MagickWand *) NULL); 2109 assert(wand->signature == MagickWandSignature); 2110 if (wand->debug != MagickFalse) 2111 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2112 if ((wand->images == (Image *) NULL) || 2113 (source_wand->images == (Image *) NULL)) 2114 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2115 CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception); 2116 status=MagickTrue; /* FUTURE: determine status from exceptions */ 2117 return(status); 2118 } 2119 2120 /* 2122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2123 % % 2124 % % 2125 % % 2126 % M a g i c k C o n t r a s t I m a g e % 2127 % % 2128 % % 2129 % % 2130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2131 % 2132 % MagickContrastImage() enhances the intensity differences between the lighter 2133 % and darker elements of the image. Set sharpen to a value other than 0 to 2134 % increase the image contrast otherwise the contrast is reduced. 2135 % 2136 % The format of the MagickContrastImage method is: 2137 % 2138 % MagickBooleanType MagickContrastImage(MagickWand *wand, 2139 % const MagickBooleanType sharpen) 2140 % 2141 % A description of each parameter follows: 2142 % 2143 % o wand: the magick wand. 2144 % 2145 % o sharpen: Increase or decrease image contrast. 2146 % 2147 % 2148 */ 2149 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand, 2150 const MagickBooleanType sharpen) 2151 { 2152 MagickBooleanType 2153 status; 2154 2155 assert(wand != (MagickWand *) NULL); 2156 assert(wand->signature == MagickWandSignature); 2157 if (wand->debug != MagickFalse) 2158 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2159 if (wand->images == (Image *) NULL) 2160 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2161 status=ContrastImage(wand->images,sharpen,wand->exception); 2162 return(status); 2163 } 2164 2165 /* 2167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2168 % % 2169 % % 2170 % % 2171 % M a g i c k C o n t r a s t S t r e t c h I m a g e % 2172 % % 2173 % % 2174 % % 2175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2176 % 2177 % MagickContrastStretchImage() enhances the contrast of a color image by 2178 % adjusting the pixels color to span the entire range of colors available. 2179 % You can also reduce the influence of a particular channel with a gamma 2180 % value of 0. 2181 % 2182 % The format of the MagickContrastStretchImage method is: 2183 % 2184 % MagickBooleanType MagickContrastStretchImage(MagickWand *wand, 2185 % const double black_point,const double white_point) 2186 % 2187 % A description of each parameter follows: 2188 % 2189 % o wand: the magick wand. 2190 % 2191 % o black_point: the black point. 2192 % 2193 % o white_point: the white point. 2194 % 2195 */ 2196 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand, 2197 const double black_point,const double white_point) 2198 { 2199 MagickBooleanType 2200 status; 2201 2202 assert(wand != (MagickWand *) NULL); 2203 assert(wand->signature == MagickWandSignature); 2204 if (wand->debug != MagickFalse) 2205 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2206 if (wand->images == (Image *) NULL) 2207 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2208 status=ContrastStretchImage(wand->images,black_point,white_point, 2209 wand->exception); 2210 return(status); 2211 } 2212 2213 /* 2215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2216 % % 2217 % % 2218 % % 2219 % M a g i c k C o n v o l v e I m a g e % 2220 % % 2221 % % 2222 % % 2223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2224 % 2225 % MagickConvolveImage() applies a custom convolution kernel to the image. 2226 % 2227 % The format of the MagickConvolveImage method is: 2228 % 2229 % MagickBooleanType MagickConvolveImage(MagickWand *wand, 2230 % const KernelInfo *kernel) 2231 % 2232 % A description of each parameter follows: 2233 % 2234 % o wand: the magick wand. 2235 % 2236 % o kernel: An array of doubles representing the convolution kernel. 2237 % 2238 */ 2239 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand, 2240 const KernelInfo *kernel) 2241 { 2242 Image 2243 *filter_image; 2244 2245 assert(wand != (MagickWand *) NULL); 2246 assert(wand->signature == MagickWandSignature); 2247 if (wand->debug != MagickFalse) 2248 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2249 if (kernel == (const KernelInfo *) NULL) 2250 return(MagickFalse); 2251 if (wand->images == (Image *) NULL) 2252 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2253 filter_image=ConvolveImage(wand->images,kernel,wand->exception); 2254 if (filter_image == (Image *) NULL) 2255 return(MagickFalse); 2256 ReplaceImageInList(&wand->images,filter_image); 2257 return(MagickTrue); 2258 } 2259 2260 /* 2262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2263 % % 2264 % % 2265 % % 2266 % M a g i c k C r o p I m a g e % 2267 % % 2268 % % 2269 % % 2270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2271 % 2272 % MagickCropImage() extracts a region of the image. 2273 % 2274 % The format of the MagickCropImage method is: 2275 % 2276 % MagickBooleanType MagickCropImage(MagickWand *wand, 2277 % const size_t width,const size_t height,const ssize_t x,const ssize_t y) 2278 % 2279 % A description of each parameter follows: 2280 % 2281 % o wand: the magick wand. 2282 % 2283 % o width: the region width. 2284 % 2285 % o height: the region height. 2286 % 2287 % o x: the region x-offset. 2288 % 2289 % o y: the region y-offset. 2290 % 2291 */ 2292 WandExport MagickBooleanType MagickCropImage(MagickWand *wand, 2293 const size_t width,const size_t height,const ssize_t x,const ssize_t y) 2294 { 2295 Image 2296 *crop_image; 2297 2298 RectangleInfo 2299 crop; 2300 2301 assert(wand != (MagickWand *) NULL); 2302 assert(wand->signature == MagickWandSignature); 2303 if (wand->debug != MagickFalse) 2304 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2305 if (wand->images == (Image *) NULL) 2306 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2307 crop.width=width; 2308 crop.height=height; 2309 crop.x=x; 2310 crop.y=y; 2311 crop_image=CropImage(wand->images,&crop,wand->exception); 2312 if (crop_image == (Image *) NULL) 2313 return(MagickFalse); 2314 ReplaceImageInList(&wand->images,crop_image); 2315 return(MagickTrue); 2316 } 2317 2318 /* 2320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2321 % % 2322 % % 2323 % % 2324 % M a g i c k C y c l e C o l o r m a p I m a g e % 2325 % % 2326 % % 2327 % % 2328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2329 % 2330 % MagickCycleColormapImage() displaces an image's colormap by a given number 2331 % of positions. If you cycle the colormap a number of times you can produce 2332 % a psychodelic effect. 2333 % 2334 % The format of the MagickCycleColormapImage method is: 2335 % 2336 % MagickBooleanType MagickCycleColormapImage(MagickWand *wand, 2337 % const ssize_t displace) 2338 % 2339 % A description of each parameter follows: 2340 % 2341 % o wand: the magick wand. 2342 % 2343 % o pixel_wand: the pixel wand. 2344 % 2345 */ 2346 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand, 2347 const ssize_t displace) 2348 { 2349 MagickBooleanType 2350 status; 2351 2352 assert(wand != (MagickWand *) NULL); 2353 assert(wand->signature == MagickWandSignature); 2354 if (wand->debug != MagickFalse) 2355 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2356 if (wand->images == (Image *) NULL) 2357 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2358 status=CycleColormapImage(wand->images,displace,wand->exception); 2359 return(status); 2360 } 2361 2362 /* 2364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2365 % % 2366 % % 2367 % % 2368 % M a g i c k C o n s t i t u t e I m a g e % 2369 % % 2370 % % 2371 % % 2372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2373 % 2374 % MagickConstituteImage() adds an image to the wand comprised of the pixel 2375 % data you supply. The pixel data must be in scanline order top-to-bottom. 2376 % The data can be char, short int, int, float, or double. Float and double 2377 % require the pixels to be normalized [0..1], otherwise [0..Max], where Max 2378 % is the maximum value the type can accomodate (e.g. 255 for char). For 2379 % example, to create a 640x480 image from unsigned red-green-blue character 2380 % data, use 2381 % 2382 % MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels); 2383 % 2384 % The format of the MagickConstituteImage method is: 2385 % 2386 % MagickBooleanType MagickConstituteImage(MagickWand *wand, 2387 % const size_t columns,const size_t rows,const char *map, 2388 % const StorageType storage,void *pixels) 2389 % 2390 % A description of each parameter follows: 2391 % 2392 % o wand: the magick wand. 2393 % 2394 % o columns: width in pixels of the image. 2395 % 2396 % o rows: height in pixels of the image. 2397 % 2398 % o map: This string reflects the expected ordering of the pixel array. 2399 % It can be any combination or order of R = red, G = green, B = blue, 2400 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan, 2401 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale), 2402 % P = pad. 2403 % 2404 % o storage: Define the data type of the pixels. Float and double types are 2405 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from 2406 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel, 2407 % LongPixel, QuantumPixel, or ShortPixel. 2408 % 2409 % o pixels: This array of values contain the pixel components as defined by 2410 % map and type. You must preallocate this array where the expected 2411 % length varies depending on the values of width, height, map, and type. 2412 % 2413 % 2414 */ 2415 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand, 2416 const size_t columns,const size_t rows,const char *map, 2417 const StorageType storage,const void *pixels) 2418 { 2419 Image 2420 *images; 2421 2422 assert(wand != (MagickWand *) NULL); 2423 assert(wand->signature == MagickWandSignature); 2424 if (wand->debug != MagickFalse) 2425 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2426 images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception); 2427 if (images == (Image *) NULL) 2428 return(MagickFalse); 2429 return(InsertImageInWand(wand,images)); 2430 } 2431 2432 /* 2434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2435 % % 2436 % % 2437 % % 2438 % M a g i c k D e c i p h e r I m a g e % 2439 % % 2440 % % 2441 % % 2442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2443 % 2444 % MagickDecipherImage() converts cipher pixels to plain pixels. 2445 % 2446 % The format of the MagickDecipherImage method is: 2447 % 2448 % MagickBooleanType MagickDecipherImage(MagickWand *wand, 2449 % const char *passphrase) 2450 % 2451 % A description of each parameter follows: 2452 % 2453 % o wand: the magick wand. 2454 % 2455 % o passphrase: the passphrase. 2456 % 2457 */ 2458 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand, 2459 const char *passphrase) 2460 { 2461 assert(wand != (MagickWand *) NULL); 2462 assert(wand->signature == MagickWandSignature); 2463 if (wand->debug != MagickFalse) 2464 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2465 if (wand->images == (Image *) NULL) 2466 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2467 return(DecipherImage(wand->images,passphrase,wand->exception)); 2468 } 2469 2470 /* 2472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2473 % % 2474 % % 2475 % % 2476 % M a g i c k D e c o n s t r u c t I m a g e s % 2477 % % 2478 % % 2479 % % 2480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2481 % 2482 % MagickDeconstructImages() compares each image with the next in a sequence 2483 % and returns the maximum bounding region of any pixel differences it 2484 % discovers. 2485 % 2486 % The format of the MagickDeconstructImages method is: 2487 % 2488 % MagickWand *MagickDeconstructImages(MagickWand *wand) 2489 % 2490 % A description of each parameter follows: 2491 % 2492 % o wand: the magick wand. 2493 % 2494 */ 2495 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand) 2496 { 2497 Image 2498 *deconstruct_image; 2499 2500 assert(wand != (MagickWand *) NULL); 2501 assert(wand->signature == MagickWandSignature); 2502 if (wand->debug != MagickFalse) 2503 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2504 if (wand->images == (Image *) NULL) 2505 return((MagickWand *) NULL); 2506 deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer, 2507 wand->exception); 2508 if (deconstruct_image == (Image *) NULL) 2509 return((MagickWand *) NULL); 2510 return(CloneMagickWandFromImages(wand,deconstruct_image)); 2511 } 2512 2513 /* 2515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2516 % % 2517 % % 2518 % % 2519 % M a g i c k D e s k e w I m a g e % 2520 % % 2521 % % 2522 % % 2523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2524 % 2525 % MagickDeskewImage() removes skew from the image. Skew is an artifact that 2526 % occurs in scanned images because of the camera being misaligned, 2527 % imperfections in the scanning or surface, or simply because the paper was 2528 % not placed completely flat when scanned. 2529 % 2530 % The format of the MagickDeskewImage method is: 2531 % 2532 % MagickBooleanType MagickDeskewImage(MagickWand *wand, 2533 % const double threshold) 2534 % 2535 % A description of each parameter follows: 2536 % 2537 % o wand: the magick wand. 2538 % 2539 % o threshold: separate background from foreground. 2540 % 2541 */ 2542 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand, 2543 const double threshold) 2544 { 2545 Image 2546 *sepia_image; 2547 2548 assert(wand != (MagickWand *) NULL); 2549 assert(wand->signature == MagickWandSignature); 2550 if (wand->debug != MagickFalse) 2551 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2552 if (wand->images == (Image *) NULL) 2553 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2554 sepia_image=DeskewImage(wand->images,threshold,wand->exception); 2555 if (sepia_image == (Image *) NULL) 2556 return(MagickFalse); 2557 ReplaceImageInList(&wand->images,sepia_image); 2558 return(MagickTrue); 2559 } 2560 2561 /* 2563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2564 % % 2565 % % 2566 % % 2567 % M a g i c k D e s p e c k l e I m a g e % 2568 % % 2569 % % 2570 % % 2571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2572 % 2573 % MagickDespeckleImage() reduces the speckle noise in an image while 2574 % perserving the edges of the original image. 2575 % 2576 % The format of the MagickDespeckleImage method is: 2577 % 2578 % MagickBooleanType MagickDespeckleImage(MagickWand *wand) 2579 % 2580 % A description of each parameter follows: 2581 % 2582 % o wand: the magick wand. 2583 % 2584 */ 2585 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand) 2586 { 2587 Image 2588 *despeckle_image; 2589 2590 assert(wand != (MagickWand *) NULL); 2591 assert(wand->signature == MagickWandSignature); 2592 if (wand->debug != MagickFalse) 2593 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2594 if (wand->images == (Image *) NULL) 2595 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2596 despeckle_image=DespeckleImage(wand->images,wand->exception); 2597 if (despeckle_image == (Image *) NULL) 2598 return(MagickFalse); 2599 ReplaceImageInList(&wand->images,despeckle_image); 2600 return(MagickTrue); 2601 } 2602 2603 /* 2605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2606 % % 2607 % % 2608 % % 2609 % M a g i c k D e s t r o y I m a g e % 2610 % % 2611 % % 2612 % % 2613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2614 % 2615 % MagickDestroyImage() dereferences an image, deallocating memory associated 2616 % with the image if the reference count becomes zero. 2617 % 2618 % The format of the MagickDestroyImage method is: 2619 % 2620 % Image *MagickDestroyImage(Image *image) 2621 % 2622 % A description of each parameter follows: 2623 % 2624 % o image: the image. 2625 % 2626 */ 2627 WandExport Image *MagickDestroyImage(Image *image) 2628 { 2629 return(DestroyImage(image)); 2630 } 2631 2632 /* 2634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2635 % % 2636 % % 2637 % % 2638 % M a g i c k D i s p l a y I m a g e % 2639 % % 2640 % % 2641 % % 2642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2643 % 2644 % MagickDisplayImage() displays an image. 2645 % 2646 % The format of the MagickDisplayImage method is: 2647 % 2648 % MagickBooleanType MagickDisplayImage(MagickWand *wand, 2649 % const char *server_name) 2650 % 2651 % A description of each parameter follows: 2652 % 2653 % o wand: the magick wand. 2654 % 2655 % o server_name: the X server name. 2656 % 2657 */ 2658 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand, 2659 const char *server_name) 2660 { 2661 Image 2662 *image; 2663 2664 MagickBooleanType 2665 status; 2666 2667 assert(wand != (MagickWand *) NULL); 2668 assert(wand->signature == MagickWandSignature); 2669 if (wand->debug != MagickFalse) 2670 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2671 if (wand->images == (Image *) NULL) 2672 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2673 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception); 2674 if (image == (Image *) NULL) 2675 return(MagickFalse); 2676 (void) CloneString(&wand->image_info->server_name,server_name); 2677 status=DisplayImages(wand->image_info,image,wand->exception); 2678 image=DestroyImage(image); 2679 return(status); 2680 } 2681 2682 /* 2684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2685 % % 2686 % % 2687 % % 2688 % M a g i c k D i s p l a y I m a g e s % 2689 % % 2690 % % 2691 % % 2692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2693 % 2694 % MagickDisplayImages() displays an image or image sequence. 2695 % 2696 % The format of the MagickDisplayImages method is: 2697 % 2698 % MagickBooleanType MagickDisplayImages(MagickWand *wand, 2699 % const char *server_name) 2700 % 2701 % A description of each parameter follows: 2702 % 2703 % o wand: the magick wand. 2704 % 2705 % o server_name: the X server name. 2706 % 2707 */ 2708 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand, 2709 const char *server_name) 2710 { 2711 MagickBooleanType 2712 status; 2713 2714 assert(wand != (MagickWand *) NULL); 2715 assert(wand->signature == MagickWandSignature); 2716 if (wand->debug != MagickFalse) 2717 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2718 (void) CloneString(&wand->image_info->server_name,server_name); 2719 status=DisplayImages(wand->image_info,wand->images,wand->exception); 2720 return(status); 2721 } 2722 2723 /* 2725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2726 % % 2727 % % 2728 % % 2729 % M a g i c k D i s t o r t I m a g e % 2730 % % 2731 % % 2732 % % 2733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2734 % 2735 % MagickDistortImage() distorts an image using various distortion methods, by 2736 % mapping color lookups of the source image to a new destination image 2737 % usally of the same size as the source image, unless 'bestfit' is set to 2738 % true. 2739 % 2740 % If 'bestfit' is enabled, and distortion allows it, the destination image is 2741 % adjusted to ensure the whole source 'image' will just fit within the final 2742 % destination image, which will be sized and offset accordingly. Also in 2743 % many cases the virtual offset of the source image will be taken into 2744 % account in the mapping. 2745 % 2746 % The format of the MagickDistortImage method is: 2747 % 2748 % MagickBooleanType MagickDistortImage(MagickWand *wand, 2749 % const DistortMethod method,const size_t number_arguments, 2750 % const double *arguments,const MagickBooleanType bestfit) 2751 % 2752 % A description of each parameter follows: 2753 % 2754 % o image: the image to be distorted. 2755 % 2756 % o method: the method of image distortion. 2757 % 2758 % ArcDistortion always ignores the source image offset, and always 2759 % 'bestfit' the destination image with the top left corner offset 2760 % relative to the polar mapping center. 2761 % 2762 % Bilinear has no simple inverse mapping so it does not allow 'bestfit' 2763 % style of image distortion. 2764 % 2765 % Affine, Perspective, and Bilinear, do least squares fitting of the 2766 % distortion when more than the minimum number of control point pairs 2767 % are provided. 2768 % 2769 % Perspective, and Bilinear, falls back to a Affine distortion when less 2770 % that 4 control point pairs are provided. While Affine distortions let 2771 % you use any number of control point pairs, that is Zero pairs is a 2772 % no-Op (viewport only) distrotion, one pair is a translation and two 2773 % pairs of control points do a scale-rotate-translate, without any 2774 % shearing. 2775 % 2776 % o number_arguments: the number of arguments given for this distortion 2777 % method. 2778 % 2779 % o arguments: the arguments for this distortion method. 2780 % 2781 % o bestfit: Attempt to resize destination to fit distorted source. 2782 % 2783 */ 2784 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand, 2785 const DistortMethod method,const size_t number_arguments, 2786 const double *arguments,const MagickBooleanType bestfit) 2787 { 2788 Image 2789 *distort_image; 2790 2791 assert(wand != (MagickWand *) NULL); 2792 assert(wand->signature == MagickWandSignature); 2793 if (wand->debug != MagickFalse) 2794 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2795 if (wand->images == (Image *) NULL) 2796 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2797 distort_image=DistortImage(wand->images,method,number_arguments,arguments, 2798 bestfit,wand->exception); 2799 if (distort_image == (Image *) NULL) 2800 return(MagickFalse); 2801 ReplaceImageInList(&wand->images,distort_image); 2802 return(MagickTrue); 2803 } 2804 2805 /* 2807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2808 % % 2809 % % 2810 % % 2811 % M a g i c k D r a w I m a g e % 2812 % % 2813 % % 2814 % % 2815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2816 % 2817 % MagickDrawImage() renders the drawing wand on the current image. 2818 % 2819 % The format of the MagickDrawImage method is: 2820 % 2821 % MagickBooleanType MagickDrawImage(MagickWand *wand, 2822 % const DrawingWand *drawing_wand) 2823 % 2824 % A description of each parameter follows: 2825 % 2826 % o wand: the magick wand. 2827 % 2828 % o drawing_wand: the draw wand. 2829 % 2830 */ 2831 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand, 2832 const DrawingWand *drawing_wand) 2833 { 2834 char 2835 *primitive; 2836 2837 DrawInfo 2838 *draw_info; 2839 2840 MagickBooleanType 2841 status; 2842 2843 assert(wand != (MagickWand *) NULL); 2844 assert(wand->signature == MagickWandSignature); 2845 if (wand->debug != MagickFalse) 2846 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2847 if (wand->images == (Image *) NULL) 2848 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2849 draw_info=PeekDrawingWand(drawing_wand); 2850 if ((draw_info == (DrawInfo *) NULL) || 2851 (draw_info->primitive == (char *) NULL)) 2852 return(MagickFalse); 2853 primitive=AcquireString(draw_info->primitive); 2854 draw_info=DestroyDrawInfo(draw_info); 2855 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL); 2856 draw_info->primitive=primitive; 2857 status=DrawImage(wand->images,draw_info,wand->exception); 2858 draw_info=DestroyDrawInfo(draw_info); 2859 return(status); 2860 } 2861 2862 /* 2864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2865 % % 2866 % % 2867 % % 2868 % M a g i c k E d g e I m a g e % 2869 % % 2870 % % 2871 % % 2872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2873 % 2874 % MagickEdgeImage() enhance edges within the image with a convolution filter 2875 % of the given radius. Use a radius of 0 and Edge() selects a suitable 2876 % radius for you. 2877 % 2878 % The format of the MagickEdgeImage method is: 2879 % 2880 % MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius) 2881 % 2882 % A description of each parameter follows: 2883 % 2884 % o wand: the magick wand. 2885 % 2886 % o radius: the radius of the pixel neighborhood. 2887 % 2888 */ 2889 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand, 2890 const double radius) 2891 { 2892 Image 2893 *edge_image; 2894 2895 assert(wand != (MagickWand *) NULL); 2896 assert(wand->signature == MagickWandSignature); 2897 if (wand->debug != MagickFalse) 2898 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2899 if (wand->images == (Image *) NULL) 2900 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2901 edge_image=EdgeImage(wand->images,radius,wand->exception); 2902 if (edge_image == (Image *) NULL) 2903 return(MagickFalse); 2904 ReplaceImageInList(&wand->images,edge_image); 2905 return(MagickTrue); 2906 } 2907 2908 /* 2910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2911 % % 2912 % % 2913 % % 2914 % M a g i c k E m b o s s I m a g e % 2915 % % 2916 % % 2917 % % 2918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2919 % 2920 % MagickEmbossImage() returns a grayscale image with a three-dimensional 2921 % effect. We convolve the image with a Gaussian operator of the given radius 2922 % and standard deviation (sigma). For reasonable results, radius should be 2923 % larger than sigma. Use a radius of 0 and Emboss() selects a suitable 2924 % radius for you. 2925 % 2926 % The format of the MagickEmbossImage method is: 2927 % 2928 % MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius, 2929 % const double sigma) 2930 % 2931 % A description of each parameter follows: 2932 % 2933 % o wand: the magick wand. 2934 % 2935 % o radius: the radius of the Gaussian, in pixels, not counting the center 2936 % pixel. 2937 % 2938 % o sigma: the standard deviation of the Gaussian, in pixels. 2939 % 2940 */ 2941 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand, 2942 const double radius,const double sigma) 2943 { 2944 Image 2945 *emboss_image; 2946 2947 assert(wand != (MagickWand *) NULL); 2948 assert(wand->signature == MagickWandSignature); 2949 if (wand->debug != MagickFalse) 2950 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2951 if (wand->images == (Image *) NULL) 2952 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2953 emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception); 2954 if (emboss_image == (Image *) NULL) 2955 return(MagickFalse); 2956 ReplaceImageInList(&wand->images,emboss_image); 2957 return(MagickTrue); 2958 } 2959 2960 /* 2962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2963 % % 2964 % % 2965 % % 2966 % M a g i c k E n c i p h e r I m a g e % 2967 % % 2968 % % 2969 % % 2970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2971 % 2972 % MagickEncipherImage() converts plaint pixels to cipher pixels. 2973 % 2974 % The format of the MagickEncipherImage method is: 2975 % 2976 % MagickBooleanType MagickEncipherImage(MagickWand *wand, 2977 % const char *passphrase) 2978 % 2979 % A description of each parameter follows: 2980 % 2981 % o wand: the magick wand. 2982 % 2983 % o passphrase: the passphrase. 2984 % 2985 */ 2986 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand, 2987 const char *passphrase) 2988 { 2989 assert(wand != (MagickWand *) NULL); 2990 assert(wand->signature == MagickWandSignature); 2991 if (wand->debug != MagickFalse) 2992 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 2993 if (wand->images == (Image *) NULL) 2994 ThrowWandException(WandError,"ContainsNoImages",wand->name); 2995 return(EncipherImage(wand->images,passphrase,wand->exception)); 2996 } 2997 2998 /* 3000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3001 % % 3002 % % 3003 % % 3004 % M a g i c k E n h a n c e I m a g e % 3005 % % 3006 % % 3007 % % 3008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3009 % 3010 % MagickEnhanceImage() applies a digital filter that improves the quality of a 3011 % noisy image. 3012 % 3013 % The format of the MagickEnhanceImage method is: 3014 % 3015 % MagickBooleanType MagickEnhanceImage(MagickWand *wand) 3016 % 3017 % A description of each parameter follows: 3018 % 3019 % o wand: the magick wand. 3020 % 3021 */ 3022 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand) 3023 { 3024 Image 3025 *enhance_image; 3026 3027 assert(wand != (MagickWand *) NULL); 3028 assert(wand->signature == MagickWandSignature); 3029 if (wand->debug != MagickFalse) 3030 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3031 if (wand->images == (Image *) NULL) 3032 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3033 enhance_image=EnhanceImage(wand->images,wand->exception); 3034 if (enhance_image == (Image *) NULL) 3035 return(MagickFalse); 3036 ReplaceImageInList(&wand->images,enhance_image); 3037 return(MagickTrue); 3038 } 3039 3040 /* 3042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3043 % % 3044 % % 3045 % % 3046 % M a g i c k E q u a l i z e I m a g e % 3047 % % 3048 % % 3049 % % 3050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3051 % 3052 % MagickEqualizeImage() equalizes the image histogram. 3053 % 3054 % The format of the MagickEqualizeImage method is: 3055 % 3056 % MagickBooleanType MagickEqualizeImage(MagickWand *wand) 3057 % 3058 % A description of each parameter follows: 3059 % 3060 % o wand: the magick wand. 3061 % 3062 % o channel: the image channel(s). 3063 % 3064 */ 3065 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand) 3066 { 3067 MagickBooleanType 3068 status; 3069 3070 assert(wand != (MagickWand *) NULL); 3071 assert(wand->signature == MagickWandSignature); 3072 if (wand->debug != MagickFalse) 3073 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3074 if (wand->images == (Image *) NULL) 3075 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3076 status=EqualizeImage(wand->images,wand->exception); 3077 return(status); 3078 } 3079 3080 /* 3082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3083 % % 3084 % % 3085 % % 3086 % M a g i c k E v a l u a t e I m a g e % 3087 % % 3088 % % 3089 % % 3090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3091 % 3092 % MagickEvaluateImage() applys an arithmetic, relational, or logical 3093 % expression to an image. Use these operators to lighten or darken an image, 3094 % to increase or decrease contrast in an image, or to produce the "negative" 3095 % of an image. 3096 % 3097 % The format of the MagickEvaluateImage method is: 3098 % 3099 % MagickBooleanType MagickEvaluateImage(MagickWand *wand, 3100 % const MagickEvaluateOperator operator,const double value) 3101 % MagickBooleanType MagickEvaluateImages(MagickWand *wand, 3102 % const MagickEvaluateOperator operator) 3103 % 3104 % A description of each parameter follows: 3105 % 3106 % o wand: the magick wand. 3107 % 3108 % o op: A channel operator. 3109 % 3110 % o value: A value value. 3111 % 3112 */ 3113 3114 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand, 3115 const MagickEvaluateOperator op) 3116 { 3117 Image 3118 *evaluate_image; 3119 3120 assert(wand != (MagickWand *) NULL); 3121 assert(wand->signature == MagickWandSignature); 3122 if (wand->debug != MagickFalse) 3123 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3124 if (wand->images == (Image *) NULL) 3125 return((MagickWand *) NULL); 3126 evaluate_image=EvaluateImages(wand->images,op,wand->exception); 3127 if (evaluate_image == (Image *) NULL) 3128 return((MagickWand *) NULL); 3129 return(CloneMagickWandFromImages(wand,evaluate_image)); 3130 } 3131 3132 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand, 3133 const MagickEvaluateOperator op,const double value) 3134 { 3135 MagickBooleanType 3136 status; 3137 3138 assert(wand != (MagickWand *) NULL); 3139 assert(wand->signature == MagickWandSignature); 3140 if (wand->debug != MagickFalse) 3141 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3142 if (wand->images == (Image *) NULL) 3143 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3144 status=EvaluateImage(wand->images,op,value,wand->exception); 3145 return(status); 3146 } 3147 3148 /* 3150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3151 % % 3152 % % 3153 % % 3154 % M a g i c k E x p o r t I m a g e P i x e l s % 3155 % % 3156 % % 3157 % % 3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3159 % 3160 % MagickExportImagePixels() extracts pixel data from an image and returns it 3161 % to you. The method returns MagickTrue on success otherwise MagickFalse if 3162 % an error is encountered. The data is returned as char, short int, int, 3163 % ssize_t, float, or double in the order specified by map. 3164 % 3165 % Suppose you want to extract the first scanline of a 640x480 image as 3166 % character data in red-green-blue order: 3167 % 3168 % MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels); 3169 % 3170 % The format of the MagickExportImagePixels method is: 3171 % 3172 % MagickBooleanType MagickExportImagePixels(MagickWand *wand, 3173 % const ssize_t x,const ssize_t y,const size_t columns, 3174 % const size_t rows,const char *map,const StorageType storage, 3175 % void *pixels) 3176 % 3177 % A description of each parameter follows: 3178 % 3179 % o wand: the magick wand. 3180 % 3181 % o x, y, columns, rows: These values define the perimeter 3182 % of a region of pixels you want to extract. 3183 % 3184 % o map: This string reflects the expected ordering of the pixel array. 3185 % It can be any combination or order of R = red, G = green, B = blue, 3186 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan, 3187 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale), 3188 % P = pad. 3189 % 3190 % o storage: Define the data type of the pixels. Float and double types are 3191 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from 3192 % these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel, 3193 % LongPixel, QuantumPixel, or ShortPixel. 3194 % 3195 % o pixels: This array of values contain the pixel components as defined by 3196 % map and type. You must preallocate this array where the expected 3197 % length varies depending on the values of width, height, map, and type. 3198 % 3199 */ 3200 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand, 3201 const ssize_t x,const ssize_t y,const size_t columns, 3202 const size_t rows,const char *map,const StorageType storage, 3203 void *pixels) 3204 { 3205 MagickBooleanType 3206 status; 3207 3208 assert(wand != (MagickWand *) NULL); 3209 assert(wand->signature == MagickWandSignature); 3210 if (wand->debug != MagickFalse) 3211 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3212 if (wand->images == (Image *) NULL) 3213 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3214 status=ExportImagePixels(wand->images,x,y,columns,rows,map, 3215 storage,pixels,wand->exception); 3216 return(status); 3217 } 3218 3219 /* 3221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3222 % % 3223 % % 3224 % % 3225 % M a g i c k E x t e n t I m a g e % 3226 % % 3227 % % 3228 % % 3229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3230 % 3231 % MagickExtentImage() extends the image as defined by the geometry, gravity, 3232 % and wand background color. Set the (x,y) offset of the geometry to move 3233 % the original wand relative to the extended wand. 3234 % 3235 % The format of the MagickExtentImage method is: 3236 % 3237 % MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width, 3238 % const size_t height,const ssize_t x,const ssize_t y) 3239 % 3240 % A description of each parameter follows: 3241 % 3242 % o wand: the magick wand. 3243 % 3244 % o width: the region width. 3245 % 3246 % o height: the region height. 3247 % 3248 % o x: the region x offset. 3249 % 3250 % o y: the region y offset. 3251 % 3252 */ 3253 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand, 3254 const size_t width,const size_t height,const ssize_t x,const ssize_t y) 3255 { 3256 Image 3257 *extent_image; 3258 3259 RectangleInfo 3260 extent; 3261 3262 assert(wand != (MagickWand *) NULL); 3263 assert(wand->signature == MagickWandSignature); 3264 if (wand->debug != MagickFalse) 3265 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3266 if (wand->images == (Image *) NULL) 3267 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3268 extent.width=width; 3269 extent.height=height; 3270 extent.x=x; 3271 extent.y=y; 3272 extent_image=ExtentImage(wand->images,&extent,wand->exception); 3273 if (extent_image == (Image *) NULL) 3274 return(MagickFalse); 3275 ReplaceImageInList(&wand->images,extent_image); 3276 return(MagickTrue); 3277 } 3278 3279 /* 3281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3282 % % 3283 % % 3284 % % 3285 % M a g i c k F l i p I m a g e % 3286 % % 3287 % % 3288 % % 3289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3290 % 3291 % MagickFlipImage() creates a vertical mirror image by reflecting the pixels 3292 % around the central x-axis. 3293 % 3294 % The format of the MagickFlipImage method is: 3295 % 3296 % MagickBooleanType MagickFlipImage(MagickWand *wand) 3297 % 3298 % A description of each parameter follows: 3299 % 3300 % o wand: the magick wand. 3301 % 3302 */ 3303 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand) 3304 { 3305 Image 3306 *flip_image; 3307 3308 assert(wand != (MagickWand *) NULL); 3309 assert(wand->signature == MagickWandSignature); 3310 if (wand->debug != MagickFalse) 3311 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3312 if (wand->images == (Image *) NULL) 3313 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3314 flip_image=FlipImage(wand->images,wand->exception); 3315 if (flip_image == (Image *) NULL) 3316 return(MagickFalse); 3317 ReplaceImageInList(&wand->images,flip_image); 3318 return(MagickTrue); 3319 } 3320 3321 /* 3323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3324 % % 3325 % % 3326 % % 3327 % M a g i c k F l o o d f i l l P a i n t I m a g e % 3328 % % 3329 % % 3330 % % 3331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3332 % 3333 % MagickFloodfillPaintImage() changes the color value of any pixel that matches 3334 % target and is an immediate neighbor. If the method FillToBorderMethod is 3335 % specified, the color value is changed for any neighbor pixel that does not 3336 % match the bordercolor member of image. 3337 % 3338 % The format of the MagickFloodfillPaintImage method is: 3339 % 3340 % MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand, 3341 % const PixelWand *fill,const double fuzz,const PixelWand *bordercolor, 3342 % const ssize_t x,const ssize_t y,const MagickBooleanType invert) 3343 % 3344 % A description of each parameter follows: 3345 % 3346 % o wand: the magick wand. 3347 % 3348 % o fill: the floodfill color pixel wand. 3349 % 3350 % o fuzz: By default target must match a particular pixel color 3351 % exactly. However, in many cases two colors may differ by a small amount. 3352 % The fuzz member of image defines how much tolerance is acceptable to 3353 % consider two colors as the same. For example, set fuzz to 10 and the 3354 % color red at intensities of 100 and 102 respectively are now interpreted 3355 % as the same color for the purposes of the floodfill. 3356 % 3357 % o bordercolor: the border color pixel wand. 3358 % 3359 % o x,y: the starting location of the operation. 3360 % 3361 % o invert: paint any pixel that does not match the target color. 3362 % 3363 */ 3364 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand, 3365 const PixelWand *fill,const double fuzz,const PixelWand *bordercolor, 3366 const ssize_t x,const ssize_t y,const MagickBooleanType invert) 3367 { 3368 DrawInfo 3369 *draw_info; 3370 3371 MagickBooleanType 3372 status; 3373 3374 PixelInfo 3375 target; 3376 3377 assert(wand != (MagickWand *) NULL); 3378 assert(wand->signature == MagickWandSignature); 3379 if (wand->debug != MagickFalse) 3380 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3381 if (wand->images == (Image *) NULL) 3382 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3383 draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL); 3384 PixelGetQuantumPacket(fill,&draw_info->fill); 3385 (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x % 3386 wand->images->columns,y % wand->images->rows,&target,wand->exception); 3387 if (bordercolor != (PixelWand *) NULL) 3388 PixelGetMagickColor(bordercolor,&target); 3389 wand->images->fuzz=fuzz; 3390 status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert, 3391 wand->exception); 3392 draw_info=DestroyDrawInfo(draw_info); 3393 return(status); 3394 } 3395 3396 /* 3398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3399 % % 3400 % % 3401 % % 3402 % M a g i c k F l o p I m a g e % 3403 % % 3404 % % 3405 % % 3406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3407 % 3408 % MagickFlopImage() creates a horizontal mirror image by reflecting the pixels 3409 % around the central y-axis. 3410 % 3411 % The format of the MagickFlopImage method is: 3412 % 3413 % MagickBooleanType MagickFlopImage(MagickWand *wand) 3414 % 3415 % A description of each parameter follows: 3416 % 3417 % o wand: the magick wand. 3418 % 3419 */ 3420 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand) 3421 { 3422 Image 3423 *flop_image; 3424 3425 assert(wand != (MagickWand *) NULL); 3426 assert(wand->signature == MagickWandSignature); 3427 if (wand->debug != MagickFalse) 3428 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3429 if (wand->images == (Image *) NULL) 3430 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3431 flop_image=FlopImage(wand->images,wand->exception); 3432 if (flop_image == (Image *) NULL) 3433 return(MagickFalse); 3434 ReplaceImageInList(&wand->images,flop_image); 3435 return(MagickTrue); 3436 } 3437 3438 /* 3440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3441 % % 3442 % % 3443 % % 3444 % M a g i c k F o u r i e r T r a n s f o r m I m a g e % 3445 % % 3446 % % 3447 % % 3448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3449 % 3450 % MagickForwardFourierTransformImage() implements the discrete Fourier 3451 % transform (DFT) of the image either as a magnitude / phase or real / 3452 % imaginary image pair. 3453 % 3454 % The format of the MagickForwardFourierTransformImage method is: 3455 % 3456 % MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand, 3457 % const MagickBooleanType magnitude) 3458 % 3459 % A description of each parameter follows: 3460 % 3461 % o wand: the magick wand. 3462 % 3463 % o magnitude: if true, return as magnitude / phase pair otherwise a real / 3464 % imaginary image pair. 3465 % 3466 */ 3467 WandExport MagickBooleanType MagickForwardFourierTransformImage( 3468 MagickWand *wand,const MagickBooleanType magnitude) 3469 { 3470 Image 3471 *forward_image; 3472 3473 assert(wand != (MagickWand *) NULL); 3474 assert(wand->signature == MagickWandSignature); 3475 if (wand->debug != MagickFalse) 3476 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3477 if (wand->images == (Image *) NULL) 3478 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3479 forward_image=ForwardFourierTransformImage(wand->images,magnitude, 3480 wand->exception); 3481 if (forward_image == (Image *) NULL) 3482 return(MagickFalse); 3483 ReplaceImageInList(&wand->images,forward_image); 3484 return(MagickTrue); 3485 } 3486 3487 /* 3489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3490 % % 3491 % % 3492 % % 3493 % M a g i c k F r a m e I m a g e % 3494 % % 3495 % % 3496 % % 3497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3498 % 3499 % MagickFrameImage() adds a simulated three-dimensional border around the 3500 % image. The width and height specify the border width of the vertical and 3501 % horizontal sides of the frame. The inner and outer bevels indicate the 3502 % width of the inner and outer shadows of the frame. 3503 % 3504 % The format of the MagickFrameImage method is: 3505 % 3506 % MagickBooleanType MagickFrameImage(MagickWand *wand, 3507 % const PixelWand *matte_color,const size_t width, 3508 % const size_t height,const ssize_t inner_bevel, 3509 % const ssize_t outer_bevel,const CompositeOperator compose) 3510 % 3511 % A description of each parameter follows: 3512 % 3513 % o wand: the magick wand. 3514 % 3515 % o matte_color: the frame color pixel wand. 3516 % 3517 % o width: the border width. 3518 % 3519 % o height: the border height. 3520 % 3521 % o inner_bevel: the inner bevel width. 3522 % 3523 % o outer_bevel: the outer bevel width. 3524 % 3525 % o compose: the composite operator. 3526 % 3527 */ 3528 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand, 3529 const PixelWand *matte_color,const size_t width,const size_t height, 3530 const ssize_t inner_bevel,const ssize_t outer_bevel, 3531 const CompositeOperator compose) 3532 { 3533 Image 3534 *frame_image; 3535 3536 FrameInfo 3537 frame_info; 3538 3539 assert(wand != (MagickWand *) NULL); 3540 assert(wand->signature == MagickWandSignature); 3541 if (wand->debug != MagickFalse) 3542 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3543 if (wand->images == (Image *) NULL) 3544 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3545 (void) memset(&frame_info,0,sizeof(frame_info)); 3546 frame_info.width=wand->images->columns+2*width; 3547 frame_info.height=wand->images->rows+2*height; 3548 frame_info.x=(ssize_t) width; 3549 frame_info.y=(ssize_t) height; 3550 frame_info.inner_bevel=inner_bevel; 3551 frame_info.outer_bevel=outer_bevel; 3552 PixelGetQuantumPacket(matte_color,&wand->images->matte_color); 3553 frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception); 3554 if (frame_image == (Image *) NULL) 3555 return(MagickFalse); 3556 ReplaceImageInList(&wand->images,frame_image); 3557 return(MagickTrue); 3558 } 3559 3560 /* 3562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3563 % % 3564 % % 3565 % % 3566 % M a g i c k F u n c t i o n I m a g e % 3567 % % 3568 % % 3569 % % 3570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3571 % 3572 % MagickFunctionImage() applys an arithmetic, relational, or logical 3573 % expression to an image. Use these operators to lighten or darken an image, 3574 % to increase or decrease contrast in an image, or to produce the "negative" 3575 % of an image. 3576 % 3577 % The format of the MagickFunctionImage method is: 3578 % 3579 % MagickBooleanType MagickFunctionImage(MagickWand *wand, 3580 % const MagickFunction function,const size_t number_arguments, 3581 % const double *arguments) 3582 % 3583 % A description of each parameter follows: 3584 % 3585 % o wand: the magick wand. 3586 % 3587 % o function: the image function. 3588 % 3589 % o number_arguments: the number of function arguments. 3590 % 3591 % o arguments: the function arguments. 3592 % 3593 */ 3594 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand, 3595 const MagickFunction function,const size_t number_arguments, 3596 const double *arguments) 3597 { 3598 MagickBooleanType 3599 status; 3600 3601 assert(wand != (MagickWand *) NULL); 3602 assert(wand->signature == MagickWandSignature); 3603 if (wand->debug != MagickFalse) 3604 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3605 if (wand->images == (Image *) NULL) 3606 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3607 status=FunctionImage(wand->images,function,number_arguments,arguments, 3608 wand->exception); 3609 return(status); 3610 } 3611 3612 /* 3614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3615 % % 3616 % % 3617 % % 3618 % M a g i c k F x I m a g e % 3619 % % 3620 % % 3621 % % 3622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3623 % 3624 % MagickFxImage() evaluate expression for each pixel in the image. 3625 % 3626 % The format of the MagickFxImage method is: 3627 % 3628 % MagickWand *MagickFxImage(MagickWand *wand,const char *expression) 3629 % 3630 % A description of each parameter follows: 3631 % 3632 % o wand: the magick wand. 3633 % 3634 % o expression: the expression. 3635 % 3636 */ 3637 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression) 3638 { 3639 Image 3640 *fx_image; 3641 3642 assert(wand != (MagickWand *) NULL); 3643 assert(wand->signature == MagickWandSignature); 3644 if (wand->debug != MagickFalse) 3645 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3646 if (wand->images == (Image *) NULL) 3647 return((MagickWand *) NULL); 3648 fx_image=FxImage(wand->images,expression,wand->exception); 3649 if (fx_image == (Image *) NULL) 3650 return((MagickWand *) NULL); 3651 return(CloneMagickWandFromImages(wand,fx_image)); 3652 } 3653 3654 /* 3656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3657 % % 3658 % % 3659 % % 3660 % M a g i c k G a m m a I m a g e % 3661 % % 3662 % % 3663 % % 3664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3665 % 3666 % MagickGammaImage() gamma-corrects an image. The same image viewed on 3667 % different devices will have perceptual differences in the way the image's 3668 % intensities are represented on the screen. Specify individual gamma levels 3669 % for the red, green, and blue channels, or adjust all three with the gamma 3670 % parameter. Values typically range from 0.8 to 2.3. 3671 % 3672 % You can also reduce the influence of a particular channel with a gamma 3673 % value of 0. 3674 % 3675 % The format of the MagickGammaImage method is: 3676 % 3677 % MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma) 3678 % 3679 % A description of each parameter follows: 3680 % 3681 % o wand: the magick wand. 3682 % 3683 % o level: Define the level of gamma correction. 3684 % 3685 */ 3686 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand, 3687 const double gamma) 3688 { 3689 MagickBooleanType 3690 status; 3691 3692 assert(wand != (MagickWand *) NULL); 3693 assert(wand->signature == MagickWandSignature); 3694 if (wand->debug != MagickFalse) 3695 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3696 if (wand->images == (Image *) NULL) 3697 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3698 status=GammaImage(wand->images,gamma,wand->exception); 3699 return(status); 3700 } 3701 3702 /* 3704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3705 % % 3706 % % 3707 % % 3708 % M a g i c k G a u s s i a n B l u r I m a g e % 3709 % % 3710 % % 3711 % % 3712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3713 % 3714 % MagickGaussianBlurImage() blurs an image. We convolve the image with a 3715 % Gaussian operator of the given radius and standard deviation (sigma). 3716 % For reasonable results, the radius should be larger than sigma. Use a 3717 % radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you. 3718 % 3719 % The format of the MagickGaussianBlurImage method is: 3720 % 3721 % MagickBooleanType MagickGaussianBlurImage(MagickWand *wand, 3722 % const double radius,const double sigma) 3723 % 3724 % A description of each parameter follows: 3725 % 3726 % o wand: the magick wand. 3727 % 3728 % o radius: the radius of the Gaussian, in pixels, not counting the center 3729 % pixel. 3730 % 3731 % o sigma: the standard deviation of the Gaussian, in pixels. 3732 % 3733 */ 3734 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand, 3735 const double radius,const double sigma) 3736 { 3737 Image 3738 *blur_image; 3739 3740 assert(wand != (MagickWand *) NULL); 3741 assert(wand->signature == MagickWandSignature); 3742 if (wand->debug != MagickFalse) 3743 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3744 if (wand->images == (Image *) NULL) 3745 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3746 blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception); 3747 if (blur_image == (Image *) NULL) 3748 return(MagickFalse); 3749 ReplaceImageInList(&wand->images,blur_image); 3750 return(MagickTrue); 3751 } 3752 3753 /* 3755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3756 % % 3757 % % 3758 % % 3759 % M a g i c k G e t I m a g e % 3760 % % 3761 % % 3762 % % 3763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3764 % 3765 % MagickGetImage() gets the image at the current image index. 3766 % 3767 % The format of the MagickGetImage method is: 3768 % 3769 % MagickWand *MagickGetImage(MagickWand *wand) 3770 % 3771 % A description of each parameter follows: 3772 % 3773 % o wand: the magick wand. 3774 % 3775 */ 3776 WandExport MagickWand *MagickGetImage(MagickWand *wand) 3777 { 3778 Image 3779 *image; 3780 3781 assert(wand != (MagickWand *) NULL); 3782 assert(wand->signature == MagickWandSignature); 3783 if (wand->debug != MagickFalse) 3784 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3785 if (wand->images == (Image *) NULL) 3786 { 3787 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 3788 "ContainsNoImages","`%s'",wand->name); 3789 return((MagickWand *) NULL); 3790 } 3791 image=CloneImage(wand->images,0,0,MagickTrue,wand->exception); 3792 if (image == (Image *) NULL) 3793 return((MagickWand *) NULL); 3794 return(CloneMagickWandFromImages(wand,image)); 3795 } 3796 3797 /* 3799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3800 % % 3801 % % 3802 % % 3803 % M a g i c k G e t I m a g e A l p h a C h a n n e l % 3804 % % 3805 % % 3806 % % 3807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3808 % 3809 % MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel 3810 % is not activated. That is, the image is RGB rather than RGBA or CMYK rather 3811 % than CMYKA. 3812 % 3813 % The format of the MagickGetImageAlphaChannel method is: 3814 % 3815 % MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand) 3816 % 3817 % A description of each parameter follows: 3818 % 3819 % o wand: the magick wand. 3820 % 3821 */ 3822 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand) 3823 { 3824 assert(wand != (MagickWand *) NULL); 3825 assert(wand->signature == MagickWandSignature); 3826 if (wand->debug != MagickFalse) 3827 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3828 if (wand->images == (Image *) NULL) 3829 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3830 return(GetImageAlphaChannel(wand->images)); 3831 } 3832 3833 /* 3835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3836 % % 3837 % % 3838 % % 3839 % M a g i c k G e t I m a g e C l i p M a s k % 3840 % % 3841 % % 3842 % % 3843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3844 % 3845 % MagickGetImageMask() gets the image clip mask at the current image index. 3846 % 3847 % The format of the MagickGetImageMask method is: 3848 % 3849 % MagickWand *MagickGetImageMask(MagickWand *wand) 3850 % 3851 % A description of each parameter follows: 3852 % 3853 % o wand: the magick wand. 3854 % 3855 % o type: type of mask, ReadPixelMask or WritePixelMask. 3856 % 3857 */ 3858 WandExport MagickWand *MagickGetImageMask(MagickWand *wand, 3859 const PixelMask type) 3860 { 3861 Image 3862 *image; 3863 3864 assert(wand != (MagickWand *) NULL); 3865 assert(wand->signature == MagickWandSignature); 3866 if (wand->debug != MagickFalse) 3867 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3868 if (wand->images == (Image *) NULL) 3869 { 3870 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 3871 "ContainsNoImages","`%s'",wand->name); 3872 return((MagickWand *) NULL); 3873 } 3874 image=GetImageMask(wand->images,type,wand->exception); 3875 if (image == (Image *) NULL) 3876 return((MagickWand *) NULL); 3877 return(CloneMagickWandFromImages(wand,image)); 3878 } 3879 3880 /* 3882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3883 % % 3884 % % 3885 % % 3886 % M a g i c k G e t I m a g e B a c k g r o u n d C o l o r % 3887 % % 3888 % % 3889 % % 3890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3891 % 3892 % MagickGetImageBackgroundColor() returns the image background color. 3893 % 3894 % The format of the MagickGetImageBackgroundColor method is: 3895 % 3896 % MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand, 3897 % PixelWand *background_color) 3898 % 3899 % A description of each parameter follows: 3900 % 3901 % o wand: the magick wand. 3902 % 3903 % o background_color: Return the background color. 3904 % 3905 */ 3906 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand, 3907 PixelWand *background_color) 3908 { 3909 assert(wand != (MagickWand *) NULL); 3910 assert(wand->signature == MagickWandSignature); 3911 if (wand->debug != MagickFalse) 3912 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3913 if (wand->images == (Image *) NULL) 3914 ThrowWandException(WandError,"ContainsNoImages",wand->name); 3915 PixelSetPixelColor(background_color,&wand->images->background_color); 3916 return(MagickTrue); 3917 } 3918 3919 /* 3921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3922 % % 3923 % % 3924 % % 3925 % M a g i c k G e t I m a g e B l o b % 3926 % % 3927 % % 3928 % % 3929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3930 % 3931 % MagickGetImageBlob() implements direct to memory image formats. It returns 3932 % the image as a blob (a formatted "file" in memory) and its length, starting 3933 % from the current position in the image sequence. Use MagickSetImageFormat() 3934 % to set the format to write to the blob (GIF, JPEG, PNG, etc.). 3935 % 3936 % Utilize MagickResetIterator() to ensure the write is from the beginning of 3937 % the image sequence. 3938 % 3939 % Use MagickRelinquishMemory() to free the blob when you are done with it. 3940 % 3941 % The format of the MagickGetImageBlob method is: 3942 % 3943 % unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length) 3944 % 3945 % A description of each parameter follows: 3946 % 3947 % o wand: the magick wand. 3948 % 3949 % o length: the length of the blob. 3950 % 3951 */ 3952 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length) 3953 { 3954 unsigned char 3955 *blob; 3956 3957 assert(wand != (MagickWand *) NULL); 3958 assert(wand->signature == MagickWandSignature); 3959 if (wand->debug != MagickFalse) 3960 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 3961 if (wand->images == (Image *) NULL) 3962 { 3963 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 3964 "ContainsNoImages","`%s'",wand->name); 3965 return((unsigned char *) NULL); 3966 } 3967 blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length, 3968 wand->exception); 3969 return(blob); 3970 } 3971 3972 /* 3974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3975 % % 3976 % % 3977 % % 3978 % M a g i c k G e t I m a g e s B l o b % 3979 % % 3980 % % 3981 % % 3982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3983 % 3984 % MagickGetImagesBlob() implements direct to memory image formats. It 3985 % returns the image sequence as a blob and its length. The format of the image 3986 % determines the format of the returned blob (GIF, JPEG, PNG, etc.). To 3987 % return a different image format, use MagickSetImageFormat(). 3988 % 3989 % Note, some image formats do not permit multiple images to the same image 3990 % stream (e.g. JPEG). in this instance, just the first image of the 3991 % sequence is returned as a blob. 3992 % 3993 % The format of the MagickGetImagesBlob method is: 3994 % 3995 % unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length) 3996 % 3997 % A description of each parameter follows: 3998 % 3999 % o wand: the magick wand. 4000 % 4001 % o length: the length of the blob. 4002 % 4003 */ 4004 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length) 4005 { 4006 unsigned char 4007 *blob; 4008 4009 assert(wand != (MagickWand *) NULL); 4010 assert(wand->signature == MagickWandSignature); 4011 if (wand->debug != MagickFalse) 4012 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4013 if (wand->images == (Image *) NULL) 4014 { 4015 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4016 "ContainsNoImages","`%s'",wand->name); 4017 return((unsigned char *) NULL); 4018 } 4019 blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList( 4020 wand->images),length,wand->exception); 4021 return(blob); 4022 } 4023 4024 /* 4026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4027 % % 4028 % % 4029 % % 4030 % M a g i c k G e t I m a g e B l u e P r i m a r y % 4031 % % 4032 % % 4033 % % 4034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4035 % 4036 % MagickGetImageBluePrimary() returns the chromaticy blue primary point for the 4037 % image. 4038 % 4039 % The format of the MagickGetImageBluePrimary method is: 4040 % 4041 % MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x, 4042 % double *y,double *z) 4043 % 4044 % A description of each parameter follows: 4045 % 4046 % o wand: the magick wand. 4047 % 4048 % o x: the chromaticity blue primary x-point. 4049 % 4050 % o y: the chromaticity blue primary y-point. 4051 % 4052 % o z: the chromaticity blue primary z-point. 4053 % 4054 */ 4055 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand, 4056 double *x,double *y,double *z) 4057 { 4058 assert(wand != (MagickWand *) NULL); 4059 assert(wand->signature == MagickWandSignature); 4060 if (wand->debug != MagickFalse) 4061 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4062 if (wand->images == (Image *) NULL) 4063 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4064 *x=wand->images->chromaticity.blue_primary.x; 4065 *y=wand->images->chromaticity.blue_primary.y; 4066 *z=wand->images->chromaticity.blue_primary.z; 4067 return(MagickTrue); 4068 } 4069 4070 /* 4072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4073 % % 4074 % % 4075 % % 4076 % M a g i c k G e t I m a g e B o r d e r C o l o r % 4077 % % 4078 % % 4079 % % 4080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4081 % 4082 % MagickGetImageBorderColor() returns the image border color. 4083 % 4084 % The format of the MagickGetImageBorderColor method is: 4085 % 4086 % MagickBooleanType MagickGetImageBorderColor(MagickWand *wand, 4087 % PixelWand *border_color) 4088 % 4089 % A description of each parameter follows: 4090 % 4091 % o wand: the magick wand. 4092 % 4093 % o border_color: Return the border color. 4094 % 4095 */ 4096 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand, 4097 PixelWand *border_color) 4098 { 4099 assert(wand != (MagickWand *) NULL); 4100 assert(wand->signature == MagickWandSignature); 4101 if (wand->debug != MagickFalse) 4102 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4103 if (wand->images == (Image *) NULL) 4104 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4105 PixelSetPixelColor(border_color,&wand->images->border_color); 4106 return(MagickTrue); 4107 } 4108 4109 /* 4111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4112 % % 4113 % % 4114 % % 4115 % M a g i c k G e t I m a g e F e a t u r e s % 4116 % % 4117 % % 4118 % % 4119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4120 % 4121 % MagickGetImageFeatures() returns features for each channel in the 4122 % image in each of four directions (horizontal, vertical, left and right 4123 % diagonals) for the specified distance. The features include the angular 4124 % second moment, contrast, correlation, sum of squares: variance, inverse 4125 % difference moment, sum average, sum varience, sum entropy, entropy, 4126 % difference variance, difference entropy, information measures of 4127 % correlation 1, information measures of correlation 2, and maximum 4128 % correlation coefficient. You can access the red channel contrast, for 4129 % example, like this: 4130 % 4131 % channel_features=MagickGetImageFeatures(wand,1); 4132 % contrast=channel_features[RedPixelChannel].contrast[0]; 4133 % 4134 % Use MagickRelinquishMemory() to free the statistics buffer. 4135 % 4136 % The format of the MagickGetImageFeatures method is: 4137 % 4138 % ChannelFeatures *MagickGetImageFeatures(MagickWand *wand, 4139 % const size_t distance) 4140 % 4141 % A description of each parameter follows: 4142 % 4143 % o wand: the magick wand. 4144 % 4145 % o distance: the distance. 4146 % 4147 */ 4148 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand, 4149 const size_t distance) 4150 { 4151 assert(wand != (MagickWand *) NULL); 4152 assert(wand->signature == MagickWandSignature); 4153 if (wand->debug != MagickFalse) 4154 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4155 if (wand->images == (Image *) NULL) 4156 { 4157 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4158 "ContainsNoImages","`%s'",wand->name); 4159 return((ChannelFeatures *) NULL); 4160 } 4161 return(GetImageFeatures(wand->images,distance,wand->exception)); 4162 } 4163 4164 /* 4166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4167 % % 4168 % % 4169 % % 4170 % M a g i c k G e t I m a g e K u r t o s i s % 4171 % % 4172 % % 4173 % % 4174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4175 % 4176 % MagickGetImageKurtosis() gets the kurtosis and skewness of one or 4177 % more image channels. 4178 % 4179 % The format of the MagickGetImageKurtosis method is: 4180 % 4181 % MagickBooleanType MagickGetImageKurtosis(MagickWand *wand, 4182 % double *kurtosis,double *skewness) 4183 % 4184 % A description of each parameter follows: 4185 % 4186 % o wand: the magick wand. 4187 % 4188 % o kurtosis: The kurtosis for the specified channel(s). 4189 % 4190 % o skewness: The skewness for the specified channel(s). 4191 % 4192 */ 4193 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand, 4194 double *kurtosis,double *skewness) 4195 { 4196 MagickBooleanType 4197 status; 4198 4199 assert(wand != (MagickWand *) NULL); 4200 assert(wand->signature == MagickWandSignature); 4201 if (wand->debug != MagickFalse) 4202 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4203 if (wand->images == (Image *) NULL) 4204 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4205 status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception); 4206 return(status); 4207 } 4208 4209 /* 4211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4212 % % 4213 % % 4214 % % 4215 % M a g i c k G e t I m a g e M e a n % 4216 % % 4217 % % 4218 % % 4219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4220 % 4221 % MagickGetImageMean() gets the mean and standard deviation of one or more 4222 % image channels. 4223 % 4224 % The format of the MagickGetImageMean method is: 4225 % 4226 % MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean, 4227 % double *standard_deviation) 4228 % 4229 % A description of each parameter follows: 4230 % 4231 % o wand: the magick wand. 4232 % 4233 % o channel: the image channel(s). 4234 % 4235 % o mean: The mean pixel value for the specified channel(s). 4236 % 4237 % o standard_deviation: The standard deviation for the specified channel(s). 4238 % 4239 */ 4240 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean, 4241 double *standard_deviation) 4242 { 4243 MagickBooleanType 4244 status; 4245 4246 assert(wand != (MagickWand *) NULL); 4247 assert(wand->signature == MagickWandSignature); 4248 if (wand->debug != MagickFalse) 4249 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4250 if (wand->images == (Image *) NULL) 4251 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4252 status=GetImageMean(wand->images,mean,standard_deviation,wand->exception); 4253 return(status); 4254 } 4255 4256 /* 4258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4259 % % 4260 % % 4261 % % 4262 % M a g i c k G e t I m a g e R a n g e % 4263 % % 4264 % % 4265 % % 4266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4267 % 4268 % MagickGetImageRange() gets the range for one or more image channels. 4269 % 4270 % The format of the MagickGetImageRange method is: 4271 % 4272 % MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima, 4273 % double *maxima) 4274 % 4275 % A description of each parameter follows: 4276 % 4277 % o wand: the magick wand. 4278 % 4279 % o minima: The minimum pixel value for the specified channel(s). 4280 % 4281 % o maxima: The maximum pixel value for the specified channel(s). 4282 % 4283 */ 4284 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand, 4285 double *minima,double *maxima) 4286 { 4287 MagickBooleanType 4288 status; 4289 4290 assert(wand != (MagickWand *) NULL); 4291 assert(wand->signature == MagickWandSignature); 4292 if (wand->debug != MagickFalse) 4293 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4294 if (wand->images == (Image *) NULL) 4295 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4296 status=GetImageRange(wand->images,minima,maxima,wand->exception); 4297 return(status); 4298 } 4299 4300 /* 4302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4303 % % 4304 % % 4305 % % 4306 % M a g i c k G e t I m a g e S t a t i s t i c s % 4307 % % 4308 % % 4309 % % 4310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4311 % 4312 % MagickGetImageStatistics() returns statistics for each channel in the 4313 % image. The statistics include the channel depth, its minima and 4314 % maxima, the mean, the standard deviation, the kurtosis and the skewness. 4315 % You can access the red channel mean, for example, like this: 4316 % 4317 % channel_statistics=MagickGetImageStatistics(wand); 4318 % red_mean=channel_statistics[RedPixelChannel].mean; 4319 % 4320 % Use MagickRelinquishMemory() to free the statistics buffer. 4321 % 4322 % The format of the MagickGetImageStatistics method is: 4323 % 4324 % ChannelStatistics *MagickGetImageStatistics(MagickWand *wand) 4325 % 4326 % A description of each parameter follows: 4327 % 4328 % o wand: the magick wand. 4329 % 4330 */ 4331 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand) 4332 { 4333 assert(wand != (MagickWand *) NULL); 4334 assert(wand->signature == MagickWandSignature); 4335 if (wand->debug != MagickFalse) 4336 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4337 if (wand->images == (Image *) NULL) 4338 { 4339 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4340 "ContainsNoImages","`%s'",wand->name); 4341 return((ChannelStatistics *) NULL); 4342 } 4343 return(GetImageStatistics(wand->images,wand->exception)); 4344 } 4345 4346 /* 4348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4349 % % 4350 % % 4351 % % 4352 % M a g i c k G e t I m a g e C o l o r m a p C o l o r % 4353 % % 4354 % % 4355 % % 4356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4357 % 4358 % MagickGetImageColormapColor() returns the color of the specified colormap 4359 % index. 4360 % 4361 % The format of the MagickGetImageColormapColor method is: 4362 % 4363 % MagickBooleanType MagickGetImageColormapColor(MagickWand *wand, 4364 % const size_t index,PixelWand *color) 4365 % 4366 % A description of each parameter follows: 4367 % 4368 % o wand: the magick wand. 4369 % 4370 % o index: the offset into the image colormap. 4371 % 4372 % o color: Return the colormap color in this wand. 4373 % 4374 */ 4375 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand, 4376 const size_t index,PixelWand *color) 4377 { 4378 assert(wand != (MagickWand *) NULL); 4379 assert(wand->signature == MagickWandSignature); 4380 if (wand->debug != MagickFalse) 4381 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4382 if (wand->images == (Image *) NULL) 4383 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4384 if ((wand->images->colormap == (PixelInfo *) NULL) || 4385 (index >= wand->images->colors)) 4386 { 4387 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4388 "InvalidColormapIndex","`%s'",wand->name); 4389 return(MagickFalse); 4390 } 4391 PixelSetPixelColor(color,wand->images->colormap+index); 4392 return(MagickTrue); 4393 } 4394 4395 /* 4397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4398 % % 4399 % % 4400 % % 4401 % M a g i c k G e t I m a g e C o l o r s % 4402 % % 4403 % % 4404 % % 4405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4406 % 4407 % MagickGetImageColors() gets the number of unique colors in the image. 4408 % 4409 % The format of the MagickGetImageColors method is: 4410 % 4411 % size_t MagickGetImageColors(MagickWand *wand) 4412 % 4413 % A description of each parameter follows: 4414 % 4415 % o wand: the magick wand. 4416 % 4417 */ 4418 WandExport size_t MagickGetImageColors(MagickWand *wand) 4419 { 4420 assert(wand != (MagickWand *) NULL); 4421 assert(wand->signature == MagickWandSignature); 4422 if (wand->debug != MagickFalse) 4423 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4424 if (wand->images == (Image *) NULL) 4425 { 4426 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4427 "ContainsNoImages","`%s'",wand->name); 4428 return(0); 4429 } 4430 return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception)); 4431 } 4432 4433 /* 4435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4436 % % 4437 % % 4438 % % 4439 % M a g i c k G e t I m a g e C o l o r s p a c e % 4440 % % 4441 % % 4442 % % 4443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4444 % 4445 % MagickGetImageColorspace() gets the image colorspace. 4446 % 4447 % The format of the MagickGetImageColorspace method is: 4448 % 4449 % ColorspaceType MagickGetImageColorspace(MagickWand *wand) 4450 % 4451 % A description of each parameter follows: 4452 % 4453 % o wand: the magick wand. 4454 % 4455 */ 4456 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand) 4457 { 4458 assert(wand != (MagickWand *) NULL); 4459 assert(wand->signature == MagickWandSignature); 4460 if (wand->debug != MagickFalse) 4461 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4462 if (wand->images == (Image *) NULL) 4463 { 4464 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4465 "ContainsNoImages","`%s'",wand->name); 4466 return(UndefinedColorspace); 4467 } 4468 return(wand->images->colorspace); 4469 } 4470 4471 /* 4473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4474 % % 4475 % % 4476 % % 4477 % M a g i c k G e t I m a g e C o m p o s e % 4478 % % 4479 % % 4480 % % 4481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4482 % 4483 % MagickGetImageCompose() returns the composite operator associated with the 4484 % image. 4485 % 4486 % The format of the MagickGetImageCompose method is: 4487 % 4488 % CompositeOperator MagickGetImageCompose(MagickWand *wand) 4489 % 4490 % A description of each parameter follows: 4491 % 4492 % o wand: the magick wand. 4493 % 4494 */ 4495 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand) 4496 { 4497 assert(wand != (MagickWand *) NULL); 4498 assert(wand->signature == MagickWandSignature); 4499 if (wand->debug != MagickFalse) 4500 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4501 if (wand->images == (Image *) NULL) 4502 { 4503 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4504 "ContainsNoImages","`%s'",wand->name); 4505 return(UndefinedCompositeOp); 4506 } 4507 return(wand->images->compose); 4508 } 4509 4510 /* 4512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4513 % % 4514 % % 4515 % % 4516 % M a g i c k G e t I m a g e C o m p r e s s i o n % 4517 % % 4518 % % 4519 % % 4520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4521 % 4522 % MagickGetImageCompression() gets the image compression. 4523 % 4524 % The format of the MagickGetImageCompression method is: 4525 % 4526 % CompressionType MagickGetImageCompression(MagickWand *wand) 4527 % 4528 % A description of each parameter follows: 4529 % 4530 % o wand: the magick wand. 4531 % 4532 */ 4533 WandExport CompressionType MagickGetImageCompression(MagickWand *wand) 4534 { 4535 assert(wand != (MagickWand *) NULL); 4536 assert(wand->signature == MagickWandSignature); 4537 if (wand->debug != MagickFalse) 4538 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4539 if (wand->images == (Image *) NULL) 4540 { 4541 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4542 "ContainsNoImages","`%s'",wand->name); 4543 return(UndefinedCompression); 4544 } 4545 return(wand->images->compression); 4546 } 4547 4548 /* 4550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4551 % % 4552 % % 4553 % % 4554 % M a g i c k G e t I m a g e C o m p r e s s i o n Q u a l i t y % 4555 % % 4556 % % 4557 % % 4558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4559 % 4560 % MagickGetImageCompressionQuality() gets the image compression quality. 4561 % 4562 % The format of the MagickGetImageCompressionQuality method is: 4563 % 4564 % size_t MagickGetImageCompressionQuality(MagickWand *wand) 4565 % 4566 % A description of each parameter follows: 4567 % 4568 % o wand: the magick wand. 4569 % 4570 */ 4571 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand) 4572 { 4573 assert(wand != (MagickWand *) NULL); 4574 assert(wand->signature == MagickWandSignature); 4575 if (wand->debug != MagickFalse) 4576 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4577 if (wand->images == (Image *) NULL) 4578 { 4579 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4580 "ContainsNoImages","`%s'",wand->name); 4581 return(0UL); 4582 } 4583 return(wand->images->quality); 4584 } 4585 4586 /* 4588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4589 % % 4590 % % 4591 % % 4592 % M a g i c k G e t I m a g e D e l a y % 4593 % % 4594 % % 4595 % % 4596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4597 % 4598 % MagickGetImageDelay() gets the image delay. 4599 % 4600 % The format of the MagickGetImageDelay method is: 4601 % 4602 % size_t MagickGetImageDelay(MagickWand *wand) 4603 % 4604 % A description of each parameter follows: 4605 % 4606 % o wand: the magick wand. 4607 % 4608 */ 4609 WandExport size_t MagickGetImageDelay(MagickWand *wand) 4610 { 4611 assert(wand != (MagickWand *) NULL); 4612 assert(wand->signature == MagickWandSignature); 4613 if (wand->debug != MagickFalse) 4614 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4615 if (wand->images == (Image *) NULL) 4616 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4617 return(wand->images->delay); 4618 } 4619 4620 /* 4622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4623 % % 4624 % % 4625 % % 4626 % M a g i c k G e t I m a g e D e p t h % 4627 % % 4628 % % 4629 % % 4630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4631 % 4632 % MagickGetImageDepth() gets the image depth. 4633 % 4634 % The format of the MagickGetImageDepth method is: 4635 % 4636 % size_t MagickGetImageDepth(MagickWand *wand) 4637 % 4638 % A description of each parameter follows: 4639 % 4640 % o wand: the magick wand. 4641 % 4642 */ 4643 WandExport size_t MagickGetImageDepth(MagickWand *wand) 4644 { 4645 assert(wand != (MagickWand *) NULL); 4646 assert(wand->signature == MagickWandSignature); 4647 if (wand->debug != MagickFalse) 4648 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4649 if (wand->images == (Image *) NULL) 4650 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4651 return(wand->images->depth); 4652 } 4653 4654 /* 4656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4657 % % 4658 % % 4659 % % 4660 % M a g i c k G e t I m a g e D i s p o s e % 4661 % % 4662 % % 4663 % % 4664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4665 % 4666 % MagickGetImageDispose() gets the image disposal method. 4667 % 4668 % The format of the MagickGetImageDispose method is: 4669 % 4670 % DisposeType MagickGetImageDispose(MagickWand *wand) 4671 % 4672 % A description of each parameter follows: 4673 % 4674 % o wand: the magick wand. 4675 % 4676 */ 4677 WandExport DisposeType MagickGetImageDispose(MagickWand *wand) 4678 { 4679 assert(wand != (MagickWand *) NULL); 4680 assert(wand->signature == MagickWandSignature); 4681 if (wand->debug != MagickFalse) 4682 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4683 if (wand->images == (Image *) NULL) 4684 { 4685 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4686 "ContainsNoImages","`%s'",wand->name); 4687 return(UndefinedDispose); 4688 } 4689 return((DisposeType) wand->images->dispose); 4690 } 4691 4692 /* 4694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4695 % % 4696 % % 4697 % % 4698 % M a g i c k G e t I m a g e D i s t o r t i o n % 4699 % % 4700 % % 4701 % % 4702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4703 % 4704 % MagickGetImageDistortion() compares an image to a reconstructed image and 4705 % returns the specified distortion metric. 4706 % 4707 % The format of the MagickGetImageDistortion method is: 4708 % 4709 % MagickBooleanType MagickGetImageDistortion(MagickWand *wand, 4710 % const MagickWand *reference,const MetricType metric, 4711 % double *distortion) 4712 % 4713 % A description of each parameter follows: 4714 % 4715 % o wand: the magick wand. 4716 % 4717 % o reference: the reference wand. 4718 % 4719 % o metric: the metric. 4720 % 4721 % o distortion: the computed distortion between the images. 4722 % 4723 */ 4724 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand, 4725 const MagickWand *reference,const MetricType metric,double *distortion) 4726 { 4727 MagickBooleanType 4728 status; 4729 4730 assert(wand != (MagickWand *) NULL); 4731 assert(wand->signature == MagickWandSignature); 4732 if (wand->debug != MagickFalse) 4733 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4734 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL)) 4735 ThrowWandException(WandError,"ContainsNoImages",wand->name); 4736 status=GetImageDistortion(wand->images,reference->images,metric,distortion, 4737 wand->exception); 4738 return(status); 4739 } 4740 4741 /* 4743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4744 % % 4745 % % 4746 % % 4747 % M a g i c k G e t I m a g e D i s t o r t i o n s % 4748 % % 4749 % % 4750 % % 4751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4752 % 4753 % MagickGetImageDistortions() compares one or more pixel channels of an 4754 % image to a reconstructed image and returns the specified distortion metrics. 4755 % 4756 % Use MagickRelinquishMemory() to free the metrics when you are done with them. 4757 % 4758 % The format of the MagickGetImageDistortion method is: 4759 % 4760 % double *MagickGetImageDistortion(MagickWand *wand, 4761 % const MagickWand *reference,const MetricType metric) 4762 % 4763 % A description of each parameter follows: 4764 % 4765 % o wand: the magick wand. 4766 % 4767 % o reference: the reference wand. 4768 % 4769 % o metric: the metric. 4770 % 4771 */ 4772 WandExport double *MagickGetImageDistortions(MagickWand *wand, 4773 const MagickWand *reference,const MetricType metric) 4774 { 4775 double 4776 *channel_distortion; 4777 4778 assert(wand != (MagickWand *) NULL); 4779 assert(wand->signature == MagickWandSignature); 4780 if (wand->debug != MagickFalse) 4781 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4782 assert(reference != (MagickWand *) NULL); 4783 assert(reference->signature == MagickWandSignature); 4784 if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL)) 4785 { 4786 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4787 "ContainsNoImages","`%s'",wand->name); 4788 return((double *) NULL); 4789 } 4790 channel_distortion=GetImageDistortions(wand->images,reference->images, 4791 metric,wand->exception); 4792 return(channel_distortion); 4793 } 4794 4795 /* 4797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4798 % % 4799 % % 4800 % % 4801 % M a g i c k G e t I m a g e E n d i a n % 4802 % % 4803 % % 4804 % % 4805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4806 % 4807 % MagickGetImageEndian() gets the image endian. 4808 % 4809 % The format of the MagickGetImageEndian method is: 4810 % 4811 % EndianType MagickGetImageEndian(MagickWand *wand) 4812 % 4813 % A description of each parameter follows: 4814 % 4815 % o wand: the magick wand. 4816 % 4817 */ 4818 WandExport EndianType MagickGetImageEndian(MagickWand *wand) 4819 { 4820 assert(wand != (MagickWand *) NULL); 4821 assert(wand->signature == MagickWandSignature); 4822 if (wand->debug != MagickFalse) 4823 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4824 if (wand->images == (Image *) NULL) 4825 { 4826 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4827 "ContainsNoImages","`%s'",wand->name); 4828 return(UndefinedEndian); 4829 } 4830 return(wand->images->endian); 4831 } 4832 4833 /* 4835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4836 % % 4837 % % 4838 % % 4839 % M a g i c k G e t I m a g e F i l e n a m e % 4840 % % 4841 % % 4842 % % 4843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4844 % 4845 % MagickGetImageFilename() returns the filename of a particular image in a 4846 % sequence. 4847 % 4848 % The format of the MagickGetImageFilename method is: 4849 % 4850 % char *MagickGetImageFilename(MagickWand *wand) 4851 % 4852 % A description of each parameter follows: 4853 % 4854 % o wand: the magick wand. 4855 % 4856 */ 4857 WandExport char *MagickGetImageFilename(MagickWand *wand) 4858 { 4859 assert(wand != (MagickWand *) NULL); 4860 assert(wand->signature == MagickWandSignature); 4861 if (wand->debug != MagickFalse) 4862 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4863 if (wand->images == (Image *) NULL) 4864 { 4865 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4866 "ContainsNoImages","`%s'",wand->name); 4867 return((char *) NULL); 4868 } 4869 return(AcquireString(wand->images->filename)); 4870 } 4871 4872 /* 4874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4875 % % 4876 % % 4877 % % 4878 % M a g i c k G e t I m a g e F o r m a t % 4879 % % 4880 % % 4881 % % 4882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4883 % 4884 % MagickGetImageFormat() returns the format of a particular image in a 4885 % sequence. 4886 % 4887 % The format of the MagickGetImageFormat method is: 4888 % 4889 % char *MagickGetImageFormat(MagickWand *wand) 4890 % 4891 % A description of each parameter follows: 4892 % 4893 % o wand: the magick wand. 4894 % 4895 */ 4896 WandExport char *MagickGetImageFormat(MagickWand *wand) 4897 { 4898 assert(wand != (MagickWand *) NULL); 4899 assert(wand->signature == MagickWandSignature); 4900 if (wand->debug != MagickFalse) 4901 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4902 if (wand->images == (Image *) NULL) 4903 { 4904 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4905 "ContainsNoImages","`%s'",wand->name); 4906 return((char *) NULL); 4907 } 4908 return(AcquireString(wand->images->magick)); 4909 } 4910 4911 /* 4913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4914 % % 4915 % % 4916 % % 4917 % M a g i c k G e t I m a g e F u z z % 4918 % % 4919 % % 4920 % % 4921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4922 % 4923 % MagickGetImageFuzz() gets the image fuzz. 4924 % 4925 % The format of the MagickGetImageFuzz method is: 4926 % 4927 % double MagickGetImageFuzz(MagickWand *wand) 4928 % 4929 % A description of each parameter follows: 4930 % 4931 % o wand: the magick wand. 4932 % 4933 */ 4934 WandExport double MagickGetImageFuzz(MagickWand *wand) 4935 { 4936 assert(wand != (MagickWand *) NULL); 4937 assert(wand->signature == MagickWandSignature); 4938 if (wand->debug != MagickFalse) 4939 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4940 if (wand->images == (Image *) NULL) 4941 { 4942 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4943 "ContainsNoImages","`%s'",wand->name); 4944 return(0.0); 4945 } 4946 return(wand->images->fuzz); 4947 } 4948 4949 /* 4951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4952 % % 4953 % % 4954 % % 4955 % M a g i c k G e t I m a g e G a m m a % 4956 % % 4957 % % 4958 % % 4959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4960 % 4961 % MagickGetImageGamma() gets the image gamma. 4962 % 4963 % The format of the MagickGetImageGamma method is: 4964 % 4965 % double MagickGetImageGamma(MagickWand *wand) 4966 % 4967 % A description of each parameter follows: 4968 % 4969 % o wand: the magick wand. 4970 % 4971 */ 4972 WandExport double MagickGetImageGamma(MagickWand *wand) 4973 { 4974 assert(wand != (MagickWand *) NULL); 4975 assert(wand->signature == MagickWandSignature); 4976 if (wand->debug != MagickFalse) 4977 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 4978 if (wand->images == (Image *) NULL) 4979 { 4980 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 4981 "ContainsNoImages","`%s'",wand->name); 4982 return(0.0); 4983 } 4984 return(wand->images->gamma); 4985 } 4986 4987 /* 4989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4990 % % 4991 % % 4992 % % 4993 % M a g i c k G e t I m a g e G r a v i t y % 4994 % % 4995 % % 4996 % % 4997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4998 % 4999 % MagickGetImageGravity() gets the image gravity. 5000 % 5001 % The format of the MagickGetImageGravity method is: 5002 % 5003 % GravityType MagickGetImageGravity(MagickWand *wand) 5004 % 5005 % A description of each parameter follows: 5006 % 5007 % o wand: the magick wand. 5008 % 5009 */ 5010 WandExport GravityType MagickGetImageGravity(MagickWand *wand) 5011 { 5012 assert(wand != (MagickWand *) NULL); 5013 assert(wand->signature == MagickWandSignature); 5014 if (wand->debug != MagickFalse) 5015 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5016 if (wand->images == (Image *) NULL) 5017 { 5018 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5019 "ContainsNoImages","`%s'",wand->name); 5020 return(UndefinedGravity); 5021 } 5022 return(wand->images->gravity); 5023 } 5024 5025 /* 5027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5028 % % 5029 % % 5030 % % 5031 % M a g i c k G e t I m a g e G r e e n P r i m a r y % 5032 % % 5033 % % 5034 % % 5035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5036 % 5037 % MagickGetImageGreenPrimary() returns the chromaticy green primary point. 5038 % 5039 % The format of the MagickGetImageGreenPrimary method is: 5040 % 5041 % MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x, 5042 % double *y,double *z) 5043 % 5044 % A description of each parameter follows: 5045 % 5046 % o wand: the magick wand. 5047 % 5048 % o x: the chromaticity green primary x-point. 5049 % 5050 % o y: the chromaticity green primary y-point. 5051 % 5052 % o z: the chromaticity green primary z-point. 5053 % 5054 */ 5055 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand, 5056 double *x,double *y,double *z) 5057 { 5058 assert(wand != (MagickWand *) NULL); 5059 assert(wand->signature == MagickWandSignature); 5060 if (wand->debug != MagickFalse) 5061 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5062 if (wand->images == (Image *) NULL) 5063 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5064 *x=wand->images->chromaticity.green_primary.x; 5065 *y=wand->images->chromaticity.green_primary.y; 5066 *z=wand->images->chromaticity.green_primary.z; 5067 return(MagickTrue); 5068 } 5069 5070 /* 5072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5073 % % 5074 % % 5075 % % 5076 % M a g i c k G e t I m a g e H e i g h t % 5077 % % 5078 % % 5079 % % 5080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5081 % 5082 % MagickGetImageHeight() returns the image height. 5083 % 5084 % The format of the MagickGetImageHeight method is: 5085 % 5086 % size_t MagickGetImageHeight(MagickWand *wand) 5087 % 5088 % A description of each parameter follows: 5089 % 5090 % o wand: the magick wand. 5091 % 5092 */ 5093 WandExport size_t MagickGetImageHeight(MagickWand *wand) 5094 { 5095 assert(wand != (MagickWand *) NULL); 5096 assert(wand->signature == MagickWandSignature); 5097 if (wand->debug != MagickFalse) 5098 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5099 if (wand->images == (Image *) NULL) 5100 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5101 return(wand->images->rows); 5102 } 5103 5104 /* 5106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5107 % % 5108 % % 5109 % % 5110 % M a g i c k G e t I m a g e H i s t o g r a m % 5111 % % 5112 % % 5113 % % 5114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5115 % 5116 % MagickGetImageHistogram() returns the image histogram as an array of 5117 % PixelWand wands. 5118 % 5119 % The format of the MagickGetImageHistogram method is: 5120 % 5121 % PixelWand **MagickGetImageHistogram(MagickWand *wand, 5122 % size_t *number_colors) 5123 % 5124 % A description of each parameter follows: 5125 % 5126 % o wand: the magick wand. 5127 % 5128 % o number_colors: the number of unique colors in the image and the number 5129 % of pixel wands returned. 5130 % 5131 */ 5132 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand, 5133 size_t *number_colors) 5134 { 5135 PixelInfo 5136 *histogram; 5137 5138 PixelWand 5139 **pixel_wands; 5140 5141 register ssize_t 5142 i; 5143 5144 assert(wand != (MagickWand *) NULL); 5145 assert(wand->signature == MagickWandSignature); 5146 if (wand->debug != MagickFalse) 5147 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5148 if (wand->images == (Image *) NULL) 5149 { 5150 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5151 "ContainsNoImages","`%s'",wand->name); 5152 return((PixelWand **) NULL); 5153 } 5154 histogram=GetImageHistogram(wand->images,number_colors,wand->exception); 5155 if (histogram == (PixelInfo *) NULL) 5156 return((PixelWand **) NULL); 5157 pixel_wands=NewPixelWands(*number_colors); 5158 for (i=0; i < (ssize_t) *number_colors; i++) 5159 { 5160 PixelSetPixelColor(pixel_wands[i],&histogram[i]); 5161 PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count); 5162 } 5163 histogram=(PixelInfo *) RelinquishMagickMemory(histogram); 5164 return(pixel_wands); 5165 } 5166 5167 /* 5169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5170 % % 5171 % % 5172 % % 5173 % M a g i c k G e t I m a g e I n t e r l a c e S c h e m e % 5174 % % 5175 % % 5176 % % 5177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5178 % 5179 % MagickGetImageInterlaceScheme() gets the image interlace scheme. 5180 % 5181 % The format of the MagickGetImageInterlaceScheme method is: 5182 % 5183 % InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand) 5184 % 5185 % A description of each parameter follows: 5186 % 5187 % o wand: the magick wand. 5188 % 5189 */ 5190 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand) 5191 { 5192 assert(wand != (MagickWand *) NULL); 5193 assert(wand->signature == MagickWandSignature); 5194 if (wand->debug != MagickFalse) 5195 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5196 if (wand->images == (Image *) NULL) 5197 { 5198 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5199 "ContainsNoImages","`%s'",wand->name); 5200 return(UndefinedInterlace); 5201 } 5202 return(wand->images->interlace); 5203 } 5204 5205 /* 5207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5208 % % 5209 % % 5210 % % 5211 % M a g i c k G e t I m a g e I n t e r p o l a t e M e t h o d % 5212 % % 5213 % % 5214 % % 5215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5216 % 5217 % MagickGetImageInterpolateMethod() returns the interpolation method for the 5218 % sepcified image. 5219 % 5220 % The format of the MagickGetImageInterpolateMethod method is: 5221 % 5222 % PixelInterpolateMethod MagickGetImageInterpolateMethod(MagickWand *wand) 5223 % 5224 % A description of each parameter follows: 5225 % 5226 % o wand: the magick wand. 5227 % 5228 */ 5229 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod( 5230 MagickWand *wand) 5231 { 5232 assert(wand != (MagickWand *) NULL); 5233 assert(wand->signature == MagickWandSignature); 5234 if (wand->debug != MagickFalse) 5235 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5236 if (wand->images == (Image *) NULL) 5237 { 5238 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5239 "ContainsNoImages","`%s'",wand->name); 5240 return(UndefinedInterpolatePixel); 5241 } 5242 return(wand->images->interpolate); 5243 } 5244 5245 /* 5247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5248 % % 5249 % % 5250 % % 5251 % M a g i c k G e t I m a g e I t e r a t i o n s % 5252 % % 5253 % % 5254 % % 5255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5256 % 5257 % MagickGetImageIterations() gets the image iterations. 5258 % 5259 % The format of the MagickGetImageIterations method is: 5260 % 5261 % size_t MagickGetImageIterations(MagickWand *wand) 5262 % 5263 % A description of each parameter follows: 5264 % 5265 % o wand: the magick wand. 5266 % 5267 */ 5268 WandExport size_t MagickGetImageIterations(MagickWand *wand) 5269 { 5270 assert(wand != (MagickWand *) NULL); 5271 assert(wand->signature == MagickWandSignature); 5272 if (wand->debug != MagickFalse) 5273 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5274 if (wand->images == (Image *) NULL) 5275 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5276 return(wand->images->iterations); 5277 } 5278 5279 /* 5281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5282 % % 5283 % % 5284 % % 5285 % M a g i c k G e t I m a g e L e n g t h % 5286 % % 5287 % % 5288 % % 5289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5290 % 5291 % MagickGetImageLength() returns the image length in bytes. 5292 % 5293 % The format of the MagickGetImageLength method is: 5294 % 5295 % MagickBooleanType MagickGetImageLength(MagickWand *wand, 5296 % MagickSizeType *length) 5297 % 5298 % A description of each parameter follows: 5299 % 5300 % o wand: the magick wand. 5301 % 5302 % o length: the image length in bytes. 5303 % 5304 */ 5305 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand, 5306 MagickSizeType *length) 5307 { 5308 assert(wand != (MagickWand *) NULL); 5309 assert(wand->signature == MagickWandSignature); 5310 if (wand->debug != MagickFalse) 5311 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5312 if (wand->images == (Image *) NULL) 5313 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5314 *length=GetBlobSize(wand->images); 5315 return(MagickTrue); 5316 } 5317 5318 /* 5320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5321 % % 5322 % % 5323 % % 5324 % M a g i c k G e t I m a g e M a t t e C o l o r % 5325 % % 5326 % % 5327 % % 5328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5329 % 5330 % MagickGetImageMatteColor() returns the image matte color. 5331 % 5332 % The format of the MagickGetImageMatteColor method is: 5333 % 5334 % MagickBooleanType MagickGetImageMatteColor(MagickWand *wand, 5335 % PixelWand *matte_color) 5336 % 5337 % A description of each parameter follows: 5338 % 5339 % o wand: the magick wand. 5340 % 5341 % o matte_color: return the alpha color. 5342 % 5343 */ 5344 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand, 5345 PixelWand *matte_color) 5346 { 5347 assert(wand != (MagickWand *)NULL); 5348 assert(wand->signature == MagickWandSignature); 5349 if (wand->debug != MagickFalse) 5350 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5351 if (wand->images == (Image *)NULL) 5352 ThrowWandException(WandError, "ContainsNoImages", wand->name); 5353 PixelSetPixelColor(matte_color,&wand->images->matte_color); 5354 return(MagickTrue); 5355 } 5356 5357 /* 5359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5360 % % 5361 % % 5362 % % 5363 % M a g i c k G e t I m a g e O r i e n t a t i o n % 5364 % % 5365 % % 5366 % % 5367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5368 % 5369 % MagickGetImageOrientation() returns the image orientation. 5370 % 5371 % The format of the MagickGetImageOrientation method is: 5372 % 5373 % OrientationType MagickGetImageOrientation(MagickWand *wand) 5374 % 5375 % A description of each parameter follows: 5376 % 5377 % o wand: the magick wand. 5378 % 5379 */ 5380 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand) 5381 { 5382 assert(wand != (MagickWand *) NULL); 5383 assert(wand->signature == MagickWandSignature); 5384 if (wand->debug != MagickFalse) 5385 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5386 if (wand->images == (Image *) NULL) 5387 { 5388 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5389 "ContainsNoImages","`%s'",wand->name); 5390 return(UndefinedOrientation); 5391 } 5392 return(wand->images->orientation); 5393 } 5394 5395 /* 5397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5398 % % 5399 % % 5400 % % 5401 % M a g i c k G e t I m a g e P a g e % 5402 % % 5403 % % 5404 % % 5405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5406 % 5407 % MagickGetImagePage() returns the page geometry associated with the image. 5408 % 5409 % The format of the MagickGetImagePage method is: 5410 % 5411 % MagickBooleanType MagickGetImagePage(MagickWand *wand, 5412 % size_t *width,size_t *height,ssize_t *x,ssize_t *y) 5413 % 5414 % A description of each parameter follows: 5415 % 5416 % o wand: the magick wand. 5417 % 5418 % o width: the page width. 5419 % 5420 % o height: the page height. 5421 % 5422 % o x: the page x-offset. 5423 % 5424 % o y: the page y-offset. 5425 % 5426 */ 5427 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand, 5428 size_t *width,size_t *height,ssize_t *x,ssize_t *y) 5429 { 5430 assert(wand != (const MagickWand *) NULL); 5431 assert(wand->signature == MagickWandSignature); 5432 if (wand->debug != MagickFalse) 5433 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5434 if (wand->images == (Image *) NULL) 5435 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5436 *width=wand->images->page.width; 5437 *height=wand->images->page.height; 5438 *x=wand->images->page.x; 5439 *y=wand->images->page.y; 5440 return(MagickTrue); 5441 } 5442 5443 /* 5445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5446 % % 5447 % % 5448 % % 5449 % M a g i c k G e t I m a g e P i x e l C o l o r % 5450 % % 5451 % % 5452 % % 5453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5454 % 5455 % MagickGetImagePixelColor() returns the color of the specified pixel. 5456 % 5457 % The format of the MagickGetImagePixelColor method is: 5458 % 5459 % MagickBooleanType MagickGetImagePixelColor(MagickWand *wand, 5460 % const ssize_t x,const ssize_t y,PixelWand *color) 5461 % 5462 % A description of each parameter follows: 5463 % 5464 % o wand: the magick wand. 5465 % 5466 % o x,y: the pixel offset into the image. 5467 % 5468 % o color: Return the colormap color in this wand. 5469 % 5470 */ 5471 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand, 5472 const ssize_t x,const ssize_t y,PixelWand *color) 5473 { 5474 register const Quantum 5475 *p; 5476 5477 CacheView 5478 *image_view; 5479 5480 assert(wand != (MagickWand *) NULL); 5481 assert(wand->signature == MagickWandSignature); 5482 if (wand->debug != MagickFalse) 5483 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5484 if (wand->images == (Image *) NULL) 5485 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5486 image_view=AcquireVirtualCacheView(wand->images,wand->exception); 5487 p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception); 5488 if (p == (const Quantum *) NULL) 5489 { 5490 image_view=DestroyCacheView(image_view); 5491 return(MagickFalse); 5492 } 5493 PixelSetQuantumPixel(wand->images,p,color); 5494 image_view=DestroyCacheView(image_view); 5495 return(MagickTrue); 5496 } 5497 5498 /* 5500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5501 % % 5502 % % 5503 % % 5504 % M a g i c k G e t I m a g e R e d P r i m a r y % 5505 % % 5506 % % 5507 % % 5508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5509 % 5510 % MagickGetImageRedPrimary() returns the chromaticy red primary point. 5511 % 5512 % The format of the MagickGetImageRedPrimary method is: 5513 % 5514 % MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x, 5515 % double *y, double *z) 5516 % 5517 % A description of each parameter follows: 5518 % 5519 % o wand: the magick wand. 5520 % 5521 % o x: the chromaticity red primary x-point. 5522 % 5523 % o y: the chromaticity red primary y-point. 5524 % 5525 % o z: the chromaticity red primary z-point. 5526 % 5527 */ 5528 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand, 5529 double *x,double *y,double *z) 5530 { 5531 assert(wand != (MagickWand *) NULL); 5532 assert(wand->signature == MagickWandSignature); 5533 if (wand->debug != MagickFalse) 5534 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5535 if (wand->images == (Image *) NULL) 5536 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5537 *x=wand->images->chromaticity.red_primary.x; 5538 *y=wand->images->chromaticity.red_primary.y; 5539 *z=wand->images->chromaticity.red_primary.z; 5540 return(MagickTrue); 5541 } 5542 5543 /* 5545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5546 % % 5547 % % 5548 % % 5549 % M a g i c k G e t I m a g e R e g i o n % 5550 % % 5551 % % 5552 % % 5553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5554 % 5555 % MagickGetImageRegion() extracts a region of the image and returns it as a 5556 % a new wand. 5557 % 5558 % The format of the MagickGetImageRegion method is: 5559 % 5560 % MagickWand *MagickGetImageRegion(MagickWand *wand, 5561 % const size_t width,const size_t height,const ssize_t x, 5562 % const ssize_t y) 5563 % 5564 % A description of each parameter follows: 5565 % 5566 % o wand: the magick wand. 5567 % 5568 % o width: the region width. 5569 % 5570 % o height: the region height. 5571 % 5572 % o x: the region x offset. 5573 % 5574 % o y: the region y offset. 5575 % 5576 */ 5577 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand, 5578 const size_t width,const size_t height,const ssize_t x, 5579 const ssize_t y) 5580 { 5581 Image 5582 *region_image; 5583 5584 RectangleInfo 5585 region; 5586 5587 assert(wand != (MagickWand *) NULL); 5588 assert(wand->signature == MagickWandSignature); 5589 if (wand->debug != MagickFalse) 5590 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5591 if (wand->images == (Image *) NULL) 5592 return((MagickWand *) NULL); 5593 region.width=width; 5594 region.height=height; 5595 region.x=x; 5596 region.y=y; 5597 region_image=CropImage(wand->images,®ion,wand->exception); 5598 if (region_image == (Image *) NULL) 5599 return((MagickWand *) NULL); 5600 return(CloneMagickWandFromImages(wand,region_image)); 5601 } 5602 5603 /* 5605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5606 % % 5607 % % 5608 % % 5609 % M a g i c k G e t I m a g e R e n d e r i n g I n t e n t % 5610 % % 5611 % % 5612 % % 5613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5614 % 5615 % MagickGetImageRenderingIntent() gets the image rendering intent. 5616 % 5617 % The format of the MagickGetImageRenderingIntent method is: 5618 % 5619 % RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand) 5620 % 5621 % A description of each parameter follows: 5622 % 5623 % o wand: the magick wand. 5624 % 5625 */ 5626 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand) 5627 { 5628 assert(wand != (MagickWand *) NULL); 5629 assert(wand->signature == MagickWandSignature); 5630 if (wand->debug != MagickFalse) 5631 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5632 if (wand->images == (Image *) NULL) 5633 { 5634 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5635 "ContainsNoImages","`%s'",wand->name); 5636 return(UndefinedIntent); 5637 } 5638 return((RenderingIntent) wand->images->rendering_intent); 5639 } 5640 5641 /* 5643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5644 % % 5645 % % 5646 % % 5647 % M a g i c k G e t I m a g e R e s o l u t i o n % 5648 % % 5649 % % 5650 % % 5651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5652 % 5653 % MagickGetImageResolution() gets the image X and Y resolution. 5654 % 5655 % The format of the MagickGetImageResolution method is: 5656 % 5657 % MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x, 5658 % double *y) 5659 % 5660 % A description of each parameter follows: 5661 % 5662 % o wand: the magick wand. 5663 % 5664 % o x: the image x-resolution. 5665 % 5666 % o y: the image y-resolution. 5667 % 5668 */ 5669 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand, 5670 double *x,double *y) 5671 { 5672 assert(wand != (MagickWand *) NULL); 5673 assert(wand->signature == MagickWandSignature); 5674 if (wand->debug != MagickFalse) 5675 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5676 if (wand->images == (Image *) NULL) 5677 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5678 *x=wand->images->resolution.x; 5679 *y=wand->images->resolution.y; 5680 return(MagickTrue); 5681 } 5682 5683 /* 5685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5686 % % 5687 % % 5688 % % 5689 % M a g i c k G e t I m a g e S c e n e % 5690 % % 5691 % % 5692 % % 5693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5694 % 5695 % MagickGetImageScene() gets the image scene. 5696 % 5697 % The format of the MagickGetImageScene method is: 5698 % 5699 % size_t MagickGetImageScene(MagickWand *wand) 5700 % 5701 % A description of each parameter follows: 5702 % 5703 % o wand: the magick wand. 5704 % 5705 */ 5706 WandExport size_t MagickGetImageScene(MagickWand *wand) 5707 { 5708 assert(wand != (MagickWand *) NULL); 5709 assert(wand->signature == MagickWandSignature); 5710 if (wand->debug != MagickFalse) 5711 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5712 if (wand->images == (Image *) NULL) 5713 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5714 return(wand->images->scene); 5715 } 5716 5717 /* 5719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5720 % % 5721 % % 5722 % % 5723 % M a g i c k G e t I m a g e S i g n a t u r e % 5724 % % 5725 % % 5726 % % 5727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5728 % 5729 % MagickGetImageSignature() generates an SHA-256 message digest for the image 5730 % pixel stream. 5731 % 5732 % The format of the MagickGetImageSignature method is: 5733 % 5734 % char *MagickGetImageSignature(MagickWand *wand) 5735 % 5736 % A description of each parameter follows: 5737 % 5738 % o wand: the magick wand. 5739 % 5740 */ 5741 WandExport char *MagickGetImageSignature(MagickWand *wand) 5742 { 5743 const char 5744 *value; 5745 5746 MagickBooleanType 5747 status; 5748 5749 assert(wand != (MagickWand *) NULL); 5750 assert(wand->signature == MagickWandSignature); 5751 if (wand->debug != MagickFalse) 5752 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5753 if (wand->images == (Image *) NULL) 5754 { 5755 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5756 "ContainsNoImages","`%s'",wand->name); 5757 return((char *) NULL); 5758 } 5759 status=SignatureImage(wand->images,wand->exception); 5760 if (status == MagickFalse) 5761 return((char *) NULL); 5762 value=GetImageProperty(wand->images,"signature",wand->exception); 5763 if (value == (const char *) NULL) 5764 return((char *) NULL); 5765 return(AcquireString(value)); 5766 } 5767 5768 /* 5770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5771 % % 5772 % % 5773 % % 5774 % M a g i c k G e t I m a g e T i c k s P e r S e c o n d % 5775 % % 5776 % % 5777 % % 5778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5779 % 5780 % MagickGetImageTicksPerSecond() gets the image ticks-per-second. 5781 % 5782 % The format of the MagickGetImageTicksPerSecond method is: 5783 % 5784 % size_t MagickGetImageTicksPerSecond(MagickWand *wand) 5785 % 5786 % A description of each parameter follows: 5787 % 5788 % o wand: the magick wand. 5789 % 5790 */ 5791 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand) 5792 { 5793 assert(wand != (MagickWand *) NULL); 5794 assert(wand->signature == MagickWandSignature); 5795 if (wand->debug != MagickFalse) 5796 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5797 if (wand->images == (Image *) NULL) 5798 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5799 return((size_t) wand->images->ticks_per_second); 5800 } 5801 5802 /* 5804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5805 % % 5806 % % 5807 % % 5808 % M a g i c k G e t I m a g e T y p e % 5809 % % 5810 % % 5811 % % 5812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5813 % 5814 % MagickGetImageType() gets the potential image type: 5815 % 5816 % Bilevel Grayscale GrayscaleMatte 5817 % Palette PaletteMatte TrueColor 5818 % TrueColorMatte ColorSeparation ColorSeparationMatte 5819 % 5820 % The format of the MagickGetImageType method is: 5821 % 5822 % ImageType MagickGetImageType(MagickWand *wand) 5823 % 5824 % A description of each parameter follows: 5825 % 5826 % o wand: the magick wand. 5827 % 5828 */ 5829 WandExport ImageType MagickGetImageType(MagickWand *wand) 5830 { 5831 assert(wand != (MagickWand *) NULL); 5832 assert(wand->signature == MagickWandSignature); 5833 if (wand->debug != MagickFalse) 5834 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5835 if (wand->images == (Image *) NULL) 5836 { 5837 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5838 "ContainsNoImages","`%s'",wand->name); 5839 return(UndefinedType); 5840 } 5841 return(GetImageType(wand->images)); 5842 } 5843 5844 /* 5846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5847 % % 5848 % % 5849 % % 5850 % M a g i c k G e t I m a g e U n i t s % 5851 % % 5852 % % 5853 % % 5854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5855 % 5856 % MagickGetImageUnits() gets the image units of resolution. 5857 % 5858 % The format of the MagickGetImageUnits method is: 5859 % 5860 % ResolutionType MagickGetImageUnits(MagickWand *wand) 5861 % 5862 % A description of each parameter follows: 5863 % 5864 % o wand: the magick wand. 5865 % 5866 */ 5867 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand) 5868 { 5869 assert(wand != (MagickWand *) NULL); 5870 assert(wand->signature == MagickWandSignature); 5871 if (wand->debug != MagickFalse) 5872 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5873 if (wand->images == (Image *) NULL) 5874 { 5875 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5876 "ContainsNoImages","`%s'",wand->name); 5877 return(UndefinedResolution); 5878 } 5879 return(wand->images->units); 5880 } 5881 5882 /* 5884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5885 % % 5886 % % 5887 % % 5888 % M a g i c k G e t I m a g e V i r t u a l P i x e l M e t h o d % 5889 % % 5890 % % 5891 % % 5892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5893 % 5894 % MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the 5895 % sepcified image. 5896 % 5897 % The format of the MagickGetImageVirtualPixelMethod method is: 5898 % 5899 % VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand) 5900 % 5901 % A description of each parameter follows: 5902 % 5903 % o wand: the magick wand. 5904 % 5905 */ 5906 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand) 5907 { 5908 assert(wand != (MagickWand *) NULL); 5909 assert(wand->signature == MagickWandSignature); 5910 if (wand->debug != MagickFalse) 5911 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5912 if (wand->images == (Image *) NULL) 5913 { 5914 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 5915 "ContainsNoImages","`%s'",wand->name); 5916 return(UndefinedVirtualPixelMethod); 5917 } 5918 return(GetImageVirtualPixelMethod(wand->images)); 5919 } 5920 5921 /* 5923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5924 % % 5925 % % 5926 % % 5927 % M a g i c k G e t I m a g e W h i t e P o i n t % 5928 % % 5929 % % 5930 % % 5931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5932 % 5933 % MagickGetImageWhitePoint() returns the chromaticy white point. 5934 % 5935 % The format of the MagickGetImageWhitePoint method is: 5936 % 5937 % MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x, 5938 % double *y,double *z) 5939 % 5940 % A description of each parameter follows: 5941 % 5942 % o wand: the magick wand. 5943 % 5944 % o x: the chromaticity white x-point. 5945 % 5946 % o y: the chromaticity white y-point. 5947 % 5948 % o z: the chromaticity white z-point. 5949 % 5950 */ 5951 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand, 5952 double *x,double *y,double *z) 5953 { 5954 assert(wand != (MagickWand *) NULL); 5955 assert(wand->signature == MagickWandSignature); 5956 if (wand->debug != MagickFalse) 5957 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5958 if (wand->images == (Image *) NULL) 5959 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5960 *x=wand->images->chromaticity.white_point.x; 5961 *y=wand->images->chromaticity.white_point.y; 5962 *z=wand->images->chromaticity.white_point.z; 5963 return(MagickTrue); 5964 } 5965 5966 /* 5968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5969 % % 5970 % % 5971 % % 5972 % M a g i c k G e t I m a g e W i d t h % 5973 % % 5974 % % 5975 % % 5976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5977 % 5978 % MagickGetImageWidth() returns the image width. 5979 % 5980 % The format of the MagickGetImageWidth method is: 5981 % 5982 % size_t MagickGetImageWidth(MagickWand *wand) 5983 % 5984 % A description of each parameter follows: 5985 % 5986 % o wand: the magick wand. 5987 % 5988 */ 5989 WandExport size_t MagickGetImageWidth(MagickWand *wand) 5990 { 5991 assert(wand != (MagickWand *) NULL); 5992 assert(wand->signature == MagickWandSignature); 5993 if (wand->debug != MagickFalse) 5994 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 5995 if (wand->images == (Image *) NULL) 5996 ThrowWandException(WandError,"ContainsNoImages",wand->name); 5997 return(wand->images->columns); 5998 } 5999 6000 /* 6002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6003 % % 6004 % % 6005 % % 6006 % M a g i c k G e t N u m b e r I m a g e s % 6007 % % 6008 % % 6009 % % 6010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6011 % 6012 % MagickGetNumberImages() returns the number of images associated with a 6013 % magick wand. 6014 % 6015 % The format of the MagickGetNumberImages method is: 6016 % 6017 % size_t MagickGetNumberImages(MagickWand *wand) 6018 % 6019 % A description of each parameter follows: 6020 % 6021 % o wand: the magick wand. 6022 % 6023 */ 6024 WandExport size_t MagickGetNumberImages(MagickWand *wand) 6025 { 6026 assert(wand != (MagickWand *) NULL); 6027 assert(wand->signature == MagickWandSignature); 6028 if (wand->debug != MagickFalse) 6029 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6030 return(GetImageListLength(wand->images)); 6031 } 6032 6033 /* 6035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6036 % % 6037 % % 6038 % % 6039 % M a g i c k I m a g e G e t T o t a l I n k D e n s i t y % 6040 % % 6041 % % 6042 % % 6043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6044 % 6045 % MagickGetImageTotalInkDensity() gets the image total ink density. 6046 % 6047 % The format of the MagickGetImageTotalInkDensity method is: 6048 % 6049 % double MagickGetImageTotalInkDensity(MagickWand *wand) 6050 % 6051 % A description of each parameter follows: 6052 % 6053 % o wand: the magick wand. 6054 % 6055 */ 6056 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand) 6057 { 6058 assert(wand != (MagickWand *) NULL); 6059 assert(wand->signature == MagickWandSignature); 6060 if (wand->debug != MagickFalse) 6061 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6062 if (wand->images == (Image *) NULL) 6063 { 6064 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 6065 "ContainsNoImages","`%s'",wand->name); 6066 return(0.0); 6067 } 6068 return(GetImageTotalInkDensity(wand->images,wand->exception)); 6069 } 6070 6071 /* 6073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6074 % % 6075 % % 6076 % % 6077 % M a g i c k H a l d C l u t I m a g e % 6078 % % 6079 % % 6080 % % 6081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6082 % 6083 % MagickHaldClutImage() replaces colors in the image from a Hald color lookup 6084 % table. A Hald color lookup table is a 3-dimensional color cube mapped to 2 6085 % dimensions. Create it with the HALD coder. You can apply any color 6086 % transformation to the Hald image and then use this method to apply the 6087 % transform to the image. 6088 % 6089 % The format of the MagickHaldClutImage method is: 6090 % 6091 % MagickBooleanType MagickHaldClutImage(MagickWand *wand, 6092 % const MagickWand *hald_wand) 6093 % 6094 % A description of each parameter follows: 6095 % 6096 % o wand: the magick wand. 6097 % 6098 % o hald_image: the hald CLUT image. 6099 % 6100 */ 6101 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand, 6102 const MagickWand *hald_wand) 6103 { 6104 MagickBooleanType 6105 status; 6106 6107 assert(wand != (MagickWand *) NULL); 6108 assert(wand->signature == MagickWandSignature); 6109 if (wand->debug != MagickFalse) 6110 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6111 if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL)) 6112 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6113 status=HaldClutImage(wand->images,hald_wand->images,wand->exception); 6114 return(status); 6115 } 6116 6117 /* 6119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6120 % % 6121 % % 6122 % % 6123 % M a g i c k H a s N e x t I m a g e % 6124 % % 6125 % % 6126 % % 6127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6128 % 6129 % MagickHasNextImage() returns MagickTrue if the wand has more images when 6130 % traversing the list in the forward direction 6131 % 6132 % The format of the MagickHasNextImage method is: 6133 % 6134 % MagickBooleanType MagickHasNextImage(MagickWand *wand) 6135 % 6136 % A description of each parameter follows: 6137 % 6138 % o wand: the magick wand. 6139 % 6140 */ 6141 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand) 6142 { 6143 assert(wand != (MagickWand *) NULL); 6144 assert(wand->signature == MagickWandSignature); 6145 if (wand->debug != MagickFalse) 6146 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6147 if (wand->images == (Image *) NULL) 6148 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6149 if (GetNextImageInList(wand->images) == (Image *) NULL) 6150 return(MagickFalse); 6151 return(MagickTrue); 6152 } 6153 6154 /* 6156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6157 % % 6158 % % 6159 % % 6160 % M a g i c k H a s P r e v i o u s I m a g e % 6161 % % 6162 % % 6163 % % 6164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6165 % 6166 % MagickHasPreviousImage() returns MagickTrue if the wand has more images when 6167 % traversing the list in the reverse direction 6168 % 6169 % The format of the MagickHasPreviousImage method is: 6170 % 6171 % MagickBooleanType MagickHasPreviousImage(MagickWand *wand) 6172 % 6173 % A description of each parameter follows: 6174 % 6175 % o wand: the magick wand. 6176 % 6177 */ 6178 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand) 6179 { 6180 assert(wand != (MagickWand *) NULL); 6181 assert(wand->signature == MagickWandSignature); 6182 if (wand->debug != MagickFalse) 6183 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6184 if (wand->images == (Image *) NULL) 6185 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6186 if (GetPreviousImageInList(wand->images) == (Image *) NULL) 6187 return(MagickFalse); 6188 return(MagickTrue); 6189 } 6190 6191 /* 6193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6194 % % 6195 % % 6196 % % 6197 % M a g i c k I d e n t i f y I m a g e % 6198 % % 6199 % % 6200 % % 6201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6202 % 6203 % MagickIdentifyImage() identifies an image by printing its attributes to the 6204 % file. Attributes include the image width, height, size, and others. 6205 % 6206 % The format of the MagickIdentifyImage method is: 6207 % 6208 % const char *MagickIdentifyImage(MagickWand *wand) 6209 % 6210 % A description of each parameter follows: 6211 % 6212 % o wand: the magick wand. 6213 % 6214 */ 6215 WandExport char *MagickIdentifyImage(MagickWand *wand) 6216 { 6217 char 6218 *description, 6219 filename[MagickPathExtent]; 6220 6221 FILE 6222 *file; 6223 6224 int 6225 unique_file; 6226 6227 assert(wand != (MagickWand *) NULL); 6228 assert(wand->signature == MagickWandSignature); 6229 if (wand->debug != MagickFalse) 6230 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6231 if (wand->images == (Image *) NULL) 6232 { 6233 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 6234 "ContainsNoImages","`%s'",wand->name); 6235 return((char *) NULL); 6236 } 6237 description=(char *) NULL; 6238 unique_file=AcquireUniqueFileResource(filename); 6239 file=(FILE *) NULL; 6240 if (unique_file != -1) 6241 file=fdopen(unique_file,"wb"); 6242 if ((unique_file == -1) || (file == (FILE *) NULL)) 6243 { 6244 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 6245 "UnableToCreateTemporaryFile","`%s'",wand->name); 6246 return((char *) NULL); 6247 } 6248 (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception); 6249 (void) fclose(file); 6250 description=FileToString(filename,~0UL,wand->exception); 6251 (void) RelinquishUniqueFileResource(filename); 6252 return(description); 6253 } 6254 6255 /* 6256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6257 % % 6258 % % 6259 % % 6260 % M a g i c k I d e n t i f y I m a g e T y p e % 6261 % % 6262 % % 6263 % % 6264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6265 % 6266 % MagickIdentifyImageType() gets the potential image type: 6267 % 6268 % Bilevel Grayscale GrayscaleMatte 6269 % Palette PaletteMatte TrueColor 6270 % TrueColorMatte ColorSeparation ColorSeparationMatte 6271 % 6272 % To ensure the image type matches its potential, use MagickSetImageType(): 6273 % 6274 % (void) MagickSetImageType(wand,MagickIdentifyImageType(wand)); 6275 % 6276 % The format of the MagickIdentifyImageType method is: 6277 % 6278 % ImageType MagickIdentifyImageType(MagickWand *wand) 6279 % 6280 % A description of each parameter follows: 6281 % 6282 % o wand: the magick wand. 6283 % 6284 */ 6285 WandExport ImageType MagickIdentifyImageType(MagickWand *wand) 6286 { 6287 assert(wand != (MagickWand *) NULL); 6288 assert(wand->signature == MagickWandSignature); 6289 if (wand->debug != MagickFalse) 6290 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6291 if (wand->images == (Image *) NULL) 6292 { 6293 (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError, 6294 "ContainsNoImages","`%s'",wand->name); 6295 return(UndefinedType); 6296 } 6297 return(IdentifyImageType(wand->images,wand->exception)); 6298 } 6299 6300 /* 6301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6302 % % 6303 % % 6304 % % 6305 % M a g i c k I m p l o d e I m a g e % 6306 % % 6307 % % 6308 % % 6309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6310 % 6311 % MagickImplodeImage() creates a new image that is a copy of an existing 6312 % one with the image pixels "implode" by the specified percentage. It 6313 % allocates the memory necessary for the new Image structure and returns a 6314 % pointer to the new image. 6315 % 6316 % The format of the MagickImplodeImage method is: 6317 % 6318 % MagickBooleanType MagickImplodeImage(MagickWand *wand, 6319 % const double radius,const PixelInterpolateMethod method) 6320 % 6321 % A description of each parameter follows: 6322 % 6323 % o wand: the magick wand. 6324 % 6325 % o amount: Define the extent of the implosion. 6326 % 6327 % o method: the pixel interpolation method. 6328 % 6329 */ 6330 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand, 6331 const double amount,const PixelInterpolateMethod method) 6332 { 6333 Image 6334 *implode_image; 6335 6336 assert(wand != (MagickWand *) NULL); 6337 assert(wand->signature == MagickWandSignature); 6338 if (wand->debug != MagickFalse) 6339 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6340 if (wand->images == (Image *) NULL) 6341 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6342 implode_image=ImplodeImage(wand->images,amount,method,wand->exception); 6343 if (implode_image == (Image *) NULL) 6344 return(MagickFalse); 6345 ReplaceImageInList(&wand->images,implode_image); 6346 return(MagickTrue); 6347 } 6348 6349 /* 6351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6352 % % 6353 % % 6354 % % 6355 % M a g i c k I m p o r t I m a g e P i x e l s % 6356 % % 6357 % % 6358 % % 6359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6360 % 6361 % MagickImportImagePixels() accepts pixel datand stores it in the image at the 6362 % location you specify. The method returns MagickFalse on success otherwise 6363 % MagickTrue if an error is encountered. The pixel data can be either char, 6364 % short int, int, ssize_t, float, or double in the order specified by map. 6365 % 6366 % Suppose your want to upload the first scanline of a 640x480 image from 6367 % character data in red-green-blue order: 6368 % 6369 % MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels); 6370 % 6371 % The format of the MagickImportImagePixels method is: 6372 % 6373 % MagickBooleanType MagickImportImagePixels(MagickWand *wand, 6374 % const ssize_t x,const ssize_t y,const size_t columns, 6375 % const size_t rows,const char *map,const StorageType storage, 6376 % const void *pixels) 6377 % 6378 % A description of each parameter follows: 6379 % 6380 % o wand: the magick wand. 6381 % 6382 % o x, y, columns, rows: These values define the perimeter of a region 6383 % of pixels you want to define. 6384 % 6385 % o map: This string reflects the expected ordering of the pixel array. 6386 % It can be any combination or order of R = red, G = green, B = blue, 6387 % A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan, 6388 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale), 6389 % P = pad. 6390 % 6391 % o storage: Define the data type of the pixels. Float and double types are 6392 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from 6393 % these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel, 6394 % or DoublePixel. 6395 % 6396 % o pixels: This array of values contain the pixel components as defined by 6397 % map and type. You must preallocate this array where the expected 6398 % length varies depending on the values of width, height, map, and type. 6399 % 6400 */ 6401 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand, 6402 const ssize_t x,const ssize_t y,const size_t columns,const size_t rows, 6403 const char *map,const StorageType storage,const void *pixels) 6404 { 6405 MagickBooleanType 6406 status; 6407 6408 assert(wand != (MagickWand *) NULL); 6409 assert(wand->signature == MagickWandSignature); 6410 if (wand->debug != MagickFalse) 6411 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6412 if (wand->images == (Image *) NULL) 6413 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6414 status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels, 6415 wand->exception); 6416 return(status); 6417 } 6418 6419 /* 6421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6422 % % 6423 % % 6424 % % 6425 % M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e % 6426 % % 6427 % % 6428 % % 6429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6430 % 6431 % MagickInterpolativeResizeImage() resize image using a interpolative 6432 % method. 6433 % 6434 % MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand, 6435 % const size_t columns,const size_t rows, 6436 % const PixelInterpolateMethod method) 6437 % 6438 % A description of each parameter follows: 6439 % 6440 % o wand: the magick wand. 6441 % 6442 % o columns: the number of columns in the scaled image. 6443 % 6444 % o rows: the number of rows in the scaled image. 6445 % 6446 % o interpolate: the pixel interpolation method. 6447 % 6448 */ 6449 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand, 6450 const size_t columns,const size_t rows,const PixelInterpolateMethod method) 6451 { 6452 Image 6453 *resize_image; 6454 6455 assert(wand != (MagickWand *) NULL); 6456 assert(wand->signature == MagickWandSignature); 6457 if (wand->debug != MagickFalse) 6458 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6459 if (wand->images == (Image *) NULL) 6460 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6461 resize_image=InterpolativeResizeImage(wand->images,columns,rows,method, 6462 wand->exception); 6463 if (resize_image == (Image *) NULL) 6464 return(MagickFalse); 6465 ReplaceImageInList(&wand->images,resize_image); 6466 return(MagickTrue); 6467 } 6468 6469 /* 6471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6472 % % 6473 % % 6474 % % 6475 % M a g i c k I n v e r s e F o u r i e r T r a n s f o r m I m a g e % 6476 % % 6477 % % 6478 % % 6479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6480 % 6481 % MagickInverseFourierTransformImage() implements the inverse discrete 6482 % Fourier transform (DFT) of the image either as a magnitude / phase or real / 6483 % imaginary image pair. 6484 % 6485 % The format of the MagickInverseFourierTransformImage method is: 6486 % 6487 % MagickBooleanType MagickInverseFourierTransformImage( 6488 % MagickWand *magnitude_wand,MagickWand *phase_wand, 6489 % const MagickBooleanType magnitude) 6490 % 6491 % A description of each parameter follows: 6492 % 6493 % o magnitude_wand: the magnitude or real wand. 6494 % 6495 % o phase_wand: the phase or imaginary wand. 6496 % 6497 % o magnitude: if true, return as magnitude / phase pair otherwise a real / 6498 % imaginary image pair. 6499 % 6500 */ 6501 WandExport MagickBooleanType MagickInverseFourierTransformImage( 6502 MagickWand *magnitude_wand,MagickWand *phase_wand, 6503 const MagickBooleanType magnitude) 6504 { 6505 Image 6506 *inverse_image; 6507 6508 MagickWand 6509 *wand; 6510 6511 assert(magnitude_wand != (MagickWand *) NULL); 6512 assert(magnitude_wand->signature == MagickWandSignature); 6513 if (magnitude_wand->debug != MagickFalse) 6514 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", 6515 magnitude_wand->name); 6516 wand=magnitude_wand; 6517 if (magnitude_wand->images == (Image *) NULL) 6518 ThrowWandException(WandError,"ContainsNoImages", 6519 magnitude_wand->name); 6520 assert(phase_wand != (MagickWand *) NULL); 6521 assert(phase_wand->signature == MagickWandSignature); 6522 inverse_image=InverseFourierTransformImage(magnitude_wand->images, 6523 phase_wand->images,magnitude,wand->exception); 6524 if (inverse_image == (Image *) NULL) 6525 return(MagickFalse); 6526 ReplaceImageInList(&wand->images,inverse_image); 6527 return(MagickTrue); 6528 } 6529 6530 /* 6532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6533 % % 6534 % % 6535 % % 6536 % M a g i c k L a b e l I m a g e % 6537 % % 6538 % % 6539 % % 6540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6541 % 6542 % MagickLabelImage() adds a label to your image. 6543 % 6544 % The format of the MagickLabelImage method is: 6545 % 6546 % MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label) 6547 % 6548 % A description of each parameter follows: 6549 % 6550 % o wand: the magick wand. 6551 % 6552 % o label: the image label. 6553 % 6554 */ 6555 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand, 6556 const char *label) 6557 { 6558 MagickBooleanType 6559 status; 6560 6561 assert(wand != (MagickWand *) NULL); 6562 assert(wand->signature == MagickWandSignature); 6563 if (wand->debug != MagickFalse) 6564 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6565 if (wand->images == (Image *) NULL) 6566 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6567 status=SetImageProperty(wand->images,"label",label,wand->exception); 6568 return(status); 6569 } 6570 6571 /* 6573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6574 % % 6575 % % 6576 % % 6577 % M a g i c k L e v e l I m a g e % 6578 % % 6579 % % 6580 % % 6581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6582 % 6583 % MagickLevelImage() adjusts the levels of an image by scaling the colors 6584 % falling between specified white and black points to the full available 6585 % quantum range. The parameters provided represent the black, mid, and white 6586 % points. The black point specifies the darkest color in the image. Colors 6587 % darker than the black point are set to zero. Mid point specifies a gamma 6588 % correction to apply to the image. White point specifies the lightest color 6589 % in the image. Colors brighter than the white point are set to the maximum 6590 % quantum value. 6591 % 6592 % The format of the MagickLevelImage method is: 6593 % 6594 % MagickBooleanType MagickLevelImage(MagickWand *wand, 6595 % const double black_point,const double gamma,const double white_point) 6596 % MagickBooleanType MagickLevelImage(MagickWand *wand, 6597 % const ChannelType channel,const double black_point,const double gamma, 6598 % const double white_point) 6599 % 6600 % A description of each parameter follows: 6601 % 6602 % o wand: the magick wand. 6603 % 6604 % o channel: Identify which channel to level: RedPixelChannel, 6605 % GreenPixelChannel, etc. 6606 % 6607 % o black_point: the black point. 6608 % 6609 % o gamma: the gamma. 6610 % 6611 % o white_point: the white point. 6612 % 6613 */ 6614 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand, 6615 const double black_point,const double gamma,const double white_point) 6616 { 6617 MagickBooleanType 6618 status; 6619 6620 assert(wand != (MagickWand *) NULL); 6621 assert(wand->signature == MagickWandSignature); 6622 if (wand->debug != MagickFalse) 6623 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6624 if (wand->images == (Image *) NULL) 6625 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6626 status=LevelImage(wand->images,black_point,white_point,gamma, 6627 wand->exception); 6628 return(status); 6629 } 6630 6631 /* 6633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6634 % % 6635 % % 6636 % % 6637 % M a g i c k L i n e a r S t r e t c h I m a g e % 6638 % % 6639 % % 6640 % % 6641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6642 % 6643 % MagickLinearStretchImage() stretches with saturation the image intensity. 6644 % 6645 % You can also reduce the influence of a particular channel with a gamma 6646 % value of 0. 6647 % 6648 % The format of the MagickLinearStretchImage method is: 6649 % 6650 % MagickBooleanType MagickLinearStretchImage(MagickWand *wand, 6651 % const double black_point,const double white_point) 6652 % 6653 % A description of each parameter follows: 6654 % 6655 % o wand: the magick wand. 6656 % 6657 % o black_point: the black point. 6658 % 6659 % o white_point: the white point. 6660 % 6661 */ 6662 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand, 6663 const double black_point,const double white_point) 6664 { 6665 MagickBooleanType 6666 status; 6667 6668 assert(wand != (MagickWand *) NULL); 6669 assert(wand->signature == MagickWandSignature); 6670 if (wand->debug != MagickFalse) 6671 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6672 if (wand->images == (Image *) NULL) 6673 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6674 status=LinearStretchImage(wand->images,black_point,white_point, 6675 wand->exception); 6676 return(status); 6677 } 6678 6679 /* 6681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6682 % % 6683 % % 6684 % % 6685 % M a g i c k L i q u i d R e s c a l e I m a g e % 6686 % % 6687 % % 6688 % % 6689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6690 % 6691 % MagickLiquidRescaleImage() rescales image with seam carving. 6692 % 6693 % MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand, 6694 % const size_t columns,const size_t rows, 6695 % const double delta_x,const double rigidity) 6696 % 6697 % A description of each parameter follows: 6698 % 6699 % o wand: the magick wand. 6700 % 6701 % o columns: the number of columns in the scaled image. 6702 % 6703 % o rows: the number of rows in the scaled image. 6704 % 6705 % o delta_x: maximum seam transversal step (0 means straight seams). 6706 % 6707 % o rigidity: introduce a bias for non-straight seams (typically 0). 6708 % 6709 */ 6710 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand, 6711 const size_t columns,const size_t rows,const double delta_x, 6712 const double rigidity) 6713 { 6714 Image 6715 *rescale_image; 6716 6717 assert(wand != (MagickWand *) NULL); 6718 assert(wand->signature == MagickWandSignature); 6719 if (wand->debug != MagickFalse) 6720 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6721 if (wand->images == (Image *) NULL) 6722 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6723 rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x, 6724 rigidity,wand->exception); 6725 if (rescale_image == (Image *) NULL) 6726 return(MagickFalse); 6727 ReplaceImageInList(&wand->images,rescale_image); 6728 return(MagickTrue); 6729 } 6730 6731 /* 6732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6733 % % 6734 % % 6735 % % 6736 % M a g i c k L o c a l C o n t r a s t I m a g e % 6737 % % 6738 % % 6739 % % 6740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6741 % 6742 % MagickLocalContrastImage() attempts to increase the appearance of 6743 % large-scale light-dark transitions. Local contrast enhancement works 6744 % similarly to sharpening with an unsharp mask, however the mask is instead 6745 % created using an image with a greater blur distance. 6746 % 6747 % MagickBooleanType MagickLocalContrastImage(MagickWand *wand, 6748 % const double radius,const double strength) 6749 % 6750 % A description of each parameter follows: 6751 % 6752 % o image: the image. 6753 % 6754 % o radius: the radius of the Gaussian, in pixels, not counting 6755 % the center pixel. 6756 % 6757 % o strength: the strength of the blur mask in percentage. 6758 % 6759 */ 6760 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand, 6761 const double radius, const double strength) 6762 { 6763 Image 6764 *contrast_image; 6765 6766 assert(wand != (MagickWand *)NULL); 6767 assert(wand->signature == MagickWandSignature); 6768 if (wand->debug != MagickFalse) 6769 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name); 6770 if (wand->images == (Image *)NULL) 6771 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6772 contrast_image=LocalContrastImage(wand->images,radius,strength, 6773 wand->exception); 6774 if (contrast_image == (Image *)NULL) 6775 return(MagickFalse); 6776 ReplaceImageInList(&wand->images,contrast_image); 6777 return(MagickTrue); 6778 } 6779 6780 /* 6782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6783 % % 6784 % % 6785 % % 6786 % M a g i c k M a g n i f y I m a g e % 6787 % % 6788 % % 6789 % % 6790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6791 % 6792 % MagickMagnifyImage() is a convenience method that scales an image 6793 % proportionally to twice its original size. 6794 % 6795 % The format of the MagickMagnifyImage method is: 6796 % 6797 % MagickBooleanType MagickMagnifyImage(MagickWand *wand) 6798 % 6799 % A description of each parameter follows: 6800 % 6801 % o wand: the magick wand. 6802 % 6803 */ 6804 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand) 6805 { 6806 Image 6807 *magnify_image; 6808 6809 assert(wand != (MagickWand *) NULL); 6810 assert(wand->signature == MagickWandSignature); 6811 if (wand->debug != MagickFalse) 6812 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6813 if (wand->images == (Image *) NULL) 6814 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6815 magnify_image=MagnifyImage(wand->images,wand->exception); 6816 if (magnify_image == (Image *) NULL) 6817 return(MagickFalse); 6818 ReplaceImageInList(&wand->images,magnify_image); 6819 return(MagickTrue); 6820 } 6821 6822 /* 6824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6825 % % 6826 % % 6827 % % 6828 % M a g i c k M e r g e I m a g e L a y e r s % 6829 % % 6830 % % 6831 % % 6832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6833 % 6834 % MagickMergeImageLayers() composes all the image layers from the current 6835 % given image onward to produce a single image of the merged layers. 6836 % 6837 % The inital canvas's size depends on the given LayerMethod, and is 6838 % initialized using the first images background color. The images 6839 % are then compositied onto that image in sequence using the given 6840 % composition that has been assigned to each individual image. 6841 % 6842 % The format of the MagickMergeImageLayers method is: 6843 % 6844 % MagickWand *MagickMergeImageLayers(MagickWand *wand, 6845 % const LayerMethod method) 6846 % 6847 % A description of each parameter follows: 6848 % 6849 % o wand: the magick wand. 6850 % 6851 % o method: the method of selecting the size of the initial canvas. 6852 % 6853 % MergeLayer: Merge all layers onto a canvas just large enough 6854 % to hold all the actual images. The virtual canvas of the 6855 % first image is preserved but otherwise ignored. 6856 % 6857 % FlattenLayer: Use the virtual canvas size of first image. 6858 % Images which fall outside this canvas is clipped. 6859 % This can be used to 'fill out' a given virtual canvas. 6860 % 6861 % MosaicLayer: Start with the virtual canvas of the first image, 6862 % enlarging left and right edges to contain all images. 6863 % Images with negative offsets will be clipped. 6864 % 6865 */ 6866 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand, 6867 const LayerMethod method) 6868 { 6869 Image 6870 *mosaic_image; 6871 6872 assert(wand != (MagickWand *) NULL); 6873 assert(wand->signature == MagickWandSignature); 6874 if (wand->debug != MagickFalse) 6875 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6876 if (wand->images == (Image *) NULL) 6877 return((MagickWand *) NULL); 6878 mosaic_image=MergeImageLayers(wand->images,method,wand->exception); 6879 if (mosaic_image == (Image *) NULL) 6880 return((MagickWand *) NULL); 6881 return(CloneMagickWandFromImages(wand,mosaic_image)); 6882 } 6883 6884 /* 6886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6887 % % 6888 % % 6889 % % 6890 % M a g i c k M i n i f y I m a g e % 6891 % % 6892 % % 6893 % % 6894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6895 % 6896 % MagickMinifyImage() is a convenience method that scales an image 6897 % proportionally to one-half its original size 6898 % 6899 % The format of the MagickMinifyImage method is: 6900 % 6901 % MagickBooleanType MagickMinifyImage(MagickWand *wand) 6902 % 6903 % A description of each parameter follows: 6904 % 6905 % o wand: the magick wand. 6906 % 6907 */ 6908 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand) 6909 { 6910 Image 6911 *minify_image; 6912 6913 assert(wand != (MagickWand *) NULL); 6914 assert(wand->signature == MagickWandSignature); 6915 if (wand->debug != MagickFalse) 6916 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6917 if (wand->images == (Image *) NULL) 6918 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6919 minify_image=MinifyImage(wand->images,wand->exception); 6920 if (minify_image == (Image *) NULL) 6921 return(MagickFalse); 6922 ReplaceImageInList(&wand->images,minify_image); 6923 return(MagickTrue); 6924 } 6925 6926 /* 6928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6929 % % 6930 % % 6931 % % 6932 % M a g i c k M o d u l a t e I m a g e % 6933 % % 6934 % % 6935 % % 6936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6937 % 6938 % MagickModulateImage() lets you control the brightness, saturation, and hue 6939 % of an image. Hue is the percentage of absolute rotation from the current 6940 % position. For example 50 results in a counter-clockwise rotation of 90 6941 % degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200 6942 % both resulting in a rotation of 180 degrees. 6943 % 6944 % To increase the color brightness by 20% and decrease the color saturation by 6945 % 10% and leave the hue unchanged, use: 120,90,100. 6946 % 6947 % The format of the MagickModulateImage method is: 6948 % 6949 % MagickBooleanType MagickModulateImage(MagickWand *wand, 6950 % const double brightness,const double saturation,const double hue) 6951 % 6952 % A description of each parameter follows: 6953 % 6954 % o wand: the magick wand. 6955 % 6956 % o brightness: the percent change in brighness. 6957 % 6958 % o saturation: the percent change in saturation. 6959 % 6960 % o hue: the percent change in hue. 6961 % 6962 */ 6963 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand, 6964 const double brightness,const double saturation,const double hue) 6965 { 6966 char 6967 modulate[MagickPathExtent]; 6968 6969 MagickBooleanType 6970 status; 6971 6972 assert(wand != (MagickWand *) NULL); 6973 assert(wand->signature == MagickWandSignature); 6974 if (wand->debug != MagickFalse) 6975 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 6976 if (wand->images == (Image *) NULL) 6977 ThrowWandException(WandError,"ContainsNoImages",wand->name); 6978 (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g", 6979 brightness,saturation,hue); 6980 status=ModulateImage(wand->images,modulate,wand->exception); 6981 return(status); 6982 } 6983 6984 /* 6986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6987 % % 6988 % % 6989 % % 6990 % M a g i c k M o n t a g e I m a g e % 6991 % % 6992 % % 6993 % % 6994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6995 % 6996 % MagickMontageImage() creates a composite image by combining several 6997 % separate images. The images are tiled on the composite image with the name 6998 % of the image optionally appearing just below the individual tile. 6999 % 7000 % The format of the MagickMontageImage method is: 7001 % 7002 % MagickWand *MagickMontageImage(MagickWand *wand, 7003 % const DrawingWand drawing_wand,const char *tile_geometry, 7004 % const char *thumbnail_geometry,const MontageMode mode, 7005 % const char *frame) 7006 % 7007 % A description of each parameter follows: 7008 % 7009 % o wand: the magick wand. 7010 % 7011 % o drawing_wand: the drawing wand. The font name, size, and color are 7012 % obtained from this wand. 7013 % 7014 % o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0). 7015 % 7016 % o thumbnail_geometry: Preferred image size and border size of each 7017 % thumbnail (e.g. 120x120+4+3>). 7018 % 7019 % o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate. 7020 % 7021 % o frame: Surround the image with an ornamental border (e.g. 15x15+3+3). 7022 % The frame color is that of the thumbnail's matte color. 7023 % 7024 */ 7025 WandExport MagickWand *MagickMontageImage(MagickWand *wand, 7026 const DrawingWand *drawing_wand,const char *tile_geometry, 7027 const char *thumbnail_geometry,const MontageMode mode,const char *frame) 7028 { 7029 char 7030 *font; 7031 7032 Image 7033 *montage_image; 7034 7035 MontageInfo 7036 *montage_info; 7037 7038 PixelWand 7039 *pixel_wand; 7040 7041 assert(wand != (MagickWand *) NULL); 7042 assert(wand->signature == MagickWandSignature); 7043 if (wand->debug != MagickFalse) 7044 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7045 if (wand->images == (Image *) NULL) 7046 return((MagickWand *) NULL); 7047 montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL); 7048 switch (mode) 7049 { 7050 case FrameMode: 7051 { 7052 (void) CloneString(&montage_info->frame,"15x15+3+3"); 7053 montage_info->shadow=MagickTrue; 7054 break; 7055 } 7056 case UnframeMode: 7057 { 7058 montage_info->frame=(char *) NULL; 7059 montage_info->shadow=MagickFalse; 7060 montage_info->border_width=0; 7061 break; 7062 } 7063 case ConcatenateMode: 7064 { 7065 montage_info->frame=(char *) NULL; 7066 montage_info->shadow=MagickFalse; 7067 (void) CloneString(&montage_info->geometry,"+0+0"); 7068 montage_info->border_width=0; 7069 break; 7070 } 7071 default: 7072 break; 7073 } 7074 font=DrawGetFont(drawing_wand); 7075 if (font != (char *) NULL) 7076 (void) CloneString(&montage_info->font,font); 7077 if (frame != (char *) NULL) 7078 (void) CloneString(&montage_info->frame,frame); 7079 montage_info->pointsize=DrawGetFontSize(drawing_wand); 7080 pixel_wand=NewPixelWand(); 7081 DrawGetFillColor(drawing_wand,pixel_wand); 7082 PixelGetQuantumPacket(pixel_wand,&montage_info->fill); 7083 DrawGetStrokeColor(drawing_wand,pixel_wand); 7084 PixelGetQuantumPacket(pixel_wand,&montage_info->stroke); 7085 pixel_wand=DestroyPixelWand(pixel_wand); 7086 if (thumbnail_geometry != (char *) NULL) 7087 (void) CloneString(&montage_info->geometry,thumbnail_geometry); 7088 if (tile_geometry != (char *) NULL) 7089 (void) CloneString(&montage_info->tile,tile_geometry); 7090 montage_image=MontageImageList(wand->image_info,montage_info,wand->images, 7091 wand->exception); 7092 montage_info=DestroyMontageInfo(montage_info); 7093 if (montage_image == (Image *) NULL) 7094 return((MagickWand *) NULL); 7095 return(CloneMagickWandFromImages(wand,montage_image)); 7096 } 7097 7098 /* 7100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7101 % % 7102 % % 7103 % % 7104 % M a g i c k M o r p h I m a g e s % 7105 % % 7106 % % 7107 % % 7108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7109 % 7110 % MagickMorphImages() method morphs a set of images. Both the image pixels 7111 % and size are linearly interpolated to give the appearance of a 7112 % meta-morphosis from one image to the next. 7113 % 7114 % The format of the MagickMorphImages method is: 7115 % 7116 % MagickWand *MagickMorphImages(MagickWand *wand, 7117 % const size_t number_frames) 7118 % 7119 % A description of each parameter follows: 7120 % 7121 % o wand: the magick wand. 7122 % 7123 % o number_frames: the number of in-between images to generate. 7124 % 7125 */ 7126 WandExport MagickWand *MagickMorphImages(MagickWand *wand, 7127 const size_t number_frames) 7128 { 7129 Image 7130 *morph_image; 7131 7132 assert(wand != (MagickWand *) NULL); 7133 assert(wand->signature == MagickWandSignature); 7134 if (wand->debug != MagickFalse) 7135 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7136 if (wand->images == (Image *) NULL) 7137 return((MagickWand *) NULL); 7138 morph_image=MorphImages(wand->images,number_frames,wand->exception); 7139 if (morph_image == (Image *) NULL) 7140 return((MagickWand *) NULL); 7141 return(CloneMagickWandFromImages(wand,morph_image)); 7142 } 7143 7144 /* 7146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7147 % % 7148 % % 7149 % % 7150 % M a g i c k M o r p h o l o g y I m a g e % 7151 % % 7152 % % 7153 % % 7154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7155 % 7156 % MagickMorphologyImage() applies a user supplied kernel to the image 7157 % according to the given mophology method. 7158 % 7159 % The format of the MagickMorphologyImage method is: 7160 % 7161 % MagickBooleanType MagickMorphologyImage(MagickWand *wand, 7162 % MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel) 7163 % 7164 % A description of each parameter follows: 7165 % 7166 % o wand: the magick wand. 7167 % 7168 % o method: the morphology method to be applied. 7169 % 7170 % o iterations: apply the operation this many times (or no change). 7171 % A value of -1 means loop until no change found. How this is applied 7172 % may depend on the morphology method. Typically this is a value of 1. 7173 % 7174 % o kernel: An array of doubles representing the morphology kernel. 7175 % 7176 */ 7177 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand, 7178 MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel) 7179 { 7180 Image 7181 *morphology_image; 7182 7183 assert(wand != (MagickWand *) NULL); 7184 assert(wand->signature == MagickWandSignature); 7185 if (wand->debug != MagickFalse) 7186 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7187 if (kernel == (const KernelInfo *) NULL) 7188 return(MagickFalse); 7189 if (wand->images == (Image *) NULL) 7190 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7191 morphology_image=MorphologyImage(wand->images,method,iterations,kernel, 7192 wand->exception); 7193 if (morphology_image == (Image *) NULL) 7194 return(MagickFalse); 7195 ReplaceImageInList(&wand->images,morphology_image); 7196 return(MagickTrue); 7197 } 7198 7199 /* 7201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7202 % % 7203 % % 7204 % % 7205 % M a g i c k M o t i o n B l u r I m a g e % 7206 % % 7207 % % 7208 % % 7209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7210 % 7211 % MagickMotionBlurImage() simulates motion blur. We convolve the image with a 7212 % Gaussian operator of the given radius and standard deviation (sigma). 7213 % For reasonable results, radius should be larger than sigma. Use a 7214 % radius of 0 and MotionBlurImage() selects a suitable radius for you. 7215 % Angle gives the angle of the blurring motion. 7216 % 7217 % The format of the MagickMotionBlurImage method is: 7218 % 7219 % MagickBooleanType MagickMotionBlurImage(MagickWand *wand, 7220 % const double radius,const double sigma,const double angle) 7221 % 7222 % A description of each parameter follows: 7223 % 7224 % o wand: the magick wand. 7225 % 7226 % o radius: the radius of the Gaussian, in pixels, not counting 7227 % the center pixel. 7228 % 7229 % o sigma: the standard deviation of the Gaussian, in pixels. 7230 % 7231 % o angle: Apply the effect along this angle. 7232 % 7233 */ 7234 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand, 7235 const double radius,const double sigma,const double angle) 7236 { 7237 Image 7238 *blur_image; 7239 7240 assert(wand != (MagickWand *) NULL); 7241 assert(wand->signature == MagickWandSignature); 7242 if (wand->debug != MagickFalse) 7243 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7244 if (wand->images == (Image *) NULL) 7245 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7246 blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception); 7247 if (blur_image == (Image *) NULL) 7248 return(MagickFalse); 7249 ReplaceImageInList(&wand->images,blur_image); 7250 return(MagickTrue); 7251 } 7252 7253 /* 7255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7256 % % 7257 % % 7258 % % 7259 % M a g i c k N e g a t e I m a g e % 7260 % % 7261 % % 7262 % % 7263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7264 % 7265 % MagickNegateImage() negates the colors in the reference image. The 7266 % Grayscale option means that only grayscale values within the image are 7267 % negated. 7268 % 7269 % You can also reduce the influence of a particular channel with a gamma 7270 % value of 0. 7271 % 7272 % The format of the MagickNegateImage method is: 7273 % 7274 % MagickBooleanType MagickNegateImage(MagickWand *wand, 7275 % const MagickBooleanType gray) 7276 % 7277 % A description of each parameter follows: 7278 % 7279 % o wand: the magick wand. 7280 % 7281 % o gray: If MagickTrue, only negate grayscale pixels within the image. 7282 % 7283 */ 7284 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand, 7285 const MagickBooleanType gray) 7286 { 7287 MagickBooleanType 7288 status; 7289 7290 assert(wand != (MagickWand *) NULL); 7291 assert(wand->signature == MagickWandSignature); 7292 if (wand->debug != MagickFalse) 7293 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7294 if (wand->images == (Image *) NULL) 7295 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7296 status=NegateImage(wand->images,gray,wand->exception); 7297 return(status); 7298 } 7299 7300 /* 7302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7303 % % 7304 % % 7305 % % 7306 % M a g i c k N e w I m a g e % 7307 % % 7308 % % 7309 % % 7310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7311 % 7312 % MagickNewImage() adds a blank image canvas of the specified size and 7313 % background color to the wand. 7314 % 7315 % The format of the MagickNewImage method is: 7316 % 7317 % MagickBooleanType MagickNewImage(MagickWand *wand, 7318 % const size_t columns,const size_t rows, 7319 % const PixelWand *background) 7320 % 7321 % A description of each parameter follows: 7322 % 7323 % o wand: the magick wand. 7324 % 7325 % o width: the image width. 7326 % 7327 % o height: the image height. 7328 % 7329 % o background: the image color. 7330 % 7331 */ 7332 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width, 7333 const size_t height,const PixelWand *background) 7334 { 7335 Image 7336 *images; 7337 7338 PixelInfo 7339 pixel; 7340 7341 assert(wand != (MagickWand *) NULL); 7342 assert(wand->signature == MagickWandSignature); 7343 if (wand->debug != MagickFalse) 7344 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7345 PixelGetMagickColor(background,&pixel); 7346 images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception); 7347 if (images == (Image *) NULL) 7348 return(MagickFalse); 7349 return(InsertImageInWand(wand,images)); 7350 } 7351 7352 /* 7354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7355 % % 7356 % % 7357 % % 7358 % M a g i c k N e x t I m a g e % 7359 % % 7360 % % 7361 % % 7362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7363 % 7364 % MagickNextImage() sets the next image in the wand as the current image. 7365 % 7366 % It is typically used after MagickResetIterator(), after which its first use 7367 % will set the first image as the current image (unless the wand is empty). 7368 % 7369 % It will return MagickFalse when no more images are left to be returned 7370 % which happens when the wand is empty, or the current image is the last 7371 % image. 7372 % 7373 % When the above condition (end of image list) is reached, the iterator is 7374 % automaticall set so that you can start using MagickPreviousImage() to 7375 % again iterate over the images in the reverse direction, starting with the 7376 % last image (again). You can jump to this condition immeditally using 7377 % MagickSetLastIterator(). 7378 % 7379 % The format of the MagickNextImage method is: 7380 % 7381 % MagickBooleanType MagickNextImage(MagickWand *wand) 7382 % 7383 % A description of each parameter follows: 7384 % 7385 % o wand: the magick wand. 7386 % 7387 */ 7388 WandExport MagickBooleanType MagickNextImage(MagickWand *wand) 7389 { 7390 assert(wand != (MagickWand *) NULL); 7391 assert(wand->signature == MagickWandSignature); 7392 if (wand->debug != MagickFalse) 7393 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7394 if (wand->images == (Image *) NULL) 7395 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7396 wand->insert_before=MagickFalse; /* Inserts is now appended */ 7397 if (wand->image_pending != MagickFalse) 7398 { 7399 wand->image_pending=MagickFalse; 7400 return(MagickTrue); 7401 } 7402 if (GetNextImageInList(wand->images) == (Image *) NULL) 7403 { 7404 wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */ 7405 return(MagickFalse); 7406 } 7407 wand->images=GetNextImageInList(wand->images); 7408 return(MagickTrue); 7409 } 7410 7411 /* 7413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7414 % % 7415 % % 7416 % % 7417 % M a g i c k N o r m a l i z e I m a g e % 7418 % % 7419 % % 7420 % % 7421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7422 % 7423 % MagickNormalizeImage() enhances the contrast of a color image by adjusting 7424 % the pixels color to span the entire range of colors available 7425 % 7426 % You can also reduce the influence of a particular channel with a gamma 7427 % value of 0. 7428 % 7429 % The format of the MagickNormalizeImage method is: 7430 % 7431 % MagickBooleanType MagickNormalizeImage(MagickWand *wand) 7432 % 7433 % A description of each parameter follows: 7434 % 7435 % o wand: the magick wand. 7436 % 7437 */ 7438 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand) 7439 { 7440 MagickBooleanType 7441 status; 7442 7443 assert(wand != (MagickWand *) NULL); 7444 assert(wand->signature == MagickWandSignature); 7445 if (wand->debug != MagickFalse) 7446 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7447 if (wand->images == (Image *) NULL) 7448 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7449 status=NormalizeImage(wand->images,wand->exception); 7450 return(status); 7451 } 7452 7453 /* 7455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7456 % % 7457 % % 7458 % % 7459 % M a g i c k O i l P a i n t I m a g e % 7460 % % 7461 % % 7462 % % 7463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7464 % 7465 % MagickOilPaintImage() applies a special effect filter that simulates an oil 7466 % painting. Each pixel is replaced by the most frequent color occurring 7467 % in a circular region defined by radius. 7468 % 7469 % The format of the MagickOilPaintImage method is: 7470 % 7471 % MagickBooleanType MagickOilPaintImage(MagickWand *wand, 7472 % const double radius,const double sigma) 7473 % 7474 % A description of each parameter follows: 7475 % 7476 % o wand: the magick wand. 7477 % 7478 % o radius: the radius of the circular neighborhood. 7479 % 7480 % o sigma: the standard deviation of the Gaussian, in pixels. 7481 % 7482 */ 7483 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand, 7484 const double radius,const double sigma) 7485 { 7486 Image 7487 *paint_image; 7488 7489 assert(wand != (MagickWand *) NULL); 7490 assert(wand->signature == MagickWandSignature); 7491 if (wand->debug != MagickFalse) 7492 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7493 if (wand->images == (Image *) NULL) 7494 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7495 paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception); 7496 if (paint_image == (Image *) NULL) 7497 return(MagickFalse); 7498 ReplaceImageInList(&wand->images,paint_image); 7499 return(MagickTrue); 7500 } 7501 7502 /* 7504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7505 % % 7506 % % 7507 % % 7508 % M a g i c k O p a q u e P a i n t I m a g e % 7509 % % 7510 % % 7511 % % 7512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7513 % 7514 % MagickOpaquePaintImage() changes any pixel that matches color with the color 7515 % defined by fill. 7516 % 7517 % The format of the MagickOpaquePaintImage method is: 7518 % 7519 % MagickBooleanType MagickOpaquePaintImage(MagickWand *wand, 7520 % const PixelWand *target,const PixelWand *fill,const double fuzz, 7521 % const MagickBooleanType invert) 7522 % 7523 % A description of each parameter follows: 7524 % 7525 % o wand: the magick wand. 7526 % 7527 % o target: Change this target color to the fill color within the image. 7528 % 7529 % o fill: the fill pixel wand. 7530 % 7531 % o fuzz: By default target must match a particular pixel color 7532 % exactly. However, in many cases two colors may differ by a small amount. 7533 % The fuzz member of image defines how much tolerance is acceptable to 7534 % consider two colors as the same. For example, set fuzz to 10 and the 7535 % color red at intensities of 100 and 102 respectively are now interpreted 7536 % as the same color for the purposes of the floodfill. 7537 % 7538 % o invert: paint any pixel that does not match the target color. 7539 % 7540 */ 7541 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand, 7542 const PixelWand *target,const PixelWand *fill,const double fuzz, 7543 const MagickBooleanType invert) 7544 { 7545 MagickBooleanType 7546 status; 7547 7548 PixelInfo 7549 fill_pixel, 7550 target_pixel; 7551 7552 assert(wand != (MagickWand *) NULL); 7553 assert(wand->signature == MagickWandSignature); 7554 if (wand->debug != MagickFalse) 7555 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7556 if (wand->images == (Image *) NULL) 7557 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7558 PixelGetMagickColor(target,&target_pixel); 7559 PixelGetMagickColor(fill,&fill_pixel); 7560 wand->images->fuzz=fuzz; 7561 status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert, 7562 wand->exception); 7563 return(status); 7564 } 7565 7566 /* 7568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7569 % % 7570 % % 7571 % % 7572 % M a g i c k O p t i m i z e I m a g e L a y e r s % 7573 % % 7574 % % 7575 % % 7576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7577 % 7578 % MagickOptimizeImageLayers() compares each image the GIF disposed forms of the 7579 % previous image in the sequence. From this it attempts to select the 7580 % smallest cropped image to replace each frame, while preserving the results 7581 % of the animation. 7582 % 7583 % The format of the MagickOptimizeImageLayers method is: 7584 % 7585 % MagickWand *MagickOptimizeImageLayers(MagickWand *wand) 7586 % 7587 % A description of each parameter follows: 7588 % 7589 % o wand: the magick wand. 7590 % 7591 */ 7592 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand) 7593 { 7594 Image 7595 *optimize_image; 7596 7597 assert(wand != (MagickWand *) NULL); 7598 assert(wand->signature == MagickWandSignature); 7599 if (wand->debug != MagickFalse) 7600 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7601 if (wand->images == (Image *) NULL) 7602 return((MagickWand *) NULL); 7603 optimize_image=OptimizeImageLayers(wand->images,wand->exception); 7604 if (optimize_image == (Image *) NULL) 7605 return((MagickWand *) NULL); 7606 return(CloneMagickWandFromImages(wand,optimize_image)); 7607 } 7608 7609 /* 7611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7612 % % 7613 % % 7614 % % 7615 % M a g i c k O p t i m i z e I m a g e T r a n s p a r e n c y % 7616 % % 7617 % % 7618 % % 7619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7620 % 7621 % MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and 7622 % compares the overlayed pixels against the disposal image resulting from all 7623 % the previous frames in the animation. Any pixel that does not change the 7624 % disposal image (and thus does not effect the outcome of an overlay) is made 7625 % transparent. 7626 % 7627 % WARNING: This modifies the current images directly, rather than generate 7628 % a new image sequence. 7629 % The format of the MagickOptimizeImageTransparency method is: 7630 % 7631 % MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand) 7632 % 7633 % A description of each parameter follows: 7634 % 7635 % o wand: the magick wand. 7636 % 7637 */ 7638 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand) 7639 { 7640 assert(wand != (MagickWand *) NULL); 7641 assert(wand->signature == MagickWandSignature); 7642 if (wand->debug != MagickFalse) 7643 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7644 if (wand->images == (Image *) NULL) 7645 return(MagickFalse); 7646 OptimizeImageTransparency(wand->images,wand->exception); 7647 return(MagickTrue); 7648 } 7649 7650 /* 7652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7653 % % 7654 % % 7655 % % 7656 % M a g i c k O r d e r e d D i t h e r I m a g e % 7657 % % 7658 % % 7659 % % 7660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7661 % 7662 % MagickOrderedDitherImage() performs an ordered dither based on a number 7663 % of pre-defined dithering threshold maps, but over multiple intensity levels, 7664 % which can be different for different channels, according to the input 7665 % arguments. 7666 % 7667 % The format of the MagickOrderedDitherImage method is: 7668 % 7669 % MagickBooleanType MagickOrderedDitherImage(MagickWand *wand, 7670 % const char *threshold_map) 7671 % 7672 % A description of each parameter follows: 7673 % 7674 % o image: the image. 7675 % 7676 % o threshold_map: A string containing the name of the threshold dither 7677 % map to use, followed by zero or more numbers representing the number of 7678 % color levels tho dither between. 7679 % 7680 % Any level number less than 2 is equivalent to 2, and means only binary 7681 % dithering will be applied to each color channel. 7682 % 7683 % No numbers also means a 2 level (bitmap) dither will be applied to all 7684 % channels, while a single number is the number of levels applied to each 7685 % channel in sequence. More numbers will be applied in turn to each of 7686 % the color channels. 7687 % 7688 % For example: "o3x3,6" generates a 6 level posterization of the image 7689 % with a ordered 3x3 diffused pixel dither being applied between each 7690 % level. While checker,8,8,4 will produce a 332 colormaped image with 7691 % only a single checkerboard hash pattern (50% grey) between each color 7692 % level, to basically double the number of color levels with a bare 7693 % minimim of dithering. 7694 % 7695 */ 7696 WandExport MagickBooleanType MagickOrderedDitherImage(MagickWand *wand, 7697 const char *threshold_map) 7698 { 7699 MagickBooleanType 7700 status; 7701 7702 assert(wand != (MagickWand *) NULL); 7703 assert(wand->signature == MagickWandSignature); 7704 if (wand->debug != MagickFalse) 7705 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7706 if (wand->images == (Image *) NULL) 7707 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7708 status=OrderedDitherImage(wand->images,threshold_map,wand->exception); 7709 return(status); 7710 } 7711 7712 /* 7714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7715 % % 7716 % % 7717 % % 7718 % M a g i c k P i n g I m a g e % 7719 % % 7720 % % 7721 % % 7722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7723 % 7724 % MagickPingImage() is the same as MagickReadImage() except the only valid 7725 % information returned is the image width, height, size, and format. It 7726 % is designed to efficiently obtain this information from a file without 7727 % reading the entire image sequence into memory. 7728 % 7729 % The format of the MagickPingImage method is: 7730 % 7731 % MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename) 7732 % 7733 % A description of each parameter follows: 7734 % 7735 % o wand: the magick wand. 7736 % 7737 % o filename: the image filename. 7738 % 7739 */ 7740 WandExport MagickBooleanType MagickPingImage(MagickWand *wand, 7741 const char *filename) 7742 { 7743 Image 7744 *images; 7745 7746 ImageInfo 7747 *ping_info; 7748 7749 assert(wand != (MagickWand *) NULL); 7750 assert(wand->signature == MagickWandSignature); 7751 if (wand->debug != MagickFalse) 7752 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7753 ping_info=CloneImageInfo(wand->image_info); 7754 if (filename != (const char *) NULL) 7755 (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent); 7756 images=PingImage(ping_info,wand->exception); 7757 ping_info=DestroyImageInfo(ping_info); 7758 if (images == (Image *) NULL) 7759 return(MagickFalse); 7760 return(InsertImageInWand(wand,images)); 7761 } 7762 7763 /* 7765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7766 % % 7767 % % 7768 % % 7769 % M a g i c k P i n g I m a g e B l o b % 7770 % % 7771 % % 7772 % % 7773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7774 % 7775 % MagickPingImageBlob() pings an image or image sequence from a blob. 7776 % 7777 % The format of the MagickPingImageBlob method is: 7778 % 7779 % MagickBooleanType MagickPingImageBlob(MagickWand *wand, 7780 % const void *blob,const size_t length) 7781 % 7782 % A description of each parameter follows: 7783 % 7784 % o wand: the magick wand. 7785 % 7786 % o blob: the blob. 7787 % 7788 % o length: the blob length. 7789 % 7790 */ 7791 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand, 7792 const void *blob,const size_t length) 7793 { 7794 Image 7795 *images; 7796 7797 ImageInfo 7798 *read_info; 7799 7800 assert(wand != (MagickWand *) NULL); 7801 assert(wand->signature == MagickWandSignature); 7802 if (wand->debug != MagickFalse) 7803 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7804 read_info=CloneImageInfo(wand->image_info); 7805 SetImageInfoBlob(read_info,blob,length); 7806 images=PingImage(read_info,wand->exception); 7807 read_info=DestroyImageInfo(read_info); 7808 if (images == (Image *) NULL) 7809 return(MagickFalse); 7810 return(InsertImageInWand(wand,images)); 7811 } 7812 7813 /* 7815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7816 % % 7817 % % 7818 % % 7819 % M a g i c k P i n g I m a g e F i l e % 7820 % % 7821 % % 7822 % % 7823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7824 % 7825 % MagickPingImageFile() pings an image or image sequence from an open file 7826 % descriptor. 7827 % 7828 % The format of the MagickPingImageFile method is: 7829 % 7830 % MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file) 7831 % 7832 % A description of each parameter follows: 7833 % 7834 % o wand: the magick wand. 7835 % 7836 % o file: the file descriptor. 7837 % 7838 */ 7839 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file) 7840 { 7841 Image 7842 *images; 7843 7844 ImageInfo 7845 *read_info; 7846 7847 assert(wand != (MagickWand *) NULL); 7848 assert(wand->signature == MagickWandSignature); 7849 assert(file != (FILE *) NULL); 7850 if (wand->debug != MagickFalse) 7851 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7852 read_info=CloneImageInfo(wand->image_info); 7853 SetImageInfoFile(read_info,file); 7854 images=PingImage(read_info,wand->exception); 7855 read_info=DestroyImageInfo(read_info); 7856 if (images == (Image *) NULL) 7857 return(MagickFalse); 7858 return(InsertImageInWand(wand,images)); 7859 } 7860 7861 /* 7863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7864 % % 7865 % % 7866 % % 7867 % M a g i c k P o l a r o i d I m a g e % 7868 % % 7869 % % 7870 % % 7871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7872 % 7873 % MagickPolaroidImage() simulates a Polaroid picture. 7874 % 7875 % The format of the MagickPolaroidImage method is: 7876 % 7877 % MagickBooleanType MagickPolaroidImage(MagickWand *wand, 7878 % const DrawingWand *drawing_wand,const char *caption,const double angle, 7879 % const PixelInterpolateMethod method) 7880 % 7881 % A description of each parameter follows: 7882 % 7883 % o wand: the magick wand. 7884 % 7885 % o drawing_wand: the draw wand. 7886 % 7887 % o caption: the Polaroid caption. 7888 % 7889 % o angle: Apply the effect along this angle. 7890 % 7891 % o method: the pixel interpolation method. 7892 % 7893 */ 7894 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand, 7895 const DrawingWand *drawing_wand,const char *caption,const double angle, 7896 const PixelInterpolateMethod method) 7897 { 7898 DrawInfo 7899 *draw_info; 7900 7901 Image 7902 *polaroid_image; 7903 7904 assert(wand != (MagickWand *) NULL); 7905 assert(wand->signature == MagickWandSignature); 7906 if (wand->debug != MagickFalse) 7907 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7908 if (wand->images == (Image *) NULL) 7909 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7910 draw_info=PeekDrawingWand(drawing_wand); 7911 if (draw_info == (DrawInfo *) NULL) 7912 return(MagickFalse); 7913 polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method, 7914 wand->exception); 7915 if (polaroid_image == (Image *) NULL) 7916 return(MagickFalse); 7917 ReplaceImageInList(&wand->images,polaroid_image); 7918 return(MagickTrue); 7919 } 7920 7921 /* 7923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7924 % % 7925 % % 7926 % % 7927 % M a g i c k P o s t e r i z e I m a g e % 7928 % % 7929 % % 7930 % % 7931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7932 % 7933 % MagickPosterizeImage() reduces the image to a limited number of color level. 7934 % 7935 % The format of the MagickPosterizeImage method is: 7936 % 7937 % MagickBooleanType MagickPosterizeImage(MagickWand *wand, 7938 % const size_t levels,const DitherMethod method) 7939 % 7940 % A description of each parameter follows: 7941 % 7942 % o wand: the magick wand. 7943 % 7944 % o levels: Number of color levels allowed in each channel. Very low values 7945 % (2, 3, or 4) have the most visible effect. 7946 % 7947 % o method: choose the dither method: UndefinedDitherMethod, 7948 % NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod. 7949 % 7950 */ 7951 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand, 7952 const size_t levels,const DitherMethod dither) 7953 { 7954 MagickBooleanType 7955 status; 7956 7957 assert(wand != (MagickWand *) NULL); 7958 assert(wand->signature == MagickWandSignature); 7959 if (wand->debug != MagickFalse) 7960 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 7961 if (wand->images == (Image *) NULL) 7962 ThrowWandException(WandError,"ContainsNoImages",wand->name); 7963 status=PosterizeImage(wand->images,levels,dither,wand->exception); 7964 return(status); 7965 } 7966 7967 /* 7969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7970 % % 7971 % % 7972 % % 7973 % M a g i c k P r e v i e w I m a g e s % 7974 % % 7975 % % 7976 % % 7977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7978 % 7979 % MagickPreviewImages() tiles 9 thumbnails of the specified image with an 7980 % image processing operation applied at varying strengths. This helpful 7981 % to quickly pin-point an appropriate parameter for an image processing 7982 % operation. 7983 % 7984 % The format of the MagickPreviewImages method is: 7985 % 7986 % MagickWand *MagickPreviewImages(MagickWand *wand, 7987 % const PreviewType preview) 7988 % 7989 % A description of each parameter follows: 7990 % 7991 % o wand: the magick wand. 7992 % 7993 % o preview: the preview type. 7994 % 7995 */ 7996 WandExport MagickWand *MagickPreviewImages(MagickWand *wand, 7997 const PreviewType preview) 7998 { 7999 Image 8000 *preview_image; 8001 8002 assert(wand != (MagickWand *) NULL); 8003 assert(wand->signature == MagickWandSignature); 8004 if (wand->debug != MagickFalse) 8005 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8006 if (wand->images == (Image *) NULL) 8007 return((MagickWand *) NULL); 8008 preview_image=PreviewImage(wand->images,preview,wand->exception); 8009 if (preview_image == (Image *) NULL) 8010 return((MagickWand *) NULL); 8011 return(CloneMagickWandFromImages(wand,preview_image)); 8012 } 8013 8014 /* 8016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8017 % % 8018 % % 8019 % % 8020 % M a g i c k P r e v i o u s I m a g e % 8021 % % 8022 % % 8023 % % 8024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8025 % 8026 % MagickPreviousImage() sets the previous image in the wand as the current 8027 % image. 8028 % 8029 % It is typically used after MagickSetLastIterator(), after which its first 8030 % use will set the last image as the current image (unless the wand is empty). 8031 % 8032 % It will return MagickFalse when no more images are left to be returned 8033 % which happens when the wand is empty, or the current image is the first 8034 % image. At that point the iterator is than reset to again process images in 8035 % the forward direction, again starting with the first image in list. Images 8036 % added at this point are prepended. 8037 % 8038 % Also at that point any images added to the wand using MagickAddImages() or 8039 % MagickReadImages() will be prepended before the first image. In this sense 8040 % the condition is not quite exactly the same as MagickResetIterator(). 8041 % 8042 % The format of the MagickPreviousImage method is: 8043 % 8044 % MagickBooleanType MagickPreviousImage(MagickWand *wand) 8045 % 8046 % A description of each parameter follows: 8047 % 8048 % o wand: the magick wand. 8049 % 8050 */ 8051 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand) 8052 { 8053 assert(wand != (MagickWand *) NULL); 8054 assert(wand->signature == MagickWandSignature); 8055 if (wand->debug != MagickFalse) 8056 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8057 if (wand->images == (Image *) NULL) 8058 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8059 if (wand->image_pending != MagickFalse) 8060 { 8061 wand->image_pending=MagickFalse; /* image returned no longer pending */ 8062 return(MagickTrue); 8063 } 8064 if (GetPreviousImageInList(wand->images) == (Image *) NULL) 8065 { 8066 wand->image_pending=MagickTrue; /* Next now re-gets first image */ 8067 wand->insert_before=MagickTrue; /* insert/add prepends new images */ 8068 return(MagickFalse); 8069 } 8070 wand->images=GetPreviousImageInList(wand->images); 8071 return(MagickTrue); 8072 } 8073 8074 /* 8076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8077 % % 8078 % % 8079 % % 8080 % M a g i c k Q u a n t i z e I m a g e % 8081 % % 8082 % % 8083 % % 8084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8085 % 8086 % MagickQuantizeImage() analyzes the colors within a reference image and 8087 % chooses a fixed number of colors to represent the image. The goal of the 8088 % algorithm is to minimize the color difference between the input and output 8089 % image while minimizing the processing time. 8090 % 8091 % The format of the MagickQuantizeImage method is: 8092 % 8093 % MagickBooleanType MagickQuantizeImage(MagickWand *wand, 8094 % const size_t number_colors,const ColorspaceType colorspace, 8095 % const size_t treedepth,const DitherMethod dither_method, 8096 % const MagickBooleanType measure_error) 8097 % 8098 % A description of each parameter follows: 8099 % 8100 % o wand: the magick wand. 8101 % 8102 % o number_colors: the number of colors. 8103 % 8104 % o colorspace: Perform color reduction in this colorspace, typically 8105 % RGBColorspace. 8106 % 8107 % o treedepth: Normally, this integer value is zero or one. A zero or 8108 % one tells Quantize to choose a optimal tree depth of Log4(number_colors).% A tree of this depth generally allows the best representation of the 8109 % reference image with the least amount of memory and the fastest 8110 % computational speed. In some cases, such as an image with low color 8111 % dispersion (a few number of colors), a value other than 8112 % Log4(number_colors) is required. To expand the color tree completely, 8113 % use a value of 8. 8114 % 8115 % o dither_method: choose from UndefinedDitherMethod, NoDitherMethod, 8116 % RiemersmaDitherMethod, FloydSteinbergDitherMethod. 8117 % 8118 % o measure_error: A value other than zero measures the difference between 8119 % the original and quantized images. This difference is the total 8120 % quantization error. The error is computed by summing over all pixels 8121 % in an image the distance squared in RGB space between each reference 8122 % pixel value and its quantized value. 8123 % 8124 */ 8125 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand, 8126 const size_t number_colors,const ColorspaceType colorspace, 8127 const size_t treedepth,const DitherMethod dither_method, 8128 const MagickBooleanType measure_error) 8129 { 8130 MagickBooleanType 8131 status; 8132 8133 QuantizeInfo 8134 *quantize_info; 8135 8136 assert(wand != (MagickWand *) NULL); 8137 assert(wand->signature == MagickWandSignature); 8138 if (wand->debug != MagickFalse) 8139 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8140 if (wand->images == (Image *) NULL) 8141 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8142 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL); 8143 quantize_info->number_colors=number_colors; 8144 quantize_info->dither_method=dither_method; 8145 quantize_info->tree_depth=treedepth; 8146 quantize_info->colorspace=colorspace; 8147 quantize_info->measure_error=measure_error; 8148 status=QuantizeImage(quantize_info,wand->images,wand->exception); 8149 quantize_info=DestroyQuantizeInfo(quantize_info); 8150 return(status); 8151 } 8152 8153 /* 8155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8156 % % 8157 % % 8158 % % 8159 % M a g i c k Q u a n t i z e I m a g e s % 8160 % % 8161 % % 8162 % % 8163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8164 % 8165 % MagickQuantizeImages() analyzes the colors within a sequence of images and 8166 % chooses a fixed number of colors to represent the image. The goal of the 8167 % algorithm is to minimize the color difference between the input and output 8168 % image while minimizing the processing time. 8169 % 8170 % The format of the MagickQuantizeImages method is: 8171 % 8172 % MagickBooleanType MagickQuantizeImages(MagickWand *wand, 8173 % const size_t number_colors,const ColorspaceType colorspace, 8174 % const size_t treedepth,const DitherMethod dither_method, 8175 % const MagickBooleanType measure_error) 8176 % 8177 % A description of each parameter follows: 8178 % 8179 % o wand: the magick wand. 8180 % 8181 % o number_colors: the number of colors. 8182 % 8183 % o colorspace: Perform color reduction in this colorspace, typically 8184 % RGBColorspace. 8185 % 8186 % o treedepth: Normally, this integer value is zero or one. A zero or 8187 % one tells Quantize to choose a optimal tree depth of Log4(number_colors).% A tree of this depth generally allows the best representation of the 8188 % reference image with the least amount of memory and the fastest 8189 % computational speed. In some cases, such as an image with low color 8190 % dispersion (a few number of colors), a value other than 8191 % Log4(number_colors) is required. To expand the color tree completely, 8192 % use a value of 8. 8193 % 8194 % o dither_method: choose from these dither methods: NoDitherMethod, 8195 % RiemersmaDitherMethod, or FloydSteinbergDitherMethod. 8196 % 8197 % o measure_error: A value other than zero measures the difference between 8198 % the original and quantized images. This difference is the total 8199 % quantization error. The error is computed by summing over all pixels 8200 % in an image the distance squared in RGB space between each reference 8201 % pixel value and its quantized value. 8202 % 8203 */ 8204 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand, 8205 const size_t number_colors,const ColorspaceType colorspace, 8206 const size_t treedepth,const DitherMethod dither_method, 8207 const MagickBooleanType measure_error) 8208 { 8209 MagickBooleanType 8210 status; 8211 8212 QuantizeInfo 8213 *quantize_info; 8214 8215 assert(wand != (MagickWand *) NULL); 8216 assert(wand->signature == MagickWandSignature); 8217 if (wand->debug != MagickFalse) 8218 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8219 if (wand->images == (Image *) NULL) 8220 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8221 quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL); 8222 quantize_info->number_colors=number_colors; 8223 quantize_info->dither_method=dither_method; 8224 quantize_info->tree_depth=treedepth; 8225 quantize_info->colorspace=colorspace; 8226 quantize_info->measure_error=measure_error; 8227 status=QuantizeImages(quantize_info,wand->images,wand->exception); 8228 quantize_info=DestroyQuantizeInfo(quantize_info); 8229 return(status); 8230 } 8231 8232 /* 8234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8235 % % 8236 % % 8237 % % 8238 % M a g i c k R o t a t i o n a l B l u r I m a g e % 8239 % % 8240 % % 8241 % % 8242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8243 % 8244 % MagickRotationalBlurImage() rotational blurs an image. 8245 % 8246 % The format of the MagickRotationalBlurImage method is: 8247 % 8248 % MagickBooleanType MagickRotationalBlurImage(MagickWand *wand, 8249 % const double angle) 8250 % 8251 % A description of each parameter follows: 8252 % 8253 % o wand: the magick wand. 8254 % 8255 % o angle: the angle of the blur in degrees. 8256 % 8257 */ 8258 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand, 8259 const double angle) 8260 { 8261 Image 8262 *blur_image; 8263 8264 assert(wand != (MagickWand *) NULL); 8265 assert(wand->signature == MagickWandSignature); 8266 if (wand->debug != MagickFalse) 8267 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8268 if (wand->images == (Image *) NULL) 8269 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8270 blur_image=RotationalBlurImage(wand->images,angle,wand->exception); 8271 if (blur_image == (Image *) NULL) 8272 return(MagickFalse); 8273 ReplaceImageInList(&wand->images,blur_image); 8274 return(MagickTrue); 8275 } 8276 8277 /* 8279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8280 % % 8281 % % 8282 % % 8283 % M a g i c k R a i s e I m a g e % 8284 % % 8285 % % 8286 % % 8287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8288 % 8289 % MagickRaiseImage() creates a simulated three-dimensional button-like effect 8290 % by lightening and darkening the edges of the image. Members width and 8291 % height of raise_info define the width of the vertical and horizontal 8292 % edge of the effect. 8293 % 8294 % The format of the MagickRaiseImage method is: 8295 % 8296 % MagickBooleanType MagickRaiseImage(MagickWand *wand, 8297 % const size_t width,const size_t height,const ssize_t x, 8298 % const ssize_t y,const MagickBooleanType raise) 8299 % 8300 % A description of each parameter follows: 8301 % 8302 % o wand: the magick wand. 8303 % 8304 % o width,height,x,y: Define the dimensions of the area to raise. 8305 % 8306 % o raise: A value other than zero creates a 3-D raise effect, 8307 % otherwise it has a lowered effect. 8308 % 8309 */ 8310 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand, 8311 const size_t width,const size_t height,const ssize_t x, 8312 const ssize_t y,const MagickBooleanType raise) 8313 { 8314 MagickBooleanType 8315 status; 8316 8317 RectangleInfo 8318 raise_info; 8319 8320 assert(wand != (MagickWand *) NULL); 8321 assert(wand->signature == MagickWandSignature); 8322 if (wand->debug != MagickFalse) 8323 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8324 if (wand->images == (Image *) NULL) 8325 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8326 raise_info.width=width; 8327 raise_info.height=height; 8328 raise_info.x=x; 8329 raise_info.y=y; 8330 status=RaiseImage(wand->images,&raise_info,raise,wand->exception); 8331 return(status); 8332 } 8333 8334 /* 8336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8337 % % 8338 % % 8339 % % 8340 % M a g i c k R a n d o m T h r e s h o l d I m a g e % 8341 % % 8342 % % 8343 % % 8344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8345 % 8346 % MagickRandomThresholdImage() changes the value of individual pixels based on 8347 % the intensity of each pixel compared to threshold. The result is a 8348 % high-contrast, two color image. 8349 % 8350 % The format of the MagickRandomThresholdImage method is: 8351 % 8352 % MagickBooleanType MagickRandomThresholdImage(MagickWand *wand, 8353 % const double low,const double high) 8354 % 8355 % A description of each parameter follows: 8356 % 8357 % o wand: the magick wand. 8358 % 8359 % o low,high: Specify the high and low thresholds. These values range from 8360 % 0 to QuantumRange. 8361 % 8362 */ 8363 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand, 8364 const double low,const double high) 8365 { 8366 assert(wand != (MagickWand *) NULL); 8367 assert(wand->signature == MagickWandSignature); 8368 if (wand->debug != MagickFalse) 8369 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8370 if (wand->images == (Image *) NULL) 8371 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8372 return(RandomThresholdImage(wand->images,low,high,wand->exception)); 8373 } 8374 8375 /* 8377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8378 % % 8379 % % 8380 % % 8381 % M a g i c k R e a d I m a g e % 8382 % % 8383 % % 8384 % % 8385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8386 % 8387 % MagickReadImage() reads an image or image sequence. The images are inserted 8388 % jjust before the current image pointer position. 8389 % 8390 % Use MagickSetFirstIterator(), to insert new images before all the current 8391 % images in the wand, MagickSetLastIterator() to append add to the end, 8392 % MagickSetIteratorIndex() to place images just after the given index. 8393 % 8394 % The format of the MagickReadImage method is: 8395 % 8396 % MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename) 8397 % 8398 % A description of each parameter follows: 8399 % 8400 % o wand: the magick wand. 8401 % 8402 % o filename: the image filename. 8403 % 8404 */ 8405 WandExport MagickBooleanType MagickReadImage(MagickWand *wand, 8406 const char *filename) 8407 { 8408 Image 8409 *images; 8410 8411 ImageInfo 8412 *read_info; 8413 8414 assert(wand != (MagickWand *) NULL); 8415 assert(wand->signature == MagickWandSignature); 8416 if (wand->debug != MagickFalse) 8417 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8418 read_info=CloneImageInfo(wand->image_info); 8419 if (filename != (const char *) NULL) 8420 (void) CopyMagickString(read_info->filename,filename,MagickPathExtent); 8421 images=ReadImage(read_info,wand->exception); 8422 read_info=DestroyImageInfo(read_info); 8423 if (images == (Image *) NULL) 8424 return(MagickFalse); 8425 return(InsertImageInWand(wand,images)); 8426 } 8427 8428 /* 8430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8431 % % 8432 % % 8433 % % 8434 % M a g i c k R e a d I m a g e B l o b % 8435 % % 8436 % % 8437 % % 8438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8439 % 8440 % MagickReadImageBlob() reads an image or image sequence from a blob. 8441 % In all other respects it is like MagickReadImage(). 8442 % 8443 % The format of the MagickReadImageBlob method is: 8444 % 8445 % MagickBooleanType MagickReadImageBlob(MagickWand *wand, 8446 % const void *blob,const size_t length) 8447 % 8448 % A description of each parameter follows: 8449 % 8450 % o wand: the magick wand. 8451 % 8452 % o blob: the blob. 8453 % 8454 % o length: the blob length. 8455 % 8456 */ 8457 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand, 8458 const void *blob,const size_t length) 8459 { 8460 Image 8461 *images; 8462 8463 assert(wand != (MagickWand *) NULL); 8464 assert(wand->signature == MagickWandSignature); 8465 if (wand->debug != MagickFalse) 8466 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8467 images=BlobToImage(wand->image_info,blob,length,wand->exception); 8468 if (images == (Image *) NULL) 8469 return(MagickFalse); 8470 return(InsertImageInWand(wand,images)); 8471 } 8472 8473 /* 8475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8476 % % 8477 % % 8478 % % 8479 % M a g i c k R e a d I m a g e F i l e % 8480 % % 8481 % % 8482 % % 8483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8484 % 8485 % MagickReadImageFile() reads an image or image sequence from an already 8486 % opened file descriptor. Otherwise it is like MagickReadImage(). 8487 % 8488 % The format of the MagickReadImageFile method is: 8489 % 8490 % MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file) 8491 % 8492 % A description of each parameter follows: 8493 % 8494 % o wand: the magick wand. 8495 % 8496 % o file: the file descriptor. 8497 % 8498 */ 8499 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file) 8500 { 8501 Image 8502 *images; 8503 8504 ImageInfo 8505 *read_info; 8506 8507 assert(wand != (MagickWand *) NULL); 8508 assert(wand->signature == MagickWandSignature); 8509 assert(file != (FILE *) NULL); 8510 if (wand->debug != MagickFalse) 8511 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8512 read_info=CloneImageInfo(wand->image_info); 8513 SetImageInfoFile(read_info,file); 8514 images=ReadImage(read_info,wand->exception); 8515 read_info=DestroyImageInfo(read_info); 8516 if (images == (Image *) NULL) 8517 return(MagickFalse); 8518 return(InsertImageInWand(wand,images)); 8519 } 8520 8521 /* 8523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8524 % % 8525 % % 8526 % % 8527 % M a g i c k R e m a p I m a g e % 8528 % % 8529 % % 8530 % % 8531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8532 % 8533 % MagickRemapImage() replaces the colors of an image with the closest color 8534 % from a reference image. 8535 % 8536 % The format of the MagickRemapImage method is: 8537 % 8538 % MagickBooleanType MagickRemapImage(MagickWand *wand, 8539 % const MagickWand *remap_wand,const DitherMethod method) 8540 % 8541 % A description of each parameter follows: 8542 % 8543 % o wand: the magick wand. 8544 % 8545 % o affinity: the affinity wand. 8546 % 8547 % o method: choose from these dither methods: NoDitherMethod, 8548 % RiemersmaDitherMethod, or FloydSteinbergDitherMethod. 8549 % 8550 */ 8551 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand, 8552 const MagickWand *remap_wand,const DitherMethod dither_method) 8553 { 8554 MagickBooleanType 8555 status; 8556 8557 QuantizeInfo 8558 *quantize_info; 8559 8560 assert(wand != (MagickWand *) NULL); 8561 assert(wand->signature == MagickWandSignature); 8562 if (wand->debug != MagickFalse) 8563 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8564 if ((wand->images == (Image *) NULL) || 8565 (remap_wand->images == (Image *) NULL)) 8566 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8567 quantize_info=AcquireQuantizeInfo(wand->image_info); 8568 quantize_info->dither_method=dither_method; 8569 status=RemapImage(quantize_info,wand->images,remap_wand->images, 8570 wand->exception); 8571 quantize_info=DestroyQuantizeInfo(quantize_info); 8572 return(status); 8573 } 8574 8575 /* 8577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8578 % % 8579 % % 8580 % % 8581 % M a g i c k R e m o v e I m a g e % 8582 % % 8583 % % 8584 % % 8585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8586 % 8587 % MagickRemoveImage() removes an image from the image list. 8588 % 8589 % The format of the MagickRemoveImage method is: 8590 % 8591 % MagickBooleanType MagickRemoveImage(MagickWand *wand) 8592 % 8593 % A description of each parameter follows: 8594 % 8595 % o wand: the magick wand. 8596 % 8597 % o insert: the splice wand. 8598 % 8599 */ 8600 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand) 8601 { 8602 assert(wand != (MagickWand *) NULL); 8603 assert(wand->signature == MagickWandSignature); 8604 if (wand->debug != MagickFalse) 8605 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8606 if (wand->images == (Image *) NULL) 8607 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8608 DeleteImageFromList(&wand->images); 8609 return(MagickTrue); 8610 } 8611 8612 /* 8614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8615 % % 8616 % % 8617 % % 8618 % M a g i c k R e s a m p l e I m a g e % 8619 % % 8620 % % 8621 % % 8622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8623 % 8624 % MagickResampleImage() resample image to desired resolution. 8625 % 8626 % Bessel Blackman Box 8627 % Catrom Cubic Gaussian 8628 % Hanning Hermite Lanczos 8629 % Mitchell Point Quandratic 8630 % Sinc Triangle 8631 % 8632 % Most of the filters are FIR (finite impulse response), however, Bessel, 8633 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc 8634 % are windowed (brought down to zero) with the Blackman filter. 8635 % 8636 % The format of the MagickResampleImage method is: 8637 % 8638 % MagickBooleanType MagickResampleImage(MagickWand *wand, 8639 % const double x_resolution,const double y_resolution, 8640 % const FilterType filter) 8641 % 8642 % A description of each parameter follows: 8643 % 8644 % o wand: the magick wand. 8645 % 8646 % o x_resolution: the new image x resolution. 8647 % 8648 % o y_resolution: the new image y resolution. 8649 % 8650 % o filter: Image filter to use. 8651 % 8652 */ 8653 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand, 8654 const double x_resolution,const double y_resolution,const FilterType filter) 8655 { 8656 Image 8657 *resample_image; 8658 8659 assert(wand != (MagickWand *) NULL); 8660 assert(wand->signature == MagickWandSignature); 8661 if (wand->debug != MagickFalse) 8662 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8663 if (wand->images == (Image *) NULL) 8664 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8665 resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter, 8666 wand->exception); 8667 if (resample_image == (Image *) NULL) 8668 return(MagickFalse); 8669 ReplaceImageInList(&wand->images,resample_image); 8670 return(MagickTrue); 8671 } 8672 8673 /* 8675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8676 % % 8677 % % 8678 % % 8679 % M a g i c k R e s e t I m a g e P a g e % 8680 % % 8681 % % 8682 % % 8683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8684 % 8685 % MagickResetImagePage() resets the Wand page canvas and position. 8686 % 8687 % The format of the MagickResetImagePage method is: 8688 % 8689 % MagickBooleanType MagickResetImagePage(MagickWand *wand, 8690 % const char *page) 8691 % 8692 % A description of each parameter follows: 8693 % 8694 % o wand: the magick wand. 8695 % 8696 % o page: the relative page specification. 8697 % 8698 */ 8699 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand, 8700 const char *page) 8701 { 8702 assert(wand != (MagickWand *) NULL); 8703 assert(wand->signature == MagickWandSignature); 8704 if (wand->debug != MagickFalse) 8705 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8706 if (wand->images == (Image *) NULL) 8707 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8708 if ((page == (char *) NULL) || (*page == '\0')) 8709 { 8710 (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page); 8711 return(MagickTrue); 8712 } 8713 return(ResetImagePage(wand->images,page)); 8714 } 8715 8716 /* 8718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8719 % % 8720 % % 8721 % % 8722 % M a g i c k R e s i z e I m a g e % 8723 % % 8724 % % 8725 % % 8726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8727 % 8728 % MagickResizeImage() scales an image to the desired dimensions with one of 8729 % these filters: 8730 % 8731 % Bessel Blackman Box 8732 % Catrom Cubic Gaussian 8733 % Hanning Hermite Lanczos 8734 % Mitchell Point Quandratic 8735 % Sinc Triangle 8736 % 8737 % Most of the filters are FIR (finite impulse response), however, Bessel, 8738 % Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc 8739 % are windowed (brought down to zero) with the Blackman filter. 8740 % 8741 % The format of the MagickResizeImage method is: 8742 % 8743 % MagickBooleanType MagickResizeImage(MagickWand *wand, 8744 % const size_t columns,const size_t rows,const FilterType filter) 8745 % 8746 % A description of each parameter follows: 8747 % 8748 % o wand: the magick wand. 8749 % 8750 % o columns: the number of columns in the scaled image. 8751 % 8752 % o rows: the number of rows in the scaled image. 8753 % 8754 % o filter: Image filter to use. 8755 % 8756 */ 8757 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand, 8758 const size_t columns,const size_t rows,const FilterType filter) 8759 { 8760 Image 8761 *resize_image; 8762 8763 assert(wand != (MagickWand *) NULL); 8764 assert(wand->signature == MagickWandSignature); 8765 if (wand->debug != MagickFalse) 8766 (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); 8767 if (wand->images == (Image *) NULL) 8768 ThrowWandException(WandError,"ContainsNoImages",wand->name); 8769 resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception); 8770 if (resize_image == (Image *) NULL) 8771 return(MagickFalse); 8772 ReplaceImageInList(&wand->images,resize_image); 8773 return(MagickTrue); 8774 } 8775 8776 /* 8778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8779 % % 8780 % % 8781 % % 8782 % M a g i c k R o l l I m a g e % 8783 % % 8784 % % 8785 %