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