Last update Sun May 11 01:02:36 2014


A class to expose ImageInfo QuantizeInfo and DrawInfo

zlib (See accompanying LICENSE file)

Mike Wey

alias DitherMethod = dmagick.c.quantize.DitherMethod;

See Also:

class Options;

A class that wraps ImageInfo, DrawInfo and QuantizeInfo

void adjoin(bool flag);
const bool adjoin();

Join images into a single multi-image file.

void backgroundColor(string color);
void backgroundColor(Color color);
const Color backgroundColor();

Set the image background color. The default is "white".

void backgroundTexture(string str);
const string backgroundTexture();

Set a texture to tile onto the image background. Corresponds to the -texture option to ImageMagick's convert and mogrify commands.

void borderColor(string color);
void borderColor(Color color);
const Color borderColor();

Set the image border color. The default is "#dfdfdf".

void colorspace(ColorspaceType space);
const ColorspaceType colorspace();

Specifies the image pixel interpretation.

void compression(CompressionType compress);
const CompressionType compression();

Specifies the type of compression used when writing the image. Only some image formats support compression. For those that do, only some compression types are supported. If you specify an compression type that is not supported, the default compression type (usually NoCompression) is used instead.

void define(string format, string key, string value = "");

Define an option. Use this method to set options for reading or writing certain image formats. The list of supported options changes from release to release. For a list of the valid image formats, keys, and values, refer to the documentation for the -define option for the release of ImageMagick installed on your system.


string format An image format name such as "ps" or "tiff".
string key A string that identifies the option.
vaule The value of the option.

void undefine(string format, string key);

Delete an option definition set by define. This is not the same as setting the option to a null value. The undefine method removes the option name from the list of options for the specified format. format = An image format name such as "ps" or "tiff". key = A string that identifies the option.

void density(string str);
void density(Geometry geometry);
const Geometry density();

Specifies the vertical and horizontal resolution in pixels. The default density is "72.0x72.0". This attribute can be used when writing JBIG, PCL, PS, PS2, and PS3 format images.

This attribute can also be used to specify the width and height of HISTOGRAM format images. For HISTOGRAM, the default is 256x200.

void depth(size_t d);
const size_t depth();

Specifies the image depth

Either 8, 16, or 32. You can specify 16 and 32 only when ImageMagick was compiled with a QuantumDepth that allows these depth values.

void dither(bool d);
const size_t dither();

This attribute can be used when writing GIF images.

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.

void endian(EndianType type);
const EndianType endian();

Specify the endianess of the image when reading the image file.

void file(FILE* f);
FILE* file();

Image file descriptor.

void filename(string str);
const string filename();

Image filename/path.

void font(string str);
const string font();

The font name or filename. You can tag a font to specify whether it is a Postscript, Truetype, or OPTION1 font. For example, Arial.ttf is a Truetype font, ps:helvetica is Postscript, and x:fixed is OPTION1.

The font name can be a complete filename such as "/mnt/windows/windows/fonts/Arial.ttf". The font name can also be a fully qualified X font name such as "-urw-times-medium-i-normal--0-0-0-0-p-0-iso8859-13".

void fontSize(double size);
const double fontSize();

Text rendering font point size

void fuzz(double f);
const 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.

void interlace(InterlaceType type);
const InterlaceType interlace();

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. The default is NoInterlace.

void magick(string str);
const string magick();

Image format (e.g. "GIF")

void matteColor(string color);
void matteColor(Color color);
const Color matteColor();

Set the image transparent color. The default is "#bdbdbd".

void monochrome(bool m);
const bool monochrome();

Transform the image to black and white on input. Only the EPT, PDF, and PS formats respect this attribute.

void page(string str);
void page(Geometry geometry);
const Geometry page();

Use this option to specify the dimensions and position of the Postscript page in dots per inch or 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) The default is "612x792"

void quality(size_t q);
const size_t quality();

The compression level for JPEG, MPEG, JPEG-2000, MIFF, MNG, and PNG image format. The default is 75

void resolutionUnits(ResolutionType type);
const ResolutionType resolutionUnits();

Units of image resolution.

void samplingFactor(string str);
const string samplingFactor();

sampling factors used by JPEG or MPEG-2 encoder and YUV decoder/encoder.

This attribute specifies the sampling factors to be used by the JPEG encoder for chroma downsampling. If this attribute is omitted, the JPEG library will use its own default values. When reading or writing the YUV format and when writing the M2V (MPEG-2) format, use sampling-factor="2x1" to specify the 4:2:2 downsampling method.

void size(string str);
void size(Geometry geometry);
const Geometry size();

