Image.h revision 617c1234f713a6b7068e2a5abbf94a23f77c8181
1// This may look like C code, but it is really -*- C++ -*- 2// 3// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003 4// 5// Definition of Image, the representation of a single image in Magick++ 6// 7 8#if !defined(Magick_Image_header) 9#define Magick_Image_header 10 11#include "Magick++/Include.h" 12#include <string> 13#include <list> 14#include "Magick++/Blob.h" 15#include "Magick++/ChannelMoments.h" 16#include "Magick++/Color.h" 17#include "Magick++/Drawable.h" 18#include "Magick++/Exception.h" 19#include "Magick++/Geometry.h" 20#include "Magick++/TypeMetric.h" 21 22namespace Magick 23{ 24 // Forward declarations 25 class Options; 26 class ImageRef; 27 28 extern MagickPPExport const char *borderGeometryDefault; 29 extern MagickPPExport const char *frameGeometryDefault; 30 extern MagickPPExport const char *raiseGeometryDefault; 31 32 // Compare two Image objects regardless of LHS/RHS 33 // Image sizes and signatures are used as basis of comparison 34 MagickPPExport int operator == 35 (const Magick::Image &left_,const Magick::Image &right_); 36 MagickPPExport int operator != 37 (const Magick::Image &left_,const Magick::Image &right_); 38 MagickPPExport int operator > 39 (const Magick::Image &left_,const Magick::Image &right_); 40 MagickPPExport int operator < 41 (const Magick::Image &left_,const Magick::Image &right_); 42 MagickPPExport int operator >= 43 (const Magick::Image &left_,const Magick::Image &right_); 44 MagickPPExport int operator <= 45 (const Magick::Image &left_,const Magick::Image &right_); 46 47 // 48 // Image is the representation of an image. In reality, it actually 49 // a handle object which contains a pointer to a shared reference 50 // object (ImageRef). As such, this object is extremely space efficient. 51 // 52 class MagickPPExport Image 53 { 54 public: 55 56 // Obtain image statistics. Statistics are normalized to the range 57 // of 0.0 to 1.0 and are output to the specified ImageStatistics 58 // structure. 59 typedef struct _ImageChannelStatistics 60 { 61 /* Minimum value observed */ 62 double maximum; 63 /* Maximum value observed */ 64 double minimum; 65 /* Average (mean) value observed */ 66 double mean; 67 /* Standard deviation, sqrt(variance) */ 68 double standard_deviation; 69 /* Variance */ 70 double variance; 71 /* Kurtosis */ 72 double kurtosis; 73 /* Skewness */ 74 double skewness; 75 } ImageChannelStatistics; 76 77 typedef struct _ImageStatistics 78 { 79 ImageChannelStatistics red; 80 ImageChannelStatistics green; 81 ImageChannelStatistics blue; 82 ImageChannelStatistics alpha; 83 } ImageStatistics; 84 85 // Default constructor 86 Image(void); 87 88 // Construct Image from in-memory BLOB 89 Image(const Blob &blob_); 90 91 // Construct Image of specified size from in-memory BLOB 92 Image(const Blob &blob_,const Geometry &size_); 93 94 // Construct Image of specified size and depth from in-memory BLOB 95 Image(const Blob &blob_,const Geometry &size,const size_t depth); 96 97 // Construct Image of specified size, depth, and format from 98 // in-memory BLOB 99 Image(const Blob &blob_,const Geometry &size,const size_t depth_, 100 const std::string &magick_); 101 102 // Construct Image of specified size, and format from in-memory BLOB 103 Image(const Blob &blob_,const Geometry &size,const std::string &magick_); 104 105 // Construct a blank image canvas of specified size and color 106 Image(const Geometry &size_,const Color &color_); 107 108 // Copy constructor 109 Image(const Image &image_); 110 111 // Construct an image based on an array of raw pixels, of 112 // specified type and mapping, in memory 113 Image(const size_t width_,const size_t height_,const std::string &map_, 114 const StorageType type_,const void *pixels_); 115 116 // Construct from image file or image specification 117 Image(const std::string &imageSpec_); 118 119 // Destructor 120 virtual ~Image(); 121 122 // Assignment operator 123 Image& operator=(const Image &image_); 124 125 // Join images into a single multi-image file 126 void adjoin(const bool flag_); 127 bool adjoin(void) const; 128 129 // Image supports transparency (alpha channel) 130 void alpha(const bool alphaFlag_); 131 bool alpha(void) const; 132 133 // Transparent color 134 void alphaColor(const Color &alphaColor_); 135 Color alphaColor(void) const; 136 137 // Anti-alias Postscript and TrueType fonts (default true) 138 void antiAlias(const bool flag_); 139 bool antiAlias(void); 140 141 // Time in 1/100ths of a second which must expire before 142 // displaying the next image in an animated sequence. 143 void animationDelay(const size_t delay_); 144 size_t animationDelay(void) const; 145 146 // Number of iterations to loop an animation (e.g. Netscape loop 147 // extension) for. 148 void animationIterations(const size_t iterations_); 149 size_t animationIterations(void) const; 150 151 // Image background color 152 void backgroundColor(const Color &color_); 153 Color backgroundColor(void) const; 154 155 // Name of texture image to tile onto the image background 156 void backgroundTexture(const std::string &backgroundTexture_); 157 std::string backgroundTexture(void) const; 158 159 // Base image width (before transformations) 160 size_t baseColumns(void) const; 161 162 // Base image filename (before transformations) 163 std::string baseFilename(void) const; 164 165 // Base image height (before transformations) 166 size_t baseRows(void) const; 167 168 // Use black point compensation. 169 void blackPointCompensation(const bool flag_); 170 bool blackPointCompensation(void) const; 171 172 // Image border color 173 void borderColor(const Color &color_); 174 Color borderColor(void) const; 175 176 // Return smallest bounding box enclosing non-border pixels. The 177 // current fuzz value is used when discriminating between pixels. 178 // This is the crop bounding box used by crop(Geometry(0,0)); 179 Geometry boundingBox(void) const; 180 181 // Text bounding-box base color (default none) 182 void boxColor(const Color &boxColor_); 183 Color boxColor(void) const; 184 185 // Set or obtain modulus channel depth 186 void channelDepth(const size_t depth_); 187 size_t channelDepth(); 188 189 // Returns the number of channels in this image. 190 size_t channels() const; 191 192 // Image class (DirectClass or PseudoClass) 193 // NOTE: setting a DirectClass image to PseudoClass will result in 194 // the loss of color information if the number of colors in the 195 // image is greater than the maximum palette size (either 256 or 196 // 65536 entries depending on the value of MAGICKCORE_QUANTUM_DEPTH when 197 // ImageMagick was built). 198 void classType(const ClassType class_); 199 ClassType classType(void) const; 200 201 // Associate a clip mask with the image. The clip mask must be the 202 // same dimensions as the image. Pass an invalid image to unset an 203 // existing clip mask. 204 void clipMask(const Image &clipMask_); 205 Image clipMask(void) const; 206 207 // Colors within this distance are considered equal 208 void colorFuzz(const double fuzz_); 209 double colorFuzz(void) const; 210 211 // Colormap size (number of colormap entries) 212 void colorMapSize(const size_t entries_); 213 size_t colorMapSize(void) const; 214 215 // Image Color Space 216 void colorSpace(const ColorspaceType colorSpace_); 217 ColorspaceType colorSpace(void) const; 218 219 void colorSpaceType(const ColorspaceType colorSpace_); 220 ColorspaceType colorSpaceType(void) const; 221 222 // Image width 223 size_t columns(void) const; 224 225 // Comment image (add comment string to image) 226 void comment(const std::string &comment_); 227 std::string comment(void) const; 228 229 // Composition operator to be used when composition is implicitly 230 // used (such as for image flattening). 231 void compose(const CompositeOperator compose_); 232 CompositeOperator compose(void) const; 233 234 // Compression type 235 void compressType(const CompressionType compressType_); 236 CompressionType compressType(void) const; 237 238 // Enable printing of debug messages from ImageMagick 239 void debug(const bool flag_); 240 bool debug(void) const; 241 242 // Vertical and horizontal resolution in pixels of the image 243 void density(const Geometry &geomery_); 244 Geometry density(void) const; 245 246 // Image depth (bits allocated to red/green/blue components) 247 void depth(const size_t depth_); 248 size_t depth(void) const; 249 250 // Tile names from within an image montage 251 std::string directory(void) const; 252 253 // Endianness (little like Intel or big like SPARC) for image 254 // formats which support endian-specific options. 255 void endian(const EndianType endian_); 256 EndianType endian(void) const; 257 258 // Exif profile (BLOB) 259 void exifProfile(const Blob &exifProfile_); 260 Blob exifProfile(void) const; 261 262 // Image file name 263 void fileName(const std::string &fileName_); 264 std::string fileName(void) const; 265 266 // Number of bytes of the image on disk 267 MagickSizeType fileSize(void) const; 268 269 // Color to use when filling drawn objects 270 void fillColor(const Color &fillColor_); 271 Color fillColor(void) const; 272 273 // Rule to use when filling drawn objects 274 void fillRule(const FillRule &fillRule_); 275 FillRule fillRule(void) const; 276 277 // Pattern to use while filling drawn objects. 278 void fillPattern(const Image &fillPattern_); 279 Image fillPattern(void) const; 280 281 // Filter to use when resizing image 282 void filterType(const FilterTypes filterType_); 283 FilterTypes filterType(void) const; 284 285 // Text rendering font 286 void font(const std::string &font_); 287 std::string font(void) const; 288 289 // Font point size 290 void fontPointsize(const double pointSize_); 291 double fontPointsize(void) const; 292 293 // Long image format description 294 std::string format(void) const; 295 296 // Formats the specified expression 297 // More info here: http://www.imagemagick.org/script/escape.php 298 std::string formatExpression(const std::string expression); 299 300 // Gamma level of the image 301 double gamma(void) const; 302 303 // Preferred size of the image when encoding 304 Geometry geometry(void) const; 305 306 // GIF disposal method 307 void gifDisposeMethod(const DisposeType disposeMethod_); 308 DisposeType gifDisposeMethod(void) const; 309 310 // ICC color profile (BLOB) 311 void iccColorProfile(const Blob &colorProfile_); 312 Blob iccColorProfile(void) const; 313 314 // Type of interlacing to use 315 void interlaceType(const InterlaceType interlace_); 316 InterlaceType interlaceType(void) const; 317 318 // Pixel color interpolation method to use 319 void interpolate(const PixelInterpolateMethod interpolate_); 320 PixelInterpolateMethod interpolate(void) const; 321 322 // IPTC profile (BLOB) 323 void iptcProfile(const Blob &iptcProfile_); 324 Blob iptcProfile(void) const; 325 326 // Does object contain valid image? 327 void isValid(const bool isValid_); 328 bool isValid(void) const; 329 330 // Image label 331 void label(const std::string &label_); 332 std::string label(void) const; 333 334 // File type magick identifier (.e.g "GIF") 335 void magick(const std::string &magick_); 336 std::string magick(void) const; 337 338 // The mean error per pixel computed when an image is color reduced 339 double meanErrorPerPixel(void) const; 340 341 // Image modulus depth (minimum number of bits required to support 342 // red/green/blue components without loss of accuracy) 343 void modulusDepth(const size_t modulusDepth_); 344 size_t modulusDepth(void) const; 345 346 // Transform image to black and white 347 void monochrome(const bool monochromeFlag_); 348 bool monochrome(void) const; 349 350 // Tile size and offset within an image montage 351 Geometry montageGeometry(void) const; 352 353 // The normalized max error per pixel computed when an image is 354 // color reduced. 355 double normalizedMaxError(void) const; 356 357 // The normalized mean error per pixel computed when an image is 358 // color reduced. 359 double normalizedMeanError(void) const; 360 361 // Image orientation 362 void orientation(const OrientationType orientation_); 363 OrientationType orientation(void) const; 364 365 // Preferred size and location of an image canvas. 366 void page(const Geometry &pageSize_); 367 Geometry page(void) const; 368 369 // JPEG/MIFF/PNG compression level (default 75). 370 void quality(const size_t quality_); 371 size_t quality(void) const; 372 373 // Maximum number of colors to quantize to 374 void quantizeColors(const size_t colors_); 375 size_t quantizeColors(void) const; 376 377 // Colorspace to quantize in. 378 void quantizeColorSpace(const ColorspaceType colorSpace_); 379 ColorspaceType quantizeColorSpace(void) const; 380 381 // Dither image during quantization (default true). 382 void quantizeDither(const bool ditherFlag_); 383 bool quantizeDither(void) const; 384 385 // Dither method 386 void quantizeDitherMethod(const DitherMethod ditherMethod_); 387 DitherMethod quantizeDitherMethod(void) const; 388 389 // Quantization tree-depth 390 void quantizeTreeDepth(const size_t treeDepth_); 391 size_t quantizeTreeDepth(void) const; 392 393 // The type of rendering intent 394 void renderingIntent(const RenderingIntent renderingIntent_); 395 RenderingIntent renderingIntent(void) const; 396 397 // Units of image resolution 398 void resolutionUnits(const ResolutionType resolutionUnits_); 399 ResolutionType resolutionUnits(void) const; 400 401 // The number of pixel rows in the image 402 size_t rows(void) const; 403 404 // Image scene number 405 void scene(const size_t scene_); 406 size_t scene(void) const; 407 408 // Width and height of a raw image 409 void size(const Geometry &geometry_); 410 Geometry size(void) const; 411 412 // enabled/disable stroke anti-aliasing 413 void strokeAntiAlias(const bool flag_); 414 bool strokeAntiAlias(void) const; 415 416 // Color to use when drawing object outlines 417 void strokeColor(const Color &strokeColor_); 418 Color strokeColor(void) const; 419 420 // Specify the pattern of dashes and gaps used to stroke 421 // paths. The strokeDashArray represents a zero-terminated array 422 // of numbers that specify the lengths of alternating dashes and 423 // gaps in pixels. If an odd number of values is provided, then 424 // the list of values is repeated to yield an even number of 425 // values. A typical strokeDashArray_ array might contain the 426 // members 5 3 2 0, where the zero value indicates the end of the 427 // pattern array. 428 void strokeDashArray(const double *strokeDashArray_); 429 const double *strokeDashArray(void) const; 430 431 // While drawing using a dash pattern, specify distance into the 432 // dash pattern to start the dash (default 0). 433 void strokeDashOffset(const double strokeDashOffset_); 434 double strokeDashOffset(void) const; 435 436 // Specify the shape to be used at the end of open subpaths when 437 // they are stroked. Values of LineCap are UndefinedCap, ButtCap, 438 // RoundCap, and SquareCap. 439 void strokeLineCap(const LineCap lineCap_); 440 LineCap strokeLineCap(void) const; 441 442 // Specify the shape to be used at the corners of paths (or other 443 // vector shapes) when they are stroked. Values of LineJoin are 444 // UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin. 445 void strokeLineJoin(const LineJoin lineJoin_); 446 LineJoin strokeLineJoin(void) const; 447 448 // Specify miter limit. When two line segments meet at a sharp 449 // angle and miter joins have been specified for 'lineJoin', it is 450 // possible for the miter to extend far beyond the thickness of 451 // the line stroking the path. The miterLimit' imposes a limit on 452 // the ratio of the miter length to the 'lineWidth'. The default 453 // value of this parameter is 4. 454 void strokeMiterLimit(const size_t miterLimit_); 455 size_t strokeMiterLimit(void) const; 456 457 // Pattern image to use while stroking object outlines. 458 void strokePattern(const Image &strokePattern_); 459 Image strokePattern(void) const; 460 461 // Stroke width for drawing vector objects (default one) 462 void strokeWidth(const double strokeWidth_); 463 double strokeWidth(void) const; 464 465 // Subimage of an image sequence 466 void subImage(const size_t subImage_); 467 size_t subImage(void) const; 468 469 // Number of images relative to the base image 470 void subRange(const size_t subRange_); 471 size_t subRange(void) const; 472 473 // Render text right-to-left or left-to-right. 474 void textDirection(DirectionType direction_); 475 DirectionType textDirection() const; 476 477 // Annotation text encoding (e.g. "UTF-16") 478 void textEncoding(const std::string &encoding_); 479 std::string textEncoding(void) const; 480 481 // Text gravity. 482 void textGravity(GravityType gravity_); 483 GravityType textGravity() const; 484 485 // Text inter-line spacing 486 void textInterlineSpacing(double spacing_); 487 double textInterlineSpacing(void) const; 488 489 // Text inter-word spacing 490 void textInterwordSpacing(double spacing_); 491 double textInterwordSpacing(void) const; 492 493 // Text inter-character kerning 494 void textKerning(double kerning_); 495 double textKerning(void) const; 496 497 // Number of colors in the image 498 size_t totalColors(void) const; 499 500 // Rotation to use when annotating with text or drawing 501 void transformRotation(const double angle_); 502 503 // Skew to use in X axis when annotating with text or drawing 504 void transformSkewX(const double skewx_); 505 506 // Skew to use in Y axis when annotating with text or drawing 507 void transformSkewY(const double skewy_); 508 509 // Image representation type (also see type operation) 510 // Available types: 511 // Bilevel Grayscale GrayscaleMatte 512 // Palette PaletteMatte TrueColor 513 // TrueColorMatte ColorSeparation ColorSeparationMatte 514 void type(const ImageType type_); 515 ImageType type(void) const; 516 517 // Print detailed information about the image 518 void verbose(const bool verboseFlag_); 519 bool verbose(void) const; 520 521 // FlashPix viewing parameters 522 void view(const std::string &view_); 523 std::string view(void) const; 524 525 // Virtual pixel method 526 void virtualPixelMethod(const VirtualPixelMethod virtualPixelMethod_); 527 VirtualPixelMethod virtualPixelMethod(void) const; 528 529 // X11 display to display to, obtain fonts from, or to capture 530 // image from 531 void x11Display(const std::string &display_); 532 std::string x11Display(void) const; 533 534 // x resolution of the image 535 double xResolution(void) const; 536 537 // y resolution of the image 538 double yResolution(void) const; 539 540 // Adaptive-blur image with specified blur factor 541 // The radius_ parameter specifies the radius of the Gaussian, in 542 // pixels, not counting the center pixel. The sigma_ parameter 543 // specifies the standard deviation of the Laplacian, in pixels. 544 void adaptiveBlur(const double radius_=0.0,const double sigma_=1.0); 545 546 // This is shortcut function for a fast interpolative resize using mesh 547 // interpolation. It works well for small resizes of less than +/- 50% 548 // of the original image size. For larger resizing on images a full 549 // filtered and slower resize function should be used instead. 550 void adaptiveResize(const Geometry &geometry_); 551 552 // Adaptively sharpens the image by sharpening more intensely near image 553 // edges and less intensely far from edges. We sharpen the image with a 554 // Gaussian operator of the given radius and standard deviation (sigma). 555 // For reasonable results, radius should be larger than sigma. 556 void adaptiveSharpen(const double radius_=0.0,const double sigma_=1.0); 557 void adaptiveSharpenChannel(const ChannelType channel_, 558 const double radius_=0.0,const double sigma_=1.0); 559 560 // Local adaptive threshold image 561 // http://www.dai.ed.ac.uk/HIPR2/adpthrsh.htm 562 // Width x height define the size of the pixel neighborhood 563 // offset = constant to subtract from pixel neighborhood mean 564 void adaptiveThreshold(const size_t width,const size_t height, 565 const ::ssize_t offset=0); 566 567 // Add noise to image with specified noise type 568 void addNoise(const NoiseType noiseType_); 569 void addNoiseChannel(const ChannelType channel_, 570 const NoiseType noiseType_); 571 572 // Transform image by specified affine (or free transform) matrix. 573 void affineTransform(const DrawableAffine &affine); 574 575 // Set or attenuate the alpha channel in the image. If the image 576 // pixels are opaque then they are set to the specified alpha 577 // value, otherwise they are blended with the supplied alpha 578 // value. The value of alpha_ ranges from 0 (completely opaque) 579 // to QuantumRange. The defines OpaqueAlpha and TransparentAlpha are 580 // available to specify completely opaque or completely 581 // transparent, respectively. 582 void alpha(const unsigned int alpha_); 583 584 // AlphaChannel() activates, deactivates, resets, or sets the alpha 585 // channel. 586 void alphaChannel(AlphaChannelOption alphaOption_); 587 588 // Floodfill designated area with replacement alpha value 589 void alphaFloodfill(const Color &target_,const unsigned int alpha_, 590 const ::ssize_t x_, const ::ssize_t y_,const PaintMethod method_); 591 592 // 593 // Annotate image (draw text on image) 594 // 595 // Gravity effects text placement in bounding area according to rules: 596 // NorthWestGravity text bottom-left corner placed at top-left 597 // NorthGravity text bottom-center placed at top-center 598 // NorthEastGravity text bottom-right corner placed at top-right 599 // WestGravity text left-center placed at left-center 600 // CenterGravity text center placed at center 601 // EastGravity text right-center placed at right-center 602 // SouthWestGravity text top-left placed at bottom-left 603 // SouthGravity text top-center placed at bottom-center 604 // SouthEastGravity text top-right placed at bottom-right 605 606 // Annotate using specified text, and placement location 607 void annotate(const std::string &text_,const Geometry &location_); 608 609 // Annotate using specified text, bounding area, and placement 610 // gravity 611 void annotate(const std::string &text_,const Geometry &boundingArea_, 612 const GravityType gravity_); 613 614 // Annotate with text using specified text, bounding area, 615 // placement gravity, and rotation. 616 void annotate(const std::string &text_,const Geometry &boundingArea_, 617 const GravityType gravity_,const double degrees_); 618 619 // Annotate with text (bounding area is entire image) and placement 620 // gravity. 621 void annotate(const std::string &text_,const GravityType gravity_); 622 623 // Inserts the artifact with the specified name and value into 624 // the artifact tree of the image. 625 void artifact(const std::string &name_,const std::string &value_); 626 627 // Returns the value of the artifact with the specified name. 628 std::string artifact(const std::string &name_); 629 630 // Access/Update a named image attribute 631 void attribute(const std::string name_,const std::string value_); 632 std::string attribute(const std::string name_); 633 634 // Extracts the 'mean' from the image and adjust the image to try 635 // make set its gamma appropriatally. 636 void autoGamma(void); 637 void autoGammaChannel(const ChannelType channel_); 638 639 // Adjusts the levels of a particular image channel by scaling the 640 // minimum and maximum values to the full quantum range. 641 void autoLevel(void); 642 void autoLevelChannel(const ChannelType channel_); 643 644 // Adjusts an image so that its orientation is suitable for viewing. 645 void autoOrient(void); 646 647 // Forces all pixels below the threshold into black while leaving all 648 // pixels at or above the threshold unchanged. 649 void blackThreshold(const std::string &threshold_); 650 void blackThresholdChannel(const ChannelType channel_, 651 const std::string &threshold_); 652 653 // Simulate a scene at nighttime in the moonlight. 654 void blueShift(const double factor_=1.5); 655 656 // Blur image with specified blur factor 657 // The radius_ parameter specifies the radius of the Gaussian, in 658 // pixels, not counting the center pixel. The sigma_ parameter 659 // specifies the standard deviation of the Laplacian, in pixels. 660 void blur(const double radius_=0.0,const double sigma_=1.0); 661 void blurChannel(const ChannelType channel_,const double radius_=0.0, 662 const double sigma_=1.0); 663 664 // Border image (add border to image) 665 void border(const Geometry &geometry_=borderGeometryDefault); 666 667 // Changes the brightness and/or contrast of an image. It converts the 668 // brightness and contrast parameters into slope and intercept and calls 669 // a polynomical function to apply to the image. 670 void brightnessContrast(const double brightness_=0.0, 671 const double contrast_=0.0); 672 void brightnessContrastChannel(const ChannelType channel_, 673 const double brightness_=0.0,const double contrast_=0.0); 674 675 // Extract channel from image 676 void channel(const ChannelType channel_); 677 678 // Charcoal effect image (looks like charcoal sketch) 679 // The radius_ parameter specifies the radius of the Gaussian, in 680 // pixels, not counting the center pixel. The sigma_ parameter 681 // specifies the standard deviation of the Laplacian, in pixels. 682 void charcoal(const double radius_=0.0,const double sigma_=1.0); 683 684 // Chop image (remove vertical or horizontal subregion of image) 685 // FIXME: describe how geometry argument is used to select either 686 // horizontal or vertical subregion of image. 687 void chop(const Geometry &geometry_); 688 689 // Chromaticity blue primary point (e.g. x=0.15, y=0.06) 690 void chromaBluePrimary(const double x_,const double y_); 691 void chromaBluePrimary(double *x_,double *y_) const; 692 693 // Chromaticity green primary point (e.g. x=0.3, y=0.6) 694 void chromaGreenPrimary(const double x_,const double y_); 695 void chromaGreenPrimary(double *x_,double *y_) const; 696 697 // Chromaticity red primary point (e.g. x=0.64, y=0.33) 698 void chromaRedPrimary(const double x_,const double y_); 699 void chromaRedPrimary(double *x_,double *y_) const; 700 701 // Chromaticity white point (e.g. x=0.3127, y=0.329) 702 void chromaWhitePoint(const double x_,const double y_); 703 void chromaWhitePoint(double *x_,double *y_) const; 704 705 // Accepts a lightweight Color Correction Collection 706 // (CCC) file which solely contains one or more color corrections and 707 // applies the correction to the image. 708 void cdl(const std::string &cdl_); 709 710 // Set each pixel whose value is below zero to zero and any the 711 // pixel whose value is above the quantum range to the quantum range (e.g. 712 // 65535) otherwise the pixel value remains unchanged. 713 void clamp(void); 714 void clampChannel(const ChannelType channel_); 715 716 // Sets the image clip mask based on any clipping path information 717 // if it exists. 718 void clip(void); 719 void clipPath(const std::string pathname_,const bool inside_); 720 721 // Apply a color lookup table (CLUT) to the image. 722 void clut(const Image &clutImage_,const PixelInterpolateMethod method); 723 void clutChannel(const ChannelType channel_,const Image &clutImage_, 724 const PixelInterpolateMethod method); 725 726 // Colorize image with pen color, using specified percent alpha. 727 void colorize(const unsigned int alpha_,const Color &penColor_); 728 729 // Colorize image with pen color, using specified percent alpha 730 // for red, green, and blue quantums 731 void colorize(const unsigned int alphaRed_,const unsigned int alphaGreen_, 732 const unsigned int alphaBlue_,const Color &penColor_); 733 734 // Color at colormap position index_ 735 void colorMap(const size_t index_,const Color &color_); 736 Color colorMap(const size_t index_) const; 737 738 // Apply a color matrix to the image channels. The user supplied 739 // matrix may be of order 1 to 5 (1x1 through 5x5). 740 void colorMatrix(const size_t order_,const double *color_matrix_); 741 742 // Compare current image with another image 743 // Sets meanErrorPerPixel, normalizedMaxError, and normalizedMeanError 744 // in the current image. False is returned if the images are identical. 745 bool compare(const Image &reference_); 746 747 // Compare current image with another image 748 // Returns the distortion based on the specified metric. 749 double compare(const Image &reference_,const MetricType metric_); 750 double compareChannel(const ChannelType channel_, 751 const Image &reference_, 752 const MetricType metric_ ); 753 754 // Compare current image with another image 755 // Sets the distortion and returns the difference image. 756 Image compare(const Image &reference_,const MetricType metric_, 757 double *distortion); 758 Image compareChannel(const ChannelType channel_,const Image &reference_, 759 const MetricType metric_,double *distortion); 760 761 // Compose an image onto another at specified offset and using 762 // specified algorithm 763 void composite(const Image &compositeImage_,const Geometry &offset_, 764 const CompositeOperator compose_=InCompositeOp); 765 void composite(const Image &compositeImage_,const GravityType gravity_, 766 const CompositeOperator compose_=InCompositeOp); 767 void composite(const Image &compositeImage_,const ::ssize_t xOffset_, 768 const ::ssize_t yOffset_,const CompositeOperator compose_=InCompositeOp); 769 770 // Contrast image (enhance intensity differences in image) 771 void contrast(const size_t sharpen_); 772 773 // A simple image enhancement technique that attempts to improve the 774 // contrast in an image by 'stretching' the range of intensity values 775 // it contains to span a desired range of values. It differs from the 776 // more sophisticated histogram equalization in that it can only apply a 777 // linear scaling function to the image pixel values. As a result the 778 // 'enhancement' is less harsh. 779 void contrastStretch(const double blackPoint_,const double whitePoint_); 780 void contrastStretchChannel(const ChannelType channel_, 781 const double blackPoint_,const double whitePoint_); 782 783 // Convolve image. Applies a user-specified convolution to the image. 784 // order_ represents the number of columns and rows in the filter kernel. 785 // kernel_ is an array of doubles representing the convolution kernel. 786 void convolve(const size_t order_,const double *kernel_); 787 788 // Crop image (subregion of original image) 789 void crop(const Geometry &geometry_); 790 791 // Cycle image colormap 792 void cycleColormap(const ::ssize_t amount_); 793 794 // Converts cipher pixels to plain pixels. 795 void decipher(const std::string &passphrase_); 796 797 // Tagged image format define. Similar to the defineValue() method 798 // except that passing the flag_ value 'true' creates a value-less 799 // define with that format and key. Passing the flag_ value 'false' 800 // removes any existing matching definition. The method returns 'true' 801 // if a matching key exists, and 'false' if no matching key exists. 802 void defineSet(const std::string &magick_,const std::string &key_, 803 bool flag_); 804 bool defineSet(const std::string &magick_,const std::string &key_) const; 805 806 // Tagged image format define (set/access coder-specific option) The 807 // magick_ option specifies the coder the define applies to. The key_ 808 // option provides the key specific to that coder. The value_ option 809 // provides the value to set (if any). See the defineSet() method if the 810 // key must be removed entirely. 811 void defineValue(const std::string &magick_,const std::string &key_, 812 const std::string &value_); 813 std::string defineValue(const std::string &magick_, 814 const std::string &key_) const; 815 816 // Removes skew from the image. Skew is an artifact that occurs in scanned 817 // images because of the camera being misaligned, imperfections in the 818 // scanning or surface, or simply because the paper was not placed 819 // completely flat when scanned. The value of threshold_ ranges from 0 820 // to QuantumRange. 821 void deskew(const double threshold_); 822 823 // Despeckle image (reduce speckle noise) 824 void despeckle(void); 825 826 // Display image on screen 827 void display(void); 828 829 // Distort image. distorts an image using various distortion methods, by 830 // mapping color lookups of the source image to a new destination image 831 // usally of the same size as the source image, unless 'bestfit' is set to 832 // true. 833 void distort(const DistortImageMethod method_, 834 const size_t numberArguments_,const double *arguments_, 835 const bool bestfit_=false); 836 837 // Draw on image using a single drawable 838 void draw(const Drawable &drawable_); 839 840 // Draw on image using a drawable list 841 void draw(const std::list<Magick::Drawable> &drawable_); 842 843 // Edge image (hilight edges in image) 844 void edge(const double radius_=0.0); 845 846 // Emboss image (hilight edges with 3D effect) 847 // The radius_ parameter specifies the radius of the Gaussian, in 848 // pixels, not counting the center pixel. The sigma_ parameter 849 // specifies the standard deviation of the Laplacian, in pixels. 850 void emboss(const double radius_=0.0,const double sigma_=1.0); 851 852 // Converts pixels to cipher-pixels. 853 void encipher(const std::string &passphrase_); 854 855 // Enhance image (minimize noise) 856 void enhance(void); 857 858 // Equalize image (histogram equalization) 859 void equalize(void); 860 861 // Erase image to current "background color" 862 void erase(void); 863 864 // Extend the image as defined by the geometry. 865 void extent(const Geometry &geometry_); 866 void extent(const Geometry &geometry_,const Color &backgroundColor); 867 void extent(const Geometry &geometry_,const Color &backgroundColor, 868 const GravityType gravity_); 869 void extent(const Geometry &geometry_,const GravityType gravity_); 870 871 // Flip image (reflect each scanline in the vertical direction) 872 void flip(void); 873 874 // Floodfill pixels matching color (within fuzz factor) of target 875 // pixel(x,y) with replacement alpha value using method. 876 void floodFillAlpha(const ::ssize_t x_,const ::ssize_t y_, 877 const unsigned int alpha_,const PaintMethod method_); 878 879 // Flood-fill color across pixels that match the color of the 880 // target pixel and are neighbors of the target pixel. 881 // Uses current fuzz setting when determining color match. 882 void floodFillColor(const Geometry &point_,const Color &fillColor_); 883 void floodFillColor(const ::ssize_t x_,const ::ssize_t y_, 884 const Color &fillColor_ ); 885 886 // Flood-fill color across pixels starting at target-pixel and 887 // stopping at pixels matching specified border color. 888 // Uses current fuzz setting when determining color match. 889 void floodFillColor(const Geometry &point_,const Color &fillColor_, 890 const Color &borderColor_); 891 void floodFillColor(const ::ssize_t x_,const ::ssize_t y_, 892 const Color &fillColor_,const Color &borderColor_); 893 894 // Flood-fill texture across pixels that match the color of the 895 // target pixel and are neighbors of the target pixel. 896 // Uses current fuzz setting when determining color match. 897 void floodFillTexture(const Geometry &point_,const Image &texture_); 898 void floodFillTexture(const ::ssize_t x_,const ::ssize_t y_, 899 const Image &texture_); 900 901 // Flood-fill texture across pixels starting at target-pixel and 902 // stopping at pixels matching specified border color. 903 // Uses current fuzz setting when determining color match. 904 void floodFillTexture(const Geometry &point_,const Image &texture_, 905 const Color &borderColor_); 906 void floodFillTexture(const ::ssize_t x_,const ::ssize_t y_, 907 const Image &texture_,const Color &borderColor_); 908 909 // Flop image (reflect each scanline in the horizontal direction) 910 void flop(void); 911 912 // Obtain font metrics for text string given current font, 913 // pointsize, and density settings. 914 void fontTypeMetrics(const std::string &text_,TypeMetric *metrics); 915 916 // Obtain multi line font metrics for text string given current font, 917 // pointsize, and density settings. 918 void fontTypeMetricsMultiline(const std::string &text_, 919 TypeMetric *metrics); 920 921 // Frame image 922 void frame(const Geometry &geometry_=frameGeometryDefault); 923 void frame(const size_t width_,const size_t height_, 924 const ::ssize_t innerBevel_=6,const ::ssize_t outerBevel_=6); 925 926 // Applies a mathematical expression to the image. 927 void fx(const std::string expression_); 928 void fx(const std::string expression_,const Magick::ChannelType channel_); 929 930 // Gamma correct image 931 void gamma(const double gamma_); 932 void gamma(const double gammaRed_,const double gammaGreen_, 933 const double gammaBlue_); 934 935 // Gaussian blur image 936 // The number of neighbor pixels to be included in the convolution 937 // mask is specified by 'width_'. The standard deviation of the 938 // gaussian bell curve is specified by 'sigma_'. 939 void gaussianBlur(const double width_,const double sigma_); 940 void gaussianBlurChannel(const ChannelType channel_,const double width_, 941 const double sigma_); 942 943 // Transfers read-only pixels from the image to the pixel cache as 944 // defined by the specified region 945 const Quantum *getConstPixels(const ::ssize_t x_, const ::ssize_t y_, 946 const size_t columns_,const size_t rows_) const; 947 948 // Obtain immutable image pixel metacontent (valid for PseudoClass images) 949 const void *getConstMetacontent(void) const; 950 951 // Obtain mutable image pixel metacontent (valid for PseudoClass images) 952 void *getMetacontent(void); 953 954 // Transfers pixels from the image to the pixel cache as defined 955 // by the specified region. Modified pixels may be subsequently 956 // transferred back to the image via syncPixels. This method is 957 // valid for DirectClass images. 958 Quantum *getPixels(const ::ssize_t x_,const ::ssize_t y_, 959 const size_t columns_,const size_t rows_); 960 961 // Apply a color lookup table (Hald CLUT) to the image. 962 void haldClut(const Image &clutImage_); 963 964 // Implode image (special effect) 965 void implode(const double factor_); 966 967 // Implements the inverse discrete Fourier transform (DFT) of the image 968 // either as a magnitude / phase or real / imaginary image pair. 969 void inverseFourierTransform(const Image &phase_); 970 void inverseFourierTransform(const Image &phase_,const bool magnitude_); 971 972 // Level image. Adjust the levels of the image by scaling the 973 // colors falling between specified white and black points to the 974 // full available quantum range. The parameters provided represent 975 // the black, mid (gamma), and white points. The black point 976 // specifies the darkest color in the image. Colors darker than 977 // the black point are set to zero. Mid point (gamma) specifies a 978 // gamma correction to apply to the image. White point specifies 979 // the lightest color in the image. Colors brighter than the 980 // white point are set to the maximum quantum value. The black and 981 // white point have the valid range 0 to QuantumRange while mid (gamma) 982 // has a useful range of 0 to ten. 983 void level(const double blackPoint_,const double whitePoint_, 984 const double gamma_=1.0); 985 void levelChannel(const ChannelType channel_,const double blackPoint_, 986 const double whitePoint_,const double gamma_=1.0); 987 988 // Maps the given color to "black" and "white" values, linearly spreading 989 // out the colors, and level values on a channel by channel bases, as 990 // per level(). The given colors allows you to specify different level 991 // ranges for each of the color channels separately. 992 void levelColors(const Color &blackColor_,const Color &whiteColor_, 993 const bool invert_=true); 994 void levelColorsChannel(const ChannelType channel_, 995 const Color &blackColor_,const Color &whiteColor_, 996 const bool invert_=true); 997 998 // Discards any pixels below the black point and above the white point and 999 // levels the remaining pixels. 1000 void linearStretch(const double blackPoint_,const double whitePoint_); 1001 1002 // Rescales image with seam carving. 1003 void liquidRescale(const Geometry &geometry_); 1004 1005 // Magnify image by integral size 1006 void magnify(void); 1007 1008 // Remap image colors with closest color from reference image 1009 void map(const Image &mapImage_,const bool dither_=false); 1010 1011 // Filter image by replacing each pixel component with the median 1012 // color in a circular neighborhood 1013 void medianFilter(const double radius_=0.0); 1014 1015 // Reduce image by integral size 1016 void minify(void); 1017 1018 // Modulate percent hue, saturation, and brightness of an image 1019 void modulate(const double brightness_,const double saturation_, 1020 const double hue_); 1021 1022 // Returns the normalized moments of one or more image channels. 1023 ChannelMoments moments(void); 1024 1025 // Applies a kernel to the image according to the given mophology method. 1026 void morphology(const MorphologyMethod method_,const std::string kernel_, 1027 const ssize_t iterations_=1); 1028 void morphology(const MorphologyMethod method_, 1029 const KernelInfoType kernel_,const std::string arguments_, 1030 const ssize_t iterations_=1); 1031 void morphologyChannel(const ChannelType channel_, 1032 const MorphologyMethod method_,const std::string kernel_, 1033 const ssize_t iterations_=1); 1034 void morphologyChannel(const ChannelType channel_, 1035 const MorphologyMethod method_,const KernelInfoType kernel_, 1036 const std::string arguments_,const ssize_t iterations_=1); 1037 1038 // Motion blur image with specified blur factor 1039 // The radius_ parameter specifies the radius of the Gaussian, in 1040 // pixels, not counting the center pixel. The sigma_ parameter 1041 // specifies the standard deviation of the Laplacian, in pixels. 1042 // The angle_ parameter specifies the angle the object appears 1043 // to be comming from (zero degrees is from the right). 1044 void motionBlur(const double radius_,const double sigma_, 1045 const double angle_); 1046 1047 // Negate colors in image. Set grayscale to only negate grayscale 1048 // values in image. 1049 void negate(const bool grayscale_=false); 1050 void negateChannel(const ChannelType channel_,const bool grayscale_=false); 1051 1052 // Normalize image (increase contrast by normalizing the pixel 1053 // values to span the full range of color values) 1054 void normalize(void); 1055 1056 // Oilpaint image (image looks like oil painting) 1057 void oilPaint(const double radius_=0.0,const double sigma=1.0); 1058 1059 // Change color of opaque pixel to specified pen color. 1060 void opaque(const Color &opaqueColor_,const Color &penColor_); 1061 1062 // Perform a ordered dither based on a number of pre-defined dithering 1063 // threshold maps, but over multiple intensity levels. 1064 void orderedDither(std::string thresholdMap_); 1065 void orderedDitherChannel(const ChannelType channel_, 1066 std::string thresholdMap_); 1067 1068 // Set each pixel whose value is less than epsilon to epsilon or 1069 // -epsilon (whichever is closer) otherwise the pixel value remains 1070 // unchanged. 1071 void perceptible(const double epsilon_); 1072 void perceptibleChannel(const ChannelType channel_,const double epsilon_); 1073 1074 // Ping is similar to read except only enough of the image is read 1075 // to determine the image columns, rows, and filesize. Access the 1076 // columns(), rows(), and fileSize() attributes after invoking 1077 // ping. The image data is not valid after calling ping. 1078 void ping(const std::string &imageSpec_); 1079 1080 // Ping is similar to read except only enough of the image is read 1081 // to determine the image columns, rows, and filesize. Access the 1082 // columns(), rows(), and fileSize() attributes after invoking 1083 // ping. The image data is not valid after calling ping. 1084 void ping(const Blob &blob_); 1085 1086 // Get/set pixel color at location x & y. 1087 void pixelColor(const ::ssize_t x_,const ::ssize_t y_,const Color &color_); 1088 Color pixelColor(const ::ssize_t x_,const ::ssize_t y_ ) const; 1089 1090 // Simulates a Polaroid picture. 1091 void polaroid(const std::string &caption_,const double angle_, 1092 const PixelInterpolateMethod method_); 1093 1094 // Reduces the image to a limited number of colors for a "poster" effect. 1095 void posterize(const size_t levels_,const DitherMethod method_); 1096 void posterizeChannel(const ChannelType channel_,const size_t levels_, 1097 const DitherMethod method_); 1098 1099 // Execute a named process module using an argc/argv syntax similar to 1100 // that accepted by a C 'main' routine. An exception is thrown if the 1101 // requested process module doesn't exist, fails to load, or fails during 1102 // execution. 1103 void process(std::string name_,const ::ssize_t argc_,const char **argv_); 1104 1105 // Add or remove a named profile to/from the image. Remove the 1106 // profile by passing an empty Blob (e.g. Blob()). Valid names are 1107 // "*", "8BIM", "ICM", "IPTC", or a user/format-defined profile name. 1108 void profile(const std::string name_,const Blob &colorProfile_); 1109 1110 // Retrieve a named profile from the image. Valid names are: 1111 // "8BIM", "8BIMTEXT", "APP1", "APP1JPEG", "ICC", "ICM", & "IPTC" 1112 // or an existing user/format-defined profile name. 1113 Blob profile(const std::string name_) const; 1114 1115 // Quantize image (reduce number of colors) 1116 void quantize(const bool measureError_=false); 1117 1118 void quantumOperator(const ChannelType channel_, 1119 const MagickEvaluateOperator operator_,double rvalue_); 1120 1121 void quantumOperator(const ::ssize_t x_,const ::ssize_t y_, 1122 const size_t columns_,const size_t rows_,const ChannelType channel_, 1123 const MagickEvaluateOperator operator_,const double rvalue_); 1124 1125 // Raise image (lighten or darken the edges of an image to give a 1126 // 3-D raised or lowered effect) 1127 void raise(const Geometry &geometry_=raiseGeometryDefault, 1128 const bool raisedFlag_=false); 1129 1130 // Random threshold image. 1131 // 1132 // Changes the value of individual pixels based on the intensity 1133 // of each pixel compared to a random threshold. The result is a 1134 // low-contrast, two color image. The thresholds_ argument is a 1135 // geometry containing LOWxHIGH thresholds. If the string 1136 // contains 2x2, 3x3, or 4x4, then an ordered dither of order 2, 1137 // 3, or 4 will be performed instead. If a channel_ argument is 1138 // specified then only the specified channel is altered. This is 1139 // a very fast alternative to 'quantize' based dithering. 1140 void randomThreshold(const Geometry &thresholds_); 1141 void randomThresholdChannel(const ChannelType channel_, 1142 const Geometry &thresholds_); 1143 1144 // Read single image frame from in-memory BLOB 1145 void read(const Blob &blob_); 1146 1147 // Read single image frame of specified size from in-memory BLOB 1148 void read(const Blob &blob_,const Geometry &size_); 1149 1150 // Read single image frame of specified size and depth from 1151 // in-memory BLOB 1152 void read(const Blob &blob_,const Geometry &size_,const size_t depth_); 1153 1154 // Read single image frame of specified size, depth, and format 1155 // from in-memory BLOB 1156 void read(const Blob &blob_,const Geometry &size_,const size_t depth_, 1157 const std::string &magick_); 1158 1159 // Read single image frame of specified size, and format from 1160 // in-memory BLOB 1161 void read(const Blob &blob_,const Geometry &size_, 1162 const std::string &magick_); 1163 1164 // Read single image frame of specified size into current object 1165 void read(const Geometry &size_,const std::string &imageSpec_); 1166 1167 // Read single image frame from an array of raw pixels, with 1168 // specified storage type (ConstituteImage), e.g. 1169 // image.read( 640, 480, "RGB", 0, pixels ); 1170 void read(const size_t width_,const size_t height_,const std::string &map_, 1171 const StorageType type_,const void *pixels_); 1172 1173 // Read single image frame into current object 1174 void read(const std::string &imageSpec_); 1175 1176 // Transfers one or more pixel components from a buffer or file 1177 // into the image pixel cache of an image. 1178 // Used to support image decoders. 1179 void readPixels(const QuantumType quantum_,const unsigned char *source_); 1180 1181 // Reduce noise in image using a noise peak elimination filter 1182 void reduceNoise(void); 1183 void reduceNoise(const double order_); 1184 1185 // Resize image in terms of its pixel size. 1186 void resample(const Geometry &geometry_); 1187 1188 // Resize image to specified size. 1189 void resize(const Geometry &geometry_); 1190 1191 // Roll image (rolls image vertically and horizontally) by specified 1192 // number of columnms and rows) 1193 void roll(const Geometry &roll_); 1194 void roll(const size_t columns_,const size_t rows_); 1195 1196 // Rotate image counter-clockwise by specified number of degrees. 1197 void rotate(const double degrees_); 1198 1199 // Rotational blur image. 1200 void rotationalBlur(const double angle_); 1201 void rotationalBlurChannel(const ChannelType channel_,const double angle_); 1202 1203 // Resize image by using pixel sampling algorithm 1204 void sample(const Geometry &geometry_); 1205 1206 // Resize image by using simple ratio algorithm 1207 void scale(const Geometry &geometry_); 1208 1209 // Segment (coalesce similar image components) by analyzing the 1210 // histograms of the color components and identifying units that 1211 // are homogeneous with the fuzzy c-means technique. Also uses 1212 // QuantizeColorSpace and Verbose image attributes 1213 void segment(const double clusterThreshold_=1.0, 1214 const double smoothingThreshold_=1.5); 1215 1216 // Selectively blur pixels within a contrast threshold. It is similar to 1217 // the unsharpen mask that sharpens everything with contrast above a 1218 // certain threshold. 1219 void selectiveBlur(const double radius_,const double sigma_, 1220 const double threshold_); 1221 void selectiveBlurChannel(const ChannelType channel_,const double radius_, 1222 const double sigma_,const double threshold_); 1223 1224 // Separates a channel from the image and returns it as a grayscale image. 1225 Image separate(const ChannelType channel_); 1226 1227 // Applies a special effect to the image, similar to the effect achieved in 1228 // a photo darkroom by sepia toning. Threshold ranges from 0 to 1229 // QuantumRange and is a measure of the extent of the sepia toning. 1230 // A threshold of 80% is a good starting point for a reasonable tone. 1231 void sepiaTone(const double threshold_); 1232 1233 // Allocates a pixel cache region to store image pixels as defined 1234 // by the region rectangle. This area is subsequently transferred 1235 // from the pixel cache to the image via syncPixels. 1236 Quantum *setPixels(const ::ssize_t x_, const ::ssize_t y_, 1237 const size_t columns_,const size_t rows_); 1238 1239 // Shade image using distant light source 1240 void shade(const double azimuth_=30,const double elevation_=30, 1241 const bool colorShading_=false); 1242 1243 // Simulate an image shadow 1244 void shadow(const double percentAlpha_=80.0,const double sigma_=0.5, 1245 const ssize_t x_=5,const ssize_t y_=5); 1246 1247 // Sharpen pixels in image 1248 // The radius_ parameter specifies the radius of the Gaussian, in 1249 // pixels, not counting the center pixel. The sigma_ parameter 1250 // specifies the standard deviation of the Laplacian, in pixels. 1251 void sharpen(const double radius_=0.0,const double sigma_=1.0); 1252 void sharpenChannel(const ChannelType channel_,const double radius_=0.0, 1253 const double sigma_=1.0); 1254 1255 // Shave pixels from image edges. 1256 void shave(const Geometry &geometry_); 1257 1258 // Shear image (create parallelogram by sliding image by X or Y axis) 1259 void shear(const double xShearAngle_,const double yShearAngle_); 1260 1261 // adjust the image contrast with a non-linear sigmoidal contrast algorithm 1262 void sigmoidalContrast(const size_t sharpen_,const double contrast, 1263 const double midpoint=QuantumRange/2.0); 1264 1265 // Image signature. Set force_ to true in order to re-calculate 1266 // the signature regardless of whether the image data has been 1267 // modified. 1268 std::string signature(const bool force_=false) const; 1269 1270 // Simulates a pencil sketch. We convolve the image with a Gaussian 1271 // operator of the given radius and standard deviation (sigma). For 1272 // reasonable results, radius should be larger than sigma. Use a 1273 // radius of 0 and SketchImage() selects a suitable radius for you. 1274 void sketch(const double radius_=0.0,const double sigma_=1.0, 1275 const double angle_=0.0); 1276 1277 // Solarize image (similar to effect seen when exposing a 1278 // photographic film to light during the development process) 1279 void solarize(const double factor_=50.0); 1280 1281 // Sparse color image, given a set of coordinates, interpolates the colors 1282 // found at those coordinates, across the whole image, using various 1283 // methods. 1284 void sparseColor(const ChannelType channel_, 1285 const SparseColorMethod method_,const size_t numberArguments_, 1286 const double *arguments_); 1287 1288 // Splice the background color into the image. 1289 void splice(const Geometry &geometry_); 1290 1291 // Spread pixels randomly within image by specified ammount 1292 void spread(const size_t amount_=3); 1293 1294 void statistics(ImageStatistics *statistics); 1295 1296 // Add a digital watermark to the image (based on second image) 1297 void stegano(const Image &watermark_); 1298 1299 // Create an image which appears in stereo when viewed with 1300 // red-blue glasses (Red image on left, blue on right) 1301 void stereo(const Image &rightImage_); 1302 1303 // Strip strips an image of all profiles and comments. 1304 void strip(void); 1305 1306 // Search for the specified image at EVERY possible location in this image. 1307 // This is slow! very very slow.. It returns a similarity image such that 1308 // an exact match location is completely white and if none of the pixels 1309 // match, black, otherwise some gray level in-between. 1310 Image subImageSearch(const Image &reference_,const MetricType metric_, 1311 Geometry *offset_,double *similarityMetric_, 1312 const double similarityThreshold=(-1.0)); 1313 1314 // Swirl image (image pixels are rotated by degrees) 1315 void swirl(const double degrees_); 1316 1317 // Transfers the image cache pixels to the image. 1318 void syncPixels(void); 1319 1320 // Channel a texture on image background 1321 void texture(const Image &texture_); 1322 1323 // Threshold image 1324 void threshold(const double threshold_); 1325 1326 // Resize image to thumbnail size 1327 void thumbnail(const Geometry &geometry_); 1328 1329 // Applies a color vector to each pixel in the image. The length of the 1330 // vector is 0 for black and white and at its maximum for the midtones. 1331 // The vector weighting function is f(x)=(1-(4.0*((x-0.5)*(x-0.5)))) 1332 void tint(const std::string opacity_); 1333 1334 // Transform image based on image and crop geometries 1335 // Crop geometry is optional 1336 void transform(const Geometry &imageGeometry_); 1337 void transform(const Geometry &imageGeometry_, 1338 const Geometry &cropGeometry_); 1339 1340 // Origin of coordinate system to use when annotating with text or drawing 1341 void transformOrigin(const double x_,const double y_); 1342 1343 // Reset transformation parameters to default 1344 void transformReset(void); 1345 1346 // Scale to use when annotating with text or drawing 1347 void transformScale(const double sx_,const double sy_); 1348 1349 // Add matte image to image, setting pixels matching color to 1350 // transparent 1351 void transparent(const Color &color_); 1352 1353 // Add matte image to image, for all the pixels that lies in between 1354 // the given two color 1355 void transparentChroma(const Color &colorLow_,const Color &colorHigh_); 1356 1357 // Creates a horizontal mirror image by reflecting the pixels around the 1358 // central y-axis while rotating them by 90 degrees. 1359 void transpose(void); 1360 1361 // Creates a vertical mirror image by reflecting the pixels around the 1362 // central x-axis while rotating them by 270 degrees. 1363 void transverse(void); 1364 1365 // Trim edges that are the background color from the image 1366 void trim(void); 1367 1368 // Returns the unique colors of an image. 1369 Image uniqueColors(void); 1370 1371 // Replace image with a sharpened version of the original image 1372 // using the unsharp mask algorithm. 1373 // radius_ 1374 // the radius of the Gaussian, in pixels, not counting the 1375 // center pixel. 1376 // sigma_ 1377 // the standard deviation of the Gaussian, in pixels. 1378 // amount_ 1379 // the percentage of the difference between the original and 1380 // the blur image that is added back into the original. 1381 // threshold_ 1382 // the threshold in pixels needed to apply the diffence amount. 1383 void unsharpmask(const double radius_,const double sigma_, 1384 const double amount_,const double threshold_); 1385 void unsharpmaskChannel(const ChannelType channel_,const double radius_, 1386 const double sigma_,const double amount_,const double threshold_); 1387 1388 // Softens the edges of the image in vignette style. 1389 void vignette(const double radius_=0.0,const double sigma_=1.0, 1390 const ssize_t x_=0,const ssize_t y_=0); 1391 1392 // Map image pixels to a sine wave 1393 void wave(const double amplitude_=25.0,const double wavelength_=150.0); 1394 1395 // Forces all pixels above the threshold into white while leaving all 1396 // pixels at or below the threshold unchanged. 1397 void whiteThreshold(const std::string &threshold_); 1398 void whiteThresholdChannel(const ChannelType channel_, 1399 const std::string &threshold_); 1400 1401 // Write single image frame to in-memory BLOB, with optional 1402 // format and adjoin parameters. 1403 void write(Blob *blob_); 1404 void write(Blob *blob_,const std::string &magick_); 1405 void write(Blob *blob_,const std::string &magick_,const size_t depth_); 1406 1407 // Write single image frame to an array of pixels with storage 1408 // type specified by user (DispatchImage), e.g. 1409 // image.write( 0, 0, 640, 1, "RGB", 0, pixels ); 1410 void write(const ::ssize_t x_,const ::ssize_t y_,const size_t columns_, 1411 const size_t rows_,const std::string &map_,const StorageType type_, 1412 void *pixels_); 1413 1414 // Write single image frame to a file 1415 void write(const std::string &imageSpec_); 1416 1417 // Transfers one or more pixel components from the image pixel 1418 // cache to a buffer or file. 1419 // Used to support image encoders. 1420 void writePixels(const QuantumType quantum_,unsigned char *destination_); 1421 1422 // Zoom image to specified size. 1423 void zoom(const Geometry &geometry_); 1424 1425 ////////////////////////////////////////////////////////////////////// 1426 // 1427 // No user-serviceable parts beyond this point 1428 // 1429 ////////////////////////////////////////////////////////////////////// 1430 1431 // Construct with MagickCore::Image and default options 1432 Image(MagickCore::Image *image_); 1433 1434 // Retrieve Image* 1435 MagickCore::Image *&image(void); 1436 const MagickCore::Image *constImage(void) const; 1437 1438 // Retrieve ImageInfo* 1439 MagickCore::ImageInfo *imageInfo(void); 1440 const MagickCore::ImageInfo *constImageInfo(void) const; 1441 1442 // Retrieve Options* 1443 Options *options(void); 1444 const Options *constOptions(void) const; 1445 1446 // Retrieve QuantizeInfo* 1447 MagickCore::QuantizeInfo *quantizeInfo(void); 1448 const MagickCore::QuantizeInfo *constQuantizeInfo(void) const; 1449 1450 // Prepare to update image (copy if reference > 1) 1451 void modifyImage(void); 1452 1453 // Register image with image registry or obtain registration id 1454 ::ssize_t registerId(void); 1455 1456 // Replace current image (reference counted) 1457 MagickCore::Image *replaceImage(MagickCore::Image *replacement_); 1458 1459 // Unregister image from image registry 1460 void unregisterId(void); 1461 1462 private: 1463 1464 ImageRef *_imgRef; 1465 }; 1466 1467} // end of namespace Magick 1468 1469#endif // Magick_Image_header 1470