Blob provides the means to contain any opaque data. It is named after the term "Binary Large OBject" commonly used to describe unstructured data (such as encoded images) which is stored in a database. While the function of Blob is very simple (store a pointer and and size associated with allocated data), the Blob class provides some very useful capabilities. In particular, it is fully reference counted just like the Image class.
-
The Blob class supports value assignment while preserving any outstanding earlier versions of the object. Since assignment is via a pointer internally, Blob is efficient enough to be stored directly in an STL container or any other data structure which requires assignment. In particular, by storing a Blob in an associative container (such as STL's 'map') it is possible to create simple indexed in-memory "database" of Blobs.
-
Magick++ currently uses Blob to contain encoded images (e.g. JPEG) as well as ICC and IPTC profiles. Since Blob is a general-purpose class, it may be used for other purposes as well.
-
The methods Blob provides are shown in the following table:
-
-
Blob Methods
-
-
-
-
Method
-
-
Return Type
-
-
Signature(s)
-
-
Description
-
-
-
Blob
-
-
-
void
-
-
Default constructor
-
-
-
const void* data_, size_t length_
-
-
Construct object with data, making a copy of the supplied data
-
-
-
const Blob& blob_
-
-
Copy constructor (reference counted)
-
-
-
operator=
-
-
Blob
-
-
const Blob& blob_
-
-
Assignment operator (reference counted)
-
-
-
update
-
-
void
-
-
const void* data_, size_t length_
-
-
Update object contents, making a copy of the supplied data. Any existing data in the object is deallocated.
Update object contents, using supplied pointer directly (no copy) Any existing data in the object is deallocated. The user must ensure that the pointer supplied is not deleted or otherwise modified after it has been supplied to this method. The optional allocator_ parameter allows the user to specify if the C (MallocAllocator) or C++ (NewAllocator) memory allocation system was used to allocate the memory. The default is to use the C++ memory allocator.
The CoderInfo class provides the means to provide information regarding ImageMagick support for an image format (designated by a magick string). It may be used to provide support for a specific named format (provided as an argument to the constructor), or as an element of a container when format support is queried using the coderInfoList() templated function.
-
The following code fragment illustrates how CoderInfo may be used.
The methods available in the CoderInfo class are shown in the following table:
-
-
CoderInfo Methods
-
-
-
-
Method
-
-
Returns
-
-
Signature
-
-
Description
-
-
-
CoderInfo
-
-
-
void
-
-
Construct object corresponding to named format (e.g. "GIF"). An exception is thrown if the format is not supported.
-
-
-
name
-
-
std::string
-
-
void
-
-
Format name (e.g. "GIF").
-
-
-
description
-
-
std::string
-
-
void
-
-
Format description (e.g. "CompuServe graphics interchange format").
-
-
-
isReadable
-
-
bool
-
-
void
-
-
Format is readable.
-
-
-
isWritable
-
-
bool
-
-
void
-
-
Format is writeable.
-
-
-
isMultiFrame
-
-
bool
-
-
void
-
-
Format supports multiple frames.
-
-
-
diff --git a/ImageMagick/Magick++/Color.html b/ImageMagick/Magick++/Color.html
deleted file mode 100644
index 3df33a428..000000000
--- a/ImageMagick/Magick++/Color.html
+++ /dev/null
@@ -1,260 +0,0 @@
-
-
-
-
-
-Magick++ API: Working with Color
-
-
-
-
-
Magick::Color
-
Color is the base color class in Magick++. It is a simple container class for the pixel red, green, blue, and alpha values scaled to fit ImageMagick's Quantum size. Normally users will instantiate a class derived from Color which supports the color model that fits the needs of the application. The Color class may be constructed directly from an SVG-style color string.
-
Quantum
-
-The base type used to represent color samples in ImageMagick is the Quantum type. Pixels are represented by a structure of Quantum values. For example, an RGB pixel contains red, green, and blue quantums, while an RGBA pixel contains red, green, blue, and opacity quantums. The maximum value that a Quantum can attain is specified by a constant value represented by the MaxRGB define, which is itself determined by the number of bits in a Quantum. The QuantumDepth build option determines the number of bits in a Quantum.
-
-
Quantum
-
-Quantum is the internal representation of a pixel in ImageMagick. ImageMagick may be compiled to support 32, 64, or 128 bit pixels of type Quantum. This is controlled by the value of the QuantumDepth define. The default is 32 bit pixels (QuantumDepth=8), which provides the best performance and the least resource consumption. If additional color precision or range is desired, then ImageMagick may be compiled with QuantumDepth=16 or QuantumDepth=32. The following table shows the relationship between QuantumDepth, the type of Quantum, and the overall Quantum size.
-
Effect Of QuantumDepth Values
-
-
-
-
-
-
-
-
QuantumDepth
-
-
Quantum Typedef
-
-
Quantum Size
-
-
-
8
-
-
unsigned char
-
-
32 bits
-
-
-
16
-
-
unsigned short
-
-
64 bits
-
-
-
32
-
-
unsigned int
-
-
128 bits
-
-
Color Class
-
The Color base class is not intended to be used directly. Normally a user will construct a derived class or inherit from this class. Color arguments are must be scaled to fit the Quantum size. The Color class contains a pointer to a Quantum, which may be allocated by the Color class, or may refer to an existing pixel in an image.
-
An alternate way to construct the class is via an SVG-compatible color specification string (e.g. Color("red") or Color ("#FF0000")). Since the class may be constructed from a string, convenient strings may be passed in place of an explicit Color object in methods which accept a reference to Color. Color may also be converted to a std::string for convenience in user interfaces, and for saving settings to a text file.
-
-class Color
-{
- public:
- Color ( Quantum red_,
- Quantum green_,
- Quantum blue_ );
- Color ( Quantum red_,
- Quantum green_,
- Quantum blue_,
- Quantum alpha_ );
- Color ( const std::string &svgColor_ );
- Color ( const char * svgColor_ );
- Color ( void );
- virtual ~Color ( void );
- Color ( const Color & color_ );
-
- // Red color (range 0 to MaxRGB)
- void redQuantum ( Quantum red_ );
- Quantum redQuantum ( void ) const;
-
- // Green color (range 0 to MaxRGB)
- void greenQuantum ( Quantum green_ );
- Quantum greenQuantum ( void ) const;
-
- // Blue color (range 0 to MaxRGB)
- void blueQuantum ( Quantum blue_ );
- Quantum blueQuantum ( void ) const;
-
- // Alpha level (range OpaqueOpacity=0 to TransparentOpacity=MaxRGB)
- void alphaQuantum ( Quantum alpha_ );
- Quantum alphaQuantum ( void ) const;
-
- // Scaled (to 1.0) version of alpha for use in sub-classes
- // (range opaque=0 to transparent=1.0)
- void alpha ( double alpha_ );
- double alpha ( void ) const;
-
- // Does object contain valid color?
- void isValid ( bool valid_ );
- bool isValid ( void ) const;
-
- // Set color via SVG color specification string
- const Color& operator= ( const std::string & svgColor_ );
- const Color& operator= ( const char * svgColor_ );
-
- // Assignment operator
- Color& operator= ( const Color& color_ );
-
- // Return SVG color specification string
- /* virtual */ operator std::string() const;
-
- // Return ImageMagick Quantum
- operator Quantum() const;
-
- // Construct color via ImageMagick Quantum
- Color ( const Quantum &color_ );
-
- // Set color via ImageMagick Quantum
- const Color& operator= ( Quantum &color_ );
-};
-
Representation of an sRGB color. All color arguments have a valid range of 0.0 - 1.0.
-
-class ColorRGB : public Color
-{
- public:
- ColorRGB ( double red_, double green_, double blue_ );
- ColorRGB ( void );
- ColorRGB ( const Color & color_ );
- /* virtual */ ~ColorRGB ( void );
-
- void red ( double red_ );
- double red ( void ) const;
-
- void green ( double green_ );
- double green ( void ) const;
-
- void blue ( double blue_ );
- double blue ( void ) const;
-
- // Assignment operator from base class
- ColorRGB& operator= ( const Color& color_ );
-};
-
-
ColorGray
-
Representation of a grayscale color (in linear colorspace). Grayscale is simply RGB with equal parts of red, green, and blue. All double arguments have a valid range of 0.0 - 1.0.
Drawable provides a convenient interface for preparing vector, image, or text arguments for the Image::draw() method. Each instance of a Drawable sub-class represents a single drawable object. Drawable objects may be drawn "one-by-one" via multiple invocations of the Image draw() method, or may be drawn "all-at-once" by passing a list of Drawable objects to the Image draw() method. The one-by-one approach is convenient for simple drawings, while the list-based approach is appropriate for drawings which require more sophistication.
-
The following is an example using the Drawable subclasses with a one-by-one approach to draw the following figure:
Since Drawable is an object it may be saved in an array or a list for later (perhaps repeated) use. The following example shows how to draw the same figure using the list-based approach:
-
-#include <string>
-#include <iostream>
-#include <list>
-#include <Magick++.h>
-
-using namespace std;
-using namespace Magick;
-
-int main(int /*argc*/,char **/*argv*/)
-{
- try {
-
- InitializeMagick(*argv);
-
- // Create base image (white image of 300 by 200 pixels)
- Image image( Geometry(300,200), Color("white") );
-
- // Construct drawing list
- std::list<Magick::Drawable> drawList;
-
- // Add some drawing options to drawing list
- drawList.push_back(DrawableStrokeColor("red")); // Outline color
- drawList.push_back(DrawableStrokeWidth(5)); // Stroke width
- drawList.push_back(DrawableFillColor("green")); // Fill color
-
- // Add a Circle to drawing list
- drawList.push_back(DrawableCircle(100,100, 50,100));
-
- // Add a Rectangle to drawing list
- drawList.push_back(DrawableRectangle(200,100, 270,170));
-
- // Draw everything using completed drawing list
- image.draw(drawList);
-
- // Display the result
- image.display( );
- }
- catch( exception & error_ )
- {
- cout << "Caught exception: " << error_.what() << endl;
- return 1;
- }
-
- return 0;
-}
-
-
Drawable depends on the simple Coordinate structure which represents a pair of x,y coodinates. The methods provided by the Coordinate structure are shown in the following table:
-
Coordinate Structure Methods
-
-
-
-
Method/Member
-
-
Signature
-
-
Description
-
-
-
Coordinate
-
-
void
-
-
Default Constructor
-
-
-
double x_, double y_
-
-
Constructor, setting first & second
-
-
-
x
-
-
double x_
-
-
x coordinate member
-
-
-
y
-
-
double y_
-
-
y coordinate member
-
The Drawable classes are shown in the following table. Only constructor signatures are documented here. Each Drawable class also provides methods by which each individual parameter may be adjusted.
Specify a transformation matrix to adjust scaling, rotation, and translation (coordinate transformation) for subsequently drawn objects in the same or decendent drawing context. The sx_ & sy_ parameters represent the x & y scale factors, the rx_ & ry_ parameters represent the x & y rotation, and the tx_ & ty_ parameters represent the x & y translation.
-
-
-
void
-
-
Specify a transformation matrix to adjust scaling, rotation, and translation (coordinate transformation) for subsequently drawn objects in the same or decendent drawing context. Initialized to unity (no effect) affine values. Use class methods (not currently documented) to adjust individual parameters from their unity values.
Draw an arc using the stroke color and based on the circle starting at coordinates startX_,startY_, and ending with coordinates endX_,endY_, and bounded by the rotational arc startDegrees_,endDegrees_
-
-
-
DrawableBezier
-
-
const std::list<Magick::Coordinate> &coordinates_
-
-
Draw a bezier curve using the stroke color and based on the coordinates specified by the coordinates_ list.
Draw a circle using the stroke color and thickness using specified origin and perimeter coordinates. If a fill color is specified, then the object is filled.
Color image according to paintMethod. The point method recolors the target pixel. The replace method recolors any pixel that matches the color of the target pixel. Floodfill recolors any pixel that matches the color of the target pixel and is a neighbor, whereas filltoborder recolors any neighbor pixel that is not the border color. Finally, reset recolors all pixels.
Composite current image with contents of specified image, at specified coordinates. If the matte attribute is set to true, then the image composition will consider an alpha channel, or transparency, present in the image file so that non-opaque portions allow part (or all) of the composite image to show through.
Composite current image with contents of specified image, rendered with specified width and height, at specified coordinates. If the matte attribute is set to true, then the image composition will consider an alpha channel, or transparency, present in the image file so that non-opaque portions allow part (or all) of the composite image to show through. If the specified width or height is zero, then the image is composited at its natural size, without enlargement or reduction.
Composite current image with contents of specified image, rendered with specified width and height, using specified composition algorithm, at specified coordinates. If the matte attribute is set to true, then the image composition will consider an alpha channel, or transparency, present in the image file so that non-opaque portions allow part (or all) of the composite image to show through. If the specified width or height is zero, then the image is composited at its natural size, without enlargement or reduction.
Specify the pattern of dashes and gaps used to stroke paths. The strokeDashArray represents a zero-terminated array of numbers that specify the lengths of alternating dashes and gaps in pixels. If an odd number of values is provided, then the list of values is repeated to yield an even number of values. A typical strokeDashArray_ array might contain the members 5 3 2 0, where the zero value indicates the end of the pattern array.
-
-
-
DrawableDashOffset
-
-
double offset_
-
-
Specify the distance into the dash pattern to start the dash. See documentation on SVG's stroke-dashoffset property for usage details.
Draw an ellipse using the stroke color and thickness, specified origin, x & y radius, as well as specified start and end of arc in degrees. If a fill color is specified, then the object is filled.
Specify the algorithm which is to be used to determine what parts of the canvas are included inside the shape. See documentation on SVG's fill-rule property for usage details.
-
-
-
DrawableFillOpacity
-
-
double opacity_
-
-
Specify opacity to use when drawing using fill color.
-
-
-
DrawableFont
-
-
const std::string &font_
-
-
Specify font name to use when drawing text.
-
-
-
const std::string &family_,
-StyleType style_,
-unsigned int weight_,
-StretchType stretch_
-
-
Specify font family, style, weight (one of the set { 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 } with 400 being the normal size), and stretch to be used to select the font used when drawing text. Wildcard matches may be applied to style via the AnyStyle enumeration, applied to weight if weight is zero, and applied to stretch via the AnyStretch enumeration.
Change the pixel matte value to transparent. The point method changes the matte value of the target pixel. The replace method changes the matte value of any pixel that matches the color of the target pixel. Floodfill changes the matte value of any pixel that matches the color of the target pixel and is a neighbor, whereas filltoborder changes the matte value of any neighbor pixel that is not the border color, Finally reset changes the matte value of all pixels.
-
-
-
DrawableMiterLimit
-
-
size_t miterLimit_
-
-
Specify miter limit. When two line segments meet at a sharp angle and miter joins have been specified for 'lineJoin', it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miterLimit' imposes a limit on the ratio of the miter length to the 'lineWidth'. The default value of this parameter is 4.
-
-
-
DrawablePath
-
-
const std::list<Magick::VPath> &path_
-
-
Draw on image using vector path.
-
-
-
DrawablePoint
-
-
double x_, double y_
-
-
Draw a point using stroke color and thickness at coordinate
-
-
-
DrawablePointSize
-
-
double pointSize_
-
-
Set font point size.
-
-
-
DrawablePolygon
-
-
const std::list<Magick::Coordinate> &coordinates_
-
-
Draw an arbitrary polygon using stroke color and thickness consisting of three or more coordinates contained in an STL list. If a fill color is specified, then the object is filled.
-
-
-
DrawablePolyline
-
-
const std::list<Magick::Coordinate> &coordinates_
-
-
Draw an arbitrary polyline using stroke color and thickness consisting of three or more coordinates contained in an STL list. If a fill color is specified, then the object is filled.
-
-
-
DrawablePopClipPath
-
-
void
-
-
Pop (terminate) clip path definition started by DrawablePushClipPath.
-
-
-
DrawablePopGraphicContext
-
-
void
-
-
Pop Graphic Context. Removing the current graphic context from the graphic context stack restores the options to the values they had prior to the preceding DrawablePushGraphicContext operation.
-
-
-
DrawablePushClipPath
-
-
const std::string &id_
-
-
Push (create) clip path definition with id_. Clip patch definition consists of subsequent drawing commands, terminated by DrawablePopClipPath.
-
-
-
DrawablePushGraphicContext
-
-
void
-
-
Push Graphic Context. When a graphic context is pushed, options set after the context is pushed (such as coordinate transformations, color settings, etc.) are saved to a new graphic context. This allows related options to be saved on a graphic context "stack" in order to support heirarchical nesting of options. When DrawablePopGraphicContext is used to pop the current graphic context, the options in effect during the last DrawablePushGraphicContext operation are restored.
Start a pattern definition with arbitrary pattern name specified by id_, pattern offset specified by x_ and y_, and pattern size specified by width_ and height_. The pattern is defined within the coordinate system defined by the specified offset and size. Arbitrary drawing objects (including DrawableCompositeImage) may be specified between DrawablePushPattern and DrawablePopPattern in order to draw the pattern. Normally the pair DrawablePushGraphicContext & DrawablePopGraphicContext are used to enclose a pattern definition. Pattern definitions are terminated by a DrawablePopPattern object.
Draw a rectangle using stroke color and thickness from upper-left coordinates to lower-right coordinates. If a fill color is specified, then the object is filled.
-
-
-
DrawableRotation
-
-
double angle_
-
-
Set rotation to use when drawing (coordinate transformation).
Draw a rounded rectangle using stroke color and thickness, with specified center coordinate, specified width and height, and specified corner width and height. If a fill color is specified, then the object is filled.
-
-
-
DrawableScaling
-
-
double x_, double y_
-
-
Apply scaling in x and y direction while drawing objects (coordinate transformation).
-
-
-
DrawableSkewX
-
-
double angle_
-
-
Apply Skew in X direction (coordinate transformation)
Specify the shape to be used at the corners of paths (or other vector shapes) when they are stroked. Values of LineJoin are UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
-
-
-
DrawableStrokeOpacity
-
-
double opacity_
-
-
Opacity to use when drawing lines or object outlines.
-
-
-
DrawableStrokeWidth
-
-
double width_
-
-
Set width to use when drawing lines or object outlines.
-
-
-
DrawableText
-
-
double x_, double y_, std::string text_
-
-
Annotate image with text using stroke color, font, font pointsize, and box color (text background color), at specified coordinates. If text contains special format characters the image filename, type, width, height, or other image attributes may be incorporated in the text (see label()).
Annotate image with text represented with text encoding, using current stroke color, font, font pointsize, and box color (text background color), at specified coordinates. If text contains special format characters the image filename, type, width, height, or other image attributes may be incorporated in the text (see label()).
-
The text encoding specifies the code set to use for text annotations. The only character encoding which may be specified at this time is "UTF-8" for representing Unicode as a sequence of bytes. Specify an empty string to set text encoding to the system's default. Successful text annotation using Unicode may require fonts designed to support Unicode.
-
-
-
DrawableTextAntialias
-
-
bool flag_
-
-
Antialias while drawing text (default true). The main reason to disable text antialiasing is to avoid adding new colors to the image.
Dimensions of the output viewbox. If the image is to be written to a vector format (e.g. MVG or SVG), then a DrawablePushGraphicContext() object should be pushed to the head of the list, followed by a DrawableViewbox() statement to establish the output canvas size. A matching DrawablePopGraphicContext() object should be pushed to the tail of the list.
-
Vector Path Classes
-
The vector paths supported by Magick++ are based on those supported by the SVG XML specification. Vector paths are not directly drawable, they must first be supplied as a constructor argument to the DrawablePath class in order to create a drawable object. The DrawablePath class effectively creates a drawable compound component which may be replayed as desired. If the drawable compound component consists only of vector path objects using relative coordinates then the object may be positioned on the image by preceding it with a DrawablePath which sets the current drawing coordinate. Alternatively coordinate transforms may be used to translate the origin in order to position the object, rotate it, skew it, or scale it.
-
The "moveto" commands
-
The "moveto" commands establish a new current point. The effect is as if the "pen" were lifted and moved to a new location. A path data segment must begin with either one of the "moveto" commands or one of the "arc" commands. Subsequent "moveto" commands (i.e., when the "moveto" is not the first command) represent the start of a new subpath:
-
Moveto Classes
-
-
-
-
-
-
-
Sub-Class
-
-
Constructor Signature
-
-
Description
-
-
-
PathMovetoAbs
-
-
const Magick::Coordinate &coordinate_
-
-
Start a new sub-path at the given coordinate. PathMovetoAbs indicates that absolute coordinates will follow; PathMovetoRel indicates that relative coordinates will follow. If a relative moveto appears as the first element of the path, then it is treated as a pair of absolute coordinates. If a moveto is followed by multiple pairs of coordinates, the subsequent pairs are treated as implicit lineto commands.
-
-
-
const std::list<Magick::Coordinate> &coordinates_
-
-
-
PathMovetoRel
-
-
const Magick::Coordinate &coordinate_
-
-
-
const std::list<Magick::Coordinate> &coordinates_
-
The "closepath" command
-
The "closepath" command causes an automatic straight line to be drawn from the current point to the initial point of the current subpath:
-
Closepath Classes
-
-
-
-
-
-
-
Sub-Class
-
-
Constructor Signature
-
-
Description
-
-
-
PathClosePath
-
-
void
-
-
Close the current subpath by drawing a straight line from the current point to current subpath's most recent starting point (usually, the most recent moveto point).
-
The "lineto" commands
-
The various "lineto" commands draw straight lines from the current point to a new point:
-
Lineto Classes
-
-
-
-
-
-
-
Sub-Class
-
-
Constructor Signature
-
-
Description
-
-
-
PathLinetoAbs
-
-
const Magick::Coordinate& coordinate_
-
-
Draw a line from the current point to the given coordinate which becomes the new current point. PathLinetoAbs indicates that absolute coordinates are used; PathLinetoRel indicates that relative coordinates are used. A number of coordinates pairs may be specified in a list to draw a polyline. At the end of the command, the new current point is set to the final set of coordinates provided.
-
-
-
const std::list<Magick::Coordinate> &coordinates_
-
-
-
PathLinetoRel
-
-
const Magick::Coordinate& coordinate_
-
-
-
const std::list<Magick::Coordinate> &coordinates_
-
-
-
PathLinetoHorizontalAbs
-
-
double x_
-
-
Draws a horizontal line from the current point (cpx, cpy) to (x, cpy). PathLinetoHorizontalAbs indicates that absolute coordinates are supplied; PathLinetoHorizontalRel indicates that relative coordinates are supplied. At the end of the command, the new current point becomes (x, cpy) for the final value of x.
-
-
-
PathLinetoHorizontalRel
-
-
double x_
-
-
-
PathLinetoVerticalAbs
-
-
double y_
-
-
Draws a vertical line from the current point (cpx, cpy) to (cpx, y). PathLinetoVerticalAbs indicates that absolute coordinates are supplied; PathLinetoVerticalRel indicates that relative coordinates are supplied. At the end of the command, the new current point becomes (cpx, y) for the final value of y.
Draws an elliptical arc from the current point to (x, y). The size and orientation of the ellipse are defined by two radii (radiusX, radiusY) and an xAxisRotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automagically to satisfy the constraints imposed by the other parameters. largeArcFlag and sweepFlag contribute to the automatic calculations and help determine how the arc is drawn. If largeArcFlag is true then draw the larger of the available arcs. If sweepFlag is true, then draw the arc matching a clock-wise rotation.
ChannelType is used as an
-argument when doing color separations. Use ChannelType when
-extracting a layer from an image. MatteChannel is useful for
-extracting the opacity values from an image. Note that an image may
-be represented in RGB, RGBA, CMYK, or CMYKA, pixel formats and a
-channel may only be extracted if it is valid for the current pixel
-format.
Image is composed of pixels which represent literal color
- values.
-
-
-
-
-
PseudoClass
-
-
-
Image is composed of pixels which specify an index in a color
- palette.
-
-
-
-
-
-
-
-
-
-
- ColorspaceType
-
-
-
-
The ColorspaceType enumeration is used to specify the colorspace
-that quantization (color reduction and mapping) is done under or to
-specify the colorspace when encoding an output image. Colorspaces are
-ways of describing colors to fit the requirements of a particular
-application (e.g. Television, offset printing, color monitors).
-Color reduction, by default, takes place in the RGBColorspace.
-Empirical evidence suggests that distances in color spaces such as
-YUVColorspace or YIQColorspace correspond to perceptual
-color differences more closely han do distances in RGB space. These
-color spaces may give better results when color reducing an image.
-Refer to quantize for more details.
-
-
When encoding an output image, the
-colorspaces RGBColorspace, CMYKColorspace, and
-GRAYColorspace may be specified. The CMYKColorspace
-option is only applicable when writing TIFF, JPEG, and Adobe
-Photoshop bitmap (PSD) files.
-
-
ColorspaceType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedColorspace
-
-
-
Unset value.
-
-
-
-
-
CMYKColorspace
-
-
-
Cyan-Magenta-Yellow-Black colorspace. CYMK is a subtractive
- color system used by printers and photographers for the rendering
- of colors with ink or emulsion, normally on a white surface.
-
-
-
-
-
GRAYColorspace
-
-
-
Grayscale colorspace
-
-
-
-
-
HCLColorspace
-
-
-
-
-
-
-
-
LabColorspace
-
-
-
-
-
-
-
-
LCHabColorspace
-
-
-
-
-
-
-
-
LuvColorspace
-
-
-
-
-
-
-
-
OHTAColorspace
-
-
-
-
-
-
-
-
RGBColorspace
-
-
-
Red-Green-Blue colorspace.
-
-
-
-
-
sRGBColorspace
-
-
-
-
-
-
-
-
scRGBColorspace
-
-
-
-
-
-
-
-
TransparentColorspace
-
-
-
The Transparent color space behaves uniquely in that it
- preserves the matte channel of the image if it exists.
-
-
-
-
-
XYZColorspace
-
-
-
-
-
-
-
-
YCbCrColorspace
-
-
-
-
-
-
-
-
YCCColorspace
-
-
-
-
-
-
-
-
YIQColorspace
-
-
-
-
-
-
-
-
YPbPrColorspace
-
-
-
-
-
-
-
-
YUVColorspace
-
-
-
Y-signal, U-signal, and V-signal colorspace. YUV is most widely
- used to encode color for use in television transmission.
-
-
-
-
-
-
-
-
-
-
- CompositeOperator
-
-
-
-
CompositeOperator is used to
-select the image composition algorithm used to compose a composite
-image with an image. By default, each of the composite
-image pixels are replaced by the corresponding image tile pixel.
-Specify CompositeOperator to select a different algorithm.
-
-
CompositeOperator
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedCompositeOp
-
-
-
Unset value.
-
-
-
-
-
OverCompositeOp
-
-
-
The result is the union of the the two image shapes with the
- composite image obscuring image in the region of
- overlap.
-
-
-
-
-
InCompositeOp
-
-
-
The result is a simply composite image cut by the shape
- of image. None of the image data of image is included in
- the result.
-
-
-
-
-
OutCompositeOp
-
-
-
The resulting image is composite image with the shape of
- image cut out.
-
-
-
-
-
AtopCompositeOp
-
-
-
The result is the same shape as image image, with
- composite image obscuring image there the image
- shapes overlap. Note that this differs from OverCompositeOp
- because the portion of composite image outside of image's
- shape does not appear in the result.
-
-
-
-
-
XorCompositeOp
-
-
-
The result is the image data from both composite image
- and image that is outside the overlap region. The overlap
- region will be blank.
-
-
-
-
-
PlusCompositeOp
-
-
-
The result is just the sum of the image data. Output
- values are cropped to 255 (no overflow). This operation is
- independent of the matte channels.
-
-
-
-
-
MinusCompositeOp
-
-
-
The result of composite image - image, with
- overflow cropped to zero. The matte chanel is ignored (set to 255,
- full coverage).
-
-
-
-
-
AddCompositeOp
-
-
-
The result of composite image + image, with
- overflow wrapping around (mod 256).
-
-
-
-
-
SubtractCompositeOp
-
-
-
The result of composite image - image, with
- underflow wrapping around (mod 256). The add and subtract
- operators can be used to perform reverible transformations.
-
-
-
-
-
DifferenceCompositeOp
-
-
-
The result of abs(composite image - image). This
- is useful for comparing two very similar images.
-
-
-
-
-
MultiplyCompositeOp
-
-
-
-
-
-
-
-
BumpmapCompositeOp
-
-
-
The result image shaded by composite image.
-
-
-
-
-
CopyCompositeOp
-
-
-
The resulting image is image replaced with composite
- image. Here the matte information is ignored.
-
-
-
-
-
CopyRedCompositeOp
-
-
-
The resulting image is the red layer in image replaced
- with the red layer in composite image. The other layers are
- copied untouched.
-
-
-
-
-
CopyGreenCompositeOp
-
-
-
The resulting image is the green layer in image replaced
- with the green layer in composite image. The other layers
- are copied untouched.
-
-
-
-
-
CopyBlueCompositeOp
-
-
-
The resulting image is the blue layer in image replaced
- with the blue layer in composite image. The other layers
- are copied untouched.
-
-
-
-
-
CopyOpacityCompositeOp
-
-
-
The resulting image is the matte layer in image replaced
- with the matte layer in composite image. The other layers
- are copied untouched.
-
-
The image compositor requires a matte, or alpha channel in the
- image for some operations. This extra channel usually defines a
- mask which represents a sort of a cookie-cutter for the image.
- This is the case when matte is 255 (full coverage) for pixels
- inside the shape, zero outside, and between zero and 255 on the
- boundary. For certain operations, if image does not
- have a matte channel, it is initialized with 0 for any pixel
- matching in color to pixel location (0,0), otherwise 255 (to work
- properly borderWidth must be 0).
-
-
-
-
-
ClearCompositeOp
-
-
-
-
-
-
-
-
DissolveCompositeOp
-
-
-
-
-
-
-
-
DisplaceCompositeOp
-
-
-
-
-
-
-
-
ModulateCompositeOp
-
-
-
-
-
-
-
-
ThresholdCompositeOp
-
-
-
-
-
-
-
-
-
-
-
-
CompressionType
-
-
-
-
CompressionType is used to
-express the desired compression type when encoding an image. Be aware
-that most image types only support a sub-set of the available
-compression types. If the compression type specified is incompatable
-with the image, ImageMagick selects a compression type compatable
-with the image type.
-
-
CompressionType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedCompression
-
-
-
Unset value.
-
-
-
-
-
NoCompression
-
-
-
No compression
-
-
-
-
-
BZipCompression
-
-
-
BZip (Burrows-Wheeler block-sorting text compression algorithm
- and Huffman coding) as used by bzip2 utilities
-
-
-
-
-
FaxCompression
-
-
-
CCITT Group 3 FAX compression
-
-
-
-
-
Group4Compression
-
-
-
CCITT Group 4 FAX compression (used only for TIFF)
-
-
-
-
-
JPEGCompression
-
-
-
JPEG compression
-
-
-
-
-
LZWCompression
-
-
-
Lempel-Ziv-Welch (LZW) compression (caution, patented by
- Unisys)
-
-
-
-
-
RunlengthEncodedCompression
-
-
-
Run-Length encoded (RLE) compression
-
-
-
-
-
ZipCompression
-
-
-
Lempel-Ziv compression (LZ77) as used in PKZIP and GNU gzip.
-
-
-
-
-
-
-
-
-
-
- DecorationType
-
-
-
-
The DecorationType enumerations
-are used to specify line decorations of rendered text.
-
-
DecorationType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
NoDecoration
-
-
-
No decoration
-
-
-
-
-
UnderlineDecoration
-
-
-
Underlined text
-
-
-
-
-
OverlineDecoration
-
-
-
Overlined text
-
-
-
-
-
LineThroughDecoration
-
-
-
Strike-through text
-
-
-
-
-
-
-
-
-
EndianType
-
-
-
-
The EndianType enumerations are
-used to specify the endian option for formats which support it (e.g.
-TIFF).
-
-
-
-
EndianType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedEndian
-
-
-
Not defined (default)
-
-
-
-
-
LSBEndian
-
-
-
Little endian (like Intel X86 and DEC Alpha)
-
-
-
-
-
MSBEndian
-
-
-
Big endian (like Motorola 68K, Mac PowerPC, & SPARC)
-
-
-
-
-
-
-
-
-
FillRule
-
-
-
-
FillRule specifies the algorithm
-which is to be used to determine what parts of the canvas are
-included inside the shape. See the documentation on SVG's fill-rule
-property for usage details.
-
-
FillRule
-
-
-
-
UndefinedRule
-
-
-
Fill rule not specified
-
-
-
-
-
EvenOddRule
-
-
-
See SVG fill-rule evenodd rule.
-
-
-
-
-
NonZeroRule
-
-
-
See SVG fill-rule nonzero rule.
-
-
-
-
-
-
-
-
-
FilterTypes
-
-
-
-
FilterTypes is used to adjust
-the filter algorithm used when resizing images. Different filters
-experience varying degrees of success with various images and can
-take sipngicantly different amounts of processing time.
-ImageMagick uses the LanczosFilter by default since this
-filter has been shown to provide the best results for most images in
-a reasonable amount of time. Other filter types (e.g. TriangleFilter)
-may execute much faster but may show artifacts when the image is
-re-sized or around diagonal lines. The only way to be sure is to test
-the filter with sample images.
-
-
FilterTypes
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedFilter
-
-
-
Unset value.
-
-
-
-
-
PointFilter
-
-
-
Point Filter
-
-
-
-
-
BoxFilter
-
-
-
Box Filter
-
-
-
-
-
TriangleFilter
-
-
-
Triangle Filter
-
-
-
-
-
HermiteFilter
-
-
-
Hermite Filter
-
-
-
-
-
HanningFilter
-
-
-
Hanning Filter
-
-
-
-
-
HammingFilter
-
-
-
Hamming Filter
-
-
-
-
-
BlackmanFilter
-
-
-
Blackman Filter
-
-
-
-
-
GaussianFilter
-
-
-
Gaussian Filter
-
-
-
-
-
QuadraticFilter
-
-
-
Quadratic Filter
-
-
-
-
-
CubicFilter
-
-
-
Cubic Filter
-
-
-
-
-
CatromFilter
-
-
-
Catrom Filter
-
-
-
-
-
MitchellFilter
-
-
-
Mitchell Filter
-
-
-
-
-
LanczosFilter
-
-
-
Lanczos Filter
-
-
-
-
-
BesselFilter
-
-
-
Bessel Filter
-
-
-
-
-
SincFilter
-
-
-
Sinc Filter
-
-
-
-
-
-
-
-
-
GravityType
-
-
-
-
GravityType specifies
-positioning of an object (e.g. text, image) within a bounding region
-(e.g. an image). Gravity provides a convenient way to locate objects
-irrespective of the size of the bounding region, in other words, you
-don't need to provide absolute coordinates in order to position an
-object. A common default for gravity is NorthWestGravity.
-
-
GravityType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
ForgetGravity
-
-
-
Don't use gravity.
-
-
-
-
-
NorthWestGravity
-
-
-
Position object at top-left of region.
-
-
-
-
-
NorthGravity
-
-
-
Postiion object at top-center of region
-
-
-
-
-
NorthEastGravity
-
-
-
Position object at top-right of region
-
-
-
-
-
WestGravity
-
-
-
Position object at left-center of region
-
-
-
-
-
CenterGravity
-
-
-
Position object at center of region
-
-
-
-
-
EastGravity
-
-
-
Position object at right-center of region
-
-
-
-
-
SouthWestGravity
-
-
-
Position object at left-bottom of region
-
-
-
-
-
SouthGravity
-
-
-
Position object at bottom-center of region
-
-
-
-
-
SouthEastGravity
-
-
-
Position object at bottom-right of region
-
-
-
-
-
-
-
-
-
ImageType
-
-
-
-
ImageType indicates the type
-classification of the image.
-
-
ImageType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedType
-
-
-
Unset value.
-
-
-
-
-
BilevelType
-
-
-
Monochrome image
-
-
-
-
-
GrayscaleType
-
-
-
Grayscale image
-
-
-
-
-
GrayscaleMatteType
-
-
-
Grayscale image with opacity
-
-
-
-
-
PaletteType
-
-
-
Indexed color (palette) image
-
-
-
-
-
PaletteMatteType
-
-
-
Indexed color (palette) image with opacity
-
-
-
-
-
TrueColorType
-
-
-
Truecolor image
-
-
-
-
-
TrueColorMatteType
-
-
-
Truecolor image with opacity
-
-
-
-
-
ColorSeparationType
-
-
-
Cyan/Yellow/Magenta/Black (CYMK) image
-
-
-
-
-
-
-
-
-
InterlaceType
-
-
-
-
InterlaceType specifies the ordering of the red, green, and
-blue pixel information in the image. Interlacing is usually used to
-make image information available to the user faster by taking
-advantage of the space vs time tradeoff. For example, interlacing
-allows images on the Web to be recognizable sooner and satellite
-images to accumulate/render with image resolution increasing over
-time.
-
-
Use LineInterlace or
-PlaneInterlace to create an interlaced GIF or progressive JPEG
-image.
-
-
InterlaceType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedInterlace
-
-
-
Unset value.
-
-
-
-
-
NoInterlace
-
-
-
Don't interlace image (RGBRGBRGBRGBRGBRGB...)
-
-
-
-
-
LineInterlace
-
-
-
Use scanline interlacing (RRR...GGG...BBB...RRR...GGG...BBB...)
-
-
-
-
-
PlaneInterlace
-
-
-
Use plane interlacing (RRRRRR...GGGGGG...BBBBBB...)
-
-
-
-
-
PartitionInterlace
-
-
-
Similar to plane interlaing except that the different planes
- are saved to individual files (e.g. image.R, image.G, and image.B)
-
-
-
-
-
-
-
-
-
ChannelType
-
-
-
-
ChannelType is used as an
-argument when doing color separations. Use ChannelType when
-extracting a layer from an image. MatteLayer is useful for
-extracting the opacity values from an image.
-
-
ChannelType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedLayer
-
-
-
Unset value.
-
-
-
-
-
RedLayer
-
-
-
Select red layer
-
-
-
-
-
GreenLayer
-
-
-
Select green layer
-
-
-
-
-
BlueLayer
-
-
-
Select blue layer
-
-
-
-
-
MatteLayer
-
-
-
Select matte (opacity values) layer
-
-
-
-
-
-
-
-
-
LineCap
-
-
-
-
The LineCap enumerations specify
-shape to be used at the end of open subpaths when they are stroked.
-See SVG's 'stroke-linecap'
-for examples.
-
-
LineCap
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedCap
-
-
-
Unset value.
-
-
-
-
-
ButtCap
-
-
-
Square ending.
-
-
-
-
-
RoundCap
-
-
-
Rounded ending (half-circle end with radius of 1/2 stroke
- width).
-
-
-
-
-
SquareCap
-
-
-
Square ending, extended by 1/2 the stroke width at end.
-
-
-
-
-
-
-
-
-
LineJoin
-
-
-
-
The LineJoin enumerations
-specify the shape to be used at the corners of paths or basic shapes
-when they are stroked. See SVG's 'stroke-linejoin'
-for examples.
-
-
ChannelType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedJoin
-
-
-
Unset value.
-
-
-
-
-
MiterJoin
-
-
-
Sharp-edged join
-
-
-
-
-
RoundJoin
-
-
-
Rounded-edged join
-
-
-
-
-
BevelJoin
-
-
-
Beveled-edged join
-
-
-
-
-
-
-
-
-
NoiseType
-
-
-
-
NoiseType is used as an argument
-to select the type of noise to be added to the image.
-
-
NoiseType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UniformNoise
-
-
-
Uniform noise
-
-
-
-
-
GaussianNoise
-
-
-
Gaussian noise
-
-
-
-
-
MultiplicativeGaussianNoise
-
-
-
Multiplicative Gaussian noise
-
-
-
-
-
ImpulseNoise
-
-
-
Impulse noise
-
-
-
-
-
LaplacianNoise
-
-
-
Laplacian noise
-
-
-
-
-
PoissonNoise
-
-
-
Poisson noise
-
-
-
-
-
-
-
-
-
-
- OrientationType
-
-
-
-
OrientationType
-specifies the orientation of the image. Useful for when the image is
-produced via a different ordinate system, the camera was turned on
-its side, or the page was scanned sideways.
-
OrientationType
-
-
-
-
-
-
-
Enumeration
-
-
-
Scanline Direction
-
-
-
Frame Direction
-
-
-
-
-
UndefinedOrientation
-
-
-
Unknown
-
-
-
Unknown
-
-
-
-
-
TopLeftOrientation
-
-
-
Left to right
-
-
-
Top to bottom
-
-
-
-
-
TopRightOrientation
-
-
-
Right to left
-
-
-
Top to bottom
-
-
-
-
-
BottomRightOrientation
-
-
-
Right to left
-
-
-
Bottom to top
-
-
-
-
-
BottomLeftOrientation
-
-
-
Left to right
-
-
-
Bottom to top
-
-
-
-
-
LeftTopOrientation
-
-
-
Top to bottom
-
-
-
Left to right
-
-
-
-
-
RightTopOrientation
-
-
-
Top to bottom
-
-
-
Right to left
-
-
-
-
-
RightBottomOrientation
-
-
-
Bottom to top
-
-
-
Right to left
-
-
-
-
-
LeftBottomOrientation
-
-
-
Bottom to top
-
-
-
Left to right
-
-
-
-
-
-
-
-
-
PaintMethod
-
-
-
-
PaintMethod specifies how pixel
-colors are to be replaced in the image. It is used to select the
-pixel-filling algorithm employed.
-
-
PaintMethod
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
PointMethod
-
-
-
Replace pixel color at point.
-
-
-
-
-
ReplaceMethod
-
-
-
Replace color for all image pixels matching color at point.
-
-
-
-
-
FloodfillMethod
-
-
-
Replace color for pixels surrounding point until encountering
- pixel that fails to match color at point.
-
-
-
-
-
FillToBorderMethod
-
-
-
Replace color for pixels surrounding point until encountering
- pixels matching border color.
-
-
-
-
-
ResetMethod
-
-
-
Replace colors for all pixels in image with pen color.
-
-
-
-
-
-
-
-
-
QuantumTypes
-
-
-
-
QuantumTypes is used to indicate
-the source or destination format of entire pixels, or components of
-pixels ("Quantums") while they are being read, or written
-to, a pixel cache. The validity of these format specifications
-depends on whether the Image pixels are in RGB format, RGBA format,
-or CMYK format. The pixel Quantum size is determined by the Image
-depth (eight or sixteen bits).
-
-
RGB(A) Image Quantums
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
IndexQuantum
-
-
-
PseudoColor colormap indices (valid only for image with
- colormap)
-
-
-
-
-
RedQuantum
-
-
-
Red pixel Quantum
-
-
-
-
-
GreenQuantum
-
-
-
Green pixel Quantum
-
-
-
-
-
BlueQuantum
-
-
-
Blue pixel Quantum
-
-
-
-
-
AlphaQuantum
-
-
-
Alpha Quantum
-
-
-
-
-
-
CMY(K)(A) Image Quantum
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
CyanQuantum
-
-
-
Cyan pixel Quantum
-
-
-
-
-
MagentaQuantum
-
-
-
Magenta pixel Quantum
-
-
-
-
-
YellowQuantum
-
-
-
Yellow pixel Quantum
-
-
-
-
-
BlackQuantum
-
-
-
Black pixel Quantum
-
-
-
-
-
AlphaQuantum
-
-
-
Alpha Quantum
-
-
-
-
-
-
Grayscale Image
-Quantums
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
GrayQuantum
-
-
-
Gray pixel
-
-
-
-
-
GrayOpacityQuantum
-
-
-
Pixel opacity
-
-
-
-
-
AlphaQuantum
-
-
-
Alpha Quantum
-
-
-
-
-
-
Entire Pixels
-(Expressed in Byte Order)
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
RGBQuantum
-
-
-
RGB pixel (24 or 48 bits)
-
-
-
-
-
RGBAQuantum
-
-
-
RGBA pixel (32 or 64 bits)
-
-
-
-
-
CMYKQuantum
-
-
-
CMYK pixel (32 or 64 bits)
-
-
-
-
-
CMYKAQuantum
-
-
-
CMYKA pixel (40 or 80 bits)
-
-
-
-
-
-
-
-
-
RenderingIntent
-
-
-
-
Rendering intent is a concept defined by ICC
-Spec ICC.1:1998-09, "File Format for Color Profiles".
-ImageMagick uses RenderingIntent in order to support ICC
-Color Profiles.
-
-
From the specification: "Rendering
-intent specifies the style of reproduction to be used during the
-evaluation of this profile in a sequence of profiles. It applies
-specifically to that profile in the sequence and not to the entire
-sequence. Typically, the user or application will set the rendering
-intent dynamically at runtime or embedding time."
-
-
RenderingIntent
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedIntent
-
-
-
Unset value.
-
-
-
-
-
SaturationIntent
-
-
-
A rendering intent that specifies the saturation of the pixels
- in the image is preserved perhaps at the expense of accuracy in
- hue and lightness.
-
-
-
-
-
PerceptualIntent
-
-
-
A rendering intent that specifies the full gamut of the image
- is compressed or expanded to fill the gamut of the destination
- device. Gray balance is preserved but colorimetric accuracy might
- not be preserved.
-
-
-
-
-
AbsoluteIntent
-
-
-
Absolute colorimetric
-
-
-
-
-
RelativeIntent
-
-
-
Relative colorimetric
-
-
-
-
-
-
-
-
-
ResolutionType
-
-
-
-
By default, ImageMagick defines
-resolutions in pixels per inch. ResolutionType provides a
-means to adjust this.
-
-
ResolutionType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedResolution
-
-
-
Unset value.
-
-
-
-
-
PixelsPerInchResolution
-
-
-
Density specifications are specified in units of pixels per
- inch (english units).
-
-
-
-
-
PixelsPerCentimeterResolution
-
-
-
Density specifications are specified in units of pixels per
- centimeter (metric units).
-
-
-
-
-
-
-
-
-
StorageType
-
-
-
-
The StorageType enumerations are
-used to specify the storage format of pixels in the source or
-destination pixel array.
-
-
StorageType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
CharPixel
-
-
-
Character type
-
-
-
-
-
ShortPixel
-
-
-
Short type
-
-
-
-
-
IntegerPixel
-
-
-
Integer type
-
-
-
-
-
FloatPixel
-
-
-
Float type
-
-
-
-
-
DoublePixel
-
-
-
Double type
-
-
-
-
-
-
-
-
-
StretchType
-
-
-
-
The StretchType enumerations are
-used to specify the relative width of a font to the regular width for
-the font family. If the width is not important, the AnyStretch
-enumeration may be specified for a wildcard match.
-
-
StretchType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
AnyStretch
-
-
-
Wildcard match for font stretch
-
-
-
-
-
NormalStretch
-
-
-
Normal width font
-
-
-
-
-
UltraCondensedStretch
-
-
-
Ultra-condensed (narrowest) font
-
-
-
-
-
ExtraCondensedStretch
-
-
-
Extra-condensed font
-
-
-
-
-
CondensedStretch
-
-
-
Condensed font
-
-
-
-
-
SemiCondensedStretch
-
-
-
Semi-Condensed font
-
-
-
-
-
SemiExpandedStretch
-
-
-
Semi-Expanded font
-
-
-
-
-
ExpandedStretch
-
-
-
Expanded font
-
-
-
-
-
ExtraExpandedStretch
-
-
-
Extra-Expanded font
-
-
-
-
-
UltraExpandedStretch
-
-
-
Ultra-expanded (widest) font
-
-
-
-
-
-
-
-
-
StyleType
-
-
-
-
The StyleType enumerations are
-used to specify the style (e.g. Italic) of a font. If the style is
-not important, the AnyStyle enumeration may be specified for a
-wildcard match.
-
-
StyleType
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
AnyStyle
-
-
-
Wildcard match for font style
-
-
-
-
-
NormalStyle
-
-
-
Normal font style
-
-
-
-
-
ItalicStyle
-
-
-
Italic font style
-
-
-
-
-
ObliqueStyle
-
-
-
Oblique font style
-
-
-
-
-
-
-
-
-
VirtualPixelMethod
-
-
-
-
The VirtualPixelMethod enumerations are
-used to specify the virtual pixel method.
-
-
-
-
VirtualPixelMethod
-
-
-
-
Enumeration
-
-
-
Description
-
-
-
-
-
UndefinedVirtualPixelMethod
-
-
-
Not defined
-
-
-
-
-
BackgroundVirtualPixelMethod
-
-
-
the area surrounding the image is the background color
-
-
-
-
-
-
BlackVirtualPixelMethod
-
-
-
the area surrounding the image is black
-
-
-
-
-
CheckerTileVirtualPixelMethod
-
-
-
alternate squares with image and background color
-
-
-
-
-
-
DitherVirtualPixelMethod
-
-
-
non-random 32x32 dithered pattern
-
-
-
-
-
-
EdgeVirtualPixelMethod
-
-
-
extend the edge pixel toward infinity
-
-
-
-
-
-
GrayVirtualPixelMethod
-
-
-
the area surrounding the image is gray
-
-
-
-
-
-
HorizontalTileVirtualPixelMethod
-
-
-
horizontally tile the image, background color above/below
-
-
-
-
-
HorizontalTileEdgeVirtualPixelMethod
-
-
-
horizontally tile the image and replicate the side edge pixels
-
-
-
-
-
MirrorVirtualPixelMethod
-
-
-
mirror tile the image
-
-
-
-
-
-
RandomVirtualPixelMethod
-
-
-
choose a random pixel from the image
-
-
-
-
-
-
TileVirtualPixelMethod
-
-
-
tile the image (default)
-
-
-
-
-
-
TransparentVirtualPixelMethod
-
-
-
the area surrounding the image is transparent blackness
-
-
-
-
-
-
VerticalTileVirtualPixelMethod
-
-
-
vertically tile the image, sides are background color
-
-
-
-
-
-
VerticalTileEdgeVirtualPixelMethod
-
-
-
vertically tile the image and replicate the side edge pixels
-
Exception represents the base class of objects thrown when
-Magick++reports an error. Magick++ throws C++ exceptions synchronous
-with the operation where the error occurred. This allows errors to be
-trapped within the enclosing code (perhaps the code to process a
-single image) while allowing the code to be written with a simple
-coding style.
-
A try/catch block should be placed around any sequence of
-operations which can be considered an important body of work. For
-example, if your program processes lists of images and some of these
-images may be defective, by placing the try/catch block around the
-entire sequence of code that processes one image (including
-instantiating the image object), you can minimize the overhead of
-error checking while ensuring that all objects created to deal with
-that object are safely destroyed (C++ exceptions unroll the stack
-until the enclosing try block, destroying any created objects).
-
-
The pseudo code for the main loop of your program may look like:
-
-
-using namespace std;
-for infile in list
-{
- try {
- // Construct an image instance first so that we don't have to worry
- // about object construction failure due to a minor warning exception
- // being thrown.
- Magick::Image image;
- try {
- // Try reading image file
- image.read(infile);
- }
- catch( Magick::WarningCoder &warning )
- {
- // Process coder warning while loading file (e.g. TIFF warning)
- // Maybe the user will be interested in these warnings (or not).
- // If a warning is produced while loading an image, the image
- // can normally still be used (but not if the warning was about
- // something important!)
- cerr << "Coder Warning: " << warning.what() << endl;
- }
- catch( Magick::Warning &warning )
- {
- // Handle any other Magick++ warning.
- cerr << "Warning: " << warning.what() << endl;
- }
- catch( Magick::ErrorFileOpen &error )
- {
- // Process Magick++ file open error
- cerr << "Error: " << error.what() << endl;
- continue; // Try next image.
- }
- try {
- image.rotate(90);
- image.write("outfile");
- }
- catch ( MagickExeption & error)
- {
- // Handle problem while rotating or writing outfile.
- cerr << "Caught Magick++ exception: " << error.what() << endl;
- }
- }
- catch( std::exception & error )
- {
- // Process any other exceptions derived from standard C++ exception
- cerr << "Caught C++ STD exception: " << error.what() << endl;
- }
- catch( ... )
- {
- // Process *any* exception (last-ditch effort). There is not a lot
- // you can do here other to retry the operation that failed, or exit
- }
-}
-
-
The desired location and number of try/catch blocks in your program
-depends how sophisticated its error handling must be. Very simple
-programs may use just one try/catch block.
-
The Exception class is derived from the C++ standard
-exception class. This means that it contains a C++ string containing
-additional information about the error (e.g to display to the user).
-Obtain access to this string via the what() method. For
-example:
-
The classes Warning and Error derive from the
-Exception class. Exceptions derived from Warning are
-thrown to represent non-fatal errors which may effect the
-completeness or quality of the result (e.g. one image provided as an
-argument to montage is defective). In most cases, a Warning
-exception may be ignored by catching it immediately, processing it
-(e.g. printing a diagnostic) and continuing on. Exceptions derived
-from Error are thrown to represent fatal errors that can not
-produce a valid result (e.g. attempting to read a file which does not
-exist).
-
-
The specific derived exception classes
-are shown in the following tables:
-
-
Warning Sub-Classes
-
-
-
-
-
-
Warning
-
-
-
Warning Description
-
-
-
-
-
WarningUndefined
-
-
-
Unspecified warning type.
-
-
-
-
-
WarningBlob
-
-
-
NOT
- CURRENTLY USED
-
-
-
-
-
WarningCache
-
-
-
NOT
- CURRENTLY USED
-
-
-
-
-
WarningCoder
-
-
-
Warnings issued by some coders.
-
-
-
-
-
WarningConfigure
-
-
-
NOT
- CURRENTLY USED
-
-
-
-
-
WarningCorruptImage
-
-
-
Warning issued when an image is determined to be
- corrupt.
-
-
-
-
-
WarningDelegate
-
-
-
Warnings reported by the delegate (interface to
- external programs) subsystem.
-
-
-
-
-
WarningDraw
-
-
-
Warnings reported by the rendering subsystem.
-
-
-
-
-
WarningFileOpen
-
-
-
Warning reported when The image file could not be
- opened (permission problem, wrong file type, or does not exist).
-
-
-
-
-
WarningImage
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
WarningMissingDelegate
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
WarningModule
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
WarningMonitor
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
WarningOption
-
-
-
Warning reported when an option is malformed or
- out of range.
-
-
-
-
-
WarningRegistry
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
WarningResourceLimit
-
-
-
Warning reported when a program resource is
- exhausted (e.g. not enough memory).
-
-
-
-
-
WarningStream
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
WarningType
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
WarningXServer
-
-
-
Warnings reported by the X11 subsystem.
-
-
-
-
-
-
Error Sub-Classes
-
-
-
-
-
-
Error
-
-
-
Error Description
-
-
-
-
-
ErrorUndefined
-
-
-
Unspecified error type.
-
-
-
-
-
ErrorBlob
-
-
-
Error reported by BLOB I/O subsystem.
-
-
-
-
-
ErrorCache
-
-
-
Error reported by the pixel cache subsystem.
-
-
-
-
-
ErrorCoder
-
-
-
Error reported by coders (image format support).
-
-
-
-
-
ErrorConfigure
-
-
-
Errors reported while loading configuration files.
-
-
-
-
-
ErrorCorruptImage
-
-
-
Error reported when the image file is corrupt.
-
-
-
-
-
ErrorDelegate
-
-
-
Errors reported by the delegate (interface to
- external programs) subsystem.
-
-
-
-
-
ErrorDraw
-
-
-
Error reported while drawing on image.
-
-
-
-
-
ErrorFileOpen
-
-
-
Error reported when the image file can not be
- opened.
-
-
-
-
-
ErrorImage
-
-
-
Errors reported while drawing.
-
-
-
-
-
ErrorMissingDelegate
-
-
-
Error reported when an add-on library or program
- is necessary in order to support the requested operation.
-
-
-
-
-
ErrorModule
-
-
-
Errors reported by the module loader subsystem.
-
-
-
-
-
ErrorMonitor
-
-
-
NOT CURRENTLY USED
-
-
-
-
-
ErrorOption
-
-
-
Error reported when an option is malformed or out
- of range.
-
-
-
-
-
ErrorRegistry
-
-
-
Errors reported by the image/BLOB registry
- subsystem.
-
-
-
-
-
ErrorResourceLimit
-
-
-
Error reported when a program resource is
- exhausted (e.g. not enough memory).
-
-
-
-
-
ErrorStream
-
-
-
Errors reported by the pixel stream subsystem.
-
-
-
-
-
ErrorType
-
-
-
Errors reported by the type (font) rendering
- subsystem.
The Magick::Image methods annotate, draw, label, and the template function montageImages support special format characters contained in the argument text. These format characters work similar to C's printf. Whenever a format character appears in the text, it is replaced with the equivalent attribute text. The available format characters are shown in the following table.
Geometry provides a convenient means to specify a geometry
-argument. The object may be initialized from a C string or C++ string
-containing a geometry specification. It may also be initialized by
-more efficient parameterized constructors.
-
-
Geometry
-Specifications
-
Geometry specifications are in the form
-"<width>x<height>{+-}<xoffset>{+-}<yoffset>"
-(where width, height, xoffset, and yoffset
-are numbers) for specifying the size and placement location for an
-object.
-
-
The width and height
-parts of the geometry specification are measured in pixels. The
-xoffset and yoffset parts are also measured in pixels
-and are used to specify the distance of the placement coordinate from
-the left and top and edges of the image, respectively. Both types of
-offsets are measured from the indicated edge of the object to the
-corresponding edge of the image. The X offset may be specified in the
-following ways:
-
-
-
-
-
-
-
+xoffset
-
-
-
The left edge of the object is to be placed xoffset
- pixels in from the left edge of the image.
-
-
-
-
-
-xoffset
-
-
-
The left edge of the object is to be placed outside the image,
- xoffset pixels out from the left edge of the image.
-
-
-
-
The Y offset has similar meanings:
-
-
-
-
-
-
-
+yoffset
-
-
-
The top edge of the object is to be yoffset pixels
- below the top edge of the image.
-
-
-
-
-
-yoffset
-
-
-
The top edge of the object is to be yoffset pixels
- above the top edge of the image.
-
-
-
-
Offsets must be given as pairs; in other words, in order to
-specify either xoffset or yoffset both must be present.
-
-
ImageMagick
-Extensions To Geometry Specifications
-
ImageMagick has added a number of
-qualifiers to the standard geometry string for use when resizing
-images. The form of an extended geometry string is
-"<width>x<height>{+-}<xoffset>{+-}<yoffset>{%}{!}{<}{>}".
-Extended geometry strings should only be used when resizing
-an image. Using an extended geometry string for other
-applications may cause the API call to fail. The available
-qualifiers are shown in the following table:
-
-
ImageMagick Geometry
-Qualifiers
-
-
-
-
-
-
Qualifier
-
-
-
Description
-
-
-
-
-
%
-
-
-
Interpret width and height as a percentage of the
- current size.
-
-
-
-
-
!
-
-
-
Resize to width and height exactly, loosing original
- aspect ratio.
-
-
-
-
-
<
-
-
-
Resize only if the image is smaller than the geometry
- specification.
-
-
-
-
-
>
-
-
-
Resize only if the image is greater than the geometry
- specification.
Any geometry string specification supplied to the Geometry
-constructor is considered to be a Postscript page size nickname if
-the first character is not numeric. The Geometry constructor converts
-these page size specifications into the equivalent numeric geometry
-string specification (preserving any offset component) prior to
-conversion to the internal object format. Postscript page size
-specifications are short-hand for the pixel geometry required to fill
-a page of that size. Since the 11x17 inch page size used in the US
-starts with a digit, it is not supported as a Postscript page size
-nickname. Instead, substitute the geometry specification "792x1224>"
-when 11x17 output is desired.
-
-
An example of a Postscript page size
-specification is "letter+43+43>".
-
-
Postscript Page Size
-Nicknames
-
-
-
-
-
-
Postscript Page Size Nickname
-
-
-
Equivalent Extended Geometry Specification
-
-
-
-
-
Ledger
-
-
-
1224x792>
-
-
-
-
-
Legal
-
-
-
612x1008>
-
-
-
-
-
Letter
-
-
-
612x792>
-
-
-
-
-
LetterSmall
-
-
-
612x792>
-
-
-
-
-
ArchE
-
-
-
2592x3456>
-
-
-
-
-
ArchD
-
-
-
1728x2592>
-
-
-
-
-
ArchC
-
-
-
1296x1728>
-
-
-
-
-
ArchB
-
-
-
864x1296>
-
-
-
-
-
ArchA
-
-
-
648x864>
-
-
-
-
-
A0
-
-
-
2380x3368>
-
-
-
-
-
A1
-
-
-
1684x2380>
-
-
-
-
-
A2
-
-
-
1190x1684>
-
-
-
-
-
A3
-
-
-
842x1190>
-
-
-
-
-
A4
-
-
-
595x842>
-
-
-
-
-
A4Small
-
-
-
595x842>
-
-
-
-
-
A5
-
-
-
421x595>
-
-
-
-
-
A6
-
-
-
297x421>
-
-
-
-
-
A7
-
-
-
210x297>
-
-
-
-
-
A8
-
-
-
148x210>
-
-
-
-
-
A9
-
-
-
105x148>
-
-
-
-
-
A10
-
-
-
74x105>
-
-
-
-
-
B0
-
-
-
2836x4008>
-
-
-
-
-
B1
-
-
-
2004x2836>
-
-
-
-
-
B2
-
-
-
1418x2004>
-
-
-
-
-
B3
-
-
-
1002x1418>
-
-
-
-
-
B4
-
-
-
709x1002>
-
-
-
-
-
B5
-
-
-
501x709>
-
-
-
-
-
C0
-
-
-
2600x3677>
-
-
-
-
-
C1
-
-
-
1837x2600>
-
-
-
-
-
C2
-
-
-
1298x1837>
-
-
-
-
-
C3
-
-
-
918x1298>
-
-
-
-
-
C4
-
-
-
649x918>
-
-
-
-
-
C5
-
-
-
459x649>
-
-
-
-
-
C6
-
-
-
323x459>
-
-
-
-
-
Flsa
-
-
-
612x936>
-
-
-
-
-
Flse
-
-
-
612x936>
-
-
-
-
-
HalfLetter
-
-
-
396x612>
-
-
-
-
Geometry Methods
-
Geometry provides methods to initialize
-its value from strings, from a set of parameters, or via attributes.
-The methods available for use in Geometry are shown in the following
-table:
-
Image is the primary object in Magick++ and represents
-a single image frame (see design ). The
-STL interfacemust be used to operate on
-image sequences or images (e.g. of format GIF, TIFF, MIFF, Postscript,
-& MNG) which are comprized of multiple image frames. Individual
-frames of a multi-frame image may be requested by adding array-style
-notation to the end of the file name (e.g. "animation.gif[3]" retrieves
-the fourth frame of a GIF animation. Various image manipulation
-operations may be applied to the image. Attributes may be set on the
-image to influence the operation of the manipulation operations. The Pixels class provides low-level access to
-image
-pixels. As a convenience, including <Magick++.h>
-is sufficient in order to use the complete Magick++ API. The Magick++
-API is enclosed within the Magick namespace so you must either
-add the prefix " Magick:: " to each class/enumeration name or
-add
-the statement " using namespace Magick;" after including the Magick++.h
-header.
-
The preferred way to allocate Image objects is via automatic
-allocation (on the stack). There is no concern that allocating Image
-objects on the stack will excessively enlarge the stack since Magick++
-allocates all large data objects (such as the actual image data) from
-the heap. Use of automatic allocation is preferred over explicit
-allocation (via new) since it is much less error prone and
-allows use of C++ scoping rules to avoid memory leaks. Use of automatic
-allocation allows Magick++ objects to be assigned and copied just like
-the C++ intrinsic data types (e.g. 'int '), leading to clear and
-easy to read code. Use of automatic allocation leads to naturally
-exception-safe code since if an exception is thrown, the object is
-automagically deallocated once the stack unwinds past the scope of the
-allocation (not the case for objects allocated via new ).
-
Image is very easy to use. For example, here is a the source to a
-program which reads an image, crops it, and writes it to a new file
-(the
-exception handling is optional but strongly recommended):
-
-#include <Magick++.h>
-#include <iostream>
-using namespace std;
-using namespace Magick;
-int main(int argc,char **argv)
-{
- InitializeMagick(*argv);
-
- // Construct the image object. Seperating image construction from the
- // the read operation ensures that a failure to read the image file
- // doesn't render the image object useless.
- Image image;
- try {
- // Read a file into image object
- image.read( "girl.gif" );
-
- // Crop the image to specified size (width, height, xOffset, yOffset)
- image.crop( Geometry(100,100, 100, 100) );
-
- // Write the image to a file
- image.write( "x.gif" );
- }
- catch( Exception &error_ )
- {
- cout << "Caught exception: " << error_.what() << endl;
- return 1;
- }
- return 0;
-}
-
-The following is the source to a program which illustrates the use of
-Magick++'s efficient reference-counted assignment and copy-constructor
-operations which minimize use of memory and eliminate unncessary copy
-operations (allowing Image objects to be efficiently assigned, and
-copied into containers). The program accomplishes the
-following:
-
-
-During the entire operation, a maximum of three images exist in memory
-and the image data is never copied.
-
The following is the source for another simple program which creates
-a 100 by 100 pixel white image with a red pixel in the center and
-writes it to a file:
-While encoded images (e.g. JPEG) are most often written-to and
-read-from a disk file, encoded images may also reside in memory.
-Encoded
-images in memory are known as BLOBs (Binary Large OBjects) and may be
-represented using the Blob class. The encoded
-image may be initially placed in memory by reading it directly from a
-file, reading the image from a database, memory-mapped from a disk
-file, or could be written to memory by Magick++. Once the encoded image
-has been placed within a Blob, it may be read into a Magick++ Image via
-a constructor or read()
-. Likewise, a Magick++ image may be written to a Blob via write() .
-
An example of using Image to write to a Blob follows:
-
-
-#include >Magick++.h>
-using namespace std;
-using namespace Magick;
-int main(int argc,char **argv)
-{
- InitializeMagick(*argv);
-
- // Read GIF file from disk
- Image image( "giraffe.gif" );
- // Write to BLOB in JPEG format
- Blob blob;
- image.magick( "JPEG" ) // Set JPEG output format
- image.write( &blob );
-
- [ Use BLOB data (in JPEG format) here ]
-
- return 0;
-}
-
-
-likewise, to read an image from a Blob, you could use one of the
-following examples:
-
[ Entry condition for the following examples
-is that data is pointer to encoded image data and length
-represents the size of the data ]
-Image may be constructed in a number of ways. It may be constructed
-from a file, a URL, or an encoded image (e.g. JPEG) contained in an
-in-memory BLOB . The available Image
-constructors are shown in the following table:
-
-
-
-
Image Constructors
-
-
-
Signature
-
-
-
Description
-
-
-
-
const std::string &imageSpec_
-
Construct Image by reading from file or URL
-specified by imageSpec_. Use array notation (e.g. filename[9])
-to select a specific scene from a multi-frame image.
Construct Image by reading from
-encoded image data contained in an in-memory BLOB
-. Depending on the constructor arguments, the Blob size
-, depth , magick (format)
-may
-also be specified. Some image formats require that size be specified.
-The default ImageMagick uses for depth depends on the compiled-in
-Quantum size (8 or 16). If ImageMagick's Quantum size does not
-match that of the image, the depth may need to be specified.
-ImageMagick can usually automagically detect the image's format.
-When a format can't be automagically detected, the format (magick ) must be specified.
Construct a new Image based on an array of
-image pixels. The pixel data must be in scanline order top-to-bottom.
-The data can be character, short int, integer, float, or double. Float
-and double require the pixels to be normalized [0..1]. The other types
-are [0..MaxRGB]. For example, to create a 640x480 image from
-unsigned red-green-blue character data, use
-
Image image( 640, 480, "RGB",
-0, pixels );
-
The parameters are as follows:
-
-
-
-
-
width_
-
Width in pixels of the image.
-
-
-
height_
-
Height in pixels of the image.
-
-
-
map_
-
This character string can be any
-combination or order of R = red, G = green, B = blue, A = alpha, C =
-cyan, Y = yellow M = magenta, and K = black. The ordering reflects the
-order of the pixels in the supplied pixel array.
-
-
-
type_
-
Pixel
-storage type (CharPixel, ShortPixel, IntegerPixel, FloatPixel, or
-DoublePixel)
-
-
-
pixels_
-
This array of values contain the pixel
-components as defined by the map_ and type_ parameters. The length of
-the arrays must equal the area specified by the width_ and height_
-values and type_ parameters.
-
-
-
-
-
-
-
-
-
Image Manipulation
-Methods
-
-Image supports access to all the single-image (versus
-image-list) manipulation operations provided by the ImageMagick
-library. If you
-must process a multi-image file (such as an animation), the STL interface , which provides a multi-image
-abstraction on top of Image, must be used.
-
Image manipulation methods are very easy to use. For example:
-adds gaussian noise to the image file "myImage.tiff".
-
The operations supported by Image are shown in the following table:
-
-
-
Image Image Manipulation Methods
-
-
Method
-
Signature(s)
-
Description
-
-
-
-
adaptiveThreshold
-
-
-
size_t width, size_t
-height, size_t offset = 0
-
-
Apply adaptive thresholding to
-the image. Adaptive thresholding is useful if the ideal threshold level
-is not known in advance, or if the illumination gradient is not
-constant
-across the image. Adaptive thresholding works by evaulating the mean
-(average) of a pixel region (size specified by width and height)
-and using the mean as the thresholding value. In order to remove
-residual noise from the background, the threshold may be adjusted by
-subtracting a constant offset (default zero) from the mean to
-compute the threshold.
-
Add noise to an image
-channel with the specified noise type. The channel_ parameter specifies the
-channel to add noise to. The noiseType_ parameter
-specifies the type of noise.
-
-
-
-
affineTransform
-
-
const DrawableAffine
-&affine
-
-
Transform image by
-specified affine (or free transform) matrix.
-
Annotate with text using specified text,
-bounding area, placement gravity, and rotation. If boundingArea_
-is invalid, then bounding area is entire image.
Blur image. The radius_ parameter
-specifies the radius of the Gaussian, in pixels, not counting the
-center
-pixel. The sigma_ parameter specifies the standard
-deviation of the Laplacian, in pixels.
Blur an image
-channel. The channel_
-parameter specifies the channel to blur. The radius_ parameter
-specifies the radius of the Gaussian, in pixels, not counting the
-center
-pixel. The sigma_ parameter specifies the standard
-deviation of the Laplacian, in pixels.
Extract channel from image. Use this option
-to extract a particular channel from the image. MatteChannel
- for example, is useful for extracting the opacity values
-from an image.
Charcoal effect image (looks like charcoal
-sketch). The radius_ parameter specifies the radius of the
-Gaussian, in pixels, not counting the center pixel. The sigma_
-parameter specifies the standard deviation of the Laplacian, in pixels.
Chop image (remove vertical or horizontal
-subregion of image)
-
-
-
-
colorize
-
-
const unsigned int opacityRed_, const
-unsigned int opacityGreen_, const unsigned int opacityBlue_, const
-Color &penColor_
-
Colorize image with pen color, using
-specified percent opacity for red, green, and blue quantums.
-
-
-
-
colorMatrix
-
-
const size_t order_, const double *color_matrix_
-
apply color correction to the image.
-
-
-
-
comment
-
-
const std::string &comment_
-
Comment image (add comment string to
-image). By default, each image is commented with its file name.
-Use this method to assign a specific comment to the
-image. Optionally you can include the image filename, type,
-width, height, or other image attributes by embedding special format characters.
-
-
-
compare
-
-
const Image &reference_
-
-
Compare current image with
-another image. Sets meanErrorPerPixel
-, normalizedMaxError , and normalizedMeanError in the current
-image. False is returned if the images are identical. An ErrorOption
-exception is thrown if the reference image columns, rows, colorspace,
-or
-matte differ from the current image.
-
Convolve image. Applies a user-specfied
-convolution to the image. The order_ parameter represents the
-number of columns and rows in the filter kernel, and kernel_
-is a two-dimensional array of doubles representing the convolution
-kernel to apply.
Display image on screen.
- Caution: if
-an image format is is not compatible with the display visual (e.g.
-JPEG on a colormapped display) then the original image will be
-altered. Use a copy of the original if this is a problem.
Draw shapes or text on image using a set of
-Drawable objects contained in an STL list. Use of this method improves
-drawing performance and allows batching draw objects together in a
-list for repeated use.
-
-
-
-
edge
-
-
size_t radius_ = 0.0
-
Edge image (hilight edges in image).
-The radius is the radius of the pixel neighborhood.. Specify a radius
-of zero for automatic radius selection.
Emboss image (hilight edges with 3D effect).
-The radius_ parameter specifies the radius of the Gaussian, in
-pixels, not counting the center pixel. The sigma_
-parameter specifies the standard deviation of the Laplacian, in pixels.
-
-
-
-
enhance
-
-
void
-
Enhance image (minimize noise)
-
-
-
-
equalize
-
-
void
-
Equalize image (histogram equalization)
-
-
-
-
erase
-
-
void
-
Set all image pixels to the current
-background color.
Flood-fill color across pixels
-that match the color of the target pixel and are neighbors of the
-target pixel. Uses current fuzz setting when determining color match.
ssize_t x_, ssize_t y_, const Color &fillColor_, const Color
-&borderColor_
-
Flood-fill color across pixels
-starting at target-pixel and stopping at pixels matching specified
-border color. Uses current fuzz setting when determining color match.
-
-
-
const Geometry
-&point_, const Color &fillColor_,
-const Color &borderColor_
-
-
-
floodFillOpacity
-
const long x_, const long y_, const unsigned int
-opacity_, const PaintMethod method_
-
Floodfill pixels matching color (within fuzz
-factor) of target pixel(x,y) with replacement opacity value using
-method.
-
-
-
-
floodFill-
-
- Texture
-
-
ssize_t x_, ssize_t y_, const
-Image &texture_
-
Flood-fill texture across pixels
-that match the color of the target pixel and are neighbors of the
-target pixel. Uses current fuzz setting when determining color match.
ssize_t x_, ssize_t y_, const Image
-&texture_, const Color &borderColor_
-
Flood-fill texture across pixels
-starting at target-pixel and stopping at pixels matching specified
-border color. Uses current fuzz setting when determining color match.
Gamma correct red, green, and blue channels
-of image.
-
-
-
-
gaussianBlur
-
-
const double width_, const double sigma_
-
Gaussian blur image. The number of neighbor
-pixels to be included in the convolution mask is specified by
-'width_'. For example, a width of one gives a (standard) 3x3
-convolution mask. The standard deviation of the gaussian bell curve is
-specified by 'sigma_'.
Gaussian blur
-an image channel. The channel_ parameter specifies the
-channel to blur. The number of neighbor
-pixels to be included in the convolution mask is specified by
-'width_'. For example, a width of one gives a (standard) 3x3
-convolution mask. The standard deviation of the gaussian bell curve is
-specified by 'sigma_'.
-
-
-
haldClut
-
-
const Image &reference_
-
-
apply a Hald color lookup table to the image.
-
-
-
-
-
implode
-
-
const double factor_
-
Implode image (special effect)
-
-
-
-
inverseFourierTransform
-
-
const Image &phaseImage_, const bool magnitude_
-
implements the inverse discrete Fourier transform (DFT) of the image either as a magnitude / phase or real / imaginary image pair.
-
-
-
-
label
-
-
const string &label_
-
Assign a label to an image. Use this option
-to assign a specific label to the image. Optionally
-you can include the image filename, type, width, height, or scene
-number in the label by embedding
-special format characters. If the first character of string is @,
-the
-image label is read from a file titled by the remaining characters in
-the string. When converting to Postscript, use this option to
-specify a header string to print above the image.
Level image. Adjust the
-levels of the image by scaling the colors falling between specified
-white and black points to the full available quantum range. The
-parameters provided represent the black, mid (gamma), and white
-points. The black point specifies the darkest color in the image.
-Colors darker than the black point are set to zero. Mid point (gamma)
-specifies a gamma correction to apply to the image. White point
-specifies the lightest color in the image. Colors brighter than
-the white point are set to the maximum quantum value. The black and
-white point have the valid range 0 to MaxRGB while mid (gamma) has a
-useful range of 0 to ten.
-
Level image channel.
-Adjust the levels of the image channel by scaling the values falling
-between specified white and black points to the full available quantum
-range. The parameters provided represent the black, mid (gamma), and
-white points. The black point specifies the darkest color in the image.
-Colors darker than the black point are set to zero. Mid point (gamma)
-specifies a gamma correction to apply to the image. White point
-specifies the lightest color in the image. Colors brighter than the
-white point are set to the maximum quantum value. The black and white
-point have the valid range 0 to MaxRGB while mid (gamma) has a useful
-range of 0 to ten.
-
-
-
-
-
magnify
-
-
void
-
Magnify image by integral size
-
-
-
-
map
-
-
const Image &mapImage_ , bool dither_ =
-false
-
Remap image colors with closest color from
-reference image. Set dither_ to true in to apply
-Floyd/Steinberg
-error diffusion to the image. By default, color reduction chooses an
-optimal set of colors that best represent the original
-image. Alternatively, you can choose a
-particular set of colors from an image file
-with this option.
-
-
-
-
matteFloodfill
-
-
const Color
-&target_, const unsigned int opacity_, const ssize_t x_, const
-ssize_t
-y_, PaintMethod method_
-
Floodfill designated area with a replacement
-opacity value.
-
-
-
medianFilter
-
const double radius_ = 0.0
-
Filter image by replacing each pixel
-component with the median color in a circular neighborhood
handle multiple images forming a set of image layers or animation frames.
-
-
-
-
minify
-
-
void
-
Reduce image by integral size
-
-
-
modifyImage
-
void
-
Prepare to update image. Ensures that there
-is only one reference to the underlying image so that the underlying
-image may be safely modified without effecting previous generations of
-the image. Copies the underlying image to a new image if necessary.
Modulate percent hue, saturation, and
-brightness of an image. Modulation of saturation and brightness is as a
-ratio of the current value (100.0 for no change). Modulation of hue is an
-absolute rotation of -180 degrees to +180 degrees from the current
-position corresponding to an argument range of 0 to 200.0 (100.0 for no
-change).
Motion blur image with
-specified blur factor. The radius_ parameter specifies the radius of
-the Gaussian, in pixels, not counting the center pixel. The
-sigma_ parameter specifies the standard deviation of the Laplacian, in
-pixels. The angle_ parameter specifies the angle the object appears to
-be comming from (zero degrees is from the right).
-
-
-
-
-
negate
-
-
bool grayscale_ = false
-
Negate colors in image. Replace every
-pixel with its complementary color (white becomes black, yellow becomes
-blue, etc.). Set grayscale to only negate grayscale values in
-image.
-
-
-
-
normalize
-
-
void
-
Normalize image (increase contrast by
-normalizing the pixel values to span the full range of color values).
-
-
-
-
oilPaint
-
-
size_t radius_ = 3
-
Oilpaint image (image looks like oil painting)
-
-
-
-
opacity
-
-
unsigned int opacity_
-
Set or attenuate the opacity channel in the
-image. If the image pixels are opaque then they are set to the
-specified
-opacity value, otherwise they are blended with the supplied opacity
-value. The value of opacity_ ranges from 0 (completely opaque) to
- MaxRGB
-. The defines OpaqueOpacity and TransparentOpacity are
-available to specify completely opaque or completely transparent,
-respectively.
-
-
-
-
opaque
-
-
const Color
-&opaqueColor_, const Color &penColor_
-
Change color of pixels matching opaqueColor_
-to specified penColor_.
-
-
-
-
ping
-
-
const std::string &imageSpec_
-
Ping is similar to read
-except only enough of the image is read to determine the image columns,
-rows, and filesize. The columns ,
- rows , and fileSize
-attributes are valid after invoking ping. The image data is not
-valid after calling ping.
Execute the named
-process module, passing any arguments via an argument vector, with
-argc_
-specifying the number of arguments in the vector, and argv_ passing the
-address of an array of null-terminated C strings which constitute the
-argument vector. An exception is thrown if the requested process module
-does not exist, fails to load, or fails during execution.
-
-
-
-
-
quantize
-
-
bool measureError_ = false
-
Quantize image (reduce number of colors). Set
-measureError_ to true in order to calculate error attributes.
Read image of specified size into current
-object. This form is useful for images that do not specifiy their size
-or to specify a size hint for decoding an image. For example, when
-reading a Photo CD, JBIG, or JPEG image, a size request causes the
-library to return an image which is the next resolution greater or
-equal to the specified size. This may result in memory and time savings.
Read encoded image of specified
-size from an in-memory BLOB into current
-object. Depending on the method arguments, the Blob size, depth, and
-format may also be specified. Some image formats require that size be
-specified. The default ImageMagick uses for depth depends on its
-Quantum size (8 or 16). If ImageMagick's Quantum size does not
-match that of the image, the depth may need to be specified.
-ImageMagick can usually automagically detect the image's format.
-When
-a format can't be automagically detected, the format must be specified.
Read image based on an array of image pixels.
-The pixel data must be in scanline order top-to-bottom. The data can be
-character, short int, integer, float, or double. Float and double
-require the pixels to be normalized [0..1]. The other types are
-[0..MaxRGB]. For example, to create a 640x480 image from
-unsigned red-green-blue character data, use
-
This character string can be any
-combination or order of R = red, G = green, B = blue, A = alpha, C =
-cyan, Y = yellow M = magenta, and K = black. The ordering reflects the
-order of the pixels in the supplied pixel array.
-
-
-
type_
-
Pixel storage type (CharPixel,
-ShortPixel, IntegerPixel, FloatPixel, or DoublePixel)
-
-
-
pixels_
-
This array of values contain the pixel
-components as defined by the map_ and type_ parameters. The length of
-the arrays must equal the area specified by the width_ and height_
-values and type_ parameters.
-
-
-
-
-
-
-
-
reduceNoise
-
-
const double order_
-
reduce noise in image using a noise peak elimination filter.
-
-
-
randomThreshold
-
-
const Geometry
-&thresholds_
-
-
Random threshold the
-image. Changes the value of individual pixels based on the intensity of
-each pixel compared to a random threshold. The result is a
-low-contrast, two color image. The thresholds_ argument is a
-geometry containing LOWxHIGH thresholds. If the string contains
-2x2, 3x3, or 4x4, then an ordered dither of order 2, 3, or 4 will be
-performed instead. This is a very fast alternative to 'quantize' based
-dithering.
-
Segment (coalesce similar image components)
-by analyzing the histograms of the color components and identifying
-units that are homogeneous with the fuzzy c-means technique. Also uses quantizeColorSpace
-and verbose image attributes. Specify clusterThreshold_
-,
-as the number of pixels each cluster must
-exceed
-the cluster threshold to be considered valid. SmoothingThreshold_
-eliminates noise in the second derivative of the histogram. As
-the
-value is increased, you can expect a smoother
-second derivative. The default is 1.5.
Shade image using distant light source.
-Specify azimuth_ and elevation_ as the
-position of the light source. By default, the shading
-results as a grayscale image.. Set colorShading_ to true
-to
-shade the red, green, and blue components of the image.
Sharpen pixels in image. The radius_
-parameter specifies the radius of the Gaussian, in pixels, not counting
-the center pixel. The sigma_ parameter specifies the
-standard deviation of the Laplacian, in pixels.
Sharpen pixel
-quantums in an image channel The channel_ parameter specifies the
-channel to sharpen.. The radius_
-parameter specifies the radius of the Gaussian, in pixels, not counting
-the center pixel. The sigma_ parameter specifies the
-standard deviation of the Laplacian, in pixels.
-
-
-
-
shave
-
-
const Geometry &geometry_
-
Shave pixels from image edges.
-
-
-
-
shear
-
-
double xShearAngle_, double yShearAngle_
-
Shear image (create parallelogram by sliding
-image by X or Y axis). Shearing slides one edge of an image along
-the X or Y axis, creating a
-parallelogram. An X direction shear slides an edge along the X
-axis, while a Y direction shear slides
-an edge along the Y axis. The amount of the shear is controlled
-by a shear angle. For X direction shears, x
-degrees is measured relative to the Y axis, and similarly, for Y
-direction shears y degrees is measured relative to the X
-axis. Empty triangles left over from shearing the image are
-filled with the color defined as borderColor.
-
-
-
-
solarize
-
-
double factor_ = 50.0
-
Solarize image (similar to effect seen when
-exposing a photographic film to light during the development process)
Sparse color image, given a set of coordinates, interpolates the colors found at those coordinates, across the whole image, using various methods.
-
-
-
-
statistics
-
-
ImageStatistics *statistics
-
Obtain image statistics. Statistics are normalized to the range of 0.0 to 1.0 and are output to the specified ImageStatistics structure. The structure includes members maximum, minimum, mean, standard_deviation, and variance for each of these channels: red, green, blue, and opacity (e.g. statistics->red.maximum).
-
-
-
-
stereo
-
-
const Image &rightImage_
-
Create an image which appears in stereo when
-viewed with red-blue glasses (Red image on left, blue on right)
-
-
-
-
swirl
-
-
double degrees_
-
Swirl image (image pixels are rotated by
-degrees)
-
-
-
-
texture
-
-
const Image &texture_
-
Layer a texture on pixels matching image
-background color.
Sharpen the image using the unsharp mask
-algorithm. The radius_
-parameter specifies the radius of the Gaussian, in pixels, not
-counting the center pixel. The sigma_ parameter specifies the
-standard deviation of the Gaussian, in pixels. The amount_
-parameter specifies the percentage of the difference between the
-original and the blur image that is added back into the original. The threshold_
-parameter specifies the threshold in pixels needed to apply the
-diffence amount.
Sharpen an image
-channel using the unsharp mask algorithm. The channel_ parameter specifies the
-channel to sharpen. The radius_
-parameter specifies the radius of the Gaussian, in pixels, not
-counting the center pixel. The sigma_ parameter specifies the
-standard deviation of the Gaussian, in pixels. The amount_
-parameter specifies the percentage of the difference between the
-original and the blur image that is added back into the original. The threshold_
-parameter specifies the threshold in pixels needed to apply the
-diffence amount.
Write image to a file using filename imageSpec_
-.
- Caution: if
-an image format is selected which is capable of supporting fewer
-colors than the original image or quantization has been requested, the
-original image will be quantized to fewer colors. Use a copy of the
-original if this is a problem.
Write image to a in-memory BLOB stored in blob_. The magick_
-parameter specifies the image format to write (defaults to magick ). The depth_ parameter species the image
-depth (defaults to depth ).
- Caution: if
-an image format is selected which is capable of supporting fewer
-colors than the original image or quantization has been requested, the
-original image will be quantized to fewer colors. Use a copy of the
-original if this is a problem.
Write pixel data into a buffer you supply.
-The data is saved either as char, short int, integer, float or double
-format in the order specified by the type_ parameter. For example, we
-want to extract scanline 1 of a 640x480 image as character data in
-red-green-blue order:
-
image.write(0,0,640,1,"RGB",0,pixels);
-
-
The parameters are as follows:
-
-
-
-
-
x_
-
Horizontal ordinate of left-most
-coordinate of region to extract.
-
-
-
y_
-
Vertical ordinate of top-most
-coordinate of region to extract.
-
-
-
columns_
-
Width in pixels of the region to
-extract.
-
-
-
rows_
-
Height in pixels of the region to
-extract.
-
-
-
map_
-
This character string can be any
-combination or order of R = red, G = green, B = blue, A = alpha, C =
-cyan, Y = yellow, M = magenta, and K = black. The ordering reflects
-the order of the pixels in the supplied pixel array.
-
-
-
type_
-
Pixel storage type (CharPixel,
-ShortPixel, IntegerPixel, FloatPixel, or DoublePixel)
-
-
-
pixels_
-
This array of values contain the pixel
-components as defined by the map_ and type_ parameters. The length of
-the arrays must equal the area specified by the width_ and height_
-values and type_ parameters.
-Image attributes are set and obtained via methods in Image. Except for
-methods which accept pointer arguments (e.g. chromaBluePrimary)
-all methods return attributes by value.
-
Image attributes are easily used. For example, to set the resolution
-of the TIFF file "file.tiff" to 150 dots-per-inch (DPI) in both the
-horizontal and vertical directions, you can use the following example
-code:
-
-string filename("file.tiff");
-Image image;
-image.read(filename);
-image.resolutionUnits(PixelsPerInchResolution);
-image.density(Geometry(150,150)); // could also use image.density("150x150")
-image.write(filename)
-
-The supported image attributes and the method arguments required to
-obtain them are shown in the following table:
-
-
-
Image Attributes
-
-
-
Function
-
-
-
Type
-
-
-
Get Signature
-
-
-
Set Signature
-
-
-
Description
-
-
-
-
-
adjoin
-
-
bool
-
void
-
bool flag_
-
Join images into a single multi-image file.
-
-
-
-
antiAlias
-
-
bool
-
void
-
bool flag_
-
Control antialiasing of rendered Postscript
-and Postscript or TrueType fonts. Enabled by default.
-
-
-
-
animation-
-
- Delay
-
-
size_t (0 to 65535)
-
void
-
size_t delay_
-
Time in 1/100ths of a second (0 to 65535)
-which must expire before displaying the next image in an animated
-sequence. This option is useful for regulating the animation of a
-sequence of GIF images within Netscape.
-
-
-
-
animation-
-
- Iterations
-
-
size_t
-
void
-
size_t iterations_
-
Number of iterations to loop an animation
-(e.g. Netscape loop extension) for.
An arbitrary named
-image attribute. Any number of named attributes may be attached to the
-image. For example, the image comment is a named image attribute with
-the name "comment". EXIF tags are attached to the image as named
-attributes. Use the syntax "EXIF:<tag>" to request an EXIF tag
-similar to "EXIF:DateTime".
-
Return smallest bounding box enclosing
-non-border pixels. The current fuzz value is used when discriminating
-between pixels. This is the crop bounding box used by
-crop(Geometry(0,0)).
Pixel cache threshold in bytes. Once this
-threshold is exceeded, all subsequent pixels cache operations are
-to/from disk. This is a static method and the attribute it sets is
-shared by all Image objects.
Channel modulus depth.
-The channel modulus depth represents the minimum number of bits
-required
-to support the channel without loss. Setting the channel's modulus
-depth
-modifies the channel (i.e. discards resolution) if the requested
-modulus
-depth is less than the current modulus depth, otherwise the channel is
-not altered. There is no attribute associated with the modulus depth so
-the current modulus depth is obtained by inspecting the pixels. As a
-result, the depth returned may be less than the most recently set
-channel depth. Subsequent image processing may result in increasing the
-channel depth.
-
-
-
-
-
chroma-
-
- BluePrimary
-
-
double x & y
-
double *x_, double *y_
-
double x_, double y_
-
Chromaticity blue primary point (e.g. x=0.15,
-y=0.06)
-
-
-
-
chroma-
-
- GreenPrimary
-
-
double x & y
-
double *x_, double *y_
-
double x_, double y_
-
Chromaticity green primary point (e.g. x=0.3,
-y=0.6)
-
-
-
-
chroma-
-
- RedPrimary
-
-
double x & y
-
double *x_, double *y_
-
double x_, double y_
-
Chromaticity red primary point (e.g. x=0.64,
-y=0.33)
-
-
-
-
chroma-
-
- WhitePoint
-
-
double x & y
-
double*x_, double *y_
-
double x_, double y_
-
Chromaticity white point (e.g. x=0.3127,
-y=0.329)
Image storage class. Note that
-conversion from a DirectClass image to a PseudoClass image may result
-in a loss of color due to the limited size of the palette (256 or
-65535 colors).
-
-
-
-
clipMask
-
-
Image
-
void
-
const Image &clipMask_
-
Associate a clip mask image with the current
-image. The clip mask image must have the same dimensions as the current
-image or an exception is thrown. Clipping occurs wherever pixels are
-transparent in the clip mask image. Clipping Pass an invalid image to
-unset an existing clip mask.
-
-
-
-
colorFuzz
-
-
double
-
void
-
double fuzz_
-
Colors within this distance are considered
-equal. A number of algorithms search for a target color. By
-default the color must be exact. Use this option to match colors that
-are close to the target color in RGB space.
Number of entries in the
-colormap. Setting the colormap size may extend or truncate the
-colormap.
-The maximum number of supported entries is specified by the MaxColormapSizeconstant,
-and is dependent on the value of QuantumDepth when ImageMagick is
-compiled. An exception is thrown if more entries are requested than may
-be supported. Care should be taken when truncating the colormap to
-ensure that the image colormap indexes reference valid colormap entries.
-
Set or obtain a
-definition string to applied when encoding or decoding the specified
-format. The meanings of the definitions are format specific. The format
-is designated by the magick_
-argument, the format-specific key is designated by key_, and the associated value is
-specified by value_. See the
-defineSet() method if the key must be removed entirely.
-
Set or obtain a
-definition flag to applied when encoding or decoding the specified
-format.. Similar to the defineValue() method except that
-passing the flag_ value
-'true'
-creates a value-less define with that format and key. Passing the flag_
-value 'false' removes any existing matching definition. The method
-returns 'true' if a matching key exists, and 'false' if no matching key
-exists.
-
Vertical and horizontal resolution in pixels
-of the image. This option specifies an image density when decoding a
-Postscript or Portable Document page. Often used with psPageSize.
-
-
-
-
depth
-
-
size_t (8-32)
-
void
-
size_t depth_
-
Image depth. Used to specify the bit depth
-when reading or writing raw images or when the output format
-supports multiple depths. Defaults to the quantum depth that
-ImageMagick is compiled with.
Filter to use when resizing image. The
-reduction filter employed has a sigificant effect on the time required
-to resize an image and the resulting quality. The default filter is Lanczos
-which has been shown to produce high quality results when reducing most
-images.
-
-
-
-
font
-
-
string
-
void
-
const string &font_
-
Text rendering font. If the font is a fully
-qualified X server font name, the font is obtained from an X
-server. To use a TrueType font, precede the TrueType filename with an
-@. Otherwise, specify a Postscript font name (e.g.
-"helvetica").
Update metrics with font type metrics using
-specified text, and current font and fontPointSize settings.
-
-
-
-
format
-
-
string
-
void
-
-
Long form image format description.
-
-
-
-
gamma
-
-
double (typical range 0.8 to 2.3)
-
void
-
-
Gamma level of the image. The same color
-image displayed on two different workstations may
-look different due to differences in the display monitor.
-Use gamma correction to adjust for this
-color difference.
size_t
- { 0 = Disposal not specified,
- 1 = Do not dispose of graphic,
- 3 = Overwrite graphic with background color,
-
- 4 = Overwrite graphic with previous graphic. }
-
void
-
size_t disposeMethod_
-
GIF disposal method. This option is used to
-control how successive frames are rendered (how the preceding frame is
-disposed of) when creating a GIF animation.
ICC color profile. Supplied via a Blob since Magick++/ and ImageMagick do not
-currently support formating this data structure directly.
-Specifications are available from the
-International Color Consortium for the format of ICC color profiles.
The type of interlacing scheme (default NoInterlace
-). This option is used to specify the type of interlacing
-scheme for raw image formats such as RGB or YUV. NoInterlace
-means do not interlace, LineInterlace uses scanline
-interlacing, and PlaneInterlace uses plane interlacing.
-PartitionInterlace is like PlaneInterlace except the
-different planes are saved to individual files (e.g.
-image.R, image.G, and image.B). Use LineInterlace or
-PlaneInterlace to create an interlaced GIF or progressive JPEG
-image.
IPTC profile. Supplied via a Blob since Magick++ and ImageMagick do not
-currently support formating this data structure directly.
-Specifications are available from the
-International Press Telecommunications Council for IPTC profiles.
-
-
-
-
label
-
-
string
-
void
-
const string &label_
-
Image label
-
-
-
-
magick
-
-
string
-
void
-
const string &magick_
-
Get image format (e.g. "GIF")
-
-
-
-
matte
-
-
bool
-
void
-
bool matteFlag_
-
True if the image has transparency. If set
-True, store matte channel if the image has one otherwise create
-an opaque one.
The mean error per pixel computed when an
-image is color reduced. This parameter is only valid if verbose is set
-to true and the image has just been quantized.
-
-
-
modulusDepth
-
-
size_t
-
-
-
void
-
-
size_t
-depth_
-
-
Image
-modulus depth (minimum number of bits required to support
-red/green/blue components without loss of accuracy). The pixel modulus
-depth may be decreased by supplying a value which is less than the
-current value, updating the pixels (reducing accuracy) to the new
-depth.
-The pixel modulus depth can not be increased over the current value
-using this method.
-
Tile size and offset within an image montage.
-Only valid for montage images.
-
-
-
-
normalized-
-
- MaxError
-
-
double
-
void
-
-
The normalized max error per pixel computed
-when an image is color reduced. This parameter is only valid if verbose
-is set to true and the image has just been quantized.
-
-
-
-
normalized-
-
- MeanError
-
-
double
-
void
-
-
The normalized mean error per pixel computed
-when an image is color reduced. This parameter is only valid if verbose
-is set to true and the image has just been quantized.
Preferred size and location of an image
-canvas.
-
Use this option to specify the dimensions
-and position of the Postscript page in dots per inch or a TEXT page in
-pixels. This option is typically used in concert with density.
-
Page may also be used to position a GIF
-image (such as for a scene in an animation)
Get/set/remove a named
-profile. Valid names include "*",
-"8BIM", "ICM", "IPTC", or a user/format-defined profile name.
-
-
-
-
-
quality
-
-
size_t (0 to 100)
-
void
-
size_t quality_
-
JPEG/MIFF/PNG compression level (default 75).
-
-
-
-
quantize-
-
- Colors
-
-
size_t
-
void
-
size_t colors_
-
Preferred number of colors in the image. The
-actual number of colors in the image may be less than your request, but
-never more. Images with less unique colors than specified with this
-option will have any duplicate or unused colors removed.
Colorspace to quantize colors in (default
-RGB). Empirical evidence suggests that distances in color spaces such
-as YUV or YIQ correspond to perceptual color differences more closely
-than do distances in RGB space. These color spaces may give better
-results when color reducing an image.
-
-
-
-
quantize-
-
- Dither
-
-
bool
-
void
-
bool flag_
-
Apply Floyd/Steinberg error diffusion to the
-image. The basic strategy of dithering is to trade
-intensity
-resolution for spatial resolution by
-averaging the intensities of several
-neighboring pixels. Images which suffer from
-severe contouring when reducing colors can be
-improved with this option. The quantizeColors or monochrome option must
-be set for this option to take effect.
-
-
-
-
quantize-
-
- TreeDepth
-
-
size_t
-
void
-
size_t treeDepth_
-
Depth of the quantization color
-classification tree. Values of 0 or 1 allow selection of the optimal
-tree depth for the color reduction algorithm. Values between 2 and 8
-may be used to manually adjust the tree depth.
Width and height of a raw image (an image
-which does not support width and height information). Size may
-also be used to affect the image size read from a multi-resolution
-format (e.g. Photo CD, JBIG, or JPEG.
-
-
-
-
strip
-
-
void
-
strips an image of all profiles and comments.
-
-
-
-
strokeAntiAlias
-
-
bool
-
void
-
bool flag_
-
Enable or disable anti-aliasing when drawing
-object outlines.
-
-
-
-
strokeColor
-
-
Color
-
void
-
const Color &strokeColor_
-
Color to use when drawing object outlines
-
-
-
-
strokeDashOffset
-
-
size_t
-
void
-
double strokeDashOffset_
-
While drawing using a dash pattern, specify
-distance into the dash pattern to start the dash (default 0).
-
-
-
-
strokeDashArray
-
-
const double*
-
void
-
const double* strokeDashArray_
-
Specify the pattern of dashes and gaps used
-to stroke paths. The strokeDashArray represents a zero-terminated
-array of numbers that specify the lengths (in pixels) of alternating
-dashes and gaps in user units. If an odd number of values is provided,
-then the list of values is repeated to yield an even number of
-values. A typical strokeDashArray_ array might contain the
-members 5 3 2 0, where the zero value indicates the end of the pattern
-array.
-
-
-
-
strokeLineCap
-
-
LineCap
-
void
-
LineCap lineCap_
-
Specify the shape to be used at the corners
-of paths (or other vector shapes) when they are stroked. Values of
-LineJoin are UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
-
-
-
-
strokeLineJoin
-
-
LineJoin
-
void
-
LineJoin lineJoin_
-
Specify the shape to be used at the corners
-of paths (or other vector shapes) when they are stroked. Values of
-LineJoin are UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
-
-
-
-
strokeMiterLimit
-
-
size_t
-
void
-
size_t miterLimit_
-
Specify miter limit. When two line segments
-meet at a sharp angle and miter joins have been specified for
-'lineJoin', it is possible for the miter to extend far beyond the
-thickness of the line stroking the path. The miterLimit' imposes a
-limit on the ratio of the miter length to the 'lineWidth'. The default
-value of this parameter is 4.
-
-
-
-
strokeWidth
-
-
double
-
void
-
double strokeWidth_
-
Stroke width for use when drawing vector
-objects (default one)
-
-
-
-
strokePattern
-
-
Image
-
void
-
const Image &strokePattern_
-
Pattern image to use while drawing object
-stroke (outlines).
-
-
-
-
subImage
-
-
size_t
-
void
-
size_t subImage_
-
Subimage of an image sequence
-
-
-
-
subRange
-
-
size_t
-
void
-
size_t subRange_
-
Number of images relative to the base image
-
-
-
-
textEncoding
-
-
-
string
-
-
void
-
-
const std::string &encoding_
-
-
Specify the code set to use for text
-annotations. The only character encoding which may be specified at
-this time is "UTF-8" for representing Unicode as a
-sequence of bytes. Specify an empty string to use the default ASCII
-encoding. Successful text annotation using Unicode may require fonts
-designed to support Unicode.
-
X11 display to display to, obtain fonts from,
-or to capture image from
-
-
-
-
xResolution
-
-
double
-
void
-
-
x resolution of the image
-
-
-
-
yResolution
-
-
double
-
void
-
-
y resolution of the image
-
-
-
-
-
Low-Level Image Pixel Access
-
-Image pixels (of type Quantum)
-may be accessed directly via the Image Pixel Cache . The
-image pixel cache is a rectangular window into the actual image pixels
-(which may be in memory, memory-mapped from a disk file, or entirely on
-disk). Two interfaces exist to access the Image Pixel Cache.
-The
-interface described here (part of the Image class) supports
-only
-one view at a time. See the Pixels
-class for a more abstract interface which supports simultaneous pixel
-views (up to the number of rows). As an analogy, the interface
-described
-here relates to the Pixels class as
-stdio's gets() relates to fgets(). The Pixels
-class provides the more general form of the interface.
-
Obtain existing image pixels via getPixels(). Create a new
-pixel region using setPixels().
-
In order to ensure that only the current generation of the image is
-modified, the Image's modifyImage() method
-should be invoked to reduce the reference count on the underlying image
-to one. If this is not done, then it is possible for a previous
-generation of the image to be modified due to the use of reference
-counting when copying or constructing an Image.
-
-
Depending on the capabilities of the operating system, and the
-relationship of the window to the image, the pixel cache may be a copy
-of the pixels in the selected window, or it may be the actual image
-pixels. In any case calling syncPixels() insures that the base
-image is updated with the contents of the modified pixel cache. The
-method readPixels() supports copying foreign pixel data
-formats
-into the pixel cache according to the QuantumTypes. The method writePixels()
-supports copying the pixels in the cache to a foreign pixel
-representation according to the format specified by QuantumTypes.
-
The pixel region is effectively a small image in which the pixels
-may be accessed, addressed, and updated, as shown in the following
-example:
-
-
-Image image("cow.png");
-// Ensure that there are no other references to this image.
-image.modifyImage();
-// Set the image type to TrueColor DirectClass representation.
-image.type(TrueColorType);
-// Request pixel region with size 60x40, and top origin at 20x30
-ssize_t columns = 60;
-Quantum *pixel_cache = image.getPixels(20,30,columns,40);
-// Set pixel at column 5, and row 10 in the pixel cache to red.
-ssize_t column = 5;
-ssize_t row = 10;
-Quantum *pixel = pixel_cache+row*columns+column;
-*pixel = Color("red");
-// Save changes to underlying image .
-image.syncPixels();
- // Save updated image to file.
-image.write("horse.png");
-
Transfers pixels from the image to the pixel
-cache as defined by the specified rectangular region. The returned pointer remains valid until the next getPixel,
-getConstPixels, or setPixels call and should never be deallocated by
-the
-user.
-
-
-
-
getConstIndexes
-
-
const IndexPacket*
-
void
-
Returns a pointer to the Image pixel indexes
-corresponding to a previous getPixel,
-getConstPixels, or setPixels call. The
-returned pointer remains valid until the next getPixel, getConstPixels,
-or setPixels call and should never be deallocated by the user. Only valid for PseudoClass images or CMYKA images. The
-pixel indexes represent an array of type IndexPacket, with each entry
-corresponding to an x,y pixel position. For PseudoClass images, the
-entry's value is the offset into the colormap (see colorMap
-) for that pixel. For CMYKA images, the indexes are used to contain the
-alpha channel.
-
-
-
-
getIndexes
-
-
IndexPacket*
-
void
-
Returns a pointer to the Image pixel indexes
-corresponding to the pixel region requested by the last getConstPixels , getPixels
-, or setPixels call. The
-returned pointer remains valid until the next getPixel, getConstPixels,
-or setPixels call and should never be deallocated by the user. Only valid for PseudoClass images
-or
-CMYKA images. The pixel indexes represent an array of type
-IndexPacket, with each entry corresponding to a pixel x,y position. For
-PseudoClass images, the entry's value is the offset into the colormap
-(see colorMap ) for that pixel. For
-CMYKA
-images, the indexes are used to contain the alpha channel.
Transfers pixels from the image to the pixel
-cache as defined by the specified rectangular region. Modified pixels
-may be subsequently transferred back to the image via syncPixels. The returned pointer remains valid until the next getPixel,
-getConstPixels, or setPixels call and should never be deallocated by
-the
-user.
Allocates a pixel cache region to store image
-pixels as defined by the region rectangle. This area is
-subsequently transferred from the pixel cache to the image via
-syncPixels. The returned pointer remains
-valid until the next getPixel, getConstPixels, or setPixels call and
-should never be deallocated by the user.
Transfers one or more pixel components from a
-buffer or file into the image pixel cache of an image. ReadPixels is
-typically used to support image decoders. The region transferred
-corresponds to the region set by a preceding setPixels call.
Transfers one or more pixel components from
-the image pixel cache to a buffer or file. WritePixels is typically
-used to support image encoders. The region transferred corresponds to
-the region set by a preceding getPixels or getConstPixels call.
-The class Magick::Image is a simple handle which points to a reference-counted image representation. This allows multiple Magick::Image instances to share the same image and attributes. At the point in time that the image data, or image attributes are modified and the current reference count is greater than one, the image data and attributes are copied to create a new image with a reference count of one and the reference count on the old image is decremented. If the reference count on the old image becomes zero, then the associated reference and data are deleted. This strategy represents a simple (but effective) form of garbage collection
-
-
In order to compile Magick++ you must have access to a standard C++ implementation. The author uses gcc 3.4 (GNU C++) which is available under UNIX and under the Cygwin UNIX-emulation environment for Windows. Standards compliant commercial C++ compilers should also work fine. Most modern C++ compilers for Microsoft Windows or the Mac should work (project files are provided for Microsoft Visual C++ 8.0).
-
It was decided that Magick++ will be around for the long-haul, so its API definition depends on valuable C++ features which should be common in all current and future C++ compilers. The compiler must support the following C++ standard features:
-
-
-
templates
-
-
static constructors
-
-
C++-style casts (e.g. static_cast)
-
-
bool type
-
-
string class (<string>)
-
-
exceptions (<exception>)
-
-
namespaces
-
-
Standard Template Library (STL) (e.g. <list>, <vector>)
-
The author has personally verified that Magick++ compiles and runs using the following compiler/platform combinations:
Users of Magick++ have reported that the following configurations work with Magick++:
-
-
Other Known Working Configurations
-
-
-
-
Operating System
-
-
Architecture
-
-
Compiler
-
-
Reported By
-
-
-
Red Hat Linux 8.0
-
-
i386 & alpha
-
-
EGCS 1.1.2
-
-
Dr. Alexander Zimmermann <Alexander.Zimmermann@fmi.uni-passau.de>
-
-
-
Red Hat Linux 7.0
-
-
i386
-
-
GCC 2.95.2
-
-
Dr. Alexander Zimmermann <Alexander.Zimmermann@fmi.uni-passau.de>
-
-
-
Red Hat Linux 7.0
-
-
i386
-
-
GCC "2.96" snapshot
-
-
???
-
-
-
Red Hat Linux 7.X
-
-
i386 & alpha
-
-
GCC 3.0
-
-
Dr. Alexander Zimmermann <Alexander.Zimmermann@fmi.uni-passau.de>
-
-
-
SGI IRIX 6.2, 6.5
-
-
MIPS
-
-
IRIX C++ 7.3.1.2m
-
-
Albert Chin-A-Young <china@thewrittenword.com>
-
-
-
SunOS 5.5.1
-
-
SPARC
-
-
Sun WorkShop CC 5.0
-
-
Albert Chin-A-Young <china@thewrittenword.com>
-
-
-
SunOS 5.6, 5.7, 5.8
-
-
SPARC
-
-
Sun Forte CC 5.3
-
-
Albert Chin-A-Young <china@thewrittenword.com>
-
-
-
HP-UX 11.00
-
-
PA-RISC
-
-
HP-UX aCC A.03.30
-
-
Albert Chin-A-Young <china@thewrittenword.com>
-
-
-
Mac OS 9
-
-
PowerPC
-
-
CodeWarrior Professional Release 6
-
-
Leonard Rosenthol <leonardr@digapp.com>
-
-
-
Mac OS X 10.1 "Darwin"
-
-
PowerPC
-
-
GCC 2.95.2 (apple gcc -926)
-
-
Cristy
-
Please let me know if you have successfully built and executed Magick++ using a different configuration so that I can add to the table of verified configurations.
-
-
Unix/Linux
-
Building From Source
-
Magick++ is now built using the ImageMagick configure script and Makefiles. Please follow the installation instructions provided by its README.txt file. The following instructions pertain to the Magick++ specific configuration and build options.
-
To install ImageMagick plus Magick++ under Unix, installation should be similar to
The library is currently named similar to 'libMagick++.a' (and/or libMagick++.so.5.0.39) and is installed under prefix/lib while the headers are installed with Magick++.h being installed in prefix/include and the remaining headers in prefix/include/Magick++.
-
To influence the options the configure script chooses, you may specify 'make' option variables when running the configure script. For example, the command
-
./configure CXX=CC CXXFLAGS=-O2 LIBS=-lposix
-
-specifies additional options to the configure script. The following table shows the available options.
-
-
Environment Variables That Effect Configure
-
-
-
-
-
-
Make Option Variable
-
-
Description
-
-
-
CXX
-
-
Name of C++ compiler (e.g. 'CC -Xa') to use compiler 'CC -Xa'
-
-
-
CXXFLAGS
-
-
Compiler flags (e.g. '-g -O2') to compile with
-
-
-
CPPFLAGS
-
-
Include paths (-I/somedir) to look for header files
-
-
-
LDFLAGS
-
-
Library paths (-L/somedir) to look for libraries. Systems that support the notion of a library run-path may additionally require -R/somedir or '-rpath /somedir' in order to find shared libraries at run time.
Windows NT through Windows Vista are supported by the ImageMagick source package for NT available in the 'win2k' subdirectory of the ImageMagick ftp site (and mirrors). The ImageMagick source package for NT provides sources to ImageMagick, Magick++, add-on libraries (e.g. JPEG), and a ready-made Visual C++ 8.0 build environment. Please read the configuration and build instructions in README.txt (under the heading "Windows Win2K/XP VISUAL C++ 8.0 COMPILATION") in order to build Magick++.
-
Cygwin & GCC
-
It is possible to build both ImageMagick and Magick++ under the Cygwin Unix-emulation environment for Windows NT. Obtain and install Cgywin from http://www.cygwin.com/ . An X11R6 environment for Cygwin is available from http://www.cygwin.com/xfree/ .To build using Cygwin and GCC, follow the instructions for building under Unix.
A montage is a single image which is composed of thumbnail images composed in a uniform grid. The size of the montage image is determined by the size of the individual thumbnails and the number of rows and columns in the grid.
-
The following illustration shows a montage consisting of three columns and two rows of thumbnails rendered on a gray background:
-
-
Montages may be either "plain" (undecorated thumbnails) or "framed" (decorated thumbnails). In order to more easily understand the options supplied to MontageImages(), montage options are supplied by two different classes: Magick::Montage and Magick::MontageFramed.
-
Plain Montages
-
Magick::Montage is the base class to provide montage options and provides methods to set all options required to render simple (unframed) montages. See Magick::MontageFramedif you would like to create a framed montage.
-
Unframed thumbnails consist of four components: the thumbnail image, the thumbnail border, an optional thumbnail shadow, and an optional thumbnail label area.
Specifies the image composition algorithm for thumbnails. This controls the algorithm by which the thumbnail image is placed on the background. Use of OverCompositeOp is recommended for use with images that have transparency. This option may have negative side-effects for images without transparency.
Specifies the image filename to be used for the generated montage images. To handle the case were multiple montage images are generated, a printf-style format may be embedded within the filename. For example, a filename specification of image%02d.miff names the montage images as image00.miff, image01.miff, etc.
Specifies the thumbnail positioning within the specified geometry area. If the thumbnail is smaller in any dimension than the geometry, then it is placed according to this specification.
Specifies a texture image to use as montage background. The built-in textures "granite:" and "plasma:" are available. A texture is the same as a background image.
Specifies the maximum number of montage columns and rows in the montage. The montage is built by filling out all cells in a row before advancing to the next row. Once the montage has reached the maximum number of columns and rows, a new montage image is started.
Specifies a montage color to set transparent. This option can be set the same as the background color in order for the thumbnails to appear without a background when rendered on an HTML page. For best effect, ensure that the transparent color selected does not occur in the rendered thumbnail colors.
Magick::MontageFramed provides the means to specify montage options when it is desired to have decorative frames around the image thumbnails. MontageFramed inherits from Montage and therefore provides all the methods of Montage as well as those shown in the table "MontageFramed Methods".
-
Framed thumbnails consist of four components: the thumbnail image, the thumbnail frame, the thumbnail border, an optional thumbnail shadow, and an optional thumbnail label area.
-
-
-
MontageFramed Methods
-
-
-
-
Method
-
-
Return Type
-
-
Signature(s)
-
-
Description
-
-
-
MontageFramed
-
-
-
void
-
-
Default constructor (enable frame via frameGeometry).
Specifies the border (in pixels) to place between a thumbnail and its surrounding frame. This option only takes effect if thumbnail frames are enabled (via frameGeometry) and the thumbnail geometry specification doesn't also specify the thumbnail border width.
The PixelPacket structure is used to represent pixels in ImageMagick. ImageMagick may be compiled to support 32 or 64 bit pixels. The size of PixelPacket is controlled by the value of the QuantumDepth define. The default is 64 bit pixels, which provide the best accuracy. If memory consumption must be minimized, or processing time must be minimized, then ImageMagick may be compiled with QuantumDepth=8. The following table shows the relationship between QuantumDepth, the type of Quantum, and the overall PixelPacket size.
-
-
Effect Of QuantumDepth Values
-
-
-
-
-
-
-
-
QuantumDepth
-
-
Quantum Type
-
-
PixelPacket Size
-
-
-
8
-
-
unsigned char
-
-
32 bits
-
-
-
16
-
-
unsigned short
-
-
64 bits
-
The members of the PixelPacket structure, and their interpretation, are shown in the following table:
The Pixels class provides efficient access to raw image
-pixels. Image pixels (of type Quantum)
-may be accessed directly via the Image Pixel Cache. The image
-pixel cache is a rectangular window (a view) into the actual image
-pixels (which may be in memory, memory-mapped from a disk file, or
-entirely on disk). Obtain existing image pixels via get().
-Create a new pixel region using set().
-
Depending on the capabilities of the operating system, and the
-relationship of the window to the image, the pixel cache may be a copy
-of the pixels in the selected window, or it may be the actual image
-pixels. In any case calling sync() insures that the base image
-is updated with the contents of the modified pixel cache. The method decode()supports
-copying foreign pixel data formats into the pixel cache according to
-the QuantumTypes. The method encode() supports copying
-the pixels in the cache to a foreign pixel representation according to
-the format specified by QuantumTypes.
-
Setting a view using the Pixels class does not cause the number of
-references to the underlying image to be reduced to one. Therefore, in
-order to ensure that only the current generation of the image is
-modified, the Image's modifyImage()
-method should be invoked to reduce the reference count on the underlying
-image to one. If this is not done, then it is possible for a previous
-generation of the image to be modified due to the use of reference
-counting when copying or constructing an Image.
-
The Quantum* returned by the set and get
-methods, and the void* returned by the indexes
-method point to pixel data managed by the Pixels class. The Pixels
-class is responsible for releasing resources associated with the pixel
-view. This means that the pointer should never be passed to delete() or
-free().
-
The pixel view is a small image in which
-the pixels may be accessed, addressed, and updated, as shown in the
-following example, which produces an image similar to the one on the
-right (minus lines and text):
-
-
-#include <Magick++.h>
-#include <iostream>
-
-using namespace std;
-using namespace Magick;
-int main(int argc,char **argv)
-{
- InitializeMagick(*argv);
-
- // Create base image
- Image image(Geometry(254,218), "white");
-
-
- // Set the image type to TrueColor DirectClass representation.
- image.type(TrueColorType);
- // Ensure that there is only one reference to underlying image
- // If this is not done, then image pixels will not be modified.
- image.modifyImage();
-
- // Allocate pixel view
- Pixels view(image);
-
- // Set all pixels in region anchored at 38x36, with size 160x230 to green.
- size_t columns = 196; size_t rows = 162;
- Color green("green");
- Quantum *pixels = view.get(38,36,columns,rows);
- for ( ssize_t row = 0; row < rows ; ++row )
- for ( ssize_t column = 0; column < columns ; ++column )
- {
- *pixels++=QuantumRange*green.quantumRed();
- *pixels++=QuantumRange*green.quantumGreen();
- *pixels++=QuantumRange*green.quantumBlue();
- }
-
- // Save changes to image.
- view.sync();
-
- // Set all pixels in region anchored at 86x72, with size 108x67 to yellow.
- columns = 108; rows = 67;
- Color yellow("yellow");
- pixels = view.get(86,72,columns,rows);
- for ( ssize_t row = 0; row < rows ; ++row )
- for ( ssize_t column = 0; column < columns ; ++column )
- {
- *pixels++=QuantumRange*yellow.quantumRed();
- *pixels++=QuantumRange*yellow.quantumGreen();
- *pixels++=QuantumRange*yellow.quantumBlue();
- }
- view.sync();
-
- // Set pixel at position 108,94 to red
- Color red("red");
- pixels = view.get(108,94,1,1);
- *pixels++=QuantumRange*red.quantumRed();
- *pixels++=QuantumRange*red.quantumGreen();
- *pixels++=QuantumRange*red.quantumBlue();
-
- // Save changes to image.
- view.sync();
- image.write( "logo.png" );
-}
-
Transfers read-write pixels from the image to
-the pixel cache as defined by the specified rectangular region.
- Modified pixels may be subsequently transferred back to the image
- via sync. The value returned is intended for pixel access
- only. It should never be deallocated.
Allocates a pixel cache region to store image
- pixels as defined by the region rectangle. This area is
- subsequently transferred from the pixel cache to the image via sync.
-The value returned is intended for pixel access only. It should
-never be deallocated.
-
-
-
-
-
sync
-
-
-
void
-
-
-
void
-
-
-
Transfers the image cache pixels to the image.
-
-
-
-
-
indexes
-
-
-
void*
-
-
-
void
-
-
-
Returns the PsuedoColor pixel indexes
- corresponding to the pixel region defined by the last get
- , getConst, or set
- call. Only valid for PseudoColor and CMYKA images. The pixel
- indexes (an array of type void, which is typedef Quantum,
-which is itself typedef unsigned char, or unsigned short,
-depending on the value of the QuantumDepth define) provide
-the colormap index (see colorMap) for each pixel in the
-image. For CMYKA images, the indexes represent the black
-channel. The value returned is intended for pixel access only. It
-should never be deallocated.
The Quantum structure is used to represent pixels in ImageMagick. ImageMagick may be compiled to support 32 or 64 bit pixels. The size of Quantum is controlled by the value of the QuantumDepth define. The default is 64 bit pixels, which provide the best accuracy. If memory consumption must be minimized, or processing time must be minimized, then ImageMagick may be compiled with QuantumDepth=8. The following table shows the relationship between QuantumDepth, the type of Quantum, and the overall Quantum size.
-
-
Effect Of QuantumDepth Values
-
-
-
-
-
-
-
-
QuantumDepth
-
-
Quantum Type
-
-
Quantum Size
-
-
-
8
-
-
unsigned char
-
-
32 bits
-
-
-
16
-
-
unsigned short
-
-
64 bits
-
The members of the Quantum structure, and their interpretation, are shown in the following table:
-Magick++ provides a set of Standard
-Template Libary (STL )
-algorithms for operating across ranges of image frames in a container.
-It also provides a set of STL unary function objects to apply an
-operation on image frames in a container via an algorithm which uses
-unary function objects. A good example of a standard algorithm which is
-useful for processing containers of image frames is the STL for_each
-algorithm which invokes a unary function object on a range of container
-elements.
-
Magick++ uses a limited set of template argument types. The current
-template argument types are:
A container having the properties of a Back
-Insertion Sequence . Sequences support forward iterators and Back
-Insertion Sequences support the additional abilty to append an element
-via push_back(). Common compatable container types are the STL < vector > and <list > template
-containers. This template argument is usually used to represent an
-output container in which one or more image frames may be appended.
-Containers like STL <vector
-> which have a given default capacity may need to have their
-capacity adjusted via reserve() to a larger capacity
-in order to support the expected final size . Since Magick++
-images are very small, it is likely that the default capacity of STL < vector > is
-sufficient for most situations.
An input iterator used to express a position in a
-container. These template arguments are typically used to represent a
-range of elements with first_ representing the first element to
-be processed and last_ representing the element to stop at. When
-processing the entire contents of a container, it is handy to know that
-STL containers usually provide the begin() and end() methods to return
-input interators which correspond with the first and last elements,
-respectively.
-
The following is an example of how frames from a GIF animation "test_image_anim.gif" may be appended horizontally
-with the resulting image written to the file appended_image.miff:
Animate a sequence of image frames. Image
-frames are displayed in succession, creating an animated effect. The
-animation options are taken from the first image frame. This feature is
-only supported under X11 at the moment.
Append a sequence of image frames, writing
-the result to appendedImage_. All the input image frames must
-have the same width or height. Image frames of the same width are
-stacked top-to-bottom. Image frames of the same height are stacked
-left-to-right. If the stack_ parameter is false, rectangular
-image frames are stacked left-to-right otherwise top-to-bottom.
Create a coalesced image sequence obtained by
-"playing" the image sequence (observing page offsets and disposal
-methods) to create a new image sequence in which all frames are full
-size and completely rendered. Note that if the original image sequence
-relied on page offsets and disposal methods that the resulting sequence
-will be larger (perhaps much larger) then the original. This is useful
-for GIF animation sequences that have page offsets and disposal methods.
-The resuting image sequence is returned via coalescedImages_.
Break down an image sequence into constituent
-parts. This is useful for creating GIF or MNG animation sequences.
-The input sequence is specified by first_ and last_, and
-the deconstructed images are returned via deconstructedImages_.
Display a sequence of image frames. Through
-use of a pop-up menu, image frames may be selected in succession. This
-feature is fully supported under X11 but may have only limited support
-in other environments.
- Caution: if
-an image format is is not compatable with the display visual (e.g. JPEG
-on a colormapped display) then the original image will be altered. Use a
-copy of the original if this is a problem.
Merge a sequence of image frames which
-represent image layers into a single composited representation. The flattendImage_
-parameter points to an existing Image to update with the flattened
-image. This function is useful for combining Photoshop layers into a
-single image.
Replace the colors of a sequence of images
-with the closest color from a reference image. Set dither_ to true
-to enable dithering. Set measureError_ to true in
-order to evaluate quantization error.
Create a composite image by combining several
-separate image frames. Multiple frames may be generated in the output
-container montageImages_ depending on the tile setting and the
-number of image frames montaged. Montage options are provided via the
-parameter montageOpts_ . Options set in the first image frame ( backgroundColor,borderColor , matteColor , penColor,font,
-and fontPointsize ) are also used
-as options by montageImages().
Morph a seqence of image frames. This
-algorithm expands the number of image frames (output to the
-container morphedImages_) by adding the number of intervening
-frames specified by frames_ such that the original frames morph
-(blend) into each other when played as an animation.
Inlay a number of images to form a single
-coherent picture. The mosicImage_ argument is updated with a
-mosaic constructed from the image sequence represented by first_
-through last_ .
Read a sequence of image frames into existing
-container (appending to container sequence_) with image names
-specified in the UTF-8 string imageSpec_.
Write images in container to file specified
-by string imageSpec_. Set adjoin_ to false to write a
-set of image frames via a wildcard imageSpec_ (e.g.
-image%02d.miff).
-The wildcard must be one of %0Nd, %0No, or %0Nx.
- Caution: if
-an image format is selected which is capable of supporting fewer colors
-than the original image or quantization has been requested, the original
-image will be quantized to fewer colors. Use a copy of the original if
-this is a problem.
Write images in container to in-memory BLOB
-specified by Blob blob_. Set adjoin_ to false to
-write a set of image frames via a wildcard imageSpec_ (e.g.
-image%02d.miff).
- Caution: if an
-image format is selected which is capable of supporting fewer colors
-than the original image or quantization has been requested, the original
-image will be quantized to fewer colors. Use a copy of the original if
-this is a problem.
-
-
-
-
In addition, we support these yet to be documented methods: combineImages(), evaluateImages(), mergeImageLayers(), optimizeImageLayers(), optimizePlusImageLayers(), and separateImages().
-
-
-
-
Magick++ Unary Function Objects
-
-Magick++ unary function objects inherit from the STL unary_function
-template class . The STL unary_function template class is of the form
-
unary_function<Arg, Result>
-and expects that derived classes implement a method of the form:
-
Result operator()( Arg argument_);
-which is invoked by algorithms using the function object. In the case
-of unary function objects defined by Magick++, the invoked function
-looks like:
-
void operator()( Image &image_);
-with a typical implementation looking similar to:
-
-where contrast is an Image method and _sharpen is an
-argument stored within the function object by its contructor. Since
-constructors may be polymorphic, a given function object may have
-several constructors and selects the appropriate Image method based on
-the arguments supplied.
-
In essence, unary function objects (as provided by Magick++) simply
-provide the means to construct an object which caches arguments for
-later use by an algorithm designed for use with unary function objects.
-There is a unary function object corresponding each algorithm provided
-by the Image class and there is a contructor
-available compatable with each synonymous method in the Image class.
-
The unary function objects that Magick++ provides to support
-manipulating images are shown in the following table:
-
-
-
Magick++ Unary Function Objects For Image Manipulation
Apply adaptive thresholding to
-the image. Adaptive thresholding is useful if the ideal threshold level
-is not known in advance, or if the illumination gradient is not constant
-across the image. Adaptive thresholding works by evaulating the mean
-(average) of a pixel region (size specified by width and height)
-and using the mean as the thresholding value. In order to remove
-residual noise from the background, the threshold may be adjusted by
-subtracting a constant offset (default zero) from the mean to
-compute the threshold.
-
Annotate with text using specified text,
-bounding area, placement gravity, and rotation. If boundingArea_
-is invalid, then bounding area is entire image.
Annotate with text using specified text,
-bounding area, placement gravity, and rotation. If boundingArea_
-is invalid, then bounding area is entire image.
Blur image. The radius_ parameter specifies
-the radius of the Gaussian, in pixels, not counting the center
-pixel. The sigma_ parameter specifies the standard deviation of
-the Laplacian, in pixels.
Charcoal effect image (looks like charcoal
-sketch). The radius_ parameter specifies the radius of the Gaussian, in
-pixels, not counting the center pixel. The sigma_ parameter
-specifies the standard deviation of the Laplacian, in pixels.
Colorize image with pen color, using
-specified percent opacity.
-
-
-
-
commentImage
-
-
const std::string &comment_
-
Comment image (add comment string to
-image). By default, each image is commented with its file name.
-Use this method to assign a specific comment to the
-image. Optionally you can include the image filename, type, width,
-height, or other image attributes by embedding special format characters.
Draw shapes or text on image using a set of
-Drawable objects contained in an STL list. Use of this method improves
-drawing performance and allows batching draw objects together in a list
-for repeated use.
-
-
-
-
edgeImage
-
-
size_t radius_ = 0.0
-
Edge image (hilight edges in image).
-The radius is the radius of the pixel neighborhood.. Specify a radius
-of zero for automatic radius selection.
Emboss image (hilight edges with 3D effect).
-The radius_ parameter specifies the radius of the Gaussian, in pixels,
-not counting the center pixel. The sigma_ parameter specifies the
-standard deviation of the Laplacian, in pixels.
-
-
-
-
enhanceImage
-
-
void
-
Enhance image (minimize noise)
-
-
-
-
equalizeImage
-
-
void
-
Equalize image (histogram equalization)
-
-
-
-
flipImage
-
-
void
-
Flip image (reflect each scanline in the
-vertical direction)
Flood-fill color across pixels
-that match the color of the target pixel and are neighbors of the
-target pixel. Uses current fuzz setting when determining color match.
ssize_t x_, ssize_t y_, const Color &fillColor_, const Color
-&borderColor_
-
Flood-fill color across pixels
-starting at target-pixel and stopping at pixels matching specified
-border color. Uses current fuzz setting when determining color match.
-
-
-
const Geometry
-&point_, const Color &fillColor_, const Color &borderColor_
Flood-fill texture across pixels
-that match the color of the target pixel and are neighbors of the
-target pixel. Uses current fuzz setting when determining color match.
ssize_t x_, ssize_t y_, const Image
-&texture_, const Color &borderColor_
-
Flood-fill texture across pixels
-starting at target-pixel and stopping at pixels matching specified
-border color. Uses current fuzz setting when determining color match.
-
-
-
const Geometry
-&point_, const Image &texture_, const Color
-&borderColor_
-
-
-
-
flopImage
-
-
void
-
Flop image (reflect each scanline in the
-horizontal direction)
Gamma correct red, green, and blue channels
-of image.
-
-
-
-
gaussianBlurImage
-
-
double width_, double sigma_
-
Gaussian blur image. The number of neighbor
-pixels to be included in the convolution mask is specified by
-'width_'. For example, a width of one gives a (standard) 3x3
-convolution mask. The standard deviation of the gaussian bell curve is
-specified by 'sigma_'.
implements the inverse discrete Fourier transform (DFT) of the image either as a magnitude / phase or real / imaginary image pair.
-
-
-
-
labelImage
-
-
const string &label_
-
Assign a label to an image. Use this option
-to assign a specific label to the image. Optionally
-you can include the image filename, type, width, height, or scene
-number in the label by embedding special
-format characters. If the first character of string is @, the image
-label is read from a file titled by the remaining characters in the
-string. When converting to Postscript, use this option to specify
-a header string to print above the image.
Level image. Adjust the
-levels of the image by scaling the colors falling between specified
-white and black points to the full available quantum range. The
-parameters provided represent the black, mid (gamma), and white
-points. The black point specifies the darkest color in the image.
-Colors darker than the black point are set to zero. Mid point (gamma)
-specifies a gamma correction to apply to the image. White point
-specifies the lightest color in the image. Colors brighter than
-the white point are set to the maximum quantum value. The black and
-white point have the valid range 0 to QuantumRange while mid (gamma) has a
-useful range of 0 to ten.
Level image channel.
-Adjust the levels of the image channel by scaling the values falling
-between specified white and black points to the full available quantum
-range. The parameters provided represent the black, mid (gamma), and
-white points. The black point specifies the darkest color in the image.
-Colors darker than the black point are set to zero. Mid point (gamma)
-specifies a gamma correction to apply to the image. White point
-specifies the lightest color in the image. Colors brighter than the
-white point are set to the maximum quantum value. The black and white
-point have the valid range 0 to QuantumRange while mid (gamma) has a useful
-range of 0 to ten.
Extract layer from image. Use this option to
-extract a particular layer from the image. MatteLayer,
-for example, is useful for extracting the opacity values from an
-image.
Remap image colors with closest color from
-reference image. Set dither_ to true in to apply Floyd/Steinberg
-error diffusion to the image. By default, color reduction chooses an
-optimal set of colors that best represent the original
-image. Alternatively, you can choose a
-particular set of colors from an image file
-with this option.
-
-
-
-
matteFloodfill-
- Image
-
-
const Color
-&target_, unsigned int matte_, ssize_t x_, ssize_t y_, PaintMethod method_
-
Floodfill designated area with a matte value
-
-
-
medianFilterImage
-
const double radius_ = 0.0
-
Filter image by replacing each pixel
-component with the median color in a circular neighborhood
Modulate percent hue, saturation, and
-brightness of an image. Modulation of
-saturation and brightness is as a ratio of the current value (100.0 for no
-change). Modulation of hue is an absolute rotation of -180 degrees to
-+180 degrees from the current position corresponding to an argument
-range of 0 to 200.0 (100.0 for no change).
-
-
-
-
negateImage
-
-
bool grayscale_ = false
-
Negate colors in image. Replace every
-pixel with its complementary color (white becomes black, yellow becomes
-blue, etc.). Set grayscale to only negate grayscale values in
-image.
-
-
-
-
normalizeImage
-
-
void
-
Normalize image (increase contrast by
-normalizing the pixel values to span the full range of color values).
-
-
-
-
oilPaintImage
-
-
size_t radius_ = 3
-
Oilpaint image (image looks like oil painting)
-
-
-
-
opacityImage
-
-
size_t opacity_
-
Set or attenuate the opacity channel in the
-image. If the image pixels are opaque then they are set to the specified
-opacity value, otherwise they are blended with the supplied opacity
-value. The value of opacity_ ranges from 0 (completely opaque) to QuantumRange.
-The defines OpaqueOpacity and TransparentOpacity are
-available to specify completely opaque or completely transparent,
-respectively.
-
-
-
-
opaqueImage
-
-
const Color
-&opaqueColor_, const Color &penColor_
-
Change color of pixels matching opaqueColor_
-to specified penColor_.
-
-
-
-
quantizeImage
-
-
bool measureError_ = false
-
Quantize image (reduce number of colors). Set
-measureError_ to true in order to calculate error attributes.
Segment (coalesce similar image components)
-by analyzing the histograms of the color components and identifying
-units that are homogeneous with the fuzzy c-means technique. Also uses quantizeColorSpace
-and verbose image attributes. Specify clusterThreshold_ ,
-as the number of pixels each cluster must exceed
-the cluster threshold to be considered valid. SmoothingThreshold_
-eliminates noise in the second derivative of the histogram. As the
-value is increased, you can expect a smoother
-second derivative. The default is 1.5.
Shade image using distant light source.
-Specify azimuth_ and elevation_ as the
-position of the light source. By default, the shading
-results as a grayscale image.. Set colorShading_ to true to
-shade the red, green, and blue components of the image.
Sharpen pixels in image. The radius_
-parameter specifies the radius of the Gaussian, in pixels, not counting
-the center pixel. The sigma_ parameter specifies the standard
-deviation of the Laplacian, in pixels.
Shear image (create parallelogram by sliding
-image by X or Y axis). Shearing slides one edge of an image along
-the X or Y axis, creating a
-parallelogram. An X direction shear slides an edge along the X
-axis, while a Y direction shear slides an
-edge along the Y axis. The amount of the shear is controlled by a
-shear angle. For X direction shears, x degrees
-is measured relative to the Y axis, and similarly, for Y direction
-shears y degrees is measured relative to the X axis. Empty
-triangles left over from shearing the image are filled
-with the color defined as borderColor.
-
-
-
-
solarizeImage
-
-
double factor_
-
Solarize image (similar to effect seen when
-exposing a photographic film to light during the development process)
-
-
-
-
spreadImage
-
-
size_t amount_ = 3
-
Spread pixels randomly within image by
-specified amount
Function objects are available to set attributes on image frames
-which are equivalent to methods in the Image object. These function
-objects allow setting an option across a range of image frames using f
-or_each().
-
The following code is an example of how the color 'red' may be set
-to transparent in a GIF animation:
The available function objects for setting image attributes are
-
-
-
Image Attributes
-
-
-
Attribute
-
-
-
Type
-
-
-
Constructor Signature(s)
-
-
-
Description
-
-
-
-
-
adjoinImage
-
-
bool
-
bool flag_
-
Join images into a single multi-image file.
-
-
-
-
antiAliasImage
-
-
bool
-
bool flag_
-
Control antialiasing of rendered Postscript
-and Postscript or TrueType fonts. Enabled by default.
-
-
-
-
animation-
- DelayImage
-
-
size_t (0 to 65535)
-
size_t delay_
-
Time in 1/100ths of a second (0 to 65535)
-which must expire before displaying the next image in an animated
-sequence. This option is useful for regulating the animation of a
-sequence of GIF images within Netscape.
-
-
-
-
animation-
- IterationsImage
-
-
size_t
-
size_t iterations_
-
Number of iterations to loop an animation
-(e.g. Netscape loop extension) for.
Chromaticity blue primary point (e.g. x=0.15,
-y=0.06)
-
-
-
-
chroma-
- GreenPrimaryImage
-
-
double x & y
-
double x_, double y_
-
Chromaticity green primary point (e.g. x=0.3,
-y=0.6)
-
-
-
-
chroma-
- RedPrimaryImage
-
-
double x & y
-
double x_, double y_
-
Chromaticity red primary point (e.g. x=0.64,
-y=0.33)
-
-
-
-
chroma-
- WhitePointImage
-
-
double x & y
-
double x_, double y_
-
Chromaticity white point (e.g. x=0.3127,
-y=0.329)
-
-
-
-
colorFuzzImage
-
-
double
-
double fuzz_
-
Colors within this distance are considered
-equal. A number of algorithms search for a target color. By
-default the color must be exact. Use this option to match colors that
-are close to the target color in RGB space.
Vertical and horizontal resolution in pixels
-of the image. This option specifies an image density when decoding a
-Postscript or Portable Document page. Often used with psPageSize.
-
-
-
-
depthImage
-
-
size_t (8 or 16)
-
size_t depth_
-
Image depth. Used to specify the bit depth
-when reading or writing raw images or thwn the output format
-supports multiple depths. Defaults to the quantum depth that
-ImageMagick is compiled with.
Filter to use when resizing image. The
-reduction filter employed has a sigificant effect on the time required
-to resize an image and the resulting quality. The default filter is Lanczos
-which has been shown to produce good results when reducing images.
-
-
-
-
fontImage
-
-
std::string
-
const std::string &font_
-
Text rendering font. If the font is a fully
-qualified X server font name, the font is obtained from an X
-server. To use a TrueType font, precede the TrueType filename with an @.
-Otherwise, specify a Postscript font name (e.g.
-"helvetica").
-
-
-
-
fontPointsize-
- Image
-
-
size_t
-
size_t pointSize_
-
Text rendering font point size
-
-
-
-
gifDispose-
- MethodImage
-
-
size_t
- { 0 = Disposal not specified,
- 1 = Do not dispose of graphic,
- 3 = Overwrite graphic with background color,
- 4 = Overwrite graphic with previous graphic. }
-
size_t disposeMethod_
-
layer disposal method. This option is used to
-control how successive frames are rendered (how the preceding frame is
-disposed of) when creating a GIF animation.
The type of interlacing scheme (default NoInterlace
-). This option is used to specify the type of interlacing
-scheme for raw image formats such as RGB or YUV. NoInterlace
-means do not interlace, LineInterlace uses scanline
-interlacing, and PlaneInterlace uses plane interlacing.
-PartitionInterlace is like PlaneInterlace except the
-different planes are saved to individual files (e.g.
-image.R, image.G, and image.B). Use LineInterlace or PlaneInterlace
-to create an interlaced GIF or progressive JPEG image.
-
-
-
-
isValidImage
-
-
bool
-
bool isValid_
-
Set image validity. Valid images become empty
-(inValid) if argument is false.
-
-
-
-
labelImage
-
-
std::string
-
const std::string &label_
-
Image label
-
-
-
-
lineWidthImage
-
-
double
-
double lineWidth_
-
Line width for drawing lines, circles,
-ellipses, etc. See Drawable .
-
-
-
-
magickImage
-
-
std::string
-
const std::string &magick_
-
Get image format (e.g. "GIF")
-
-
-
-
matteImage
-
-
bool
-
bool matteFlag_
-
True if the image has transparency. If set
-True, store matte channel if the image has one otherwise create
-an opaque one.
Preferred size and location of an image
-canvas.
-
Use this option to specify the dimensions and
-position of the Postscript page in dots per inch or a TEXT page in
-pixels. This option is typically used in concert with density.
-
Page may also be used to position a GIF image
-(such as for a scene in an animation)
Postscript page size. Use this option
-to specify the dimensions of the Postscript page in dots per inch
-or a TEXT page in pixels. This option is typically used in concert with density.
-
-
-
-
qualityImage
-
-
size_t (0 to 100)
-
size_t quality_
-
JPEG/MIFF/PNG compression level (default 75).
-
-
-
-
quantize-
- ColorsImage
-
-
size_t
-
size_t colors_
-
Preferred number of colors in the image. The
-actual number of colors in the image may be less than your request, but
-never more. Images with less unique colors than specified with this
-option will have any duplicate or unused colors removed.
Colorspace to quantize colors in (default
-RGB). Empirical evidence suggests that distances in color spaces such
-as YUV or YIQ correspond to perceptual color differences more closely
-than do distances in RGB space. These color spaces may give better
-results when color reducing an image.
-
-
-
-
quantize-
- DitherImage
-
-
bool
-
bool flag_
-
Apply Floyd/Steinberg error diffusion to the
-image. The basic strategy of dithering is to trade intensity
-resolution for spatial resolution by
-averaging the intensities of several
-neighboring pixels. Images which suffer from
-severe contouring when reducing colors can be improved
-with this option. The quantizeColors or monochrome option must be set
-for this option to take effect.
-
-
-
-
quantize-
- TreeDepthImage
-
-
size_t (0 to 8)
-
size_t treeDepth_
-
Depth of the quantization color
-classification tree. Values of 0 or 1 allow selection of the optimal
-tree depth for the color reduction algorithm. Values between 2 and 8 may
-be used to manually adjust the tree depth.
Width and height of a raw image (an image
-which does not support width and height information). Size may
-also be used to affect the image size read from a multi-resolution
-format (e.g. Photo CD, JBIG, or JPEG.
X11 display to display to, obtain fonts from,
-or to capture image from
-
-
-
-
-
-
-
Query Image Format Support
-
-
Magick++ provides the coderInfoList()
-function to support obtaining information about the image formats
-supported by ImageMagick. Support for image formats in ImageMagick
-is provided by modules known as "coders". A user-provided container is
-updated based on a boolean truth-table match. The truth-table supports
-matching based on whether ImageMagick can read the format, write the
-format, or supports multiple frames for the format. A wildcard specifier
-is supported for any "don't care" field. The data obtained via
-coderInfoList() may be useful for preparing GUI dialog boxes or for
-deciding which output format to write based on support within the
-ImageMagick build.
The following example shows how to retrieve a list of all of the
-coders which support reading images and print the coder attributes (all
-listed formats will be readable):
Magick++ provides the colorHistogram template function to
-retrieve a color histogram from an image. A color histogram provides a
-count of how many times each color occurs in the image. The histogram is
-written into a user-provided container, which (for example) could be a <vector> or a <map>. When a
-<map> is used, the Color
-is used as the key so that quick lookups of usage counts for colors may
-be performed. Writing into a <map>
-may be slower than writing into a <vector>
-since the <map> sorts the
-entries (by color intensity) and checks for uniqueness. Each histogram
-entry is contained in type std::pair<Magick::Color,unsigned
-long>with the first
-member of the pair being a Color,
-and the second member of the pair being an 'unsigned long'. Use the <pair> "first" member to access the Color
-and the "second" member to
-access the number of times the color occurs in the image.
-
The template function declaration is as follows:
-
The following examples illustrate using both a <map> and a
-<vector> to retrieve the color histogram, and print out a
-formatted summary.
-
-Using <map>:
-
-
The TypeMetric class provides the means to pass data from the Image class's TypeMetric method to the user. It provides information regarding font metrics such as ascent, descent, text width, text height, and maximum horizontal advance. The units of these font metrics are in pixels, and that the metrics are dependent on the current Image font (default Ghostscript's "Helvetica"), pointsize (default 12 points), and x/y resolution (default 72 DPI) settings.
-
The pixel units may be converted to points (the standard resolution-independent measure used by the typesetting industry) via the following equation:
-
-size_points = (size_pixels * 72)/resolution
-
-
where resolution is in dots-per-inch (DPI). This means that at the default image resolution, there is one pixel per point.
-
Note that a font's pointsize is only a first-order approximation of the font height (ascender + descender) in points. The relationship between the specified pointsize and the rendered font height is determined by the font designer.
The programs on these pages show how to use the ImageMagick
- MagickWand API. Each example is presented as a C
- function, complete with headers, so that it can be copied to a file and
- then included in your own C project. The code is written for Windows and was
- compiled using MSVC V7 but, with a little tweaking, it should
- also run on Linux.
-
Some of the examples show a command line "program" and how to achieve the equivalent output using MagickWand.
- By "equivalent" I mean that the program produces the
- same image as the command line example - it won't necessarily be exactly how it is achieved by the convert program.
- In some cases there is only one command line
- example to replicate but in others there can be 3 or 4 commands which
- build on each other to produce a final result. In most of these cases I
- have created one C function which replicates all the commands but each
- section of code will show how it relates to the original commands.
-
-
- There is little or no error checking in the examples but
- you should add your own where needed. For example, the MagickReadImage
- function returns a true or false value depending upon whether the read succeeded and
- you should check this using code similar to this:
You should note that there are a lot of
- MagickWand functions which are declared as returning a boolean result
- but which will
- always return MagickTrue and are therefore not worth checking.
- This is particularly true with the DrawingWand commands.
- For example, even if DrawSetFont
- doesn't find the font you specify, it will return MagickTrue because it will set
- the font to your default system font.
-
-
-
-
If you haven't used MagickWand
- before, you should start with something easy such as this:
-
• logo_1.c
- A simple starter. Convert the builtin logo: image to JPG.
-
- It is easy to see that to make this convert
- one of your own input files to another format you just replace "logo:"
- with your input filename and replace "logo.jpg" with whatever output filename you
- wish.
-
The MagickReadImage function is very versatile. It will
- accept a website URL which links to an image somewhere on the internet or
- it can generate a plain coloured canvas using the "xc:" filename
- convention. E.G. "xc:red" will create a red canvas and "xc:none" will
- create a transparent canvas. If you use the "xc:" format you will usually
- precede the read function with a call to MagickSetSize otherwise you will
- get a 1x1 pixel image. It is worthwhile to read the "pseudo Image" and "Built-in Images" sections near the bottom of the
- ImageMagick Formats page to see what other pseudo files are available.
-
- Just in case you are deciding whether to use MagickCore instead of MagickWand, first
- look at the simple example I showed in the previous paragraph and then look at
- the equivalent written for MagickCore:
-
• MagickCore.c
- The simple starter program written for MagickCore.
-
I think you'll
- agree that even in this simple example, the MagickWand version is much easier to
- read and write.
-
-
-
All of this code is provided AS IS with NO warranty or guarantee of any kind
-
Each image is shown on a gray background to show transparent images better
-
Here's an INDEX of the MagickWand functions used in each example
-
-
-
Resize an image to 50% using a Lanczos filter and save as high-quality JPG
- • resize.c
- • Image
-
-
-
-
Extend the canvas around an image.
- • extent.c
- • Image
-
-
Simple floodfill to change an image's white background to transparent.
- • floodfill.c
- • Image
-
-
ImageMagick utilizes multiple computational threads to increase performance and can read, process, or write mega-, giga-, or tera-pixel image sizes.
-
ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license.
-
-
The ImageMagick development process ensures a stable API and ABI. Before each ImageMagick release, we perform a comprehensive security assessment that includes memory error and thread data race detection to help prevent security vulnerabilities.
certain algorithms are OpenCL-enabled to take advantage of speed-ups offered by executing in concert across heterogeneous platforms consisting of CPUs, GPUs, and other processors.
accurately represent the wide range of intensity levels found in real scenes ranging from the brightest direct sunlight to the deepest darkest shadows.
map visually identical images to the same or similar hash-- useful in image retrieval, authentication, indexing, or copy detection as well as digital watermarking.
convenient access to pixels outside the image boundaries.
-
-
-
-
-
Examples of ImageMagick Usage shows how to use ImageMagick from the command-line to accomplish any of these tasks and much more. Also, see Fred's ImageMagick Scripts: a plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations. With Magick.NET, use ImageMagick without having to install ImageMagick on your server or desktop.
-
-
News
-
-
Now that ImageMagick version 7 is released, we continue to maintain the legacy release of ImageMagick, version 6, at https://legacy.imagemagick.org. Learn how ImageMagick version 7 differs from previous versions with our porting guide.
-
-
ImageMagick best practices strongly encourages you to configure a security policy that suits your local environment.
-
-
As an analog to linear (RGB) and non-linear (sRGB) color colorspaces, as of ImageMagick 7.0.7-17, we introduce the LinearGray colorspace. Gray is non-linear grayscale and LinearGray is linear (e.g. -colorspace linear-gray).
-
-
Want more performance from ImageMagick? Try these options:
If these options are prohibitive, you can reduce the quality of the image results. The default build is Q16 HDRI. If you disable HDRI, you use half the memory and instead of predominately floating point operations, you use the typically more efficient integer operations. The tradeoff is reduced percision and you cannot process out of range pixel values (e.g. negative). If you build the Q8 non-HDRI version of ImageMagick, you again reduce the memory requirements in half-- and once again there is a tradeoff, even less percision and no out of range pixel values. For a Q8 non-HDRI build of ImageMagick, use these configure script options: --with-quantum-depth=8 --disable-hdri.
-
-
Community
-
To join the ImageMagick community, try the discourse server. You can review questions or comments (with informed responses) posed by ImageMagick users or ask your own questions. If you want to contribute image processing algorithms, other enhancements, or bug fixes, open an issue.
ImageMagick utilizes multiple computational threads to increase performance and can read, process, or write mega-, giga-, or tera-pixel image sizes.
-
ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license.
-
-
The ImageMagick development process ensures a stable API and ABI. Before each ImageMagick release, we perform a comprehensive security assessment that includes memory error and thread data race detection to help prevent security vulnerabilities.
certain algorithms are OpenCL-enabled to take advantage of speed-ups offered by executing in concert across heterogeneous platforms consisting of CPUs, GPUs, and other processors.
accurately represent the wide range of intensity levels found in real scenes ranging from the brightest direct sunlight to the deepest darkest shadows.
map visually identical images to the same or similar hash-- useful in image retrieval, authentication, indexing, or copy detection as well as digital watermarking.
convenient access to pixels outside the image boundaries.
-
-
-
-
-
Examples of ImageMagick Usage shows how to use ImageMagick from the command-line to accomplish any of these tasks and much more. Also, see Fred's ImageMagick Scripts: a plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations. With Magick.NET, use ImageMagick without having to install ImageMagick on your server or desktop.
-
-
News
-
-
Now that ImageMagick version 7 is released, we continue to maintain the legacy release of ImageMagick, version 6, at https://legacy.imagemagick.org. Learn how ImageMagick version 7 differs from previous versions with our porting guide.
-
-
ImageMagick best practices strongly encourages you to configure a security policy that suits your local environment.
-
-
As an analog to linear (RGB) and non-linear (sRGB) color colorspaces, as of ImageMagick 7.0.7-17, we introduce the LinearGray colorspace. Gray is non-linear grayscale and LinearGray is linear (e.g. -colorspace linear-gray).
-
-
Want more performance from ImageMagick? Try these options:
If these options are prohibitive, you can reduce the quality of the image results. The default build is Q16 HDRI. If you disable HDRI, you use half the memory and instead of predominately floating point operations, you use the typically more efficient integer operations. The tradeoff is reduced percision and you cannot process out of range pixel values (e.g. negative). If you build the Q8 non-HDRI version of ImageMagick, you again reduce the memory requirements in half-- and once again there is a tradeoff, even less percision and no out of range pixel values. For a Q8 non-HDRI build of ImageMagick, use these configure script options: --with-quantum-depth=8 --disable-hdri.
-
-
Community
-
To join the ImageMagick community, try the discourse server. You can review questions or comments (with informed responses) posed by ImageMagick users or ask your own questions. If you want to contribute image processing algorithms, other enhancements, or bug fixes, open an issue.