Set the width and height of the image when reading a built-in image format that does not have an inherent size, or when reading an image from a multi-resolution file format such as Photo CD, JBIG, or JPEG.

void subImage(size_t num);
const size_t subImage();

Subimage of an image sequence

void subRange(size_t num);
const size_t subRange();

Number of images relative to the base image

void type(ImageType t);
const ImageType type();

Image type.

void verbose(bool v);
const bool verbose();

Print detailed information about the image.

void view(string str);
const string view();

FlashPix viewing parameters.

void virtualPixelMethod(VirtualPixelMethod method);
const VirtualPixelMethod virtualPixelMethod();

Image virtual pixel method.

void x11Display(string str);
const string x11Display();

X11 display to display to obtain fonts from or, to capture image from.

void transformOrigin(double tx, double ty);

Origin of coordinate system to use when annotating or drawing

void transformRotation(double angle);

Rotation to use when annotating or drawing

void transformScale(double sx, double sy);

Scale to use when annotating or drawing

void transformShearX(double skewx);

Shear to use in X axis when annotating or drawing

void transformShearY(double skewy);

Shear to use in X axis when annotating or drawing

void transformReset();

Reset transformation parameters to default

AffineMatrix multiplyMatrix(AffineMatrix a, AffineMatrix b);

Returns the product of two Affine matrices The AffineMatrix looks like this:

| sx rx 0 |
| ry sy 0 |
| tx ty 1 |

void antialias(bool antialias);
const bool antialias();

Control antialiasing of rendered Postscript and Postscript or TrueType fonts. The default is true.

void boxColor(string color);
void boxColor(Color color);
const Color boxColor();

If set, causes the text to be drawn over a box of the specified color.

void fillColor(string color);
void fillColor(Color color);
const Color fillColor();

Color to use when filling drawn objects. The default is "black".

void fillPattern(dmagick.Image.Image pattern);
const const(dmagick.Image.Image) fillPattern();

Pattern image to use when filling drawn objects.

void fillRule(FillRule rule);
const FillRule fillRule();

Rule to use when filling drawn objects.

void fontFamily(string type);
const string fontFamily();

Specify the font family, such as "arial" or "helvetica".

void fontStretch(StretchType type);
const StretchType fontStretch();

Specify the spacing between text characters.

void fontStyle(StyleType type);
const StyleType fontStyle();

Specify the font style, i.e. italic, oblique, or normal.

void fontWeight(size_t weight);
const size_t fontWeight();

Specify the font weight.

void strokeAntialias(bool antialias);
const bool strokeAntialias();

Enable or disable anti-aliasing when drawing object outlines.

void strokeColor(string color);
void strokeColor(Color color);
const Color strokeColor();

Color to use when drawing object outlines.

void strokeDashOffset(double offset);
const double strokeDashOffset();

The initial distance into the dash pattern. The units are pixels.

void strokeDashPattern(const(double)[] pattern);
const double[] strokeDashPattern();

Describe a pattern of dashes to be used when stroking paths. The arguments are a list of pixel widths of alternating dashes and gaps. All elements must be > 0.

void strokeLineCap(LineCap cap);
const LineCap strokeLineCap();

Specify how the line ends should be drawn.

void strokeLineJoin(LineJoin join);
const LineJoin lineJoin();

Specify how corners are drawn.

void strokeMiterlimit(size_t limit);
const size_t strokeMiterlimit();

Specify a constraint on the length of the "miter" formed by two lines meeting at an angle. If the angle if very sharp, the miter could be very long relative to the line thickness. The miter limit is a limit on the ratio of the miter length to the line width. The default is 4.

void strokePattern(dmagick.Image.Image pattern);
const const(dmagick.Image.Image) strokePattern();

Pattern image to use while drawing object stroke

void strokeWidth(double width);
const double strokeWidth();

Stroke width for use when drawing vector objects

void textDensity(string str);
void textDensity(Geometry geometry);
const Geometry textDensity();

The text density in the x and y directions. The default is "72x72".

void textEncoding(string str);
const string textEncoding();

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 ASCII encoding. Successful text annotation using Unicode may require fonts designed to support Unicode. The default is "UTF-8"

void quantizeColors(size_t colors);
const size_t quantizeColors();

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.

void quantizeColorSpace(ColorspaceType type);
const ColorspaceType quantizeColorSpace();

Colorspace to quantize colors in. 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. The default is RGB

void quantizeDitherMethod(DitherMethod method);
const DitherMethod quantizeDitherMethod();

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.

void quantizeTreeDepth(size_t depth);
const size_t quantizeTreeDepth();

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.