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