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