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