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